Salome HOME
quick optimization patch (bytearray for images)
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_BathymetryPrs.cxx
index 3eef5d64c6f5e99a0e19b3c2d4b2583c91cb646e..bf7f53b367e5804a7c5b8e309f08fd118030f711 100644 (file)
 
 const int BATH_HIGHLIGHT_MODE = 10;
 
-HYDROGUI_BathymetryPrs::HYDROGUI_BathymetryPrs()
+HYDROGUI_BathymetryPrs::HYDROGUI_BathymetryPrs( const HYDROGUI_ShapeBathymetry* theShape )
+  : myShape( theShape )
 {
   SetHilightMode( BATH_HIGHLIGHT_MODE );
-  SetAutoHilight( Standard_False );
+  SetAutoHilight( Standard_True );
 }
 
 HYDROGUI_BathymetryPrs::~HYDROGUI_BathymetryPrs()
 {
 }
 
+HYDROGUI_ShapeBathymetry* HYDROGUI_BathymetryPrs::GetShape() const
+{
+  return const_cast<HYDROGUI_ShapeBathymetry*>( myShape );
+}
+
 void HYDROGUI_BathymetryPrs::UpdateBound()
 {
   Handle(Graphic3d_ArrayOfPoints) points = GetPoints();
@@ -77,6 +83,7 @@ void HYDROGUI_BathymetryPrs::Compute( const Handle(PrsMgr_PresentationManager3d)
     if( myBound.IsVoid() )
       UpdateBound();
 
+
     if( myBound.IsVoid() || 
         myBound.IsOpenXmin() || myBound.IsOpenXmax() ||
         myBound.IsOpenYmin() || myBound.IsOpenYmax() ||
@@ -189,6 +196,8 @@ void HYDROGUI_BathymetryPrs::AddPoint( const Handle(Graphic3d_ArrayOfPoints)& th
                                        const Handle(SelectMgr_EntityOwner)& theOwner )
 {
   Handle(HYDROGUI_BathymetryPointOwner) anOwner = Handle(HYDROGUI_BathymetryPointOwner)::DownCast( theOwner );
+  if( anOwner.IsNull() )
+    return;
   gp_Pnt p = GetPoint( anOwner->GetIndex() );
   thePoints->AddVertex( p );
 }