]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1330: debug of bathymetry showing with patch for polylines
authorasl <asl@opencascade.com>
Wed, 11 Oct 2017 07:29:35 +0000 (10:29 +0300)
committerasl <asl@opencascade.com>
Wed, 11 Oct 2017 07:30:28 +0000 (10:30 +0300)
src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx

index c88b86388af285646281c60dea2b48b1b05c7293..f211ae56480fbbd0e4e27861ffc0750604c24af5 100644 (file)
@@ -94,7 +94,7 @@ QList<Handle(AIS_InteractiveObject)> 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();
 }