gistoolkit.features
Class LinearRing

java.lang.Object
  extended bygistoolkit.features.Shape
      extended bygistoolkit.features.LinearRing
Direct Known Subclasses:
LinearRingM

public class LinearRing
extends Shape

A ring is a closed group of line segments. These are usefull for implementing polygons. The rules for rings are that they can not overlap (No Self Intersections), there can be no shared line segments, although single points can be shared.


Field Summary
 
Fields inherited from class gistoolkit.features.Shape
EQUAL_LIMIT, LINEARRING, LINESTRING, MULTILINESTRING, MULTIPOINT, MULTIPOLYGON, myEnvelope, NULLSHAPE, POINT, POLYGON, RASTER
 
Constructor Summary
LinearRing()
          Create a new empty linear ring.
LinearRing(double[] inXs, double[] inYs)
          Create a new linear ring from the points.
LinearRing(Point[] inPoints)
          Create a new linear ring from the points.
 
Method Summary
 int add(double inX, double inY)
          Adds a point to the LineString at the given point index.
 boolean add(int inIndex, double inX, double inY)
          Adds a point to the LineString at the given point index.
 void calculateEnvelope()
          Recalculates the envelope for the shape.
 java.lang.Object clone()
          Creates a copy of the Linear Ring Creation date: (5/3/2001 8:45:46 AM)
 boolean contains(Shape inShape)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsLine(LineString inLineString)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsLinearRing(LinearRing inRing)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsMultiLine(MultiLineString inMultiLineString)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsMultiPolygon(MultiPolygon inMultiPolygon)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsPoint(double inX, double inY)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsPoint(Point inPoint)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 boolean containsPolygon(Polygon inPolygon)
          For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.
 void ensureClosed()
          Ensure that the ring is closed
 int getClosestIndex(double inX, double inY)
          Return the point in the LineString that is the closest to this point.
 Point getClosestPoint(double inX, double inY)
          Return the point in the LineString 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.
 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 which make up the linear ring.
 Point[] getRingPoints()
          Return the Points which make up the linear ring.
 java.lang.String getShapeType()
          Return the type of shape this is
 java.lang.String getWKT()
          There is no WKT for a linear ring
 double[] getXCoordinates()
          Return the array of X Coordinates.
 double[] getYCoordinates()
          Return the array of Y Coordinates.
 boolean intersects(Shape inShape)
          Determines if the two shapes intersect
 boolean intersectsLinearRing(LinearRing inLinearRing)
          A LinearRing intersects another LinearRing if the boundaries of the LinearRing cross, or one LinearRing is entirely within the other
 boolean intersectsMultiPolygon(MultiPolygon inMultiPolygon)
          A LinearRing intersects a MultiPolygon if it intersects any of the constituent Polygons contained within the MultiPolygon.
 boolean intersectsPoint(double inX, double inY)
          A Linear Ring will intersect a point if the point falls on the line, within the boundary of the linear ring.
 boolean intersectsPoint(Point inPoint)
          A Linear Ring will intersect a point if the point falls on the line, or within the boundary of the linear ring.
 boolean intersectsPolygon(Polygon inPolygon)
          A LinearRing intersects a Polygon if it intersects any of the rings of the polygon, or if it is contained within the posative ring of the polygon.
 boolean intersectsRasterShape(RasterShape inRasterShape)
          A LinearRing intersects a RasterShape if it intersects the envelope of the raster, or if it is contained within the raster.
 boolean isClockwise()
          Returns true if this is a valid ring, and it is oriented clockwise.
 boolean overlaps(Shape inShape)
          Checks if the shape overlaps this shape, and returns true if it does.
 boolean remove(int inIndex)
          Removes the point at the given index from the linear ring.
 void reorder()
          Exactly changes the orientation of the nodes in the ring
 void setPoint(int inIndex, double inXCoordinate, double inYCoordinate)
          Set the point at the given index.
 java.lang.String toString()
          Returns the string representation of this Ring.
 void translate(double inXDistance, double inYDistance)
          Translate the shape the given distance in the X and Y directions
 Shape union(Shape inShape)
          Create the union of the two objects
 
Methods inherited from class gistoolkit.features.Shape
distance, getDistance, getDistanceToEnvelope, getDistanceToLine, getDistanceToLine, getLinesIntersect, linesIntersect, linesIntersect, pointOnLine, pointOnLine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinearRing

public LinearRing()
Create a new empty linear ring.


LinearRing

public LinearRing(double[] inXs,
                  double[] inYs)
Create a new linear ring from the points.


LinearRing

public LinearRing(Point[] inPoints)
Create a new linear ring from the points.

Method Detail

getXCoordinates

public double[] getXCoordinates()
Return the array of X Coordinates. This is private data, and should be used carefully.


getYCoordinates

public double[] getYCoordinates()
Return the array of Y Coordinates. This is private data, and should be used carefully.


getShapeType

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

Specified by:
getShapeType 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)
Adds a point to the LineString at the given point index.

Specified by:
add in class Shape

add

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

Specified by:
add in class Shape

remove

public boolean remove(int inIndex)
Removes the point at the given index from the linear ring.

Specified by:
remove in class Shape

getEnvelope

public Envelope getEnvelope()
return the bounding rectangle of this shape.

Specified by:
getEnvelope in class Shape

calculateEnvelope

public void calculateEnvelope()
Recalculates the envelope for the shape.

Overrides:
calculateEnvelope in class Shape

clone

public java.lang.Object clone()
Creates a copy of the Linear Ring Creation date: (5/3/2001 8:45:46 AM)

Specified by:
clone in class Shape
Returns:
gistoolkit.features.Shape

contains

public boolean contains(Shape inShape)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon. Creation date: (4/18/2001 5:36:23 PM)

Overrides:
contains in class Shape
Parameters:
inShape - features.Shape
Returns:
boolean

containsPoint

public boolean containsPoint(Point inPoint)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


containsPoint

public boolean containsPoint(double inX,
                             double inY)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


getPoints

public Point[] getPoints()
Return the Points which make up the linear ring. Creates a new copy of all the points, so this is an expensive operation.

Specified by:
getPoints in class Shape

getRingPoints

public Point[] getRingPoints()
Return the Points which make up the linear ring. The ring is closed with the last point being the same as the first.


containsLine

public boolean containsLine(LineString inLineString)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


containsLinearRing

public boolean containsLinearRing(LinearRing inRing)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


containsMultiLine

public boolean containsMultiLine(MultiLineString inMultiLineString)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


containsMultiPolygon

public boolean containsMultiPolygon(MultiPolygon inMultiPolygon)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


containsPolygon

public boolean containsPolygon(Polygon inPolygon)
For linear rings, since the shape is representing a simple polygon, if the shape is contained within the interior of the ring, then it is said to be within the simple polygon.


isClockwise

public boolean isClockwise()
Returns true if this is a valid ring, and it is oriented clockwise.


reorder

public void reorder()
Exactly changes the orientation of the nodes in the ring


toString

public java.lang.String toString()
Returns the string representation of this Ring.


ensureClosed

public void ensureClosed()
Ensure that the ring is closed


getWKT

public java.lang.String getWKT()
There is no WKT for a linear ring

Specified by:
getWKT 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

union

public Shape union(Shape inShape)
Create the union of the two objects


overlaps

public boolean overlaps(Shape inShape)
Checks if the shape overlaps this shape, and returns true if it does.


getClosestIndex

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

Specified by:
getClosestIndex in class Shape

getClosestPoint

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


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

intersectsPoint

public boolean intersectsPoint(Point inPoint)
A Linear Ring will intersect a point if the point falls on the line, or within the boundary of the linear ring. Calls containsPoint().


intersectsPoint

public boolean intersectsPoint(double inX,
                               double inY)
A Linear Ring will intersect a point if the point falls on the line, within the boundary of the linear ring. Calls containsPoint().


intersectsLinearRing

public boolean intersectsLinearRing(LinearRing inLinearRing)
A LinearRing intersects another LinearRing if the boundaries of the LinearRing cross, or one LinearRing is entirely within the other


intersectsPolygon

public boolean intersectsPolygon(Polygon inPolygon)
A LinearRing intersects a Polygon if it intersects any of the rings of the polygon, or if it is contained within the posative ring of the polygon.


intersectsMultiPolygon

public boolean intersectsMultiPolygon(MultiPolygon inMultiPolygon)
A LinearRing intersects a MultiPolygon if it intersects any of the constituent Polygons contained within the MultiPolygon.


intersectsRasterShape

public boolean intersectsRasterShape(RasterShape inRasterShape)
A LinearRing intersects a RasterShape if it intersects the envelope of the raster, or if it is contained within the raster.