From: mzn Date: Thu, 21 Nov 2013 10:40:43 +0000 (+0000) Subject: Bug #119: create obstacles from several objects in GEOM is wrong. X-Git-Tag: BR_hydro_v_0_3_1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ecb167067ddfbaf01ceedb62f754e6ca7d2f7131;p=modules%2Fhydro.git Bug #119: create obstacles from several objects in GEOM is wrong. --- diff --git a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx index 6f771664..4ba06589 100644 --- a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx @@ -122,31 +122,33 @@ bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags, QString anObstacleName; Handle(HYDROData_Obstacle) anObstacleToEdit; - // Get panel - HYDROGUI_ObstacleDlg* aPanel = ::qobject_cast( inputPanel() ); - if ( aPanel ) { - // Check obstacle name - anObstacleName = aPanel->getObstacleName().simplified(); - if ( anObstacleName.isEmpty() ) { - theErrorMsg = tr( "INCORRECT_OBJECT_NAME" ); - return false; - } + if ( myGeomObjects.count() == 1 ) { + // Get panel + HYDROGUI_ObstacleDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( aPanel ) { + // Check obstacle name + anObstacleName = aPanel->getObstacleName().simplified(); + if ( anObstacleName.isEmpty() ) { + theErrorMsg = tr( "INCORRECT_OBJECT_NAME" ); + return false; + } - // Get obstacle to edit - QString anEditedName = aPanel->getEditedObstacleName().simplified(); + // Get obstacle to edit + QString anEditedName = aPanel->getEditedObstacleName().simplified(); - if ( !anEditedName.isEmpty() ) { - anObstacleToEdit = Handle(HYDROData_Obstacle)::DownCast( - HYDROGUI_Tool::FindObjectByName( module(), anEditedName, KIND_OBSTACLE ) ); + if ( !anEditedName.isEmpty() ) { + anObstacleToEdit = Handle(HYDROData_Obstacle)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), anEditedName, KIND_OBSTACLE ) ); + } } - } - if( anObstacleToEdit.IsNull() || anObstacleToEdit->GetName() != anObstacleName ) { - // check that there are no other objects with the same name in the document - Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObstacleName ); - if( !anObject.IsNull() ) { - theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObstacleName ); - return false; + if( anObstacleToEdit.IsNull() || anObstacleToEdit->GetName() != anObstacleName ) { + // check that there are no other objects with the same name in the document + Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObstacleName ); + if( !anObject.IsNull() ) { + theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObstacleName ); + return false; + } } } @@ -179,6 +181,8 @@ bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags, anObstacle->SetName( anObstacleName ); } + anObstacleName.clear(); + // Set shape anObstacle->SetShape3D( aShape );