HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection );
}
-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() );
if( !aBath.IsNull() )
{
- aPntCloud = new HYDROGUI_BathymetryPrs();
- aPntCloud->SetHilightMode( AIS_PointCloud::DM_BndBox );
+ aPntCloud = new HYDROGUI_BathymetryPrs( this );
+ //aPntCloud->SetHilightMode( AIS_PointCloud::DM_BndBox );
aPntCloud->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 2.0));
const HYDROData_Bathymetry::AltitudePoints& aBathPoints = aBath->GetAltitudePoints();
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 ) );
+
+ shapes.append( aPntCloud );
}
- return aPntCloud;
+ return shapes;
}
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++ )
theColorScale->FindColor( z, aColor );
myColors->SetValue( i, aColor );
}
- Handle(AIS_PointCloud) aPntCloud = Handle(AIS_PointCloud)::DownCast( getAISObject() );
+ Handle(HYDROGUI_BathymetryPrs) aPntCloud = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObjects()[0] );
aPntCloud->SetPoints( myCoords, myColors );
getContext()->RecomputePrsOnly( aPntCloud, Standard_True );
+ getContext()->RecomputeSelectionOnly( aPntCloud );
}
void HYDROGUI_ShapeBathymetry::setVisible( const bool theState,
const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ if( getAISObjects().isEmpty() )
+ return;
+
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( isShown != theState );
HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer );
setToUpdateColorScale( isChanged );
void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ if( getAISObjects().isEmpty() )
+ return;
+
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( !isShown );
HYDROGUI_Shape::displayShape( theIsUpdateViewer );
setToUpdateColorScale( isChanged );
void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ if( getAISObjects().isEmpty() )
+ return;
+
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( !isShown );
HYDROGUI_Shape::display( theIsUpdateViewer );
setToUpdateColorScale( isChanged );
void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer )
{
- bool isShown = getContext()->IsDisplayed( getAISObject() );
+ if( getAISObjects().isEmpty() )
+ return;
+
+ bool isShown = getContext()->IsDisplayed( getAISObjects()[0] );
bool isChanged = ( isShown );
HYDROGUI_Shape::erase( theIsUpdateViewer );
setToUpdateColorScale( isChanged );
getContext()->ClearSelected();
myMin = qMin( theMin, theMax );
myMax = qMax( theMin, theMax );
- getAISObject()->Redisplay();
+ setToUpdateColorScale( true );
+
+ if( !getAISObjects().isEmpty() )
+ getAISObjects()[0]->Redisplay();
}
void HYDROGUI_ShapeBathymetry::RescaleDefault()
void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn )
{
- Handle(HYDROGUI_BathymetryPrs) prs = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObject() );
+ if( getAISObjects().isEmpty() )
+ return;
+
+ Handle(HYDROGUI_BathymetryPrs) prs = Handle(HYDROGUI_BathymetryPrs)::DownCast( getAISObjects()[0] );
if( prs.IsNull() )
return;
- QList<int> selection = selected();
+ QList<int> selection;
+ if( isOn )
+ selection = selected();
+
getContext()->ClearSelected();
prs->SetTextLabels( selection );
- getAISObject()->Redisplay();
+ prs->Redisplay();
}