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"
23 #include <HYDROData_Image.h>
27 #define LAMBERT_X0 700000
28 #define LAMBERT_Y0 6600000
29 #define LAMBERT_LONG 3
30 #define LAMBERT_LATT 46.5
40 class QtxDoubleSpinBox;
42 class QAbstractSpinBox;
45 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
50 struct TransformationData
53 QPointF GeodesicPoint;
54 QPointF CartesianPoint;
56 TransformationData() {}
58 TransformationData( const QPoint& theImagePoint ) :
59 ImagePoint( theImagePoint ) {}
61 TransformationData( const QPoint& theImagePoint,
62 const QPointF& theGeodesicPoint,
63 const QPointF& theCartesianPoint ) :
64 ImagePoint( theImagePoint ),
65 GeodesicPoint( theGeodesicPoint ),
66 CartesianPoint( theCartesianPoint ) {}
68 typedef QMap< int, TransformationData > TransformationDataMap;
70 typedef QPair< QString, TransformationDataMap > PrsPointData;
71 typedef QList< PrsPointData > PrsPointDataList;
72 typedef QListIterator< PrsPointData > PrsPointDataListIterator;
75 HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
76 virtual ~HYDROGUI_ImportImageDlg();
78 void setIsEdit( const bool theIsEdit );
81 void setImageName( const QString& theName );
82 QString getImageName() const;
84 void setRefImageName( const QString& theName );
85 QString getRefImageName() const;
87 QString getFileName() const;
88 void setFileName( const QString& theName );
89 QString getGeoreferencementFileName() const;
91 void setImageSize( const QSize& theSize,
92 const bool theIsRefImage = false );
94 void setTransformationMode( const int theMode );
95 int getTransformationMode() const;
97 void setByTwoPoints( const bool theIsByTwoPoints );
98 bool isByTwoPoints() const;
100 void setTransformationDataMap( const TransformationDataMap& theMap,
101 const bool theIsOnlyInput = false,
102 const bool theIsRefImage = false );
103 bool getTransformationDataMap( TransformationDataMap& theMap,
104 const bool theIsRefImage = false ) const;
106 void setPrsPointDataList( const PrsPointDataList& theList );
108 void initializePointSelection();
111 void ECW_initializePointSelection(HYDROData_Image::ECW_FileInfo* theECW_FileInfo);
114 void ActivateFile( const QString& theFileName, bool isEnableFilesChoice );
118 static TransformationData ComputeTrsfData( const int theMode,
119 const QPoint& theLocalPoint,
120 const QPointF& theGlobalPoint );
125 void onModeActivated( int );
126 void onRefImageActivated( const QString& );
127 void onPointBtnToggled( bool );
128 void onPointCoordChanged( int );
129 void onSetCIsUsed( bool theCIsUsed );
131 void onGeodesicCoordChanged();
132 void onGeodesicCoordChanged( const int thePointType );
134 void onCartesianCoordChanged();
135 void onCartesianCoordChanged( const int thePointType );
138 void clearSpins( QAbstractSpinBox* theSpin );
139 bool blockSignalsPoints( const bool theState );
140 bool blockSignalsGeodesic( const bool theState );
141 bool blockSignalsCartesian( const bool theState );
144 void createPreview( QImage, HYDROData_Image::ECW_FileInfo* );
145 void activatePointSelection( int );
146 void pointCoordChanged( bool theIsRef,
150 void modeActivated( int );
151 void refImageActivated( const QString& );
152 void setCIsUsed( bool theIsByTwoPoints );
153 void filesSelected( const QStringList& );
156 QGroupBox* myFileNameGroup; //!< The group for the source image file selection
157 QLineEdit* myFileName; //!< Source image file name input field
158 QToolButton* myBrowseBtn;
160 QGroupBox* myImageNameGroup; //!< The group for the image name input field
161 QLineEdit* myImageName; //!< The image name input field
163 QGroupBox* myTransformGroup; //!< The group of input contols for points definition
165 QButtonGroup* myModeGroup; //!< The group for the input mode selector
166 QComboBox* myRefImage; //!< Reference image selector
168 QLineEdit* myGeoFileName; //!< Image georeferencement file name input field
170 QList<QLabel*> myGeodesicLabels; //!< Labels for geodesic coords input fields
172 QMap<int, QPushButton*> myPointBtnMap; //!< A,B,C points selection modes activators
173 QMap<int, QtxIntSpinBox*> myPointXMap; //!< X coord on the image
174 QMap<int, QtxIntSpinBox*> myPointYMap; //!< Y coord on the image
175 QMap<int, QtxIntSpinBox*> myPointXDegMap; //!< Longitude degrees
176 QMap<int, QtxIntSpinBox*> myPointYDegMap; //!< Latitude degrees
177 QMap<int, QtxIntSpinBox*> myPointXMinMap; //!< Longitude minutes
178 QMap<int, QtxIntSpinBox*> myPointYMinMap; //!< Latitude minutes
179 QMap<int, QtxDoubleSpinBox*> myPointXSecMap; //!< Longitude seconds
180 QMap<int, QtxDoubleSpinBox*> myPointYSecMap; //!< Latitude seconds
182 QMap<int, QtxDoubleSpinBox*> myCartPointXMap; //!< Lambert93 (cartesian) X coord (m)
183 QMap<int, QtxDoubleSpinBox*> myCartPointYMap; //!< Lambert93 (cartesian) Y coord (m)
185 QMap<int, QtxIntSpinBox*> myRefPointXMap; //!< X coord on the reference image
186 QMap<int, QtxIntSpinBox*> myRefPointYMap; //!< Y coord on the reference image
188 QCheckBox* myPointCEnabler; //!< Checkbox for enabling definition of the point C
190 PrsPointDataList myPrsPointDataList; //!< Points presentations
192 bool myIsInitialized; //!< True if a point selection is activated