|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot.DefaultStyle
public abstract class DefaultStyle
Convenience partial implementation of Style which has a defined colour
and stroke style, with other attributes given by a single object.
The 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.
Constructor Summary | |
---|---|
protected |
DefaultStyle(Color color,
Object otherAtts)
Constructs a style given a colour, style and otherAtts
object. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface uk.ac.starlink.ttools.plot.Style |
---|
getLegendIcon |
Constructor Detail |
---|
protected DefaultStyle(Color color, Object otherAtts)
otherAtts
object.
color
- initial colourotherAtts
- object distinguishing this instanceMethod Detail |
---|
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_* constants
public 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
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public static Stroke getStroke(Stroke stroke, int cap, int join)
stroke
- template strokecap
- one of BasicStroke
's CAP_* constantsjoin
- one of BasicStroke
's JOIN_* constants
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |