Package uk.ac.starlink.ttools.plot
Class ErrorRenderer
java.lang.Object
uk.ac.starlink.ttools.plot.ErrorRenderer
Renders error bars.
- Since:
- 20 Feb 2007
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ErrorRenderer
General purpose error renderer.static final ErrorRenderer
Error renderer suitable for use in user controls.static final ErrorRenderer
Error renderer which draws nothing.static final ErrorRenderer
Error renderer suitable for displaying 2D tangential errors. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
drawErrors
(Graphics g, int x, int y, int[] xoffs, int[] yoffs) Renders error bars in one or more dimensions around a given point.abstract Rectangle
getBounds
(int x, int y, int[] xoffs, int[] yoffs) Returns a rectangle which will contain the rendered error bar graphics for a given point.abstract Icon
Returns an icon giving a general example of what this form looks like.abstract Icon
getLegendIcon
(ErrorMode[] modes, int width, int height, int xpad, int ypad) Returns an icon giving an example of what this form looks like in a detailed context.getName()
Returns a user-readable name for this style of error rendering.static ErrorRenderer[]
Returns an array of ErrorRenderers which can render 1-dimensional (vertical) errors.static ErrorRenderer[]
Returns an array of ErrorRenderers which can render 2-dimensional errors.static ErrorRenderer[]
Returns an array of ErrorRenderers which can render 3-dimensional errors.static ErrorRenderer[]
Returns an array of ErrorRenderers which is suitable for 2d ellipse-like applications.static ErrorRenderer[]
Returns an array of ErrorRenderers which can render errors of arbitrary dimensionality.static ErrorRenderer[]
Returns an array of ErrorRenderers which is suitable for applications that plot a shape with independently variable horizontal and vertical extents.static ErrorRenderer[]
Returns an array of ErrorRenderers which can render errors suitable for spherical or spherical polar coordinates.static ErrorRenderer[]
Returns an array of ErrorRenderers which is suitable for vector-like applications.Returns an array of pixel positions which can be used to draw this marker onto a raster.abstract boolean
Indicates whether this renderer is known to produce no output for a particular set of ErrorModes.abstract boolean
supportsDimensionality
(int ndim) Reports whether this form can be used on a given error dimensionality.toString()
-
Field Details
-
NONE
Error renderer which draws nothing. -
DEFAULT
General purpose error renderer. -
EXAMPLE
Error renderer suitable for use in user controls. -
TANGENT
Error renderer suitable for displaying 2D tangential errors.
-
-
Constructor Details
-
ErrorRenderer
Constructor.- Parameters:
name
- renderer name
-
-
Method Details
-
getLegendIcon
Returns an icon giving a general example of what this form looks like.- Returns:
- example icon
-
getLegendIcon
Returns an icon giving an example of what this form looks like in a detailed context.- Parameters:
modes
- array of ErrorModes, one per error dimension (x, y, ...)width
- total width of iconheight
- total height of iconxpad
- internal horizontal padding of iconypad
- internal vertical padding of icon
-
getName
Returns a user-readable name for this style of error rendering.- Returns:
- renderer name
-
isBlank
Indicates whether this renderer is known to produce no output for a particular set of ErrorModes. Ifmodes
is null, the question is about whether this renderer will produce no output regardless of the error mode context.- Parameters:
modes
- error mode context, or null- Returns:
- true if this renderer can be guaranteed to paint nothing
-
supportsDimensionality
public abstract boolean supportsDimensionality(int ndim) Reports whether this form can be used on a given error dimensionality.- Parameters:
ndim
- number of error dimensions to be used- Returns:
- true iff this object can do rendering
-
drawErrors
Renders error bars in one or more dimensions around a given point. The positions of the ends of error bars relative to the the point are given. There may in general be (2*N) of these, though certainErrorRenderer
implementations may impose restrictions on this count. They must come in consecutive pairs which describe error bars along the same axis in different directions. Missing error bars are represented as (0,0). The values must come in axis order where that makes sense, but note in some contexts (e.g. 3D) these may be data axes rather than graphics plane axes.This method is quite likely to get called from time to time with ridiculously large offset arrays. Implementations should try to ensure that they don't attempt graphics operations which may cause the graphics system undue grief, such as filling an ellipse the size of a village.
- Parameters:
g
- graphics contextx
- data point X coordinatey
- data point Y coordinatexoffs
- X coordinates of error bar limit offsets from (x,y)yoffs
- Y coordinates of error bar limit offsets from (x,y)
-
getBounds
Returns a rectangle which will contain the rendered error bar graphics for a given point.- Parameters:
x
- data point X coordinatey
- data point Y coordinatexoffs
- X coordinates of error bar limit offsets from (x,y)yoffs
- Y coordinates of error bar limit offsets from (x,y)- Returns:
- bounding box
-
getPixels
Returns an array of pixel positions which can be used to draw this marker onto a raster. This can be used as an alternative to rendering the marker using thedrawErrors(java.awt.Graphics, int, int, int[], int[])
method, for instance in situations where it might be more efficient. The assumption is that all the pixels are the same colour.The ErrorRenderer implementation calculates this by painting onto a temporary BufferedImage and then examining the raster to see which pixels have been painted. This is probably not very efficient. Subclasses are encouraged to override this method if they can calculate the pixels which will be painted directly.
- Parameters:
clip
- clipping regionx
- data point X coordinatey
- data point Y coordinatexoffs
- X coordinates of error bar limit offsets from (x,y)yoffs
- Y coordinates of error bar limit offsets from (x,y)- Returns:
- array of pixel coordinates representing the error bar as a bitmap
-
toString
-
getOptions1d
Returns an array of ErrorRenderers which can render 1-dimensional (vertical) errors.- Returns:
- selection of renderers
-
getOptions2d
Returns an array of ErrorRenderers which can render 2-dimensional errors.- Returns:
- selection of renderers
-
getOptions3d
Returns an array of ErrorRenderers which can render 3-dimensional errors.- Returns:
- selection of renderers
-
getOptionsSpherical
Returns an array of ErrorRenderers which can render errors suitable for spherical or spherical polar coordinates. The first two dimensions of offset values submitted to such renderers are the tangential ones, and the third, if present, is the radial one.- Returns:
- selection of renderers
-
getOptionsGeneral
Returns an array of ErrorRenderers which can render errors of arbitrary dimensionality.- Returns:
- selection of renderers
-
getOptionsEllipse
Returns an array of ErrorRenderers which is suitable for 2d ellipse-like applications.- Returns:
- selection of renderers
-
getOptionsSizeXY
Returns an array of ErrorRenderers which is suitable for applications that plot a shape with independently variable horizontal and vertical extents.- Returns:
- selection of renderers
-
getOptionsVector
Returns an array of ErrorRenderers which is suitable for vector-like applications.- Returns:
- selection of renderers
-