Commit 61da08f3 authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Added angle view based LOD; testing it

Change-Id: I3f160a086adcad6aaec471ecaccdd9a4c3f34e81
parent 94a96fb5
......@@ -39,7 +39,7 @@ polaxes.SetMaximumRadius( 4.5 )
polaxes.SetMinimumAngle( 45. )
polaxes.SetMaximumAngle( 270. )
polaxes.SetNumberOfRadialAxes( 10 )
polaxes.SetNumberOfPolarAxisTicks( 12 )
polaxes.SetNumberOfPolarAxisTicks( 9 )
polaxes.SetAutoSubdividePolarAxis( 0 )
polaxes.SetCamera( camera )
polaxes.SetPolarLabelFormat( "%6.1f" )
......@@ -48,6 +48,8 @@ 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.SetDistanceLODThreshold( .4 )
polaxes.SetViewAngleLODThreshold( .2 )
polaxes.SetScreenSize( 8. )
# Create renderer
......
......@@ -92,14 +92,14 @@ int TestPolarAxes( int argc, char * argv [] )
polaxes->GetPolarAxisProperty()->SetColor( .2, .2, .2 );
polaxes->GetPolarAxisTitleTextProperty()->SetColor( .2, .2, .2 );
polaxes->GetPolarAxisLabelTextProperty()->SetColor( .2, .2, .2 );
polaxes->SetNumberOfPolarAxisTicks( 11 );
polaxes->SetNumberOfPolarAxisTicks( 9 );
polaxes->SetAutoSubdividePolarAxis( false );
polaxes->SetScreenSize( 9.0 );
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples( 0 );
renWin->AddRenderer( renderer.GetPointer() );
renWin->SetWindowName( "VTK - Polar Axes custom range" );
renWin->SetWindowName( "VTK - Polar Axes" );
renWin->SetSize( 600, 600 );
vtkNew<vtkRenderWindowInteractor> iren;
......
......@@ -85,6 +85,10 @@ void vtkPolarAxesActor::PrintSelf( ostream& os, vtkIndent indent )
<< ( this->EnableDistanceLOD ? "On" : "Off" ) << endl;
os << indent << "DistanceLODThreshold: (" << this->DistanceLODThreshold << ")\n";
os << indent << "EnableViewAngleLOD: "
<< ( this->EnableViewAngleLOD ? "On" : "Off" ) << endl;
os << indent << "ViewAngleLODThreshold: (" << this->ViewAngleLODThreshold << ")\n";
os << indent << "Polar Axis Title: " << this->PolarAxisTitle << "\n";
os << indent << "Polar Label Format: " << this->PolarLabelFormat << "\n";
os << indent << "PolarAxisLabelTextProperty: " << this->PolarAxisLabelTextProperty << endl;
......@@ -177,12 +181,18 @@ vtkPolarAxesActor::vtkPolarAxesActor() : vtkActor()
this->EnableDistanceLOD = 1;
this->DistanceLODThreshold = .7;
// By default enable view angle based LOD
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( .8 * this->DistanceLODThreshold );
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();
......@@ -205,6 +215,8 @@ vtkPolarAxesActor::vtkPolarAxesActor() : vtkActor()
axis->GetTitleActor()->SetScreenOffset( .67 * offset );
axis->GetTitleActor()->SetEnableDistanceLOD( this->EnableDistanceLOD );
axis->GetTitleActor()->SetDistanceLODThreshold( this->DistanceLODThreshold );
axis->GetTitleActor()->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
axis->GetTitleActor()->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
} // for ( int i = 0; i < VTK_MAXIMUM_NUMBER_OF_RADIAL_AXES; ++ i )
// Create and set polar arcs and ancillary objects, with default color white
......@@ -735,7 +747,9 @@ void vtkPolarAxesActor::BuildPolarAxisLabelsArcs( double* O )
labelActors[i]->SetAxis( axis );
labelActors[i]->SetScreenOffset( this->LabelScreenOffset );
labelActors[i]->SetEnableDistanceLOD( this->EnableDistanceLOD );
labelActors[i]->SetDistanceLODThreshold( .9 * this->DistanceLODThreshold );
labelActors[i]->SetDistanceLODThreshold( this->DistanceLODThreshold );
labelActors[i]->SetEnableViewAngleLOD( this->EnableViewAngleLOD );
labelActors[i]->SetViewAngleLODThreshold( this->ViewAngleLODThreshold );
}
}
......
......@@ -136,7 +136,7 @@ public:
vtkGetStringMacro( PolarAxisTitle );
// Description:
// Set/Get the format with which to print the polar axis labels
// Set/Get the format with which to print the polar axis labels.
vtkSetStringMacro( PolarLabelFormat );
vtkGetStringMacro( PolarLabelFormat );
......@@ -156,6 +156,16 @@ public:
vtkSetClampMacro( DistanceLODThreshold, double, 0.0, 1.0 );
vtkGetMacro( DistanceLODThreshold, double);
// Description:
// Enable and disable the use of view angle based LOD for titles and labels.
vtkSetMacro( EnableViewAngleLOD, int );
vtkGetMacro( EnableViewAngleLOD, int );
// Description:
// Set view angle LOD threshold [0.0 - 1.0] for titles and labels.
vtkSetClampMacro( ViewAngleLODThreshold, double, 0., 1. );
vtkGetMacro( ViewAngleLODThreshold, double );
// Description:
// Turn on and off the visibility of the polar axis.
vtkSetMacro( PolarAxisVisibility, int );
......@@ -341,6 +351,16 @@ protected:
// This determines at what fraction of camera far clip range, actor is not visible.
double DistanceLODThreshold;
// Description:
// If enabled the actor will not be visible at a certain view angle.
// Default is true.
int EnableViewAngleLOD;
// Description:
// This determines at what view angle to geometry will make the geometry not visibile.
// Default is 0.3.
double ViewAngleLODThreshold;
// Description:
// Visibility of polar axis and its title, labels, ticks (major only)
int PolarAxisVisibility;
......
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