All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 <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 the current acquired tie-points.
116 
117  \param tiePoints The current acquired tie-points.
118  */
119  void getTiePointsIdxCoords( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
120 
121  /*!
122  \brief Get tie point data container.
123 
124  \return The tie point data container.
125  */
126  const te::qt::widgets::TiePointData::TPContainerT& getTiePointContainer();
127 
128  /*!
129  \brief Get tie point reference coord that does not have an adjust coordenate
130 
131  \param coordRef The tie point reference coord.
132 
133  \return The m_tiePointHasFirstCoord status.
134  */
135  bool getReferenceTiePointCoord(te::gm::Coord2D& coordRef);
136 
137  /*!
138  \brief This method is used to set the selected layer used to be the reference layer
139 
140  \param layer The layer ptr
141 
142  \note This layer MUST HAVE a valid raster object.
143  */
144  void setReferenceLayer(te::map::AbstractLayerPtr layer);
145 
146  /*!
147  \brief This method is used to set the selected layer used to be the adjust layer
148 
149  \param layer The layer ptr
150 
151  \note This layer MUST HAVE a valid raster object.
152  */
153  void setAdjustLayer(te::map::AbstractLayerPtr layer);
154 
155  void getOutputSRID(int& srid);
156 
157  void getOutputResolution(double& resX, double& resY);
158 
159  protected:
160 
161  void refCoordPicked(double x, double y);
162 
163  void adjCoordPicked(double x, double y);
164 
165  void setTiePointMarkLegend(QPixmap p);
166 
167  void setSelectedTiePointMarkLegend(QPixmap p);
168 
169  void setReferenceTiePointMarkLegend(QPixmap p);
170 
171  void createSelection(int initialId);
172 
173  protected slots:
174 
175  void onAutoAcquireTiePointsToolButtonClicked();
176 
177  void onSelectAllToolButtonClicked();
178 
179  void onUnselectAllToolButtonClicked();
180 
181  void onDeleteSelectedToolButtonClicked();
182 
183  void onAddToolButtonClicked();
184 
185  void onTiePointsTableWidgetItemSelectionChanged();
186 
187  void onRefreshToolButtonClicked();
188 
189  void onDoneToolButtonClicked();
190 
191  void onRefMapDisplayExtentChanged();
192 
193  void onAdjMapDisplayExtentChanged();
194 
195  void onRefPointPicked(double x, double y);
196 
197  void onAdjPointPicked(double x, double y);
198 
199  void onTiePointsUpdated();
200 
201  void onSRIDPushButtonClicked();
202 
203  protected:
204 
205  /*! \brief Uptate the tie-points table widget. */
206  void tiePointsTableUpdate();
207 
208  /*! \brief Uptate the current transformation information widgets. */
209  void transformationInfoUpdate();
210 
211  /*! \brief Fill interface widget with initial values. */
212  void startAdvancedOptions();
213 
214  /*! \brief Update tie point values with advanced options changed values. */
215  void updateAdvancedOptions();
216 
217  void startUpNavigators();
218 
219  void drawTiePoints();
220 
221  QPixmap getPixmap(te::color::RGBAColor** rgba);
222 
223  signals:
224 
225  void tiePointsUpdated();
226 
227  void doneAcquiredTiePoints();
228 
229  private:
230 
231  std::auto_ptr<Ui::TiePointLocatorWidgetForm> m_ui;
232 
233  te::map::AbstractLayerPtr m_refLayer; //!< Layer with reference imagem
234  te::map::AbstractLayerPtr m_adjLayer; //!< Layer with adjust imagem
235 
236  te::qt::widgets::TiePointData::TPContainerT m_tiePoints; //!< Internal tie-points container.
237 
239 
241  bool m_tiePointHasFirstCoord; //!< true if the tie-point has the first part set;
242  unsigned int m_tiePointIdCounter; //!< A ID counter for new tie pointes inserted into m_tiePoints;
243 
244  std::set<int> m_tiePointsSelected; //!< List of selected tie points.
245 
246 
247  te::qt::widgets::RasterNavigatorWidget* m_refNavigator; //!< Reference raster navigator
249 
250  te::color::RGBAColor** m_rgbaMarkSelected; //!< Represents the pattern of a selected tie point
251  te::color::RGBAColor** m_rgbaMarkUnselected; //!< Represents the pattern of a unselected tie point
252  te::color::RGBAColor** m_rgbaMarkRef; //!< Represents the pattern of reference tie point
253  te::se::Mark* m_markSelected; //!< Represents the mark of a selected tie point
254  te::se::Mark* m_markUnselected; //!< Represents the mark of a unselected tie point
255  te::se::Mark* m_markRef; //!< Represents the mark of a reference tie point
256  };
257 
258  } // end namespace widgets
259  } // end namespace qt
260 } // end namespace te
261 
262 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
263 
te::rp::TiePointsLocator::InputParameters m_inputParameters
The current parameters.
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.
TiePointsLocator input parameters.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
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.
const TiePointData & operator=(const TiePointData &other)
te::map::AbstractLayerPtr m_adjLayer
Layer with adjust imagem.
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 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:66
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;.