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