|
|||||||||||
| 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.rectangle.AbstractRectangle
Abstract Rectangle class. It's a class as base of Arc, rectangle,ellipse
| Field Summary | |
protected FillFormat |
m_fillFormat
fill format of current fill. |
protected JFPoint |
m_firstNode
first node settled while drawing. |
protected LineFormat |
m_lineFormat
line format of current line. |
protected LineSeg |
m_lineSeg
line segment object for rectangle calculations. |
protected int |
m_nodeAdded
while drawing rectangle, how many nodes have been decided. called by addnode method. |
protected Rect |
m_originalRect
|
protected Rect |
m_rect
An rectangle object for the outline of this rectangle. |
static java.lang.String |
XML_LEFTBOTTOMX
A XML string tag represents the left-bottom x coordinate offset of this rectangle |
static java.lang.String |
XML_LEFTBOTTOMY
A XML string tag represents the left-bottom y coordinate offset of this rectangle |
static java.lang.String |
XML_LEFTTOPX
A XML string tag represents the left-top x coordinate offset of this rectangle |
static java.lang.String |
XML_LEFTTOPY
A XML string tag represents the left-top y coordinate offset of this rectangle |
static java.lang.String |
XML_RIGHTBOTTOMX
A XML string tag represents the right-bottom x coordinate offset of this rectangle |
static java.lang.String |
XML_RIGHTBOTTOMY
A XML string tag represents the right-bottom y coordinate offset of this rectangle |
static java.lang.String |
XML_RIGHTTOPX
A XML string tag represents the right-top x coordinate offset of this rectangle |
static java.lang.String |
XML_RIGHTTOPY
A XML string tag represents the right-top y coordinate offset of this rectangle |
| 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 | |
AbstractRectangle()
Constructor. |
|
| 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. |
void |
draw(java.awt.Graphics g,
boolean isXorMode)
Draw 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 |
flipBy()
Reverse this rectangle by a central y coordinate of this rectangle. |
void |
flipBy(double baseY)
Reverse this rectangle by a y coordinate. |
Rect |
getBounds()
Get the bounds of this rectangle. |
FillFormat |
getFillFormat()
Get the fill format of current line. |
double |
getHeight()
Get the height of current rectangle. |
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. |
Node |
getNodeByVertexType(int vertexType)
Get a node by vertex type. |
Rect |
getOriginalRect()
Get an original rectangle if this rectangle. |
double |
getRotateAngle()
Get the rotate angle of current rectangle. |
int |
getVertexTypeByNode(Node node)
Get vertex type by a node. |
double |
getWidth()
Get the width of current rectangle. |
double |
getX()
Get the x offset of current rectangle. |
double |
getY()
Get the y offset of current rectangle. |
int |
hashCode()
Returns the hashcode for this Object. |
boolean |
ifCompleteDrawing()
If a rectanglue has been drew. |
protected void |
initNodes()
Init all nodes of this rectangle. |
protected void |
initPorts()
Init all ports of this rectangle. |
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. |
void |
loadFromStream(JFReader stream,
boolean skipHead,
JFVersion version)
Load object data from a binary stream |
void |
mirrorBy()
Mirror this rectangle by a central x coordinate of this rectangle. |
void |
mirrorBy(double baseX)
Mirror this rectangle 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. |
Node |
removeLastNode()
Remove last node added by addNode method. |
void |
rotateBy(double theta)
Rotate this rectangle by an angle theta. |
void |
rotateBy(double baseX,
double baseY,
double theta)
Rotate this line 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 |
setFillFormat(FillFormat fillFormat)
Set the fill format of current line. |
void |
setLineFormat(LineFormat lineFormat)
Set the line format of current line. |
void |
setRect(double x,
double y,
double w,
double h)
Set the value of this rectangle. |
void |
setRect(Rect rect)
Set the value of current rectangle. |
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 |
cloneMe, 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_LEFTTOPX
public static final java.lang.String XML_LEFTTOPY
public static final java.lang.String XML_RIGHTTOPX
public static final java.lang.String XML_RIGHTTOPY
public static final java.lang.String XML_LEFTBOTTOMX
public static final java.lang.String XML_LEFTBOTTOMY
public static final java.lang.String XML_RIGHTBOTTOMX
public static final java.lang.String XML_RIGHTBOTTOMY
protected LineFormat m_lineFormat
protected FillFormat m_fillFormat
protected Rect m_rect
protected LineSeg m_lineSeg
protected JFPoint m_firstNode
protected int m_nodeAdded
protected Rect m_originalRect
| Constructor Detail |
public AbstractRectangle()
| Method Detail |
public double getX()
public double getY()
public double getWidth()
public double getHeight()
public void setRect(double x,
double y,
double w,
double h)
x - X coordiate.y - Y coordiate.w - Width of this rectangle.h - Height of this rectangle.public void setRect(Rect rect)
rect - A new rectangle.public Rect getOriginalRect()
public double getRotateAngle()
public Rect getBounds()
getBounds in class AbstractShapepublic FillFormat getFillFormat()
getFillFormat in class AbstractShapepublic void setFillFormat(FillFormat fillFormat)
setFillFormat in class AbstractShapefillFormat - A new fill format.public LineFormat getLineFormat()
getLineFormat in class AbstractShapepublic void setLineFormat(LineFormat lineFormat)
setLineFormat in class AbstractShapelineFormat - A new line format.protected void initNodes()
protected void initPorts()
public Node getNodeByVertexType(int vertexType)
vertexType - Vertex type of current node.
public int getVertexTypeByNode(Node node)
node - A node of this rectangle.
public void addNode(double x,
double y)
addNode in class AbstractShapepublic Node removeLastNode()
removeLastNode in class AbstractShapepublic boolean ifCompleteDrawing()
ifCompleteDrawing in class AbstractShapepublic boolean finishDrawing()
finishDrawing in class AbstractShape
public void draw(java.awt.Graphics g,
boolean isXorMode)
draw in class AbstractShapeg - A graphic canvas.isXorMode - If is in xor mode now.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 Port addPort(double x,
double y)
addPort in class AbstractShape
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 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 java.lang.String toString()
toString in class AbstractShape
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 | ||||||||||