Loading...
Searching...
No Matches
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"
39
40// STL
41#include <map>
42#include <memory>
43#include <set>
44
45// Qt
46#include <QTableWidgetItem>
47#include <QWidget>
48
49namespace Ui { class TiePointLocatorWidgetForm; }
50
51namespace te
52{
53
54 namespace se { class Mark; }
55
56 namespace qt
57 {
58 namespace widgets
59 {
60 class MapDisplay;
61 class TiePointLocatorParametersWidget;
62
63 /*! \class TiePointData Tie Point data. */
65 {
66 public :
67
68 /*! \enum TiePointAcquisitionType Tie point acquisition type. */
70 {
71 InvalidAcquisitionT, //!< Invalid acquisition type.
72 ManualAcquisitionT, //!< Manual acquisition type.
73 AutomaticAcquisitionT //!< Automatic acquisition type.
74 };
75
76 TiePointAcquisitionType m_acqType; //!< Acquisition type.
77 te::gm::GTParameters::TiePoint m_tiePoint; //!< Tie point coordinates - std::pair< Reference Raster Line/Col Coord,. Adjust Raster Line/Col Coord >.
78 bool m_selected; //!< Tie point selection status;
79
81
82 TiePointData( const TiePointData& other );
83
85
86 const TiePointData& operator=( const TiePointData& other );
87
88 typedef std::map< unsigned int, TiePointData > TPContainerT; //!< Tie-pints container type definition.
89
90 };
91
92 /*!
93 \class TiePointLocatorWidget
94
95 \brief This class is used to define a widget for tie point acquirement.
96 */
98 {
99 Q_OBJECT
100
101 public:
102
104 {
105 None, //!< None first coord picked
106 Reference, //!< Reference first coord was picked
107 Adjust //!< Adjust first coord was picked
108 };
109
110 TiePointLocatorWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
111
113
114 Ui::TiePointLocatorWidgetForm* getForm() const;
115
116 /*!
117 \brief Get the current acquired tie-points.
118
119 \param tiePoints The current acquired tie-points (TiePoint.first=adjust raster lines/cols, TiePoint.second=the related correct X/Y coords under the output SRID).
120 */
121 void getTiePoints( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
122
123 /*!
124 \brief Get the current acquired tie-points.
125
126 \param tiePoints The current acquired tie-points.
127 */
128 void getTiePointsIdxCoords( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
129
130 /*!
131 \brief Get tie point data container.
132
133 \return The tie point data container.
134 */
136
137 /*!
138 \brief Get tie point reference coord that does not have an adjust coordenate or
139 \ tie point adjust coord that does not have an reference coordenate
140 \param firstCoord The tie point reference or adjsut coord.
141
142 \return The m_tiePointHasFirstCoord type (None, Reference or Adjust).
143 */
145
146 /*!
147 \brief This method is used to set the selected layer used to be the reference layer
148
149 \param layer The layer ptr
150
151 \note This layer MUST HAVE a valid raster object.
152 */
154
155 /*!
156 \brief This method is used to set the selected layer used to be the adjust layer
157
158 \param layer The layer ptr
159
160 \note This layer MUST HAVE a valid raster object.
161 */
163
164 void getRefSRID(int& srid);
165
166 void getAdjSRID(int& srid);
167
168 void getOutputSRID(int& srid);
169
170 void getOutputResolution(double& resX, double& resY);
171
172 std::string getTransformationName() const;
173
175
177
178 protected:
179
180 /*!
181 \brief A proxy to allow table itens sorting
182 */
183 class TableItem: public QTableWidgetItem
184 {
185 public:
186 TableItem(const double& value, int type = Type)
187 : QTableWidgetItem( QString::number( value ), type )
188 {
189 setData( 0, QVariant( value ) );
190 };
191
192 TableItem(const QString &text, int type = Type)
193 : QTableWidgetItem( text, type )
194 {
195 setData( 0, QVariant( text.toDouble() ) );
196 };
197
198 bool operator< (const QTableWidgetItem &other) const
199 {
200 return ( data(0).toDouble() < other.data(0).toDouble() );
201 };
202 };
203
204 void refCoordPicked(double x, double y);
205
206 void adjCoordPicked(double x, double y);
207
208 void refCoordMoved(double xorig, double yorig, double xnew, double ynew);
209
210 void adjCoordMoved(double xorig, double yorig, double xnew, double ynew);
211
212 void setTiePointMarkLegend(QPixmap p);
213
215
217
218 void createSelection(int initialIdx, int nPos);
219
221
223
224 protected slots:
225
227
229
231
233
235
237
239
241
243
245
246 void onRefPointPicked(double x, double y);
247
248 void onAdjPointPicked(double x, double y);
249
250 void onRefPointMoved(double xorig, double yorig, double xnew, double ynew);
251
252 void onAdjPointMoved(double xorig, double yorig, double xnew, double ynew);
253
255
257
259
261
262 void onTiePointsTableWidgetItemChanged(QTableWidgetItem*);
263
264 void showEvent(QShowEvent *event);
265
266 void hideEvent(QShowEvent *event);
267
269
271
272 protected:
273
274 /*! \brief Uptate the tie-points table widget. */
276
277 /*! \brief Uptate the current transformation information widgets. */
279
281
283
284 void reset();
285
286 /*!
287 \brief Returns the rasters pixel sizes relation (under the reference SRS)
288 \param pixelSizeXRelation X Relation.
289 \param pixelSizeYRelation Y Relation.
290 \note PixelSizeRelation = Reference_Raster_Pixel_Size / Adjust_Raster_Pixel_Size
291 */
292 void getRastersPixelSizesRelation( double& pixelSizeXRelation,
293 double& pixelSizeYRelation ) const;
294
295 /*!
296 \brief Returns the rasters pixel size relation ((under the reference SRS)).
297 \note PixelSizeRelation = Reference_Raster_Mean_Pixel_Size / Adjust_Raster_Mean_Pixel_Size
298 */
300
301 signals:
302
304
306
307 private:
308
309 std::unique_ptr<Ui::TiePointLocatorWidgetForm> m_ui;
310
312
313 te::map::AbstractLayerPtr m_refLayer; //!< Layer with reference imagem
314 te::map::AbstractLayerPtr m_adjLayer; //!< Layer with adjust imagem
315
316 te::qt::widgets::TiePointData::TPContainerT m_tiePoints; //!< Internal tie-points container..
317
319 FirstCoordType m_tiePointFirstCoord; //!< Type of coord if the tie-point has the first part set;
320 unsigned int m_tiePointIdCounter; //!< A ID counter for new tie pointes inserted into m_tiePoints;
321
322 std::unique_ptr< te::qt::widgets::RasterNavigatorDialog > m_refNavigatorDPtr; //!< Reference raster navigator
323 std::unique_ptr< te::qt::widgets::RasterNavigatorDialog > m_adjNavigatorDPtr; //!< Adjust raster navigator
324
325 te::color::RGBAColor** m_rgbaMarkSelected; //!< Represents the pattern of a selected tie point
326 te::color::RGBAColor** m_rgbaMarkUnselected; //!< Represents the pattern of a unselected tie point
327 te::color::RGBAColor** m_rgbaMarkRef; //!< Represents the pattern of reference tie point
328 te::se::Mark* m_markSelected; //!< Represents the mark of a selected tie point
329 te::se::Mark* m_markUnselected; //!< Represents the mark of a unselected tie point
330 te::se::Mark* m_markRef; //!< Represents the mark of a reference tie point
331 std::map< unsigned int, QPointF > m_refPoints; //!< Display reference coordinates
332 std::map< unsigned int, QPointF > m_adjPoints; //!< Display adjust coordinates
333 };
334
335 } // end namespace widgets
336 } // end namespace qt
337} // end namespace te
338
339#endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
340
This file defines a class for a Raster Navigator Dialog.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:58
std::pair< Coord2D, Coord2D > TiePoint
Tie point type definition.
Definition: GTParameters.h:59
bool m_selected
Tie point selection status;.
te::gm::GTParameters::TiePoint m_tiePoint
Tie point coordinates - std::pair< Reference Raster Line/Col Coord,. Adjust Raster Line/Col Coord >.
TiePointData(const TiePointData &other)
std::map< unsigned int, TiePointData > TPContainerT
Tie-pints container type definition.
const TiePointData & operator=(const TiePointData &other)
@ AutomaticAcquisitionT
Automatic acquisition type.
@ InvalidAcquisitionT
Invalid acquisition type.
@ ManualAcquisitionT
Manual acquisition type.
TiePointAcquisitionType m_acqType
Acquisition type.
This class is used to define a widget for tie point parameters acquirement.
This class is used to define a widget for tie point acquirement.
@ Reference
Reference first coord was picked.
std::unique_ptr< te::qt::widgets::RasterNavigatorDialog > m_adjNavigatorDPtr
Adjust raster navigator.
te::gm::GTParameters::TiePoint m_currentTiePoint
The current tie-point.
FirstCoordType getFirstTiePointCoord(te::gm::Coord2D &firstCoord)
Get tie point reference coord that does not have an adjust coordenate or \ tie point adjust coord tha...
void tiePointsTableUpdate()
Uptate the tie-points table widget.
te::color::RGBAColor ** m_rgbaMarkSelected
Represents the pattern of a selected tie point.
void refCoordMoved(double xorig, double yorig, double xnew, double ynew)
std::map< unsigned int, QPointF > m_refPoints
Display reference coordinates.
te::color::RGBAColor ** m_rgbaMarkUnselected
Represents the pattern of a unselected tie point.
std::string getTransformationName() const
te::se::Mark * m_markRef
Represents the mark of a reference tie point.
std::unique_ptr< te::qt::widgets::RasterNavigatorDialog > m_refNavigatorDPtr
Reference raster navigator.
FirstCoordType m_tiePointFirstCoord
Type of coord if the tie-point has the first part set;.
void setReferenceLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer used to be the reference layer.
void setAdjustLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer used to be the adjust layer.
QPixmap getPixmap(te::color::RGBAColor **rgba)
double getRastersMeanPixelSizeRelation() const
Returns the rasters pixel size relation ((under the reference SRS)).
te::color::RGBAColor ** m_rgbaMarkRef
Represents the pattern of reference tie point.
void getTiePointsIdxCoords(std::vector< te::gm::GTParameters::TiePoint > &tiePoints) const
Get the current acquired tie-points.
void refCoordPicked(double x, double y)
te::map::AbstractLayerPtr m_refLayer
Layer with reference imagem.
void getOutputResolution(double &resX, double &resY)
Ui::TiePointLocatorWidgetForm * getForm() const
void onTiePointsTableWidgetItemChanged(QTableWidgetItem *)
void onRefPointMoved(double xorig, double yorig, double xnew, double ynew)
te::map::AbstractLayerPtr m_adjLayer
Layer with adjust imagem.
te::rst::Interpolator::Method getInterpolatorMethod() const
te::se::Mark * m_markSelected
Represents the mark of a selected tie point.
std::unique_ptr< Ui::TiePointLocatorWidgetForm > m_ui
te::qt::widgets::TiePointData::TPContainerT m_tiePoints
Internal tie-points container..
unsigned int m_tiePointIdCounter
A ID counter for new tie pointes inserted into m_tiePoints;.
te::qt::widgets::TiePointLocatorParametersWidget * m_tiePointParameters
Tie Point parameters widget.
void hideEvent(QShowEvent *event)
std::map< unsigned int, QPointF > m_adjPoints
Display adjust coordinates.
void transformationInfoUpdate()
Uptate the current transformation information widgets.
void onRefPointPicked(double x, double y)
TiePointLocatorWidget(QWidget *parent=0, Qt::WindowFlags f=0)
te::se::Mark * m_markUnselected
Represents the mark of a unselected tie point.
void adjCoordMoved(double xorig, double yorig, double xnew, double ynew)
void getTiePoints(std::vector< te::gm::GTParameters::TiePoint > &tiePoints) const
Get the current acquired tie-points.
void adjCoordPicked(double x, double y)
void onAdjPointPicked(double x, double y)
void createSelection(int initialIdx, int nPos)
void showEvent(QShowEvent *event)
void getRastersPixelSizesRelation(double &pixelSizeXRelation, double &pixelSizeYRelation) const
Returns the rasters pixel sizes relation (under the reference SRS)
const te::qt::widgets::TiePointData::TPContainerT & getTiePointContainer()
Get tie point data container.
void onAdjPointMoved(double xorig, double yorig, double xnew, double ynew)
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:85
TEDATAACCESSEXPORT te::da::Expression * operator<(const te::da::Expression &e1, const te::da::Expression &e2)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
TerraLib.
#define slots
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63