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