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  std::string getTransformationName() const;
163 
164  te::rst::Interpolator::Method getInterpolatorMethod() const;
165 
166  protected:
167 
168  void refCoordPicked(double x, double y);
169 
170  void adjCoordPicked(double x, double y);
171 
172  void setTiePointMarkLegend(QPixmap p);
173 
174  void setSelectedTiePointMarkLegend(QPixmap p);
175 
176  void setReferenceTiePointMarkLegend(QPixmap p);
177 
178  void createSelection(int initialIdx, int nPos);
179 
180  protected slots:
181 
182  void onAutoAcquireTiePointsToolButtonClicked();
183 
184  void onSelectAllToolButtonClicked();
185 
186  void onUnselectAllToolButtonClicked();
187 
188  void onDeleteSelectedToolButtonClicked();
189 
190  void onAddToolButtonClicked();
191 
192  void onTiePointsTableWidgetItemSelectionChanged();
193 
194  void onRefreshToolButtonClicked();
195 
196  void onDoneToolButtonClicked();
197 
198  void onRefMapDisplayExtentChanged();
199 
200  void onAdjMapDisplayExtentChanged();
201 
202  void onRefPointPicked(double x, double y);
203 
204  void onAdjPointPicked(double x, double y);
205 
206  void onTiePointsUpdated();
207 
208  void onSRIDPushButtonClicked();
209 
210  void onLoadTiePointsToolButtonClicked();
211 
212  void onSaveTiePointsToolButtonClicked();
213 
214  protected:
215 
216  /*! \brief Uptate the tie-points table widget. */
217  void tiePointsTableUpdate();
218 
219  /*! \brief Uptate the current transformation information widgets. */
220  void transformationInfoUpdate();
221 
222  void startUpNavigators();
223 
224  void drawTiePoints();
225 
226  QPixmap getPixmap(te::color::RGBAColor** rgba);
227 
228  signals:
229 
230  void tiePointsUpdated();
231 
232  void doneAcquiredTiePoints();
233 
234  private:
235 
236  std::auto_ptr<Ui::TiePointLocatorWidgetForm> m_ui;
237 
239 
240  te::map::AbstractLayerPtr m_refLayer; //!< Layer with reference imagem
241  te::map::AbstractLayerPtr m_adjLayer; //!< Layer with adjust imagem
242 
243  te::qt::widgets::TiePointData::TPContainerT m_tiePoints; //!< Internal tie-points container.
244 
246  bool m_tiePointHasFirstCoord; //!< true if the tie-point has the first part set;
247  unsigned int m_tiePointIdCounter; //!< A ID counter for new tie pointes inserted into m_tiePoints;
248 
249  std::set<int> m_tiePointsSelected; //!< List of selected tie points.
250 
251  te::qt::widgets::RasterNavigatorWidget* m_refNavigator; //!< Reference raster navigator
253 
254  te::color::RGBAColor** m_rgbaMarkSelected; //!< Represents the pattern of a selected tie point
255  te::color::RGBAColor** m_rgbaMarkUnselected; //!< Represents the pattern of a unselected tie point
256  te::color::RGBAColor** m_rgbaMarkRef; //!< Represents the pattern of reference tie point
257  te::se::Mark* m_markSelected; //!< Represents the mark of a selected tie point
258  te::se::Mark* m_markUnselected; //!< Represents the mark of a unselected tie point
259  te::se::Mark* m_markRef; //!< Represents the mark of a reference tie point
260  };
261 
262  } // end namespace widgets
263  } // end namespace qt
264 } // end namespace te
265 
266 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
267 
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
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
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)