From 8a7c7e5abd642e3ccf6f315eb1d745884a39d5c3 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 6 Dec 2013 12:02:04 +0000 Subject: [PATCH] Rename of bathymetry object corrected (Bug #165). --- src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx index ea5eb1e1..458e2e80 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx @@ -121,12 +121,15 @@ bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags, return false; } - // check that there are no other objects with the same name in the document - Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName ); - if ( ( !myIsEdit ) && ( !anObject.IsNull() ) ) + if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) ) { - theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName ); - return false; + // check that there are no other objects with the same name in the document + Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName ); + if( !anObject.IsNull() ) + { + theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName ); + return false; + } } Handle(HYDROData_Bathymetry) aBathymetryObj; -- 2.39.2