com.moximedia.aims
Class AimsPoints

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended bycom.moximedia.aims.AimsPoints
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class AimsPoints
extends java.util.Vector
implements java.io.Serializable, java.lang.Cloneable

AimsPoints is an ordered collection of AimsPoint objects. An AimsPoints object is used to construct lines and polygons.

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

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AimsPoints()
          Creates new AimsPoints
AimsPoints(com.vividsolutions.jts.geom.Point[] points)
          Creates a new AimsPoints object from a com.vividsolutions.jts.geom.Point array.
AimsPoints(java.lang.String commaSeparatedPoints)
          Creates a new AimsPoints collection from a string of x,y values that are separated by commas between the x and y values and the other coordinates (e.g.
AimsPoints(java.lang.String points, java.lang.String coordinateSeparator, java.lang.String tupleSeparator)
          Creates a new AimsPoints collection from a coords string.
 
Method Summary
 boolean addPoint(AimsPoint pt)
          Adds an AimsPoint to the end of the collection.
 boolean addPoint(AimsPointObject pt)
          Adds an AimsPoint to the end of the collection using the coordinates of an AimsPointObject.
 void addPoints(AimsPoints pts)
          Adds the points in another points object to the end of this points object.
 void clear()
          Clears the AimsPoints (removes all points from the collection).
 java.lang.Object clone()
          Returns a clone of this object
 void close()
          Closes the points, so that the end point is the same as the starting point.
 void densify(double distance)
          Densifies the points in the points list by a distance.
 void generalize(double distance)
          Generalizes the points in the points list by a distance.
 AimsPoint getClosestPointTo(AimsPoint pt)
          Returns the point in the points list that is closest to the specified point.
 int getCount()
          Returns the number of AimsPoints contained in the collection.
 AimsEnvelope getExtent()
          Returns the extent of the points list, or null if the list has no points.
 AimsPoint getPoint(int index)
          Returns the AimsPoint at the specified index position
 boolean insertPoint(AimsPoint pt)
          Adds an AimsPoint to the beginning of the collection.
 boolean insertPoint(AimsPoint pt, int index)
          Adds an AimsPoint to the collection at the specified position.
 boolean isClockwise()
          Returns whether the points list is clockwise.
 void offsetBy(AimsPoint offset)
          Offsets the points in the points list by the x and y in a point.
 AimsPoints project(Projection projection)
          Projects this object to the specified projection.
 AimsPoints project(Projection fromProjection, Projection toProjection)
          Projects the points from one projection to another.
 boolean removePoint(int index)
          Removes the AimsPoint at specified index
 boolean replacePoint(int index, AimsPoint pt)
          Replaces the AimsPoint at specified index
 void reverse()
          Reverses the points in the points list
 void setClockwise()
          Sets the points list to clockwise.
 void setCoordinates(java.lang.String coordinates)
           
 void setCounterClockwise()
          Sets the points list to counterclockwise.
 java.lang.String toAxlString(AimsEnvironment env)
          Returns a string containing the points in format.
 java.lang.String toCoordsAxlString()
          Returns a string containing the points in coords format, enclosed in the tags, using the separators in the default environment object.
 java.lang.String toCoordsAxlString(AimsEnvironment env)
          Returns a string containing the points in coords format, enclosed in the tags, using the separators in the specified environment object.
 java.lang.String toCoordsString()
          Returns a string containing the points in coords format.
 java.lang.String toCoordsString(AimsEnvironment env)
          Returns a string containing the points in coords format, using the separators in the specified environment object.
 java.lang.String toCoordsString(java.lang.String coordinateSeparator, java.lang.String tupleSeparator)
          Returns a string containing the points in coords format, using the specified separators.
 java.lang.String toGmlString()
          Returns the GML string representing this object.
 com.vividsolutions.jts.geom.Coordinate[] toJtsCoordinateArray()
          Returns this object as a com.vividsolutions.jts.geom.Coordinate array.
 com.vividsolutions.jts.geom.LinearRing toJtsLinearRing()
          Returns this object as a com.vividsolutions.jts.geom.LinearRing
 com.vividsolutions.jts.geom.Geometry toJtsLineString()
          Returns this object as a com.vividsolutions.jts.geom.LineString
 com.vividsolutions.jts.geom.Geometry toJtsMultiPoint()
          Returns this object as a com.vividsolutions.jts.geom.MultiPoint
 com.vividsolutions.jts.geom.Point[] toJtsPointArray()
          Returns this object as a com.vividsolutions.jts.geom.Point array.
 java.util.Vector toLineSegments()
          Returns the points array as a vector of java.awt.geom.Line2D.Double objects representing the line segments between points.
 java.lang.String toString()
          Returns a string representation of this object
 AimsPoints unproject(Projection projection)
          Unprojects this object to geographic from the specified projection.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

AimsPoints

public AimsPoints()
Creates new AimsPoints


AimsPoints

public AimsPoints(java.lang.String commaSeparatedPoints)
Creates a new AimsPoints collection from a string of x,y values that are separated by commas between the x and y values and the other coordinates (e.g. "0,0,100,100").

Parameters:
commaSeparatedPoints - The string containing coordinates.

AimsPoints

public AimsPoints(com.vividsolutions.jts.geom.Point[] points)
Creates a new AimsPoints object from a com.vividsolutions.jts.geom.Point array.

Parameters:
points - A com.vividsolutions.jts.geom.Point array.

AimsPoints

public AimsPoints(java.lang.String points,
                  java.lang.String coordinateSeparator,
                  java.lang.String tupleSeparator)
Creates a new AimsPoints collection from a coords string.

Parameters:
points - The coordinate string.
coordinateSeparator - The separator between the point's x and y values.
tupleSeparator - The separator between pairs of points.
Method Detail

setCoordinates

public void setCoordinates(java.lang.String coordinates)

toJtsCoordinateArray

public com.vividsolutions.jts.geom.Coordinate[] toJtsCoordinateArray()
Returns this object as a com.vividsolutions.jts.geom.Coordinate array.

Returns:
A com.vividsolutions.jts.geom.Coordinate array.

toJtsPointArray

public com.vividsolutions.jts.geom.Point[] toJtsPointArray()
Returns this object as a com.vividsolutions.jts.geom.Point array.

Returns:
A com.vividsolutions.jts.geom.Point array.

toJtsLinearRing

public com.vividsolutions.jts.geom.LinearRing toJtsLinearRing()
Returns this object as a com.vividsolutions.jts.geom.LinearRing

Returns:
A com.vividsolutions.jts.geom.LinearRing

toJtsLineString

public com.vividsolutions.jts.geom.Geometry toJtsLineString()
Returns this object as a com.vividsolutions.jts.geom.LineString

Returns:
A com.vividsolutions.jts.geom.LineString

toJtsMultiPoint

public com.vividsolutions.jts.geom.Geometry toJtsMultiPoint()
Returns this object as a com.vividsolutions.jts.geom.MultiPoint

Returns:
A com.vividsolutions.jts.geom.MultiPoint

close

public void close()
Closes the points, so that the end point is the same as the starting point.


densify

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

Parameters:
distance - The densify distance.

generalize

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

Parameters:
distance - The generalize distance.

offsetBy

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

Parameters:
offset - An AimsPoint object containing the offset.

reverse

public void reverse()
Reverses the points in the points list


setCounterClockwise

public void setCounterClockwise()
Sets the points list to counterclockwise.


setClockwise

public void setClockwise()
Sets the points list to clockwise.


isClockwise

public boolean isClockwise()
Returns whether the points list is clockwise.

Returns:
True if the list is clockwise, otherwise false.

getExtent

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

Returns:
An AimsEnvelope containing the extent.

getClosestPointTo

public AimsPoint getClosestPointTo(AimsPoint pt)
Returns the point in the points list that is closest to the specified point.

Parameters:
pt - The point used in the search.
Returns:
The closest point, or null if there are no points in the points list.

addPoint

public boolean addPoint(AimsPoint pt)
Adds an AimsPoint to the end of the collection.

Parameters:
pt - An AimsPoint object.
Returns:
True if added, false if not.

insertPoint

public boolean insertPoint(AimsPoint pt)
Adds an AimsPoint to the beginning of the collection.

Parameters:
pt - An AimsPoint object.
Returns:
True if added, false if not.

insertPoint

public boolean insertPoint(AimsPoint pt,
                           int index)
Adds an AimsPoint to the collection at the specified position.

Parameters:
pt - An AimsPoint object.
index - The zero based position of the position to add the point.
Returns:
True if added, false if not.

addPoint

public boolean addPoint(AimsPointObject pt)
Adds an AimsPoint to the end of the collection using the coordinates of an AimsPointObject.

Parameters:
pt - An AimsPointObject object.
Returns:
True if added, false if not.

addPoints

public void addPoints(AimsPoints pts)
Adds the points in another points object to the end of this points object.

Parameters:
pts - A set of points to add to this one.

getPoint

public AimsPoint getPoint(int index)
Returns the AimsPoint at the specified index position

Parameters:
index - The index position of the point

getCount

public int getCount()
Returns the number of AimsPoints contained in the collection.


toLineSegments

public java.util.Vector toLineSegments()
Returns the points array as a vector of java.awt.geom.Line2D.Double objects representing the line segments between points.

Returns:
A vector of ava.awt.geom.Line2D.Double objects.

replacePoint

public boolean replacePoint(int index,
                            AimsPoint pt)
Replaces the AimsPoint at specified index

Parameters:
index - The index of the AimsPoint to replace.
pt - The AimsPoint to replace.
Returns:
True if replaced, otherwise false.

removePoint

public boolean removePoint(int index)
Removes the AimsPoint at specified index

Parameters:
index - The index of the AimsPoint to remove.
Returns:
True if removed, otherwise false.

clear

public void clear()
Clears the AimsPoints (removes all points from the collection).

Specified by:
clear in interface java.util.List

toString

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

Returns:
A string representation of this object.

toCoordsString

public java.lang.String toCoordsString()
Returns a string containing the points in coords format.

Returns:
A string containing the points in coords format.

toCoordsString

public java.lang.String toCoordsString(java.lang.String coordinateSeparator,
                                       java.lang.String tupleSeparator)
Returns a string containing the points in coords format, using the specified separators.

Parameters:
coordinateSeparator - The separator between coordinates.
tupleSeparator - The separator between coordinate pairs.
Returns:
A string containing the points in coords format.

toCoordsString

public java.lang.String toCoordsString(AimsEnvironment env)
Returns a string containing the points in coords format, using the separators in the specified environment object.

Parameters:
env - The AimsEnvironment containing coordinate settings.
Returns:
A string containing the points in coords format.

toCoordsAxlString

public java.lang.String toCoordsAxlString()
Returns a string containing the points in coords format, enclosed in the tags, using the separators in the default environment object.

Returns:
A string containing the points in coords format.

toCoordsAxlString

public java.lang.String toCoordsAxlString(AimsEnvironment env)
Returns a string containing the points in coords format, enclosed in the tags, using the separators in the specified environment object.

Returns:
A string containing the points in coords format.

toAxlString

public java.lang.String toAxlString(AimsEnvironment env)
Returns a string containing the points in format.

Returns:
A string containing the points in format.

toGmlString

public java.lang.String toGmlString()
Returns the GML string representing this object.

Returns:
The GML string representing this object.

clone

public java.lang.Object clone()
Returns a clone of this object

Returns:
This object as a java.lang.Object. Remember to cast the clone to the proper object type before using.

project

public AimsPoints project(Projection fromProjection,
                          Projection toProjection)
Projects the points from one projection to another.

Parameters:
fromProjection - The projection or this point.
toProjection - The target projection.
Returns:
The projected points.

project

public AimsPoints 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 AimsPoints 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.