HYDROGUI_ShapeBathymetry::~HYDROGUI_ShapeBathymetry()
{
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( true );
}
void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivateSelection )
Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
- if ( !aBath.IsNull() )
+ if ( !aBath.IsNull() && !aBath->GetAltitudePoints().empty())
{
buildShape();
updateShape( false, false );
}
-Handle(AIS_InteractiveObject) HYDROGUI_ShapeBathymetry::createShape() const
+QList<Handle(AIS_InteractiveObject)> HYDROGUI_ShapeBathymetry::createShape() const
{
+ QList<Handle(AIS_InteractiveObject)> shapes;
+
Handle(AIS_InteractiveObject) aPntCloud;
Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() );
aPntCloud->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 2.0));
const HYDROData_Bathymetry::AltitudePoints& aBathPoints = aBath->GetAltitudePoints();
- int aLower = aBathPoints.Lower();
- int anUpper = aBathPoints.Upper();
+ int aLower = 0;
+ int anUpper = (int)aBathPoints.size()-1;
HYDROGUI_ShapeBathymetry* aThat = const_cast<HYDROGUI_ShapeBathymetry*>( this );
aThat->myCoords = new TColgp_HArray1OfPnt( aLower, anUpper );
aThat->myColors = new Quantity_HArray1OfColor( aLower, anUpper );
for( int i=aLower; i<=anUpper; i++ )
- aThat->myCoords->SetValue( i, aBathPoints.Value( i ) );
+ aThat->myCoords->SetValue( i, gp_Pnt( aBathPoints[i].X, aBathPoints[i].Y, aBathPoints[i].Z ) );
+
+ shapes.append( aPntCloud );
}
- return aPntCloud;
+ return shapes;
}
void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const
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();
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( getAISObjects()[0] );
aPntCloud->SetPoints( myCoords, myColors );
getContext()->Redisplay( aPntCloud, Standard_False );
}
void HYDROGUI_ShapeBathymetry::setVisible( const bool theState,
const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( isShown != theState );
HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
- if( isChanged )
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( isChanged );
}
void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( !isShown );
HYDROGUI_Shape::displayShape( theIsUpdateViewer );
- if( isChanged )
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( isChanged );
}
void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( !isShown );
HYDROGUI_Shape::display( theIsUpdateViewer );
- if( isChanged )
- myDisplayer->SetToUpdateColorScale();
+ setToUpdateColorScale( isChanged );
}
void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( isShown );
HYDROGUI_Shape::erase( theIsUpdateViewer );
- if( isChanged )
+ setToUpdateColorScale( isChanged );
+}
+
+void HYDROGUI_ShapeBathymetry::setToUpdateColorScale( bool isChanged )
+{
+#ifndef LIGHT_MODE
+ if( isChanged && myDisplayer )
myDisplayer->SetToUpdateColorScale();
+#endif
}