public abstract class XYShape extends Object
This object acts as a factory for Glyphs. These glyphs are lazily cached per instance of this class for small values of the X and Y coordinates (since there aren't very many of them, and they are probably used frequently); for larger values, the glyphs are created on demand.
Modifier and Type | Field and Description |
---|---|
static Glyph |
POINT
Glyph that paints a single pixel at the origin.
|
Modifier | Constructor and Description |
---|---|
protected |
XYShape(String name)
Constructs a shape with a default cache limit
and single-pixel point glyph.
|
protected |
XYShape(String name,
int maxCacheRadius,
Glyph pointGlyph)
Constructs a shape with a specified cache limit and point glyph.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Glyph |
createGlyph(short sx,
short sy)
Constructs a new glyph with given coordinates.
|
static Icon |
createIcon(XYShape shape,
int width,
int height,
boolean useComponentColor)
Returns an icon displaying a given shape.
|
Glyph |
getGlyph(short sx,
short sy)
Obtains a glyph characterised by a given pair of values.
|
String |
getName()
Returns the name of this shape.
|
boolean |
isCached(short sx,
short sy)
Indicates whether a glyph of a given size will be cached.
|
String |
toString() |
public static Glyph POINT
protected XYShape(String name, int maxCacheRadius, Glyph pointGlyph)
name
- shape namemaxCacheRadius
- glyphs are cached if both input values
have an absolute value lower than or equal
to this limitpointGlyph
- glyph to dispense for zero-length lines;
may be null for no special-case behaviourprotected XYShape(String name)
name
- shape namepublic String getName()
public boolean isCached(short sx, short sy)
sx
- X radiussy
- Y radiuspublic Glyph getGlyph(short sx, short sy)
sx
- X valuesy
- Y valueprotected abstract Glyph createGlyph(short sx, short sy)
sx
- X valuesy
- Y valuepublic static Icon createIcon(XYShape shape, int width, int height, boolean useComponentColor)
shape
- shapewidth
- icon widthheight
- icon heightuseComponentColor
- if true, the glyph will be painted in
the component's foreground colourCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.