OrthoGrid

References
public class OrthoGrid
Immutable class for rendering orthogonal grids into graphics contexts.

Constructors

OrthoGrid

#
public OrthoGrid(AxisStyle xAxis, AxisStyle yAxis, LineStyle xLines, LineStyle yLines, MarkStyle marks)
Constructor.
xAxis (AxisStyle)
yAxis (AxisStyle)
xLines (LineStyle)
yLines (LineStyle)
marks (MarkStyle)

Properties

Default

#
public static OrthoGrid Default { get; }
Gets the default grid Grasshopper usually draws.

DefaultTight

#
public static OrthoGrid DefaultTight { get; }
Gets the default grid for drawing tight grids.

Marks

#
public MarkStyle Marks { get; }
Gets the grid lines properties.

XAxis

#
public AxisStyle XAxis { get; }
Gets the grid x-axis properties.

XLines

#
public LineStyle XLines { get; }
Gets the properties for the lines parallel to the x-axis.

YAxis

#
public AxisStyle YAxis { get; }
Gets the grid y-axis properties.

YLines

#
public LineStyle YLines { get; }
Gets the properties for the lines parallel to the y-axis.

Methods

ControlToGrid

#
public void ControlToGrid(double x, double y, out double xʹ, out double yʹ)
Map a coordinate from control space into grid space.
x (double)Pixel x coordinate.
y (double)Pixel y coordinate.
xʹ (out double)X parameter
yʹ (out double)Y parameter.

Draw

#
public void Draw(Context context, GridElements elements)
Draw this grid into a control graphics context. The grid drawing is designed to work in control-space, not content space. You should provide a graphics context without zoom transformations.
context (Context)Graphics context to draw into.
elements (GridElements)Grid elements to render.

GridToControl

#
public void GridToControl(double x, double y, out double xʹ, out double yʹ)
Map a coordinate from grid space into control space.
x (double)X parameter.
y (double)Y parameter.
xʹ (out double)Pixel x coordinate.
yʹ (out double)Pixel y coordinate.

ResolveSnapping

#
public bool ResolveSnapping(out double x, out double y)
Determine the snapping intervals in the X and Y directions. This only works after a grid has been successfully drawn.
x (out double)Interval between grid lines in the X direction.
y (out double)Interval between grid lines in the Y direction.
True if the snapping could be resolved.

Setup

#
public void Setup(RectangleF frame, (double min, double max) xDomain, (double min, double max) yDomain)
Setup a specific projection. This method must be called before any calls to RenderXXXX() methods.
frame (RectangleF)Grid boundary frame.
xDomain ((double min, double max))X domain to be visible within frame.
yDomain ((double min, double max))Y domain to be visible within frame.

Setup

#
public void Setup(RectangleF frame, PointF origin, SizeF unit)
Setup a specific projection. This method must be called before any calls to RenderXXXX() methods.
frame (RectangleF)Grid boundary frame.
origin (PointF)Grid origin.
unit (SizeF)Grid unit rectangle.

WithAxes

#
public OrthoGrid WithAxes(AxisStyle xStyle, AxisStyle yStyle)
Swap out the X and Y-Axis style of this grid.
xStyle (AxisStyle)
yStyle (AxisStyle)

WithAxisColours

#
public OrthoGrid WithAxisColours(Color xColour, Color yColour)
Change the axis colours of this grid.
xColour (Color)
yColour (Color)

WithLines

#
public OrthoGrid WithLines(LineStyle xStyle, LineStyle yStyle)
Swap out the X and Y-Line style of this grid.
xStyle (LineStyle)
yStyle (LineStyle)

WithMarks

#
public OrthoGrid WithMarks(MarkStyle style)
Swap out the Marker style of this grid.
style (MarkStyle)

WithXAxis

#
public OrthoGrid WithXAxis(AxisStyle style)
Swap out the X-Axis style of this grid.
style (AxisStyle)

WithXLines

#
public OrthoGrid WithXLines(LineStyle style)
Swap out the X-Line style of this grid.
style (LineStyle)

WithYAxis

#
public OrthoGrid WithYAxis(AxisStyle style)
Swap out the Y-Axis style of this grid.
style (AxisStyle)

WithYLines

#
public OrthoGrid WithYLines(LineStyle style)
Swap out the X-Line style of this grid.
style (LineStyle)