Commit 08c1db7e authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Update polar axis title follower when needed

Change-Id: Ibbb179ded68ee927a803c9710420f5654aa79f1c
parent 94c638a1
......@@ -46,7 +46,7 @@ polaxes.SetMinimumAngle( -60. )
polaxes.SetMaximumAngle( 210. )
polaxes.SetNumberOfRadialAxes( 10 )
polaxes.AutoSubdividePolarAxisOff()
polaxes.SetNumberOfPolarAxisTicks( 8 )
polaxes.SetNumberOfPolarAxisTicks( 5 )
polaxes.SetCamera( renderer.GetActiveCamera() )
polaxes.SetPolarLabelFormat( "%6.1f" )
polaxes.GetRadialAxesProperty().SetColor( .0, .0, 1. )
......@@ -54,9 +54,9 @@ polaxes.GetPolarArcsProperty().SetColor( 1., .0, 0. )
polaxes.GetPolarAxisProperty().SetColor( 0., 1., 0. )
polaxes.GetPolarAxisTitleTextProperty().SetColor( 0., 1., 0. )
polaxes.GetPolarAxisLabelTextProperty().SetColor( 0., 1., 0. )
polaxes.SetEnableDistanceLOD( 0 )
polaxes.SetEnableDistanceLOD( 1 )
polaxes.SetDistanceLODThreshold( .4 )
polaxes.SetEnableViewAngleLOD( 0 )
polaxes.SetEnableViewAngleLOD( 1 )
polaxes.SetViewAngleLODThreshold( .2 )
polaxes.SetScreenSize( 8. )
......@@ -73,7 +73,9 @@ interactor.SetRenderWindow( window )
# Start interaction
window.Render()
polaxes.SetMinimumAngle( 60. )
polaxes.SetNumberOfPolarAxisTicks( 12 )
polaxes.SetMinimumAngle( 40. )
polaxes.SetMaximumAngle( 219.99999 )
polaxes.SetNumberOfRadialAxes( 10 )
polaxes.SetNumberOfPolarAxisTicks( 10 )
interactor.Start()
......@@ -178,31 +178,20 @@ vtkPolarAxesActor::vtkPolarAxesActor() : vtkActor()
this->PolarAxis->SetCalculateTitleOffset( 0 );
this->PolarAxis->SetCalculateLabelOffset( 0 );
// Base offset for followers
double offset = this->LabelScreenOffset + this->ScreenSize * 0.5;
// By default enable distance based LOD
// Default distance LOD settings
this->EnableDistanceLOD = 1;
this->DistanceLODThreshold = .7;
// By default enable view angle based LOD
// Default view angle LOD settings
this->EnableViewAngleLOD = 1;
this->ViewAngleLODThreshold = .3;
// Set polar axis title follower (label followers not built yet)
vtkAxisFollower* follower = this->PolarAxis->GetTitleActor();
follower->SetAxis( this->PolarAxis );
follower->SetScreenOffset( 2.0 * offset + 5 );
follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
follower->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
follower->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
// Properties of the radial axes, with default color black
this->RadialAxesProperty = vtkProperty::New();
this->RadialAxesProperty->SetColor( 0., 0., 0. );
// Create and set radial axes of type X
// Create and set radial axes of type X with base offset for followers
double offset = this->LabelScreenOffset + this->ScreenSize * 0.5;
this->CreateRadialAxes( offset );
// Create and set polar arcs and ancillary objects, with default color white
......@@ -711,6 +700,8 @@ void vtkPolarAxesActor::BuildRadialAxes()
title << alpha
<< ( this->RadialUnits ? " deg" : "" );
axis->SetTitle( title.str().c_str() );
// Update axis title follower
}
// No labels nor ticks for radial axes
......@@ -877,6 +868,15 @@ void vtkPolarAxesActor::BuildPolarAxisLabelsArcs()
// Clean up
labels->Delete();
// Update axis title follower
vtkAxisFollower* follower = axis->GetTitleActor();
follower->SetAxis( axis );
follower->SetScreenOffset( 2. * this->LabelScreenOffset + this->ScreenSize + 5 );
follower->SetEnableDistanceLOD( this->EnableDistanceLOD );
follower->SetDistanceLODThreshold( this->DistanceLODThreshold );
follower->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
follower->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
// Update axis label followers
vtkAxisFollower** labelActors = axis->GetLabelActors();
for( int i = 0; i < this->NumberOfPolarAxisTicks; ++ i )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment