|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.jfimagine.jfgraph.geom.PolyLine
A PolyLine class used to represents a continuous arbitrary line segments collection.
Attention: Here we used a clockwise quadrant system. And the first quadrant is under right bottom corner.
| Field Summary | |
static int |
POLYLINE_CLOSED
An closed polyline, it's really a polygon |
static int |
POLYLINE_OPEN
An open polyline |
| Constructor Summary | |
PolyLine()
Constructor for PolyLine. |
|
PolyLine(int[] xpoints,
int[] ypoints,
int npoints)
Constructor for PolyLine. |
|
PolyLine(PolyLine line)
Constructor for PolyLine. |
|
| Method Summary | |
void |
addNode(double x,
double y)
Add a new node to polyline. |
void |
addNode(JFPointNode pnt)
Add a new node to polyline. |
boolean |
canAddPort(double x,
double y,
JFPoint startPoint,
JFPoint endPoint,
JFPoint portPoint)
Test if current polyline can add a port according to the position x,y. |
void |
cancelLastNode()
Cancel last node. |
void |
clearNodes()
Clear all nodes of this polyline. |
java.lang.Object |
clone()
Creates a new object of the same class and with the same contents as this object. |
boolean |
closePolygon()
close path for polygon |
boolean |
contains(double x,
double y)
Test if a point(x, y coordinates for instead) is on this line. |
boolean |
contains(double x,
double y,
double pickOffset)
Test if a point(x, y coordinates for instead) is on this line. |
boolean |
contains(JFPoint pnt)
Test if a point is on this line. |
boolean |
contains(JFPoint pnt,
double pickOffset)
Test if a point is on this line. |
boolean |
equals(java.lang.Object obj)
Determines whether or not two objects are equal. |
void |
finishDrawing()
Finish drawing, and combine some nodes which are on same line. |
void |
flipBy()
Reverse this line by a central y coordinate of this line. |
void |
flipBy(double baseY)
Reverse this line by a y coordinate. |
Rect |
getBounds()
Get the bounds of this polyline. |
JFPoint |
getCenter()
Get a center point on this line. |
int |
getEndNodeCount()
Get end node count of polyline. |
JFPointNode |
getNextNode(int nodeIndex,
boolean reverse)
Get next node of a polyline. |
JFPointNode |
getNextNode(JFPointNode node,
boolean reverse)
Get next node of a polyline. |
JFPointNode |
getNode(int nodeIndex)
Get a specified node of this polyline. |
int |
getNodeCount()
Get node count of polyline. |
int |
getNodeIndex(JFPointNode node)
Get a node's index inside a node list. |
java.util.List |
getNodeList()
Get point node list |
int |
hashCode()
Returns the hashcode for this Object. |
boolean |
intersects(double x1,
double y1,
double x2,
double y2)
Tests if the specified line segment intersects this PolyLine. |
boolean |
intersects(JFPointNode startPoint,
JFPointNode endPoint)
Tests if the specified line segment intersects this PolyLine. |
boolean |
intersects(LineSeg l)
Tests if the specified line segment intersects the this PolyLine. |
boolean |
intersects(Rect rect)
Tests if the specified rectangle intersects the interior of this PolyLine. |
boolean |
isPolygon()
If this polyline is actually a polygon. |
void |
mirrorBy()
Mirror this line by a central x coordinate of this line. |
void |
mirrorBy(double baseX)
Mirror this line by a x coordinate. |
void |
moveBy(double x,
double y)
Move this line by specific x and y coordinates. |
LineSeg |
pickLine(double x,
double y,
double pickOffset)
Pick a line segment of this polyline by a point with a pickoffset. |
LineSeg |
pickLine(double x,
double y,
double pickOffset,
JFPoint startPoint,
JFPoint endPoint)
Pick a line segment of this polyline by specified a point with a pickoffset, and start point and end point restricted. |
void |
removeNode(int nodeIndex)
Remove a specified node. |
void |
removeNode(JFPointNode node)
Remove a specified node. |
void |
replaceLastNode(double x,
double y)
replace last node. and concurrently adjust the relational points. |
void |
rotateBy(double theta)
Rotate this line by an angle theta. |
void |
rotateBy(double baseX,
double baseY,
double theta)
Rotate this line by a specified point and an angle theta. |
void |
rotateBy(JFPoint pnt,
double theta)
Rotate this line by a specified point and an angle theta. |
void |
scaleBy(JFPoint basePoint,
double xScale,
double yScale)
Scale current polyLine by a specified x and y scale. |
void |
scaleBy(JFPoint basePoint,
JFPoint refPoint1,
JFPoint refPoint2,
double scale)
Scale current polyline by specified points and scale percent. |
void |
setNodeList(int[] xpoints,
int[] ypoints,
int npoints)
Set point node list |
void |
setNodeList(java.util.List nodeList)
Set point node list |
java.lang.String |
toString()
Convert this object to String |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int POLYLINE_OPEN
public static final int POLYLINE_CLOSED
| Constructor Detail |
public PolyLine()
public PolyLine(PolyLine line)
line - A polyline.
public PolyLine(int[] xpoints,
int[] ypoints,
int npoints)
xpoints - an array of x coordinatesypoints - an array of y coordinatesnpoints - the total number of points in the Polygon| Method Detail |
public boolean isPolygon()
public java.util.List getNodeList()
public void setNodeList(java.util.List nodeList)
public void setNodeList(int[] xpoints,
int[] ypoints,
int npoints)
xpoints - an array of x coordinatesypoints - an array of y coordinatesnpoints - the total number of points in the Polygonpublic void clearNodes()
public int getNodeCount()
public int getEndNodeCount()
public JFPointNode getNode(int nodeIndex)
nodeIndex - A node index.
public int getNodeIndex(JFPointNode node)
node - A specified node to be found.public void removeNode(JFPointNode node)
node - A node in the node list to be removed.public void removeNode(int nodeIndex)
nodeIndex - The index of specified node.
public JFPointNode getNextNode(JFPointNode node,
boolean reverse)
node - The node to start finding.reverse - False if get next node of this node, true if get prior node of this node.
public JFPointNode getNextNode(int nodeIndex,
boolean reverse)
nodeIndex - The node index to start finding.reverse - False if get next node of this node, true if get prior node of this node.
public void finishDrawing()
public void addNode(JFPointNode pnt)
public void addNode(double x,
double y)
public boolean closePolygon()
public void cancelLastNode()
public void replaceLastNode(double x,
double y)
public Rect getBounds()
public JFPoint getCenter()
public void scaleBy(JFPoint basePoint,
JFPoint refPoint1,
JFPoint refPoint2,
double scale)
basePoint - 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)
basePoint - 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)
x - X coordiate to moveby.y - Y coordiate to moveby.public void rotateBy(double theta)
theta - A rotate angle.
public void rotateBy(JFPoint pnt,
double theta)
pnt - A rotate center point.theta - A rotate angle.
public void rotateBy(double baseX,
double baseY,
double theta)
theta - A rotate angle.public void mirrorBy()
public void mirrorBy(double baseX)
baseX - A mirror base x coordinate.public void flipBy()
public void flipBy(double baseY)
baseY - A flip base y coordinate.public boolean contains(JFPoint pnt)
pnt - A point to be measured.
public boolean contains(JFPoint pnt,
double pickOffset)
pnt - A point to be measured.pickOffset - An analog offset for 'pick' this line.
public boolean contains(double x,
double y)
x - X coordinate of this point.y - Y coordinate of this point.
public boolean contains(double x,
double y,
double pickOffset)
x - X coordinate of this point.y - Y coordinate of this point.pickOffset - An analog pick offset that great equal than 0.
public LineSeg pickLine(double x,
double y,
double pickOffset)
x - X coordinate of this point.y - Y coordinate of this point.pickOffset - An analog pick offset that great equal than 0.
public LineSeg pickLine(double x,
double y,
double pickOffset,
JFPoint startPoint,
JFPoint endPoint)
x - X coordinate of this point.y - Y coordinate of this point.pickOffset - An analog pick offset that great equal than 0.startPoint - Start point of a line segment.endPoint - End point of a line segment.
public boolean canAddPort(double x,
double y,
JFPoint startPoint,
JFPoint endPoint,
JFPoint portPoint)
x - X coordinate of the port.y - Y coordinate of the port.
public boolean intersects(LineSeg l)
PolyLine.
l - the specified PolyLine to test for intersection
with this PolyLine
true if the specified PolyLine
intersects this PolyLine;
false otherwise.
public boolean intersects(JFPointNode startPoint,
JFPointNode endPoint)
PolyLine.
startPoint - the first endpoint of the specified
line segmentendPoint - the second endpoint of the specified
line segment
true if the specified line segment intersects
the this PolyLine; false
otherwise.
public boolean intersects(double x1,
double y1,
double x2,
double y2)
PolyLine.
true if the specified line segment intersects
the this PolyLine; false
otherwise.public boolean intersects(Rect rect)
PolyLine.
rect - the specified PolyLine to test for intersection
with the interior of this PolyLine
true if the specified PolyLine
intersects the interior of this PolyLine;
false otherwise.public java.lang.String toString()
toString in class java.lang.Object
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - an object to be compared with this object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||