|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.jfimagine.jfgraph.shape.base.AbstractObject
|
+--com.jfimagine.jfgraph.shape.base.AbstractShape
|
+--com.jfimagine.jfgraph.shape.line.JFCurve
A JFCurve class is used to represent a bezier curve with two end points and two control points.
| Field Summary | |
protected Arrow |
m_arrow
arrow format of current line. |
protected JFPoint |
m_firstNode
first node settled while drawing. |
protected int |
m_nodeAdded
while drawing rectangle, how many nodes have been decided. called by addnode method. |
static java.lang.String |
XML_CURVE
A XML string tag represents a Curve |
static java.lang.String |
XML_X1
A XML string tag represents the x coordinates of start point |
static java.lang.String |
XML_X2
A XML string tag represents the x coordinates of control point1 |
static java.lang.String |
XML_X3
A XML string tag represents the x coordinates of control point3 |
static java.lang.String |
XML_X4
A XML string tag represents the x coordinates of end point |
static java.lang.String |
XML_Y1
A XML string tag represents the y coordinates of start point |
static java.lang.String |
XML_Y2
A XML string tag represents the y coordinates of control point1 |
static java.lang.String |
XML_Y3
A XML string tag represents the y coordinates of control point3 |
static java.lang.String |
XML_Y4
A XML string tag represents the y coordinates of end point |
| Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractShape |
m_boundsNodeList, m_fontFormat, m_label, m_nodeList, m_portList, m_propertyList, XML_DISABLEMODIFYINGPROPERTIES, XML_DISABLEMOTION, XML_DISABLESCALING, XML_INVISIBLE, XML_LABEL, XML_SHOWLABEL |
| Fields inherited from class com.jfimagine.jfgraph.shape.base.AbstractObject |
m_lastError, XML_OBJECTID, XML_OBJECTTYPE |
| Constructor Summary | |
JFCurve()
Constructor for Curve |
|
JFCurve(double x1,
double y1,
double x2,
double y2)
Constructor for Curve |
|
JFCurve(double x1,
double y1,
double x2,
double y2,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2)
Constructor for Curve |
|
| Method Summary | |
void |
addNode(double x,
double y)
Add a new node for current node list. |
Port |
addPort(double x,
double y)
Add a new port to this shape. |
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. |
void |
draw(java.awt.Graphics g,
boolean isXorMode)
Draw current object on graphic canvas. |
protected void |
drawArrow(java.awt.Graphics g)
Draw current object's arrows. |
void |
drawPicked(java.awt.Graphics g,
boolean ifRotate)
Draw picked state of current object on graphic canvas. |
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. |
boolean |
finishDrawing()
Finish drawing object. |
void |
finishMoveNode(Node node,
double x,
double y,
java.awt.Graphics g)
finish move/adjust a node of current object. |
void |
finishMovePort()
finish move all ports of this curve. |
void |
flipBy()
Reverse this object by a central y coordinate of this object. |
void |
flipBy(double baseY)
Reverse this object by a y coordinate. |
Arrow |
getArrow()
Get the arrow format of current object. |
LineFormat |
getLineFormat()
Get the line format of current line. |
JFPoint |
getMoveNodePos(Node node,
JFPoint movePos,
int moveCase)
When moving a node, in some cases, e.g. ctrl key or shift key pressed to force preserving the form of a shape, or force equilateral shapes, we need to recalculate the actual moving node's position. |
int |
hashCode()
Returns the hashcode for this Object. |
boolean |
ifCompleteDrawing()
If a curve has been drew. |
protected void |
initNodes()
Init all nodes of this curve. |
protected void |
initPorts()
Init all ports of this curve. |
boolean |
intersects(JFPoint pnt)
Test if current object intersects with a specified point. |
boolean |
intersects(Rect rect)
Test if current object intersects with a specified rectangle. |
boolean |
isOpenShape()
Ask if this object is an open shape,e.g. line,curve,arc,etc. |
void |
loadFromStream(JFReader stream,
boolean skipHead,
JFVersion version)
Load object data from a binary stream |
void |
mirrorBy()
Mirror this object by a central x coordinate of this object. |
void |
mirrorBy(double baseX)
Mirror this object by a x coordinate. |
void |
moveBy(double x,
double y)
Move current object by an x and y offset. |
void |
moveNode(Node node,
double x,
double y,
java.awt.Graphics g)
Move/adjust a node of current object. |
boolean |
movePort(Port port,
double x,
double y)
Move/adjust a port of current object. |
Node |
nodeIntersects(JFPoint pnt,
int usage)
Get which node of current shape that intersects with point pnt. |
Node |
removeLastNode()
Remove last node added by addNode method. |
void |
rotateBy(double theta)
Rotate this object by an angle theta. |
void |
rotateBy(double baseX,
double baseY,
double theta)
Rotate current object by a specified point and an angle theta. |
void |
saveToStream(JFWriter stream,
JFVersion version)
Save this object to a binary stream |
void |
scaleBy(JFPoint basePoint,
double xScale,
double yScale)
Scale current object by a specified x and y scale. |
void |
scaleBy(JFPoint basePoint,
JFPoint refPoint1,
JFPoint refPoint2,
double scale)
Scale current object by specified points and scale percent. |
void |
setArrow(Arrow arrow)
Set the arrow format of current object. |
void |
setCurve(Curve curve)
Set the value of current curve. |
void |
setCurve(JFCurve curve)
Set the value of current curve. |
void |
setCurve(JFPoint startPoint,
JFPoint endPoint)
Set value of current Curve. |
void |
setLineFormat(LineFormat lineFormat)
Set the line format of current line. |
void |
startMoveNode(Node node)
Start move a node. |
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, setObjectType, setShowDesign, setValue, setXMLTag, toDOM |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String XML_CURVE
public static final java.lang.String XML_X1
public static final java.lang.String XML_Y1
public static final java.lang.String XML_X2
public static final java.lang.String XML_Y2
public static final java.lang.String XML_X3
public static final java.lang.String XML_Y3
public static final java.lang.String XML_X4
public static final java.lang.String XML_Y4
protected Arrow m_arrow
protected JFPoint m_firstNode
protected int m_nodeAdded
| Constructor Detail |
public JFCurve()
public JFCurve(double x1,
double y1,
double x2,
double y2)
public JFCurve(double x1,
double y1,
double x2,
double y2,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2)
| Method Detail |
public Arrow getArrow()
getArrow in class AbstractShapepublic void setArrow(Arrow arrow)
setArrow in class AbstractShapearrow - A new arrow format object.public LineFormat getLineFormat()
getLineFormat in class AbstractShapepublic void setLineFormat(LineFormat lineFormat)
setLineFormat in class AbstractShapelineFormat - A new line format.public void setCurve(JFCurve curve)
curve - A new JFCurve object.public void setCurve(Curve curve)
curve - A new curve.
public void setCurve(JFPoint startPoint,
JFPoint endPoint)
startPoint - The start point of this curve.endPoint - The end point of this curve.public boolean isOpenShape()
isOpenShape in class AbstractShapeprotected void initNodes()
protected void initPorts()
public void addNode(double x,
double y)
addNode in class AbstractShapepublic boolean finishDrawing()
finishDrawing in class AbstractShapepublic Node removeLastNode()
removeLastNode in class AbstractShapepublic boolean ifCompleteDrawing()
ifCompleteDrawing in class AbstractShape
public Node nodeIntersects(JFPoint pnt,
int usage)
nodeIntersects in class AbstractShapepnt - A JFPoint used to test intersection.usage - Purpose to get a node intersected, e.g. move or rotate.
protected void drawArrow(java.awt.Graphics g)
public void draw(java.awt.Graphics g,
boolean isXorMode)
draw in class AbstractShapeg - A graphic canvas.isXorMode - If is in xor mode now.
public void drawPicked(java.awt.Graphics g,
boolean ifRotate)
drawPicked in class AbstractShapeg - A graphic canvas.ifRotate - If user's operation or other actions force objects to be rotated.public boolean intersects(JFPoint pnt)
intersects in class AbstractShapepnt - A JFPoint used to test intersection.public boolean intersects(Rect rect)
intersects in class AbstractShaperect - A Rect used to test intersection.
public void scaleBy(JFPoint basePoint,
JFPoint refPoint1,
JFPoint refPoint2,
double scale)
scaleBy in class AbstractShapebasePoint - A base point that is unmovable.refPoint1 - A 'width' reference point.refPoint2 - A 'height' reference point.scale - A reference scale percent.
public void scaleBy(JFPoint basePoint,
double xScale,
double yScale)
scaleBy in class AbstractShapebasePoint - A base scale point for scaling reference.xScale - A scale percentage in x coordinate, default to 1.0yScale - A scale percentage in y coordinate, default to 1.0
public void moveBy(double x,
double y)
moveBy in class AbstractShapepublic void rotateBy(double theta)
rotateBy in class AbstractShapetheta - A rotate angle.
public void rotateBy(double baseX,
double baseY,
double theta)
rotateBy in class AbstractShapetheta - A rotate angle.public void mirrorBy()
mirrorBy in class AbstractShapepublic void mirrorBy(double baseX)
mirrorBy in class AbstractShapebaseX - A mirror base x coordinate.public void flipBy()
flipBy in class AbstractShapepublic void flipBy(double baseY)
flipBy in class AbstractShapebaseY - A flip base y coordinate.
public Port addPort(double x,
double y)
addPort in class AbstractShapepublic void finishMovePort()
public JFPoint getMoveNodePos(Node node,
JFPoint movePos,
int moveCase)
getMoveNodePos in class AbstractShapemovePos - Desire moving position of a node.moveCase - Move case of a node, normal, shift key pressed or ctrl key pressed
public void startMoveNode(Node node)
startMoveNode in class AbstractShapenode - The node will be moved.
public void finishMoveNode(Node node,
double x,
double y,
java.awt.Graphics g)
finishMoveNode in class AbstractShapenode - Currently moving node.g - current drawing canvas.
public void moveNode(Node node,
double x,
double y,
java.awt.Graphics g)
moveNode in class AbstractShapenode - Currently moving node.g - current drawing canvas.
public boolean movePort(Port port,
double x,
double y)
movePort in class AbstractShapeport - Currently moving port.
public java.lang.String toString()
toString in class AbstractShape
protected AbstractObject cloneMe()
throws java.lang.CloneNotSupportedException
cloneMe in class AbstractObjectjava.lang.CloneNotSupportedException
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class AbstractShapejava.lang.CloneNotSupportedExceptionpublic int hashCode()
hashCode in class AbstractShapepublic boolean equals(java.lang.Object obj)
equals in class AbstractShapeobj - an object to be compared with this object
protected void appendChildToDOM(Element element,
JFVersion version)
appendChildToDOM in class AbstractShapeelement - A XML element to append child xml nodesversion - A file version notification so this object can obey the rules to save data.
protected void extractChildFromDOM(Element element,
JFVersion version)
extractChildFromDOM in class AbstractShapeelement - An element used to extract needed xml childversion - A file version notification so this object can obey the rules to fetch data.
public void saveToStream(JFWriter stream,
JFVersion version)
throws java.io.IOException
saveToStream in class AbstractShapestream - An binary output streamversion - A file version notification so this object can obey the rules to save data.
java.io.IOException
public void loadFromStream(JFReader stream,
boolean skipHead,
JFVersion version)
throws java.io.IOException
loadFromStream in class AbstractShapestream - An binary input streamskipHead - 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.
java.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||