com.esri.adf.web.data.geometry
Class WebGeometry

java.lang.Object
  extended by com.esri.adf.web.data.geometry.WebGeometry
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
WebCircle, WebExtent, WebOval, WebPoint, WebPointCollection, WebPolygon, WebPolyline

public abstract class WebGeometry
extends Object
implements Serializable

WebGeometry is an abstract base class for all geometries in the ADF. All web geometries can be used to represent both screen as well as map geometries. The toMapGeometry(WebMap) and fromMapGeometry(WebMap) methods can be used to convert geometries to and from screen coordinates to map coordinates. Additionally, the WebGeometry class declares an abstract project(WebSpatialReference) method. This method can be used to convert map geometries from one coordinate system to another.

See Also:
Serialized Form

Field Summary
protected  WebSpatialReference spatialReference
          The coordinate system of this geometry.
 
Constructor Summary
WebGeometry()
           
 
Method Summary
 boolean equals(Object obj)
           
 WebGeometry fromMapGeometry(WebExtent extent, int width, int height)
           Converts a geometry in map coordinates to a geometry of the same type in screen coordinates.
abstract  WebGeometry fromMapGeometry(WebMap webMap)
           Converts a geometry in map coordinates to a geometry of the same type in screen coordinates.
abstract  String getGeometryType()
           Returns a text representing the type of the geometry.
 WebSpatialReference getSpatialReference()
           Returns the coordinate system of this geometry.
 int hashCode()
           
abstract  WebGeometry project(WebSpatialReference toSpatialReference)
           Converts the geometry in map coordinates from the spatialReference of this geometry to a geometry in the desired spatial reference.
 void setSpatialReference(WebSpatialReference spatialReference)
           Sets the coordinate system of this geometry.
 WebGeometry toMapGeometry(WebExtent extent, int width, int height)
           Converts a geometry in screen coordinates to a geometry of the same type in map coordinates.
abstract  WebGeometry toMapGeometry(WebMap webMap)
           Converts a geometry in screen coordinates to a geometry of the same type in map coordinates.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spatialReference

protected WebSpatialReference spatialReference
The coordinate system of this geometry. When the geometry represents a client-side geometry the spatialReference is null.

Constructor Detail

WebGeometry

public WebGeometry()
Method Detail

getGeometryType

public abstract String getGeometryType()

Returns a text representing the type of the geometry. WebGeometry objects of the same type must return the same text.

Returns:
a text representing the type of the geometry

toMapGeometry

public abstract WebGeometry toMapGeometry(WebMap webMap)

Converts a geometry in screen coordinates to a geometry of the same type in map coordinates. The coordinate system of the converted geometry is the same as the coordinate system of the WebMap.

Parameters:
webMap - The WebMap based on which the coordinates need to be converted
Returns:
the WebGeometry in map coordinates

toMapGeometry

public WebGeometry toMapGeometry(WebExtent extent,
                                 int width,
                                 int height)

Converts a geometry in screen coordinates to a geometry of the same type in map coordinates. The coordinate system of the converted geometry is the same as the coordinate system of the specified extent.

Parameters:
extent - the WebExtent of the map image
width - the width of the map image
height - the height of the map image
Returns:
the WebGeometry in map coordinates

fromMapGeometry

public abstract WebGeometry fromMapGeometry(WebMap webMap)

Converts a geometry in map coordinates to a geometry of the same type in screen coordinates. Since the converted geometry is a screen geometry, the coordinate system of the converted geometry will be null.

Parameters:
webMap - The WebMap based on which the coordinates need to be converted
Returns:
the WebGeometry in screen coordinates

fromMapGeometry

public WebGeometry fromMapGeometry(WebExtent extent,
                                   int width,
                                   int height)

Converts a geometry in map coordinates to a geometry of the same type in screen coordinates. Since the converted geometry is a screen geometry, the coordinate system of the converted geometry will be null.

Parameters:
extent - the WebExtent of the map image
width - the width of the map image
height - the height of the map image
Returns:
the WebGeometry in screen coordinates

getSpatialReference

public WebSpatialReference getSpatialReference()

Returns the coordinate system of this geometry. When the geometry represents a client-side geometry the spatialReference is null.

Returns:
the coordinate system of this geometry

setSpatialReference

public void setSpatialReference(WebSpatialReference spatialReference)

Sets the coordinate system of this geometry. When the geometry represents a client-side geometry the spatialReference is null.

Parameters:
spatialReference - the coordinate system of this geometry

project

public abstract WebGeometry project(WebSpatialReference toSpatialReference)

Converts the geometry in map coordinates from the spatialReference of this geometry to a geometry in the desired spatial reference. If the desired spatial reference is same as that of this geometry, this same geometry is returned. Otherwise, a new WebGeometry object is created and populated with the converted coordinates. The type of the projected geometry is same as this geometry.

Parameters:
toSpatialReference - the desired spatial reference of the projected geometry
Returns:
the projected WebGeometry

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object