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