1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_IMPORTIMAGEDLG_H
24 #define HYDROGUI_IMPORTIMAGEDLG_H
26 #include "HYDROGUI_InputPanel.h"
30 #define LAMBERT_X0 700000
31 #define LAMBERT_Y0 6600000
32 #define LAMBERT_LONG 3
33 #define LAMBERT_LATT 46.5
43 class QtxDoubleSpinBox;
46 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
51 struct TransformationData
54 QPointF GeodesicPoint;
55 QPointF CartesianPoint;
57 TransformationData() {}
59 TransformationData( const QPoint& theImagePoint ) :
60 ImagePoint( theImagePoint ) {}
62 TransformationData( const QPoint& theImagePoint,
63 const QPointF& theGeodesicPoint,
64 const QPointF& theCartesianPoint ) :
65 ImagePoint( theImagePoint ),
66 GeodesicPoint( theGeodesicPoint ),
67 CartesianPoint( theCartesianPoint ) {}
69 typedef QMap< int, TransformationData > TransformationDataMap;
71 typedef QPair< QString, TransformationDataMap > PrsPointData;
72 typedef QList< PrsPointData > PrsPointDataList;
73 typedef QListIterator< PrsPointData > PrsPointDataListIterator;
76 HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
77 virtual ~HYDROGUI_ImportImageDlg();
79 void setIsEdit( const bool theIsEdit );
82 void setImageName( const QString& theName );
83 QString getImageName() const;
85 void setRefImageName( const QString& theName );
86 QString getRefImageName() const;
88 QString getFileName() 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();
111 static TransformationData ComputeTrsfData( const int theMode,
112 const QPoint& theLocalPoint,
113 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 blockSignalsGeodesic( const bool theState );
131 void blockSignalsCartesian( const bool theState );
134 void createPreview( QImage );
135 void activatePointSelection( int );
136 void pointCoordChanged( bool theIsRef,
140 void modeActivated( int );
141 void refImageActivated( const QString& );
142 void setCIsUsed( bool theIsByTwoPoints );
145 QGroupBox* myFileNameGroup; //!< The group for the source image file selection
146 QLineEdit* myFileName; //!< Source image file name input field
148 QGroupBox* myImageNameGroup; //!< The group for the image name input field
149 QLineEdit* myImageName; //!< The image name input field
151 QGroupBox* myTransformGroup; //!< The group of input contols for points definition
153 QButtonGroup* myModeGroup; //!< The group for the input mode selector
154 QComboBox* myRefImage; //!< Reference image selector
156 QList<QLabel*> myGeodesicLabels; //!< Labels for geodesic coords input fields
158 QMap<int, QPushButton*> myPointBtnMap; //!< A,B,C points selection modes activators
159 QMap<int, QtxIntSpinBox*> myPointXMap; //!< X coord on the image
160 QMap<int, QtxIntSpinBox*> myPointYMap; //!< Y coord on the image
161 QMap<int, QtxIntSpinBox*> myPointXDegMap; //!< Longitude degrees
162 QMap<int, QtxIntSpinBox*> myPointYDegMap; //!< Latitude degrees
163 QMap<int, QtxIntSpinBox*> myPointXMinMap; //!< Longitude minutes
164 QMap<int, QtxIntSpinBox*> myPointYMinMap; //!< Latitude minutes
165 QMap<int, QtxDoubleSpinBox*> myPointXSecMap; //!< Longitude seconds
166 QMap<int, QtxDoubleSpinBox*> myPointYSecMap; //!< Latitude seconds
168 QMap<int, QtxDoubleSpinBox*> myCartPointXMap; //!< Lambert93 (cartesian) X coord (m)
169 QMap<int, QtxDoubleSpinBox*> myCartPointYMap; //!< Lambert93 (cartesian) Y coord (m)
171 QMap<int, QtxIntSpinBox*> myRefPointXMap; //!< X coord on the reference image
172 QMap<int, QtxIntSpinBox*> myRefPointYMap; //!< Y coord on the reference image
174 QCheckBox* myPointCEnabler; //!< Checkbox for enabling definition of the point C
176 PrsPointDataList myPrsPointDataList; //!< Points presentations
178 bool myIsInitialized; //!< True if a point selection is activated