From 682d4abf52a431b72c6573ca8dc3365bcd92d0c5 Mon Sep 17 00:00:00 2001 From: mzn Date: Mon, 2 Dec 2013 06:48:05 +0000 Subject: [PATCH] Erase and nullify the shape for invalid profile. --- src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx | 2 -- src/HYDROGUI/HYDROGUI_Shape.cxx | 22 +++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx index 53128386..269cd83e 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx @@ -67,10 +67,8 @@ void HYDROGUI_GeoreferencementOp::startOperation() aPanel->reset(); if ( myInitialMode == All ) { - //@MZN aPanel->setMode( anAllMode ); onModeActivated( HYDROGUI_GeoreferencementDlg::AllProfiles ); } else if ( myInitialMode == Selected ) { - //@MZN aPanel->setMode( aSelectionMode ); onModeActivated( HYDROGUI_GeoreferencementDlg::SelectedProfiles ); } diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index f37fe900..9e36f73d 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -291,22 +291,18 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( myObject ); + TopoDS_Wire aProfileWire; + if ( aProfile->IsValid() ) { TopoDS_Shape aProfileShape = aProfile->GetShape3D(); - if ( !aProfileShape.IsNull() ) { - if ( aProfileShape.ShapeType() == TopAbs_WIRE ) { - TopoDS_Wire aProfileWire = TopoDS::Wire( aProfileShape ); - setWire( aProfileWire, false, false ); - } else { - myTopoShape = aProfileShape; - myDisplayMode = AIS_WireFrame; - - buildShape(); - updateShape( false, false ); - } + if ( !aProfileShape.IsNull() && + aProfileShape.ShapeType() == TopAbs_WIRE ) { + aProfileWire = TopoDS::Wire( aProfileShape ); } } + + setWire( aProfileWire, false, false ); } } @@ -483,8 +479,10 @@ void HYDROGUI_Shape::buildShape() // Erase previously created shape erase(); - if ( myTopoShape.IsNull() ) + if ( myTopoShape.IsNull() ) { + myShape.Nullify(); return; + } QString aTextureFileName = getTextureFileName(); bool anIsTexture = !aTextureFileName.isEmpty(); -- 2.39.2