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

java.lang.Object
  extended by com.esri.adf.web.data.geometry.WebGeometry
      extended by com.esri.adf.web.data.geometry.WebPoint
All Implemented Interfaces:
Serializable, Comparable<WebPoint>

public class WebPoint
extends WebGeometry
implements Comparable<WebPoint>

WebPoint is a class used for representing points.

See Also:
Serialized Form

Field Summary
static double DEFAULT_EPSILON
           
 
Fields inherited from class com.esri.adf.web.data.geometry.WebGeometry
spatialReference
 
Constructor Summary
WebPoint()
          Creates an instance of WebPoint at 0, 0.
WebPoint(double x, double y)
          Constructs an instance of WebPoint.
WebPoint(double x, double y, WebSpatialReference spatialReference)
          Constructs a instance of WebPoint.
WebPoint(WebPoint copy)
          Constructs an instance of WebPoint that is a copy of the given WebPoint.
 
Method Summary
 int compareTo(WebPoint wp)
           
 boolean equals(Object obj)
           
 WebPoint fromMapGeometry(WebExtent extent, int width, int height)
           Converts a geometry in map coordinates to a geometry of the same type in screen coordinates.
 WebPoint fromMapGeometry(WebMap webMap)
           Converts a geometry in map coordinates to a geometry of the same type in screen coordinates.
static WebPoint fromMapPoint(WebPoint mapPt, WebExtent mapExtent, int mapWidth, int mapHeight)
           Converts a WebPoint in map coordinates to a WebPoint in screen coordinates.
 String getGeometryType()
           Returns a text representing the type of the geometry.
 double getX()
          Returns a horizontal coordinate of the point
 double getY()
          Returns a vertical coordinate of the point
 int hashCode()
           
 WebPoint project(WebSpatialReference toSpatialReference)
           Converts the geometry in map coordinates from the spatialReference of this geometry to a geometry in the desired spatial reference.
 void putCoords(double x, double y)
          Sets the point coordinates
 void setX(double x)
          Sets a horizontal coordinate of the point
 void setY(double y)
          Sets a vertical coordinate of the point
 WebPoint toMapGeometry(WebExtent extent, int width, int height)
           Converts a geometry in screen coordinates to a geometry of the same type in map coordinates.
 WebPoint toMapGeometry(WebMap webMap)
           Converts a geometry in screen coordinates to a geometry of the same type in map coordinates.
static WebPoint toMapPoint(WebPoint screenPt, WebExtent mapExtent, int mapWidth, int mapHeight)
           Converts a WebPoint in screen coordinates to a geometry of the same type in map coordinates.
 String toString()
           
 
Methods inherited from class com.esri.adf.web.data.geometry.WebGeometry
getSpatialReference, setSpatialReference
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_EPSILON

public static final double DEFAULT_EPSILON
See Also:
Constant Field Values
Constructor Detail

WebPoint

public WebPoint(double x,
                double y,
                WebSpatialReference spatialReference)
Constructs a instance of WebPoint.

Parameters:
x - the horizontal coordinate of the point
y - the vertical coordinate of the point
spatialReference - the spatial reference of the point

WebPoint

public WebPoint(double x,
                double y)
Constructs an instance of WebPoint.

Parameters:
x - the horizontal coordinate of the point
y - the vertical coordinate of the point

WebPoint

public WebPoint(WebPoint copy)
Constructs an instance of WebPoint that is a copy of the given WebPoint.

Parameters:
copy - the WebPoint to clone

WebPoint

public WebPoint()
Creates an instance of WebPoint at 0, 0.

Method Detail

getY

public double getY()
Returns a vertical coordinate of the point

Returns:
a vertical coordinate of the point

setX

public void setX(double x)
Sets a horizontal coordinate of the point

Parameters:
x - a horizontal coordinate of the point

setY

public void setY(double y)
Sets a vertical coordinate of the point

Parameters:
y - a vertical coordinate of the point

getX

public double getX()
Returns a horizontal coordinate of the point

Returns:
a horizontal coordinate of the point

putCoords

public void putCoords(double x,
                      double y)
Sets the point coordinates

Parameters:
x - a horizontal coordinate of the point
y - a vertical coordinate of the point

getGeometryType

public String getGeometryType()
Description copied from class: WebGeometry

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

Specified by:
getGeometryType in class WebGeometry
Returns:
a text representing the type of the geometry

toMapGeometry

public WebPoint toMapGeometry(WebMap webMap)
Description copied from class: WebGeometry

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.

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

toMapGeometry

public WebPoint toMapGeometry(WebExtent extent,
                              int width,
                              int height)
Description copied from class: WebGeometry

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.

Overrides:
toMapGeometry in class WebGeometry
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 WebPoint fromMapGeometry(WebMap webMap)
Description copied from class: WebGeometry

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.

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

fromMapGeometry

public WebPoint fromMapGeometry(WebExtent extent,
                                int width,
                                int height)
Description copied from class: WebGeometry

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.

Overrides:
fromMapGeometry in class WebGeometry
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

toString

public String toString()
Overrides:
toString in class Object

toMapPoint

public static WebPoint toMapPoint(WebPoint screenPt,
                                  WebExtent mapExtent,
                                  int mapWidth,
                                  int mapHeight)

Converts a WebPoint 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:
screenPt - the point to convert
mapExtent - the WebExtent of the map image
mapWidth - the width of the map image
mapHeight - the height of the map image
Returns:
the WebGeometry in map coordinates

fromMapPoint

public static WebPoint fromMapPoint(WebPoint mapPt,
                                    WebExtent mapExtent,
                                    int mapWidth,
                                    int mapHeight)

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

Parameters:
mapPt -
mapExtent - the WebExtent of the map image
mapWidth - the width of the map image
mapHeight - the height of the map image
Returns:
the WebGeometry in screen coordinates

project

public WebPoint project(WebSpatialReference toSpatialReference)
Description copied from class: WebGeometry

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.

Specified by:
project in class WebGeometry
Parameters:
toSpatialReference - the desired spatial reference of the projected geometry
Returns:
the projected WebGeometry

hashCode

public int hashCode()
Overrides:
hashCode in class WebGeometry

equals

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

compareTo

public int compareTo(WebPoint wp)
Specified by:
compareTo in interface Comparable<WebPoint>