All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MapDisplay.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of TerraView - A GIS Application.
4 
5  TerraView is free software: you can redistribute it and/or modify
6  it under the terms of the GNU 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  TerraView 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 General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with TerraLib Code Editor. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@dpi.inpe.br>.
18  */
19 
20 /*!
21  \file terralib/qt/af/connectors/MapDisplay.h
22 
23  \brief A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
24 */
25 
26 #ifndef __TERRALIB_QT_AF_CONNECTORS_INTERNAL_MAPDISPLAY_H
27 #define __TERRALIB_QT_AF_CONNECTORS_INTERNAL_MAPDISPLAY_H
28 
29 // Terralib
30 #include "../../../maptools/AbstractLayer.h"
31 #include "../Config.h"
32 
33 // Qt
34 #include <QtCore/QObject>
35 #include <QtCore/QPoint>
36 #include <QtCore/QString>
37 #include <QtCore/QMap>
38 #include <QtGui/QColor>
39 #include <QtGui/QMenu>
40 #include <QtGui/QPixmap>
41 
42 namespace te
43 {
44  namespace da
45  {
46  class DataSet;
47  }
48 
49  namespace qt
50  {
51  namespace widgets
52  {
53  class AbstractTool;
54  class EyeBirdMapDisplayWidget;
55  class MapDisplay;
56  class ZoomInMapDisplayWidget;
57  }
58 
59  namespace af
60  {
61  namespace evt
62  {
63  // Forward declaration
64  struct Event;
65  }
66 
67  /*!
68  \class MapDisplay
69 
70  \brief A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
71 
72  It is used to listen events sent by the application framework.
73  It is a proxy for the te::qt::widgets::MapDisplay.
74  */
75  class TEQTAFEXPORT MapDisplay : public QObject
76  {
77  Q_OBJECT
78 
79  public:
80 
81  /*!
82  \brief Constructor.
83 
84  \param display te::qt::widgets::MapDisplay to be listened.
85  */
87 
88  /*! \brief destructor. */
89  ~MapDisplay();
90 
91  te::qt::widgets::MapDisplay* getDisplay();
92 
93  void setZoomInDisplay(te::qt::widgets::ZoomInMapDisplayWidget* display);
94 
95  void setEyeBirdDisplay(te::qt::widgets::EyeBirdMapDisplayWidget* display);
96 
97  bool eventFilter(QObject* watched, QEvent* e);
98 
99  /*!
100  \brief It draws the given layer list.
101 
102  \param layers The layer list.
103  */
104  void draw(const std::list<te::map::AbstractLayerPtr>& layers);
105 
106  /*! \brief It clears the map display. */
107  void clear();
108 
109  /*!
110  \brief Updates the current tool being used on te::qt::widgets::MapDisplay.
111 
112  \param tool The new te::qt::widgets::AbstractTool.
113 
114  \note The class will take the ownership of the given pointer.
115  */
116  void setCurrentTool(te::qt::widgets::AbstractTool* tool);
117 
118  void nextExtent();
119 
120  void previousExtent();
121 
122  void fit(const std::list<te::map::AbstractLayerPtr>& layers);
123 
124  protected slots:
125 
126  void onCoordTracked(QPointF& coordinate);
127 
128  void onDrawLayersFinished(const QMap<QString, QString>& errors);
129 
130  void onExtentChanged();
131 
132  /*!
133  \brief Listener to the application framewrork events.
134 
135  \param e An event sent by framework.
136  */
137  void onApplicationTriggered(te::qt::af::evt::Event* e);
138 
139  protected:
140 
141  void drawLayersSelection(const std::list<te::map::AbstractLayerPtr>& layers);
142 
143  void drawLayerSelection(te::map::AbstractLayerPtr layer);
144 
145  void drawDataSet(te::da::DataSet* dataset, int srid, const QColor& color);
146 
147  void configSRS(const std::list<te::map::AbstractLayerPtr>& layers);
148 
149  signals:
150 
151  void hasNextExtent(bool value);
152 
153  void hasPreviousExtent(bool value);
154 
155  protected:
156 
157  te::qt::widgets::MapDisplay* m_display; //!< Pointer to a component te::qt::widgets::MapDisplay.
158  te::qt::widgets::AbstractTool* m_tool; //!< Pointer to the current tool being used.
159  QMenu* m_menu; //!< The map display popup menu.
160  QPixmap m_lastDisplayContent; //!< The last map display content. i.e. a "clean" pixmap.
161  std::vector<te::gm::Envelope> m_extentStack; //!< The stack of MapDisplay extents.
162  int m_currentExtentIndex; //!< The current extent index.
163  int m_extentStackMaxSize; //!< The max size of the extent stack. Used on previousExtent and nextExtent.
164 
165  te::qt::widgets::ZoomInMapDisplayWidget* m_zoomInDisplay; //!< Pointer to a component that represents a zoom in display.
166  te::qt::widgets::EyeBirdMapDisplayWidget* m_eyeBirdDisplay; //!< Pointer to a component that represents a eye bird display.
167  };
168  }
169  }
170 }
171 
172 #endif // __TERRALIB_QT_AF_CONNECTORS_INTERNAL_MAPDISPLAY_H
te::qt::widgets::ZoomInMapDisplayWidget * m_zoomInDisplay
Pointer to a component that represents a zoom in display.
Definition: MapDisplay.h:165
te::qt::widgets::EyeBirdMapDisplayWidget * m_eyeBirdDisplay
Pointer to a component that represents a eye bird display.
Definition: MapDisplay.h:166
te::qt::widgets::AbstractTool * m_tool
Pointer to the current tool being used.
Definition: MapDisplay.h:158
QMenu * m_menu
The map display popup menu.
Definition: MapDisplay.h:159
This class defines an interface for objects that can receive application events and respond to them...
Definition: AbstractTool.h:62
te::qt::widgets::MapDisplay * m_display
Pointer to a component te::qt::widgets::MapDisplay.
Definition: MapDisplay.h:157
This class defines the map display ZoomIn, this component is only a specific map that shows the curre...
std::vector< te::gm::Envelope > m_extentStack
The stack of MapDisplay extents.
Definition: MapDisplay.h:161
QPixmap m_lastDisplayContent
The last map display content. i.e. a &quot;clean&quot; pixmap.
Definition: MapDisplay.h:160
int m_currentExtentIndex
The current extent index.
Definition: MapDisplay.h:162
A widget to control the display of a set of layers.
Definition: MapDisplay.h:65
int m_extentStackMaxSize
The max size of the extent stack. Used on previousExtent and nextExtent.
Definition: MapDisplay.h:163
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:108
A base class for application events.
Definition: Event.h:59
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:75
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:111