From 90314a195b4d4951ba61a7333cb0de16c253dea9 Mon Sep 17 00:00:00 2001 From: adv Date: Tue, 5 Nov 2013 10:44:20 +0000 Subject: [PATCH] Methods to work with imagw references: - Remove image references - Recalculate image position if reference image changed --- src/HYDROData/HYDROData_Entity.cxx | 2 +- src/HYDROData/HYDROData_Entity.h | 6 +- src/HYDROData/HYDROData_Image.cxx | 136 ++++++++++++++++---- src/HYDROData/HYDROData_Image.h | 29 ++++- src/HYDROData/HYDROData_Tool.cxx | 8 ++ src/HYDROGUI/CMakeLists.txt | 2 + src/HYDROGUI/HYDROGUI_ImportImageOp.cxx | 2 +- src/HYDROGUI/HYDROGUI_Module.cxx | 12 +- src/HYDROGUI/HYDROGUI_Operations.cxx | 9 +- src/HYDROGUI/HYDROGUI_Operations.h | 1 + src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx | 61 +++++++++ src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.h | 40 ++++++ src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 64 +++++---- 13 files changed, 306 insertions(+), 66 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.h diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index 27efc616..0aab7b14 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -51,7 +51,7 @@ QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjec return anEmptyList; } -void HYDROData_Entity::Update( const bool theIsForce ) +void HYDROData_Entity::Update() { } diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 84a82778..8f60960d 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -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. diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index ae6b0804..3ca786fc 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -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 ); diff --git a/src/HYDROData/HYDROData_Image.h b/src/HYDROData/HYDROData_Image.h index da110616..7fe84c93 100644 --- a/src/HYDROData/HYDROData_Image.h +++ b/src/HYDROData/HYDROData_Image.h @@ -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 diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index fda98c61..cd609037 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -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 = diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index dc39fbe2..0a832141 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -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 diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx index ca37f4a5..d53d3a8b 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx @@ -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 ) { diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index ff3959f2..ff04b7d0 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -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 ) ); diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index 1b9fe499..08aa0d8f 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -23,22 +23,23 @@ #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 @@ -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 ); diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index 959286e8..1baabb87 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -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 index 00000000..d4ae69bb --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx @@ -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 +#include + +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 index 00000000..00b2d6a3 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.h @@ -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 diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 85ec0921..6389a4b1 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -427,6 +427,10 @@ file cannot be correctly imported for a Bathymetry definition. DSK_REDO Redo + + DSK_REMOVE_IMAGE_REFERENCE + Remove reference + DSK_SAVE_VISUAL_STATE Save visual state @@ -551,6 +555,10 @@ file cannot be correctly imported for a Bathymetry definition. MEN_REDO Redo + + MEN_REMOVE_IMAGE_REFERENCE + Remove reference + MEN_SAVE_VISUAL_STATE Save visual state @@ -671,6 +679,10 @@ file cannot be correctly imported for a Bathymetry definition. STB_REDO Redo + + STB_REMOVE_IMAGE_REFERENCE + Remove reference + STB_SAVE_VISUAL_STATE Save visual state @@ -700,7 +712,27 @@ file cannot be correctly imported for a Bathymetry definition. Update image - + + + HYDROGUI_ObserveImageOp + + OBSERVE_IMAGE + Observe image + + + + + HYDROGUI_PolylineDlg + + ADD_ELEMENT + Add element + + + CURVE_NAME_TLT + Name + + + HYDROGUI_PolylineOp @@ -712,7 +744,15 @@ file cannot be correctly imported for a Bathymetry definition. Edit polyline - + + + HYDROGUI_RemoveImageRefsOp + + REMOVE_IMAGE_REFERENCE + Remove image reference + + + HYDROGUI_ShowHideOp @@ -737,26 +777,6 @@ file cannot be correctly imported for a Bathymetry definition. - - HYDROGUI_ObserveImageOp - - OBSERVE_IMAGE - Observe image - - - - - HYDROGUI_PolylineDlg - - ADD_ELEMENT - Add element - - - CURVE_NAME_TLT - Name - - - HYDROGUI_TwoImagesDlg -- 2.39.2