public class StandardDialScale extends AbstractDialLayer implements DialScale, java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable
DialPlot.| Modifier and Type | Field and Description |
|---|---|
private double |
extent
The extent of the scale display.
|
private boolean |
firstTickLabelVisible
A flag that controls whether or not the first tick label is
displayed.
|
private double |
lowerBound
The minimum data value for the scale.
|
private double |
majorTickIncrement
The increment (in data units) between major tick marks.
|
private double |
majorTickLength
The factor that is subtracted from the tickRadius to determine the
inner point of the major ticks.
|
private java.awt.Paint |
majorTickPaint
The paint to use for major tick marks.
|
private java.awt.Stroke |
majorTickStroke
The stroke to use for major tick marks.
|
private int |
minorTickCount
The number of minor ticks between each major tick.
|
private double |
minorTickLength
The factor that is subtracted from the tickRadius to determine the
inner point of the minor ticks.
|
private java.awt.Paint |
minorTickPaint
The paint to use for minor tick marks.
|
private java.awt.Stroke |
minorTickStroke
The stroke to use for minor tick marks.
|
(package private) static long |
serialVersionUID
For serialization.
|
private double |
startAngle
The start angle for the scale display, in degrees (using the same
encoding as Arc2D).
|
private java.awt.Font |
tickLabelFont
The tick label font.
|
private java.text.NumberFormat |
tickLabelFormatter
The number formatter for the tick labels.
|
private double |
tickLabelOffset
The tick label offset.
|
private java.awt.Paint |
tickLabelPaint
The tick label paint.
|
private boolean |
tickLabelsVisible
A flag that controls whether or not the tick labels are
displayed.
|
private double |
tickRadius
The factor (in the range 0.0 to 1.0) that determines the outside limit
of the tick marks.
|
private double |
upperBound
The maximum data value for the scale.
|
| Constructor and Description |
|---|
StandardDialScale()
Creates a new instance of DialScale.
|
StandardDialScale(double lowerBound,
double upperBound,
double startAngle,
double extent,
double majorTickIncrement,
int minorTickCount)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
double |
angleToValue(double angle)
Converts the given angle to a data value, based on this scale.
|
java.lang.Object |
clone()
Returns a clone of this instance.
|
void |
draw(java.awt.Graphics2D g2,
DialPlot plot,
java.awt.geom.Rectangle2D frame,
java.awt.geom.Rectangle2D view)
Draws the scale on the dial plot.
|
boolean |
equals(java.lang.Object obj)
Tests this
StandardDialScale for equality with an arbitrary
object. |
double |
getExtent()
Returns the extent.
|
boolean |
getFirstTickLabelVisible()
Returns a flag that controls whether or not the first tick label is
visible.
|
double |
getLowerBound()
Returns the lower bound for the scale.
|
double |
getMajorTickIncrement()
Returns the increment (in data units) between major tick labels.
|
double |
getMajorTickLength()
Returns the length factor for the major tick marks.
|
java.awt.Paint |
getMajorTickPaint()
Returns the major tick paint.
|
java.awt.Stroke |
getMajorTickStroke()
Returns the stroke used to draw the major tick marks.
|
int |
getMinorTickCount()
Returns the number of minor tick marks between major tick marks.
|
double |
getMinorTickLength()
Returns the length factor for the minor tick marks.
|
java.awt.Paint |
getMinorTickPaint()
Returns the paint used to draw the minor tick marks.
|
java.awt.Stroke |
getMinorTickStroke()
Returns the stroke used to draw the minor tick marks.
|
double |
getStartAngle()
Returns the start angle for the scale (in degrees using the same
orientation as Java's
Arc2D class). |
java.awt.Font |
getTickLabelFont()
Returns the font used to draw the tick labels.
|
java.text.NumberFormat |
getTickLabelFormatter()
Returns the number formatter used to convert the tick label values to
strings.
|
double |
getTickLabelOffset()
Returns the tick label offset.
|
java.awt.Paint |
getTickLabelPaint()
Returns the paint used to draw the tick labels.
|
boolean |
getTickLabelsVisible()
Returns
true if the tick labels should be displayed,
and false otherwise. |
double |
getTickRadius()
Returns the radius (as a percentage of the maximum space available) of
the outer limit of the tick marks.
|
double |
getUpperBound()
Returns the upper bound for the scale.
|
int |
hashCode()
Returns a hash code for this instance.
|
boolean |
isClippedToWindow()
Returns
true to indicate that this layer should be
clipped within the dial window. |
private void |
readObject(java.io.ObjectInputStream stream)
Provides serialization support.
|
void |
setExtent(double extent)
Sets the extent and sends a
DialLayerChangeEvent to all
registered listeners. |
void |
setFirstTickLabelVisible(boolean visible)
Sets a flag that controls whether or not the first tick label is
visible, and sends a
DialLayerChangeEvent to all registered
listeners. |
void |
setLowerBound(double lower)
Sets the lower bound for the scale and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setMajorTickIncrement(double increment)
Sets the increment (in data units) between major tick labels and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setMajorTickLength(double length)
Sets the length factor for the major tick marks and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setMajorTickPaint(java.awt.Paint paint)
Sets the major tick paint and sends a
DialLayerChangeEvent to
all registered listeners. |
void |
setMajorTickStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the major tick marks and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setMinorTickCount(int count)
Sets the number of minor tick marks between major tick marks and sends
a
DialLayerChangeEvent to all registered listeners. |
void |
setMinorTickLength(double length)
Sets the length factor for the minor tick marks and sends
a
DialLayerChangeEvent to all registered listeners. |
void |
setMinorTickPaint(java.awt.Paint paint)
Sets the paint used to draw the minor tick marks and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setMinorTickStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the minor tick marks and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setStartAngle(double angle)
Sets the start angle for the scale and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setTickLabelFont(java.awt.Font font)
Sets the font used to display the tick labels and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setTickLabelFormatter(java.text.NumberFormat formatter)
Sets the number formatter used to convert the tick label values to
strings, and sends a
DialLayerChangeEvent to all registered
listeners. |
void |
setTickLabelOffset(double offset)
Sets the tick label offset and sends a
DialLayerChangeEvent to
all registered listeners. |
void |
setTickLabelPaint(java.awt.Paint paint)
Sets the paint used to draw the tick labels and sends a
DialLayerChangeEvent to all registered listeners. |
void |
setTickLabelsVisible(boolean visible)
Sets the flag that controls whether or not the tick labels are
displayed, and sends a
DialLayerChangeEvent to all registered
listeners. |
void |
setTickRadius(double radius)
Sets the tick radius and sends a
DialLayerChangeEvent to all
registered listeners. |
void |
setUpperBound(double upper)
Sets the upper bound for the scale and sends a
DialLayerChangeEvent to all registered listeners. |
double |
valueToAngle(double value)
Converts a data value to an angle against this scale.
|
private void |
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.
|
addChangeListener, hasListener, isVisible, notifyListeners, removeChangeListener, setVisiblefinalize, getClass, notify, notifyAll, toString, wait, wait, waitaddChangeListener, hasListener, isVisible, removeChangeListenerstatic final long serialVersionUID
private double lowerBound
private double upperBound
private double startAngle
private double extent
private double tickRadius
private double majorTickIncrement
private double majorTickLength
private transient java.awt.Paint majorTickPaint
private transient java.awt.Stroke majorTickStroke
private int minorTickCount
private double minorTickLength
private transient java.awt.Paint minorTickPaint
private transient java.awt.Stroke minorTickStroke
private double tickLabelOffset
private java.awt.Font tickLabelFont
private boolean tickLabelsVisible
private java.text.NumberFormat tickLabelFormatter
private boolean firstTickLabelVisible
private transient java.awt.Paint tickLabelPaint
public StandardDialScale()
public StandardDialScale(double lowerBound,
double upperBound,
double startAngle,
double extent,
double majorTickIncrement,
int minorTickCount)
lowerBound - the lower bound of the scale.upperBound - the upper bound of the scale.startAngle - the start angle (in degrees, using the same
orientation as Java's Arc2D class).extent - the extent (in degrees, counter-clockwise).majorTickIncrement - the interval between major tick marks (must
be > 0).minorTickCount - the number of minor ticks between major tick
marks.public double getLowerBound()
setLowerBound(double)public void setLowerBound(double lower)
DialLayerChangeEvent to all registered listeners.lower - the lower bound.getLowerBound()public double getUpperBound()
setUpperBound(double)public void setUpperBound(double upper)
DialLayerChangeEvent to all registered listeners.upper - the upper bound.getUpperBound()public double getStartAngle()
Arc2D class).setStartAngle(double)public void setStartAngle(double angle)
DialLayerChangeEvent to all registered listeners.angle - the angle (in degrees).getStartAngle()public double getExtent()
setExtent(double)public void setExtent(double extent)
DialLayerChangeEvent to all
registered listeners.extent - the extent.getExtent()public double getTickRadius()
setTickRadius(double)public void setTickRadius(double radius)
DialLayerChangeEvent to all
registered listeners.radius - the radius.getTickRadius()public double getMajorTickIncrement()
setMajorTickIncrement(double)public void setMajorTickIncrement(double increment)
DialLayerChangeEvent to all registered listeners.increment - the increment (must be > 0).getMajorTickIncrement()public double getMajorTickLength()
setMajorTickLength(double)public void setMajorTickLength(double length)
DialLayerChangeEvent to all registered listeners.length - the length.getMajorTickLength()public java.awt.Paint getMajorTickPaint()
null).setMajorTickPaint(Paint)public void setMajorTickPaint(java.awt.Paint paint)
DialLayerChangeEvent to
all registered listeners.paint - the paint (null not permitted).getMajorTickPaint()public java.awt.Stroke getMajorTickStroke()
null).setMajorTickStroke(Stroke)public void setMajorTickStroke(java.awt.Stroke stroke)
DialLayerChangeEvent to all registered listeners.stroke - the stroke (null not permitted).getMajorTickStroke()public int getMinorTickCount()
setMinorTickCount(int)public void setMinorTickCount(int count)
DialLayerChangeEvent to all registered listeners.count - the count.getMinorTickCount()public double getMinorTickLength()
setMinorTickLength(double)public void setMinorTickLength(double length)
DialLayerChangeEvent to all registered listeners.length - the length.getMinorTickLength()public java.awt.Paint getMinorTickPaint()
null).setMinorTickPaint(Paint)public void setMinorTickPaint(java.awt.Paint paint)
DialLayerChangeEvent to all registered listeners.paint - the paint (null not permitted).getMinorTickPaint()public java.awt.Stroke getMinorTickStroke()
null).setMinorTickStroke(Stroke)public void setMinorTickStroke(java.awt.Stroke stroke)
DialLayerChangeEvent to all registered listeners.stroke - the stroke (null not permitted).getMinorTickStroke()public double getTickLabelOffset()
setTickLabelOffset(double)public void setTickLabelOffset(double offset)
DialLayerChangeEvent to
all registered listeners.offset - the offset.getTickLabelOffset()public java.awt.Font getTickLabelFont()
null).setTickLabelFont(Font)public void setTickLabelFont(java.awt.Font font)
DialLayerChangeEvent to all registered listeners.font - the font (null not permitted).getTickLabelFont()public java.awt.Paint getTickLabelPaint()
null not permitted).setTickLabelPaint(Paint)public void setTickLabelPaint(java.awt.Paint paint)
DialLayerChangeEvent to all registered listeners.paint - the paint (null not permitted).public boolean getTickLabelsVisible()
true if the tick labels should be displayed,
and false otherwise.setTickLabelsVisible(boolean)public void setTickLabelsVisible(boolean visible)
DialLayerChangeEvent to all registered
listeners.visible - the new flag value.getTickLabelsVisible()public java.text.NumberFormat getTickLabelFormatter()
null).setTickLabelFormatter(NumberFormat)public void setTickLabelFormatter(java.text.NumberFormat formatter)
DialLayerChangeEvent to all registered
listeners.formatter - the formatter (null not permitted).getTickLabelFormatter()public boolean getFirstTickLabelVisible()
setFirstTickLabelVisible(boolean)public void setFirstTickLabelVisible(boolean visible)
DialLayerChangeEvent to all registered
listeners.visible - the new flag value.getFirstTickLabelVisible()public boolean isClippedToWindow()
true to indicate that this layer should be
clipped within the dial window.isClippedToWindow in interface DialLayertrue.public void draw(java.awt.Graphics2D g2,
DialPlot plot,
java.awt.geom.Rectangle2D frame,
java.awt.geom.Rectangle2D view)
draw in interface DialLayerg2 - the graphics target (null not permitted).plot - the dial plot (null not permitted).frame - the reference frame that is used to construct the
geometry of the plot (null not permitted).view - the visible part of the plot (null not
permitted).public double valueToAngle(double value)
valueToAngle in interface DialScalevalue - the data value.angleToValue(double)public double angleToValue(double angle)
angleToValue in interface DialScaleangle - the angle (in degrees).valueToAngle(double)public boolean equals(java.lang.Object obj)
StandardDialScale for equality with an arbitrary
object.equals in class AbstractDialLayerobj - the object (null permitted).public int hashCode()
hashCode in class AbstractDialLayerpublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface org.jfree.util.PublicCloneableclone in class AbstractDialLayerjava.lang.CloneNotSupportedException - if this instance is not cloneable.private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
stream - the output stream.java.io.IOException - if there is an I/O error.private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
stream - the input stream.java.io.IOException - if there is an I/O error.java.lang.ClassNotFoundException - if there is a classpath problem.