MapDisplay.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 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 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "../Config.h"
34 
35 // Qt
36 #include <QObject>
37 #include <QPoint>
38 #include <QString>
39 #include <QMap>
40 #include <QColor>
41 #include <QMenu>
42 #include <QPixmap>
43 
44 class QAction;
45 
46 namespace te
47 {
48  namespace da
49  {
50  class DataSet;
51  }
52 
53  namespace qt
54  {
55  namespace widgets
56  {
57  class EyeBirdMapDisplayWidget;
58  class MapDisplay;
59  class ZoomInMapDisplayWidget;
60  }
61 
62  namespace af
63  {
64  class ApplicationController;
65 
66  namespace evt
67  {
68  // Forward declaration
69  struct Event;
70  }
71 
72  /*!
73  \class MapDisplay
74 
75  \brief A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
76 
77  It is used to listen events sent by the application framework.
78  It is a proxy for the te::qt::widgets::MapDisplay.
79  */
80  class TEQTAFEXPORT MapDisplay : public QObject
81  {
82  Q_OBJECT
83 
84  public:
85 
86  /*!
87  \brief Constructor.
88 
89  \param display te::qt::widgets::MapDisplay to be listened.
90  */
92 
93  /*! \brief destructor. */
94  ~MapDisplay();
95 
96  te::qt::widgets::MapDisplay* getDisplay();
97 
98  void setZoomInDisplay(te::qt::widgets::ZoomInMapDisplayWidget* display);
99 
100  void setEyeBirdDisplay(te::qt::widgets::EyeBirdMapDisplayWidget* display);
101 
102  bool eventFilter(QObject* watched, QEvent* e);
103 
104  /*!
105  \brief It draws the given layer list.
106 
107  \param layers The layer list.
108  */
109  void draw(const std::list<te::map::AbstractLayerPtr>& layers);
110 
111  /*! \brief It clears the map display. */
112  void clear();
113 
114  void nextExtent();
115 
116  void previousExtent();
117 
118  void fit(const std::list<te::map::AbstractLayerPtr>& layers);
119 
120  protected slots:
121 
122  void onCoordTracked(QPointF& coordinate);
123 
124  void onDrawLayersFinished(const QMap<QString, QString>& errors);
125 
126  void onExtentChanged();
127 
128  /*!
129  \brief Listener to the application framewrork events.
130 
131  \param e An event sent by framework.
132  */
133  void onApplicationTriggered(te::qt::af::evt::Event* e);
134 
135  /*!
136  \brief Returns the pan selected flag;
137 
138  \return Flag of the pan to selected operation.
139  */
140  bool isPanToSelectedEnabled();
141 
142  protected:
143 
144  void drawLayersSelection(const std::list<te::map::AbstractLayerPtr>& layers);
145 
146  void drawLayerSelection(te::map::AbstractLayerPtr layer);
147 
148  void drawDataSet(te::da::DataSet* dataset, const std::string& geomPropertyName, int srid, const QColor& color, bool isLinked = false);
149 
150  void drawDataSet(te::da::DataSet* dataset, const std::string& geomPropertyName, int srid, te::se::Style* style, bool isLinked = false);
151 
152  void configSRS(const std::list<te::map::AbstractLayerPtr>& layers);
153 
154  std::list<te::map::AbstractLayerPtr> getSelectedLayer();
155 
156  signals:
157 
158  void hasNextExtent(bool value);
159 
160  void hasPreviousExtent(bool value);
161 
162  void triggered(te::qt::af::evt::Event* e);
163 
164  protected:
165 
166  std::list<te::map::AbstractLayerPtr> getVisibleLayers();
167 
168 
169  te::qt::af::ApplicationController* m_app; //!< Pointer to applicatin controller;
170  te::qt::widgets::MapDisplay* m_display; //!< Pointer to a component te::qt::widgets::MapDisplay.
171  QMenu* m_menu; //!< The map display popup menu.
172  QPixmap m_lastDisplayContent; //!< The last map display content. i.e. a "clean" pixmap.
173  std::vector<te::gm::Envelope> m_extentStack; //!< The stack of MapDisplay extents.
174  int m_currentExtentIndex; //!< The current extent index.
175  int m_extentStackMaxSize; //!< The max size of the extent stack. Used on previousExtent and nextExtent.
176 
177  te::qt::widgets::ZoomInMapDisplayWidget* m_zoomInDisplay; //!< Pointer to a component that represents a zoom in display.
178  te::qt::widgets::EyeBirdMapDisplayWidget* m_eyeBirdDisplay; //!< Pointer to a component that represents a eye bird display.
179 
180  QAction* m_pantoSelectedAction; //!< Action to enable / disable pan to selected operation.
181  };
182  }
183  }
184 }
185 
186 #endif // __TERRALIB_QT_AF_CONNECTORS_INTERNAL_MAPDISPLAY_H
QPixmap m_lastDisplayContent
The last map display content. i.e. a "clean" pixmap.
Definition: MapDisplay.h:172
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
This class defines the map display ZoomIn, this component is only a specific map that shows the curre...
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
te::qt::widgets::EyeBirdMapDisplayWidget * m_eyeBirdDisplay
Pointer to a component that represents a eye bird display.
Definition: MapDisplay.h:178
int m_extentStackMaxSize
The max size of the extent stack. Used on previousExtent and nextExtent.
Definition: MapDisplay.h:175
A base class for application events.
Definition: Event.h:59
QMenu * m_menu
The map display popup menu.
Definition: MapDisplay.h:171
std::vector< te::gm::Envelope > m_extentStack
The stack of MapDisplay extents.
Definition: MapDisplay.h:173
The base API for TerraLib applications.
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:80
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
te::qt::widgets::ZoomInMapDisplayWidget * m_zoomInDisplay
Pointer to a component that represents a zoom in display.
Definition: MapDisplay.h:177
QAction * m_pantoSelectedAction
Action to enable / disable pan to selected operation.
Definition: MapDisplay.h:180
te::qt::af::ApplicationController * m_app
Pointer to applicatin controller;.
Definition: MapDisplay.h:169
URI C++ Library.
int m_currentExtentIndex
The current extent index.
Definition: MapDisplay.h:174
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:71
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::qt::widgets::MapDisplay * m_display
Pointer to a component te::qt::widgets::MapDisplay.
Definition: MapDisplay.h:170