C# 클래스 NPlot.Axis

Encapsulates functionality common to all axis classes. All specific axis classes derive from Axis. Axis can be used as a concrete class itself - it is an Axis without any embilishments [tick marks or tick mark labels].



This class encapsulates no physical information about where the axes are drawn.
상속: System.ICloneable
파일 보기 프로젝트 열기: GridProtectionAlliance/openHistorian 1 사용 예제들

Private Properties

프로퍼티 타입 설명
Init void
UpdateScale void
WorldTickPositions_FirstPass void
WorldTickPositions_SecondPass void

공개 메소드들

메소드 설명
Axis ( ) : System

Default constructor

Axis ( Axis a ) : System

Copy constructor.

Axis ( double worldMin, double worldMax ) : System

Constructor that takes only world min and max values.

Clone ( ) : object

Deep copy of Axis.

This method includes a check that guards against derived classes forgetting to implement their own Clone method. If Clone is called on a object derived from Axis, and the Clone method hasn't been overridden by that object, then the test this.GetType == typeof(Axis) will fail.

Draw ( Graphics g, Point physicalMin, Point physicalMax, Rectangle &boundingBox ) : void

Draw the axis. This involves three steps: (1) Draw the axis line. (2) Draw the tick marks. (3) Draw the label.

DrawLabel ( Graphics g, Point offset, Point axisPhysicalMin, Point axisPhysicalMax ) : object

Draw the Axis Label

DrawTick ( Graphics g, double w, float size, string text, Point textOffset, Point axisPhysMin, Point axisPhysMax, Point &labelOffset, Rectangle &boundingBox ) : void

Draw a tick on the axis.

IncreaseRange ( double percent ) : void

Moves the world min and max values so that the world axis length is [percent] bigger. If the current world max and min values are the same, they are moved appart an arbitrary amount. This arbitrary amount is currently 0.01, and will probably be configurable in the future.

Works for the case WorldMax is less than WorldMin.

LUB ( Axis a ) : void

Sets the world extent of the current axis to be just large enough to encompas the current world extent of the axis, and the world extent of the passed in axis

OutOfRange ( double coord ) : bool

Determines whether a world value is outside range WorldMin -> WorldMax

PhysicalToWorld ( PointF p, PointF physicalMin, PointF physicalMax, bool clip ) : double

Return the world coordinate of the projection of the point p onto the axis.

WorldTickPositions ( Point physicalMin, Point physicalMax, List &largeTickPositions, List &smallTickPositions ) : void

Determines the positions of all Large and Small ticks.

WorldToPhysical ( double coord, PointF physicalMin, PointF physicalMax, bool clip ) : PointF

World to physical coordinate transform.

Not sure how much time is spent in this often called function. If it's lots, then worth optimizing (there is scope to do so).

보호된 메소드들

메소드 설명
DoClone ( Axis b, Axis a ) : void

Helper method for Clone. Does all the copying - can be called by derived types so they don't need to implement this part of the copying themselves. also useful in constructor of derived types that takes Axis class.

DrawTicks ( Graphics g, Point physicalMin, Point physicalMax, object &labelOffset, object &boundingBox ) : void

DrawTicks method. In base axis class this does nothing.

UpdateOffsetAndBounds ( object &labelOffset, object &boundingBox, Point mergeLabelOffset, Rectangle mergeBoundingBox ) : void

Update the bounding box and label offset associated with an axis to encompass the additionally specified mergeBoundingBox and mergeLabelOffset respectively.

getDefaultLabelOffset ( Point physicalMin, Point physicalMax ) : Point

returns a suitable offset for the axis label in the case that there are no ticks or tick text in the way.

비공개 메소드들

메소드 설명
Init ( ) : void

Helper function for constructors. Do initialization here so that Clear() method is handled properly

UpdateScale ( ) : void
WorldTickPositions_FirstPass ( Point physicalMin, Point physicalMax, List &largeTickPositions, List &smallTickPositions ) : void

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. This default implementation returns empty large ticks list and null small tick list.

WorldTickPositions_SecondPass ( Point physicalMin, Point physicalMax, List largeTickPositions, List &smallTickPositions ) : void

Determines the positions, in world coordinates, of the small ticks if they have not already been generated. This default implementation creates an empty smallTickPositions list if it doesn't already exist.

메소드 상세

Axis() 공개 메소드

Default constructor
public Axis ( ) : System
리턴 System

Axis() 공개 메소드

Copy constructor.
public Axis ( Axis a ) : System
a Axis The Axis to clone.
리턴 System

Axis() 공개 메소드

Constructor that takes only world min and max values.
public Axis ( double worldMin, double worldMax ) : System
worldMin double The minimum world coordinate.
worldMax double The maximum world coordinate.
리턴 System

Clone() 공개 메소드

Deep copy of Axis.
This method includes a check that guards against derived classes forgetting to implement their own Clone method. If Clone is called on a object derived from Axis, and the Clone method hasn't been overridden by that object, then the test this.GetType == typeof(Axis) will fail.
public Clone ( ) : object
리턴 object

DoClone() 보호된 정적인 메소드

Helper method for Clone. Does all the copying - can be called by derived types so they don't need to implement this part of the copying themselves. also useful in constructor of derived types that takes Axis class.
protected static DoClone ( Axis b, Axis a ) : void
b Axis
a Axis
리턴 void

Draw() 공개 메소드

Draw the axis. This involves three steps: (1) Draw the axis line. (2) Draw the tick marks. (3) Draw the label.
public Draw ( Graphics g, Point physicalMin, Point physicalMax, Rectangle &boundingBox ) : void
g System.Drawing.Graphics The drawing surface on which to draw.
physicalMin Point The physical position corresponding to the world minimum of the axis.
physicalMax Point The physical position corresponding to the world maximum of the axis.
boundingBox System.Drawing.Rectangle out The bounding rectangle of the axis including axis line, label, tick marks and tick mark labels
리턴 void

DrawLabel() 공개 메소드

Draw the Axis Label
public DrawLabel ( Graphics g, Point offset, Point axisPhysicalMin, Point axisPhysicalMax ) : object
g System.Drawing.Graphics The GDI+ drawing surface on which to draw.
offset Point offset from axis. Should be calculated so as to make sure axis label misses tick labels.
axisPhysicalMin Point The physical position corresponding to the world minimum of the axis.
axisPhysicalMax Point The physical position corresponding to the world maximum of the axis.
리턴 object

DrawTick() 공개 메소드

Draw a tick on the axis.
public DrawTick ( Graphics g, double w, float size, string text, Point textOffset, Point axisPhysMin, Point axisPhysMax, Point &labelOffset, Rectangle &boundingBox ) : void
g System.Drawing.Graphics The graphics surface on which to draw.
w double The tick position in world coordinates.
size float The size of the tick (in pixels)
text string The text associated with the tick
textOffset Point The Offset to draw from the auto calculated position
axisPhysMin Point The minimum physical extent of the axis
axisPhysMax Point The maximum physical extent of the axis
labelOffset Point out: offset from the axies required for axis label
boundingBox System.Drawing.Rectangle out: The bounding rectangle for the tick and tickLabel drawn
리턴 void

DrawTicks() 보호된 메소드

DrawTicks method. In base axis class this does nothing.
protected DrawTicks ( Graphics g, Point physicalMin, Point physicalMax, object &labelOffset, object &boundingBox ) : void
g System.Drawing.Graphics The graphics surface on which to draw
physicalMin Point The physical position corresponding to the world minimum of the axis.
physicalMax Point The physical position corresponding to the world maximum of the axis.
labelOffset object is set to a suitable offset from the axis to draw the axis label. In this base method, set to null.
boundingBox object is set to the smallest box that bounds the ticks and the tick text. In this base method, set to null.
리턴 void

IncreaseRange() 공개 메소드

Moves the world min and max values so that the world axis length is [percent] bigger. If the current world max and min values are the same, they are moved appart an arbitrary amount. This arbitrary amount is currently 0.01, and will probably be configurable in the future.
Works for the case WorldMax is less than WorldMin.
public IncreaseRange ( double percent ) : void
percent double Percentage to increase world length by.
리턴 void

LUB() 공개 메소드

Sets the world extent of the current axis to be just large enough to encompas the current world extent of the axis, and the world extent of the passed in axis
public LUB ( Axis a ) : void
a Axis The other Axis instance.
리턴 void

OutOfRange() 공개 메소드

Determines whether a world value is outside range WorldMin -> WorldMax
public OutOfRange ( double coord ) : bool
coord double the world value to test
리턴 bool

PhysicalToWorld() 공개 메소드

Return the world coordinate of the projection of the point p onto the axis.
public PhysicalToWorld ( PointF p, PointF physicalMin, PointF physicalMax, bool clip ) : double
p System.Drawing.PointF The point to project onto the axis
physicalMin System.Drawing.PointF The physical position corresponding to the world minimum of the axis.
physicalMax System.Drawing.PointF The physical position corresponding to the world maximum of the axis.
clip bool If true, the world value will be clipped to WorldMin or WorldMax as appropriate if it lies outside this range.
리턴 double

UpdateOffsetAndBounds() 보호된 정적인 메소드

Update the bounding box and label offset associated with an axis to encompass the additionally specified mergeBoundingBox and mergeLabelOffset respectively.
protected static UpdateOffsetAndBounds ( object &labelOffset, object &boundingBox, Point mergeLabelOffset, Rectangle mergeBoundingBox ) : void
labelOffset object Current axis label offset.
boundingBox object Current axis bounding box.
mergeLabelOffset Point the label offset to merge. The current label offset will be replaced by this if it's norm is larger.
mergeBoundingBox System.Drawing.Rectangle the bounding box to merge. The current bounding box will be replaced by this if null, or by the least upper bound of bother bounding boxes otherwise.
리턴 void

WorldTickPositions() 공개 메소드

Determines the positions of all Large and Small ticks.
public WorldTickPositions ( Point physicalMin, Point physicalMax, List &largeTickPositions, List &smallTickPositions ) : void
physicalMin Point The physical position corresponding to the world minimum of the axis.
physicalMax Point The physical position corresponding to the world maximum of the axis.
largeTickPositions List ArrayList containing the positions of the large ticks.
smallTickPositions List ArrayList containing the positions of the small ticks.
리턴 void

WorldToPhysical() 공개 메소드

World to physical coordinate transform.
Not sure how much time is spent in this often called function. If it's lots, then worth optimizing (there is scope to do so).
public WorldToPhysical ( double coord, PointF physicalMin, PointF physicalMax, bool clip ) : PointF
coord double The coordinate value to transform.
physicalMin System.Drawing.PointF The physical position corresponding to the world minimum of the axis.
physicalMax System.Drawing.PointF The physical position corresponding to the world maximum of the axis.
clip bool if false, then physical value may extend outside worldMin / worldMax. If true, the physical value returned will be clipped to physicalMin or physicalMax if it lies outside this range.
리턴 System.Drawing.PointF

getDefaultLabelOffset() 보호된 메소드

returns a suitable offset for the axis label in the case that there are no ticks or tick text in the way.
protected getDefaultLabelOffset ( Point physicalMin, Point physicalMax ) : Point
physicalMin Point physical point corresponding to the axis world maximum.
physicalMax Point physical point corresponding to the axis world minimum.
리턴 Point