public abstract class DefaultStyle extends Object implements Style
otherAtts
attribute
characterises everything apart from colour, stroke and class which
distinguish one instance of this class from another, and
is used by the equals(java.lang.Object)
implementation to determine object equality.
otherAtts
probably ought to be immutable.Modifier | Constructor and Description |
---|---|
protected |
DefaultStyle(Color color,
Object otherAtts)
Constructs a style given a colour, style and
otherAtts
object. |
Modifier and Type | Method and Description |
---|---|
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
|
Color |
getColor()
Returns the colour of this style.
|
float[] |
getDash()
Returns the dash pattern associated with this style.
|
int |
getLineWidth()
Returns the line width associated with this style.
|
Object |
getOtherAtts()
Returns the object which distinguishes this object from other ones
of the same colour and class.
|
Stroke |
getStroke(int cap,
int join)
Returns a stroke suitable for drawing lines in this style.
|
static Stroke |
getStroke(Stroke stroke,
int cap,
int join)
Returns a stroke which resembles a given template but has specified
end cap and line join policies.
|
int |
hashCode() |
void |
setColor(Color color)
Sets the colour of this style.
|
void |
setDash(float[] dash)
Sets the dash pattern associated with this style.
|
void |
setLineWidth(int width)
Sets the line width associated with this style.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getLegendIcon
public void setColor(Color color)
color
- new colourpublic Color getColor()
public void setLineWidth(int width)
width
- line width (>=1)public int getLineWidth()
public void setDash(float[] dash)
BasicStroke
,
except that it is multiplied by the line width before use.
May be null for a solid line.dash
- dash arraypublic float[] getDash()
public Stroke getStroke(int cap, int join)
cap
- one of BasicStroke
's CAP_* constantsjoin
- one of BasicStroke
's JOIN_* constantspublic Object getOtherAtts()
public boolean equals(Object o)
o
satisfies the following conditions
otherAtts
object specified at its creation
matches (according to equals()
this one's
public static Stroke getStroke(Stroke stroke, int cap, int join)
stroke
- template strokecap
- one of BasicStroke
's CAP_* constantsjoin
- one of BasicStroke
's JOIN_* constantsCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.