Salome HOME
HYDRO Feature 1: Import images (T 1.3)
[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 { Manual = 0, RefImage };
45
46 public:
47   typedef QPair< QPoint, QPointF >        TransformationData;
48   typedef QMap< int, TransformationData > TransformationDataMap;
49
50   typedef QPair< QString, TransformationDataMap > PrsPointData;
51   typedef QList< PrsPointData >                   PrsPointDataList;
52   typedef QListIterator< PrsPointData >           PrsPointDataListIterator;
53
54 public:
55   HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
56   virtual ~HYDROGUI_ImportImageDlg();
57
58   void                       setIsEdit( const bool theIsEdit );
59   void                       reset();
60
61   void                       setImageName( const QString& theName );
62   QString                    getImageName() const;
63
64   void                       setImageSize( const QSize& theSize,
65                                            const bool theIsRefImage = false );
66
67   int                        getTransformationMode() const;
68
69   void                       setTransformationDataMap( const TransformationDataMap& theMap,
70                                                        const bool theIsOnlyInput = false,
71                                                        const bool theIsRefImage = false );
72   bool                       getTransformationDataMap( TransformationDataMap& theMap,
73                                                        const bool theIsRefImage = false ) const;
74
75   void                       setPrsPointDataList( const PrsPointDataList& theList );
76
77   void                       initializePointSelection();
78
79 protected slots:
80   void                       onBrowse();
81   void                       onModeActivated( int );
82   void                       onRefImageActivated( const QString& );
83   void                       onPointBtnToggled( bool );
84   void                       onPointCoordChanged( int );
85
86 signals:
87   void                       createPreview( QImage );
88   void                       activatePointSelection( int );
89   void                       pointCoordChanged( bool theIsRef,
90                                                 int thePointType,
91                                                 bool theIsY,
92                                                 int theValue );
93   void                       refImageActivated( const QString& );
94
95 private:
96   QGroupBox*                 myFileNameGroup;
97   QLineEdit*                 myFileName;
98
99   QGroupBox*                 myImageNameGroup;
100   QLineEdit*                 myImageName;
101
102   QGroupBox*                 myTransformGroup;
103   QButtonGroup*              myModeGroup;
104
105   QWidget*                   myRefImageWg;
106   QComboBox*                 myRefImage;
107
108   QList<QLabel*>             myLambertLabels;
109
110   QMap<int, QPushButton*>    myPointBtnMap;
111   QMap<int, QtxIntSpinBox*>  myPointXMap;
112   QMap<int, QtxIntSpinBox*>  myPointYMap;
113   QMap<int, QtxIntSpinBox*>  myPointXDegMap;
114   QMap<int, QtxIntSpinBox*>  myPointYDegMap;
115   QMap<int, QtxIntSpinBox*>  myPointXMinMap;
116   QMap<int, QtxIntSpinBox*>  myPointYMinMap;
117   QMap<int, QtxDoubleSpinBox*> myPointXSecMap;
118   QMap<int, QtxDoubleSpinBox*> myPointYSecMap;
119
120   QMap<int, QtxIntSpinBox*>  myRefPointXMap;
121   QMap<int, QtxIntSpinBox*>  myRefPointYMap;
122
123   PrsPointDataList           myPrsPointDataList;
124 };
125
126 #endif