|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.hedgehog.HObject
com.hedgehog.geo.GeometricObject
com.hedgehog.geo.twod.GeometricObject2D
com.hedgehog.geo.twod.curves.Curve2D
com.hedgehog.geo.twod.curves.PolyCurve2D
public class PolyCurve2D
Title: PolyCurve2D - represents a curve as a vector of curve segments.
Description: Models a poly-curve by encapsulating a vector of curve segments.
It is assumed that adjacent vector elements refer to adjacent polycurve segments sharing a common point, forming a contiguous chain of segments.
Copyright: Copyright (c) Hedgehog Software 2007-2009.
Company: Hedgehog Software.
| Field Summary | |
|---|---|
protected java.util.Vector<Curve2D> |
mCurves
Vector of curve segments. |
| Fields inherited from class com.hedgehog.geo.twod.curves.Curve2D |
|---|
mp0, mp1 |
| Fields inherited from class com.hedgehog.HObject |
|---|
mID, mName |
| Constructor Summary | |
|---|---|
PolyCurve2D()
Default constructor. |
|
PolyCurve2D(ID id)
Constructor. |
|
PolyCurve2D(PolyCurve2D object)
Copy constructor. |
|
PolyCurve2D(java.lang.String name)
Constructor. |
|
PolyCurve2D(java.lang.String name,
ID id)
Constructor. |
|
PolyCurve2D(java.util.Vector<Curve2D> curves)
Constructor. |
|
PolyCurve2D(java.util.Vector<Curve2D> curves,
boolean ordered,
double tolerance)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addCurveSegment(Curve2D curve)
Appends the specified curve to this poly-curves vector of curve segments. |
boolean |
addCurveSegment(Curve2D curve,
int index)
Adds the specified curve at the specified index. |
java.util.Vector<ModelObject> |
childModelObjects()
Returns a vector of this object's child ModelObject objects. |
java.util.Vector<Point2D> |
curvePoints()
Returns a vector of unique curve points that are the end-points of the curve segments that make up this polycurve. |
java.util.Vector<PairPQ<HInteger,java.lang.String>> |
curveSegmentIDTypes()
Returns an array of this object's curve segment IDs and segment types. |
Interval |
curveSegmentInterval(int segment_number)
Returns the parametric variable interval of the specified curve segment. |
java.sql.PreparedStatement |
databaseInsertStatement(java.sql.Connection connection,
int modelID)
Returns a prepared statement for inserting (INSERT command) a ModelObject object into a database. |
java.sql.PreparedStatement |
databaseUpdateStatement(java.sql.Connection connection,
int modelID)
Returns a prepared statement for updating (UPDATE command) a ModelObject object into a database. |
Curve2D |
firstSegment()
Returns the first curve segment. |
ModelObject |
fromDatabase(java.sql.Connection connection,
Model model,
int modelID,
int objectID)
Returns a model object from the specified database table. |
ModelObject |
fromXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Node documentRootNode,
org.w3c.dom.Node node,
Model model)
Returns a model object from the specified xml node. |
java.util.Vector<Curve2D> |
getCurves()
Returns the curve segment vector. |
Curve2D |
getCurveSegment(int curveIndex)
Returns the curve segment at the specified index. |
boolean |
isClosed(double tolerance)
Tests whether or not this poly-curve is closed; ie p0 of the first curve segment is at the same geometric position as p1 of the last curve segment. |
Curve2D |
lastSegment()
Returns the last curve segment. |
double |
length()
Returns the total length of this poly-curve. |
Curve2D |
nearestSegment(Point2D p,
double tolerance)
Returns the segment nearest to the specified point. |
int |
nearestSegmentIndex(Point2D p,
double tolerance)
Returns the index of the segment nearest to the specified point. |
int |
numberCurvePoints()
Returns the number of points on a poly-curve; ie, number of segments+1. |
int |
numberSegments()
Returns the number of curve segments. |
Point2D |
pointOnCurve(double u,
double tolerance)
Returns a point on this curve. |
boolean |
pointOnCurve(Point2D p,
double tolerance)
Tests whether or not the specified point lies on this poly-curve. |
boolean |
pointOnLeft(Point2D p,
double tolerance)
Tests whether or not the specified point is on the lhs of this line, with the line's sense from p0 to p1. |
boolean |
pointOnRight(Point2D p,
double tolerance)
Tests whether or not the specified point is on the lhs of this line, with the line's sense from p0 to p1. |
boolean |
removeCurveSegment(int index)
Removes the curve segment at the specified index. |
void |
setCurves(java.util.Vector<Curve2D> curves)
Sets the curve segment vector. |
java.lang.String |
toString()
Returns a String representation of a PolyCurve2D object. |
X3DNode |
toX3DNode(X3DObject x3dObject)
X3D support. |
org.w3c.dom.Element |
toXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Element documentRootNode)
Returns the xml node of this object. |
| Methods inherited from class com.hedgehog.geo.GeometricObject |
|---|
objectDimension |
| Methods inherited from class com.hedgehog.HObject |
|---|
clone, compare, compareTo, copy, getID, getName, hashCode, hasID, hasName, setID, setName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Vector<Curve2D> mCurves
| Constructor Detail |
|---|
public PolyCurve2D()
public PolyCurve2D(java.util.Vector<Curve2D> curves)
curves - Vector of curves.
public PolyCurve2D(java.util.Vector<Curve2D> curves,
boolean ordered,
double tolerance)
curves - Vector of curves making up poly-curve.ordered - Boolean indicating whether or not the specified vector of curves is ordered in that
the ordering of the curves forms a continuous poly-curve or not. If ordered is set to logical-false
then curves[0] is first added to this poly-curve and all other curves added by testing for common end-points.tolerance - Required tolerance.public PolyCurve2D(java.lang.String name)
name - Poly-curve name.public PolyCurve2D(ID id)
id - Poly-curve ID.
public PolyCurve2D(java.lang.String name,
ID id)
name - Poly-curve name.id - Poly-curve ID.public PolyCurve2D(PolyCurve2D object)
object - Object to copy.| Method Detail |
|---|
public java.util.Vector<Curve2D> getCurves()
public void setCurves(java.util.Vector<Curve2D> curves)
curves - New curve segment vector.
public Curve2D getCurveSegment(int curveIndex)
throws java.lang.IllegalArgumentException
curveIndex - Curve segment index.
java.lang.IllegalArgumentException - Thrown if the specified curve index is invalid.public boolean addCurveSegment(Curve2D curve)
curve - Curve to add.
public boolean addCurveSegment(Curve2D curve,
int index)
curve - Curve to add.index - Index to add curve.
public boolean removeCurveSegment(int index)
index - Curve segment index.
public boolean isClosed(double tolerance)
tolerance - Required tolerance.
public int numberSegments()
public Curve2D firstSegment()
public Curve2D lastSegment()
public double length()
length in class Curve2Dpublic java.lang.String toString()
toString in class Curve2Dpublic int numberCurvePoints()
public Interval curveSegmentInterval(int segment_number)
throws java.lang.IllegalArgumentException
segment_number - Number of segment for which interval is required.
java.lang.IllegalArgumentException - Throws an InvalidArgumentException exception if segment_number is out of range.public java.util.Vector<PairPQ<HInteger,java.lang.String>> curveSegmentIDTypes()
public java.util.Vector<Point2D> curvePoints()
public Curve2D nearestSegment(Point2D p,
double tolerance)
p - Point.tolerance - required tolerance.
public int nearestSegmentIndex(Point2D p,
double tolerance)
p - Point.tolerance - Required tolerance.
public Point2D pointOnCurve(double u,
double tolerance)
throws java.lang.IllegalArgumentException
pointOnCurve in class Curve2Du - Parametric-variable value. Must be in range [0:1].tolerance - Required tolerance.
java.lang.IllegalArgumentException - Thrown if u is out of range.
public boolean pointOnCurve(Point2D p,
double tolerance)
pointOnCurve in class Curve2Dp - Point to test.tolerance - Required tolerance.
public boolean pointOnLeft(Point2D p,
double tolerance)
pointOnLeft in class Curve2Dp - point to test.tolerance - Required tolerance.
public boolean pointOnRight(Point2D p,
double tolerance)
pointOnRight in class Curve2Dp - point to test.tolerance - Required tolerance.
public java.util.Vector<ModelObject> childModelObjects()
childModelObjects in interface ModelObject
public java.sql.PreparedStatement databaseInsertStatement(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException
databaseInsertStatement in interface ModelObjectconnection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
public java.sql.PreparedStatement databaseUpdateStatement(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException
databaseUpdateStatement in interface ModelObjectconnection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
public org.w3c.dom.Element toXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Element documentRootNode)
throws InvalidObjectException
toXMLNode in interface ModelObjectdocument - XML document.documentRootNode - Document root node.
InvalidObjectException - Thrown if this object's ID is equal to the default ID of -1.
public ModelObject fromXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Node documentRootNode,
org.w3c.dom.Node node,
Model model)
throws InvalidObjectException
fromXMLNode in interface ModelObjectdocument - XML document.documentRootNode - Document root node; ie Model node.node - XML node.model - The model to which the returned object is associated.
InvalidObjectException - Thrown if an error occurred building the object.
public ModelObject fromDatabase(java.sql.Connection connection,
Model model,
int modelID,
int objectID)
throws java.sql.SQLException
fromDatabase in interface ModelObjectconnection - Database connection.modelID - Model ID.objectID - Object ID in associated ModelObjects table.model - Model built from database.
java.sql.SQLException - Thrown if an SQL exception occurs.
public X3DNode toX3DNode(X3DObject x3dObject)
throws InvalidObjectException
toX3DNode in interface ModelObjectx3dObject - X3D object.
InvalidObjectException - Thrown if this object is invalid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||