com.moximedia.aims
Class AimsPoint

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

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

Implementation of an ArcIMS point. If you intend to use the point in an Acetate layer of a map, use an AimsPointObject instead.

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

Field Summary
 
Fields inherited from interface com.moximedia.aims.AimsShapeObject
SHAPE_TYPE_ENVELOPE, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_POINT, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYLINE
 
Constructor Summary
AimsPoint()
          Creates a new point with no arguments.
AimsPoint(AimsPoint pt)
          Creates a new point with coordinate from another AimsPoint
AimsPoint(double x, double y)
          Creates a new point with coordinate values.
AimsPoint(java.awt.geom.Point2D pt)
          Creates a new point using a Point2D
AimsPoint(java.lang.String xy)
          Creates a new point with comma separated coordinate values contained in a String.
AimsPoint(java.lang.String point, java.lang.String cs)
          Creates a new point with specified separated coordinate values contained in a String.
 
Method Summary
 AimsPolygon buffer(double distance)
          Buffers the point by a specified distance and returns a polygon result.
 AimsPoint calculatePositionAt(double distance, double degrees)
          Calculates the position at a specified distance and angle from this point using a trigonometric calculation.
 java.lang.Object clone()
          Creates a copy of this object.
 boolean equals(AimsPoint pt)
           
 double getAngleTo(AimsPoint pt)
          Returns the trigonometric angle to another point.
 double getDistanceTo(AimsPoint pt)
          Returns the distance between two points.
 AimsPoint getOffsetFrom(AimsPoint anotherPoint)
          Returns the x and y offset from another point to this point.
 int getShapeType()
           
 double getX()
          Gets the X coordinate location of the point.
 double getY()
          Gets the Y coordinate location of the point object.
 boolean isValid()
          Returns a boolean indicator of whether this shape is valid.
 void offsetBy(AimsPoint offset)
          Sets the position of the point by adjusting it by the X and Y values contained in another point.
 void offsetBy(double deltaX, double deltaY)
          Sets the position of the point by adjusting it by X and Y offset values.
 AimsPoint project(Projection projection)
          Projects the point.
 AimsPoint project(Projection fromProjection, Projection toProjection)
          Projects the point from one projection to another.
 void setAxlAttribute(java.lang.String tag, java.lang.String name, java.lang.String value)
          Sets one of the attributes of this object using a string value.
 void setLocation(AimsPoint pt)
          Sets the location of the object using another AimsPoint.
 void setLocation(AimsPointObject pt)
          Sets the location of the object using an AimsPointObject.
 void setLocation(double x, double y)
          Sets the location of the object using coordinates.
 void setLocation(java.lang.String xy)
          Sets the location of the point using a comma separated text string.
 void setLocation(java.lang.String xy, java.lang.String cs)
          Sets the location of the point using a text string.
 void setX(double x)
          Sets the X coordinate location of the point.
 void setX(java.lang.String x)
           
 void setY(double y)
          Sets the Y coordinate location of the point.
 void setY(java.lang.String y)
           
 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()
          Returns the GML text string representing this point.
 com.vividsolutions.jts.geom.Coordinate toJtsCoordinate()
          Returns this object as a JTS Coordinate
 com.vividsolutions.jts.geom.Geometry toJtsGeometry()
          Returns this object as a JTS Geometry
 com.vividsolutions.jts.geom.Point toJtsPoint()
          Returns this object as a JTS Point
 java.awt.geom.Point2D toPoint2D()
          Returns this object as a Point2D
 java.lang.String toString()
          Returns a text representation of of this object.
 AimsPoint unproject(Projection projection)
          Unrojects the point.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AimsPoint

public AimsPoint()
Creates a new point with no arguments.


AimsPoint

public AimsPoint(double x,
                 double y)
Creates a new point with coordinate values.

Parameters:
x - The x location of the object
y - The y location of the object.

AimsPoint

public AimsPoint(java.lang.String xy)
Creates a new point with comma separated coordinate values contained in a String. Only the first two coordinates are used if more points are sent (e.g x,y.z).

Parameters:
xy - The xy location of the point

AimsPoint

public AimsPoint(java.lang.String point,
                 java.lang.String cs)
Creates a new point with specified separated coordinate values contained in a String. Only the first two coordinates are used if more points are sent (e.g x,y.z).

Parameters:
cs - The separator between the point's x and y values.

AimsPoint

public AimsPoint(AimsPoint pt)
Creates a new point with coordinate from another AimsPoint

Parameters:
pt - The AimsPoint containing the location of the object

AimsPoint

public AimsPoint(java.awt.geom.Point2D pt)
Creates a new point using a Point2D

Method Detail

setLocation

public void setLocation(java.lang.String xy)
Sets the location of the point using a comma separated text string. Only the first two points are used if more points are sent (e.g x,y.z).

Parameters:
xy - A text string like "1234,5673".

setLocation

public void setLocation(java.lang.String xy,
                        java.lang.String cs)
Sets the location of the point using a text string. Only the first two coordinates are used if more points are sent (e.g x,y.z).

Parameters:
xy - A text string like "1234,5673".
cs - The coordinate separator, e.g. ",".

getShapeType

public int getShapeType()
Specified by:
getShapeType in interface AimsShapeObject

clone

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

Specified by:
clone in interface AimsShapeObject
Returns:
An object that is a copy of this point. The object must be cast to an AimsPoint before use.

toJtsCoordinate

public com.vividsolutions.jts.geom.Coordinate toJtsCoordinate()
Returns this object as a JTS Coordinate

Returns:
A JTS Coordinate representing this shape.

toJtsGeometry

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

Specified by:
toJtsGeometry in interface AimsShapeObject
Returns:
A JTS Geometry representing this shape.

toJtsPoint

public com.vividsolutions.jts.geom.Point toJtsPoint()
Returns this object as a JTS Point

Returns:
A JTS Coordinate representing this shape.

toPoint2D

public java.awt.geom.Point2D toPoint2D()
Returns this object as a Point2D

Returns:
A Point2D representing this shape.

buffer

public AimsPolygon buffer(double distance)
Buffers the point by a specified distance and returns a polygon result.

Parameters:
distance - The buffer distance
Returns:
The buffer polygon.

getDistanceTo

public double getDistanceTo(AimsPoint pt)
Returns the distance between two points.

Parameters:
pt - The other point.
Returns:
the distance between the two points.

getAngleTo

public double getAngleTo(AimsPoint pt)
Returns the trigonometric angle to another point.

Parameters:
pt - The other point.
Returns:
The angle from this point to the other point in degrees.

getOffsetFrom

public AimsPoint getOffsetFrom(AimsPoint anotherPoint)
Returns the x and y offset from another point to this point.

Parameters:
anotherPoint - The point to compare this one to.
Returns:
The offset from the other point

calculatePositionAt

public AimsPoint calculatePositionAt(double distance,
                                     double degrees)
Calculates the position at a specified distance and angle from this point using a trigonometric calculation.

Parameters:
distance - The distance from this point.
degrees - The angle from this point.
Returns:
The calculated position.

offsetBy

public void offsetBy(AimsPoint offset)
Sets the position of the point by adjusting it by the X and Y values contained in another point.

Parameters:
offset - A point containing the X and Y delta offsets.

offsetBy

public void offsetBy(double deltaX,
                     double deltaY)
Sets the position of the point by adjusting it by X and Y offset values.

Parameters:
deltaX - The amount of X adjustment.
deltaY - The amount of Y adjustment.

equals

public boolean equals(AimsPoint pt)

setLocation

public void setLocation(double x,
                        double y)
Sets the location of the object using coordinates.

Parameters:
x - The x location of the object
y - The y location of the object.

setLocation

public void setLocation(AimsPoint pt)
Sets the location of the object using another AimsPoint.

Parameters:
pt - The point containing coordinates to use.

setLocation

public void setLocation(AimsPointObject pt)
Sets the location of the object using an AimsPointObject.

Parameters:
pt - The point object containing coordinates to use.

setX

public void setX(double x)
Sets the X coordinate location of the point.


setY

public void setY(double y)
Sets the Y coordinate location of the point.


setY

public void setY(java.lang.String y)

getX

public double getX()
Gets the X coordinate location of the point.

Returns:
The X coordinate location for the point.

setX

public void setX(java.lang.String x)

getY

public double getY()
Gets the Y coordinate location of the point object.

Returns:
The Y coordinate location for the point object.

toString

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

Returns:
A string describing the object

setAxlAttribute

public void setAxlAttribute(java.lang.String tag,
                            java.lang.String name,
                            java.lang.String value)
Sets one of the attributes of this object using a string value. This method should only be called from the SAX event handler.

Parameters:
tag - The AXL element tag containing this attribute (not used).
name - The AXL attribute name.
value - The AXL attribute value.

toAxlString

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

Specified by:
toAxlString in interface AimsShapeObject
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.

Specified by:
toAxlString in interface AimsShapeObject
Returns:
The AXL string to refresh this object.

toGmlString

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

Specified by:
toGmlString in interface AimsShapeObject
Returns:
The GML text string representing this point.

isValid

public boolean isValid()
Returns a boolean indicator of whether this shape is valid.

Specified by:
isValid in interface AimsShapeObject
Returns:
True if the shape is valid, otherwise false.

project

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

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

project

public AimsPoint project(Projection projection)
Projects the point. Assumes that the point is in geographic coordinate units.

Parameters:
projection - The projection used to project the point.
Returns:
The projected point.

unproject

public AimsPoint unproject(Projection projection)
Unrojects the point. Assumes that the point is in projected coordinate units.

Parameters:
projection - The projection used to unproject the point.
Returns:
The unprojected point.


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.