Salome HOME
Compilation errors.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageDlg.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROGUI_IMPORTIMAGEDLG_H
24 #define HYDROGUI_IMPORTIMAGEDLG_H
25
26 #include "HYDROGUI_InputPanel.h"
27
28 #include <QMap>
29
30 class QButtonGroup;
31 class QComboBox;
32 class QGroupBox;
33 class QLabel;
34 class QLineEdit;
35
36 class QtxDoubleSpinBox;
37 class QtxIntSpinBox;
38
39 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
40 {
41   Q_OBJECT
42
43 public:
44   enum TransformationMode { ManualLambert = 0, ManualCartesian, RefImage };
45
46 public:
47   struct TransformationData
48   {
49     QPoint  ImagePoint;
50     QPointF LambertPoint;
51     QPointF CartesianPoint;
52
53     TransformationData() {}
54
55     TransformationData( const QPoint& theImagePoint,
56                         const QPointF& theLambertPoint,
57                         const QPointF& theCartesianPoint ) :
58       ImagePoint( theImagePoint ),
59       LambertPoint( theLambertPoint ),
60       CartesianPoint( theCartesianPoint ) {}
61   };
62   typedef QMap< int, TransformationData > TransformationDataMap;
63
64   typedef QPair< QString, TransformationDataMap > PrsPointData;
65   typedef QList< PrsPointData >                   PrsPointDataList;
66   typedef QListIterator< PrsPointData >           PrsPointDataListIterator;
67
68 public:
69   HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
70   virtual ~HYDROGUI_ImportImageDlg();
71
72   void                       setIsEdit( const bool theIsEdit );
73   void                       reset();
74
75   void                       setImageName( const QString& theName );
76   QString                    getImageName() const;
77
78   QString                    getFileName() const;
79
80   void                       setImageSize( const QSize& theSize,
81                                            const bool theIsRefImage = false );
82
83   void                       setTransformationMode( const int theMode );
84   int                        getTransformationMode() const;
85
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;
91
92   QString                    getRefImageName() const;
93
94   void                       setPrsPointDataList( const PrsPointDataList& theList );
95
96   void                       initializePointSelection();
97
98 protected slots:
99   void                       onBrowse();
100   void                       onModeActivated( int );
101   void                       onRefImageActivated( const QString& );
102   void                       onPointBtnToggled( bool );
103   void                       onPointCoordChanged( int );
104
105   void                       onLambertCoordChanged();
106   void                       onLambertCoordChanged( const int thePointType );
107
108   void                       onCartesianCoordChanged();
109   void                       onCartesianCoordChanged( const int thePointType );
110
111 private:
112   void                       blockSignalsLambert( const bool theState );
113   void                       blockSignalsCartesian( const bool theState );
114
115 signals:
116   void                       createPreview( QImage );
117   void                       activatePointSelection( int );
118   void                       pointCoordChanged( bool theIsRef,
119                                                 int thePointType,
120                                                 bool theIsY,
121                                                 int theValue );
122   void                       modeActivated( int );
123   void                       refImageActivated( const QString& );
124
125 private:
126   QGroupBox*                 myFileNameGroup;
127   QLineEdit*                 myFileName;
128
129   QGroupBox*                 myImageNameGroup;
130   QLineEdit*                 myImageName;
131
132   QGroupBox*                 myTransformGroup;
133
134   QButtonGroup*              myModeGroup;
135   QComboBox*                 myRefImage;
136
137   QList<QLabel*>             myLambertLabels;
138
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;
148
149   QMap<int, QtxDoubleSpinBox*> myCartPointXMap;
150   QMap<int, QtxDoubleSpinBox*> myCartPointYMap;
151
152   QMap<int, QtxIntSpinBox*>  myRefPointXMap;
153   QMap<int, QtxIntSpinBox*>  myRefPointYMap;
154
155   PrsPointDataList           myPrsPointDataList;
156
157   bool                       myIsInitialized;
158 };
159
160 #endif