All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ItemGroup.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file ItemGroup.h
22 
23  \brief Class that represents the grouping of objects of type QGraphicsItem, MVC components.
24  Its coordinate system is the same of scene (millimeters).
25  He is also the son of ItemObserver and ObjectItem, so it can become observer of a model (Observable).
26 
27  \ingroup layout
28 */
29 
30 #ifndef __TERRALIB_LAYOUT_INTERNAL_ITEMGROUP_H
31 #define __TERRALIB_LAYOUT_INTERNAL_ITEMGROUP_H
32 
33 // Qt
34 #include <QGraphicsItemGroup>
35 #include <QPainter>
36 #include <QPixmap>
37 
38 // TerraLib
39 #include "../../core/pattern/mvc/ItemObserver.h"
40 #include "../../core/enum/AbstractType.h"
41 #include "../../../geometry/Envelope.h"
42 #include "../../../color/RGBAColor.h"
43 #include "../../core/Config.h"
44 
45 class QMouseEvent;
46 class QWheelEvent;
47 class QKeyEvent;
48 class QString;
49 
50 namespace te
51 {
52  namespace layout
53  {
54  /*!
55  \brief Class that represents the grouping of objects of type QGraphicsItem, MVC components.
56  Its coordinate system is the same of scene (millimeters).
57  He is also the son of ItemObserver and ObjectItem, so it can become observer of a model (Observable).
58 
59  \ingroup layout
60 
61  \sa te::layout::ItemObserver
62  */
63  class TELAYOUTEXPORT ItemGroup : public QGraphicsItemGroup, public ItemObserver
64  {
65  public:
66 
67  ItemGroup( ItemController* controller, Observable* o );
68 
69  virtual ~ItemGroup();
70 
71  virtual void updateObserver(ContextItem context);
72 
73  virtual te::gm::Coord2D getPosition();
74 
75  void setPixmap( const QPixmap& pixmap );
76 
77  virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
78 
79  virtual void addToGroup ( QGraphicsItem * item );
80 
81  virtual bool contains(const QPointF &point) const;
82 
83  void setZValue ( qreal z );
84 
85  virtual te::color::RGBAColor** getRGBAColorImage(int &w, int &h);
86 
87  protected:
88 
89  virtual void setPosition(const double& x, const double& y);
90 
91  void drawBackground( QPainter * painter );
92 
93  void drawSelection( QPainter* painter );
94 
95  virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent* event );
96 
97  virtual void mousePressEvent ( QGraphicsSceneMouseEvent* event );
98 
99  virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent* event );
100 
101  virtual int getZValueItem();
102 
103  virtual void applyRotation();
104 
105  protected:
106 
107  QPixmap m_pixmap;
108  };
109  }
110 }
111 #endif
Abstract class to represent an observable. "Model" part of MVC component.
Definition: Observable.h:56
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Definition: ContextItem.h:49
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:99
Class that represents the grouping of objects of type QGraphicsItem, MVC components. Its coordinate system is the same of scene (millimeters). He is also the son of ItemObserver and ObjectItem, so it can become observer of a model (Observable).
Definition: ItemGroup.h:63
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
Definition: ItemObserver.h:52
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
Abstract class to represent a controller. "Controller" part of MVC component. All classes representin...
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57