public class LineString extends DefaultGeometry implements Curve, LineTypeGeometry
| Modifier and Type | Field and Description |
|---|---|
protected Rectangle |
bounds
The Bounding box
|
protected Point[] |
coords
the Points defining the LineString
|
GEOMETRY_ANNOTATION, GEOMETRY_COMPLEX, GEOMETRY_ELLIPSE, GEOMETRY_LINE, GEOMETRY_LINEAR_RING, GEOMETRY_LINESTRING, GEOMETRY_MULTI_ANNOTATION, GEOMETRY_MULTI_LINESTRING, GEOMETRY_MULTI_POINT, GEOMETRY_MULTI_POLYGON, GEOMETRY_POINT, GEOMETRY_POLYGON, GEOMETRY_RECTANGLE| Constructor and Description |
|---|
LineString() |
LineString(double[] tab)
Constructor easier to use for testing warning : coords.length must be even
number, because points are entered as x,y
|
LineString(Point[] coords)
Constructs a LineString going to each points
|
| Modifier and Type | Method and Description |
|---|---|
double |
area()
Returns the geometry area.
|
Geometry |
boundary()
Returns the boundary, ie the startPoint() and endPoint()
|
LineString |
clone()
Clones this geometry.
|
void |
createBounds()
creates the bounding box
called in the constructor, not needed from outside |
Point |
endPoint()
The last point of the curve
|
boolean |
equals(java.lang.Object o) |
Rectangle |
getBounds()
Returns the minimum bounding rectangle of this geometry.
|
Point |
getCenteredPoint()
This method returns a point that is typically centered on the geometry.
|
Point[] |
getCoords() |
short |
getGeometryId()
Returns the geometry class id.
|
int |
getGeometryType()
Returns the geometry type for this geometry.
|
int |
hashCode() |
boolean |
isClosed()
Tests if the curve is closed (endPoint equals startPoint)
|
boolean |
isRing()
Tests if the curve is closed and simple (doesn't intersect itself)
|
double |
length()
The length of the curve
|
LineGeometryIterator |
lineIterator() |
int |
numPoints()
Returns the number of Point in this LineString
|
Point |
pointN(int N)
Returns the Nth Point of this LineString
|
Point |
pointOnLine(double interpolation)
This method finds the point being at a certain
percentage of the path between the starting point and the final point.
|
Point[] |
serialize()
Describe this LineString with his Points Respects the order of the Points
|
void |
setCoords(Point[] coords) |
int |
sizeOf()
Returns an approximation in bytes of the memory used by this geometry.
|
boolean |
spatiallyEquals(Geometry o,
PrecisionModel precisionModel)
Tests if this geometry is equal to the argument, on a topological point of view.
|
boolean |
spatiallyEquals(LineString lineString,
PrecisionModel precisionModel) |
Point |
startPoint()
The first point of the curve
|
java.lang.String |
toString()
Returns informations about the current geometry.
|
Geometry |
transform(Transformation tr)
Creates a clone of the current geometry and returns
the new instance transformed with the specified geometry transformation.
The returned geometry can be of any geometry types after the transformation. |
void |
translate(double dx,
double dy)
Translate this geometry with the specified values.
|
asText, spatiallyEqualsfinalize, getClass, notify, notifyAll, wait, wait, waitasText, spatiallyEqualsprotected Rectangle bounds
protected Point[] coords
public LineString()
public LineString(Point[] coords)
coords - public LineString(double[] tab)
tab - public Geometry boundary()
public void createBounds()
createBounds in interface Geometrypublic Point[] getCoords()
public void setCoords(Point[] coords)
public int numPoints()
public Point pointN(int N)
N - public Rectangle getBounds()
Geometrypublic LineString clone()
public Point[] serialize()
public double length()
public double area()
Geometrypublic Point startPoint()
startPoint in interface Curvepublic Point endPoint()
public boolean isClosed()
isClosed in interface CurveisClosed in interface LineTypeGeometrypublic boolean isRing()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean spatiallyEquals(Geometry o, PrecisionModel precisionModel)
spatiallyEquals in interface Geometryo - the geometry to be tested.precisionModel - the precision model to use while comparing geometries.public boolean spatiallyEquals(LineString lineString, PrecisionModel precisionModel)
public java.lang.String toString()
Geometrypublic LineGeometryIterator lineIterator()
lineIterator in interface LineTypeGeometrypublic void translate(double dx,
double dy)
public short getGeometryId()
getGeometryId in interface Geometrypublic int getGeometryType()
getGeometryType in interface Geometryfor more details.public Geometry transform(Transformation tr)
public Point pointOnLine(double interpolation)
interpolation - the interpolation expressed as a percentage (between 0 and 1)public Point getCenteredPoint()
getCenteredPoint in interface Geometry