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"
37 class QtxDoubleSpinBox;
40 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
45 struct TransformationData
49 QPointF CartesianPoint;
51 TransformationData() {}
53 TransformationData( const QPoint& theImagePoint ) :
54 ImagePoint( theImagePoint ) {}
56 TransformationData( const QPoint& theImagePoint,
57 const QPointF& theLambertPoint,
58 const QPointF& theCartesianPoint ) :
59 ImagePoint( theImagePoint ),
60 LambertPoint( theLambertPoint ),
61 CartesianPoint( theCartesianPoint ) {}
63 typedef QMap< int, TransformationData > TransformationDataMap;
65 typedef QPair< QString, TransformationDataMap > PrsPointData;
66 typedef QList< PrsPointData > PrsPointDataList;
67 typedef QListIterator< PrsPointData > PrsPointDataListIterator;
70 HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
71 virtual ~HYDROGUI_ImportImageDlg();
73 void setIsEdit( const bool theIsEdit );
76 void setImageName( const QString& theName );
77 QString getImageName() const;
79 void setRefImageName( const QString& theName );
80 QString getRefImageName() const;
82 QString getFileName() const;
84 void setImageSize( const QSize& theSize,
85 const bool theIsRefImage = false );
87 void setTransformationMode( const int theMode );
88 int getTransformationMode() const;
90 void setByTwoPoints( const bool theIsByTwoPoints );
91 bool isByTwoPoints() const;
93 void setTransformationDataMap( const TransformationDataMap& theMap,
94 const bool theIsOnlyInput = false,
95 const bool theIsRefImage = false );
96 bool getTransformationDataMap( TransformationDataMap& theMap,
97 const bool theIsRefImage = false ) const;
99 void setPrsPointDataList( const PrsPointDataList& theList );
101 void initializePointSelection();
105 static TransformationData ComputeTrsfData( const int theMode,
106 const QPoint& theLocalPoint,
107 const QPointF& theGlobalPoint );
111 void onModeActivated( int );
112 void onRefImageActivated( const QString& );
113 void onPointBtnToggled( bool );
114 void onPointCoordChanged( int );
116 void onLambertCoordChanged();
117 void onLambertCoordChanged( const int thePointType );
119 void onCartesianCoordChanged();
120 void onCartesianCoordChanged( const int thePointType );
123 void blockSignalsLambert( const bool theState );
124 void blockSignalsCartesian( const bool theState );
127 void createPreview( QImage );
128 void activatePointSelection( int );
129 void pointCoordChanged( bool theIsRef,
133 void modeActivated( int );
134 void refImageActivated( const QString& );
137 QGroupBox* myFileNameGroup;
138 QLineEdit* myFileName;
140 QGroupBox* myImageNameGroup;
141 QLineEdit* myImageName;
143 QGroupBox* myTransformGroup;
145 QButtonGroup* myModeGroup;
146 QComboBox* myRefImage;
148 QList<QLabel*> myLambertLabels;
150 QMap<int, QPushButton*> myPointBtnMap;
151 QMap<int, QtxIntSpinBox*> myPointXMap;
152 QMap<int, QtxIntSpinBox*> myPointYMap;
153 QMap<int, QtxIntSpinBox*> myPointXDegMap;
154 QMap<int, QtxIntSpinBox*> myPointYDegMap;
155 QMap<int, QtxIntSpinBox*> myPointXMinMap;
156 QMap<int, QtxIntSpinBox*> myPointYMinMap;
157 QMap<int, QtxDoubleSpinBox*> myPointXSecMap;
158 QMap<int, QtxDoubleSpinBox*> myPointYSecMap;
160 QMap<int, QtxDoubleSpinBox*> myCartPointXMap;
161 QMap<int, QtxDoubleSpinBox*> myCartPointYMap;
163 QMap<int, QtxIntSpinBox*> myRefPointXMap;
164 QMap<int, QtxIntSpinBox*> myRefPointYMap;
166 QCheckBox* myPointCEnabler;
168 PrsPointDataList myPrsPointDataList;
170 bool myIsInitialized;