Class MultiPointShape
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.MultiPointShape
-
public abstract class MultiPointShape extends java.lang.ObjectDefines 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
Fields Modifier and Type Field Description static MultiPointShapeDEFAULTGeneral purpose multi-point shape.static MultiPointShapeEXAMPLEShape suitable for use in user controls.static MultiPointShapeNONEMulti-point shape which draws nothing.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMultiPointShape(java.lang.String name, int iconDim, boolean canThick)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanThick()Indicates whether variants of this shape with different line thicknesses are available.abstract MultiPointScribecreateScribe(int nthick)Returns an object that can turn offset arrays into painted shapes with configurable line thickness.javax.swing.IcongetLegendIcon()Returns an icon giving a general example of what this shape looks like.javax.swing.IcongetLegendIcon(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.java.lang.StringgetName()Returns a user-readable name for this shape.static MultiPointShape[]getOptionsEllipse()Returns an array of instances which is suitable for 2d ellipse-like applications.static MultiPointShape[]getOptionsError1d()Returns an array of instances which can render 1-dimensional (vertical) errors.static MultiPointShape[]getOptionsError2d()Returns an array of instances which can render 2-dimensional errors.static MultiPointShape[]getOptionsError3d()Returns an array of instances which can render 3-dimensional errors.static MultiPointShape[]getOptionsVector()Returns an array of instances which is suitable for vector-like applications.abstract booleansupportsDimensionality(int ndim)Reports whether this shape can be used in a given dimensionality.java.lang.StringtoString()
-
-
-
Field Detail
-
NONE
public static final MultiPointShape NONE
Multi-point shape which draws nothing.
-
DEFAULT
public static final MultiPointShape DEFAULT
General purpose multi-point shape.
-
EXAMPLE
public static final MultiPointShape EXAMPLE
Shape suitable for use in user controls.
-
-
Constructor Detail
-
MultiPointShape
protected MultiPointShape(java.lang.String name, int iconDim, boolean canThick)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 Detail
-
getLegendIcon
public javax.swing.Icon getLegendIcon()
Returns an icon giving a general example of what this shape looks like.- Returns:
- example icon
-
getLegendIcon
public javax.swing.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
public abstract MultiPointScribe createScribe(int nthick)
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
public java.lang.String getName()
Returns a user-readable name for this shape.- Returns:
- shape name
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getOptionsError1d
public static MultiPointShape[] getOptionsError1d()
Returns an array of instances which can render 1-dimensional (vertical) errors.- Returns:
- selection of shapes
-
getOptionsError2d
public static MultiPointShape[] getOptionsError2d()
Returns an array of instances which can render 2-dimensional errors.- Returns:
- selection of shapes
-
getOptionsError3d
public static MultiPointShape[] getOptionsError3d()
Returns an array of instances which can render 3-dimensional errors.- Returns:
- selection of shapes
-
getOptionsEllipse
public static MultiPointShape[] getOptionsEllipse()
Returns an array of instances which is suitable for 2d ellipse-like applications.- Returns:
- selection of shapes
-
getOptionsVector
public static MultiPointShape[] getOptionsVector()
Returns an array of instances which is suitable for vector-like applications.- Returns:
- selection of shapes
-
-