Class MultiPointShape
java.lang.Object
uk.ac.starlink.ttools.plot2.layer.MultiPointShape
Defines a graphical shape with coordinates supplied by a number of
offset points.
This code is a reworked version of the class
ErrorRenderer
,
originally intended for drawing error bars,
but the usage is more general than that.
- Since:
- 21 Sep 2021
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MultiPointShape
General purpose multi-point shape.static final MultiPointShape
Shape suitable for use in user controls.static final MultiPointShape
Multi-point shape which draws nothing. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MultiPointShape
(String name, int iconDim, boolean canThick) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canThick()
Indicates whether variants of this shape with different line thicknesses are available.abstract MultiPointScribe
createScribe
(int nthick) Returns an object that can turn offset arrays into painted shapes with configurable line thickness.Returns an icon giving a general example of what this shape looks like.getLegendIcon
(MultiPointScribe scribe, ErrorMode[] modes, int width, int height, int xpad, int ypad) Returns an icon giving an example of what this shape looks like in a detailed context.getName()
Returns a user-readable name for this shape.static MultiPointShape[]
Returns an array of instances which is suitable for 2d ellipse-like applications.static MultiPointShape[]
Returns an array of instances which can render 1-dimensional (vertical) errors.static MultiPointShape[]
Returns an array of instances which can render 2-dimensional errors.static MultiPointShape[]
Returns an array of instances which can render 3-dimensional errors.static MultiPointShape[]
Returns an array of instances which is suitable for vector-like applications.abstract boolean
supportsDimensionality
(int ndim) Reports whether this shape can be used in a given dimensionality.toString()
-
Field Details
-
NONE
Multi-point shape which draws nothing. -
DEFAULT
General purpose multi-point shape. -
EXAMPLE
Shape suitable for use in user controls.
-
-
Constructor Details
-
MultiPointShape
Constructor.- Parameters:
name
- user-directed shape nameiconDim
- dimensionality to use for basic icon generationcanThick
- true iff this shape is available in different line thicknesses
-
-
Method Details
-
getLegendIcon
Returns an icon giving a general example of what this shape looks like.- Returns:
- example icon
-
getLegendIcon
public Icon getLegendIcon(MultiPointScribe scribe, ErrorMode[] modes, int width, int height, int xpad, int ypad) Returns an icon giving an example of what this shape looks like in a detailed context.- Parameters:
scribe
- shape paintermodes
- 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
-
supportsDimensionality
public abstract boolean supportsDimensionality(int ndim) Reports whether this shape can be used in a given dimensionality.- Parameters:
ndim
- number of error dimensions to be used- Returns:
- true iff this object can do rendering
-
createScribe
Returns an object that can turn offset arrays into painted shapes with configurable line thickness. IfcanThick()
returns false, the parameter makes no difference.- Parameters:
nthick
- non-negative line thickness, 0 is single-pixel- Returns:
- shape painter
-
canThick
public boolean canThick()Indicates whether variants of this shape with different line thicknesses are available. For some shapes, for instance filled rectangles, the line thickness makes no difference.- Returns:
- true iff the argument to
createScribe(int)
makes any difference
-
getName
Returns a user-readable name for this shape.- Returns:
- shape name
-
toString
-
getOptionsError1d
Returns an array of instances which can render 1-dimensional (vertical) errors.- Returns:
- selection of shapes
-
getOptionsError2d
Returns an array of instances which can render 2-dimensional errors.- Returns:
- selection of shapes
-
getOptionsError3d
Returns an array of instances which can render 3-dimensional errors.- Returns:
- selection of shapes
-
getOptionsEllipse
Returns an array of instances which is suitable for 2d ellipse-like applications.- Returns:
- selection of shapes
-
getOptionsVector
Returns an array of instances which is suitable for vector-like applications.- Returns:
- selection of shapes
-