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