From: asl Date: Wed, 11 Oct 2017 07:29:35 +0000 (+0300) Subject: refs #1330: debug of bathymetry showing with patch for polylines X-Git-Tag: v2.1~66^2~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5b6e09c6bbc0fdcbd3dfc34c0d3a5775a4dc3aea;p=modules%2Fhydro.git refs #1330: debug of bathymetry showing with patch for polylines --- diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index c88b8638..f211ae56 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -94,7 +94,7 @@ QList HYDROGUI_ShapeBathymetry::createShape() con void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale)& theColorScale ) { - if (!myCoords) + if (!myCoords || getAISObjects().isEmpty()) return; for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ ) @@ -117,6 +117,9 @@ void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale void HYDROGUI_ShapeBathymetry::setVisible( const bool theState, const bool theIsUpdateViewer ) { + if( getAISObjects().isEmpty() ) + return; + bool isShown = getContext()->IsDisplayed( getAISObjects()[0] ); bool isChanged = ( isShown != theState ); HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer ); @@ -125,6 +128,9 @@ void HYDROGUI_ShapeBathymetry::setVisible( const bool theState, void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer ) { + if( getAISObjects().isEmpty() ) + return; + bool isShown = getContext()->IsDisplayed( getAISObjects()[0] ); bool isChanged = ( !isShown ); HYDROGUI_Shape::displayShape( theIsUpdateViewer ); @@ -133,6 +139,9 @@ void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer ) void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer ) { + if( getAISObjects().isEmpty() ) + return; + bool isShown = getContext()->IsDisplayed( getAISObjects()[0] ); bool isChanged = ( !isShown ); HYDROGUI_Shape::display( theIsUpdateViewer ); @@ -141,6 +150,9 @@ void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer ) void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer ) { + if( getAISObjects().isEmpty() ) + return; + bool isShown = getContext()->IsDisplayed( getAISObjects()[0] ); bool isChanged = ( isShown ); HYDROGUI_Shape::erase( theIsUpdateViewer ); @@ -233,7 +245,9 @@ void HYDROGUI_ShapeBathymetry::Rescale( double theMin, double theMax ) myMin = qMin( theMin, theMax ); myMax = qMax( theMin, theMax ); setToUpdateColorScale( true ); - getAISObjects()[0]->Redisplay(); + + if( !getAISObjects().isEmpty() ) + getAISObjects()[0]->Redisplay(); } void HYDROGUI_ShapeBathymetry::RescaleDefault() @@ -270,6 +284,9 @@ void HYDROGUI_ShapeBathymetry::Build() void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn ) { + if( getAISObjects().isEmpty() ) + return; + Handle(HYDROGUI_BathymetryPrs) prs = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObjects()[0] ); if( prs.IsNull() ) return; @@ -280,5 +297,5 @@ void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn ) getContext()->ClearSelected(); prs->SetTextLabels( selection ); - getAISObjects()[0]->Redisplay(); + prs->Redisplay(); }