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 CoordTracking;
58  class EyeBirdMapDisplayWidget;
59  class MapDisplay;
60  class PanMiddleClick;
61  class ZoomInMapDisplayWidget;
62  class ZoomWheel;
63  }
64 
65  namespace af
66  {
67  class ApplicationController;
68 
69  namespace evt
70  {
71  // Forward declaration
72  struct Event;
73  }
74 
75  /*!
76  \class MapDisplay
77 
78  \brief A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
79 
80  It is used to listen events sent by the application framework.
81  It is a proxy for the te::qt::widgets::MapDisplay.
82  */
83  class TEQTAFEXPORT MapDisplay : public QObject
84  {
85  Q_OBJECT
86 
87  public:
88 
89  /*!
90  \brief Constructor.
91 
92  \param display te::qt::widgets::MapDisplay to be listened.
93  */
95 
96  /*! \brief destructor. */
98 
100 
102 
104 
105  bool eventFilter(QObject* watched, QEvent* e);
106 
107  /*!
108  \brief It draws the given layer list.
109 
110  \param layers The layer list.
111  */
112  void draw(const std::list<te::map::AbstractLayerPtr>& layers);
113 
114  /*! \brief It clears the map display. */
115  void clear();
116 
117  void nextExtent();
118 
120 
121  void fit(const std::list<te::map::AbstractLayerPtr>& layers);
122 
123  void pan(const std::list<te::map::AbstractLayerPtr>& layers);
124 
125  void zoom1x1(const std::list<te::map::AbstractLayerPtr>& layers);
126 
127  protected slots:
128 
129  void onCoordTracked(QPointF& coordinate);
130 
131  void onCoordLLTracked(QPointF& coordinate, QPointF& llCoordinate);
132 
133  void onDrawLayersFinished(const QMap<QString, QString>& errors);
134 
136 
137  /*!
138  \brief Listener to the application framewrork events.
139 
140  \param e An event sent by framework.
141  */
143 
144  /*!
145  \brief Returns the pan selected flag;
146 
147  \return Flag of the pan to selected operation.
148  */
150 
151  protected:
152 
153  void drawLayersSelection(const std::list<te::map::AbstractLayerPtr>& layers);
154 
156 
157  void drawDataSet(te::da::DataSet* dataset, const std::string& geomPropertyName, int srid, const QColor& color, bool isLinked = false);
158 
159  void drawDataSet(te::da::DataSet* dataset, const std::string& geomPropertyName, int srid, te::se::Style* style, bool isLinked = false);
160 
161  void configSRS(const std::list<te::map::AbstractLayerPtr>& layers);
162 
163  std::list<te::map::AbstractLayerPtr> getSelectedLayer();
164 
165  signals:
166 
167  void hasNextExtent(bool value);
168 
169  void hasPreviousExtent(bool value);
170 
172 
173  protected:
174 
175  std::list<te::map::AbstractLayerPtr> getVisibleLayers();
176 
177 
178  te::qt::af::ApplicationController* m_app; //!< Pointer to applicatin controller;
179  te::qt::widgets::MapDisplay* m_display; //!< Pointer to a component te::qt::widgets::MapDisplay.
180  QMenu* m_menu; //!< The map display popup menu.
181  QPixmap m_lastDisplayContent; //!< The last map display content. i.e. a "clean" pixmap.
182  std::vector<te::gm::Envelope> m_extentStack; //!< The stack of MapDisplay extents.
183  int m_currentExtentIndex; //!< The current extent index.
184  int m_extentStackMaxSize; //!< The max size of the extent stack. Used on previousExtent and nextExtent.
185 
186  te::qt::widgets::CoordTracking* m_coordTracking; //!< Tool for tracking mouse position
187  te::qt::widgets::ZoomWheel* m_zoomWheel; //!< Tool for zoom using the wheel mouse button
188  te::qt::widgets::PanMiddleClick* m_pan; //!< Tool for pan using the middle mouse button
189 
190  te::qt::widgets::ZoomInMapDisplayWidget* m_zoomInDisplay; //!< Pointer to a component that represents a zoom in display.
191  te::qt::widgets::EyeBirdMapDisplayWidget* m_eyeBirdDisplay; //!< Pointer to a component that represents a eye bird display.
192 
193  QAction* m_pantoSelectedAction; //!< Action to enable / disable pan to selected operation.
194 
195  bool m_autoPanEnabled; //!< Define if auto pan is enabled.
196  };
197  }
198  }
199 }
200 
201 #endif // __TERRALIB_QT_AF_CONNECTORS_INTERNAL_MAPDISPLAY_H
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:114
The base API for TerraLib applications.
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:84
void clear()
It clears the map display.
void setZoomInDisplay(te::qt::widgets::ZoomInMapDisplayWidget *display)
void hasNextExtent(bool value)
int m_extentStackMaxSize
The max size of the extent stack. Used on previousExtent and nextExtent.
Definition: MapDisplay.h:184
void setEyeBirdDisplay(te::qt::widgets::EyeBirdMapDisplayWidget *display)
te::qt::widgets::ZoomInMapDisplayWidget * m_zoomInDisplay
Pointer to a component that represents a zoom in display.
Definition: MapDisplay.h:190
QAction * m_pantoSelectedAction
Action to enable / disable pan to selected operation.
Definition: MapDisplay.h:193
std::vector< te::gm::Envelope > m_extentStack
The stack of MapDisplay extents.
Definition: MapDisplay.h:182
MapDisplay(te::qt::widgets::MapDisplay *display, te::qt::af::ApplicationController *app)
Constructor.
te::qt::widgets::ZoomWheel * m_zoomWheel
Tool for zoom using the wheel mouse button.
Definition: MapDisplay.h:187
void drawDataSet(te::da::DataSet *dataset, const std::string &geomPropertyName, int srid, const QColor &color, bool isLinked=false)
void drawLayersSelection(const std::list< te::map::AbstractLayerPtr > &layers)
bool eventFilter(QObject *watched, QEvent *e)
te::qt::widgets::PanMiddleClick * m_pan
Tool for pan using the middle mouse button.
Definition: MapDisplay.h:188
void drawLayerSelection(te::map::AbstractLayerPtr layer)
int m_currentExtentIndex
The current extent index.
Definition: MapDisplay.h:183
std::list< te::map::AbstractLayerPtr > getSelectedLayer()
std::list< te::map::AbstractLayerPtr > getVisibleLayers()
te::qt::widgets::MapDisplay * getDisplay()
void onCoordLLTracked(QPointF &coordinate, QPointF &llCoordinate)
te::qt::widgets::CoordTracking * m_coordTracking
Tool for tracking mouse position.
Definition: MapDisplay.h:186
bool m_autoPanEnabled
Define if auto pan is enabled.
Definition: MapDisplay.h:195
te::qt::af::ApplicationController * m_app
Pointer to applicatin controller;.
Definition: MapDisplay.h:178
void onApplicationTriggered(te::qt::af::evt::Event *e)
Listener to the application framewrork events.
void zoom1x1(const std::list< te::map::AbstractLayerPtr > &layers)
bool isPanToSelectedEnabled()
Returns the pan selected flag;.
void onDrawLayersFinished(const QMap< QString, QString > &errors)
te::qt::widgets::EyeBirdMapDisplayWidget * m_eyeBirdDisplay
Pointer to a component that represents a eye bird display.
Definition: MapDisplay.h:191
void hasPreviousExtent(bool value)
QMenu * m_menu
The map display popup menu.
Definition: MapDisplay.h:180
void pan(const std::list< te::map::AbstractLayerPtr > &layers)
void draw(const std::list< te::map::AbstractLayerPtr > &layers)
It draws the given layer list.
QPixmap m_lastDisplayContent
The last map display content. i.e. a "clean" pixmap.
Definition: MapDisplay.h:181
void drawDataSet(te::da::DataSet *dataset, const std::string &geomPropertyName, int srid, te::se::Style *style, bool isLinked=false)
void onCoordTracked(QPointF &coordinate)
~MapDisplay()
destructor.
void triggered(te::qt::af::evt::Event *e)
te::qt::widgets::MapDisplay * m_display
Pointer to a component te::qt::widgets::MapDisplay.
Definition: MapDisplay.h:179
void configSRS(const std::list< te::map::AbstractLayerPtr > &layers)
void fit(const std::list< te::map::AbstractLayerPtr > &layers)
This class implements a concrete tool to geographic coordinate tracking on mouse move operation.
Definition: CoordTracking.h:58
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
This class implements a concrete tool to geographic pan operation with mouse middle click.
This class defines the map display ZoomIn, this component is only a specific map that shows the curre...
This class implements a concrete tool to geographic zoom operation using the mouse wheel.
Definition: ZoomWheel.h:50
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:66
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
A base class for application events.
Definition: Event.h:60
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:71