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"
36 class QtxDoubleSpinBox;
39 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
44 enum TransformationMode { ManualLambert = 0, ManualCartesian, RefImage };
47 struct TransformationData
51 QPointF CartesianPoint;
53 TransformationData() {}
55 TransformationData( const QPoint& theImagePoint,
56 const QPointF& theLambertPoint,
57 const QPointF& theCartesianPoint ) :
58 ImagePoint( theImagePoint ),
59 LambertPoint( theLambertPoint ),
60 CartesianPoint( theCartesianPoint ) {}
62 typedef QMap< int, TransformationData > TransformationDataMap;
64 typedef QPair< QString, TransformationDataMap > PrsPointData;
65 typedef QList< PrsPointData > PrsPointDataList;
66 typedef QListIterator< PrsPointData > PrsPointDataListIterator;
69 HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
70 virtual ~HYDROGUI_ImportImageDlg();
72 void setIsEdit( const bool theIsEdit );
75 void setImageName( const QString& theName );
76 QString getImageName() const;
78 QString getFileName() const;
80 void setImageSize( const QSize& theSize,
81 const bool theIsRefImage = false );
83 void setTransformationMode( const int theMode );
84 int getTransformationMode() const;
86 void setTransformationDataMap( const TransformationDataMap& theMap,
87 const bool theIsOnlyInput = false,
88 const bool theIsRefImage = false );
89 bool getTransformationDataMap( TransformationDataMap& theMap,
90 const bool theIsRefImage = false ) const;
92 QString getRefImageName() const;
94 void setPrsPointDataList( const PrsPointDataList& theList );
96 void initializePointSelection();
100 void onModeActivated( int );
101 void onRefImageActivated( const QString& );
102 void onPointBtnToggled( bool );
103 void onPointCoordChanged( int );
105 void onLambertCoordChanged();
106 void onLambertCoordChanged( const int thePointType );
108 void onCartesianCoordChanged();
109 void onCartesianCoordChanged( const int thePointType );
112 void blockSignalsLambert( const bool theState );
113 void blockSignalsCartesian( const bool theState );
116 void createPreview( QImage );
117 void activatePointSelection( int );
118 void pointCoordChanged( bool theIsRef,
122 void modeActivated( int );
123 void refImageActivated( const QString& );
126 QGroupBox* myFileNameGroup;
127 QLineEdit* myFileName;
129 QGroupBox* myImageNameGroup;
130 QLineEdit* myImageName;
132 QGroupBox* myTransformGroup;
134 QButtonGroup* myModeGroup;
135 QComboBox* myRefImage;
137 QList<QLabel*> myLambertLabels;
139 QMap<int, QPushButton*> myPointBtnMap;
140 QMap<int, QtxIntSpinBox*> myPointXMap;
141 QMap<int, QtxIntSpinBox*> myPointYMap;
142 QMap<int, QtxIntSpinBox*> myPointXDegMap;
143 QMap<int, QtxIntSpinBox*> myPointYDegMap;
144 QMap<int, QtxIntSpinBox*> myPointXMinMap;
145 QMap<int, QtxIntSpinBox*> myPointYMinMap;
146 QMap<int, QtxDoubleSpinBox*> myPointXSecMap;
147 QMap<int, QtxDoubleSpinBox*> myPointYSecMap;
149 QMap<int, QtxDoubleSpinBox*> myCartPointXMap;
150 QMap<int, QtxDoubleSpinBox*> myCartPointYMap;
152 QMap<int, QtxIntSpinBox*> myRefPointXMap;
153 QMap<int, QtxIntSpinBox*> myRefPointYMap;
155 PrsPointDataList myPrsPointDataList;
157 bool myIsInitialized;