RasterNavigatorWidget.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 the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser 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  TerraLib 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 Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/rp/RasterNavigatorWidget.h
22 
23  \brief This file has the RasterNavigatorWidget class.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_RASTERNAVIGATORWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_RASTERNAVIGATORWIDGET_H
28 
29 // TerraLib
30 #include "../../../geometry/Envelope.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../geometry/Polygon.h"
33 #include "../../../maptools/AbstractLayer.h"
34 #endif
35 #include "../../../maptools/Enums.h"
36 #include "../Config.h"
37 
38 // STL
39 #include <memory>
40 
41 // Qt
42 #include <QComboBox>
43 #include <QWidget>
44 
45 namespace Ui { class RasterNavigatorWidgetForm; }
46 
47 namespace te
48 {
49  namespace gm { class Envelope; }
50  namespace rst { class Raster; }
51  namespace se { class RasterSymbolizer; }
52 
53  namespace qt
54  {
55  namespace widgets
56  {
57  class AbstractTool;
58  class EyeBirdMapDisplayWidget;
59  class MapDisplay;
60  class Pan;
61  class ZoomInMapDisplayWidget;
62  class ZoomWheel;
63 
64  /*!
65  \class RasterNavigatorWidget
66 
67  \brief This class is used to navigate over a DataSetLayer (having a raster representation)
68  and given a set of tools, such as, zoom in, zoom out, pan, recompose.
69  Two new tools as created for raster interaction:
70  - point clicked
71  - geom definition
72 
73  \sa RasterFactory
74  */
76  {
77  Q_OBJECT
78 
79  public:
80 
81  RasterNavigatorWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
82 
84 
85  public:
86 
87  /*!
88  \brief This method is used to set the selected layer
89 
90  \param layer The layer ptr
91 
92  \note This layer MUST HAVE a valid raster object.
93  */
94  void set(te::map::AbstractLayerPtr layer, bool setFullScaleBox = false);
95 
96  void setVectorial(te::map::AbstractLayerPtr layer);
97 
98  void setExtent(te::gm::Envelope env);
99 
100  void removeVectorial();
101 
102  te::gm::Envelope getCurrentExtent();
103 
104  te::qt::widgets::MapDisplay* getDisplay();
105 
106  te::rst::Raster* getExtentRaster(bool fullScale = false);
107 
108  void drawRaster(te::rst::Raster* rst, te::se::Style* style = 0);
109 
110  void showAsPreview(bool asPreview, bool enableZoom = true);
111 
112  void hideColorCompositionTool(bool hide);
113 
114  void hideEditionTools(bool hide);
115 
116  void hidePickerTool(bool hide);
117 
118  void hideGeomTool(bool hide);
119 
120  void hideBoxTool(bool hide);
121 
122  void hideInfoTool(bool hide);
123 
124  void hideExtraDisplaysTool(bool hide);
125 
126  void setSelectionMode(bool mode);
127 
128  void setPoints(std::map< unsigned int, QPointF > *points);
129 
130  protected slots:
131 
132  void onEnvelopeAcquired(te::gm::Envelope env);
133 
134  void onGeomAquired(te::gm::Polygon* poly);
135 
136  void onPointPicked(QPointF& point);
137 
138  void onPointMoving(QPointF& point);
139 
140  void onPointMoved(QPointF& pointoriginal, QPointF& pointnew);
141 
142  void onCoordTrackedChanged(QPointF& coordinate);
143 
144  void onMapDisplayExtentChanged();
145 
146  void onZoomAreaToggled(bool checked);
147 
148  void onZoomOutToggled(bool checked);
149 
150  void onPanToggled(bool checked);
151 
152  void onPointPickerToggled(bool checked);
153 
154  void onPointMoveToggled(bool checked);
155 
156  void onGeomToggled(bool checked);
157 
158  void onBoxToggled(bool checked);
159 
160  void onReadPixelToggled(bool checked);
161 
162  void onExtraDisplaysToggled(bool checked);
163 
164  void onRecomposeClicked();
165 
166  void onRedComboBoxActivated(int index);
167 
168  void onGreenComboBoxActivated(int index);
169 
170  void onBlueComboBoxActivated(int index);
171 
172  void onMonoComboBoxActivated(int index);
173 
174  void onMonoToolClicked(bool flag);
175 
176  void onRedToolClicked(bool flag);
177 
178  void onGreenToolClicked(bool flag);
179 
180  void onBlueToolClicked(bool flag);
181 
182  void onCompositionToolClicked(bool flag);
183 
184  void onPreviewClicked();
185 
186  void onVSliderChanged(int value);
187 
188  void onHSliderChanged(int value);
189 
190  signals:
191 
192  void previewClicked();
193 
194  void mapDisplayExtentChanged();
195 
196  void pointPicked(double x, double y);
197 
198  void pointMoving(double x, double y);
199 
200  void pointMoved(double xorig, double yorig, double xnew, double ynew);
201 
202  void geomAquired(te::gm::Polygon* poly);
203 
204  void envelopeAcquired(te::gm::Envelope env);
205 
206  protected:
207 
208  void setCurrentTool(te::qt::widgets::AbstractTool* tool);
209 
210  void listBands();
211 
212  void getCompositionInfo();
213 
214  void setComboBoxText(QComboBox* cb, std::string value);
215 
216  void drawOverlay();
217 
218  private:
219 
220  std::unique_ptr<Ui::RasterNavigatorWidgetForm> m_ui;
221 
224 
229 
230  te::qt::widgets::Pan* m_panTool; //!< Pan tool (used in preview mode)
231  te::qt::widgets::ZoomWheel* m_zoomTool; //!< Zoom tool (used in preview mode)
232 
233  int m_currentColumn; //!< The column position of mouse in map display.
234  int m_currentRow; //!< The row position of mouse in map display.
235 
237 
238  QCursor m_pointCursor;
239 
240  QPixmap* m_draftOriginal;
241 
242  std::unique_ptr< std::map< unsigned int, QPointF > > m_points;
243  };
244 
245  } // end namespace widgets
246  } // end namespace qt
247 } // end namespace te
248 
249 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_RASTERNAVIGATORWIDGET_H
250 
#define slots
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
te::qt::widgets::AbstractTool * m_tool
te::qt::widgets::ZoomWheel * m_zoomTool
Zoom tool (used in preview mode)
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::MapDisplay * m_mapDisplay
te::qt::widgets::ZoomInMapDisplayWidget * m_zoomInMapDisplay
te::qt::widgets::Pan * m_panTool
Pan tool (used in preview mode)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:71
This class defines an interface for objects that can receive application events and respond to them...
Definition: AbstractTool.h:63
int m_currentRow
The row position of mouse in map display.
std::unique_ptr< std::map< unsigned int, QPointF > > m_points
This class implements a concrete tool to geographic pan operation.
Definition: Pan.h:49
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
TerraLib.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
This event signals that the pan button toggled.
std::unique_ptr< Ui::RasterNavigatorWidgetForm > m_ui
te::qt::widgets::EyeBirdMapDisplayWidget * m_eyeBirdMapDisplay
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
This class is used to navigate over a DataSetLayer (having a raster representation) and given a set o...
This class implements a concrete tool to geographic zoom operation using the mouse wheel...
Definition: ZoomWheel.h:49
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
int m_currentColumn
The column position of mouse in map display.
Visibility
Each layer can have three states of visibility.
Definition: Enums.h:139
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr