Commit 5efba7f7 authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Isolated building of radial axes from main build routine for perf.

Change-Id: Iac165ea5ddf3608a5b2afe91dbb6f3f5ccc4235e
parent ef1ce280
......@@ -73,4 +73,5 @@ interactor.SetRenderWindow( window )
# Start interaction
window.Render()
interactor.Start()
......@@ -411,11 +411,11 @@ void vtkPolarAxesActor::SetScreenSize( double screenSize )
void vtkPolarAxesActor::ReleaseGraphicsResources( vtkWindow *win )
{
this->PolarAxis->ReleaseGraphicsResources(win);
for ( int i = 0; i < this->NumberOfRadialAxes; ++i )
for ( int i = 0; i < this->NumberOfRadialAxes; ++ i )
{
this->RadialAxes[i]->ReleaseGraphicsResources( win );
}
this->PolarArcsActor->ReleaseGraphicsResources(win);
this->PolarArcsActor->ReleaseGraphicsResources( win );
}
//-----------------------------------------------------------------------------
......@@ -617,6 +617,60 @@ void vtkPolarAxesActor::BuildAxes( vtkViewport *viewport )
axis->SetLabelVisibility( this->PolarLabelVisibility );
axis->SetLabelTextProperty( this->PolarAxisLabelTextProperty );
// Build radial axes
this->BuildRadialAxes();
// Build polar axis ticks
this->BuildPolarAxisTicks( this->Pole[0] );
// Build polar axis labels
this->BuildPolarAxisLabelsArcs();
// Scale appropriately
this->AutoScale( viewport );
this->RenderSomething = 1;
this->BuildTime.Modified();
}
//-----------------------------------------------------------------------------
void vtkPolarAxesActor::SetCommonAxisAttributes( vtkAxisActor* axis )
{
vtkProperty *prop = this->GetProperty();
prop->SetAmbient( 1.0 );
prop->SetDiffuse( 0.0 );
axis->SetProperty( prop );
// Common space and range attributes
axis->SetCamera( this->Camera );
axis->SetBounds( this->Bounds );
axis->SetRange( 0., this->MaximumRadius );
// No minor ticks for any kind of axes
axis->SetMinorTicksVisible( 0 );
}
//-----------------------------------------------------------------------------
inline double vtkPolarAxesActor::FFix( double value )
{
int ivalue = static_cast<int>( value );
return ivalue;
}
//-----------------------------------------------------------------------------
inline double vtkPolarAxesActor::FSign( double value, double sign )
{
value = fabs( value );
if ( sign < 0.)
{
value *= -1.;
}
return value;
}
//-----------------------------------------------------------------------------
void vtkPolarAxesActor::BuildRadialAxes()
{
// Create requested number of radial axes
double dAlpha =
( this->MaximumAngle - this->MinimumAngle ) / ( this->NumberOfRadialAxes - 1. );
......@@ -629,7 +683,7 @@ void vtkPolarAxesActor::BuildAxes( vtkViewport *viewport )
double y = this->Pole[1] + this->MaximumRadius * sin( alphaRad );
// Set radial axis endpoints
axis = this->RadialAxes[i];
vtkAxisActor* axis = this->RadialAxes[i];
axis->GetPoint1Coordinate()->SetValue( this->Pole[0], this->Pole[1], this->Pole[2] );
axis->GetPoint2Coordinate()->SetValue( x, y, this->Pole[2] );
......@@ -667,53 +721,6 @@ void vtkPolarAxesActor::BuildAxes( vtkViewport *viewport )
axis->SetLabelVisibility( 0 );
axis->SetTickVisibility( 0 );
}
// Build polar axis ticks
this->BuildPolarAxisTicks( this->Pole[0] );
// Build polar axis labels
this->BuildPolarAxisLabelsArcs();
// Scale appropriately
this->AutoScale( viewport );
this->RenderSomething = 1;
this->BuildTime.Modified();
}
//-----------------------------------------------------------------------------
void vtkPolarAxesActor::SetCommonAxisAttributes( vtkAxisActor* axis )
{
vtkProperty *prop = this->GetProperty();
prop->SetAmbient( 1.0 );
prop->SetDiffuse( 0.0 );
axis->SetProperty( prop );
// Common space and range attributes
axis->SetCamera( this->Camera );
axis->SetBounds( this->Bounds );
axis->SetRange( 0., this->MaximumRadius );
// No minor ticks for any kind of axes
axis->SetMinorTicksVisible( 0 );
}
//-----------------------------------------------------------------------------
inline double vtkPolarAxesActor::FFix( double value )
{
int ivalue = static_cast<int>( value );
return ivalue;
}
//-----------------------------------------------------------------------------
inline double vtkPolarAxesActor::FSign( double value, double sign )
{
value = fabs( value );
if ( sign < 0.)
{
value *= -1.;
}
return value;
}
//-----------------------------------------------------------------------------
......
......@@ -254,23 +254,27 @@ protected:
// Description:
// Build the axes.
// Determine coordinates, position, etc.
void BuildAxes( vtkViewport * );
void BuildAxes( vtkViewport * );
// Description:
// Calculate bounds based on maximum radius and angular sector
void CalculateBounds();
void CalculateBounds();
// Description:
// Send attributes which are common to all axes, both polar and radial
void SetCommonAxisAttributes( vtkAxisActor* );
void SetCommonAxisAttributes( vtkAxisActor* );
// Description:
// Build requested number of radial axes with respect to specified pole.
void BuildRadialAxes();
// Description:
// Prepare ticks on polar axis with respect to coordinate offset
void BuildPolarAxisTicks( double );
void BuildPolarAxisTicks( double );
// Description:
// Build polar axis labels and arcs with respect to specified pole.
void BuildPolarAxisLabelsArcs();
void BuildPolarAxisLabelsArcs();
// Description:
// Convenience methods
......
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