Salome HOME
Selector implementation for OCC viewer.
[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   QString                    getFileName() const;
65
66   void                       setImageSize( const QSize& theSize,
67                                            const bool theIsRefImage = false );
68
69   int                        getTransformationMode() const;
70
71   void                       setTransformationDataMap( const TransformationDataMap& theMap,
72                                                        const bool theIsOnlyInput = false,
73                                                        const bool theIsRefImage = false );
74   bool                       getTransformationDataMap( TransformationDataMap& theMap,
75                                                        const bool theIsRefImage = false ) const;
76
77   void                       setPrsPointDataList( const PrsPointDataList& theList );
78
79   void                       initializePointSelection();
80
81 protected slots:
82   void                       onBrowse();
83   void                       onModeActivated( int );
84   void                       onRefImageActivated( const QString& );
85   void                       onPointBtnToggled( bool );
86   void                       onPointCoordChanged( int );
87
88 signals:
89   void                       createPreview( QImage );
90   void                       activatePointSelection( int );
91   void                       pointCoordChanged( bool theIsRef,
92                                                 int thePointType,
93                                                 bool theIsY,
94                                                 int theValue );
95   void                       refImageActivated( const QString& );
96
97 private:
98   QGroupBox*                 myFileNameGroup;
99   QLineEdit*                 myFileName;
100
101   QGroupBox*                 myImageNameGroup;
102   QLineEdit*                 myImageName;
103
104   QGroupBox*                 myTransformGroup;
105   QButtonGroup*              myModeGroup;
106
107   QWidget*                   myRefImageWg;
108   QComboBox*                 myRefImage;
109
110   QList<QLabel*>             myLambertLabels;
111
112   QMap<int, QPushButton*>    myPointBtnMap;
113   QMap<int, QtxIntSpinBox*>  myPointXMap;
114   QMap<int, QtxIntSpinBox*>  myPointYMap;
115   QMap<int, QtxIntSpinBox*>  myPointXDegMap;
116   QMap<int, QtxIntSpinBox*>  myPointYDegMap;
117   QMap<int, QtxIntSpinBox*>  myPointXMinMap;
118   QMap<int, QtxIntSpinBox*>  myPointYMinMap;
119   QMap<int, QtxDoubleSpinBox*> myPointXSecMap;
120   QMap<int, QtxDoubleSpinBox*> myPointYSecMap;
121
122   QMap<int, QtxIntSpinBox*>  myRefPointXMap;
123   QMap<int, QtxIntSpinBox*>  myRefPointYMap;
124
125   PrsPointDataList           myPrsPointDataList;
126 };
127
128 #endif