RpToolsWidget.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/RpToolsWidget.h
22 
23  \brief This file has the RpToolsWidget class.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_ROTOOLSWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_ROTOOLSWIDGET_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 #include <qactiongroup.h>
45 
46 namespace Ui { class RpToolsWidgetForm; }
47 
48 namespace te
49 {
50  namespace gm { class Envelope; }
51  namespace rst { class Raster; }
52  namespace qt
53  {
54  namespace widgets
55  {
56  class AbstractTool;
57  class MapDisplay;
58 
59  /*!
60  \class RpToolsWidget
61 
62  \brief This class is used to navigate over a DataSetLayer (having a raster representation)
63  and given a set of tools, such as, zoom in, zoom out, pan, recompose.
64  Two new tools as created for raster interaction:
65  - point clicked
66  - geom definition
67 
68  \sa RasterFactory
69  */
70  class TEQTWIDGETSEXPORT RpToolsWidget : public QWidget
71  {
72  Q_OBJECT
73 
74  public:
75 
76  RpToolsWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
77 
78  ~RpToolsWidget();
79 
80  public:
81 
82  /*!
83  \brief This method is used to set the selected layer
84 
85  \param layer The layer ptr
86 
87  \note This layer MUST HAVE a valid raster object.
88  */
89  void set(te::map::AbstractLayerPtr layer);
90 
91  void setVectorial(te::map::AbstractLayerPtr layer);
92 
93  void removeVectorial();
94 
95  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
96 
97  void setActionGroup(QActionGroup* actionGroup);
98 
99  void hideEditionTools(bool hide);
100 
101  void enablePickerAction();
102 
103  void enableGeomAction();
104 
105  void enableBoxAction();
106 
107  void setPickerTool(bool checked);
108 
109  void setGeomTool(bool checked);
110 
111  void setEnvelopeTool(bool checked);
112 
113  void setSelectionMode(bool mode);
114 
115  void onDisableToolbar();
116 
117  protected slots:
118 
119  void onEnvelopeAcquired(te::gm::Envelope env);
120 
121  void onGeomAquired(te::gm::Polygon* poly);
122 
123  void onPointPicked(QPointF& point);
124 
125  void onMapDisplayExtentChanged();
126 
127  void onPointPickerToggled(bool checked);
128 
129  void onGeomToggled(bool checked);
130 
131  void onBoxToggled(bool checked);
132 
133  signals:
134 
135  void mapDisplayExtentChanged();
136 
137  void pointPicked(double x, double y);
138 
139  void geomAquired(te::gm::Polygon* poly);
140 
141  void envelopeAcquired(te::gm::Envelope env);
142 
143  private:
144 
145  std::auto_ptr<Ui::RpToolsWidgetForm> m_ui;
146 
148 
150 
151  QActionGroup* m_actionGroup;
152 
153  QAction* m_pickerAction;
154 
155  QAction* m_geomAction;
156 
157  QAction* m_boxAction;
158 
159  QCursor m_pointCursor;
160 
161  QPixmap* m_draftOriginal;
162  };
163 
164  } // end namespace widgets
165  } // end namespace qt
166 } // end namespace te
167 
168 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_ROTOOLSWIDGET_H
169 
te::qt::widgets::MapDisplay * m_mapDisplay
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
std::auto_ptr< Ui::RpToolsWidgetForm > m_ui
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...
Definition: RpToolsWidget.h:70
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::map::AbstractLayerPtr m_layer