|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gwoptics.graphics.Renderable org.gwoptics.graphics.graph2D.Axis2D
public class Axis2D
Axis2D is a straight forward object for drawing 2D axes. It has all the functionality for tick marks, minimum and maximum values, colour and size, tick labels and axis labels.
Once an axis object has been created it is down the the user to specify the necessary rotations of labels to make it readable. All the functions beginning with set should be used to alter the axis.
Nested Class Summary | |
---|---|
static class |
Axis2D.Alignment
Encapsulates the 3 alignment constants already present in the PConstants interface. |
Field Summary |
---|
Fields inherited from class org.gwoptics.graphics.Renderable |
---|
position |
Fields inherited from interface processing.core.PConstants |
---|
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z |
Constructor Summary | |
---|---|
Axis2D(processing.core.PApplet parent,
int length)
Axis2D constructor accepting the parent PApplet and the length of the axis in pixels |
Method Summary | |
---|---|
void |
draw()
|
int |
getLength()
returns the length of the axis in world space. |
java.lang.Integer[] |
getMajorTickPositions()
|
float |
getMajorTickSpacing()
Gets the number of major ticks on the axis |
float |
getMaxValue()
returns the maximum value of the axis range |
java.lang.Integer[] |
getMinorTickPositions()
|
float |
getMinValue()
returns the minimum value of the axis range |
float |
positionToValue(int pixel)
For a given number of pixels along the axis, the value it represents is returned |
void |
pre()
|
void |
setAxesDirection(processing.core.PVector uv)
Sets the direction in which the axis is drawn |
void |
setAxisColour(GWColour c)
Sets the axis line colour from a Colour object |
void |
setAxisColour(int R,
int G,
int B)
Sets the axis line colour from RGB values |
void |
setAxisLabel(java.lang.String lbl)
Sets the label of the axis |
void |
setAxisLabelPos(LabelPos lblpos)
Sets the position of the axis label along the axis |
void |
setDrawAxisLabel(boolean value)
Sets whether or not to draw the axis label |
void |
setDrawTickLabels(boolean value)
Sets whether or not to draw the tick major tick labels |
void |
setDrawTicks(boolean value)
Sets whether or not to draw the tick marks on the axis |
void |
setFontColour(GWColour c)
Sets the labels font colour from a Colour object |
void |
setFontColour(int R,
int G,
int B)
Sets the labels font colour from RGB values |
void |
setLabelDirection(processing.core.PVector vlbl)
Sets the direction as a PVector, of which way the ticks and labels should be from the main axis line. |
void |
setLabelOffset(float val)
Sets an offset that is to be applied to the axis label. |
void |
setLabelRotation(float val)
Sets the rotation to be applied to the main axis label |
void |
setMajorTickLength(int val)
Sets the length of the major ticks, using a negative length extends ticks into the graph rather than to the labels |
void |
setMaxValue(float val)
Sets the maximum value to show on the axis |
void |
setMinorTickLength(int val)
Sets the length of the minor ticks, using a negative length extends ticks into the graph rather than to the labels |
void |
setMinorTicks(int t)
Sets the number of minor ticks to show |
void |
setMinValue(float val)
Sets the minimum value to show on the axis |
void |
setOffsetLabelByTickLength(boolean value)
Sets whether to offset the label by the longest tick label that has been rendered. |
void |
setTickLabelAccuracy(int v)
Sets the number of decimal places to display in each tick label. |
void |
setTickLabelAlignment(Axis2D.Alignment a)
Sets the alignment of the major tick labels, from the Alignment enum |
void |
setTickLabelOffset(int val)
Sets an offset that is to be applied to the major tick labels. |
void |
setTickLabelRotation(float val)
Sets the rotation to be applied to each tick label |
void |
setTickLabelType(ValueType v)
Sets the type of number to display on the graph |
void |
setTickSpacing(float spacing)
Sets the spacing between each tick in graph space |
int |
valueToPosition(double value)
|
int |
valueToPosition(float value)
For a given graph value it provides the position it is on the axis to the nearest pixel |
Methods inherited from class org.gwoptics.graphics.Renderable |
---|
setParent |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Axis2D(processing.core.PApplet parent, int length)
Method Detail |
---|
public void setAxisColour(int R, int G, int B)
public void setAxisColour(GWColour c)
public void setFontColour(int R, int G, int B)
public void setFontColour(GWColour c)
public void setDrawTicks(boolean value)
public void setDrawTickLabels(boolean value)
public void setDrawAxisLabel(boolean value)
public void setAxisLabel(java.lang.String lbl)
public void setAxisLabelPos(LabelPos lblpos)
lblpos
- position can be START, MIDDLE, END or OUTSIDEpublic void setLabelOffset(float val)
public void setOffsetLabelByTickLength(boolean value)
public void setTickLabelOffset(int val)
public void setTickLabelAlignment(Axis2D.Alignment a)
public void setTickLabelRotation(float val)
public void setLabelRotation(float val)
public void setLabelDirection(processing.core.PVector vlbl)
public void setAxesDirection(processing.core.PVector uv)
public void setTickSpacing(float spacing)
public void setMinorTicks(int t)
public void setTickLabelType(ValueType v)
ValueType
public void setTickLabelAccuracy(int v)
public void setMajorTickLength(int val)
val
- length of the major tickspublic void setMinorTickLength(int val)
val
- length of the major tickspublic void setMaxValue(float val)
public void setMinValue(float val)
public float getMajorTickSpacing()
public float getMaxValue()
public float getMinValue()
public int getLength()
public java.lang.Integer[] getMajorTickPositions()
public java.lang.Integer[] getMinorTickPositions()
public void pre()
public void draw()
draw
in interface IRenderable
draw
in class Renderable
public int valueToPosition(float value)
public int valueToPosition(double value)
public float positionToValue(int pixel)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |