NPlot::LinearAxis Class Reference

Provides functionality for drawing axes with a linear numeric scale. More...

Inheritance diagram for NPlot::LinearAxis:

NPlot::Axis List of all members.

Public Member Functions

override object Clone ()
 Deep copy of LinearAxis.
 LinearAxis (Axis a)
 Copy constructor.
 LinearAxis ()
 Default constructor.
 LinearAxis (double worldMin, double worldMax)
 Construct a linear axis with the provided world min and max values.
double AdjustedWorldValue (double world)
 Adjusts a real world value to one that has been modified to reflect the Axis Scale and Offset properties.

Protected Member Functions

void DoClone (LinearAxis b, LinearAxis a)
 Helper method for Clone.
override void DrawTicks (Graphics g, Point physicalMin, Point physicalMax, out object labelOffset, out object boundingBox)
 Draws the large and small ticks [and tick labels] for this axis.

Properties

double LargeTickStep
 The distance between large ticks.
double largeTickStep_ = double.NaN
 If set !NaN, gives the distance between large ticks.
double LargeTickValue
 If set, a large tick will be placed at this position, and other large ticks will be placed relative to this position.
double largeTickValue_ = double.NaN
int NumberOfSmallTicks
 The number of small ticks between large ticks.
object numberSmallTicks_ = null
double Scale
 Scale to apply to world values when labelling axis: (labelWorld = world * scale + offset).
double Offset
 Offset to apply to world values when labelling the axis: (labelWorld = axisWorld * scale + offset).
float ApproxNumberLargeTicks = 3.0f
 If LargeTickStep isn't specified, then a suitable value is calculated automatically.
double[] Mantissas = {1.0, 2.0, 5.0}
 If LargeTickStep isn't specified, then a suitable value is calculated automatically.
int[] SmallTickCounts = {4, 1, 4}
 If NumberOfSmallTicks isn't specified then .
double offset_ = 0.0
double scale_ = 1.0

Private Member Functions

void Init ()
 Helper function for constructors.
internal override void WorldTickPositions_SecondPass (Point physicalMin, Point physicalMax, ArrayList largeTickPositions, ref ArrayList smallTickPositions)
 Determines the positions, in world coordinates, of the small ticks if they have not already been generated.
internal override void WorldTickPositions_FirstPass (Point physicalMin, Point physicalMax, out ArrayList largeTickPositions, out ArrayList smallTickPositions)
 Determines the positions, in world coordinates, of the large ticks.
double DetermineLargeTickStep (float physicalLength, out bool shouldCullMiddle)
 Calculates the world spacing between large ticks, based on the physical axis length (parameter), world axis length, Mantissa values and MinPhysicalLargeTickStep.
int DetermineNumberSmallTicks (double bigTickDist)
 Given the large tick step, determine the number of small ticks that should be placed in between.

Detailed Description

Provides functionality for drawing axes with a linear numeric scale.

Definition at line 63 of file LinearAxis.cs.


Constructor & Destructor Documentation

NPlot::LinearAxis::LinearAxis Axis  a  )  [inline]
 

Copy constructor.

Parameters:
a The Axis to clone

Definition at line 103 of file LinearAxis.cs.

NPlot::LinearAxis::LinearAxis  )  [inline]
 

Default constructor.

Definition at line 113 of file LinearAxis.cs.

Referenced by Clone().

NPlot::LinearAxis::LinearAxis double  worldMin,
double  worldMax
[inline]
 

Construct a linear axis with the provided world min and max values.

Parameters:
worldMin the world minimum value of the axis.
worldMax the world maximum value of the axis.

Definition at line 125 of file LinearAxis.cs.


Member Function Documentation

double NPlot::LinearAxis::AdjustedWorldValue double  world  )  [inline]
 

Adjusts a real world value to one that has been modified to reflect the Axis Scale and Offset properties.

Parameters:
world world value to adjust
Returns:
adjusted world value

Definition at line 271 of file LinearAxis.cs.

override object NPlot::LinearAxis::Clone  )  [inline, virtual]
 

Deep copy of LinearAxis.

Returns:
A copy of the LinearAxis Class

Reimplemented from NPlot::Axis.

Definition at line 70 of file LinearAxis.cs.

References LinearAxis().

double NPlot::LinearAxis::DetermineLargeTickStep float  physicalLength,
out bool  shouldCullMiddle
[inline, private]
 

Calculates the world spacing between large ticks, based on the physical axis length (parameter), world axis length, Mantissa values and MinPhysicalLargeTickStep.

A value such that at least two

Parameters:
physicalLength physical length of the axis
shouldCullMiddle Returns true if we were forced to make spacing of large ticks too small in order to ensure that there are at least two of them. The draw ticks method should not draw more than two large ticks if this returns true.
Returns:
Large tick spacing
TODO: This can be optimised a bit.

Definition at line 398 of file LinearAxis.cs.

int NPlot::LinearAxis::DetermineNumberSmallTicks double  bigTickDist  )  [inline, private]
 

Given the large tick step, determine the number of small ticks that should be placed in between.

Parameters:
bigTickDist the large tick step.
Returns:
the number of small ticks to place between large ticks.

Definition at line 499 of file LinearAxis.cs.

void NPlot::LinearAxis::DoClone LinearAxis  b,
LinearAxis  a
[inline, protected]
 

Helper method for Clone.

Definition at line 86 of file LinearAxis.cs.

References largeTickStep_, largeTickValue_, numberSmallTicks_, offset_, and scale_.

override void NPlot::LinearAxis::DrawTicks Graphics  g,
Point  physicalMin,
Point  physicalMax,
out object  labelOffset,
out object  boundingBox
[inline, protected, virtual]
 

Draws the large and small ticks [and tick labels] for this axis.

Parameters:
g The graphics surface on which to draw.
physicalMin The physical position corresponding to the world minimum of the axis.
physicalMax The physical position corresponding to the world maximum of the axis.
boundingBox out: smallest box that completely surrounds all ticks and associated labels for this axis.
labelOffset out: offset from the axis to draw the axis label.

Reimplemented from NPlot::Axis.

Definition at line 146 of file LinearAxis.cs.

void NPlot::LinearAxis::Init  )  [inline, private]
 

Helper function for constructors.

Do initialization here so that Clear() method is handled properly

Reimplemented from NPlot::Axis.

Definition at line 132 of file LinearAxis.cs.

internal override void NPlot::LinearAxis::WorldTickPositions_FirstPass Point  physicalMin,
Point  physicalMax,
out ArrayList  largeTickPositions,
out ArrayList  smallTickPositions
[inline, private, virtual]
 

Determines the positions, in world coordinates, of the large ticks.

When the physical extent of the axis is small, some of the positions that were generated in this pass may be converted to small tick positions and returned as well.

If the LargeTickStep isn't set then this is calculated automatically and depends on the physical extent of the axis.

Parameters:
physicalMin The physical position corresponding to the world minimum of the axis.
physicalMax The physical position corresponding to the world maximum of the axis.
largeTickPositions ArrayList containing the positions of the large ticks.
smallTickPositions ArrayList containing the positions of the small ticks if calculated, null otherwise.

Reimplemented from NPlot::Axis.

Definition at line 290 of file LinearAxis.cs.

internal override void NPlot::LinearAxis::WorldTickPositions_SecondPass Point  physicalMin,
Point  physicalMax,
ArrayList  largeTickPositions,
ref ArrayList  smallTickPositions
[inline, private, virtual]
 

Determines the positions, in world coordinates, of the small ticks if they have not already been generated.

Parameters:
physicalMin The physical position corresponding to the world minimum of the axis.
physicalMax The physical position corresponding to the world maximum of the axis.
largeTickPositions The positions of the large ticks.
smallTickPositions If null, small tick positions are returned via this parameter. Otherwise this function does nothing.

Reimplemented from NPlot::Axis.

Definition at line 215 of file LinearAxis.cs.


Property Documentation

float NPlot::LinearAxis::ApproxNumberLargeTicks = 3.0f
 

If LargeTickStep isn't specified, then a suitable value is calculated automatically.

To determine the tick spacing, the world axis length is divided by ApproximateNumberLargeTicks and the next lowest distance m*10^e for some m in the Mantissas set and some integer e is used as the large tick spacing.

Definition at line 629 of file LinearAxis.cs.

double NPlot::LinearAxis::LargeTickStep [get, set]
 

The distance between large ticks.

If this is set to NaN [default], this distance will be calculated automatically.

Definition at line 538 of file LinearAxis.cs.

double NPlot::LinearAxis::largeTickStep_ = double.NaN [private]
 

If set !NaN, gives the distance between large ticks.

Definition at line 551 of file LinearAxis.cs.

Referenced by DoClone().

double NPlot::LinearAxis::LargeTickValue [get, set]
 

If set, a large tick will be placed at this position, and other large ticks will be placed relative to this position.

Definition at line 559 of file LinearAxis.cs.

double NPlot::LinearAxis::largeTickValue_ = double.NaN [private]
 

Definition at line 569 of file LinearAxis.cs.

Referenced by DoClone().

double [] NPlot::LinearAxis::Mantissas = {1.0, 2.0, 5.0}
 

If LargeTickStep isn't specified, then a suitable value is calculated automatically.

The value will be of the form m*10^e for some m in this set.

Definition at line 636 of file LinearAxis.cs.

int NPlot::LinearAxis::NumberOfSmallTicks [get, set]
 

The number of small ticks between large ticks.

Definition at line 575 of file LinearAxis.cs.

object NPlot::LinearAxis::numberSmallTicks_ = null [private]
 

Definition at line 586 of file LinearAxis.cs.

Referenced by DoClone().

double NPlot::LinearAxis::Offset [get, set]
 

Offset to apply to world values when labelling the axis: (labelWorld = axisWorld * scale + offset).

This does not affect the "real" world range of the axis.

Definition at line 611 of file LinearAxis.cs.

double NPlot::LinearAxis::offset_ = 0.0 [private]
 

Definition at line 646 of file LinearAxis.cs.

Referenced by DoClone().

double NPlot::LinearAxis::Scale [get, set]
 

Scale to apply to world values when labelling axis: (labelWorld = world * scale + offset).

This does not affect the "real" world range of the axis.

Definition at line 594 of file LinearAxis.cs.

double NPlot::LinearAxis::scale_ = 1.0 [private]
 

Definition at line 648 of file LinearAxis.cs.

Referenced by DoClone().

int [] NPlot::LinearAxis::SmallTickCounts = {4, 1, 4}
 

If NumberOfSmallTicks isn't specified then .

... If specified LargeTickStep manually, then no small ticks unless NumberOfSmallTicks specified.

Definition at line 643 of file LinearAxis.cs.


The documentation for this class was generated from the following file:
Generated on Sat Nov 5 01:04:08 2005 for NPlot by  doxygen 1.4.5