]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Methods to work with imagw references:
authoradv <adv@opencascade.com>
Tue, 5 Nov 2013 10:44:20 +0000 (10:44 +0000)
committeradv <adv@opencascade.com>
Tue, 5 Nov 2013 10:44:20 +0000 (10:44 +0000)
  - Remove image references
  - Recalculate image position if reference image changed

13 files changed:
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_Image.cxx
src/HYDROData/HYDROData_Image.h
src/HYDROData/HYDROData_Tool.cxx
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.h [new file with mode: 0644]
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 27efc616cf9f6449c6bddbee1b963737c20e4875..0aab7b14474756b8e3670f18fe7b549f780fed17 100644 (file)
@@ -51,7 +51,7 @@ QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjec
   return anEmptyList;
 }
 
-void HYDROData_Entity::Update( const bool theIsForce )
+void HYDROData_Entity::Update()
 {
 }
 
index 84a82778013ec8464eef81f4b5102e0f8bea04d7..8f60960dde65c6df34ac5e8b2ab532fc0d3c4532 100644 (file)
@@ -96,11 +96,9 @@ public:
   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
 
   /**
-   * Updates object state.
-   * Base implementation dose nothing.
-   * \param theIsForce force reupdating of data object
+   * Updates object state. Base implementation dose nothing.
    */
-  HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
+  HYDRODATA_EXPORT virtual void Update();
 
   /**
    * Returns data of object wrapped to QVariant.
index ae6b08042693fc987ca8885b86ef58a9771f056b..3ca786fcff119444b3c9b670332916c862dee999 100644 (file)
@@ -2,6 +2,7 @@
 #include "HYDROData_Image.h"
 
 #include "HYDROData_Document.h"
+#include "HYDROData_Lambert93.h"
 #include "HYDROData_Tool.h"
 #include "HYDROData_OperationsFactory.h"
 
@@ -42,7 +43,7 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject
 {
   QStringList aResList;
 
-  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
   if ( aDocument.IsNull() )
     return aResList;
                              
@@ -112,7 +113,8 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject
       aResList << QString( "%1.SetOperatorName( \"%2\" );" )
                   .arg( anImageName ).arg( anOperatorName );
 
-      ImageComposer_Operator* anImageOp = HYDROData_OperationsFactory::Factory()->Operator( this );
+      ImageComposer_Operator* anImageOp = 
+        HYDROData_OperationsFactory::Factory()->Operator( OperatorName() );
       if ( anImageOp )
       {
         // Dump operation arguments
@@ -144,19 +146,18 @@ QStringList HYDROData_Image::DumpToPython( MapOfTreatedObjects& theTreatedObject
 
     // Necessary to update image in case of composed operator
     aResList << QString( "" );
-    aResList << QString( "%1.Update( False );" ).arg( anImageName );
+    aResList << QString( "%1.Update();" ).arg( anImageName );
   }
 
   return aResList;
 }
 
-void HYDROData_Image::Update( const bool theIsForce )
+void HYDROData_Image::Update()
 {
   HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory();
 
-  // Update image only if there is an operation
   ImageComposer_Operator* anOp = aFactory->Operator( OperatorName() );
-  if ( anOp ) 
+  if ( anOp ) // Update image if there is an operation
   {
     // Fill by arguments and process the operation
     QVariant anObj1, anObj2;
@@ -189,17 +190,18 @@ void HYDROData_Image::Update( const bool theIsForce )
     ImageComposer_Image aResImg = anOp->process( anObj1, anObj2 );
     SetImage( aResImg );
   }
+  else // Update image if it positioned relatively to other image
+  {
+    UpdateTrsf();
+  }
 
-  if ( theIsForce )
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  if ( !aDocument.IsNull() )
   {
-    Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
-    if ( !aDocument.IsNull() )
-    {
-      // Change the states of this and all depended images
-      MustBeUpdated( true );
-      HYDROData_Tool::SetMustBeUpdatedImages( aDocument );
-      MustBeUpdated( false );
-    }
+    // Change the states of this and all depended images
+    MustBeUpdated( true );
+    HYDROData_Tool::SetMustBeUpdatedImages( aDocument );
+    MustBeUpdated( false );
   }
 }
 
@@ -331,8 +333,28 @@ void HYDROData_Image::UpdateTrsf()
     aRefTransform = aRefImage->Trsf();
   }
 
+  bool anIsByTwoPoints = IsByTwoPoints();
+
+  // Convert lambert coordinates to cartesian
+  if ( aTrsfMode == ManualLambert )
+  {
+    double aXCart = 0, aYCart = 0;
+
+    HYDROData_Lambert93::toXY( aTrsfPointA.x(), aTrsfPointA.y(), aXCart, aYCart );
+    aTrsfPointA = QPointF( aXCart, aYCart );
+
+    HYDROData_Lambert93::toXY( aTrsfPointB.x(), aTrsfPointB.y(), aXCart, aYCart );
+    aTrsfPointB = QPointF( aXCart, aYCart );
+
+    if ( !anIsByTwoPoints )
+    {
+      HYDROData_Lambert93::toXY( aTrsfPointC.x(), aTrsfPointC.y(), aXCart, aYCart );
+      aTrsfPointC = QPointF( aXCart, aYCart );
+    }
+  }
+
   // generate third points if needed
-  if ( IsByTwoPoints() )
+  if ( anIsByTwoPoints )
   {
     aPointC = generateThirdPoint( aPointA, aPointB, true ).toPoint();
     aTrsfPointC = generateThirdPoint( aTrsfPointA, aTrsfPointB, anIsRefImage );
@@ -368,11 +390,9 @@ void HYDROData_Image::UpdateTrsf()
   if( !anIsInvertible )
     return;
 
-  QTransform aResTransform;
+  QTransform aResTransform = aTransform1Inverted * aTransform2;
   if( anIsRefImage )
-    aResTransform = aTransform1Inverted * aTransform2 * aRefTransform;
-  else
-    aResTransform = aTransform1Inverted * aTransform2;
+    aResTransform *= aRefTransform;
 
   SetTrsf( aResTransform );
 }
@@ -388,9 +408,62 @@ bool HYDROData_Image::IsByTwoPoints() const
   return aPointC.x() < 0 && aPointC.y() < 0; 
 }
 
+bool HYDROData_Image::HasReferences() const
+{
+  Handle(HYDROData_Image) aRefImage = GetTrsfReferenceImage();
+  int aNbReferences = NbReferences();
+
+  return !aRefImage.IsNull() || aNbReferences > 0;
+}
+
+void HYDROData_Image::RemoveAllReferences()
+{
+  if ( !HasReferences() )
+    return;
+
+  Handle(HYDROData_Image) aRefImage = GetTrsfReferenceImage();
+  if ( !aRefImage.IsNull() )
+  {
+    RemoveTrsfReferenceImage();
+  }
+  else
+  {
+    ClearReferences();
+    SetOperatorName( "" );
+    SetArgs( "" );
+    SetIsSelfSplitted( false );
+  }
+
+  MustBeUpdated( false );
+
+  bool anIsByTwoPoints = IsByTwoPoints();
+
+  QImage anImage = Image();
+  if ( anImage.isNull() )
+    return;
+
+  // Set local points to default position
+  QPoint aLocalPointA = QPoint( 0, 0 );
+  QPoint aLocalPointB = QPoint( anImage.width(), 0 );
+  QPoint aLocalPointC = anIsByTwoPoints ? QPoint( INT_MIN, INT_MIN ) : QPoint( 0, anImage.height() );
+
+  SetLocalPoints( aLocalPointA, aLocalPointB, aLocalPointC, false );
+
+  // Calculate global points
+  QTransform aTransform = Trsf();
+
+  QPointF aTrsfPointA = QPointF( aTransform.map( aLocalPointA ) );
+  QPointF aTrsfPointB = QPointF( aTransform.map( aLocalPointB ) );
+  QPointF aTrsfPointC = anIsByTwoPoints ? QPointF( INT_MIN, INT_MIN ) : 
+                                          QPointF( aTransform.map( aLocalPointC ) );
+
+  SetGlobalPoints( ManualCartesian, aTrsfPointA, aTrsfPointB, aTrsfPointC );
+}
+
 void HYDROData_Image::SetLocalPoints( const QPoint& thePointA,
                                       const QPoint& thePointB,
-                                      const QPoint& thePointC )
+                                      const QPoint& thePointC,
+                                      const bool    theIsUpdate )
 {
   Handle(TDataStd_RealArray) anArray;
   if ( !myLab.FindChild( DataTag_TrsfPoints ).FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
@@ -405,7 +478,8 @@ void HYDROData_Image::SetLocalPoints( const QPoint& thePointA,
 
   TDataStd_UAttribute::Set( myLab.FindChild( DataTag_TrsfPoints ), GUID_HAS_LOCAL_POINTS );
 
-  UpdateTrsf();
+  if ( theIsUpdate )
+    UpdateTrsf();
 }
 
 bool HYDROData_Image::GetLocalPoints( QPoint& thePointA,
@@ -439,7 +513,8 @@ bool HYDROData_Image::HasLocalPoints() const
 void HYDROData_Image::SetGlobalPoints( const TransformationMode& theMode,
                                        const QPointF&            thePointA,
                                        const QPointF&            thePointB,
-                                       const QPointF&            thePointC )
+                                       const QPointF&            thePointC,
+                                       const bool                theIsUpdate )
 {
   Handle(TDataStd_RealArray) anArray;
   if ( !myLab.FindChild( DataTag_TrsfPoints ).FindAttribute( TDataStd_RealArray::GetID(), anArray ) )
@@ -456,7 +531,8 @@ void HYDROData_Image::SetGlobalPoints( const TransformationMode& theMode,
 
   TDataStd_UAttribute::Set( myLab.FindChild( DataTag_TrsfPoints ), GUID_HAS_GLOBAL_POINTS );
 
-  UpdateTrsf();
+  if ( theIsUpdate )
+    UpdateTrsf();
 
   /*
   if( anIsRefImage )
@@ -518,12 +594,11 @@ bool HYDROData_Image::HasGlobalPoints() const
 void HYDROData_Image::SetReferencePoints( const Handle(HYDROData_Image)& theRefImage,
                                           const QPointF&                 thePointA,
                                           const QPointF&                 thePointB,
-                                          const QPointF&                 thePointC )
+                                          const QPointF&                 thePointC,
+                                          const bool                     theIsUpdate )
 {
   SetTrsfReferenceImage( theRefImage );
-  SetGlobalPoints( ReferenceImage, thePointA, thePointB, thePointC );
-
-  UpdateTrsf();
+  SetGlobalPoints( ReferenceImage, thePointA, thePointB, thePointC, theIsUpdate );
 }
 
 bool HYDROData_Image::GetReferencePoints( Handle(HYDROData_Image)& theRefImage,
@@ -588,6 +663,11 @@ Handle(HYDROData_Image) HYDROData_Image::GetTrsfReferenceImage() const
   return Handle(HYDROData_Image)::DownCast( GetReferenceObject( DataTag_TrsfImage ) );
 }
 
+void HYDROData_Image::RemoveTrsfReferenceImage()
+{
+  return RemoveReferenceObject( DataTag_TrsfImage );
+}
+
 void HYDROData_Image::AppendReference( const Handle(HYDROData_Entity)& theReferenced )
 {
   AddReferenceObject( theReferenced, 0 );
index da11061653ac0ce1bc57058881cca94dcba29538..7fe84c9329f1d50c8026fd0e2ec95ff6fd9a7f4d 100644 (file)
@@ -59,9 +59,8 @@ public:
    * Reimplemented to update an Image object in the data structure.
    * Call this method whenever you made changes for operator or reference objects.
    * If it is changed, sets "MustBeUpdated" flag to other depended images.
-   * \param theIsForce force reupdating of data object
    */
-  HYDRODATA_EXPORT virtual void Update( const bool theIsForce = true );
+  HYDRODATA_EXPORT virtual void Update();
 
   /**
    * Returns data of object wrapped to QVariant.
@@ -122,6 +121,17 @@ public:
   HYDRODATA_EXPORT bool IsByTwoPoints() const;
 
 
+  /**
+   * Removes all references from this image.
+   */
+  HYDRODATA_EXPORT bool HasReferences() const;
+
+  /**
+   * Removes all references from this image.
+   */
+  HYDRODATA_EXPORT void RemoveAllReferences();
+
+
   /**
    * Stores the transformation points in local cs of image
    * \param thePointA point A
@@ -130,7 +140,8 @@ public:
    */
   HYDRODATA_EXPORT void SetLocalPoints( const QPoint& thePointA,
                                         const QPoint& thePointB,
-                                        const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ) );
+                                        const QPoint& thePointC = QPoint( INT_MIN, INT_MIN ),
+                                        const bool    theIsUpdate = true );
 
   /**
    * Returns the transformation points in local cs of image
@@ -159,7 +170,8 @@ public:
   HYDRODATA_EXPORT void SetGlobalPoints( const TransformationMode& theMode,
                                          const QPointF&            thePointA,
                                          const QPointF&            thePointB,
-                                         const QPointF&            thePointC = QPoint( INT_MIN, INT_MIN ) );
+                                         const QPointF&            thePointC = QPoint( INT_MIN, INT_MIN ),
+                                         const bool                theIsUpdate = true  );
 
   /**
    * Returns the transformation points in global cs
@@ -190,7 +202,8 @@ public:
   HYDRODATA_EXPORT void SetReferencePoints( const Handle(HYDROData_Image)& theRefImage,
                                             const QPointF&                 thePointA,
                                             const QPointF&                 thePointB,
-                                            const QPointF&                 thePointC = QPoint( INT_MIN, INT_MIN ) );
+                                            const QPointF&                 thePointC = QPoint( INT_MIN, INT_MIN ),
+                                            const bool                     theIsUpdate = true );
 
   /**
    * Returns the transformation points in reference image local cs
@@ -222,6 +235,11 @@ public:
    */
   HYDRODATA_EXPORT Handle(HYDROData_Image) GetTrsfReferenceImage() const;
 
+  /**
+   * Removes the reference image for transformation
+   */
+  HYDRODATA_EXPORT void RemoveTrsfReferenceImage();
+
 
   /**
    * Stores the transformation mode
@@ -273,6 +291,7 @@ public:
    */
   HYDRODATA_EXPORT void ClearReferences();
 
+
   /**
    * Stores the operator name
    * \param theOpName name of the operator that must be executed for image update
index fda98c6134bb9807f150190aaac67f7f445e8ced..cd6090370b15f1941099fa91fea84db1bba7bd78 100644 (file)
@@ -41,6 +41,14 @@ void HYDROData_Tool::SetMustBeUpdatedImages(
       if ( anImage.IsNull() || anImage->MustBeUpdated() )
         continue;
 
+      Handle(HYDROData_Image) aTrsfRefImage = anImage->GetTrsfReferenceImage();
+      if ( !aTrsfRefImage.IsNull() && aTrsfRefImage->MustBeUpdated() )
+      {
+        anImage->MustBeUpdated( true );
+        aChanged = true;
+        continue;
+      }
+
       for ( int i = 0, aNBRefs = anImage->NbReferences(); i < aNBRefs; ++i )
       {
         Handle(HYDROData_Image) aRefImage =
index dc39fbe20052e3a8748234c3333f6b86a2bc84bd..0a83214177d3b7ce67fd4ff700adcd32d92abe04 100644 (file)
@@ -42,6 +42,7 @@ set(PROJECT_HEADERS
     HYDROGUI_PrsZone.h
     HYDROGUI_PrsZoneDriver.h
     HYDROGUI_Region.h
+    HYDROGUI_RemoveImageRefsOp.h
     HYDROGUI_Shape.h
     HYDROGUI_ShowHideOp.h
     HYDROGUI_Tool.h
@@ -96,6 +97,7 @@ set(PROJECT_SOURCES
     HYDROGUI_PrsZone.cxx
     HYDROGUI_PrsZoneDriver.cxx
     HYDROGUI_Region.cxx
+    HYDROGUI_RemoveImageRefsOp.cxx
     HYDROGUI_Shape.cxx
     HYDROGUI_ShowHideOp.cxx
     HYDROGUI_Tool.cxx
index ca37f4a5fc8e7eb6643c2da40af972d2814b9f36..d53d3a8bb997ebc3d37fb2c39bb4971e4c8225b7 100644 (file)
@@ -376,7 +376,7 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
 
   anImageObj->SetName( anImageName );
   anImageObj->SetImage( myImage );
-  anImageObj->SetLocalPoints( aPointA, aPointB, aPointC );
+  anImageObj->SetLocalPoints( aPointA, aPointB, aPointC, false );
 
   if ( aTransformationMode == HYDROData_Image::ReferenceImage )
   {
index ff3959f267518b6b619f3cc291fb039f2afd1913..ff04b7d02c53225a87bf17907dcd4ffa36077349 100644 (file)
@@ -199,7 +199,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 
   bool anIsImage = false;
   bool anIsImportedImage = false;
-  bool anIsCompositeImage = false;
+  bool anIsImageHasRefs = false;
   bool anIsFusedImage = false;
   bool anIsCutImage = false;
   bool anIsSplittedImage = false;
@@ -229,7 +229,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         if( !anImage.IsNull() )
         {
           anIsImportedImage = anImage->HasLocalPoints() && !anImage->IsSelfSplitted();
-          anIsCompositeImage = anImage->NbReferences() > 0;
+          anIsImageHasRefs = anImage->HasReferences();
           if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() )
           {
             if( ImageComposer_Operator* anOperator = aFactory->Operator( anImage ) )
@@ -300,7 +300,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     {
       if( anIsImportedImage )
         theMenu->addAction( action( EditImportedImageId ) );
-      else if( anIsCompositeImage )
+      else if( anIsImageHasRefs )
       {
         if( anIsFusedImage )
           theMenu->addAction( action( EditFusedImageId ) );
@@ -314,6 +314,12 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       theMenu->addAction( action( ExportImageId ) );
       theMenu->addSeparator();
 
+      if( anIsImageHasRefs )
+      {
+        theMenu->addAction( action( RemoveImageRefsId ) );
+        theMenu->addSeparator();
+      }
+
       theMenu->addAction( action( FuseImagesId ) );
       theMenu->addAction( action( CutImagesId ) );
       theMenu->addAction( action( SplitImageId ) );
index 1b9fe49936eb259ab153ceeb22fda4ad61104475..08aa0d8fb8f6664d577d65c784dac5517cbf6bf6 100644 (file)
 #include "HYDROGUI_Operations.h"
 
 #include "HYDROGUI_CopyPasteOp.h"
+#include "HYDROGUI_CalculationOp.h"
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_DeleteOp.h"
 #include "HYDROGUI_ExportImageOp.h"
 #include "HYDROGUI_ImportImageOp.h"
 #include "HYDROGUI_ImportBathymetryOp.h"
-#include "HYDROGUI_CalculationOp.h"
+#include "HYDROGUI_ImmersibleZoneOp.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_ObserveImageOp.h"
 #include "HYDROGUI_PolylineOp.h"
+#include "HYDROGUI_RemoveImageRefsOp.h"
 #include "HYDROGUI_ShowHideOp.h"
 #include "HYDROData_SplitToZonesTool.h"
 #include "HYDROGUI_TwoImagesOp.h"
 #include "HYDROGUI_UpdateFlags.h"
 #include "HYDROGUI_UpdateImageOp.h"
 #include "HYDROGUI_VisualStateOp.h"
-#include "HYDROGUI_ImmersibleZoneOp.h"
 
 #include <CAM_Application.h>
 
@@ -82,6 +83,7 @@ void HYDROGUI_Module::createActions()
   createAction( ObserveImageId, "OBSERVE_IMAGE" );
   createAction( ExportImageId, "EXPORT_IMAGE" );
   createAction( UpdateImageId, "UPDATE_IMAGE" );
+  createAction( RemoveImageRefsId, "REMOVE_IMAGE_REFERENCE" );
 
   createAction( CreatePolylineId, "CREATE_POLYLINE" );
   createAction( EditPolylineId, "EDIT_POLYLINE" ); 
@@ -270,6 +272,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case UpdateImageId:
     anOp = new HYDROGUI_UpdateImageOp( aModule );
     break;
+  case RemoveImageRefsId:
+    anOp = new HYDROGUI_RemoveImageRefsOp( aModule );
+    break;
   case CreatePolylineId:
   case EditPolylineId:
     anOp = new HYDROGUI_PolylineOp( aModule, theId == EditPolylineId );
index 959286e8400b7c2438ecb8064af7a6f0edb1a8e4..1baabb87553af8bfed35ad3c25bee03b98fff98a 100644 (file)
@@ -41,6 +41,7 @@ enum OperationId
   ObserveImageId,
   ExportImageId,
   UpdateImageId,
+  RemoveImageRefsId,
 
   CreatePolylineId,
   EditPolylineId,
diff --git a/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx b/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx
new file mode 100644 (file)
index 0000000..d4ae69b
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_RemoveImageRefsOp.h"
+
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Document.h>
+#include <HYDROData_Image.h>
+
+HYDROGUI_RemoveImageRefsOp::HYDROGUI_RemoveImageRefsOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+  setName( tr( "REMOVE_IMAGE_REFERENCE" ) );
+}
+
+HYDROGUI_RemoveImageRefsOp::~HYDROGUI_RemoveImageRefsOp()
+{
+}
+
+void HYDROGUI_RemoveImageRefsOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+
+  startDocOperation();
+
+  HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
+  for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
+  {
+    Handle(HYDROData_Image) anImage =
+      Handle(HYDROData_Image)::DownCast( aSeq.Value( anIndex ) );
+    if ( !anImage.IsNull() )
+      anImage->RemoveAllReferences();
+  }
+
+  commitDocOperation();
+
+  module()->update( UF_Model | UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced );
+  commit();
+}
diff --git a/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.h b/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.h
new file mode 100644 (file)
index 0000000..00b2d6a
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_RemoveImageRefsOp_H
+#define HYDROGUI_RemoveImageRefsOp_H
+
+#include "HYDROGUI_Operation.h"
+
+class HYDROGUI_RemoveImageRefsOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_RemoveImageRefsOp( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_RemoveImageRefsOp();
+
+protected:
+  virtual void               startOperation();
+};
+
+#endif
index 85ec0921480edf7255710eaa50caff7eefae6a82..6389a4b18fb1129ef4d11a46413357f16bb2a546 100644 (file)
@@ -427,6 +427,10 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <source>DSK_REDO</source>
       <translation>Redo</translation>
     </message>
+    <message>
+      <source>DSK_REMOVE_IMAGE_REFERENCE</source>
+      <translation>Remove reference</translation>
+    </message>
     <message>
       <source>DSK_SAVE_VISUAL_STATE</source>
       <translation>Save visual state</translation>
@@ -551,6 +555,10 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <source>MEN_REDO</source>
       <translation>Redo</translation>
     </message>
+    <message>
+      <source>MEN_REMOVE_IMAGE_REFERENCE</source>
+      <translation>Remove reference</translation>
+    </message>
     <message>
       <source>MEN_SAVE_VISUAL_STATE</source>
       <translation>Save visual state</translation>
@@ -671,6 +679,10 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <source>STB_REDO</source>
       <translation>Redo</translation>
     </message>
+    <message>
+      <source>STB_REMOVE_IMAGE_REFERENCE</source>
+      <translation>Remove reference</translation>
+    </message>
     <message>
       <source>STB_SAVE_VISUAL_STATE</source>
       <translation>Save visual state</translation>
@@ -700,7 +712,27 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <translation>Update image</translation>
     </message>
   </context>
-  
+
+  <context>
+    <name>HYDROGUI_ObserveImageOp</name>
+    <message>
+      <source>OBSERVE_IMAGE</source>
+      <translation>Observe image</translation>
+    </message>
+  </context>
+
+  <context>
+    <name>HYDROGUI_PolylineDlg</name>
+    <message>
+      <source>ADD_ELEMENT</source>
+      <translation>Add element</translation>
+    </message>
+    <message>
+      <source>CURVE_NAME_TLT</source>
+      <translation>Name</translation>
+    </message>
+  </context>
+
   <context>
     <name>HYDROGUI_PolylineOp</name>
     <message>
@@ -712,7 +744,15 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <translation>Edit polyline</translation>
     </message>
   </context>
-  
+
+  <context>
+    <name>HYDROGUI_RemoveImageRefsOp</name>
+    <message>
+      <source>REMOVE_IMAGE_REFERENCE</source>
+      <translation>Remove image reference</translation>
+    </message>
+  </context>
+
   <context>
     <name>HYDROGUI_ShowHideOp</name>
     <message>
@@ -737,26 +777,6 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
     </message>
   </context>
   
-  <context>
-    <name>HYDROGUI_ObserveImageOp</name>
-    <message>
-      <source>OBSERVE_IMAGE</source>
-      <translation>Observe image</translation>
-    </message>
-  </context>
-  
-  <context>
-    <name>HYDROGUI_PolylineDlg</name>
-    <message>
-      <source>ADD_ELEMENT</source>
-      <translation>Add element</translation>
-    </message>
-    <message>
-      <source>CURVE_NAME_TLT</source>
-      <translation>Name</translation>
-    </message>
-  </context>
-  
   <context>
     <name>HYDROGUI_TwoImagesDlg</name>
     <message>