From 7ee09310d48dd0d2ad23bf1a62588ca3af601d63 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 27 May 2015 09:28:04 +0300 Subject: [PATCH] refs #555: now the error message appears if the guide line or profile are not selected --- src/HYDROGUI/HYDROGUI_ChannelOp.cxx | 18 ++++++++++++++++-- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 9 ++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_ChannelOp.cxx b/src/HYDROGUI/HYDROGUI_ChannelOp.cxx index d3acb739..f00d5804 100644 --- a/src/HYDROGUI/HYDROGUI_ChannelOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ChannelOp.cxx @@ -181,19 +181,33 @@ bool HYDROGUI_ChannelOp::processApply( int& theUpdateFlags, QString aGuideLineName = aPanel->getGuideLineName(); QString aProfileName = aPanel->getProfileName(); - if ( aGuideLineName.isEmpty() || aProfileName.isEmpty() ) + /*if ( aGuideLineName.isEmpty() || aProfileName.isEmpty() ) { myEditedObject->RemoveGuideLine(); myEditedObject->RemoveProfile(); } - else + else*/ { Handle(HYDROData_Polyline3D) aGuideLine = Handle(HYDROData_Polyline3D)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), aGuideLineName, KIND_POLYLINE ) ); + if ( aGuideLine.IsNull() ) + { + theErrorMsg = tr( "GUIDE_LINE_IS_NOT_SELECTED" ); + return false; + } + + myEditedObject->RemoveGuideLine(); myEditedObject->SetGuideLine( aGuideLine ); Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) ); + if ( aProfile.IsNull() ) + { + theErrorMsg = tr( "PROFILE_IS_NOT_SELECTED" ); + return false; + } + + myEditedObject->RemoveProfile(); myEditedObject->SetProfile( aProfile ); } diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index f8b42f0f..807e8d70 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -2170,8 +2170,15 @@ Polyline should consist from one not closed curve. DEFAULT_CHANNEL_NAME Channel + + GUIDE_LINE_IS_NOT_SELECTED + Guide line is not chosen + + + PROFILE_IS_NOT_SELECTED + Profile is not chosen + - HYDROGUI_DigueDlg -- 2.39.2