Salome HOME
Image positioning by two points.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageDlg.h
index 18e8b54c66b0f7d44808754e352ea606b9c20ad6..3473fdfb89352a94fb21dcf89266895067b08430 100644 (file)
@@ -32,6 +32,7 @@ class QComboBox;
 class QGroupBox;
 class QLabel;
 class QLineEdit;
+class QCheckBox;
 
 class QtxDoubleSpinBox;
 class QtxIntSpinBox;
@@ -41,10 +42,24 @@ class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
   Q_OBJECT
 
 public:
-  enum TransformationMode { Manual = 0, RefImage };
-
-public:
-  typedef QPair< QPoint, QPointF >        TransformationData;
+  struct TransformationData
+  {
+    QPoint  ImagePoint;
+    QPointF LambertPoint;
+    QPointF CartesianPoint;
+
+    TransformationData() {}
+
+    TransformationData( const QPoint& theImagePoint ) :
+      ImagePoint( theImagePoint ) {}
+
+    TransformationData( const QPoint& theImagePoint,
+                        const QPointF& theLambertPoint,
+                        const QPointF& theCartesianPoint ) :
+      ImagePoint( theImagePoint ),
+      LambertPoint( theLambertPoint ),
+      CartesianPoint( theCartesianPoint ) {}
+  };
   typedef QMap< int, TransformationData > TransformationDataMap;
 
   typedef QPair< QString, TransformationDataMap > PrsPointData;
@@ -61,11 +76,20 @@ public:
   void                       setImageName( const QString& theName );
   QString                    getImageName() const;
 
+  void                       setRefImageName( const QString& theName );
+  QString                    getRefImageName() const;
+
+  QString                    getFileName() const;
+
   void                       setImageSize( const QSize& theSize,
                                            const bool theIsRefImage = false );
 
+  void                       setTransformationMode( const int theMode );
   int                        getTransformationMode() const;
 
+  void                       setByTwoPoints( const bool theIsByTwoPoints );
+  bool                       isByTwoPoints() const;
+
   void                       setTransformationDataMap( const TransformationDataMap& theMap,
                                                        const bool theIsOnlyInput = false,
                                                        const bool theIsRefImage = false );
@@ -76,6 +100,12 @@ public:
 
   void                       initializePointSelection();
 
+public:
+
+  static TransformationData  ComputeTrsfData( const int      theMode,
+                                              const QPoint&  theLocalPoint,
+                                              const QPointF& theGlobalPoint );
+
 protected slots:
   void                       onBrowse();
   void                       onModeActivated( int );
@@ -83,6 +113,16 @@ protected slots:
   void                       onPointBtnToggled( bool );
   void                       onPointCoordChanged( int );
 
+  void                       onLambertCoordChanged();
+  void                       onLambertCoordChanged( const int thePointType );
+
+  void                       onCartesianCoordChanged();
+  void                       onCartesianCoordChanged( const int thePointType );
+
+private:
+  void                       blockSignalsLambert( const bool theState );
+  void                       blockSignalsCartesian( const bool theState );
+
 signals:
   void                       createPreview( QImage );
   void                       activatePointSelection( int );
@@ -90,6 +130,7 @@ signals:
                                                 int thePointType,
                                                 bool theIsY,
                                                 int theValue );
+  void                       modeActivated( int );
   void                       refImageActivated( const QString& );
 
 private:
@@ -100,9 +141,8 @@ private:
   QLineEdit*                 myImageName;
 
   QGroupBox*                 myTransformGroup;
-  QButtonGroup*              myModeGroup;
 
-  QWidget*                   myRefImageWg;
+  QButtonGroup*              myModeGroup;
   QComboBox*                 myRefImage;
 
   QList<QLabel*>             myLambertLabels;
@@ -117,10 +157,17 @@ private:
   QMap<int, QtxDoubleSpinBox*> myPointXSecMap;
   QMap<int, QtxDoubleSpinBox*> myPointYSecMap;
 
+  QMap<int, QtxDoubleSpinBox*> myCartPointXMap;
+  QMap<int, QtxDoubleSpinBox*> myCartPointYMap;
+
   QMap<int, QtxIntSpinBox*>  myRefPointXMap;
   QMap<int, QtxIntSpinBox*>  myRefPointYMap;
 
+  QCheckBox*                 myPointCEnabler;
+
   PrsPointDataList           myPrsPointDataList;
+
+  bool                       myIsInitialized;
 };
 
 #endif