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 QPointF m_refPoints; //!< Display reference coordinates.
80 QPointF m_adjPoints; //!< Display adjust coordinates.
81
83
84 TiePointData( const TiePointData& other );
85
87
88 const TiePointData& operator=( const TiePointData& other );
89
90 typedef std::map< unsigned int, TiePointData > TPContainerT; //!< Tie-pints container type definition.
91
92 };
93
94 /*!
95 \class TiePointLocatorWidget
96
97 \brief This class is used to define a widget for tie point acquirement.
98 */
100 {
101 Q_OBJECT
102
103 public:
104
106 {
107 None, //!< None first coord picked
108 Reference, //!< Reference first coord was picked
109 Adjust //!< Adjust first coord was picked
110 };
111
112 TiePointLocatorWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
113
115
116 Ui::TiePointLocatorWidgetForm* getForm() const;
117
118 /*!
119 \brief Get the current acquired tie-points.
120
121 \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).
122 */
123 void getTiePoints( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
124
125 /*!
126 \brief Get the current acquired tie-points.
127
128 \param tiePoints The current acquired tie-points.
129 */
130 void getTiePointsIdxCoords( std::vector< te::gm::GTParameters::TiePoint >& tiePoints ) const;
131
132 /*!
133 \brief Get tie point data container.
134
135 \return The tie point data container.
136 */
138
139 /*!
140 \brief Get tie point reference coord that does not have an adjust coordenate or
141 \ tie point adjust coord that does not have an reference coordenate
142 \param firstCoord The tie point reference or adjsut coord.
143
144 \return The m_tiePointHasFirstCoord type (None, Reference or Adjust).
145 */
147
148 /*!
149 \brief This method is used to set the selected layer used to be the reference layer
150
151 \param layer The layer ptr
152
153 \note This layer MUST HAVE a valid raster object.
154 */
156
157 /*!
158 \brief This method is used to set the selected layer used to be the adjust layer
159
160 \param layer The layer ptr
161
162 \note This layer MUST HAVE a valid raster object.
163 */
165
166 void getRefSRID(int& srid);
167
168 void getAdjSRID(int& srid);
169
170 void getOutputSRID(int& srid);
171
172 void getOutputResolution(double& resX, double& resY);
173
174 std::string getTransformationName() const;
175
177
179
180 protected:
181
182 /*!
183 \brief A proxy to allow table itens sorting
184 */
185 class TableItem: public QTableWidgetItem
186 {
187 public:
188 TableItem(const double& value, int type = Type)
189 : QTableWidgetItem( QString::number( value ), type )
190 {
191 setData( 0, QVariant( value ) );
192 };
193
194 TableItem(const QString &text, int type = Type)
195 : QTableWidgetItem( text, type )
196 {
197 setData( 0, QVariant( text.toDouble() ) );
198 };
199
200 bool operator< (const QTableWidgetItem &other) const
201 {
202 return ( data(0).toDouble() < other.data(0).toDouble() );
203 };
204 };
205
206 void refCoordPicked(double x, double y);
207
208 void adjCoordPicked(double x, double y);
209
210 void refCoordMoved(double xorig, double yorig, double xnew, double ynew);
211
212 void adjCoordMoved(double xorig, double yorig, double xnew, double ynew);
213
214 void setTiePointMarkLegend(QPixmap p);
215
217
219
220 void createSelection(int initialIdx, int nPos);
221
223
225
226 protected slots:
227
229
231
233
235
237
239
241
243
245
247
248 void onRefPointPicked(double x, double y);
249
250 void onAdjPointPicked(double x, double y);
251
252 void onRefPointMoved(double xorig, double yorig, double xnew, double ynew);
253
254 void onAdjPointMoved(double xorig, double yorig, double xnew, double ynew);
255
257
259
261
263
264 void onTiePointsTableWidgetItemChanged(QTableWidgetItem*);
265
266 void showEvent(QShowEvent *event);
267
268 void hideEvent(QShowEvent *event);
269
271
273
274 protected:
275
276 /*! \brief Uptate the tie-points table widget. */
278
279 /*! \brief Uptate the current transformation information widgets. */
281
283
285
286 void reset();
287
288 /*!
289 \brief Returns the rasters pixel sizes relation (under the reference SRS)
290 \param pixelSizeXRelation X Relation.
291 \param pixelSizeYRelation Y Relation.
292 \note PixelSizeRelation = Reference_Raster_Pixel_Size / Adjust_Raster_Pixel_Size
293 */
294 void getRastersPixelSizesRelation( double& pixelSizeXRelation,
295 double& pixelSizeYRelation ) const;
296
297 /*!
298 \brief Returns the rasters pixel size relation ((under the reference SRS)).
299 \note PixelSizeRelation = Reference_Raster_Mean_Pixel_Size / Adjust_Raster_Mean_Pixel_Size
300 */
302
303 /*!
304 \brief Returns the next not-used tie-point ID.
305 \param suggestedID The suggested ID will be returned if not used yet.
306 \returns Returns the next not-used tie-point ID.
307 */
308 unsigned int getNextAvailTPID( unsigned int suggestedID = 0 ) const;
309
310 signals:
311
313
315
316 private:
317
318 std::unique_ptr<Ui::TiePointLocatorWidgetForm> m_ui;
319
321
322 te::map::AbstractLayerPtr m_refLayer; //!< Layer with reference imagem
323 te::map::AbstractLayerPtr m_adjLayer; //!< Layer with adjust imagem
324
325 te::qt::widgets::TiePointData::TPContainerT m_tiePoints; //!< Internal tie-points container..
326
328 FirstCoordType m_tiePointFirstCoord; //!< Type of coord if the tie-point has the first part set;
329
330 std::unique_ptr< te::qt::widgets::RasterNavigatorDialog > m_refNavigatorDPtr; //!< Reference raster navigator
331 std::unique_ptr< te::qt::widgets::RasterNavigatorDialog > m_adjNavigatorDPtr; //!< Adjust raster navigator
332
333 te::color::RGBAColor** m_rgbaMarkSelected; //!< Represents the pattern of a selected tie point
334 te::color::RGBAColor** m_rgbaMarkUnselected; //!< Represents the pattern of a unselected tie point
335 te::color::RGBAColor** m_rgbaMarkRef; //!< Represents the pattern of reference tie point
336 te::se::Mark* m_markSelected; //!< Represents the mark of a selected tie point
337 te::se::Mark* m_markUnselected; //!< Represents the mark of a unselected tie point
338 te::se::Mark* m_markRef; //!< Represents the mark of a reference tie point
339 std::map< unsigned int, QPointF > m_refPoints; //!< Display reference coordinates
340 std::map< unsigned int, QPointF > m_adjPoints; //!< Display adjust coordinates
341 };
342
343 } // end namespace widgets
344 } // end namespace qt
345} // end namespace te
346
347#endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_TIEPOINTLOCATORWIDGET_H
348
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.
bool m_selected
Tie point selection status;.
QPointF m_adjPoints
Display adjust coordinates.
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.
QPointF m_refPoints
Display reference coordinates.
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.
unsigned int getNextAvailTPID(unsigned int suggestedID=0) const
Returns the next not-used tie-point ID.
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..
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