VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
vtkAxis Class Reference

takes care of drawing 2D axes More...

#include <vtkAxis.h>

Inheritance diagram for vtkAxis:
Inheritance graph
[legend]
Collaboration diagram for vtkAxis:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { TICK_SIMPLE = 0, TICK_WILKINSON_EXTENDED }
typedef vtkContextItem Superclass
enum  {
  LEFT = 0, BOTTOM, RIGHT, TOP,
  PARALLEL
}
enum  { AUTO = 0, FIXED, CUSTOM }

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
virtual void PrintSelf (ostream &os, vtkIndent indent)
virtual void SetMinimum (double minimum)
virtual void SetMaximum (double maximum)
virtual void GetRange (double *range)
virtual void SetMinimumLimit (double lowest)
virtual void SetMaximumLimit (double highest)
virtual void Update ()
virtual bool Paint (vtkContext2D *painter)
virtual void AutoScale ()
virtual void RecalculateTickSpacing ()
virtual vtkDoubleArrayGetTickPositions ()
virtual void SetTickPositions (vtkDoubleArray *positions)
virtual vtkFloatArrayGetTickScenePositions ()
virtual vtkStringArrayGetTickLabels ()
virtual void SetTickLabels (vtkStringArray *labels)
vtkRectf GetBoundingRect (vtkContext2D *painter)
virtual void SetPosition (int position)
virtual int GetPosition ()
void SetPoint1 (const vtkVector2f &pos)
void SetPoint1 (float x, float y)
virtual floatGetPoint1 ()
virtual void GetPoint1 (float &, float &)
virtual void GetPoint1 (float[2])
vtkVector2f GetPosition1 ()
void SetPoint2 (const vtkVector2f &pos)
void SetPoint2 (float x, float y)
virtual floatGetPoint2 ()
virtual void GetPoint2 (float &, float &)
virtual void GetPoint2 (float[2])
vtkVector2f GetPosition2 ()
virtual void SetNumberOfTicks (int)
virtual int GetNumberOfTicks ()
virtual vtkTextPropertyGetLabelProperties ()
virtual double GetMinimum ()
virtual double GetMaximum ()
virtual void SetRange (double minimum, double maximum)
virtual void SetRange (double range[2])
virtual double GetMinimumLimit ()
virtual double GetMaximumLimit ()
virtual intGetMargins ()
virtual void GetMargins (int &, int &)
virtual void GetMargins (int[2])
virtual void SetMargins (int, int)
void SetMargins (int[2])
virtual void SetTitle (const vtkStdString &title)
virtual vtkStdString GetTitle ()
virtual vtkTextPropertyGetTitleProperties ()
virtual void SetLogScale (bool)
virtual bool GetLogScale ()
virtual void SetGridVisible (bool)
virtual bool GetGridVisible ()
virtual void SetLabelsVisible (bool)
virtual bool GetLabelsVisible ()
virtual void SetPrecision (int precision)
virtual int GetPrecision ()
virtual void SetBehavior (int)
virtual int GetBehavior ()
virtual vtkPenGetPen ()
virtual vtkPenGetGridPen ()
virtual void SetTickLabelAlgorithm (int)
virtual int GetTickLabelAlgorithm ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkAxisSafeDownCast (vtkObject *o)
static vtkAxisNew ()

Protected Member Functions

 vtkAxis ()
 ~vtkAxis ()
void GenerateTickLabels (double min, double max)
void GenerateTickLabels ()
void GenerateLabelFormat (int notation, double n)
double CalculateNiceMinMax (double &min, double &max)
double NiceNumber (double number, bool roundUp)
double LogScaleTickMark (double number, bool roundUp, bool &niceValue, int &order)
void GenerateLogScaleTickMarks (int order, double min=1.0, double max=9.0, bool detailLabels=true)

Protected Attributes

int Position
floatPoint1
floatPoint2
vtkVector2f Position1
vtkVector2f Position2
double TickInterval
int NumberOfTicks
vtkTextPropertyLabelProperties
double Minimum
double Maximum
double MinimumLimit
double MaximumLimit
int Margins [2]
vtkStdString Title
vtkTextPropertyTitleProperties
bool LogScale
bool GridVisible
bool LabelsVisible
int Precision
int Notation
int Behavior
float MaxLabel [2]
bool TitleAppended
vtkPenPen
vtkPenGridPen
vtkSmartPointer< vtkDoubleArrayTickPositions
vtkSmartPointer< vtkFloatArrayTickScenePositions
vtkSmartPointer< vtkStringArrayTickLabels
bool UsingNiceMinMax
bool TickMarksDirty
bool Resized
bool LogScaleReasonable
int TickLabelAlgorithm
vtkTimeStamp BuildTime
enum  {
  STANDARD_NOTATION = 0, SCIENTIFIC_NOTATION, FIXED_NOTATION, STANDARD = STANDARD_NOTATION,
  SCIENTIFIC = SCIENTIFIC_NOTATION, MIXED = FIXED_NOTATION
}
virtual void SetNotation (int notation)
virtual int GetNotation ()

Detailed Description

takes care of drawing 2D axes

The vtkAxis is drawn in screen coordinates. It is usually one of the last elements of a chart to be drawn. It renders the axis label, tick marks and tick labels.

Tests:
vtkAxis (Tests)

Definition at line 44 of file vtkAxis.h.


Member Typedef Documentation

Reimplemented from vtkContextItem.

Definition at line 47 of file vtkAxis.h.


Member Enumeration Documentation

anonymous enum

Enumeration of the axis locations in a conventional XY chart. Other layouts are possible.

Enumerator:
LEFT 
BOTTOM 
RIGHT 
TOP 
PARALLEL 

Definition at line 53 of file vtkAxis.h.

anonymous enum
Enumerator:
TICK_SIMPLE 
TICK_WILKINSON_EXTENDED 

Definition at line 62 of file vtkAxis.h.

anonymous enum

Enumeration of the axis notations available.

Enumerator:
STANDARD_NOTATION 
SCIENTIFIC_NOTATION 
FIXED_NOTATION 
STANDARD 
SCIENTIFIC 
MIXED 

Definition at line 210 of file vtkAxis.h.

anonymous enum

Enumeration of the axis behaviors.

Enumerator:
AUTO 
FIXED 
CUSTOM 

Definition at line 231 of file vtkAxis.h.


Constructor & Destructor Documentation

vtkAxis::vtkAxis ( ) [protected]
vtkAxis::~vtkAxis ( ) [protected]

Member Function Documentation

virtual const char* vtkAxis::GetClassName ( ) [virtual]

Reimplemented from vtkContextItem.

static int vtkAxis::IsTypeOf ( const char *  name) [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkContextItem.

virtual int vtkAxis::IsA ( const char *  name) [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkContextItem.

static vtkAxis* vtkAxis::SafeDownCast ( vtkObject o) [static]

Reimplemented from vtkContextItem.

virtual void vtkAxis::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkContextItem.

static vtkAxis* vtkAxis::New ( ) [static]

Creates a 2D Chart object.

Reimplemented from vtkObject.

virtual void vtkAxis::SetPosition ( int  position) [virtual]

Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL).

virtual int vtkAxis::GetPosition ( ) [virtual]

Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL).

void vtkAxis::SetPoint1 ( const vtkVector2f pos)

Set point 1 of the axis (in pixels), this is usually the origin.

void vtkAxis::SetPoint1 ( float  x,
float  y 
)

Set point 1 of the axis (in pixels), this is usually the origin.

virtual float* vtkAxis::GetPoint1 ( ) [virtual]

Get point 1 of the axis (in pixels), this is usually the origin.

virtual void vtkAxis::GetPoint1 ( float ,
float  
) [virtual]

Get point 1 of the axis (in pixels), this is usually the origin.

virtual void vtkAxis::GetPoint1 ( float  [2]) [virtual]

Get point 1 of the axis (in pixels), this is usually the origin.

vtkVector2f vtkAxis::GetPosition1 ( )

Get point 1 of the axis (in pixels), this is usually the origin.

void vtkAxis::SetPoint2 ( const vtkVector2f pos)

Set point 2 of the axis (in pixels), this is usually the terminus.

void vtkAxis::SetPoint2 ( float  x,
float  y 
)

Set point 2 of the axis (in pixels), this is usually the terminus.

virtual float* vtkAxis::GetPoint2 ( ) [virtual]

Get point 2 of the axis (in pixels), this is usually the terminus.

virtual void vtkAxis::GetPoint2 ( float ,
float  
) [virtual]

Get point 2 of the axis (in pixels), this is usually the terminus.

virtual void vtkAxis::GetPoint2 ( float  [2]) [virtual]

Get point 2 of the axis (in pixels), this is usually the terminus.

vtkVector2f vtkAxis::GetPosition2 ( )

Get point 2 of the axis (in pixels), this is usually the terminus.

virtual void vtkAxis::SetNumberOfTicks ( int  ) [virtual]

Set the number of tick marks for this axis. Default is -1, which leads to automatic calculation of nicely spaced tick marks.

virtual int vtkAxis::GetNumberOfTicks ( ) [virtual]

Get the number of tick marks for this axis.

virtual vtkTextProperty* vtkAxis::GetLabelProperties ( ) [virtual]

Get the vtkTextProperty that governs how the axis lables are displayed. Note that the alignment properties are not used.

virtual void vtkAxis::SetMinimum ( double  minimum) [virtual]

Set the logical minimum value of the axis, in plot coordinates.

virtual double vtkAxis::GetMinimum ( ) [virtual]

Get the logical minimum value of the axis, in plot coordinates.

virtual void vtkAxis::SetMaximum ( double  maximum) [virtual]

Set the logical maximum value of the axis, in plot coordinates.

virtual double vtkAxis::GetMaximum ( ) [virtual]

Get the logical maximum value of the axis, in plot coordinates.

virtual void vtkAxis::SetRange ( double  minimum,
double  maximum 
) [virtual]

Set the logical range of the axis, in plot coordinates.

virtual void vtkAxis::SetRange ( double  range[2]) [virtual]

Set the logical range of the axis, in plot coordinates.

virtual void vtkAxis::GetRange ( double range) [virtual]

Get the logical range of the axis, in plot coordinates.

virtual void vtkAxis::SetMinimumLimit ( double  lowest) [virtual]

Set the logical lowest possible value for Minimum, in plot coordinates.

virtual double vtkAxis::GetMinimumLimit ( ) [virtual]

Get the logical lowest possible value for Minimum, in plot coordinates.

virtual void vtkAxis::SetMaximumLimit ( double  highest) [virtual]

Set the logical highest possible value for Maximum, in plot coordinates.

virtual double vtkAxis::GetMaximumLimit ( ) [virtual]

Get the logical highest possible value for Maximum, in plot coordinates.

virtual int* vtkAxis::GetMargins ( ) [virtual]

Get the margins of the axis, in pixels.

virtual void vtkAxis::GetMargins ( int ,
int  
) [virtual]

Get the margins of the axis, in pixels.

virtual void vtkAxis::GetMargins ( int  [2]) [virtual]

Get the margins of the axis, in pixels.

virtual void vtkAxis::SetMargins ( int  ,
int   
) [virtual]

Set the margins of the axis, in pixels.

void vtkAxis::SetMargins ( int  [2])

Set the margins of the axis, in pixels.

virtual void vtkAxis::SetTitle ( const vtkStdString title) [virtual]

Get/set the title text of the axis.

virtual vtkStdString vtkAxis::GetTitle ( ) [virtual]

Get/set the title text of the axis.

virtual vtkTextProperty* vtkAxis::GetTitleProperties ( ) [virtual]

Get the vtkTextProperty that governs how the axis title is displayed.

virtual void vtkAxis::SetLogScale ( bool  ) [virtual]

Get/set whether the axis should use a log scale, default is false.

virtual bool vtkAxis::GetLogScale ( ) [virtual]

Get/set whether the axis should use a log scale, default is false.

virtual void vtkAxis::SetGridVisible ( bool  ) [virtual]

Get/set whether the axis grid lines should be drawn, default is true.

virtual bool vtkAxis::GetGridVisible ( ) [virtual]

Get/set whether the axis grid lines should be drawn, default is true.

virtual void vtkAxis::SetLabelsVisible ( bool  ) [virtual]

Get/set whether the axis labels should be visible.

virtual bool vtkAxis::GetLabelsVisible ( ) [virtual]

Get/set whether the axis labels should be visible.

virtual void vtkAxis::SetPrecision ( int  precision) [virtual]

Get/set the numerical precision to use, default is 2.

virtual int vtkAxis::GetPrecision ( ) [virtual]

Get/set the numerical precision to use, default is 2.

virtual void vtkAxis::SetNotation ( int  notation) [virtual]

Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).

virtual int vtkAxis::GetNotation ( ) [virtual]

Enumeration of the axis notations available.

virtual void vtkAxis::SetBehavior ( int  ) [virtual]

Get/set the behavior of the axis (auto, fixed, custom). Default is 0 (auto).

virtual int vtkAxis::GetBehavior ( ) [virtual]

Get/set the behavior of the axis (auto, fixed, custom). Default is 0 (auto).

virtual vtkPen* vtkAxis::GetPen ( ) [virtual]

Get a pointer to the vtkPen object that controls the way this axis is drawn.

virtual vtkPen* vtkAxis::GetGridPen ( ) [virtual]

Get a pointer to the vtkPen object that controls the way this axis is drawn.

virtual void vtkAxis::SetTickLabelAlgorithm ( int  ) [virtual]

Get/set the tick label algorithm that is used to calculate the min, max and tick spacing. There are currently two algoriths, vtkAxis::TICK_SIMPLE is the default and uses a simple algorithm. The second option is vtkAxis::TICK_WILKINSON which uses an extended Wilkinson algorithm to find the optimal range, spacing and font parameters.

virtual int vtkAxis::GetTickLabelAlgorithm ( ) [virtual]

Get/set the tick label algorithm that is used to calculate the min, max and tick spacing. There are currently two algoriths, vtkAxis::TICK_SIMPLE is the default and uses a simple algorithm. The second option is vtkAxis::TICK_WILKINSON which uses an extended Wilkinson algorithm to find the optimal range, spacing and font parameters.

virtual void vtkAxis::Update ( ) [virtual]

Update the geometry of the axis. Takes care of setting up the tick mark locations etc. Should be called by the scene before rendering.

Reimplemented from vtkAbstractContextItem.

virtual bool vtkAxis::Paint ( vtkContext2D painter) [virtual]

Paint event for the axis, called whenever the axis needs to be drawn.

Reimplemented from vtkAbstractContextItem.

virtual void vtkAxis::AutoScale ( ) [virtual]

Use this function to autoscale the axes after setting the minimum and maximum values. This will cause the axes to select the nicest numbers that enclose the minimum and maximum values, and to select an appropriate number of tick marks.

virtual void vtkAxis::RecalculateTickSpacing ( ) [virtual]

Recalculate the spacing of the tick marks - typically useful to do after scaling the axis.

virtual vtkDoubleArray* vtkAxis::GetTickPositions ( ) [virtual]

An array with the positions of the tick marks along the axis line. The positions are specified in the plot coordinates of the axis.

virtual void vtkAxis::SetTickPositions ( vtkDoubleArray positions) [virtual]

Set the tick positions (in plot coordinates).

virtual vtkFloatArray* vtkAxis::GetTickScenePositions ( ) [virtual]

An array with the positions of the tick marks along the axis line. The positions are specified in scene coordinates.

virtual vtkStringArray* vtkAxis::GetTickLabels ( ) [virtual]

A string array containing the tick labels for the axis.

virtual void vtkAxis::SetTickLabels ( vtkStringArray labels) [virtual]

Set the tick labels for the axis.

vtkRectf vtkAxis::GetBoundingRect ( vtkContext2D painter)

Request the space the axes require to be drawn. This is returned as a vtkRectf, with the corner being the offset from Point1, and the width/ height being the total width/height required by the axis. In order to ensure the numbers are correct, Update() should be called on the axis.

void vtkAxis::GenerateTickLabels ( double  min,
double  max 
) [protected]

Calculate and assign nice labels/logical label positions.

void vtkAxis::GenerateTickLabels ( ) [protected]

Generate tick labels from the supplied double array of tick positions.

void vtkAxis::GenerateLabelFormat ( int  notation,
double  n 
) [protected]
double vtkAxis::CalculateNiceMinMax ( double min,
double max 
) [protected]

Calculate the next "nicest" numbers above and below the current minimum.

Returns:
the "nice" spacing of the numbers.
double vtkAxis::NiceNumber ( double  number,
bool  roundUp 
) [protected]

Return a "nice number", often defined as 1, 2 or 5. If roundUp is true then the nice number will be rounded up, false it is rounded down. The supplied number should be between 0.0 and 9.9.

double vtkAxis::LogScaleTickMark ( double  number,
bool  roundUp,
bool &  niceValue,
int order 
) [protected]

Return a tick mark for a logarithmic axis. If roundUp is true then the upper tick mark is returned. Otherwise the lower tick mark is returned. Tick marks will be: ... 0.1 0.2 .. 0.9 1 2 .. 9 10 20 .. 90 100 ... Parameter nicevalue will be set to true if tick mark is in: ... 0.1 0.2 0.5 1 2 5 10 20 50 100 ... Parameter order is set to the detected order of magnitude of the number.

void vtkAxis::GenerateLogScaleTickMarks ( int  order,
double  min = 1.0,
double  max = 9.0,
bool  detailLabels = true 
) [protected]

Generate tick marks for logarithmic scale for specific order of magnitude. Mark generation is limited by parameters min and max. Tick marks will be: ... 0.1 0.2 .. 0.9 1 2 .. 9 10 20 .. 90 100 ... Tick labels will be: ... 0.1 0.2 0.5 1 2 5 10 20 50 100 ... If Parameter detaillabels is disabled tick labels will be: ... 0.1 1 10 100 ... If min/max is not in between 1.0 and 9.0 defaults will be used. If min and max do not differ 1 defaults will be used.


Member Data Documentation

int vtkAxis::Position [protected]

Definition at line 359 of file vtkAxis.h.

float* vtkAxis::Point1 [protected]

Definition at line 360 of file vtkAxis.h.

float* vtkAxis::Point2 [protected]

Definition at line 361 of file vtkAxis.h.

Definition at line 362 of file vtkAxis.h.

Definition at line 362 of file vtkAxis.h.

Definition at line 363 of file vtkAxis.h.

Definition at line 364 of file vtkAxis.h.

Definition at line 365 of file vtkAxis.h.

double vtkAxis::Minimum [protected]

Definition at line 366 of file vtkAxis.h.

double vtkAxis::Maximum [protected]

Definition at line 367 of file vtkAxis.h.

Definition at line 368 of file vtkAxis.h.

Definition at line 369 of file vtkAxis.h.

int vtkAxis::Margins[2] [protected]

Definition at line 370 of file vtkAxis.h.

Definition at line 371 of file vtkAxis.h.

Definition at line 372 of file vtkAxis.h.

bool vtkAxis::LogScale [protected]

Definition at line 373 of file vtkAxis.h.

bool vtkAxis::GridVisible [protected]

Definition at line 374 of file vtkAxis.h.

bool vtkAxis::LabelsVisible [protected]

Definition at line 375 of file vtkAxis.h.

int vtkAxis::Precision [protected]

Definition at line 376 of file vtkAxis.h.

int vtkAxis::Notation [protected]

Definition at line 377 of file vtkAxis.h.

int vtkAxis::Behavior [protected]

Definition at line 378 of file vtkAxis.h.

float vtkAxis::MaxLabel[2] [protected]

Definition at line 379 of file vtkAxis.h.

bool vtkAxis::TitleAppended [protected]

Definition at line 380 of file vtkAxis.h.

vtkPen* vtkAxis::Pen [protected]

This object stores the vtkPen that controls how the axis is drawn.

Definition at line 384 of file vtkAxis.h.

vtkPen* vtkAxis::GridPen [protected]

This object stores the vtkPen that controls how the grid lines are drawn.

Definition at line 388 of file vtkAxis.h.

Position of tick marks in screen coordinates

Definition at line 391 of file vtkAxis.h.

Position of tick marks in screen coordinates

Definition at line 394 of file vtkAxis.h.

The labels for the tick marks

Definition at line 397 of file vtkAxis.h.

bool vtkAxis::UsingNiceMinMax [protected]

Hint as to whether a nice min/max was set, otherwise labels may not be present at the top/bottom of the axis.

Definition at line 401 of file vtkAxis.h.

bool vtkAxis::TickMarksDirty [protected]

Mark the tick labels as dirty when the min/max value is changed.

Definition at line 404 of file vtkAxis.h.

bool vtkAxis::Resized [protected]

Flag to indicate that the axis has been resized.

Definition at line 407 of file vtkAxis.h.

bool vtkAxis::LogScaleReasonable [protected]

Hint as to whether a logarithmic scale is reasonable or not.

Definition at line 410 of file vtkAxis.h.

The algorithm being used to tick label placement.

Definition at line 413 of file vtkAxis.h.

The point cache is marked dirty until it has been initialized.

Definition at line 416 of file vtkAxis.h.


The documentation for this class was generated from the following file: