public abstract class DefaultStyle extends java.lang.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(java.awt.Color color,
java.lang.Object otherAtts)
Constructs a style given a colour, style and
otherAtts
object. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.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
|
java.awt.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.
|
java.lang.Object |
getOtherAtts()
Returns the object which distinguishes this object from other ones
of the same colour and class.
|
java.awt.Stroke |
getStroke(int cap,
int join)
Returns a stroke suitable for drawing lines in this style.
|
static java.awt.Stroke |
getStroke(java.awt.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(java.awt.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.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getLegendIcon
protected DefaultStyle(java.awt.Color color, java.lang.Object otherAtts)
otherAtts
object.color
- initial colourotherAtts
- object distinguishing this instancepublic void setColor(java.awt.Color color)
color
- new colourpublic java.awt.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 java.awt.Stroke getStroke(int cap, int join)
cap
- one of BasicStroke
's CAP_* constantsjoin
- one of BasicStroke
's JOIN_* constantspublic java.lang.Object getOtherAtts()
public boolean equals(java.lang.Object o)
o
satisfies the following conditions
otherAtts
object specified at its creation
matches (according to equals()
this one's
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static java.awt.Stroke getStroke(java.awt.Stroke stroke, int cap, int join)
stroke
- template strokecap
- one of BasicStroke
's CAP_* constantsjoin
- one of BasicStroke
's JOIN_* constantsCopyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.