TiePointLocatorWidget.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/TiePointLocatorWidget.h
22 
23  \brief This file has the TiePointLocatorWidget class.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
28 
29 // TerraLib
30 #include "../../../color/RGBAColor.h"
31 #include "../../../geometry/Coord2D.h"
32 #include "../../../geometry/GTParameters.h"
33 #ifndef Q_MOC_RUN
34 #include "../../../maptools/AbstractLayer.h"
35 #include "../../../rp/TiePointsLocator.h"
36 #endif
37 #include "../Config.h"
38 
39 // STL
40 #include <map>
41 #include <memory>
42 #include <set>
43 
44 // Qt
45 #include <QWidget>
46 
47 namespace Ui { class TiePointLocatorWidgetForm; }
48 
49 namespace te
50 {
51 
52  namespace se { class Mark; }
53 
54  namespace qt
55  {
56  namespace widgets
57  {
58  class MapDisplay;
59  class RasterNavigatorWidget;
60  class TiePointLocatorParametersWidget;
61 
62  /*! \class TiePointData Tie Point data. */
64  {
65  public :
66 
67  /*! \enum TiePointAcquisitionType Tie point acquisition type. */
69  {
70  InvalidAcquisitionT, //!< Invalid acquisition type.
71  ManualAcquisitionT, //!< Manual acquisition type.
72  AutomaticAcquisitionT //!< Automatic acquisition type.
73  };
74 
75  TiePointAcquisitionType m_acqType; //!< Acquisition type.
76  te::gm::GTParameters::TiePoint m_tiePoint; //!< Tie point coordinates.
77  bool m_selected; //!< Tie point selection status;
78 
79  TiePointData();
80 
81  TiePointData( const TiePointData& other );
82 
83  ~TiePointData();
84 
85  const TiePointData& operator=( const TiePointData& other );
86 
87  typedef std::map< unsigned int, TiePointData > TPContainerT; //!< Tie-pints container type definition.
88 
89  };
90 
91  /*!
92  \class TiePointLocatorWidget
93 
94  \brief This class is used to define a widget for tie point acquirement.
95  */
97  {
98  Q_OBJECT
99 
100  public:
101 
102  TiePointLocatorWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
103 
105 
106  Ui::TiePointLocatorWidgetForm* getForm() const;
107 
108  public:
109 
110  /*!
111  \brief Get the current acquired tie-points.
112 
113  \param tiePoints The current acquired tie-points.
114  */
115  void getTiePoints( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
116 
117  /*!
118  \brief Get the current acquired tie-points.
119 
120  \param tiePoints The current acquired tie-points.
121  */
122  void getTiePointsIdxCoords( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
123 
124  /*!
125  \brief Get tie point data container.
126 
127  \return The tie point data container.
128  */
129  const te::qt::widgets::TiePointData::TPContainerT& getTiePointContainer();
130 
131  /*!
132  \brief Get tie point reference coord that does not have an adjust coordenate
133 
134  \param coordRef The tie point reference coord.
135 
136  \return The m_tiePointHasFirstCoord status.
137  */
138  bool getReferenceTiePointCoord(te::gm::Coord2D& coordRef);
139 
140  /*!
141  \brief This method is used to set the selected layer used to be the reference layer
142 
143  \param layer The layer ptr
144 
145  \note This layer MUST HAVE a valid raster object.
146  */
147  void setReferenceLayer(te::map::AbstractLayerPtr layer);
148 
149  /*!
150  \brief This method is used to set the selected layer used to be the adjust layer
151 
152  \param layer The layer ptr
153 
154  \note This layer MUST HAVE a valid raster object.
155  */
156  void setAdjustLayer(te::map::AbstractLayerPtr layer);
157 
158  void getOutputSRID(int& srid);
159 
160  void getOutputResolution(double& resX, double& resY);
161 
162  protected:
163 
164  void refCoordPicked(double x, double y);
165 
166  void adjCoordPicked(double x, double y);
167 
168  void setTiePointMarkLegend(QPixmap p);
169 
170  void setSelectedTiePointMarkLegend(QPixmap p);
171 
172  void setReferenceTiePointMarkLegend(QPixmap p);
173 
174  void createSelection(int initialIdx, int nPos);
175 
176  protected slots:
177 
178  void onAutoAcquireTiePointsToolButtonClicked();
179 
180  void onSelectAllToolButtonClicked();
181 
182  void onUnselectAllToolButtonClicked();
183 
184  void onDeleteSelectedToolButtonClicked();
185 
186  void onAddToolButtonClicked();
187 
188  void onTiePointsTableWidgetItemSelectionChanged();
189 
190  void onRefreshToolButtonClicked();
191 
192  void onDoneToolButtonClicked();
193 
194  void onRefMapDisplayExtentChanged();
195 
196  void onAdjMapDisplayExtentChanged();
197 
198  void onRefPointPicked(double x, double y);
199 
200  void onAdjPointPicked(double x, double y);
201 
202  void onTiePointsUpdated();
203 
204  void onSRIDPushButtonClicked();
205 
206  protected:
207 
208  /*! \brief Uptate the tie-points table widget. */
209  void tiePointsTableUpdate();
210 
211  /*! \brief Uptate the current transformation information widgets. */
212  void transformationInfoUpdate();
213 
214  void startUpNavigators();
215 
216  void drawTiePoints();
217 
218  QPixmap getPixmap(te::color::RGBAColor** rgba);
219 
220  signals:
221 
222  void tiePointsUpdated();
223 
224  void doneAcquiredTiePoints();
225 
226  private:
227 
228  std::auto_ptr<Ui::TiePointLocatorWidgetForm> m_ui;
229 
231 
232  te::map::AbstractLayerPtr m_refLayer; //!< Layer with reference imagem
233  te::map::AbstractLayerPtr m_adjLayer; //!< Layer with adjust imagem
234 
235  te::qt::widgets::TiePointData::TPContainerT m_tiePoints; //!< Internal tie-points container.
236 
238  bool m_tiePointHasFirstCoord; //!< true if the tie-point has the first part set;
239  unsigned int m_tiePointIdCounter; //!< A ID counter for new tie pointes inserted into m_tiePoints;
240 
241  std::set<int> m_tiePointsSelected; //!< List of selected tie points.
242 
243  te::qt::widgets::RasterNavigatorWidget* m_refNavigator; //!< Reference raster navigator
245 
246  te::color::RGBAColor** m_rgbaMarkSelected; //!< Represents the pattern of a selected tie point
247  te::color::RGBAColor** m_rgbaMarkUnselected; //!< Represents the pattern of a unselected tie point
248  te::color::RGBAColor** m_rgbaMarkRef; //!< Represents the pattern of reference tie point
249  te::se::Mark* m_markSelected; //!< Represents the mark of a selected tie point
250  te::se::Mark* m_markUnselected; //!< Represents the mark of a unselected tie point
251  te::se::Mark* m_markRef; //!< Represents the mark of a reference tie point
252  };
253 
254  } // end namespace widgets
255  } // end namespace qt
256 } // end namespace te
257 
258 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
259 
te::color::RGBAColor ** m_rgbaMarkSelected
Represents the pattern of a selected tie point.
std::map< unsigned int, TiePointData > TPContainerT
Tie-pints container type definition.
te::qt::widgets::RasterNavigatorWidget * m_refNavigator
Reference raster navigator.
This class is used to define a widget for tie point acquirement.
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
te::se::Mark * m_markRef
Represents the mark of a reference tie point.
te::map::AbstractLayerPtr m_refLayer
Layer with reference imagem.
te::qt::widgets::RasterNavigatorWidget * m_adjNavigator
Adjust raster navigator.
te::gm::GTParameters::TiePoint m_tiePoint
Tie point coordinates.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
te::qt::widgets::TiePointLocatorParametersWidget * m_tiePointParameters
Tie Point parameters widget.
std::pair< Coord2D, Coord2D > TiePoint
Tie point type definition.
Definition: GTParameters.h:59
bool m_tiePointHasFirstCoord
true if the tie-point has the first part set;
te::qt::widgets::TiePointData::TPContainerT m_tiePoints
Internal tie-points container.
te::se::Mark * m_markSelected
Represents the mark of a selected tie point.
te::map::AbstractLayerPtr m_adjLayer
Layer with adjust imagem.
URI C++ Library.
te::se::Mark * m_markUnselected
Represents the mark of a unselected tie point.
te::color::RGBAColor ** m_rgbaMarkRef
Represents the pattern of reference tie point.
std::auto_ptr< Ui::TiePointLocatorWidgetForm > m_ui
bool m_selected
Tie point selection status;.
te::gm::GTParameters::TiePoint m_currentTiePoint
The current tie-point.
std::set< int > m_tiePointsSelected
List of selected tie points.
This class is used to define a widget for tie point parameters acquirement.
This class is used to navigate over a DataSetLayer (having a raster representation) and given a set o...
te::color::RGBAColor ** m_rgbaMarkUnselected
Represents the pattern of a unselected tie point.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
TiePointAcquisitionType m_acqType
Acquisition type.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
unsigned int m_tiePointIdCounter
A ID counter for new tie pointes inserted into m_tiePoints;.