NPlot::PhysicalAxis Class Reference

This class adds physical positioning information [PhysicalMin, PhysicalMax] and related functionality on top of a specific Axis class. More...

List of all members.

Public Member Functions

 PhysicalAxis (Axis a, Point physicalMin, Point physicalMax)
 Construct.
virtual Rectangle GetBoundingBox ()
 Returns the smallest rectangle that completely contains all parts of the axis [including ticks and label].
virtual void Draw (System.Drawing.Graphics g, out Rectangle boundingBox)
 Draws the axis on the given graphics surface.
PointF WorldToPhysical (double coord, bool clip)
 Given a world coordinate value, returns the physical position of the coordinate along the axis.
double PhysicalToWorld (Point p, bool clip)
 Given a physical point on the graphics surface, returns the world value of it's projection onto the axis [i.e.
void SetWorldLimitsFromPhysical (Point min, Point max)
 This sets new world limits for the axis from two physical points selected within the plot area.

Properties

Point PhysicalMin
 The physical position corresponding to WorldMin.
Point physicalMin_
Point PhysicalMax
 The physical position corresponding to WorldMax.
Point physicalMax_
Axis Axis
 The axis this object adds physical extents to.
Axis axis_
int PhysicalLength
 The length in pixels of the axis.
double PixelWorldLength
 The length in world coordinates of one pixel.

Private Member Functions

 PhysicalAxis ()
 Prevent default construction.


Detailed Description

This class adds physical positioning information [PhysicalMin, PhysicalMax] and related functionality on top of a specific Axis class.

It's an interesting question where to put this information. It belongs with every specific axis type, but on the other hand, users of the library as it is normally used should not see it because positioning of axes is handled internally by PlotSurface2D. Therefore it doesn't make sense to put it in the Axis class unless it is internal. But if this were done it would restrict use of this information outside the library always, which is not what is wanted. The main disadvantage with the method chosen is that there is a lot of passing of the positional information between physical axis and the underlying logical axis type.

C# doesn't have templates. If it did, I might derive PhysicalAxis from the templated Axis type (LinearAxis etc). Instead, have used a has-a relationship with an Axis superclass.

Definition at line 78 of file PhysicalAxis.cs.


Constructor & Destructor Documentation

NPlot::PhysicalAxis::PhysicalAxis  )  [inline, private]
 

Prevent default construction.

Definition at line 84 of file PhysicalAxis.cs.

NPlot::PhysicalAxis::PhysicalAxis Axis  a,
Point  physicalMin,
Point  physicalMax
[inline]
 

Construct.

Parameters:
a The axis this is a physical representation of.
physicalMin the physical position of the world minimum axis value.
physicalMax the physical position of the world maximum axis value.

Definition at line 95 of file PhysicalAxis.cs.


Member Function Documentation

virtual void NPlot::PhysicalAxis::Draw System.Drawing.Graphics  g,
out Rectangle  boundingBox
[inline, virtual]
 

Draws the axis on the given graphics surface.

Parameters:
g The graphics surface on which to draw.
boundingBox out: the axis bounding box - the smallest rectangle that completely contains all parts of the axis [including ticks and label].

Definition at line 123 of file PhysicalAxis.cs.

References PhysicalMax, and PhysicalMin.

virtual Rectangle NPlot::PhysicalAxis::GetBoundingBox  )  [inline, virtual]
 

Returns the smallest rectangle that completely contains all parts of the axis [including ticks and label].

Returns:
the smallest rectangle that completely contains all parts of the axis [including ticks and label].

Definition at line 107 of file PhysicalAxis.cs.

double NPlot::PhysicalAxis::PhysicalToWorld Point  p,
bool  clip
[inline]
 

Given a physical point on the graphics surface, returns the world value of it's projection onto the axis [i.e.

closest point on the axis]. The function is implemented for axes of arbitrary orientation.

Parameters:
p Physical point to find corresponding world value of.
clip if true, returns a world position outside WorldMin / WorldMax range if this is closer to the axis line. If false, such values will be clipped to be either WorldMin or WorldMax as appropriate.
Returns:
the world value of the point's projection onto the axis.

Definition at line 152 of file PhysicalAxis.cs.

References PhysicalMax, and PhysicalMin.

void NPlot::PhysicalAxis::SetWorldLimitsFromPhysical Point  min,
Point  max
[inline]
 

This sets new world limits for the axis from two physical points selected within the plot area.

Parameters:
min The upper left point of the selection.
max The lower right point of the selection.

Definition at line 164 of file PhysicalAxis.cs.

PointF NPlot::PhysicalAxis::WorldToPhysical double  coord,
bool  clip
[inline]
 

Given a world coordinate value, returns the physical position of the coordinate along the axis.

Parameters:
coord the world coordinate
clip if true, the physical position returned will be clipped to the physical max / min position as appropriate if the world value is outside the limits of the axis.
Returns:
the physical position of the coordinate along the axis.

Definition at line 136 of file PhysicalAxis.cs.

References PhysicalMax, and PhysicalMin.

Referenced by NPlot::CandlePlot::CalculatePhysicalSeparation(), NPlot::VerticalLine::Draw(), NPlot::TextItem::Draw(), NPlot::StepPlot::Draw(), NPlot::PointPlot::Draw(), NPlot::MarkerItem::Draw(), NPlot::LabelPointPlot::Draw(), NPlot::ImagePlot::Draw(), NPlot::HorizontalLine::Draw(), NPlot::HistogramPlot::Draw(), NPlot::CandlePlot::Draw(), NPlot::ArrowItem::Draw(), NPlot::Grid::DrawGridLines(), NPlot::Transform2D::FastTransform2D::Transform(), and NPlot::Transform2D::DefaultTransform2D::Transform().


Property Documentation

Axis NPlot::PhysicalAxis::Axis [get, set]
 

The axis this object adds physical extents to.

Definition at line 240 of file PhysicalAxis.cs.

Referenced by NPlot::AxesConstraint::AspectRatio::ApplyConstraint(), NPlot::AxesConstraint::YPixelWorldLength::ApplyConstraint(), NPlot::AxesConstraint::XPixelWorldLength::ApplyConstraint(), NPlot::PointPlot::Draw(), NPlot::ImagePlot::Draw(), NPlot::Grid::Draw(), NPlot::FilledRegion::Draw(), NPlot::ArrowItem::Draw(), and NPlot::PageAlignedPhysicalAxis::PageAlignedPhysicalAxis().

Axis NPlot::PhysicalAxis::axis_ [private]
 

Definition at line 250 of file PhysicalAxis.cs.

int NPlot::PhysicalAxis::PhysicalLength [get]
 

The length in pixels of the axis.

Definition at line 257 of file PhysicalAxis.cs.

Referenced by NPlot::AxesConstraint::YPixelWorldLength::ApplyConstraint(), NPlot::AxesConstraint::XPixelWorldLength::ApplyConstraint(), and NPlot::FilledRegion::Draw().

Point NPlot::PhysicalAxis::PhysicalMax [get, set]
 

The physical position corresponding to WorldMax.

Definition at line 223 of file PhysicalAxis.cs.

Referenced by NPlot::AxesConstraint::AspectRatio::ApplyConstraint(), NPlot::AxesConstraint::AxisPosition::ApplyConstraint(), NPlot::AxesConstraint::YPixelWorldLength::ApplyConstraint(), NPlot::AxesConstraint::XPixelWorldLength::ApplyConstraint(), NPlot::VerticalLine::Draw(), Draw(), NPlot::ImagePlot::Draw(), NPlot::HorizontalLine::Draw(), NPlot::Grid::Draw(), NPlot::FilledRegion::Draw(), NPlot::Grid::DrawGridLines(), NPlot::PageAlignedPhysicalAxis::PageAlignedPhysicalAxis(), PhysicalToWorld(), NPlot::Legend::UpdateAxesPositions(), and WorldToPhysical().

Point NPlot::PhysicalAxis::physicalMax_ [private]
 

Definition at line 233 of file PhysicalAxis.cs.

Point NPlot::PhysicalAxis::PhysicalMin [get, set]
 

The physical position corresponding to WorldMin.

Definition at line 206 of file PhysicalAxis.cs.

Referenced by NPlot::AxesConstraint::AspectRatio::ApplyConstraint(), NPlot::AxesConstraint::AxisPosition::ApplyConstraint(), NPlot::AxesConstraint::YPixelWorldLength::ApplyConstraint(), NPlot::AxesConstraint::XPixelWorldLength::ApplyConstraint(), NPlot::VerticalLine::Draw(), Draw(), NPlot::ImagePlot::Draw(), NPlot::HorizontalLine::Draw(), NPlot::HistogramPlot::Draw(), NPlot::Grid::Draw(), NPlot::FilledRegion::Draw(), NPlot::Grid::DrawGridLines(), NPlot::PageAlignedPhysicalAxis::PageAlignedPhysicalAxis(), PhysicalToWorld(), NPlot::Legend::UpdateAxesPositions(), and WorldToPhysical().

Point NPlot::PhysicalAxis::physicalMin_ [private]
 

Definition at line 216 of file PhysicalAxis.cs.

double NPlot::PhysicalAxis::PixelWorldLength [get]
 

The length in world coordinates of one pixel.

Definition at line 268 of file PhysicalAxis.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