com.esri.core.geometry
Class SpatialReference

java.lang.Object
  extended by com.esri.core.geometry.SpatialReference
All Implemented Interfaces:
Serializable

public class SpatialReference
extends Object
implements Serializable

An abstract class that represent the spatial reference for the geometry. SpatialReference classes are immutable.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary
static class SpatialReference.Type
          The spatial reference type can be local, geographic, or projected.
 
Constructor Summary
protected SpatialReference()
          Creates an empty Spatial Reference
protected SpatialReference(int wkid)
           
  SpatialReference(String wktext)
          The Constructor.
 
Method Summary
static SpatialReference create(int wkid)
          Creates an instance of the spatial reference based on the provided well known ID for the horizontal coordinate system.
static SpatialReference create(String wktext)
          Creates an instance of the spatial reference based on the provided well known text representation for the horizontal coordinate system.
static SpatialReference createLocal()
          Creates a local spatial reference.
static SpatialReference createLocal(Unit unit)
          Creates a local spatial reference.
static SpatialReference fromJson(org.codehaus.jackson.JsonParser parser)
          Returns spatial reference from JsonParser.
 Point[] fromMilitaryGrid(String[] mgrsStrings, int mgrsConversionMode)
          Converts Military Grid strings into coordinates.
 SpatialReference.Type getCoordinateSystemType()
          Returns map projection type.
 SpatialReference getGCS()
          Get the Geographic Coordinate System of the spatial reference.
 int getID()
          Returns the well known ID for the horizontal coordinate system of the spatial reference.
 int getLatestID()
          Returns the most current well known ID, the Geometry engine knows about, for the horizontal coordinate system.
 int getOldID()
          Returns the oldest value of the well known ID for the horizontal coordinate system of the spatial reference.
 String getText()
          Returns the well known text for the for the horizontal coordinate system of the spatial reference.
 double getTolerance()
          Get the XY tolerance of the spatial reference.
 Unit getUnit()
          Returns the unit from a spatial reference.
 String[] toMilitaryGrid(int mgrsConversionMode, int numOfDigits, boolean rounding, boolean addSpaces, Point[] coordinates)
          Converts a list of coordinates into military grid strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpatialReference

protected SpatialReference()
Creates an empty Spatial Reference


SpatialReference

protected SpatialReference(int wkid)

SpatialReference

public SpatialReference(String wktext)
The Constructor.

Parameters:
wktext - the wktext
Since:
1.0
Method Detail

create

public static SpatialReference create(int wkid)
Creates an instance of the spatial reference based on the provided well known ID for the horizontal coordinate system.

Parameters:
wkid - The well know ID.
Returns:
SpatialReference The spatial reference.
Since:
1.0

create

public static SpatialReference create(String wktext)
Creates an instance of the spatial reference based on the provided well known text representation for the horizontal coordinate system.

Parameters:
wktext - The well-known text string representation of spatial reference.
Returns:
SpatialReference The spatial reference.
Since:
1.0

createLocal

public static SpatialReference createLocal(Unit unit)
Creates a local spatial reference. A local spatial reference is not associated with any map coordinate system.

Parameters:
unit - The unit of the local coordinate system.
Returns:
SpatialReference The spatial reference.
Since:
1.0

createLocal

public static SpatialReference createLocal()
Creates a local spatial reference. A local spatial reference is not associated with any map coordinate system.

Returns:
SpatialReference The spatial reference.
Since:
1.0

fromJson

public static SpatialReference fromJson(org.codehaus.jackson.JsonParser parser)
                                 throws Exception
Returns spatial reference from JsonParser.

Parameters:
parser - The JSON parser.
Returns:
The spatial reference or null if there is no spatial reference information, or the parser does not point to an object start.
Throws:
Exception - if parsing has failed
Since:
1.0

getCoordinateSystemType

public SpatialReference.Type getCoordinateSystemType()
Returns map projection type.

Returns:
Map Projection Type
Since:
1.0

getID

public int getID()
Returns the well known ID for the horizontal coordinate system of the spatial reference.

Returns:
wkid The well known ID.
Since:
1.0

getLatestID

public int getLatestID()
Returns the most current well known ID, the Geometry engine knows about, for the horizontal coordinate system.

Returns:
the latest id
Since:
1.0

getOldID

public int getOldID()
Returns the oldest value of the well known ID for the horizontal coordinate system of the spatial reference. This ID is used for JSON serialization.

Returns:
the old id
Since:
1.0

getText

public String getText()
Returns the well known text for the for the horizontal coordinate system of the spatial reference.

Returns:
the text
Since:
1.0

getUnit

public Unit getUnit()
Returns the unit from a spatial reference.

Returns:
The spatial reference unit.
Since:
1.0

toMilitaryGrid

public String[] toMilitaryGrid(int mgrsConversionMode,
                               int numOfDigits,
                               boolean rounding,
                               boolean addSpaces,
                               Point[] coordinates)
Converts a list of coordinates into military grid strings. Each string is 15 characters (2 numbers, 3 letters, 10 numbers OR 3 letters plus 10 numbers [polar region]). Default should be (5 for 2 #s, 3 letters and 10 numbers, and a total of 15).

Parameters:
mgrsConversionMode - use the MgrsConversionMode interface for conversion options
numOfDigits - the num of digits
rounding - the rounding
addSpaces - the add spaces
coordinates - the coordinates
Returns:
array of MGRS strings
Since:
1.0

fromMilitaryGrid

public Point[] fromMilitaryGrid(String[] mgrsStrings,
                                int mgrsConversionMode)
Converts Military Grid strings into coordinates.

Parameters:
mgrsStrings - Strings to convert to points.
mgrsConversionMode - use the MgrsConversionMode interface for conversion options.
Returns:
An array of points.
Since:
1.0

getTolerance

public double getTolerance()
Get the XY tolerance of the spatial reference.

Returns:
The XY tolerance of the spatial reference as double.
Since:
1.0

getGCS

public SpatialReference getGCS()
Get the Geographic Coordinate System of the spatial reference.

Returns:
The geographic coordinate system of the spatial reference.
Since:
1.0


Copyright © 2010. All Rights Reserved.