]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Refs #320 - Point C is shown in reference image, however it isn't checked Import...
authornds <nds@opencascade.com>
Mon, 13 Jan 2014 11:50:04 +0000 (11:50 +0000)
committernds <nds@opencascade.com>
Mon, 13 Jan 2014 11:50:04 +0000 (11:50 +0000)
refs #324 - Point C is shown in reference image, however it isn't checked Import image dockable panel

src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.h
src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
src/HYDROGUI/HYDROGUI_ImportImageOp.h
src/HYDROGUI/HYDROGUI_PrsImage.cxx
src/HYDROGUI/HYDROGUI_PrsImage.h

index e39985b3675e23eb1fcf61d8f7dfc1e561afd468..4286978d8d517ba799d5f2e9e5985419a104a463 100644 (file)
@@ -385,6 +385,9 @@ void HYDROGUI_ImportImageDlg::reset()
   myImageName->clear();
   myImageNameGroup->setEnabled( false );
   myGeoFileName->clear();
+  bool isPBlocked = blockSignalsPoints( true );
+  bool isGBlocked = blockSignalsGeodesic( true );
+  bool isCBlocked = blockSignalsCartesian( true );
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
   {
@@ -393,21 +396,24 @@ void HYDROGUI_ImportImageDlg::reset()
     aBtn->setChecked( false );
     aBtn->blockSignals( anIsBlocked );
 
-    myPointXMap[ aPointType ]->clear();
-    myPointYMap[ aPointType ]->clear();
-    myPointXDegMap[ aPointType ]->clear();
-    myPointYDegMap[ aPointType ]->clear();
-    myPointXMinMap[ aPointType ]->clear();
-    myPointYMinMap[ aPointType ]->clear();
-    myPointXSecMap[ aPointType ]->clear();
-    myPointYSecMap[ aPointType ]->clear();
+    clearSpins( myPointXMap[ aPointType ] );
+    clearSpins( myPointYMap[ aPointType ] );
+    clearSpins( myPointXDegMap[ aPointType ] );
+    clearSpins( myPointYDegMap[ aPointType ] );
+    clearSpins( myPointXMinMap[ aPointType ] );
+    clearSpins( myPointYMinMap[ aPointType ] );
+    clearSpins( myPointXSecMap[ aPointType ] );
+    clearSpins( myPointYSecMap[ aPointType ] );
 
-    myRefPointXMap[ aPointType ]->clear();
-    myRefPointYMap[ aPointType ]->clear();
+    clearSpins( myRefPointXMap[ aPointType ] );
+    clearSpins( myRefPointYMap[ aPointType ] );
 
-    myCartPointXMap[ aPointType ]->clear();
-    myCartPointYMap[ aPointType ]->clear();
+    clearSpins( myCartPointXMap[ aPointType ] );
+    clearSpins( myCartPointYMap[ aPointType ] );
   }
+  blockSignalsPoints( isPBlocked );
+  blockSignalsGeodesic( isGBlocked );
+  blockSignalsCartesian( isCBlocked );
   
   // Emulate turning off C point usage
   myPointCEnabler->blockSignals( true );
@@ -465,6 +471,13 @@ QString HYDROGUI_ImportImageDlg::getFileName() const
   return myFileName->text();
 }
 
+void HYDROGUI_ImportImageDlg::setFileName( const QString& theName )
+{
+  myFileName->setText( theName );
+  myImageNameGroup->setEnabled( true );
+  myTransformGroup->setEnabled( true );
+}
+
 QString HYDROGUI_ImportImageDlg::getGeoreferencementFileName() const
 {
   return myGeoFileName->text();
@@ -701,10 +714,8 @@ void HYDROGUI_ImportImageDlg::onBrowse()
     }
     else
     {
-      myFileName->setText( aFileName );
+      setFileName( aFileName );
       emit createPreview( anImage );
-      myImageNameGroup->setEnabled( true );
-      myTransformGroup->setEnabled( true );
     }
   }
 }
@@ -908,26 +919,64 @@ void HYDROGUI_ImportImageDlg::onCartesianCoordChanged( const int thePointType )
   blockSignalsGeodesic( false );
 }
 
-void HYDROGUI_ImportImageDlg::blockSignalsGeodesic( const bool theState )
+void HYDROGUI_ImportImageDlg::clearSpins( QAbstractSpinBox* theSpin )
+{
+  if ( dynamic_cast<QtxIntSpinBox*>( theSpin ) )
+  {
+    QtxIntSpinBox* aSpin = dynamic_cast<QtxIntSpinBox*>( theSpin );
+    aSpin->setValue( aSpin->minimum() );
+  }
+  else if ( dynamic_cast<QtxIntSpinBox*>( theSpin ) )
+  {
+    QtxDoubleSpinBox* aDblSpin = dynamic_cast<QtxDoubleSpinBox*>( theSpin );
+    aDblSpin->setValue( aDblSpin->minimum() );
+  }
+
+  theSpin->clear();
+}
+
+bool HYDROGUI_ImportImageDlg::blockSignalsPoints( const bool theState )
+{
+  bool isBlocked = false;
+  for( int aPointType = HYDROGUI_PrsImage::PointA;
+       aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
+  {
+    isBlocked = 
+    myPointXMap[ aPointType ]->blockSignals( theState ) || isBlocked;
+    myPointYMap[ aPointType ]->blockSignals( theState );
+
+    myRefPointXMap[ aPointType ]->blockSignals( theState );
+    myRefPointYMap[ aPointType ]->blockSignals( theState );
+  }
+  return isBlocked;
+}
+
+bool HYDROGUI_ImportImageDlg::blockSignalsGeodesic( const bool theState )
 {
+  bool isBlocked = false;
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
   {
-    myPointXDegMap[ aPointType ]->blockSignals( theState );
+    isBlocked = 
+    myPointXDegMap[ aPointType ]->blockSignals( theState ) || isBlocked;
     myPointXMinMap[ aPointType ]->blockSignals( theState );
     myPointXSecMap[ aPointType ]->blockSignals( theState );
     myPointYDegMap[ aPointType ]->blockSignals( theState );
     myPointYMinMap[ aPointType ]->blockSignals( theState );
     myPointYSecMap[ aPointType ]->blockSignals( theState );
   }
+  return isBlocked;
 }
 
-void HYDROGUI_ImportImageDlg::blockSignalsCartesian( const bool theState )
+bool HYDROGUI_ImportImageDlg::blockSignalsCartesian( const bool theState )
 {
+  bool isBlocked = false;
   for( int aPointType = HYDROGUI_PrsImage::PointA;
        aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ )
   {
-    myCartPointXMap[ aPointType ]->blockSignals( theState );
+    isBlocked = 
+    myCartPointXMap[ aPointType ]->blockSignals( theState ) || isBlocked;
     myCartPointYMap[ aPointType ]->blockSignals( theState );
   }
+  return isBlocked;
 }
index f1f2a6478f77ffd038e4435d9061f841d457427e..b4a2c950c54ec84103505ba488fcf97bf90b120d 100644 (file)
@@ -42,6 +42,7 @@ class QCheckBox;
 
 class QtxDoubleSpinBox;
 class QtxIntSpinBox;
+class QAbstractSpinBox;
 
 class HYDROGUI_ImportImageDlg : public HYDROGUI_InputPanel
 {
@@ -86,6 +87,7 @@ public:
   QString                    getRefImageName() const;
 
   QString                    getFileName() const;
+  void                       setFileName( const QString& theName );
   QString                    getGeoreferencementFileName() const;
 
   void                       setImageSize( const QSize& theSize,
@@ -129,8 +131,10 @@ protected slots:
   void                       onCartesianCoordChanged( const int thePointType );
 
 private:
-  void                       blockSignalsGeodesic( const bool theState );
-  void                       blockSignalsCartesian( const bool theState );
+  void                       clearSpins( QAbstractSpinBox* theSpin );
+  bool                       blockSignalsPoints( const bool theState );
+  bool                       blockSignalsGeodesic( const bool theState );
+  bool                       blockSignalsCartesian( const bool theState );
 
 signals:
   void                       createPreview( QImage );
index 3533cee2c7d4f651860227a4c2b8efa7b7a30d01..58ca39f3bcef537c399e36802742ff456b55668e 100644 (file)
@@ -166,36 +166,8 @@ void HYDROGUI_ImportImageOp::startOperation()
     }
   }
 
-  // Collect information about existing images and initialize the combobox 
-  // reference image selector in the dialog.
   HYDROGUI_ImportImageDlg::PrsPointDataList aPrsPointDataList;
-  HYDROData_Iterator anIterator( doc(), KIND_IMAGE );
-  for( ; anIterator.More(); anIterator.Next() )
-  {
-    Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( anIterator.Current() );
-    if( !anImageObj.IsNull() )
-    {
-      if( myIsEdit && IsEqual( anImageObj, myEditedObject ) )
-        continue;
-
-      QPoint aLocalPointA, aLocalPointB, aLocalPointC;
-      anImageObj->GetLocalPoints( aLocalPointA, aLocalPointB, aLocalPointC );
-      
-      HYDROData_Image::TransformationMode aImgTrsfMode;
-      QPointF aTrsfPointA, aTrsfPointB, aTrsfPointC;
-      anImageObj->GetGlobalPoints( aImgTrsfMode,
-                                   aTrsfPointA, aTrsfPointB, aTrsfPointC );
-
-      HYDROGUI_ImportImageDlg::TransformationDataMap aDataMap;
-      computeTrsfData( aImgTrsfMode, false, aLocalPointA, aLocalPointB, aLocalPointC,
-        aTrsfPointA, aTrsfPointB, aTrsfPointC, aDataMap );
-
-      HYDROGUI_ImportImageDlg::PrsPointData aPrsPointData( anImageObj->GetName(), aDataMap );
-      aPrsPointDataList.append( aPrsPointData );
-    }
-  }
-
-  // Initialize the combobox in the dialog with the list of available reference images
+  getReferenceDataList( aPrsPointDataList );
   aPanel->setPrsPointDataList( aPrsPointDataList );
   // Select the current reference image in the dialog combobox
   aPanel->setRefImageName( aRefImageName );
@@ -225,6 +197,38 @@ void HYDROGUI_ImportImageOp::setPresentationTrsfPoints( HYDROGUI_PrsImage* thePr
   }
 }
 
+void HYDROGUI_ImportImageOp::getReferenceDataList(
+                        HYDROGUI_ImportImageDlg::PrsPointDataList& theList ) const
+{
+  // Collect information about existing images and initialize the combobox 
+  // reference image selector in the dialog.
+  HYDROData_Iterator anIterator( doc(), KIND_IMAGE );
+  for( ; anIterator.More(); anIterator.Next() )
+  {
+    Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( anIterator.Current() );
+    if( !anImageObj.IsNull() )
+    {
+      if( myIsEdit && IsEqual( anImageObj, myEditedObject ) )
+        continue;
+
+      QPoint aLocalPointA, aLocalPointB, aLocalPointC;
+      anImageObj->GetLocalPoints( aLocalPointA, aLocalPointB, aLocalPointC );
+      
+      HYDROData_Image::TransformationMode aImgTrsfMode;
+      QPointF aTrsfPointA, aTrsfPointB, aTrsfPointC;
+      anImageObj->GetGlobalPoints( aImgTrsfMode,
+                                   aTrsfPointA, aTrsfPointB, aTrsfPointC );
+
+      HYDROGUI_ImportImageDlg::TransformationDataMap aDataMap;
+      computeTrsfData( aImgTrsfMode, false, aLocalPointA, aLocalPointB, aLocalPointC,
+        aTrsfPointA, aTrsfPointB, aTrsfPointC, aDataMap );
+
+      HYDROGUI_ImportImageDlg::PrsPointData aPrsPointData( anImageObj->GetName(), aDataMap );
+      theList.append( aPrsPointData );
+    }
+  }
+}
+
 void HYDROGUI_ImportImageOp::computeTrsfData( HYDROData_Image::TransformationMode theTrsfMode,
                                               bool theIsByTwoPoints,
                                               const QPoint& theLocalPointA,
@@ -553,9 +557,20 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
 
   if( myPreviewPrs ) // if the image is changed by choosing another file
   {
-    myPreviewPrs->setImage( myImage );
-    myPreviewPrs->compute();
-
+    myPreviewPrs->setImage( myImage, true );
+    if ( sender() ) // reset the previous presentation settings
+    {
+      QString aFileName = aPanel->getFileName();
+
+      aPanel->reset();
+      aPanel->setIsEdit( myIsEdit );
+      // restore the file name
+      aPanel->setFileName( aFileName );
+      // fill the reference list
+      HYDROGUI_ImportImageDlg::PrsPointDataList aPrsPointDataList;
+      getReferenceDataList( aPrsPointDataList );
+      aPanel->setPrsPointDataList( aPrsPointDataList );
+    }
     if( myPreviewViewManager )
     {
       if( GraphicsView_Viewer* aViewer = myPreviewViewManager->getViewer() )
@@ -575,8 +590,7 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
     myActiveViewManager = anApp->activeViewManager();
 
     myPreviewPrs = new HYDROGUI_PrsImage( myIsEdit ? myEditedObject : 0 );
-    myPreviewPrs->setImage( myImage );
-    myPreviewPrs->compute();
+    myPreviewPrs->setImage( myImage, true );
 
     myPreviewViewManager =
       dynamic_cast<GraphicsView_ViewManager*>( anApp->createViewManager( GraphicsView_Viewer::Type() ) );
@@ -602,30 +616,29 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage )
                  this, SLOT( onPointSelected() ) );
       }
     }
+  }
 
-    // Set the image name in the dialog
-    QString anImageName = aPanel->getImageName().simplified();
-    // If edit mode and the name was not set yet then get from the edited object
-    if( myIsEdit && anImageName.isEmpty() )
-    {
-      if( !myEditedObject.IsNull() )
-        anImageName = myEditedObject->GetName();
+  // Set the image name in the dialog
+  QString anImageName = aPanel->getImageName().simplified();
+  // If edit mode and the name was not set yet then get from the edited object
+  if( myIsEdit && anImageName.isEmpty() )
+  {
+    if( !myEditedObject.IsNull() )
+      anImageName = myEditedObject->GetName();
+  }
+  // If the name was not set then initialize it from the selected file name
+  if ( anImageName.isEmpty() )
+  {
+    anImageName = aPanel->getFileName();
+    if ( !anImageName.isEmpty() ) {
+        anImageName = QFileInfo( anImageName ).baseName();
     }
-    // If the name was not set then initialize it from the selected file name
-    if ( anImageName.isEmpty() )
-    {
-      anImageName = aPanel->getFileName();
-      if ( !anImageName.isEmpty() ) {
-          anImageName = QFileInfo( anImageName ).baseName();
-      }
-      // If no file name then generate a new image name
-      if ( anImageName.isEmpty() ) {
-        anImageName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_IMAGE_NAME" ) );
-      }
+    // If no file name then generate a new image name
+    if ( anImageName.isEmpty() ) {
+      anImageName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_IMAGE_NAME" ) );
     }
-
-    aPanel->setImageName( anImageName );
   }
+  aPanel->setImageName( anImageName );
 
   aPanel->setImageSize( myImage.size() );
 
@@ -677,17 +690,19 @@ void HYDROGUI_ImportImageOp::onModeActivated( int theMode )
 
 void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
 {
+  if( theName.isEmpty() ) {
+    if( myRefViewManager )
+      closeView( myRefViewManager );
+    return;
+  }
+
   GraphicsView_ViewPort* aViewPort = 0;
 
   LightApp_Application* anApp = module()->getApp();
   ///// Get a view port for the reference image preview
   if( myRefViewManager )
   {
-    if( theName.isEmpty() )
-    {
-      closeView( myRefViewManager );
-    }
-    else if( GraphicsView_Viewer* aViewer = myRefViewManager->getViewer() )
+    if( GraphicsView_Viewer* aViewer = myRefViewManager->getViewer() )
     {
       aViewPort = aViewer->getActiveViewPort();
     }
@@ -737,8 +752,7 @@ void HYDROGUI_ImportImageOp::onRefImageActivated( const QString& theName )
     anImage = anImageObj->Image();
 
     myRefPreviewPrs = new HYDROGUI_PrsImage( anImageObj );
-    myRefPreviewPrs->setImage( anImage );
-    myRefPreviewPrs->compute();
+    myRefPreviewPrs->setImage( anImage, true );
 
     myRefPreviewPrs->setIsTransformationPointPreview( true );
     myRefPreviewPrs->setTransformationPointType( myPointType );
index 5a7e858f89db5605cd1665d1e680e6e6bf076278..0acdd0bc9b7aa8ab8ffb01817f67747708ca3302 100644 (file)
@@ -103,6 +103,12 @@ private:
                                                         const QPoint theLocalPointB, 
                                                         const QPoint theLocalPointC );
 
+  /*
+   * Initialize the combobox in the dialog with the list of available reference images
+   */
+  void                       getReferenceDataList(
+                                 HYDROGUI_ImportImageDlg::PrsPointDataList& theList ) const;
+
 private:
   bool                       myIsEdit;
   Handle(HYDROData_Image)    myEditedObject;
index 8b2c8a0ebcd3ec42a13d634a5f73a7ef450a84a1..985dc27d45a7f22a178519b96209eff757958d4a 100644 (file)
@@ -62,9 +62,13 @@ HYDROGUI_PrsImage::~HYDROGUI_PrsImage()
 // Function : setImage
 // Purpose  : 
 //================================================================
-void HYDROGUI_PrsImage::setImage( const QImage& theImage )
+void HYDROGUI_PrsImage::setImage( const QImage& theImage, const bool theCompute )
 {
   myImage = theImage;
+  if ( theCompute ) {
+    compute();
+    computeTransformationPoints( true );
+  }
 }
 
 //================================================================
@@ -293,76 +297,91 @@ void HYDROGUI_PrsImage::setSelected( bool theState )
 // Function : computeTransformationPoints
 // Purpose  : 
 //================================================================
-void HYDROGUI_PrsImage::computeTransformationPoints()
+void HYDROGUI_PrsImage::computeTransformationPoints( const bool theObligatoryInit )
 {
-  if( myTransformationPointMap.isEmpty() )
   {
-    int aWidth = myImage.width();
-    int aHeight = myImage.height();
-
-    // Create presentations for transformation points A, B and C
     for( int aPointType = PointA; aPointType <= PointC; aPointType++ )
     {
-      TransformationPoint aTransformationPoint;
-
-      QPoint aPoint;
-      QString aCaption;
-      QColor aColor = Qt::black;
-      switch( aPointType )
-      {
-        case PointA:
-          aPoint = QPoint( 0, 0 );
-          aCaption = "A";
-          aColor = Qt::darkRed;
-          break;
-        case PointB:
-          aPoint = QPoint( aWidth, 0 );
-          aCaption = "B";
-          aColor = Qt::darkGreen;
-          break;
-        case PointC:
-          aPoint = QPoint( 0, aHeight );
-          aCaption = "C";
-          aColor = Qt::darkBlue;
-          break;
-      }
-      
-      aTransformationPoint.Point = aPoint;
-      aTransformationPoint.Caption = aCaption;
-
-      QGraphicsEllipseItem* aPointItem = new QGraphicsEllipseItem( this );
-      aPointItem->setPen( QPen( aColor ) );
-      aPointItem->setBrush( QBrush( aColor ) );
-
-      double aRadius = 3;
-      QRectF aRect( -QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) );
-      aPointItem->setRect( aRect );
-      aPointItem->setPos( QPointF( 0, 0 ) );
-
-      QGraphicsSimpleTextItem* aCaptionItem = aCaptionItem = new QGraphicsSimpleTextItem( aCaption, this );
-      aCaptionItem->setPen( QPen( aColor ) );
-      aCaptionItem->setBrush( QBrush( aColor ) );
-      QFont aFont = aCaptionItem->font();
-      aFont.setPointSize( qApp->font().pointSize() );
-      aCaptionItem->setFont( aFont );
-      aCaptionItem->setPos( QPointF( -aRadius * 2, aRadius * 2 ) );
-
-      aTransformationPoint.GroupItem = new QGraphicsItemGroup( this );
-      aTransformationPoint.GroupItem->addToGroup( aPointItem );
-      aTransformationPoint.GroupItem->addToGroup( aCaptionItem );
-      aTransformationPoint.GroupItem->setVisible( false );
-      aTransformationPoint.GroupItem->setFlag( QGraphicsItem::ItemIgnoresTransformations );
-      aTransformationPoint.GroupItem->setPos( aPoint );
-
-      myTransformationPointMap[ aPointType ] = aTransformationPoint;
+      if( myTransformationPointMap.isEmpty() || theObligatoryInit )
+        initTrsfPoints( aPointType );
+      // Show/hide the point if necessary
+      updateTrsfPoint( aPointType );
+
     }
   }
+}
+
+QGraphicsItemGroup* HYDROGUI_PrsImage::createPointItem( const QString& theCaption,
+                                                        const QColor& theColor )
+{
+  QGraphicsEllipseItem* aPointItem = new QGraphicsEllipseItem( this );
+  aPointItem->setPen( QPen( theColor ) );
+  aPointItem->setBrush( QBrush( theColor ) );
+
+  double aRadius = 3;
+  QRectF aRect( -QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) );
+  aPointItem->setRect( aRect );
+  aPointItem->setPos( QPointF( 0, 0 ) );
+
+  QGraphicsSimpleTextItem* aCaptionItem = aCaptionItem = new QGraphicsSimpleTextItem( theCaption, this );
+  aCaptionItem->setPen( QPen( theColor ) );
+  aCaptionItem->setBrush( QBrush( theColor ) );
+  QFont aFont = aCaptionItem->font();
+  aFont.setPointSize( qApp->font().pointSize() );
+  aCaptionItem->setFont( aFont );
+  aCaptionItem->setPos( QPointF( -aRadius * 2, aRadius * 2 ) );
+
+  QGraphicsItemGroup* aGroupItem = new QGraphicsItemGroup( this );
+  aGroupItem->addToGroup( aPointItem );
+  aGroupItem->addToGroup( aCaptionItem );
+  aGroupItem->setVisible( false );
+  aGroupItem->setFlag( QGraphicsItem::ItemIgnoresTransformations );
+
+  return aGroupItem;
+}
+
+//================================================================
+// Function : initTrsfPoints
+// Purpose  : 
+//================================================================
+void HYDROGUI_PrsImage::initTrsfPoints( const int thePointType )
+{
+  QPoint aPoint;
+  QString aCaption;
+  QColor aColor = Qt::black;
 
-  for( int aPointType = PointA; aPointType <= PointC; aPointType++ )
+  int aWidth = myImage.width();
+  int aHeight = myImage.height();
+  switch( thePointType )
   {
-    // Show/hide the point if necessary
-    updateTrsfPoint( aPointType );
+    case PointA:
+      aPoint = QPoint( 0, 0 );
+      aCaption = "A";
+      aColor = Qt::darkRed;
+      break;
+    case PointB:
+      aPoint = QPoint( aWidth, 0 );
+      aCaption = "B";
+      aColor = Qt::darkGreen;
+      break;
+    case PointC:
+      aPoint = QPoint( 0, aHeight );
+      aCaption = "C";
+      aColor = Qt::darkBlue;
+      break;
   }
+
+  TransformationPoint aTransformationPoint;
+  if ( myTransformationPointMap.contains( thePointType ) )
+    aTransformationPoint = myTransformationPointMap[thePointType];
+
+  aTransformationPoint.Point = aPoint;
+  aTransformationPoint.Caption = aCaption;
+  if ( !aTransformationPoint.GroupItem )
+    aTransformationPoint.GroupItem = createPointItem( aCaption, aColor );
+  aTransformationPoint.GroupItem->setPos( aPoint );
+
+  myTransformationPointMap[ thePointType ] = aTransformationPoint;
 }
 
 //================================================================
index f01115208cb747d1d7260f8c6a1c864553eff288..1fafe35416c0a4d346e0a3d0509d68cda199d00a 100644 (file)
@@ -37,6 +37,8 @@ public:
   enum TransformationPointType { None = 0, PointA, PointB, PointC };
   struct TransformationPoint
   {
+    TransformationPoint() : Point( 0, 0 ), Caption( "" ), GroupItem( 0 ) {}
+
     QPoint              Point;
     QString             Caption;
     QGraphicsItemGroup* GroupItem;
@@ -49,7 +51,8 @@ public:
   virtual ~HYDROGUI_PrsImage();
 
 public:
-  void                            setImage( const QImage& theImage );
+  void                            setImage( const QImage& theImage,
+                                            const bool theCompute = false );
   QImage                          getImage() const;
 
   void                            setCaption( const QString& theCaption );
@@ -89,7 +92,16 @@ public:
   virtual void                    setSelected( bool theState );
 
 protected:
-  void                            computeTransformationPoints();
+  void                            computeTransformationPoints( const bool theObligatoryInit = false );
+
+  QGraphicsItemGroup*             createPointItem( const QString& theCaption,
+                                                   const QColor& theColor );
+
+  /**
+   * Create presentations for transformation points A, B and C or update the presentation
+   * parameters if it is already created
+   */
+  void                            initTrsfPoints( const int thePointType );
   /**
    * Show/hide a transformation point if necessary.
    */