public class MarkerStyle extends Object implements Style
MarkerShape
, colour and size.Modifier and Type | Field and Description |
---|---|
static int |
LEGEND_ICON_HEIGHT
Standard height in pixels for legend icon.
|
static int |
LEGEND_ICON_WIDTH
Standard width in pixels for legend icon.
|
Constructor and Description |
---|
MarkerStyle(MarkerShape shapeId,
Color color,
int size,
java.util.function.Consumer<Graphics> drawShape,
Pixer pixer)
Constructs a MarkerStyle based on an object that draws to a Graphics
context and a supplied pixel iterator.
|
MarkerStyle(MarkerShape shapeId,
Color color,
int size,
int maxr,
java.util.function.Consumer<Graphics> drawShape)
Constructs a MarkerStyle based on an object that draws to a Graphics
context.
|
Modifier and Type | Method and Description |
---|---|
void |
drawLegendShape(Graphics g)
Draws this marker's shape centred at the origin suitable for display
as a legend.
|
void |
drawShape(Graphics g)
Draws this marker's shape centered at the origin in a graphics context.
|
boolean |
equals(Object o) |
Icon |
getLegendIcon()
Returns an icon suitable for displaying in a legend for this style.
|
Icon |
getLegendIcon(int width,
int height)
Returns an icon of a requested size with this marker
painted in the center.
|
PixerFactory |
getPixerFactory()
Returns an iterator over pixel offsets which can be used to draw this
marker onto a raster.
|
int |
hashCode() |
public static final int LEGEND_ICON_WIDTH
public static final int LEGEND_ICON_HEIGHT
public MarkerStyle(MarkerShape shapeId, Color color, int size, int maxr, java.util.function.Consumer<Graphics> drawShape)
shapeId
- shape familycolor
- coloursize
- nominal size (non-negative integer)maxr
- maximum radius (furthest distance from center that
the shape may plot a pixel; overestimate is OK)drawShape
- can draw the sized shape to a graphics contextpublic MarkerStyle(MarkerShape shapeId, Color color, int size, java.util.function.Consumer<Graphics> drawShape, Pixer pixer)
shapeId
- shape familycolor
- coloursize
- nominal size (non-negative integer)drawShape
- can draw the sized shape to a graphics contextpixer
- pixel iterator giving shapepublic void drawShape(Graphics g)
g
- graphics contextpublic PixerFactory getPixerFactory()
drawMarker()
methods
in situations where it might be more efficient.
The assumption is that all the pixels are the same colour.
This implementation doesn't need to be fast, the data will be cached before use.
public void drawLegendShape(Graphics g)
drawShape(java.awt.Graphics)
, but it may be overridden if there are special
requirements, for instance if drawShape
draws a miniscule
graphic.g
- graphics contextpublic Icon getLegendIcon()
Style
getLegendIcon
in interface Style
public Icon getLegendIcon(int width, int height)
width
- icon width in pixelsheight
- icon height in pixelsCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.