com.moximedia.aims
Class AimsRing

java.lang.Object
  extended bycom.moximedia.aims.AimsRing
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class AimsRing
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Implementation of an ArcIMS polygon ring object.

Author:
Doug Cates - www.moximedia.com
See Also:
Serialized Form

Constructor Summary
AimsRing()
          Creates a new point object with no arguments.
AimsRing(AimsPoints pts)
          Creates a new ring object with an AimsPoints object.
 
Method Summary
 AimsHole addHole()
          Adds a new hole to the ring, and returns the hole object.
 void addHole(AimsHole hole)
          Adds a new hole to the ring.
 void addPoint(AimsPoint pt)
          Adds a point to the ring.
 boolean addVertexToClosestLineSegment(AimsPoint pt)
           
protected  boolean addVertexToSegmentAtDistance(AimsPoint pt, double segmentDistance)
           
 java.lang.Object clone()
           
 boolean contains(AimsPoint pt)
          Tests to see if the ring contains a point, not included in any holes within the ring.
 boolean contains(AimsPoints pts)
          Tests to see if the ring contains a point from a points list, not included in any holes within the ring.
 boolean contains(AimsPolygon polygon)
           
 void densify(double distance)
          Densifies the points in the shape by a distance.
 void generalize(double distance)
          Generalizes the points in the shape by a distance.
 double getArea()
          Returns the area of the ring, in square map units.
 AimsPoint getClosestVertex(AimsPoint pt)
          Gets the closest vertex in the AimsRing to the specified point.
 double getDistanceToClosestLineSegment(AimsPoint pt)
           
 AimsEnvelope getExtent()
          Returns the extent of the ring, or null if the ring has no points.
 AimsPoints getExteriorPoints()
          Gets the exterior points of the ring object.
 java.util.Vector getHoles()
          Gets the holes in a Vector object.
 AimsPoints getPoints()
          Gets the points of the ring object and associated holes.
 boolean hasHoles()
          Reports whether the ring contains holes.
 boolean movePoint(AimsPoint ptFrom, AimsPoint ptTo)
          Moves a point of the polygon ring to a new position.
 void offsetBy(AimsPoint offset)
          Offsets the points in the ring by the x and y in a point.
 AimsRing project(Projection projection)
          Projects this object to the specified projection.
 AimsRing project(Projection fromProjection, Projection toProjection)
          Projects this object from one projection to another.
 boolean removePoint(AimsPoint pt)
          Removes a point from the ring or one of it's holes.
 void setPoints(AimsPoints points)
          Sets the points of the ring object.
 java.lang.String toAxlString()
          Returns the AXL string to refresh this object.
 java.lang.String toAxlString(AimsEnvironment env)
          Returns the AXL string to refresh this object.
 java.lang.String toGmlString()
           
 com.vividsolutions.jts.geom.LinearRing toJtsLinearRing()
          Returns tthe exterior of this object as a JTS linear ring object.
 com.vividsolutions.jts.geom.Geometry toJtsPolygon()
          Returns this object as a JTS Polygon object.
 java.lang.String toString()
          Returns a text representation of of this object.
 AimsRing unproject(Projection projection)
          Unprojects this object to geographic from the specified projection.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AimsRing

public AimsRing()
Creates a new point object with no arguments.


AimsRing

public AimsRing(AimsPoints pts)
Creates a new ring object with an AimsPoints object.

Method Detail

getArea

public double getArea()
Returns the area of the ring, in square map units.

Returns:
The area of the ring, less the area of any holes.

getClosestVertex

public AimsPoint getClosestVertex(AimsPoint pt)
Gets the closest vertex in the AimsRing to the specified point. This routine also uses the hole vertexes for comparison.

Parameters:
pt - The point to compare the vertexes to.
Returns:
The closest vertex to the specified point, or null if there are no points in the path.

addVertexToClosestLineSegment

public boolean addVertexToClosestLineSegment(AimsPoint pt)

getDistanceToClosestLineSegment

public double getDistanceToClosestLineSegment(AimsPoint pt)

addVertexToSegmentAtDistance

protected boolean addVertexToSegmentAtDistance(AimsPoint pt,
                                               double segmentDistance)

addHole

public AimsHole addHole()
Adds a new hole to the ring, and returns the hole object.


addHole

public void addHole(AimsHole hole)
Adds a new hole to the ring.

Parameters:
hole - The hole to add to the ring.

addPoint

public void addPoint(AimsPoint pt)
Adds a point to the ring.

Parameters:
pt - The point to add to the ring.

densify

public void densify(double distance)
Densifies the points in the shape by a distance.

Parameters:
distance - The densify distance.

generalize

public void generalize(double distance)
Generalizes the points in the shape by a distance.

Parameters:
distance - The generalize distance.

offsetBy

public void offsetBy(AimsPoint offset)
Offsets the points in the ring by the x and y in a point.

Parameters:
offset - An AimsPoint object containing the offset.

removePoint

public boolean removePoint(AimsPoint pt)
Removes a point from the ring or one of it's holes.

Parameters:
pt - The point to remove,
Returns:
True if the point is removed, otherwise false.

movePoint

public boolean movePoint(AimsPoint ptFrom,
                         AimsPoint ptTo)
Moves a point of the polygon ring to a new position.

Parameters:
ptFrom - The point to move.
ptTo - Where to move it.
Returns:
True if the point is moved, otherwise false.

contains

public boolean contains(AimsPoints pts)
Tests to see if the ring contains a point from a points list, not included in any holes within the ring.

Returns:
True if the ring contains the point, otherwise false.

contains

public boolean contains(AimsPoint pt)
Tests to see if the ring contains a point, not included in any holes within the ring.

Returns:
True if the ring contains the point, otherwise false.

hasHoles

public boolean hasHoles()
Reports whether the ring contains holes.

Returns:
True if there are holes, otherwise false.

getHoles

public java.util.Vector getHoles()
Gets the holes in a Vector object.

Returns:
The holes in a Vector object.

getPoints

public AimsPoints getPoints()
Gets the points of the ring object and associated holes.


getExteriorPoints

public AimsPoints getExteriorPoints()
Gets the exterior points of the ring object.


setPoints

public void setPoints(AimsPoints points)
Sets the points of the ring object.

Parameters:
points - An AimsPoints object containing the ring points.

getExtent

public AimsEnvelope getExtent()
Returns the extent of the ring, or null if the ring has no points.

Returns:
An AimsEnvelope containing the extent.

toString

public java.lang.String toString()
Returns a text representation of of this object.

Returns:
A string describing the object

toAxlString

public java.lang.String toAxlString()
Returns the AXL string to refresh this object. This method is not typically used by the application programmer.

Returns:
The AXL string to refresh this object.

toAxlString

public java.lang.String toAxlString(AimsEnvironment env)
Returns the AXL string to refresh this object. This method is not typically used by the application programmer.

Returns:
The AXL string to refresh this object.

toGmlString

public java.lang.String toGmlString()

clone

public java.lang.Object clone()

toJtsLinearRing

public com.vividsolutions.jts.geom.LinearRing toJtsLinearRing()
Returns tthe exterior of this object as a JTS linear ring object.

Returns:
The exterior of this object as a JTS linear ring object.

toJtsPolygon

public com.vividsolutions.jts.geom.Geometry toJtsPolygon()
Returns this object as a JTS Polygon object.

Returns:
This object as a JTS Polygon object.

contains

public boolean contains(AimsPolygon polygon)

project

public AimsRing project(Projection fromProjection,
                        Projection toProjection)
Projects this object from one projection to another.

Parameters:
fromProjection - The projection of this object.
toProjection - The target projection.
Returns:
The projected object.

project

public AimsRing project(Projection projection)
Projects this object to the specified projection. It is assumed that the coordinate system of the original object is geographic.

Parameters:
projection - The original projection system.
Returns:
An object containing the projected coordinates.

unproject

public AimsRing unproject(Projection projection)
Unprojects this object to geographic from the specified projection.

Parameters:
projection - The projection system.
Returns:
An object containing the unprojected coordinates.


Internet Mapping Framework for ArcIMS Java Object Model API (v5.0.004)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.