Commit a992e228 authored by Philippe Pebay's avatar Philippe Pebay Committed by Kitware Robot
Browse files

Merge topic 'PolarAxesExplicitlyCalculateBounds'

8b50d474 Changed execution flow to allow subtle change in polar axis behavior
53d1549d Fixed a memory leak
d4aedeca Factorized radial axis creation (not build)
1fb5f574 A better, less memory-consuming handling of radial axes
5efba7f7 Isolated building of radial axes from main build routine for perf.
ef1ce280 Make sure that bounds are always recalculated when needed
f00d05b6 Make sure that bounds are recalculated when pole is modified
a0d9dbb5 Implemented explicit calculation of actor bounds
c26b0b2c Have valid pole coordinates by default
dbfeeb23 Simplifying API as Pole is an iVar
parents 724f206a 8b50d474
......@@ -39,15 +39,14 @@ renderer.SetActiveCamera( camera )
# Create polar axes
polaxes = vtkPolarAxesActor()
polaxes.SetBounds( cylinder.GetOutput().GetBounds() )
polaxes.SetPole( pole )
polaxes.SetAutoScaleRadius( 0 )
polaxes.SetMaximumRadius( 4.5 )
polaxes.SetMinimumAngle( -60. )
polaxes.SetMaximumAngle( 210. )
polaxes.SetNumberOfRadialAxes( 10 )
polaxes.SetNumberOfPolarAxisTicks( 9 )
polaxes.SetAutoSubdividePolarAxis( 0 )
polaxes.AutoSubdividePolarAxisOff()
polaxes.SetNumberOfPolarAxisTicks( 8 )
polaxes.SetCamera( renderer.GetActiveCamera() )
polaxes.SetPolarLabelFormat( "%6.1f" )
polaxes.GetRadialAxesProperty().SetColor( .0, .0, 1. )
......@@ -74,8 +73,7 @@ interactor.SetRenderWindow( window )
# Start interaction
window.Render()
polaxes.SetMaximumAngle( 120. )
window.Render()
polaxes.SetMinimumAngle( 60. )
polaxes.SetNumberOfPolarAxisTicks( 12 )
interactor.Start()
......@@ -607,18 +607,18 @@ vtkAxisActor::BuildLabels(vtkViewport *viewport, bool force)
{
return;
}
for (int i = 0; i < this->NumberOfLabelsBuilt; i++)
{
this->LabelActors[i]->SetCamera(this->Camera);
this->LabelActors[i]->GetProperty()->SetColor(this->LabelTextProperty->GetColor());
if(!this->GetCalculateLabelOffset())
{
this->LabelActors[i]->SetAutoCenter(1);
}
}
if (force || this->BuildTime.GetMTime() < this->BoundsTime.GetMTime() ||
this->AxisPosition != this->LastAxisPosition ||
this->LastRange[0] != this->Range[0] ||
......
This diff is collapsed.
......@@ -35,7 +35,6 @@ All rights reserve
#define VTK_MAXIMUM_NUMBER_OF_RADIAL_AXES 50
#define VTK_DEFAULT_NUMBER_OF_RADIAL_AXES 5
#define VTK_MAXIMUM_NUMBER_OF_POLAR_AXIS_TICKS 200
#define VTK_DEFAULT_MAXIMUM_POLAR_ANGLE 90.0
#define VTK_POLAR_ARC_RESOLUTION_PER_DEG 0.2
#include "vtkActor.h"
......@@ -64,14 +63,13 @@ public:
// Description:
// Explicitly specify the coordinate of the pole.
// The default coordinates are (0,0,0).
vtkSetVector3Macro( Pole, double );
virtual void SetPole( double[3] );
virtual void SetPole( double, double, double );
vtkGetVector3Macro( Pole, double );
// Description:
// Gets/Sets the number of radial axes
// Default: VTK_DEFAULT_NUMBER_OF_RADIAL_AXES
vtkSetClampMacro( NumberOfRadialAxes, vtkIdType, 2, VTK_MAXIMUM_NUMBER_OF_RADIAL_AXES );
virtual void SetNumberOfRadialAxes( vtkIdType );
vtkGetMacro( NumberOfRadialAxes, vtkIdType );
// Description:
......@@ -85,11 +83,11 @@ public:
// Default: true
vtkSetMacro( AutoSubdividePolarAxis, bool );
vtkGetMacro( AutoSubdividePolarAxis, bool );
vtkBooleanMacro( AutoSubdividePolarAxis, bool );
// Description:
// Set/Get the maximum radius of the polar coordinates.
// Default: VTK_DOUBLE_MAX
vtkSetClampMacro( MaximumRadius, double, 0., VTK_DOUBLE_MAX );
// Set/Get the maximum radius of the polar coordinates.
virtual void SetMaximumRadius( double );
vtkGetMacro( MaximumRadius, double );
// Description:
......@@ -100,14 +98,12 @@ public:
// Description:
// Set/Get the minimum radius of the polar coordinates (in degrees).
// Default: 0.
vtkSetClampMacro( MinimumAngle, double, -360., 360. );
virtual void SetMinimumAngle( double );
vtkGetMacro( MinimumAngle, double );
// Description:
// Set/Get the maximum radius of the polar coordinates (in degrees).
// Default: VTK_DEFAULT_MAXIMUM_POLAR_ANGLE
vtkSetClampMacro( MaximumAngle, double, -360., 360. );
virtual void SetMaximumAngle( double );
vtkGetMacro( MaximumAngle, double );
// Description:
......@@ -258,19 +254,31 @@ 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();
// Description:
// Send attributes which are common to all axes, both polar and radial
void SetCommonAxisAttributes( vtkAxisActor* );
void SetCommonAxisAttributes( vtkAxisActor* );
// Description:
// Create requested number of type X axes and set followers
void CreateRadialAxes( double );
// 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( double* );
void BuildPolarAxisLabelsArcs();
// Description:
// Convenience methods
......@@ -284,10 +292,12 @@ protected:
// Description:
// Coordinates of the pole
// Default: (0,0,0).
double Pole[3];
// Description:
// Number of radial axes
// Default: VTK_DEFAULT_NUMBER_OF_RADIAL_AXES
int NumberOfRadialAxes;
// Description:
......@@ -301,6 +311,7 @@ protected:
// Description:
// Maximum polar radius (minimum is always 0)
// Default: 1
double MaximumRadius;
// Description:
......@@ -309,10 +320,12 @@ protected:
// Description:
// Minimum polar angle
// Default: 0.
double MinimumAngle;
// Description:
// Maximum polar angle
// Default: 90.
double MaximumAngle;
// Description:
......
Supports Markdown
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