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;
44 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
49 struct TransformationData
52 QPointF GeodesicPoint;
53 QPointF CartesianPoint;
55 TransformationData() {}
57 TransformationData( const QPoint& theImagePoint ) :
58 ImagePoint( theImagePoint ) {}
60 TransformationData( const QPoint& theImagePoint,
61 const QPointF& theGeodesicPoint,
62 const QPointF& theCartesianPoint ) :
63 ImagePoint( theImagePoint ),
64 GeodesicPoint( theGeodesicPoint ),
65 CartesianPoint( theCartesianPoint ) {}
67 typedef QMap< int, TransformationData > TransformationDataMap;
69 typedef QPair< QString, TransformationDataMap > PrsPointData;
70 typedef QList< PrsPointData > PrsPointDataList;
71 typedef QListIterator< PrsPointData > PrsPointDataListIterator;
74 HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
75 virtual ~HYDROGUI_ImportImageDlg();
77 void setIsEdit( const bool theIsEdit );
80 void setImageName( const QString& theName );
81 QString getImageName() const;
83 void setRefImageName( const QString& theName );
84 QString getRefImageName() const;
86 QString getFileName() const;
87 void setFileName( const QString& theName );
88 QString getGeoreferencementFileName() const;
90 void setImageSize( const QSize& theSize,
91 const bool theIsRefImage = false );
93 void setTransformationMode( const int theMode );
94 int getTransformationMode() const;
96 void setByTwoPoints( const bool theIsByTwoPoints );
97 bool isByTwoPoints() const;
99 void setTransformationDataMap( const TransformationDataMap& theMap,
100 const bool theIsOnlyInput = false,
101 const bool theIsRefImage = false );
102 bool getTransformationDataMap( TransformationDataMap& theMap,
103 const bool theIsRefImage = false ) const;
105 void setPrsPointDataList( const PrsPointDataList& theList );
107 void initializePointSelection();
109 void ActivateFile( const QString& theFileName, bool isEnableFilesChoice );
113 static TransformationData ComputeTrsfData( const int theMode,
114 const QPoint& theLocalPoint,
115 const QPointF& theGlobalPoint );
120 void onModeActivated( int );
121 void onRefImageActivated( const QString& );
122 void onPointBtnToggled( bool );
123 void onPointCoordChanged( int );
124 void onSetCIsUsed( bool theCIsUsed );
126 void onGeodesicCoordChanged();
127 void onGeodesicCoordChanged( const int thePointType );
129 void onCartesianCoordChanged();
130 void onCartesianCoordChanged( const int thePointType );
133 void clearSpins( QAbstractSpinBox* theSpin );
134 bool blockSignalsPoints( const bool theState );
135 bool blockSignalsGeodesic( const bool theState );
136 bool blockSignalsCartesian( const bool theState );
139 void createPreview( QImage );
140 void activatePointSelection( int );
141 void pointCoordChanged( bool theIsRef,
145 void modeActivated( int );
146 void refImageActivated( const QString& );
147 void setCIsUsed( bool theIsByTwoPoints );
148 void filesSelected( const QStringList& );
151 QGroupBox* myFileNameGroup; //!< The group for the source image file selection
152 QLineEdit* myFileName; //!< Source image file name input field
153 QToolButton* myBrowseBtn;
155 QGroupBox* myImageNameGroup; //!< The group for the image name input field
156 QLineEdit* myImageName; //!< The image name input field
158 QGroupBox* myTransformGroup; //!< The group of input contols for points definition
160 QButtonGroup* myModeGroup; //!< The group for the input mode selector
161 QComboBox* myRefImage; //!< Reference image selector
163 QLineEdit* myGeoFileName; //!< Image georeferencement file name input field
165 QList<QLabel*> myGeodesicLabels; //!< Labels for geodesic coords input fields
167 QMap<int, QPushButton*> myPointBtnMap; //!< A,B,C points selection modes activators
168 QMap<int, QtxIntSpinBox*> myPointXMap; //!< X coord on the image
169 QMap<int, QtxIntSpinBox*> myPointYMap; //!< Y coord on the image
170 QMap<int, QtxIntSpinBox*> myPointXDegMap; //!< Longitude degrees
171 QMap<int, QtxIntSpinBox*> myPointYDegMap; //!< Latitude degrees
172 QMap<int, QtxIntSpinBox*> myPointXMinMap; //!< Longitude minutes
173 QMap<int, QtxIntSpinBox*> myPointYMinMap; //!< Latitude minutes
174 QMap<int, QtxDoubleSpinBox*> myPointXSecMap; //!< Longitude seconds
175 QMap<int, QtxDoubleSpinBox*> myPointYSecMap; //!< Latitude seconds
177 QMap<int, QtxDoubleSpinBox*> myCartPointXMap; //!< Lambert93 (cartesian) X coord (m)
178 QMap<int, QtxDoubleSpinBox*> myCartPointYMap; //!< Lambert93 (cartesian) Y coord (m)
180 QMap<int, QtxIntSpinBox*> myRefPointXMap; //!< X coord on the reference image
181 QMap<int, QtxIntSpinBox*> myRefPointYMap; //!< Y coord on the reference image
183 QCheckBox* myPointCEnabler; //!< Checkbox for enabling definition of the point C
185 PrsPointDataList myPrsPointDataList; //!< Points presentations
187 bool myIsInitialized; //!< True if a point selection is activated