com.ijchart.xychart.shape
Class MeterArcChartShape

java.lang.Object
  extended by com.ijchart.xychart.shape.AbstractChartShape
      extended by com.ijchart.xychart.shape.MeterArcChartShape
All Implemented Interfaces:
IChartShapeChangeListener, IChartShape, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class MeterArcChartShape
extends AbstractChartShape
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

A arc shape for meter chart.Note:Some super class method does not affect graphics

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static java.awt.Paint DEFAULT_ARC_BORDER_PAINT
           The paint used to draw border.
static double DEFAULT_BORDER_SIZE
           The default border size.
static boolean DEFAULT_DRAW_RADIUS
           A default boolean flag controls whether or not draw arc radius.
static boolean DEFAULT_DRAW_TICK
           A default flag that controls whether or not the tick is drawn.
static boolean DEFAULT_DRAW_TICK_LABEL
           A default flag that controls whether or not the tick label is drawn.
static java.awt.Font DEFAULT_TICK_LABEL_FONT
           The font used to draw tick label.
static java.text.NumberFormat DEFAULT_TICK_LABEL_FORMAT
           The default tick label format.
static java.awt.Paint DEFAULT_TICK_LABEL_PAINT
           The paint used to draw tick label.
static double DEFAULT_TICK_LENGTH
           The default tick length.
static java.awt.Paint DEFAULT_TICK_PAINT
           The default paint used to draw ticks.
static java.awt.Stroke DEFAULT_TICK_STROKE
           The default stroke used to draw ticks.
 
Fields inherited from class com.ijchart.xychart.shape.AbstractChartShape
DEFAULT_DRAW_TYPE, DEFAULT_SHAPE_ID, DEFAULT_VISIBLE, transformedShape
 
Fields inherited from interface com.ijchart.xychart.shape.IChartShape
DEFAULT_BORDER_PAINT, DEFAULT_BORDER_STROKE, DEFAULT_CONTENT_PAINT, DEFAULT_DRAW_BORDER, DEFAULT_FILL_ALPHA, DEFAULT_FILL_PAINT, DEFAULT_FILL_SHAPE, DEFAULT_GRADIENT_PAINT_TRANSFORM_TYPE, DEFAULT_MARGIN, DEFAULT_SELECT_FILL_PAINT, DEFAULT_SELECT_RECT_ALPHA, DEFAULT_SELECT_RECT_WIDTH, DEFAULT_SELECTED, DEFAULT_TEXT_FONT, DEFAULT_TOOLTIP_SHAPE_WIDTH, HOTSPOT_TYPE_CIRCLE, HOTSPOT_TYPE_POLYGON, HOTSPOT_TYPE_RECTANGLE
 
Constructor Summary
MeterArcChartShape(java.awt.geom.Arc2D arc)
           A constructor.
MeterArcChartShape(java.awt.geom.Arc2D arc, double startTickAngle, double tickAngleSize, java.lang.Number[] tickLabels)
           A constructor.
 
Method Summary
protected  void calculateTransformedShape()
           Calculate the transformed shape.
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void draw(java.awt.Graphics2D g2)
           Draw the ChartShape on a Java 2d graphics device(such as the screen or the printer).
protected  void drawSelect(java.awt.Graphics2D g2)
           Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer).
 boolean equals(java.lang.Object obj)
           Indicates whether some other object is "equal to" this one.
 java.awt.geom.Arc2D getArc()
           Returns the arc shape.
 double getBorderSize()
           Returns the border size.
protected  java.awt.Shape getHotspotShape()
           Returns the hotspot shape.
 java.awt.geom.Point2D getLockPoint()
           Returns the lock coordinates of this shape.
 ShapeType getShapeType()
           The type for describe this shape.
 double getStartTickAngle()
           Returns the start angle for draw tick.
 java.awt.Font getTickLabelFont()
           Returns the font used to draw tick label.
 java.text.NumberFormat getTickLabelFormat()
           Returns the tick label format.
 java.awt.Paint getTickLabelPaint()
           Returns the paint used to draw tick label.
 java.lang.Number[] getTickLabels()
           Returns the array of tick labels.
 java.util.Collection getTickLabelShapes()
           Returns the list of tick label shapes and is unmodifiable.
 double getTickLength()
           Returns the tick length.
 java.util.Collection getTickLineShapes()
           Returns the list of tick line shapes and is unmodifiable.
 java.awt.Paint getTickPaint()
           Returns the paint used to draw ticks.
 double getTickSizeAngle()
           Returns the tick size (measured in degree).
 java.awt.Stroke getTickStroke()
           Returns the stroke used to draw ticks.
 java.awt.geom.Point2D getTopLeftPoint()
           Returns the top left corner coordinates of this shape.
 int hashCode()
           Returns a hash code value for the object.
 boolean isDrawRadius()
           A boolean flag controls whether or not draw arc radius.
 boolean isDrawTick()
           A flag that controls whether or not the tick is drawn.
 boolean isDrawTickLabel()
           A flag that controls whether or not the tick label is drawn.
 void setArc(java.awt.geom.Arc2D arc)
           Sets the arc shape,and sends a ChartShapeChangeEvent to all registered listeners.
 void setBorderSize(double size)
           Sets the border size,and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawRadius(boolean flag)
           A boolean flag controls whether or not draw arc radius,and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawTick(boolean flag)
           A flag that controls whether or not the tick is drawn,and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawTickLabel(boolean flag)
           A flag that controls whether or not the tick label is drawn,and sends a ChartShapeChangeEvent to all registered listeners.
 void setStartTickAngle(double angle)
           Sets the start angle for draw tick,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickLabelFont(java.awt.Font font)
           Sets the font used to draw tick label,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickLabelFormat(java.text.NumberFormat format)
           Sets the tick label format,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickLabelPaint(java.awt.Paint paint)
           Sets the paint used to draw tick label,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickLabels(java.lang.Number[] labels)
           Sets the array of tick labels,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickLength(double length)
           Sets the tick length,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickPaint(java.awt.Paint paint)
           Sets the paint used to draw ticks,and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickSizeAngle(double size)
           Sets the tick size (measured in degree),and sends a ChartShapeChangeEvent to all registered listeners.
 void setTickStroke(java.awt.Stroke stroke)
           Sets the stroke used to draw ticks,and sends a ChartShapeChangeEvent to all registered listeners.
 void translate(double tx, double ty)
           Concatenates the current Graphics2D Transform with a translation transform.and sends a ChartShapeChangeEvent to all registered listeners.
 
Methods inherited from class com.ijchart.xychart.shape.AbstractChartShape
addChangeListener, afterDraw, beforeDraw, chartShapeChanged, contains, contains, drawAnchorByPoints, drawBackground, drawBorder, drawShapeBorder, fillShape, fireChartShapeChanged, forceChartShapeChanged, getBorderPaint, getBorderStroke, getBound, getData, getFillAlpha, getFillPaint, getGradientPaintTransformType, getHotspotPolyCoords, getHotspotType, getHotspotType, getId, getMargin, getOriginTooltipShape, getRotate, getSelectAnchorPaint, getSelectRectAlpha, getSelectRectWidth, getShapeChange, getShapeDrawType, getTooltipShape, getTooltipShapeRotate, getTooltipShapeTranslatePoint, getTooltipText, getURL, hasListener, isDrawBorder, isFillShape, isSelected, isVisible, notifyListeners, removeAllChangeListener, removeChangeListener, setBorderPaint, setBorderStroke, setData, setDrawBorder, setFillAlpha, setFillPaint, setFillShape, setGradientPaintTransformType, setId, setMargin, setOriginTooltipShape, setRotate, setSelectAnchorPaint, setSelected, setSelectRectAlpha, setSelectRectWidth, setShapeChange, setShapeDrawType, setTooltipText, setURL, setVisible
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DRAW_RADIUS

public static final boolean DEFAULT_DRAW_RADIUS
A default boolean flag controls whether or not draw arc radius.

See Also:
Constant Field Values

DEFAULT_DRAW_TICK_LABEL

public static final boolean DEFAULT_DRAW_TICK_LABEL
A default flag that controls whether or not the tick label is drawn.

See Also:
Constant Field Values

DEFAULT_DRAW_TICK

public static final boolean DEFAULT_DRAW_TICK
A default flag that controls whether or not the tick is drawn.

See Also:
Constant Field Values

DEFAULT_TICK_LENGTH

public static final double DEFAULT_TICK_LENGTH
The default tick length.

See Also:
Constant Field Values

DEFAULT_TICK_PAINT

public static final java.awt.Paint DEFAULT_TICK_PAINT
The default paint used to draw ticks.


DEFAULT_TICK_STROKE

public static final java.awt.Stroke DEFAULT_TICK_STROKE
The default stroke used to draw ticks.


DEFAULT_TICK_LABEL_FONT

public static final java.awt.Font DEFAULT_TICK_LABEL_FONT
The font used to draw tick label.


DEFAULT_TICK_LABEL_PAINT

public static final java.awt.Paint DEFAULT_TICK_LABEL_PAINT
The paint used to draw tick label.


DEFAULT_BORDER_SIZE

public static final double DEFAULT_BORDER_SIZE
The default border size.

See Also:
Constant Field Values

DEFAULT_TICK_LABEL_FORMAT

public static final java.text.NumberFormat DEFAULT_TICK_LABEL_FORMAT
The default tick label format.


DEFAULT_ARC_BORDER_PAINT

public static final java.awt.Paint DEFAULT_ARC_BORDER_PAINT
The paint used to draw border.

Constructor Detail

MeterArcChartShape

public MeterArcChartShape(java.awt.geom.Arc2D arc)
A constructor.

Parameters:
arc - Arc2D A arc shape (null not permitted).

MeterArcChartShape

public MeterArcChartShape(java.awt.geom.Arc2D arc,
                          double startTickAngle,
                          double tickAngleSize,
                          java.lang.Number[] tickLabels)
A constructor.

Parameters:
arc - Arc2D A arc shape (null not permitted).
startTickAngle - double The start angle for draw tick (measured in degree).
tickAngleSize - double The tick size (measured in degree).
tickLabels - Number[] The array of tick labels (null permitted).
Method Detail

getArc

public java.awt.geom.Arc2D getArc()
Returns the arc shape.

Returns:
Arc2D The arc shape (never null).

setArc

public void setArc(java.awt.geom.Arc2D arc)
Sets the arc shape,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
arc - Arc2D The arc shape (null not permitted).

getBorderSize

public double getBorderSize()
Returns the border size.

Returns:
double The border size.

setBorderSize

public void setBorderSize(double size)
Sets the border size,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
size - double The border size.

isDrawRadius

public boolean isDrawRadius()
A boolean flag controls whether or not draw arc radius.

Returns:
boolean A boolean.

setDrawRadius

public void setDrawRadius(boolean flag)
A boolean flag controls whether or not draw arc radius,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

isDrawTick

public boolean isDrawTick()
A flag that controls whether or not the tick is drawn.

Returns:
boolean A boolean.

setDrawTick

public void setDrawTick(boolean flag)
A flag that controls whether or not the tick is drawn,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

isDrawTickLabel

public boolean isDrawTickLabel()
A flag that controls whether or not the tick label is drawn.

Returns:
boolean A boolean.

setDrawTickLabel

public void setDrawTickLabel(boolean flag)
A flag that controls whether or not the tick label is drawn,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

getStartTickAngle

public double getStartTickAngle()
Returns the start angle for draw tick.

Returns:
double The angle.

setStartTickAngle

public void setStartTickAngle(double angle)
Sets the start angle for draw tick,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
angle - double The angle.

getTickLabelFont

public java.awt.Font getTickLabelFont()
Returns the font used to draw tick label.

Returns:
Font The font.

setTickLabelFont

public void setTickLabelFont(java.awt.Font font)
Sets the font used to draw tick label,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
font - Font The font (null not permitted).

getTickLabelFormat

public java.text.NumberFormat getTickLabelFormat()
Returns the tick label format.

Returns:
NumberFormat The number format object.

setTickLabelFormat

public void setTickLabelFormat(java.text.NumberFormat format)
Sets the tick label format,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
format - NumberFormat The number format object (null permitted).

getTickLabelPaint

public java.awt.Paint getTickLabelPaint()
Returns the paint used to draw tick label.

Returns:
Paint The paint (never null).

setTickLabelPaint

public void setTickLabelPaint(java.awt.Paint paint)
Sets the paint used to draw tick label,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
paint - Paint The paint (null not permitted).

getTickLabels

public java.lang.Number[] getTickLabels()
Returns the array of tick labels.

Returns:
Number[] The array of tick labels (maybe null).

setTickLabels

public void setTickLabels(java.lang.Number[] labels)
Sets the array of tick labels,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
labels - Number[] The array of tick labels (null permitted).

getTickLength

public double getTickLength()
Returns the tick length.

Returns:
double The tick length.

setTickLength

public void setTickLength(double length)
Sets the tick length,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
length - double The tick length (must be greater than 0).

getTickPaint

public java.awt.Paint getTickPaint()
Returns the paint used to draw ticks.

Returns:
Paint The paint (never null).

setTickPaint

public void setTickPaint(java.awt.Paint paint)
Sets the paint used to draw ticks,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
paint - Paint The paint (null not permitted).

getTickSizeAngle

public double getTickSizeAngle()
Returns the tick size (measured in degree).

Returns:
double The tick size.

setTickSizeAngle

public void setTickSizeAngle(double size)
Sets the tick size (measured in degree),and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
size - double The tick size (must be greater than 0).

getTickStroke

public java.awt.Stroke getTickStroke()
Returns the stroke used to draw ticks.

Returns:
Stroke The stroke (never null).

setTickStroke

public void setTickStroke(java.awt.Stroke stroke)
Sets the stroke used to draw ticks,and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
stroke - Stroke The stroke (null not permitted).

getTickLineShapes

public java.util.Collection getTickLineShapes()
Returns the list of tick line shapes and is unmodifiable.

Returns:
Collection The collection of shapes (never null).

getTickLabelShapes

public java.util.Collection getTickLabelShapes()
Returns the list of tick label shapes and is unmodifiable.

Returns:
Collection The collection of shapes (never null).

draw

public void draw(java.awt.Graphics2D g2)
Draw the ChartShape on a Java 2d graphics device(such as the screen or the printer). The shape's coordinate is ignored.

Specified by:
draw in interface IChartShape
Parameters:
g2 - Graphics2D The graphics device (such as the screen or the printer) (null not permitted).

drawSelect

protected void drawSelect(java.awt.Graphics2D g2)
Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer).

Specified by:
drawSelect in class AbstractChartShape
Parameters:
g2 - Graphics2D The graphics device (such as the screen or the printer) (null not permitted).

calculateTransformedShape

protected void calculateTransformedShape()
Calculate the transformed shape.

Specified by:
calculateTransformedShape in class AbstractChartShape

translate

public void translate(double tx,
                      double ty)
Concatenates the current Graphics2D Transform with a translation transform.and sends a ChartShapeChangeEvent to all registered listeners. Subsequent rendering is translated by the specified distance relative to the previous position. This is equivalent to calling transform(T), where T is an AffineTransform represented by the following matrix:
                [   1    0    tx  ]
                [   0    1    ty  ]
                [   0    0    1   ]
 
.

Specified by:
translate in interface IChartShape
Parameters:
tx - double The distance to translate along the x-axis.
ty - double The distance to translate along the y-axis.

getTopLeftPoint

public java.awt.geom.Point2D getTopLeftPoint()
Returns the top left corner coordinates of this shape.

Specified by:
getTopLeftPoint in interface IChartShape
Returns:
Point2D The coordinate.

getLockPoint

public java.awt.geom.Point2D getLockPoint()
Returns the lock coordinates of this shape.

Specified by:
getLockPoint in interface IChartShape
Overrides:
getLockPoint in class AbstractChartShape
Returns:
Point2D The coordinate.

getHotspotShape

protected java.awt.Shape getHotspotShape()
Returns the hotspot shape.

Specified by:
getHotspotShape in class AbstractChartShape
Returns:
Shape The hotspot shape (maybe null).

getShapeType

public ShapeType getShapeType()
The type for describe this shape.

Specified by:
getShapeType in interface IChartShape
Returns:
ShapeType The constant value in class ShapeType.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class AbstractChartShape
Returns:
int A hash code value for this object.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class AbstractChartShape
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class AbstractChartShape
Returns:
object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.