gistoolkit.features
Class MultiLineString

java.lang.Object
  extended bygistoolkit.features.Shape
      extended bygistoolkit.features.MultiLineString
Direct Known Subclasses:
MultiLineStringM

public class MultiLineString
extends Shape

Represents a collection of Line Strings.


Field Summary
protected  LineString[] myLines
          List of line strings
 
Fields inherited from class gistoolkit.features.Shape
EQUAL_LIMIT, LINEARRING, LINESTRING, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, myEnvelope, NULLSHAPE, POINT, POLYGON, RASTER
 
Constructor Summary
MultiLineString()
          Create a new MultiLineString
MultiLineString(LineString inLines)
          Create a MultiLineString from the given line
MultiLineString(LineString[] inLines)
          Creates a MultiLineString from the lines
 
Method Summary
 int add(double inX, double inY)
          Add the a point to this shape.
 boolean add(int inIndex, double inX, double inY)
          Adds the point to this shape at the given index.
 void addLineString(int inIndex, LineString inLineString)
          Add a line string to this MultiLineString at the given location
 void calculateEnvelope()
          Calculates the envelope based on the data in the individual lines.
 java.lang.Object clone()
          Creates a copy of the MultiLineString
 int getClosestIndex(double inX, double inY)
          Return the point in the MultiLineString that is the closest to this point.
 Point getClosestPoint(double inX, double inY)
          Return the point in the MultiLineString that is the closest to this point.
 double getDistanceToPoint(double inX, double inY)
          Get the distance from this shape to the given point
 Envelope getEnvelope()
          return the bounding rectangle of this shape.
 LineString[] getLines()
          Retrieves the array of lines contained in this multi Line String.
 int getNumPoints()
          Return the number of points in this shape.
 Point getPoint(int inIndex)
          Get the point at the given index.
 Point[] getPoints()
          Return the points that comprise the object
 java.lang.String getShapeType()
          Return the type of shape this is
 java.lang.String getWKT()
          Returns the OGIS Well Know Text Representation of this shape
 boolean intersects(Shape inShape)
          Determines if the two shapes intersect
 boolean intersectsLinearRing(LinearRing inLinearRing)
          A MultiLineString intersects a LinearRing if any one of it's constituent LineStrings intersect the Linear ring.
 boolean intersectsMultiLineString(MultiLineString inMultiLineString)
          A MultiLineString will intersect another MultiLineString if any of the constituent LinesStrings within the MultiLineStrings intersect.
 boolean intersectsMultiPolygon(MultiPolygon inMultiPolygon)
          A MultiLineString intersects a MultiPolygon if the any one of the MultiLineString intersects any of the constituent Polygons of the MultiPolygon.
 boolean intersectsPolygon(Polygon inPolygon)
          A MultiLineString intersects a Polygon if any of it's constituent LineStrings intersect the Polygon.
 boolean intersectsRasterShape(RasterShape inRasterShape)
          A MultiLineString intersects a RasterShape if any of the strings intersect the envelope or are contained within the envelope of the raster shape.
 boolean remove(int inIndex)
          Delete the given point from the polygon.
 void setPoint(int inIndex, double inXCoordinate, double inYCoordinate)
          Set the point at the given index.
 void translate(double inXDistance, double inYDistance)
          Translate the shape the given distance in the X and Y directions
 
Methods inherited from class gistoolkit.features.Shape
contains, distance, getDistance, getDistanceToEnvelope, getDistanceToLine, getDistanceToLine, getLinesIntersect, linesIntersect, linesIntersect, pointOnLine, pointOnLine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myLines

protected LineString[] myLines
List of line strings

Constructor Detail

MultiLineString

public MultiLineString()
Create a new MultiLineString


MultiLineString

public MultiLineString(LineString[] inLines)
Creates a MultiLineString from the lines


MultiLineString

public MultiLineString(LineString inLines)
Create a MultiLineString from the given line

Method Detail

getShapeType

public java.lang.String getShapeType()
Return the type of shape this is

Specified by:
getShapeType in class Shape

clone

public java.lang.Object clone()
Creates a copy of the MultiLineString

Specified by:
clone in class Shape

getNumPoints

public int getNumPoints()
Return the number of points in this shape.

Specified by:
getNumPoints in class Shape

getPoint

public Point getPoint(int inIndex)
Get the point at the given index.

Specified by:
getPoint in class Shape

setPoint

public void setPoint(int inIndex,
                     double inXCoordinate,
                     double inYCoordinate)
Set the point at the given index.

Specified by:
setPoint in class Shape

add

public int add(double inX,
               double inY)
Add the a point to this shape. Returns the location where the point was added. Returns -1 if it could not be added.

Specified by:
add in class Shape

add

public boolean add(int inIndex,
                   double inX,
                   double inY)
Adds the point to this shape at the given index.

Specified by:
add in class Shape

remove

public boolean remove(int inIndex)
Delete the given point from the polygon.

Specified by:
remove in class Shape

calculateEnvelope

public void calculateEnvelope()
Calculates the envelope based on the data in the individual lines.

Overrides:
calculateEnvelope in class Shape

getEnvelope

public Envelope getEnvelope()
Description copied from class: Shape
return the bounding rectangle of this shape.

Specified by:
getEnvelope in class Shape

getLines

public LineString[] getLines()
Retrieves the array of lines contained in this multi Line String.


getPoints

public Point[] getPoints()
Return the points that comprise the object

Specified by:
getPoints in class Shape

getWKT

public java.lang.String getWKT()
Returns the OGIS Well Know Text Representation of this shape

Specified by:
getWKT in class Shape

getClosestPoint

public Point getClosestPoint(double inX,
                             double inY)
Return the point in the MultiLineString that is the closest to this point.


getClosestIndex

public int getClosestIndex(double inX,
                           double inY)
Return the point in the MultiLineString that is the closest to this point.

Specified by:
getClosestIndex in class Shape

translate

public void translate(double inXDistance,
                      double inYDistance)
Translate the shape the given distance in the X and Y directions

Specified by:
translate in class Shape

addLineString

public void addLineString(int inIndex,
                          LineString inLineString)
Add a line string to this MultiLineString at the given location


getDistanceToPoint

public double getDistanceToPoint(double inX,
                                 double inY)
Get the distance from this shape to the given point

Specified by:
getDistanceToPoint in class Shape

intersects

public boolean intersects(Shape inShape)
Determines if the two shapes intersect

Specified by:
intersects in class Shape

intersectsMultiLineString

public boolean intersectsMultiLineString(MultiLineString inMultiLineString)
A MultiLineString will intersect another MultiLineString if any of the constituent LinesStrings within the MultiLineStrings intersect.


intersectsLinearRing

public boolean intersectsLinearRing(LinearRing inLinearRing)
A MultiLineString intersects a LinearRing if any one of it's constituent LineStrings intersect the Linear ring.


intersectsPolygon

public boolean intersectsPolygon(Polygon inPolygon)
A MultiLineString intersects a Polygon if any of it's constituent LineStrings intersect the Polygon.


intersectsMultiPolygon

public boolean intersectsMultiPolygon(MultiPolygon inMultiPolygon)
A MultiLineString intersects a MultiPolygon if the any one of the MultiLineString intersects any of the constituent Polygons of the MultiPolygon.


intersectsRasterShape

public boolean intersectsRasterShape(RasterShape inRasterShape)
A MultiLineString intersects a RasterShape if any of the strings intersect the envelope or are contained within the envelope of the raster shape.