1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROGUI_IMPORTIMAGEDLG_H
20 #define HYDROGUI_IMPORTIMAGEDLG_H
22 #include "HYDROGUI_InputPanel.h"
26 #define LAMBERT_X0 700000
27 #define LAMBERT_Y0 6600000
28 #define LAMBERT_LONG 3
29 #define LAMBERT_LATT 46.5
39 class QtxDoubleSpinBox;
41 class QAbstractSpinBox;
43 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
48 struct TransformationData
51 QPointF GeodesicPoint;
52 QPointF CartesianPoint;
54 TransformationData() {}
56 TransformationData( const QPoint& theImagePoint ) :
57 ImagePoint( theImagePoint ) {}
59 TransformationData( const QPoint& theImagePoint,
60 const QPointF& theGeodesicPoint,
61 const QPointF& theCartesianPoint ) :
62 ImagePoint( theImagePoint ),
63 GeodesicPoint( theGeodesicPoint ),
64 CartesianPoint( theCartesianPoint ) {}
66 typedef QMap< int, TransformationData > TransformationDataMap;
68 typedef QPair< QString, TransformationDataMap > PrsPointData;
69 typedef QList< PrsPointData > PrsPointDataList;
70 typedef QListIterator< PrsPointData > PrsPointDataListIterator;
73 HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
74 virtual ~HYDROGUI_ImportImageDlg();
76 void setIsEdit( const bool theIsEdit );
79 void setImageName( const QString& theName );
80 QString getImageName() const;
82 void setRefImageName( const QString& theName );
83 QString getRefImageName() const;
85 QString getFileName() const;
86 void setFileName( const QString& theName );
87 QString getGeoreferencementFileName() const;
89 void setImageSize( const QSize& theSize,
90 const bool theIsRefImage = false );
92 void setTransformationMode( const int theMode );
93 int getTransformationMode() const;
95 void setByTwoPoints( const bool theIsByTwoPoints );
96 bool isByTwoPoints() const;
98 void setTransformationDataMap( const TransformationDataMap& theMap,
99 const bool theIsOnlyInput = false,
100 const bool theIsRefImage = false );
101 bool getTransformationDataMap( TransformationDataMap& theMap,
102 const bool theIsRefImage = false ) const;
104 void setPrsPointDataList( const PrsPointDataList& theList );
106 void initializePointSelection();
110 static TransformationData ComputeTrsfData( const int theMode,
111 const QPoint& theLocalPoint,
112 const QPointF& theGlobalPoint );
117 void onModeActivated( int );
118 void onRefImageActivated( const QString& );
119 void onPointBtnToggled( bool );
120 void onPointCoordChanged( int );
121 void onSetCIsUsed( bool theCIsUsed );
123 void onGeodesicCoordChanged();
124 void onGeodesicCoordChanged( const int thePointType );
126 void onCartesianCoordChanged();
127 void onCartesianCoordChanged( const int thePointType );
130 void clearSpins( QAbstractSpinBox* theSpin );
131 bool blockSignalsPoints( const bool theState );
132 bool blockSignalsGeodesic( const bool theState );
133 bool blockSignalsCartesian( const bool theState );
136 void createPreview( QImage );
137 void activatePointSelection( int );
138 void pointCoordChanged( bool theIsRef,
142 void modeActivated( int );
143 void refImageActivated( const QString& );
144 void setCIsUsed( bool theIsByTwoPoints );
147 QGroupBox* myFileNameGroup; //!< The group for the source image file selection
148 QLineEdit* myFileName; //!< Source image file name input field
150 QGroupBox* myImageNameGroup; //!< The group for the image name input field
151 QLineEdit* myImageName; //!< The image name input field
153 QGroupBox* myTransformGroup; //!< The group of input contols for points definition
155 QButtonGroup* myModeGroup; //!< The group for the input mode selector
156 QComboBox* myRefImage; //!< Reference image selector
158 QLineEdit* myGeoFileName; //!< Image georeferencement file name input field
160 QList<QLabel*> myGeodesicLabels; //!< Labels for geodesic coords input fields
162 QMap<int, QPushButton*> myPointBtnMap; //!< A,B,C points selection modes activators
163 QMap<int, QtxIntSpinBox*> myPointXMap; //!< X coord on the image
164 QMap<int, QtxIntSpinBox*> myPointYMap; //!< Y coord on the image
165 QMap<int, QtxIntSpinBox*> myPointXDegMap; //!< Longitude degrees
166 QMap<int, QtxIntSpinBox*> myPointYDegMap; //!< Latitude degrees
167 QMap<int, QtxIntSpinBox*> myPointXMinMap; //!< Longitude minutes
168 QMap<int, QtxIntSpinBox*> myPointYMinMap; //!< Latitude minutes
169 QMap<int, QtxDoubleSpinBox*> myPointXSecMap; //!< Longitude seconds
170 QMap<int, QtxDoubleSpinBox*> myPointYSecMap; //!< Latitude seconds
172 QMap<int, QtxDoubleSpinBox*> myCartPointXMap; //!< Lambert93 (cartesian) X coord (m)
173 QMap<int, QtxDoubleSpinBox*> myCartPointYMap; //!< Lambert93 (cartesian) Y coord (m)
175 QMap<int, QtxIntSpinBox*> myRefPointXMap; //!< X coord on the reference image
176 QMap<int, QtxIntSpinBox*> myRefPointYMap; //!< Y coord on the reference image
178 QCheckBox* myPointCEnabler; //!< Checkbox for enabling definition of the point C
180 PrsPointDataList myPrsPointDataList; //!< Points presentations
182 bool myIsInitialized; //!< True if a point selection is activated