public abstract class MarkStyle extends DefaultStyle
style1 = style0.getShapeId() .getStyle( style0.getColor(), style0.getSize() ); style1.setLine( style0.getLine() ); style1.setLineWidth( style0.getLineWidth() ); style1.setDash( style0.getDash() ); style1.setHidePoints( style0.getHidePoints() ); style1.setOpaqueLimit( style0.getOpaqueLimit() ); style1.setErrorRenderer( style0.getErrorRenderer() );style0 and style1 should then match according to the
equals()
method. A style may however have a null shapeId
, in
which case you can't generate a matching instance.Modifier and Type | Class and Description |
---|---|
static class |
MarkStyle.Line
Enumeration class describing the types of line which can be drawn
in association with markers.
|
Modifier and Type | Field and Description |
---|---|
static MarkStyle.Line |
DOT_TO_DOT
Symbolic constant meaning join points by straight line segments.
|
static int |
LEGEND_ICON_HEIGHT |
static int |
LEGEND_ICON_WIDTH |
static MarkStyle.Line |
LINEAR
Symbolic constant meaning draw a linear regression line.
|
Modifier | Constructor and Description |
---|---|
protected |
MarkStyle(Color color,
Object otherAtts,
MarkShape shapeId,
int size,
int maxr)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
drawErrors(Graphics g,
int x,
int y,
int[] xoffs,
int[] yoffs)
Draws error bars using this style's current error renderer.
|
void |
drawErrors(Graphics g,
int x,
int y,
int[] xoffs,
int[] yoffs,
ColorTweaker fixer)
Draws error bars using this style's current error renderer in a way
which may be modified by a supplied
ColorTweaker object. |
void |
drawLabel(Graphics g,
int x,
int y,
String label)
Draws a label for a marker at a given point.
|
void |
drawLabel(Graphics g,
int x,
int y,
String label,
ColorTweaker fixer)
Draws a label for a marker at a given point with optional
colour modification.
|
void |
drawLegendShape(Graphics g)
Draws this marker's shape centred at the origin suitable for display
as a legend.
|
void |
drawMarker(Graphics g,
int x,
int y)
Draws this marker centered at a given position.
|
void |
drawMarker(Graphics g,
int x,
int y,
ColorTweaker fixer)
Draws this marker in a way which may be modified by a supplied
ColorTweaker object. |
abstract void |
drawShape(Graphics g)
Draws this marker's shape centered at the origin in a graphics context.
|
boolean |
equals(Object o)
Returns true if
o satisfies the following conditions
It has the same class as this one
It has the same colour as this one
It has the same stroke as this one
The otherAtts object specified at its creation
matches (according to equals() this one's
|
ErrorRenderer |
getErrorRenderer()
Returns the style used for drawing error bars around this marker.
|
int[] |
getFlattenedPixelOffsets(int xStride)
Returns an array of 1-dimensional pixel offsets which can be used
to draw this marker onto a raster.
|
boolean |
getHidePoints()
Indicates whether points are hidden or visible.
|
Icon |
getIcon(int width,
int height)
Returns an icon that draws this MarkStyle.
|
Color |
getLabelColor()
Returns the colour to use for drawing labels.
|
Pixellator |
getLabelPixels(String label,
int x,
int y,
Rectangle clip)
Returns an array over pixel positions which can be used to draw a
label for this style.
|
Icon |
getLegendIcon()
Draws a legend icon for this style without error rendering.
|
Icon |
getLegendIcon(ErrorMode[] errorModes)
Draws a legend icon for this style given certain error modes.
|
MarkStyle.Line |
getLine()
Returns the line type for this style.
|
int |
getMaximumRadius()
Returns the maximum radius of a marker drawn by this class.
|
int |
getOpaqueLimit()
Returns the opacity limit for this style.
|
Pixellator |
getPixelOffsets()
Returns an iterator over pixel offsets which can be used to draw this
marker onto a raster.
|
MarkShape |
getShapeId()
Returns this style's shape id.
|
int |
getSize()
Returns the nominal size of this style.
|
static boolean |
hasErrors(MarkStyle style,
PlotData plotData)
Utility method indicating whether errors will be drawn for a given
style when a given set of points is plotted.
|
int |
hashCode() |
void |
setErrorModeModels(ErrorModeSelection[] errSelections)
Sets the error mode suppliers with which this mark style will be used.
|
void |
setErrorRenderer(ErrorRenderer errorRenderer)
Sets the style used for drawing error bars around this marker.
|
void |
setHidePoints(boolean visible)
Sets whether points should be hidden or visible.
|
void |
setLine(MarkStyle.Line line)
Sets the line type for this style.
|
void |
setOpaqueLimit(int lim)
Sets the opacity limit for this style.
|
static MarkStyle |
targetStyle()
Returns a style which looks like a target.
|
getColor, getDash, getLineWidth, getOtherAtts, getStroke, getStroke, setColor, setDash, setLineWidth, toString
public static final MarkStyle.Line DOT_TO_DOT
public static final MarkStyle.Line LINEAR
public static final int LEGEND_ICON_WIDTH
public static final int LEGEND_ICON_HEIGHT
protected MarkStyle(Color color, Object otherAtts, MarkShape shapeId, int size, int maxr)
color
- colourotherAtts
- distinguisher for this instance (besides class
and colour)shapeId
- style factorysize
- nominal sizemaxr
- maximum radius (furthest distance from centre that
this style may plot a pixel)public abstract void drawShape(Graphics g)
g
- graphics contextpublic void drawLegendShape(Graphics g)
drawShape(java.awt.Graphics)
, but it may be overridden if there are special
requirements, for instance if drawShape
draws a minuscule
graphic.g
- graphics contextpublic int getMaximumRadius()
x
,y
point that drawMarker
might drawpublic MarkShape getShapeId()
public int getSize()
public void setLine(MarkStyle.Line line)
line
- line typepublic MarkStyle.Line getLine()
public void setHidePoints(boolean visible)
visible
- true if you want points to be invisiblepublic boolean getHidePoints()
public void setOpaqueLimit(int lim)
lim
- new opacity limitpublic int getOpaqueLimit()
public void setErrorRenderer(ErrorRenderer errorRenderer)
errorRenderer
- error bar stylepublic ErrorRenderer getErrorRenderer()
public void setErrorModeModels(ErrorModeSelection[] errSelections)
errSelections
- error mode choicespublic Color getLabelColor()
public void drawMarker(Graphics g, int x, int y)
drawShape(java.awt.Graphics)
.g
- graphics contextx
- x positiony
- y positionpublic void drawMarker(Graphics g, int x, int y, ColorTweaker fixer)
ColorTweaker
object. This permits changes to
be made to the colour just before the marker is drawn.
In some cases this could be handled by modifying the graphics
context before the call to drawMarker
, but doing it
like this makes sure that the graphics context has been assigned
the right colour and position.g
- graphics contextx
- x positiony
- y positionfixer
- hook for modifying the colour (may be null)public void drawErrors(Graphics g, int x, int y, int[] xoffs, int[] yoffs)
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)ErrorRenderer.drawErrors(java.awt.Graphics, int, int, int[], int[])
public void drawErrors(Graphics g, int x, int y, int[] xoffs, int[] yoffs, ColorTweaker fixer)
ColorTweaker
object.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)fixer
- hook for modifying the colour (may be null)ErrorRenderer.drawErrors(java.awt.Graphics, int, int, int[], int[])
public void drawLabel(Graphics g, int x, int y, String label)
g
- graphics contextx
- X coordinate of pointy
- Y coordinate of pointlabel
- text to drawpublic void drawLabel(Graphics g, int x, int y, String label, ColorTweaker fixer)
g
- graphics contextx
- X coordinate of pointy
- Y coordinate of pointlabel
- text to drawfixer
- hook for modifying the colour (may be null)public Icon getLegendIcon()
public Icon getLegendIcon(ErrorMode[] errorModes)
errorModes
- array of error modes, one for each dimensionpublic Icon getIcon(int width, int height)
width
- icon widthheight
- icon heightpublic Pixellator getPixelOffsets()
drawMarker()
methods
in situations where it might be more efficient.
The assumption is that all the pixels are the same colour.public int[] getFlattenedPixelOffsets(int xStride)
xStride
- X dimension of the bufferpublic Pixellator getLabelPixels(String label, int x, int y, Rectangle clip)
label
- text of label to drawx
- X coordinate of point to labely
- Y coordinate of point to labelclip
- clipping region, or nullpublic boolean equals(Object o)
DefaultStyle
o
satisfies the following conditions
otherAtts
object specified at its creation
matches (according to equals()
this one's
equals
in class DefaultStyle
public int hashCode()
hashCode
in class DefaultStyle
public static boolean hasErrors(MarkStyle style, PlotData plotData)
style
- plotting styleplotData
- plotting datapublic static MarkStyle targetStyle()
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.