com.jfimagine.jfgraph.shape.decorate
Class Arrow

java.lang.Object
  |
  +--com.jfimagine.jfgraph.shape.base.AbstractObject
        |
        +--com.jfimagine.jfgraph.shape.decorate.Arrow
All Implemented Interfaces:
java.lang.Cloneable

public class Arrow
extends AbstractObject

Arrow class. An arrow class is used for any line or curve shapes.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static int ARROWSIZE
          An minimum arrow size
static int ARROWSIZE_ROTATE
          a rotate sign size.
static int ARROWTYPE_CIRCLE
          A solid small circle on the end of line.
static int ARROWTYPE_CIRCLE_EMPTY
          An empty small circle on the end of line.
static int ARROWTYPE_CIRCLE_EMPTY_VLINE
          An arrow type with one small circle and one vertical line on the end of line.
static int ARROWTYPE_CIRCLE_TRIANGLELINES_REVERSED
          An arrow type with one small circle and two reversed inclined lines on the end of line.
static int ARROWTYPE_DIAMOND_CIRCLE
          An empty diamond and a solid small circle on the end of line.
static int ARROWTYPE_DIAMOND_CIRCLE_EMPTY
          An empty diamond and an empty small circle on the end of line.
static int ARROWTYPE_DIAMOND_EMPTY
          An empty diamond on the end of line.
static int ARROWTYPE_LINE_INCLINED
          An arrow type with one inclined line on the end of a line.
static int ARROWTYPE_LINE_INCLINED_INTERSECT
          An arrow type with one inclined line on the end of a line, but intersects it.
static int ARROWTYPE_NONE
          An empty arrow type.
static int ARROWTYPE_RECTANGLE
          A solid small rectangle on the end of line.
static int ARROWTYPE_RECTANGLE_EMPTY
          An empty small rectangle on the end of line.
static int ARROWTYPE_TRIANGLE
          A solid triangle arrow type.
static int ARROWTYPE_TRIANGLE_EMPTY
          An empty triangle arrow type.
static int ARROWTYPE_TRIANGLE_TRIANGLE
          A two solid triangles on the end of line.
static int ARROWTYPE_TRIANGLE_TRIANGLE_EMPTY
          An two empty triangles on the end of line.
static int ARROWTYPE_TRIANGLELINES
          An arrow type with two inclined lines constructed an arrow.
static int ARROWTYPE_TRIANGLELINES_REVERSED
          An arrow type with two reversed inclined lines on the end of line.
static int ARROWTYPE_TRIANGLELINES_TRIANGLELINES
          An arrow type with 2 x 2 inclined lines constructed an arrow.
static int ARROWTYPE_VLINE
          An arrow type with one vertical line on the end of line.
static int ARROWTYPE_VLINE_CIRCLE
          An arrow type with one vertical line and one small solid circle on the end of line.
static int ARROWTYPE_VLINE_CIRCLE_EMPTY
          An arrow type with one vertical line and one small empty circle on the end of line.
static int ARROWTYPE_VLINE_TRIANGLELINES
          An arrow type with one vertical line and two inclined lines constructed an arrow.
static int ARROWTYPE_VLINE_TRIANGLELINES_REVERSED
          An arrow type with one vertical line and two reversed inclined lines on the end of line.
static int ARROWTYPE_VLINE_TRIANGLELINES_TRIANGLELINES
          An arrow type with one vertical line and 2 x 2 inclined lines constructed an arrow.
static int ARROWTYPE_VLINE_VLINE
          An arrow type with two vertical lines on the end of line.
static int ARROWTYPE_VLINE_VLINE_CIRCLE
          An arrow type with two vertical lines and one small solid circle on the end of line.
static int ARROWTYPE_VLINE_VLINE_CIRCLE_EMPTY
          An arrow type with two vertical lines and one small empty circle on the end of line.
static int ARROWTYPE_VLINE_VLINE_VLINE
          An arrow type with three vertical lines on the end of line.
static int ARROWTYPE_VLINE_VLINE_VLINE_CIRCLE
          An arrow type with three vertical lines and one small solid circle on the end of line.
static int ARROWTYPE_VLINE_VLINE_VLINE_CIRCLE_EMPTY
          An arrow type with three vertical lines and one small empty circle on the end of line.
static java.lang.String XML_ARROW
          A XML string tag represents an arrow format.
static java.lang.String XML_ENDARROW
          A XML string tag represents the arrow type of end point of a line/curve.
static java.lang.String XML_STARTARROW
          A XML string tag represents the arrow type of begin point of a line/curve.
 
Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
m_lastError, XML_OBJECTID, XML_OBJECTTYPE
 
Constructor Summary
Arrow()
          Constructor of Arrow.
Arrow(Arrow arrow)
          Constructor of Arrow.
 
Method Summary
protected  void appendChildToDOM(Element element, JFVersion version)
          Append necessary xml child for current element, this method will be called internally by toDOM.
 java.lang.Object clone()
          Creates a new object of the same class and with the same contents as this object.
protected  AbstractObject cloneMe()
          Creates a new AbstractObject of the same class and with the same contents as this object.
static void drawArrow(int arrowType, int lineWidth, JFPoint startPoint, JFPoint endPoint, java.awt.Graphics g, java.awt.Color c)
          arrow type of this arrow
static void drawRotateArrow(double x, double y, java.awt.Graphics g)
          Draw a rotate arrow sign.
 boolean equals(java.lang.Object obj)
          Determines whether or not two objects are equal.
protected  void extractChildFromDOM(Element element, JFVersion version)
          Extract needed xml child from current element, this method will be called internally by fromDOM.
static double getArrowOccupiedSize(int arrowType, int lineWidth)
          Get an arrow occupied size on one end of line.
static Arrow getDefaultArrow()
          get global default arrow
 int getEndArrow()
          Get end arrow type.
 int getStartArrow()
          Get start arrow type.
 int hashCode()
          Returns the hashcode for this Object.
 void loadFromStream(JFReader stream, boolean skipHead, JFVersion version)
          Load object data from a binary stream
 void saveToStream(JFWriter stream, JFVersion version)
          Save this object to a binary stream
static void setDefaultArrow(Arrow arrow)
          set global default arrow
 void setEndArrow(int arrow)
          Set end arrow type.
 void setStartArrow(int arrow)
          Set start arrow type.
 void setValue(Arrow arrow)
          Set the value of this arrow.
 java.lang.String toString()
          Convert this object to String
 
Methods inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject
fromDOM, getLastError, getMaxObjectId, getObjectId, getObjectType, getXMLTag, getZoomScale, isShowDesign, setLastError, setObjectId, setObjectType, setShowDesign, setValue, setXMLTag, setZoomScale, toDOM
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_ARROW

public static final java.lang.String XML_ARROW
A XML string tag represents an arrow format.

See Also:
Constant Field Values

XML_STARTARROW

public static final java.lang.String XML_STARTARROW
A XML string tag represents the arrow type of begin point of a line/curve.

See Also:
Constant Field Values

XML_ENDARROW

public static final java.lang.String XML_ENDARROW
A XML string tag represents the arrow type of end point of a line/curve.

See Also:
Constant Field Values

ARROWTYPE_NONE

public static final int ARROWTYPE_NONE
An empty arrow type.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLE

public static final int ARROWTYPE_TRIANGLE
A solid triangle arrow type.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLE_EMPTY

public static final int ARROWTYPE_TRIANGLE_EMPTY
An empty triangle arrow type.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLELINES

public static final int ARROWTYPE_TRIANGLELINES
An arrow type with two inclined lines constructed an arrow.

See Also:
Constant Field Values

ARROWTYPE_LINE_INCLINED

public static final int ARROWTYPE_LINE_INCLINED
An arrow type with one inclined line on the end of a line.

See Also:
Constant Field Values

ARROWTYPE_LINE_INCLINED_INTERSECT

public static final int ARROWTYPE_LINE_INCLINED_INTERSECT
An arrow type with one inclined line on the end of a line, but intersects it.

See Also:
Constant Field Values

ARROWTYPE_CIRCLE_EMPTY

public static final int ARROWTYPE_CIRCLE_EMPTY
An empty small circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_CIRCLE

public static final int ARROWTYPE_CIRCLE
A solid small circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_RECTANGLE_EMPTY

public static final int ARROWTYPE_RECTANGLE_EMPTY
An empty small rectangle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_RECTANGLE

public static final int ARROWTYPE_RECTANGLE
A solid small rectangle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_DIAMOND_EMPTY

public static final int ARROWTYPE_DIAMOND_EMPTY
An empty diamond on the end of line.

See Also:
Constant Field Values

ARROWTYPE_DIAMOND_CIRCLE_EMPTY

public static final int ARROWTYPE_DIAMOND_CIRCLE_EMPTY
An empty diamond and an empty small circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_DIAMOND_CIRCLE

public static final int ARROWTYPE_DIAMOND_CIRCLE
An empty diamond and a solid small circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLELINES_REVERSED

public static final int ARROWTYPE_TRIANGLELINES_REVERSED
An arrow type with two reversed inclined lines on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_TRIANGLELINES_REVERSED

public static final int ARROWTYPE_VLINE_TRIANGLELINES_REVERSED
An arrow type with one vertical line and two reversed inclined lines on the end of line.

See Also:
Constant Field Values

ARROWTYPE_CIRCLE_TRIANGLELINES_REVERSED

public static final int ARROWTYPE_CIRCLE_TRIANGLELINES_REVERSED
An arrow type with one small circle and two reversed inclined lines on the end of line.

See Also:
Constant Field Values

ARROWTYPE_CIRCLE_EMPTY_VLINE

public static final int ARROWTYPE_CIRCLE_EMPTY_VLINE
An arrow type with one small circle and one vertical line on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE

public static final int ARROWTYPE_VLINE
An arrow type with one vertical line on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_VLINE

public static final int ARROWTYPE_VLINE_VLINE
An arrow type with two vertical lines on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_VLINE_VLINE

public static final int ARROWTYPE_VLINE_VLINE_VLINE
An arrow type with three vertical lines on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_CIRCLE_EMPTY

public static final int ARROWTYPE_VLINE_CIRCLE_EMPTY
An arrow type with one vertical line and one small empty circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_VLINE_CIRCLE_EMPTY

public static final int ARROWTYPE_VLINE_VLINE_CIRCLE_EMPTY
An arrow type with two vertical lines and one small empty circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_VLINE_VLINE_CIRCLE_EMPTY

public static final int ARROWTYPE_VLINE_VLINE_VLINE_CIRCLE_EMPTY
An arrow type with three vertical lines and one small empty circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_CIRCLE

public static final int ARROWTYPE_VLINE_CIRCLE
An arrow type with one vertical line and one small solid circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_VLINE_CIRCLE

public static final int ARROWTYPE_VLINE_VLINE_CIRCLE
An arrow type with two vertical lines and one small solid circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_VLINE_VLINE_VLINE_CIRCLE

public static final int ARROWTYPE_VLINE_VLINE_VLINE_CIRCLE
An arrow type with three vertical lines and one small solid circle on the end of line.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLE_TRIANGLE

public static final int ARROWTYPE_TRIANGLE_TRIANGLE
A two solid triangles on the end of line.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLE_TRIANGLE_EMPTY

public static final int ARROWTYPE_TRIANGLE_TRIANGLE_EMPTY
An two empty triangles on the end of line.

See Also:
Constant Field Values

ARROWTYPE_TRIANGLELINES_TRIANGLELINES

public static final int ARROWTYPE_TRIANGLELINES_TRIANGLELINES
An arrow type with 2 x 2 inclined lines constructed an arrow.

See Also:
Constant Field Values

ARROWTYPE_VLINE_TRIANGLELINES

public static final int ARROWTYPE_VLINE_TRIANGLELINES
An arrow type with one vertical line and two inclined lines constructed an arrow.

See Also:
Constant Field Values

ARROWTYPE_VLINE_TRIANGLELINES_TRIANGLELINES

public static final int ARROWTYPE_VLINE_TRIANGLELINES_TRIANGLELINES
An arrow type with one vertical line and 2 x 2 inclined lines constructed an arrow.

See Also:
Constant Field Values

ARROWSIZE

public static final int ARROWSIZE
An minimum arrow size

See Also:
Constant Field Values

ARROWSIZE_ROTATE

public static final int ARROWSIZE_ROTATE
a rotate sign size.

See Also:
Constant Field Values
Constructor Detail

Arrow

public Arrow()
Constructor of Arrow.


Arrow

public Arrow(Arrow arrow)
Constructor of Arrow.

Method Detail

setDefaultArrow

public static void setDefaultArrow(Arrow arrow)
set global default arrow


getDefaultArrow

public static Arrow getDefaultArrow()
get global default arrow

Returns:
The global default arrow

getStartArrow

public int getStartArrow()
Get start arrow type.

Returns:
start arrow type.

setStartArrow

public void setStartArrow(int arrow)
Set start arrow type.

Parameters:
arrow - start arrow type.

getEndArrow

public int getEndArrow()
Get end arrow type.

Returns:
end arrow type.

setEndArrow

public void setEndArrow(int arrow)
Set end arrow type.

Parameters:
arrow - end arrow type.

setValue

public void setValue(Arrow arrow)
Set the value of this arrow.

Parameters:
arrow - A new arrow value.

toString

public java.lang.String toString()
Convert this object to String

Overrides:
toString in class AbstractObject
Returns:
An string represents the content of the object

cloneMe

protected AbstractObject cloneMe()
                          throws java.lang.CloneNotSupportedException
Creates a new AbstractObject of the same class and with the same contents as this object. This method implements the method defined in AbstractObject.

Specified by:
cloneMe in class AbstractObject
Returns:
A clone of this class.
java.lang.CloneNotSupportedException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class AbstractObject
Returns:
A clone of this instance.
java.lang.CloneNotSupportedException

hashCode

public int hashCode()
Returns the hashcode for this Object.

Overrides:
hashCode in class AbstractObject
Returns:
hash code for this Point2D.

equals

public boolean equals(java.lang.Object obj)
Determines whether or not two objects are equal.

Overrides:
equals in class AbstractObject
Parameters:
obj - an object to be compared with this object
Returns:
true if the object to be compared is an instance of Port and has the same values; false otherwise.

appendChildToDOM

protected void appendChildToDOM(Element element,
                                JFVersion version)
Append necessary xml child for current element, this method will be called internally by toDOM.

Overrides:
appendChildToDOM in class AbstractObject
Parameters:
element - A XML element to append child xml nodes
version - A file version notification so this object can obey the rules to save data.

extractChildFromDOM

protected void extractChildFromDOM(Element element,
                                   JFVersion version)
Extract needed xml child from current element, this method will be called internally by fromDOM.

Overrides:
extractChildFromDOM in class AbstractObject
Parameters:
element - An element used to extract needed xml child
version - A file version notification so this object can obey the rules to fetch data.

saveToStream

public void saveToStream(JFWriter stream,
                         JFVersion version)
                  throws java.io.IOException
Save this object to a binary stream

Overrides:
saveToStream in class AbstractObject
Parameters:
stream - An binary output stream
version - A file version notification so this object can obey the rules to save data.
Throws:
java.io.IOException

loadFromStream

public void loadFromStream(JFReader stream,
                           boolean skipHead,
                           JFVersion version)
                    throws java.io.IOException
Load object data from a binary stream

Overrides:
loadFromStream in class AbstractObject
Parameters:
stream - An binary input stream
skipHead - Skip head 'TYPE' check, an shape object should always has its own shape-type stored, if this shape-type has already been readed, this loadFromStream should/could not read the type anymore.
version - A file version notification so this object can obey the rules to fetch data.
Throws:
java.io.IOException

getArrowOccupiedSize

public static double getArrowOccupiedSize(int arrowType,
                                          int lineWidth)
Get an arrow occupied size on one end of line.

Parameters:
arrowType - The type of the arrow to be drawn.
lineWidth - The line width, it will effect the shape of arrow.

drawArrow

public static void drawArrow(int arrowType,
                             int lineWidth,
                             JFPoint startPoint,
                             JFPoint endPoint,
                             java.awt.Graphics g,
                             java.awt.Color c)
arrow type of this arrow

Parameters:
arrowType - The type of the arrow to be drawn.
lineWidth - The line width, it will effect the shape of arrow.
startPoint - The start point of the line.
endPoint - The end point of the line. The arrow will be drawn on this end side.
g - The graphics context to draw arrow.

drawRotateArrow

public static void drawRotateArrow(double x,
                                   double y,
                                   java.awt.Graphics g)
Draw a rotate arrow sign.

Parameters:
g - The graphics context to draw arrow.


Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All Rights Reserved.