]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
1) Edit Image operation
authorouv <ouv@opencascade.com>
Fri, 9 Aug 2013 11:23:03 +0000 (11:23 +0000)
committerouv <ouv@opencascade.com>
Fri, 9 Aug 2013 11:23:03 +0000 (11:23 +0000)
2) Some minor fixes

16 files changed:
src/HYDROData/HYDROData_Image.cxx
src/HYDROData/HYDROData_Image.h
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.h
src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
src/HYDROGUI/HYDROGUI_ImportImageOp.h
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_PrsImage.cxx
src/HYDROGUI/HYDROGUI_PrsImage.h
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_Tool.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 0d1da6761f1b9e1e8fd86725d2a2ac75adf4c3a7..8fe96f68b8d00d6e1104ca53b691ff9ba1181f85 100644 (file)
@@ -9,8 +9,12 @@
 #include <TDataStd_UAttribute.hxx>
 #include <TDF_ListIteratorOfLabelList.hxx>
 
-// tage of the child of my label that contains information about the operator
-static const int TAG_OPERATOR = 1; 
+// tag of the child of my label that contains information about the operator
+static const int TAG_OPERATOR = 1;
+
+// tag of the child of my label that contains information transformation points
+static const int TAG_TRSF_POINTS = 2;
+
 static const Standard_GUID GUID_MUST_BE_UPDATED("80f2bb81-3873-4631-8ddd-940d2119f000");
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Image, HYDROData_Object)
@@ -92,6 +96,49 @@ QTransform HYDROData_Image::Trsf()
   return aTrsf;
 }
 
+void HYDROData_Image::SetTrsfPoints(const QPoint& thePointAIn,
+                                    const QPoint& thePointBIn,
+                                    const QPoint& thePointCIn,
+                                    const QPointF& thePointAOut,
+                                    const QPointF& thePointBOut,
+                                    const QPointF& thePointCOut)
+{
+  Handle(TDataStd_RealArray) anArray;
+  if (!myLab.FindChild(TAG_TRSF_POINTS).FindAttribute(TDataStd_RealArray::GetID(), anArray)) {
+    anArray = TDataStd_RealArray::Set(myLab.FindChild(TAG_TRSF_POINTS), 1, 12);
+  }
+  anArray->SetValue(1, thePointAIn.x());
+  anArray->SetValue(2, thePointAIn.y());
+  anArray->SetValue(3, thePointBIn.x());
+  anArray->SetValue(4, thePointBIn.y());
+  anArray->SetValue(5, thePointCIn.x());
+  anArray->SetValue(6, thePointCIn.y());
+  anArray->SetValue(7, thePointAOut.x());
+  anArray->SetValue(8, thePointAOut.y());
+  anArray->SetValue(9, thePointBOut.x());
+  anArray->SetValue(10, thePointBOut.y());
+  anArray->SetValue(11, thePointCOut.x());
+  anArray->SetValue(12, thePointCOut.y());
+}
+
+void HYDROData_Image::TrsfPoints(QPoint& thePointAIn,
+                                 QPoint& thePointBIn,
+                                 QPoint& thePointCIn,
+                                 QPointF& thePointAOut,
+                                 QPointF& thePointBOut,
+                                 QPointF& thePointCOut)
+{
+  Handle(TDataStd_RealArray) anArray;
+  if (myLab.FindChild(TAG_TRSF_POINTS).FindAttribute(TDataStd_RealArray::GetID(), anArray)) {
+    thePointAIn = QPointF( anArray->Value(1), anArray->Value(2) ).toPoint();
+    thePointBIn = QPointF( anArray->Value(3), anArray->Value(4) ).toPoint();
+    thePointCIn = QPointF( anArray->Value(5), anArray->Value(6) ).toPoint();
+    thePointAOut = QPointF( anArray->Value(7), anArray->Value(8) );
+    thePointBOut = QPointF( anArray->Value(9), anArray->Value(10) );
+    thePointCOut = QPointF( anArray->Value(11), anArray->Value(12) );
+  }
+}
+
 void HYDROData_Image::AppendReference(Handle(HYDROData_Image) theReferenced)
 {
   Handle(TDataStd_ReferenceList) aRefs;
index 167d8b54767833d670de08c32ebe3f96804392c4..dda1648b3ab7cbdf34f308c852c18357a0a6bd12 100644 (file)
@@ -46,6 +46,38 @@ public:
    */
   HYDRODATA_EXPORT QTransform Trsf();
 
+  /**
+   * Stores the image transformation points (3 input + 3 output)
+   * \param thePointAIn input point A
+   * \param thePointBIn input point B
+   * \param thePointCIn input point C
+   * \param thePointAOut output point A
+   * \param thePointBOut output point B
+   * \param thePointCOut output point C
+   */
+  HYDRODATA_EXPORT void SetTrsfPoints(const QPoint& thePointAIn,
+                                      const QPoint& thePointBIn,
+                                      const QPoint& thePointCIn,
+                                      const QPointF& thePointAOut,
+                                      const QPointF& thePointBOut,
+                                      const QPointF& thePointCOut);
+
+  /**
+   * Returns the image transformation points (3 input + 3 output)
+   * \param thePointAIn input point A
+   * \param thePointBIn input point B
+   * \param thePointCIn input point C
+   * \param thePointAOut output point A
+   * \param thePointBOut output point B
+   * \param thePointCOut output point C
+   */
+  HYDRODATA_EXPORT void TrsfPoints(QPoint& thePointAIn,
+                                   QPoint& thePointBIn,
+                                   QPoint& thePointCIn,
+                                   QPointF& thePointAOut,
+                                   QPointF& thePointBOut,
+                                   QPointF& thePointCOut);
+
   /**
    * Appends reference to other image.
    * \param theReferenced the image referenced by this
index f5cc14cf815a4d3683916906b9cafd3bbea378fe..4595c918d78ba958991620f203721d7ee12786e3 100644 (file)
@@ -10,13 +10,13 @@ set(PROJECT_HEADERS
     HYDROGUI_GVSelector.h
     HYDROGUI_ImportImageDlg.h
     HYDROGUI_ImportImageOp.h
-    HYDROGUI_PolylineOp.h
-    HYDROGUI_PolylineDlg.h
     HYDROGUI_InputPanel.h
     HYDROGUI_Module.h
     HYDROGUI_ObjSelector.h
     HYDROGUI_Operation.h
     HYDROGUI_Operations.h
+    HYDROGUI_PolylineDlg.h
+    HYDROGUI_PolylineOp.h
     HYDROGUI_Prs.h
     HYDROGUI_PrsDriver.h
     HYDROGUI_PrsImage.h
@@ -38,20 +38,20 @@ set(PROJECT_SOURCES
     HYDROGUI_GVSelector.cxx
     HYDROGUI_ImportImageDlg.cxx
     HYDROGUI_ImportImageOp.cxx
-    HYDROGUI_PolylineDlg.cxx
-    HYDROGUI_PolylineOp.cxx
     HYDROGUI_InputPanel.cxx
     HYDROGUI_Module.cxx
     HYDROGUI_ObjSelector.cxx
     HYDROGUI_Operation.cxx
     HYDROGUI_Operations.cxx
-    HYDROGUI_TwoImagesDlg.cxx
+    HYDROGUI_PolylineDlg.cxx
+    HYDROGUI_PolylineOp.cxx
     HYDROGUI_Prs.cxx
     HYDROGUI_PrsDriver.cxx
     HYDROGUI_PrsImage.cxx
     HYDROGUI_PrsImageDriver.cxx
     HYDROGUI_PrsImageFrame.cxx
     HYDROGUI_Tool.cxx
+    HYDROGUI_TwoImagesDlg.cxx
     HYDROGUI_TwoImagesOp.cxx
 )
 
index 4108df409fe06fa37bd36136b5745bd72118b5dc..461b493c9d73594aa759786346d4cab17dbb021d 100644 (file)
@@ -29,6 +29,7 @@
 #include <HYDROData_Document.h>
 #include <HYDROData_Image.h>
 #include <HYDROData_Iterator.h>
+#include <HYDROData_Polyline.h>
 
 #include <CAM_Application.h>
 #include <CAM_DataObject.h>
@@ -197,11 +198,11 @@ void HYDROGUI_DataModel::update( const int theStudyId )
 
   LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, "POLYLINES" );
 
-  HYDROData_Iterator aPolyIterator( aDocument, KIND_IMAGE );
+  HYDROData_Iterator aPolyIterator( aDocument, KIND_POLYLINE );
   for( ; aPolyIterator.More(); aPolyIterator.Next() )
   {
-    Handle(HYDROData_Image) aPolylineObj =
-      Handle(HYDROData_Image)::DownCast( anIterator.Current() );
+    Handle(HYDROData_Polyline) aPolylineObj =
+      Handle(HYDROData_Polyline)::DownCast( anIterator.Current() );
     if( !aPolylineObj.IsNull() )
       createObject( aPolylineRootObj, aPolylineObj );
   }
index b8f1ddeb65a4e61c08a6f64c2adf5d30d3ee00b0..7a5d089e663bbd342b14755e19d7314a9ef64f85 100644 (file)
@@ -23,6 +23,7 @@
 #include "HYDROGUI_ImportImageDlg.h"
 
 #include "HYDROGUI_PrsImage.h"
+#include "HYDROGUI_Tool.h"
 
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
@@ -30,6 +31,7 @@
 #include <QDoubleValidator>
 #include <QFileDialog>
 #include <QGroupBox>
+#include <QIntValidator>
 #include <QLabel>
 #include <QLayout>
 #include <QLineEdit>
@@ -44,17 +46,17 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
 
   // Import image from file
-  QGroupBox* aFileGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ) );
+  myFileGroup = new QGroupBox( tr( "IMPORT_IMAGE_FROM_FILE" ) );
 
-  QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), aFileGroup );
+  QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileGroup );
 
-  myFileName = new QLineEdit( aFileGroup );
+  myFileName = new QLineEdit( myFileGroup );
   myFileName->setReadOnly( true );
 
-  QToolButton* aBrowseBtn = new QToolButton( aFileGroup );
+  QToolButton* aBrowseBtn = new QToolButton( myFileGroup );
   aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) );
 
-  QBoxLayout* aFileLayout = new QHBoxLayout( aFileGroup );
+  QBoxLayout* aFileLayout = new QHBoxLayout( myFileGroup );
   aFileLayout->setMargin( 5 );
   aFileLayout->setSpacing( 5 );
   aFileLayout->addWidget( aFileNameLabel );
@@ -85,62 +87,101 @@ HYDROGUI_ImportImageDlg::HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, co
     QString aPointStr;
     switch( aPointType )
     {
-      case HYDROGUI_PrsImage::PointA: aPointStr = tr( "POINT_A" ); break;
-      case HYDROGUI_PrsImage::PointB: aPointStr = tr( "POINT_B" ); break;
-      case HYDROGUI_PrsImage::PointC: aPointStr = tr( "POINT_C" ); break;
+      case HYDROGUI_PrsImage::PointA: aPointStr = tr( "ACTIVATE_POINT_A_SELECTION" ); break;
+      case HYDROGUI_PrsImage::PointB: aPointStr = tr( "ACTIVATE_POINT_B_SELECTION" ); break;
+      case HYDROGUI_PrsImage::PointC: aPointStr = tr( "ACTIVATE_POINT_C_SELECTION" ); break;
     }
     QPushButton* aPointBtn = new QPushButton( aPointStr, myMappingGroup );
     aPointBtn->setCheckable( true );
 
-    QLabel* aPointXLabel = new QLabel( tr( "X" ), myMappingGroup );
-    QLabel* aPointYLabel = new QLabel( tr( "Y" ), myMappingGroup );
+    QLabel* aPointXLabel = new QLabel( "X", myMappingGroup );
+    QLabel* aPointYLabel = new QLabel( "Y", myMappingGroup );
 
-    QLineEdit* aPointX1 = new QLineEdit( myMappingGroup );
-    QLineEdit* aPointY1 = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointX = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointY = new QLineEdit( myMappingGroup );
 
-    aPointX1->setReadOnly( true );
-    aPointY1->setReadOnly( true );
+    aPointX->setReadOnly( true );
+    aPointY->setReadOnly( true );
 
     //QLabel* aPointArrowLabel = new QLabel( ">", myMappingGroup );
     QLabel* aPointArrowLabel = new QLabel( myMappingGroup );
     aPointArrowLabel->setPicture( anArrowPicture );
 
-    QLineEdit* aPointX2 = new QLineEdit( myMappingGroup );
-    QLineEdit* aPointY2 = new QLineEdit( myMappingGroup );
-
-    QDoubleValidator* aDoubleValidator = new QDoubleValidator();
-    aPointX2->setValidator( aDoubleValidator );
-    aPointY2->setValidator( aDoubleValidator );
-
-    int aRow = 3 * aPointType;
-    aMappingLayout->addWidget( aPointBtn,        aRow, 0, 2, 1 );
-    aMappingLayout->addWidget( aPointXLabel,     aRow, 1 );
-    aMappingLayout->addWidget( aPointX1,         aRow, 2 );
-    aMappingLayout->addWidget( aPointArrowLabel, aRow, 3, 2, 1 );
-    aMappingLayout->addWidget( aPointX2,         aRow, 4 );
-    aMappingLayout->addWidget( aPointYLabel,     aRow + 1, 1 );
-    aMappingLayout->addWidget( aPointY1,         aRow + 1, 2 );
-    aMappingLayout->addWidget( aPointY2,         aRow + 1, 4 );
+    QLabel* aPointXDegLabel = new QLabel( QChar( 0x00B0 ), myMappingGroup );
+    QLabel* aPointYDegLabel = new QLabel( QChar( 0x00B0 ), myMappingGroup );
+    QLabel* aPointXMinLabel = new QLabel( "'", myMappingGroup );
+    QLabel* aPointYMinLabel = new QLabel( "'", myMappingGroup );
+    QLabel* aPointXSecLabel = new QLabel( "\"", myMappingGroup );
+    QLabel* aPointYSecLabel = new QLabel( "\"", myMappingGroup );
+
+    QLineEdit* aPointXDeg = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointYDeg = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointXMin = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointYMin = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointXSec = new QLineEdit( myMappingGroup );
+    QLineEdit* aPointYSec = new QLineEdit( myMappingGroup );
+
+    QIntValidator* aXDegValidator = new QIntValidator( -180, 180, this );
+    QIntValidator* aYDegValidator = new QIntValidator( -90, 90, this );
+    QIntValidator* aMinValidator = new QIntValidator( 0, 59, this );
+    QDoubleValidator* aSecValidator = new QDoubleValidator( 0, 59.9999, 4, this );
+
+    aPointXDeg->setValidator( aXDegValidator );
+    aPointYDeg->setValidator( aYDegValidator );
+    aPointXMin->setValidator( aMinValidator );
+    aPointYMin->setValidator( aMinValidator );
+    aPointXSec->setValidator( aSecValidator );
+    aPointYSec->setValidator( aSecValidator );
+
+    int aRow = 4 * aPointType;
+    aMappingLayout->addWidget( aPointBtn,        aRow,     0, 1, 9 );
+
+    aMappingLayout->addWidget( aPointXLabel,     aRow + 1, 0 );
+    aMappingLayout->addWidget( aPointX,          aRow + 1, 1 );
+    aMappingLayout->addWidget( aPointArrowLabel, aRow + 1, 2, 2, 1 );
+    aMappingLayout->addWidget( aPointXDeg,       aRow + 1, 3 );
+    aMappingLayout->addWidget( aPointXDegLabel,  aRow + 1, 4 );
+    aMappingLayout->addWidget( aPointXMin,       aRow + 1, 5 );
+    aMappingLayout->addWidget( aPointXMinLabel,  aRow + 1, 6 );
+    aMappingLayout->addWidget( aPointXSec,       aRow + 1, 7 );
+    aMappingLayout->addWidget( aPointXSecLabel,  aRow + 1, 8 );
+
+    aMappingLayout->addWidget( aPointYLabel,     aRow + 2, 0 );
+    aMappingLayout->addWidget( aPointY,          aRow + 2, 1 );
+    aMappingLayout->addWidget( aPointYDeg,       aRow + 2, 3 );
+    aMappingLayout->addWidget( aPointYDegLabel,  aRow + 2, 4 );
+    aMappingLayout->addWidget( aPointYMin,       aRow + 2, 5 );
+    aMappingLayout->addWidget( aPointYMinLabel,  aRow + 2, 6 );
+    aMappingLayout->addWidget( aPointYSec,       aRow + 2, 7 );
+    aMappingLayout->addWidget( aPointYSecLabel,  aRow + 2, 8 );
 
     if( aPointType != HYDROGUI_PrsImage::PointC )
     {
       QFrame* aLine = new QFrame( myMappingGroup );
       aLine->setFrameShape( QFrame::HLine );
       aLine->setFrameShadow( QFrame::Sunken );
-      aMappingLayout->addWidget( aLine, aRow + 2, 0, 1, 5 );
+      aMappingLayout->addWidget( aLine, aRow + 3, 0, 1, 9 );
     }
 
     myPointBtnMap[ aPointType ] = aPointBtn;
-    myPointX1Map[ aPointType ] = aPointX1;
-    myPointY1Map[ aPointType ] = aPointY1;
-    myPointX2Map[ aPointType ] = aPointX2;
-    myPointY2Map[ aPointType ] = aPointY2;
+    myPointXMap[ aPointType ] = aPointX;
+    myPointYMap[ aPointType ] = aPointY;
+    myPointXDegMap[ aPointType ] = aPointXDeg;
+    myPointYDegMap[ aPointType ] = aPointYDeg;
+    myPointXMinMap[ aPointType ] = aPointXMin;
+    myPointYMinMap[ aPointType ] = aPointYMin;
+    myPointXSecMap[ aPointType ] = aPointXSec;
+    myPointYSecMap[ aPointType ] = aPointYSec;
 
     connect( aPointBtn, SIGNAL( toggled( bool ) ), this, SLOT( onPointBtnToggled( bool ) ) );
   }
+  aMappingLayout->setColumnStretch( 1, 1 ); // x
+  aMappingLayout->setColumnStretch( 3, 1 ); // degrees
+  aMappingLayout->setColumnStretch( 5, 1 ); // minutes
+  aMappingLayout->setColumnStretch( 7, 2 ); // seconds (double with 4 digits)
 
   // Common
-  addWidget( aFileGroup, 0, 0 );
+  addWidget( myFileGroup, 0, 0 );
   addWidget( myMappingGroup, 1, 0 );
 
   setRowStretch();
@@ -152,6 +193,12 @@ HYDROGUI_ImportImageDlg::~HYDROGUI_ImportImageDlg()
 {
 }
 
+void HYDROGUI_ImportImageDlg::setIsEdit( const bool theIsEdit )
+{
+  myFileGroup->setVisible( !theIsEdit );
+  myMappingGroup->setEnabled( theIsEdit );
+}
+
 void HYDROGUI_ImportImageDlg::reset()
 {
   myFileName->clear();
@@ -163,15 +210,20 @@ void HYDROGUI_ImportImageDlg::reset()
     aBtn->setChecked( false );
     aBtn->blockSignals( anIsBlocked );
 
-    myPointX1Map[ aPointType ]->clear();
-    myPointY1Map[ aPointType ]->clear();
-    myPointX2Map[ aPointType ]->clear();
-    myPointY2Map[ aPointType ]->clear();
+    myPointXMap[ aPointType ]->clear();
+    myPointYMap[ aPointType ]->clear();
+    myPointXDegMap[ aPointType ]->clear();
+    myPointYDegMap[ aPointType ]->clear();
+    myPointXMinMap[ aPointType ]->clear();
+    myPointYMinMap[ aPointType ]->clear();
+    myPointXSecMap[ aPointType ]->clear();
+    myPointYSecMap[ aPointType ]->clear();
   }
   myMappingGroup->setEnabled( false );
 }
 
-void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationDataMap& theMap )
+void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationDataMap& theMap,
+                                                        const bool theIsOnlyInput )
 {
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
@@ -179,8 +231,25 @@ void HYDROGUI_ImportImageDlg::setTransformationDataMap( const TransformationData
     if( theMap.contains( aPointType ) )
     {
       const TransformationData& aData = theMap[ aPointType ];
-      myPointX1Map[ aPointType ]->setText( QString::number( aData.first.x() ) );
-      myPointY1Map[ aPointType ]->setText( QString::number( aData.first.y() ) );
+      myPointXMap[ aPointType ]->setText( QString::number( aData.first.x() ) );
+      myPointYMap[ aPointType ]->setText( QString::number( aData.first.y() ) );
+
+      if( !theIsOnlyInput )
+      {
+        QPointF aPoint = aData.second;
+        int aXDeg = 0, aYDeg = 0;
+        int aXMin = 0, aYMin = 0;
+        double aXSec = 0, aYSec = 0;
+        HYDROGUI_Tool::DoubleToLambert( aPoint.x(), aXDeg, aXMin, aXSec );
+        HYDROGUI_Tool::DoubleToLambert( aPoint.y(), aYDeg, aYMin, aYSec );
+
+        myPointXDegMap[ aPointType ]->setText( QString::number( aXDeg ) );
+        myPointYDegMap[ aPointType ]->setText( QString::number( aYDeg ) );
+        myPointXMinMap[ aPointType ]->setText( QString::number( aXMin ) );
+        myPointYMinMap[ aPointType ]->setText( QString::number( aYMin ) );
+        myPointXSecMap[ aPointType ]->setText( QString::number( aXSec ) );
+        myPointYSecMap[ aPointType ]->setText( QString::number( aYSec ) );
+      }
     }
   }
 }
@@ -191,25 +260,26 @@ bool HYDROGUI_ImportImageDlg::getTransformationDataMap( TransformationDataMap& t
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
   {
-    bool anIsOk = false;
-    int aX1 = myPointX1Map[ aPointType ]->text().toInt( &anIsOk );
-    if( !anIsOk )
-      return false;
-
-    anIsOk = false;
-    int aY1 = myPointY1Map[ aPointType ]->text().toInt( &anIsOk );
-    if( !anIsOk )
-      return false;
-
-    anIsOk = false;
-    double aX2 = myPointX2Map[ aPointType ]->text().toDouble( &anIsOk );
-    if( !anIsOk )
-      return false;
-
-    anIsOk = false;
-    double aY2 = myPointY2Map[ aPointType ]->text().toDouble( &anIsOk );
-    if( !anIsOk )
-      return false;
+    bool anIsOk[8];
+    for( int i = 0; i < 8; i++ )
+      anIsOk[ i ] = false;
+
+    int aX1 = myPointXMap[ aPointType ]->text().toInt( &anIsOk[0] );
+    int aY1 = myPointYMap[ aPointType ]->text().toInt( &anIsOk[1] );
+    int aXDeg = myPointXDegMap[ aPointType ]->text().toInt( &anIsOk[2] );
+    int aYDeg = myPointYDegMap[ aPointType ]->text().toInt( &anIsOk[3] );
+    int aXMin = myPointXMinMap[ aPointType ]->text().toInt( &anIsOk[4] );
+    int aYMin = myPointYMinMap[ aPointType ]->text().toInt( &anIsOk[5] );
+    double aXSec = myPointXSecMap[ aPointType ]->text().toDouble( &anIsOk[6] );
+    double aYSec = myPointYSecMap[ aPointType ]->text().toDouble( &anIsOk[7] );
+
+    for( int i = 0; i < 8; i++ )
+      if( !anIsOk[ i ] )
+        return false;
+
+    double aX2 = 0, aY2 = 0;
+    HYDROGUI_Tool::LambertToDouble( aXDeg, aXMin, aXSec, aX2 );
+    HYDROGUI_Tool::LambertToDouble( aYDeg, aYMin, aYSec, aY2 );
 
     TransformationData aData( QPoint( aX1, aY1 ), QPointF( aX2, aY2 ) );
     theMap[ aPointType ] = aData;
@@ -220,27 +290,44 @@ bool HYDROGUI_ImportImageDlg::getTransformationDataMap( TransformationDataMap& t
 void HYDROGUI_ImportImageDlg::initializePointSelection()
 {
   myPointBtnMap[ HYDROGUI_PrsImage::PointA ]->setChecked( true );
-}
 
-void HYDROGUI_ImportImageDlg::synchronizeTransformedPoints()
-{
-  for( int aPointType = HYDROGUI_PrsImage::PointA;
-       aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
-  {
-    myPointX2Map[ aPointType ]->setText( myPointX1Map[ aPointType ]->text() );
-    myPointY2Map[ aPointType ]->setText( myPointY1Map[ aPointType ]->text() );
-  }
+  // ouv: tmp
+  myPointXDegMap[ HYDROGUI_PrsImage::PointA ]->setText( "50" );
+  myPointXMinMap[ HYDROGUI_PrsImage::PointA ]->setText( "0" );
+  myPointXSecMap[ HYDROGUI_PrsImage::PointA ]->setText( "0" );
+  myPointYDegMap[ HYDROGUI_PrsImage::PointA ]->setText( "50" );
+  myPointYMinMap[ HYDROGUI_PrsImage::PointA ]->setText( "0" );
+  myPointYSecMap[ HYDROGUI_PrsImage::PointA ]->setText( "0" );
+
+  myPointXDegMap[ HYDROGUI_PrsImage::PointB ]->setText( "50" );
+  myPointXMinMap[ HYDROGUI_PrsImage::PointB ]->setText( "1" );
+  myPointXSecMap[ HYDROGUI_PrsImage::PointB ]->setText( "0" );
+  myPointYDegMap[ HYDROGUI_PrsImage::PointB ]->setText( "50" );
+  myPointYMinMap[ HYDROGUI_PrsImage::PointB ]->setText( "0" );
+  myPointYSecMap[ HYDROGUI_PrsImage::PointB ]->setText( "0" );
+
+  myPointXDegMap[ HYDROGUI_PrsImage::PointC ]->setText( "50" );
+  myPointXMinMap[ HYDROGUI_PrsImage::PointC ]->setText( "0" );
+  myPointXSecMap[ HYDROGUI_PrsImage::PointC ]->setText( "0" );
+  myPointYDegMap[ HYDROGUI_PrsImage::PointC ]->setText( "50" );
+  myPointYMinMap[ HYDROGUI_PrsImage::PointC ]->setText( "1" );
+  myPointYSecMap[ HYDROGUI_PrsImage::PointC ]->setText( "0" );
 }
 
 void HYDROGUI_ImportImageDlg::onBrowse()
 {
   QString aFilter( tr( "IMAGE_FILTER" ) );
-  QString aFileName = QFileDialog::getOpenFileName( this, tr( "BROWSE_IMAGE_FILE" ), "", aFilter );
+  //QString aFileName = QFileDialog::getOpenFileName( this, tr( "BROWSE_IMAGE_FILE" ), "", aFilter );
+  QString aFileName = "W:/Work/HYDRO/doc/samples/1.bmp";
   if( !aFileName.isEmpty() )
   {
-    myFileName->setText( aFileName );
-    emit createPreview( aFileName );
-    myMappingGroup->setEnabled( true );
+    QImage anImage( aFileName );
+    if( !anImage.isNull() )
+    {
+      myFileName->setText( aFileName );
+      emit createPreview( anImage );
+      myMappingGroup->setEnabled( true );
+    }
   }
 }
 
index 49efc9ec91b016bf63f92edcdb47caab488ed61b..a1dcbda55f2fde8a127b3dd1d827f2e10dfa33fc 100644 (file)
@@ -42,31 +42,37 @@ public:
   HYDROGUI_ImportImageDlg( HYDROGUI_Module* theModule, const QString& theTitle );
   virtual ~HYDROGUI_ImportImageDlg();
 
+  void                       setIsEdit( const bool theIsEdit );
   void                       reset();
 
-  void                       setTransformationDataMap( const TransformationDataMap& theMap );
+  void                       setTransformationDataMap( const TransformationDataMap& theMap,
+                                                       const bool theIsOnlyInput = false );
   bool                       getTransformationDataMap( TransformationDataMap& theMap ) const;
 
   void                       initializePointSelection();
-  void                       synchronizeTransformedPoints();
 
 protected slots:
   void                       onBrowse();
   void                       onPointBtnToggled( bool );
 
 signals:
-  void                       createPreview( QString );
+  void                       createPreview( QImage );
   void                       activatePointSelection( int );
 
 private:
+  QGroupBox*                 myFileGroup;
   QLineEdit*                 myFileName;
 
   QGroupBox*                 myMappingGroup;
   QMap<int, QPushButton*>    myPointBtnMap;
-  QMap<int, QLineEdit*>      myPointX1Map;
-  QMap<int, QLineEdit*>      myPointY1Map;
-  QMap<int, QLineEdit*>      myPointX2Map;
-  QMap<int, QLineEdit*>      myPointY2Map;
+  QMap<int, QLineEdit*>      myPointXMap;
+  QMap<int, QLineEdit*>      myPointYMap;
+  QMap<int, QLineEdit*>      myPointXDegMap;
+  QMap<int, QLineEdit*>      myPointYDegMap;
+  QMap<int, QLineEdit*>      myPointXMinMap;
+  QMap<int, QLineEdit*>      myPointYMinMap;
+  QMap<int, QLineEdit*>      myPointXSecMap;
+  QMap<int, QLineEdit*>      myPointYSecMap;
 };
 
 #endif
index 21ab2da2defd8682bce888cee104266e1b7edf53..2ab7cec68cf2b14e2520abbd4eecfdf4a3930a73 100644 (file)
 
 #include "HYDROGUI_ImportImageOp.h"
 
+#include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_ImportImageDlg.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_PrsImage.h"
 #include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
 
 #include <HYDROData_Document.h>
-#include <HYDROData_Image.h>
 
 #include <GraphicsView_ViewManager.h>
 #include <GraphicsView_ViewPort.h>
 #include <LightApp_Application.h>
 #include <LightApp_UpdateFlags.h>
 
-HYDROGUI_ImportImageOp::HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule )
+HYDROGUI_ImportImageOp::HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule,
+                                                const bool theIsEdit )
 : HYDROGUI_Operation( theModule ),
+  myIsEdit( theIsEdit ),
+  myEditedObject( 0 ),
   myActiveViewManager( 0 ),
   myPreviewViewManager( 0 ),
   myPreviewPrs( 0 ),
   myPointType( HYDROGUI_PrsImage::None )
 {
-  setName( tr( "IMPORT_IMAGE" ) );
+  setName( theIsEdit ? tr( "EDIT_IMAGE" ) : tr( "IMPORT_IMAGE" ) );
 }
 
 HYDROGUI_ImportImageOp::~HYDROGUI_ImportImageOp()
@@ -57,13 +61,52 @@ void HYDROGUI_ImportImageOp::startOperation()
 
   HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
   aPanel->reset();
+  aPanel->setIsEdit( myIsEdit );
+
+  if( myIsEdit )
+  {
+    myEditedObject = Handle(HYDROData_Image)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+    if( !myEditedObject.IsNull() )
+    {
+      QImage anImage = myEditedObject->Image();
+
+      QPoint aPointA1, aPointB1, aPointC1;
+      QPointF aPointA2, aPointB2, aPointC2;
+      myEditedObject->TrsfPoints( aPointA1, aPointB1, aPointC1,
+                                  aPointA2, aPointB2, aPointC2 );
+
+      onCreatePreview( anImage );
+
+      if( myPreviewPrs )
+      {
+        HYDROGUI_PrsImage::TransformationPointMap aPointMap =
+          myPreviewPrs->getTransformationPointMap();
+        if( !aPointMap.isEmpty() )
+        {
+          aPointMap[ HYDROGUI_PrsImage::PointA ].Point = aPointA1;
+          aPointMap[ HYDROGUI_PrsImage::PointB ].Point = aPointB1;
+          aPointMap[ HYDROGUI_PrsImage::PointC ].Point = aPointC1;
+          myPreviewPrs->setTransformationPointMap( aPointMap );
+        }
+      }
+
+      HYDROGUI_ImportImageDlg::TransformationDataMap aDataMap;
+      aDataMap[ HYDROGUI_PrsImage::PointA ] =
+        HYDROGUI_ImportImageDlg::TransformationData( aPointA1, aPointA2 );
+      aDataMap[ HYDROGUI_PrsImage::PointB ] =
+        HYDROGUI_ImportImageDlg::TransformationData( aPointB1, aPointB2 );
+      aDataMap[ HYDROGUI_PrsImage::PointC ] =
+        HYDROGUI_ImportImageDlg::TransformationData( aPointC1, aPointC2 );
+      ( (HYDROGUI_ImportImageDlg*)inputPanel() )->setTransformationDataMap( aDataMap );
+    }
+  }
 }
 
 HYDROGUI_InputPanel* HYDROGUI_ImportImageOp::createInputPanel() const
 {
   HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportImageDlg( module(), getName() );
-  connect( aPanel, SIGNAL( createPreview( QString ) ),
-           this, SLOT( onCreatePreview( QString ) ) );
+  connect( aPanel, SIGNAL( createPreview( QImage ) ),
+           this, SLOT( onCreatePreview( QImage ) ) );
   connect( aPanel, SIGNAL( activatePointSelection( int ) ),
            this, SLOT( onActivatePointSelection( int ) ) );
   return aPanel;
@@ -78,19 +121,27 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags )
   if( !anIsOk || !myPreviewPrs )
     return false;
 
-  double xa1 = aMap[ HYDROGUI_PrsImage::PointA ].first.x();
-  double ya1 = aMap[ HYDROGUI_PrsImage::PointA ].first.y();
-  double xb1 = aMap[ HYDROGUI_PrsImage::PointB ].first.x();
-  double yb1 = aMap[ HYDROGUI_PrsImage::PointB ].first.y();
-  double xc1 = aMap[ HYDROGUI_PrsImage::PointC ].first.x();
-  double yc1 = aMap[ HYDROGUI_PrsImage::PointC ].first.y();
+  QPoint aPointA1 = aMap[ HYDROGUI_PrsImage::PointA ].first;
+  QPoint aPointB1 = aMap[ HYDROGUI_PrsImage::PointB ].first;
+  QPoint aPointC1 = aMap[ HYDROGUI_PrsImage::PointC ].first;
 
-  double xa2 = aMap[ HYDROGUI_PrsImage::PointA ].second.x();
-  double ya2 = aMap[ HYDROGUI_PrsImage::PointA ].second.y();
-  double xb2 = aMap[ HYDROGUI_PrsImage::PointB ].second.x();
-  double yb2 = aMap[ HYDROGUI_PrsImage::PointB ].second.y();
-  double xc2 = aMap[ HYDROGUI_PrsImage::PointC ].second.x();
-  double yc2 = aMap[ HYDROGUI_PrsImage::PointC ].second.y();
+  QPointF aPointA2 = aMap[ HYDROGUI_PrsImage::PointA ].second;
+  QPointF aPointB2 = aMap[ HYDROGUI_PrsImage::PointB ].second;
+  QPointF aPointC2 = aMap[ HYDROGUI_PrsImage::PointC ].second;
+
+  double xa1 = aPointA1.x();
+  double ya1 = aPointA1.y();
+  double xb1 = aPointB1.x();
+  double yb1 = aPointB1.y();
+  double xc1 = aPointC1.x();
+  double yc1 = aPointC1.y();
+
+  double xa2 = aPointA2.x();
+  double ya2 = aPointA2.y();
+  double xb2 = aPointB2.x();
+  double yb2 = aPointB2.y();
+  double xc2 = aPointC2.x();
+  double yc2 = aPointC2.y();
 
   QTransform aTransform1( xa1, ya1, 1, xb1, yb1, 1, xc1, yc1, 1 );
   QTransform aTransform2( xa2, ya2, 1, xb2, yb2, 1, xc2, yc2, 1 );
@@ -101,24 +152,30 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags )
 
   closePreview();
 
-  int aStudyId = module()->getStudyId();
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( aStudyId );
-  if( aDocument.IsNull() )
-    return false;
+  Handle(HYDROData_Image) anImageObj;
+  if( myIsEdit )
+    anImageObj = myEditedObject;
+  else
+    anImageObj = Handle(HYDROData_Image)::DownCast( doc()->CreateObject( KIND_IMAGE ) );
 
-  Handle(HYDROData_Image) anImageObj =
-    Handle(HYDROData_Image)::DownCast( aDocument->CreateObject( KIND_IMAGE ) );
   if( anImageObj.IsNull() )
     return false;
 
-  static int ImageId = 0;
-  anImageObj->SetName( QString( "Image_%1" ).arg( QString::number( ++ImageId ) ) );
+  if( !myIsEdit )
+  {
+    static int ImageId = 0;
+    anImageObj->SetName( QString( "Image_%1" ).arg( QString::number( ++ImageId ) ) );
+  }
 
   anImageObj->SetImage( anImage );
   anImageObj->SetTrsf( aTransform );
+
+  anImageObj->SetTrsfPoints( aPointA1, aPointB1, aPointC1,
+                             aPointA2, aPointB2, aPointC2 );
+
   anImageObj->SetVisibility( true );
 
-  theUpdateFlags = UF_Model | UF_Viewer;
+  theUpdateFlags = UF_Model | UF_Viewer | UF_GV_Forced;
   return true;
 }
 
@@ -127,17 +184,14 @@ void HYDROGUI_ImportImageOp::processCancel()
   closePreview();
 }
 
-void HYDROGUI_ImportImageOp::onCreatePreview( QString theFileName )
+void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
 {
   LightApp_Application* anApp = module()->getApp();
 
   myActiveViewManager = anApp->activeViewManager();
 
-  myPreviewPrs = new HYDROGUI_PrsImage( 0 ); // no data object
-
-  QImage anImage( theFileName );
-  myPreviewPrs->setImage( anImage );
-
+  myPreviewPrs = new HYDROGUI_PrsImage( myIsEdit ? myEditedObject : 0 );
+  myPreviewPrs->setImage( theImage );
   myPreviewPrs->compute();
 
   myPreviewViewManager =
@@ -165,8 +219,6 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QString theFileName )
 
   aPanel->initializePointSelection();
   onPointSelected();
-
-  aPanel->synchronizeTransformedPoints();
 }
 
 void HYDROGUI_ImportImageOp::onActivatePointSelection( int thePointType )
@@ -193,7 +245,7 @@ void HYDROGUI_ImportImageOp::onPointSelected()
     aDataMap[ aPointType ] = aData;
   }
 
-  ( (HYDROGUI_ImportImageDlg*)inputPanel() )->setTransformationDataMap( aDataMap );
+  ( (HYDROGUI_ImportImageDlg*)inputPanel() )->setTransformationDataMap( aDataMap, true );
 }
 
 void HYDROGUI_ImportImageOp::closePreview()
index 04a0f704d08afe86f3c477cc9ca421e38d36e4c0..bdb588671328b461a0e91263aa26d7fa56401301 100644 (file)
 
 #include "HYDROGUI_Operation.h"
 
+#include <HYDROData_Image.h>
+
+#include <QImage>
+
 class GraphicsView_ViewManager;
 
 class SUIT_ViewManager;
@@ -36,7 +40,7 @@ class HYDROGUI_ImportImageOp : public HYDROGUI_Operation
   Q_OBJECT
 
 public:
-  HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule );
+  HYDROGUI_ImportImageOp( HYDROGUI_Module* theModule, const bool theIsEdit );
   virtual ~HYDROGUI_ImportImageOp();
 
 protected:
@@ -48,7 +52,7 @@ protected:
   virtual void               processCancel();
 
 protected slots:
-  void                       onCreatePreview( QString );
+  void                       onCreatePreview( QImage );
   void                       onActivatePointSelection( int );
   void                       onPointSelected();
 
@@ -56,6 +60,9 @@ private:
   void                       closePreview();
 
 private:
+  bool                       myIsEdit;
+  Handle(HYDROData_Image)    myEditedObject;
+
   SUIT_ViewManager*          myActiveViewManager;
 
   GraphicsView_ViewManager*  myPreviewViewManager;
index aaefcdfbdbb8a257bcf267efcfa739e8760d06ae..9a377428af3184319e240f8e26785109c68b6c77 100644 (file)
@@ -141,6 +141,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsVisibleInSelection = false;
   bool anIsHiddenInSelection = false;
 
+  bool anIsImage = false;
+
   foreach( SUIT_DataOwner* aSUITOwner, anOwners )
   {
     if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
@@ -148,14 +150,24 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
       if( !anObject.IsNull() )
       {
+        anIsSelection = true;
+
         bool aVisibility = anObject->GetVisibility();
         anIsVisibleInSelection |= aVisibility;
         anIsHiddenInSelection |= !aVisibility;
-        anIsSelection = true;
+
+        if( anObject->GetKind() == KIND_IMAGE )
+          anIsImage = true;
       }
     }
   }
 
+  if( anOwners.count() == 1 && anIsImage )
+  {
+    theMenu->addAction( action( EditImageId ) );
+    theMenu->addSeparator();
+  }
+
   if( anIsSelection )
   {
     theMenu->addAction( action( DeleteId ) );
@@ -262,7 +274,7 @@ void HYDROGUI_Module::customEvent( QEvent* e )
     {
       if( GraphicsView_Viewer* aViewer = dynamic_cast<GraphicsView_Viewer*>( aViewFrame->getViewer() ) )
       {
-        update( UF_Viewer | UF_GV_Forced );
+        //update( UF_Viewer | UF_GV_Forced ); // ouv: to do
         aViewer->activateTransform( GraphicsView_Viewer::FitAll );
 
         if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
@@ -270,6 +282,9 @@ void HYDROGUI_Module::customEvent( QEvent* e )
           aViewPort->setInteractionFlag( GraphicsView_ViewPort::TraceBoundingRect );
           aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateContextMenu );
           aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateSelection );
+
+          // ouv: tmp
+          aViewPort->setMousePositionEnabled( true );
         }
       }
     }
index 767244045d5540627954f45bd17a38363c5c0539..5913dd23ad05f0764378c5fb0c8d279876171a62 100644 (file)
@@ -26,9 +26,9 @@
 #include "HYDROGUI_DeleteOp.h"
 #include "HYDROGUI_ImportImageOp.h"
 #include "HYDROGUI_Module.h"
+#include "HYDROGUI_PolylineOp.h"
 #include "HYDROGUI_ShowHideOp.h"
 #include "HYDROGUI_TwoImagesOp.h"
-#include "HYDROGUI_PolylineOp.h"
 #include "HYDROGUI_UpdateFlags.h"
 
 #include <CAM_Application.h>
@@ -63,11 +63,11 @@ QAction* HYDROGUI_Module::createAction( const int theId, const QString& theSuffi
 void HYDROGUI_Module::createActions()
 {
   createAction( ImportImageId, "IMPORT_IMAGE", "", Qt::CTRL + Qt::Key_I );
-  createAction( FuseId, "FUSE_IMAGES" );
-  createAction( CutId, "CUT_IMAGES" );
-
+  createAction( EditImageId, "EDIT_IMAGE" );
   createAction( PolylineId, "POLYLINE" );
 
+  createAction( FuseId, "FUSE_IMAGES" );
+  createAction( CutId, "CUT_IMAGES" );
 
   createAction( DeleteId, "DELETE", "", Qt::Key_Delete );
 
@@ -87,9 +87,9 @@ void HYDROGUI_Module::createMenus()
   int aHydroMenu = 6; // Edit menu id == 5, View menu id == 10
   int aHydroId = createMenu( tr( "MEN_DESK_HYDRO" ), -1, -1, aHydroMenu );
   createMenu( ImportImageId, aHydroId, -1, -1 );
+  createMenu( PolylineId, aHydroId, -1, -1 );
   createMenu( FuseId, aHydroId, -1, -1 );
   createMenu( CutId, aHydroId, -1, -1 );
-  createMenu( PolylineId, aHydroId, -1, -1 );
 }
 
 void HYDROGUI_Module::createPopups()
@@ -203,8 +203,11 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   switch( theId )
   {
   case ImportImageId:
-    anOp = new HYDROGUI_ImportImageOp( aModule );
+  case EditImageId:
+    anOp = new HYDROGUI_ImportImageOp( aModule, theId == EditImageId );
     break;
+  case PolylineId:
+    anOp = new HYDROGUI_PolylineOp( aModule );
   case FuseId:
     anOp = new HYDROGUI_TwoImagesOp( aModule, HYDROGUI_TwoImagesOp::Fuse );
     break;
@@ -221,8 +224,6 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case HideAllId:
     anOp = new HYDROGUI_ShowHideOp( aModule, theId );
     break;
-  case PolylineId:
-    anOp = new HYDROGUI_PolylineOp( aModule );
   }
 
   if( !anOp )
index 632b026144134859804ae3c0aaa489d7f57f3a08..22eca2ed4fe4ed45bf7d242a2bb8877f6e7db312 100644 (file)
 enum OperationId
 {
   FirstId = 0,
-
   UndoId,
   RedoId,
-
   ImportImageId,
+  EditImageId,
+  PolylineId,
   FuseId,
   CutId,
-
   DeleteId,
-
   ShowId,
   ShowOnlyId,
   ShowAllId,
   HideId,
   HideAllId,
-  PolylineId,
 };
 
 #endif
index fa75c25eb15109310cd352268622361bad9d132e..d92d0e373e7d91633aab28534b6b2e3a2c099f69 100644 (file)
@@ -109,6 +109,17 @@ void HYDROGUI_PrsImage::setTransformationPointMode( const int theMode )
     computeTransformationPoints();
 }
 
+//================================================================
+// Function : setTransformationPointMap
+// Purpose  : 
+//================================================================
+void HYDROGUI_PrsImage::setTransformationPointMap( const TransformationPointMap& theMap )
+{
+  myTransformationPointMap = theMap;
+  if( !theMap.isEmpty() )
+    computeTransformationPoints();
+}
+
 //================================================================
 // Function : boundingRect
 // Purpose  : 
index 8f385185a869ad4441e566082b71415a87e5613e..651c787cf08df9a6e85e2434fa97b215068b17e6 100644 (file)
@@ -57,6 +57,8 @@ public:
   bool                            getIsTransformationPointPreview() const;
 
   void                            setTransformationPointMode( const int theMode );
+
+  void                            setTransformationPointMap( const TransformationPointMap& theMap );
   const TransformationPointMap&   getTransformationPointMap() const { return myTransformationPointMap; }
 
 public:
index 28072d7cb228537057e41d7641c6857d58d9cf79..dbe776593dc5096e680292bf2e48dfcc00dd116d 100644 (file)
@@ -31,6 +31,8 @@
 #include <HYDROData_Iterator.h>
 
 #include <LightApp_Application.h>
+#include <LightApp_DataOwner.h>
+#include <LightApp_SelectionMgr.h>
 
 #include <QtxWorkstack.h>
 
@@ -126,6 +128,29 @@ Handle(TCollection_HExtendedString) HYDROGUI_Tool::ToHExtString( const QString&
   return new TCollection_HExtendedString( ToExtString( src ) );
 }
 
+void HYDROGUI_Tool::LambertToDouble( const int theDegrees,
+                                     const int theMinutes,
+                                     const double theSeconds,
+                                     double& theCoord )
+{
+  // ouv: check the case of negative degrees
+  theCoord = theDegrees * 3600 + theMinutes * 60 + theSeconds;
+}
+
+void HYDROGUI_Tool::DoubleToLambert( const double theCoord,
+                                     int& theDegrees,
+                                     int& theMinutes,
+                                     double& theSeconds )
+{
+  // ouv: check the case of negative degrees
+  theDegrees = int( theCoord / 3600 );
+
+  double aRemainder = theCoord - theDegrees * 3600;
+  theMinutes = int( aRemainder / 60 );
+
+  theSeconds = aRemainder - theMinutes * 60;
+}
+
 void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule,
                                           SUIT_ViewManager* theViewManager )
 {
@@ -190,3 +215,33 @@ GraphicsView_ObjectList HYDROGUI_Tool::GetPrsList( GraphicsView_ViewPort* theVie
   }
   return aList;
 }
+
+HYDROData_SequenceOfObjects HYDROGUI_Tool::GetSelectedObjects( HYDROGUI_Module* theModule )
+{
+  HYDROData_SequenceOfObjects aSeq;
+
+  HYDROGUI_DataModel* aModel = theModule->getDataModel();
+
+  SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
+  SUIT_DataOwnerPtrList anOwners;
+  aSelectionMgr->selected( anOwners );
+
+  foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+  {
+    if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
+    {
+      Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry(), KIND_UNKNOWN );
+      if( !anObject.IsNull() )
+        aSeq.Append( anObject );
+    }
+  }
+  return aSeq;
+}
+
+Handle(HYDROData_Object) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theModule )
+{
+  HYDROData_SequenceOfObjects aSeq = GetSelectedObjects( theModule );
+  if( !aSeq.IsEmpty() )
+    return aSeq.First();
+  return NULL;
+}
index 41d7fe2ffa33856ae57265336b4264b9e78cc7d3..dc2427b78c32d1b45a98611dcb7e5c0dd7892bbb 100644 (file)
@@ -86,6 +86,22 @@ public:
    */
   static Handle(TCollection_HExtendedString)      ToHExtString( const QString& );
 
+  /**
+   * \brief Encode the Lambert93 coordinates to the absolute double value
+   */
+  static void                     LambertToDouble( const int theDegrees,
+                                                   const int theMinutes,
+                                                   const double theSeconds,
+                                                   double& theCoord );
+
+  /**
+   * \brief Decode the Lambert93 coordinates from the absolute double value
+   */
+  static void                     DoubleToLambert( const double theCoord,
+                                                   int& theDegrees,
+                                                   int& theMinutes,
+                                                   double& theSeconds );
+
   /**
    * \brief Set the specified view manager to be active on the desktop.
    * \param theModule module
@@ -114,11 +130,25 @@ public:
                                                    const GraphicsView_ObjectList& theObjects );
 
   /**
-   * \brief Get list of HYDRO presentations from the specified viewport
+   * \brief Get list of HYDRO presentations from the specified viewport.
    * \param theViewPort viewport
    * \return list of HYDRO presentations
    */
   static GraphicsView_ObjectList  GetPrsList( GraphicsView_ViewPort* theViewPort );
+
+  /**
+   * \brief Get list of the selected data objects.
+   * \param theModule module
+   * \return list of the selected data objects
+   */
+  static HYDROData_SequenceOfObjects GetSelectedObjects( HYDROGUI_Module* theModule );
+
+  /**
+   * \brief Get the selected data object (first in the selected list).
+   * \param theModule module
+   * \return selected data object
+   */
+  static Handle(HYDROData_Object) GetSelectedObject( HYDROGUI_Module* theModule );
 };
 
 #endif
index 46403e91845158bc7b013585e997bf9e22a1fa90..3fe2979d63814a3b055c63067d4e1ed63282fea3 100644 (file)
       <translation>Mapping</translation>
     </message>
     <message>
-      <source>POINT_A</source>
-      <translation>Point A</translation>
+      <source>ACTIVATE_POINT_A_SELECTION</source>
+      <translation>Activate point A selection</translation>
     </message>
     <message>
-      <source>POINT_B</source>
-      <translation>Point B</translation>
+      <source>ACTIVATE_POINT_B_SELECTION</source>
+      <translation>Activate point B selection</translation>
     </message>
     <message>
-      <source>POINT_C</source>
-      <translation>Point C</translation>
+      <source>ACTIVATE_POINT_C_SELECTION</source>
+      <translation>Activate point C selection</translation>
     </message>
   </context>
   <context>
     <name>HYDROGUI_ImportImageOp</name>
+    <message>
+      <source>EDIT_IMAGE</source>
+      <translation>Edit image</translation>
+    </message>
     <message>
       <source>IMPORT_IMAGE</source>
       <translation>Import image</translation>
       <source>DSK_DELETE</source>
       <translation>Delete</translation>
     </message>
+    <message>
+      <source>DSK_EDIT_IMAGE</source>
+      <translation>Edit image</translation>
+    </message>
     <message>
       <source>DSK_FUSE_IMAGES</source>
       <translation>Fuse images</translation>
       <source>MEN_DESK_HYDRO</source>
       <translation>HYDRO</translation>
     </message>
+    <message>
+      <source>MEN_EDIT_IMAGE</source>
+      <translation>Edit image</translation>
+    </message>
     <message>
       <source>MEN_FUSE_IMAGES</source>
       <translation>Fuse images</translation>
       <source>STB_DELETE</source>
       <translation>Delete</translation>
     </message>
+    <message>
+      <source>STB_EDIT_IMAGE</source>
+      <translation>Edit image</translation>
+    </message>
     <message>
       <source>STB_FUSE_IMAGES</source>
       <translation>Fuse images</translation>
       <translation>Import image</translation>
     </message>
     <message>
-      <source>STB_IMPORT_IMAGE</source>
+      <source>STB_POLYLINE</source>
       <translation>Create polyline</translation>
     </message>
     <message>