X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ShapeBathymetry.cxx;h=a88b5069923989e42e06f4bcf2ef403b7ef4b692;hb=58bb6b7459bebeeb089c9ed486c4683a8bae7288;hp=0575b94616ac63c8dddbc34f0afc00aa8a3d9680;hpb=24fb5adcac723810ac120abf37ad191a092cbefe;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index 0575b946..a88b5069 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -22,12 +22,12 @@ #include #include -#include +#include #include HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer, const Handle(AIS_InteractiveContext)& theContext, - const Handle_HYDROData_Bathymetry& theBathymetry, + const Handle(HYDROData_Bathymetry)& theBathymetry, const int theZLayer ) : HYDROGUI_Shape( theContext, theBathymetry, theZLayer ), myDisplayer( theDisplayer ) @@ -48,7 +48,7 @@ void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivate Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() ); - if ( !aBath.IsNull() ) + if ( !aBath.IsNull() && !aBath->GetAltitudePoints().empty()) { buildShape(); updateShape( false, false ); @@ -58,12 +58,14 @@ void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivate } -Handle_AIS_InteractiveObject HYDROGUI_ShapeBathymetry::createShape() const +Handle(AIS_InteractiveObject) HYDROGUI_ShapeBathymetry::createShape() const { - Handle_HYDROData_Bathymetry aBath = Handle_HYDROData_Bathymetry::DownCast( getObject() ); + Handle(AIS_InteractiveObject) aPntCloud; + + Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() ); if( !aBath.IsNull() ) { - Handle_AIS_PointCloud aPntCloud = new HYDROGUI_BathymetryPrs(); + aPntCloud = new HYDROGUI_BathymetryPrs(); aPntCloud->SetHilightMode( AIS_PointCloud::DM_BndBox ); aPntCloud->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 2.0)); @@ -76,11 +78,9 @@ Handle_AIS_InteractiveObject HYDROGUI_ShapeBathymetry::createShape() const aThat->myColors = new Quantity_HArray1OfColor( aLower, anUpper ); for( int i=aLower; i<=anUpper; i++ ) aThat->myCoords->SetValue( i, gp_Pnt( aBathPoints[i].X, aBathPoints[i].Y, aBathPoints[i].Z ) ); - - return aPntCloud; } - else - return Handle_AIS_InteractiveObject(); + + return aPntCloud; } void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const @@ -102,8 +102,10 @@ void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const } } -void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(Aspect_ColorScale)& theColorScale ) +void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale)& theColorScale ) { + if (!myCoords) + return; for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ ) { double z = myCoords->Value( i ).Z(); @@ -111,7 +113,7 @@ void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(Aspect_ColorSc theColorScale->FindColor( z, aColor ); myColors->SetValue( i, aColor ); } - Handle_AIS_PointCloud aPntCloud = Handle_AIS_PointCloud::DownCast( getAISObject() ); + Handle(AIS_PointCloud) aPntCloud = Handle(AIS_PointCloud)::DownCast( getAISObject() ); aPntCloud->SetPoints( myCoords, myColors ); getContext()->Redisplay( aPntCloud, Standard_False ); }