Spatial DataBlade
JAVA API v8.21

com.ibm.spatial.srs
Class CoordRef

java.lang.Object
  extended by com.ibm.spatial.srs.CoordRef
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

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

The CoordRef class represents a coordinate reference. A coordinate reference includes the coordinate system and a set of offset and scale values that convert floating point real-world coordinate values into integer system coordinates for compatibility with ESRI's SDE layer.

See Also:
Serialized Form

Field Summary
static int ALL
          All fields (except srid) are compared for equivalence
static int AUTH
          Authority name and authority id are compared for equivalence
static int DESC
          Descriptions are compared for equivalence
static int EXTENT
          Coordinate values extents are compared for equivalence
static int SRTEXT
          The projection strings are compared for equivalence
 
Constructor Summary
CoordRef()
          Constructs a default coordinate reference object.
CoordRef(CoordRef cr)
          Constructs a coordinate reference object by copying fields from the specified coordinate reference.
 
Method Summary
 java.lang.Object clone()
          Returns a copy of this object.
 double[] convertMValuesToWorld(long[] m)
          Converts an array of measures stored as system values into its equivalent array of world values.
 long convertMValueToSystem(double planarValue)
          Converts a world M value into its equivalent system (internal) value.
 double convertMValueToWorld(long systemValue)
          Converts a M system value into its equivalent world value.
 long convertXValueToSystem(double planarValue)
          Converts a world X coordinate value into its equivalent system (internal) value.
 double convertXValueToWorld(long systemValue)
          Converts a X system value into its equivalent world coordinate value.
 double[] convertXYValuesToWorld(long[] xy)
          Converts an array of {x,y} coordinate pairs into its equivalent array of world coordinate values.
 long convertYValueToSystem(double planarValue)
          Converts a world Y coordinate value into its equivalent system (internal) value.
 double convertYValueToWorld(long systemValue)
          Converts a Y system value into its equivalent world coordinate value.
 double[] convertZValuesToWorld(long[] z)
          Converts an array of z ordinates stored as system values into its equivalent array of world values.
 long convertZValueToSystem(double planarValue)
          Converts a world Z value into its equivalent system (internal) value.
 double convertZValueToWorld(long systemValue)
          Converts a Z system value into its equivalent world value.
 CoordRef duplicate()
          Creates a duplicate of this coordinate reference object.
 boolean equals(java.lang.Object anObject)
          Compares this object to the specified object.
 java.lang.String getAuthName()
          Gets the authoritative name for the spatial reference system associated to this coordinate reference object.
 java.lang.Integer getAuthSrid()
          Gets the authoritative id for the spatial reference system associated to this coordinate reference object.
 java.lang.String getDescription()
          Gets a description of this coordinate reference object.
 int getDimension()
          Returns the dimension of the coordinate system.
 Envelope getExtent()
          Gets the extent of coordinate values covered by this coordinate reference object.
 double getFalseM()
          Gets the M false origin for this coordinate reference object.
 double getFalseX()
          Gets the X false origin for this coordinate reference object.
 double getFalseY()
          Gets the Y false origin for this coordinate reference object.
 double getFalseZ()
          Gets the Z false origin for this coordinate reference object.
 double getMUnits()
          Gets the M scale factor for this coordinate reference object.
 int getSrid()
          Gets the database spatial reference ID that was used to define this coordinate reference object.
 java.lang.String getSrtext()
          Returns the well-known text representation of this coordinate system, modeled after the Petrotechnical Open Software Corporation/European Professional Surveyors Group (POSC/EPSG) coordinate system data model.
 double getXYUnits()
          Gets the XY scale factor for this coordinate reference object.
 double getZUnits()
          Gets the Z scale factor for this coordinate reference object.
 int hashCode()
          Returns a hash code for this CoordRef object.
 boolean sameAs(CoordRef cr, int flags)
          Checks whether this object is equivalent to the object passed as argument.
 void setAuthName(java.lang.String name)
          Sets the authoritative name for the spatial reference system associated to this coordinate reference object.
 void setAuthSrid(java.lang.Integer id)
          Sets the authoritative id for the spatial reference system associated to this coordinate reference object.
 void setDescription(java.lang.String s)
          Sets a description of this coordinate reference object.
 void setDimension(int dimension)
          Sets the dimension of the coordinate system.
 void setExtent(Envelope env)
          Sets the X, Y, Z, and M false origins and scale factors so that this coordinate reference covers objects inside the envelope specified by env.
 void setM(double falseM, double mUnits)
          Sets the M false origin and scale factor for this coordinate reference object.
 void setSrid(int srid)
          Sets a spatial reference ID for this coordinate reference object.
 void setSrtext(java.lang.String srtext)
          Sets the well-known text representation of this coordinate system, modeled after the Petrotechnical Open Software Corporation/European Professional Surveyors Group (POSC/EPSG) coordinate system data model.
 void setXY(double falseX, double falseY, double xyUnits)
          Sets the X and Y false origins and scale factor.
 void setZ(double falseZ, double zUnits)
          Sets the Z false origin and scale factor for this coordinate reference object.
 java.lang.String toString()
          Returns a string representation of this coordinate reference object.
 void unsetSrid()
          "Unsets" the srid of this object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SRTEXT

public static final int SRTEXT
The projection strings are compared for equivalence

See Also:
sameAs(com.ibm.spatial.srs.CoordRef, int), Constant Field Values

AUTH

public static final int AUTH
Authority name and authority id are compared for equivalence

See Also:
sameAs(com.ibm.spatial.srs.CoordRef, int), Constant Field Values

DESC

public static final int DESC
Descriptions are compared for equivalence

See Also:
sameAs(com.ibm.spatial.srs.CoordRef, int), Constant Field Values

EXTENT

public static final int EXTENT
Coordinate values extents are compared for equivalence

See Also:
sameAs(com.ibm.spatial.srs.CoordRef, int), Constant Field Values

ALL

public static final int ALL
All fields (except srid) are compared for equivalence

See Also:
sameAs(com.ibm.spatial.srs.CoordRef, int), Constant Field Values
Constructor Detail

CoordRef

public CoordRef()
Constructs a default coordinate reference object.

The default projection text is set to an empty string. The XY extent is set to cover the full range of latitude-longitude coordinates and preserve 6 decimal digits, equivalent to a precision of approximately 1 meter.

The caller should never use directly this object. Instead, he should set the extent, projection string, description, and authoritative fields, register the new coordinate reference with a CoordRefManager instance (see CoordRefManager.put()), then use the returned CoordRef object reference.

See Also:
CoordRefManager.put(com.ibm.spatial.srs.CoordRef)

CoordRef

public CoordRef(CoordRef cr)
Constructs a coordinate reference object by copying fields from the specified coordinate reference.

Parameters:
cr - a coordinate reference
Method Detail

getFalseX

public double getFalseX()
Gets the X false origin for this coordinate reference object.

Returns:
The X false origin for this coordinate reference object.

getFalseY

public double getFalseY()
Gets the Y false origin for this coordinate reference object.

Returns:
The Y false origin for this coordinate reference object.

getXYUnits

public double getXYUnits()
Gets the XY scale factor for this coordinate reference object. The scale factor is used for converting between system values and world values.

Returns:
The XY scale factor for this coordinate reference object.

getFalseZ

public double getFalseZ()
Gets the Z false origin for this coordinate reference object.

Returns:
The Z false origin for this coordinate reference object.

getZUnits

public double getZUnits()
Gets the Z scale factor for this coordinate reference object. The scale factor is used for converting between system values and world values.

Returns:
The Z scale factor for this coordinate reference object.

getFalseM

public double getFalseM()
Gets the M false origin for this coordinate reference object.

Returns:
The M false origin for this coordinate reference object.

getMUnits

public double getMUnits()
Gets the M scale factor for this coordinate reference object. The scale factor is used for converting between system values and world values.

Returns:
The M scale factor for this coordinate reference object.

getExtent

public Envelope getExtent()
Gets the extent of coordinate values covered by this coordinate reference object.

Returns:
an Envelope object holding the domain of coordinate values covered by this coordinate reference object.

getDimension

public int getDimension()
Returns the dimension of the coordinate system.

Returns:
Dimension of the coordinate system.

getSrtext

public java.lang.String getSrtext()
Returns the well-known text representation of this coordinate system, modeled after the Petrotechnical Open Software Corporation/European Professional Surveyors Group (POSC/EPSG) coordinate system data model.

Returns:
The well known text representation used by this coordinate reference object.

getAuthName

public java.lang.String getAuthName()
Gets the authoritative name for the spatial reference system associated to this coordinate reference object.

Returns:
The authoritative name for the spatial reference system associated to this coordinate reference object, or null if the property is not set for this object.

getAuthSrid

public java.lang.Integer getAuthSrid()
Gets the authoritative id for the spatial reference system associated to this coordinate reference object.

Returns:
The authoritative id for the spatial reference system associated to this coordinate reference object, or null if the property is not set for this object.

getDescription

public java.lang.String getDescription()
Gets a description of this coordinate reference object. This is a descriptive text that may be displayed by a GUI in relation to this object.

Returns:
A description of this coordinate reference object, or null if there is no description text set for this object.

getSrid

public int getSrid()
Gets the database spatial reference ID that was used to define this coordinate reference object.

Returns:
The database spatial reference ID that was used to define this coordinate reference object.

setDimension

public void setDimension(int dimension)
Sets the dimension of the coordinate system. Only 2 and 3 are accepted as valid argument values.

Parameters:
dimension - Dimension of the coordinate system.

setSrtext

public void setSrtext(java.lang.String srtext)
Sets the well-known text representation of this coordinate system, modeled after the Petrotechnical Open Software Corporation/European Professional Surveyors Group (POSC/EPSG) coordinate system data model.

The argument string is trimmed before being assigned to the internal field.

Parameters:
srtext - The text representation used by this coordinate reference object. If the argument is null, an empty string is assigned; null values are not accepted for this attribute when the object is serialized to the database.

setAuthName

public void setAuthName(java.lang.String name)
Sets the authoritative name for the spatial reference system associated to this coordinate reference object. The argument string is trimmed before being assigned to the authoritative name field.

Parameters:
name - The authoritative name for the spatial reference system associated to this coordinate reference object.

setAuthSrid

public void setAuthSrid(java.lang.Integer id)
Sets the authoritative id for the spatial reference system associated to this coordinate reference object.

Parameters:
id - The authoritative id for the spatial reference system associated to this coordinate reference object, or null if the property is not set for this object.

setDescription

public void setDescription(java.lang.String s)
Sets a description of this coordinate reference object. This is a descriptive text that may be displayed by a GUI in relation to this object. The argument string is trimmed before being assigned to the description field.

Parameters:
s - a description of this coordinate reference object.

setSrid

public void setSrid(int srid)
Sets a spatial reference ID for this coordinate reference object.

The user may also "unset" the srid, in order to indicate odify an existing CoordRef, then store it into a CoordRefManager instance.

Parameters:
srid - the spatial reference id for this object
See Also:
unsetSrid(), CoordRefManager.put(com.ibm.spatial.srs.CoordRef)

unsetSrid

public void unsetSrid()
"Unsets" the srid of this object.

An unset srid indicates a CoordRef object that is not stored in the database.

The srid is in a "unset" state when the object is created. The user may also set the srid to a known value, in order to modify a CoordRef already stored into a CoordRefManager instance.

See Also:
setSrid(int), CoordRefManager.put(com.ibm.spatial.srs.CoordRef)

setExtent

public void setExtent(Envelope env)
Sets the X, Y, Z, and M false origins and scale factors so that this coordinate reference covers objects inside the envelope specified by env.

If the envelope doesn't have a Z or a M extent, then the existing Z and M extents of this coordinate reference are left unchanged.

Parameters:
env - the extent of coordinates that are covered by this object.

setXY

public void setXY(double falseX,
                  double falseY,
                  double xyUnits)
Sets the X and Y false origins and scale factor.

Parameters:
falseX - false X origin
falseY - false Y origin
xyUnits - scale factor for both x and y coordinates

setZ

public void setZ(double falseZ,
                 double zUnits)
Sets the Z false origin and scale factor for this coordinate reference object.

Parameters:
falseZ - false Z origin
zUnits - scale factor for the Z coordinates

setM

public void setM(double falseM,
                 double mUnits)
Sets the M false origin and scale factor for this coordinate reference object.

Parameters:
falseM - false M origin
mUnits - scale factor for the M coordinates

convertXValueToSystem

public long convertXValueToSystem(double planarValue)
                           throws SpatialException
Converts a world X coordinate value into its equivalent system (internal) value.

Parameters:
planarValue - The world coordinate value.
Returns:
The equivalent system value.
Throws:
SpatialException - if the value is outside of the coordinate reference bounds

convertYValueToSystem

public long convertYValueToSystem(double planarValue)
                           throws SpatialException
Converts a world Y coordinate value into its equivalent system (internal) value.

Parameters:
planarValue - The world coordinate value.
Returns:
The equivalent system value.
Throws:
SpatialException - if the value is outside of the coordinate reference bounds

convertZValueToSystem

public long convertZValueToSystem(double planarValue)
                           throws SpatialException
Converts a world Z value into its equivalent system (internal) value.

Parameters:
planarValue - The world coordinate value.
Returns:
The equivalent system value.
Throws:
SpatialException - if the value is outside of the coordinate reference bounds

convertMValueToSystem

public long convertMValueToSystem(double planarValue)
                           throws SpatialException
Converts a world M value into its equivalent system (internal) value.

Parameters:
planarValue - The world coordinate value.
Returns:
The equivalent system value.
Throws:
SpatialException - if the value is outside of the coordinate reference bounds

convertXValueToWorld

public double convertXValueToWorld(long systemValue)
Converts a X system value into its equivalent world coordinate value.

Parameters:
systemValue - The internal (system) value.
Returns:
The equivalent real-world value.

convertXYValuesToWorld

public double[] convertXYValuesToWorld(long[] xy)
Converts an array of {x,y} coordinate pairs into its equivalent array of world coordinate values.

Parameters:
xy - an array of {x,y} coordinate pairs stored as internal (system) values.
Returns:
The equivalent array with real-world values.

convertZValuesToWorld

public double[] convertZValuesToWorld(long[] z)
Converts an array of z ordinates stored as system values into its equivalent array of world values.

Parameters:
z - an array of z ordinates stored as internal (system) values.
Returns:
The equivalent array with real-world values.

convertMValuesToWorld

public double[] convertMValuesToWorld(long[] m)
Converts an array of measures stored as system values into its equivalent array of world values.

Parameters:
m - an array of m ordinates (measures) stored as internal (system) values.
Returns:
The equivalent array with real-world values.

convertYValueToWorld

public double convertYValueToWorld(long systemValue)
Converts a Y system value into its equivalent world coordinate value.

Parameters:
systemValue - The internal (system) value.
Returns:
The equivalent real-world value.

convertZValueToWorld

public double convertZValueToWorld(long systemValue)
Converts a Z system value into its equivalent world value.

Parameters:
systemValue - The internal (system) value.
Returns:
The equivalent real-world value.

convertMValueToWorld

public double convertMValueToWorld(long systemValue)
Converts a M system value into its equivalent world value.

Parameters:
systemValue - The internal (system) value.
Returns:
The equivalent real-world value.

duplicate

public CoordRef duplicate()
Creates a duplicate of this coordinate reference object.

Returns:
A duplicate of this coordinate reference object.

sameAs

public boolean sameAs(CoordRef cr,
                      int flags)
Checks whether this object is equivalent to the object passed as argument. The equivalence test only compares fields specified by the second argument.

Parameters:
cr - another coordinate reference object
flags - a combination of the following flag values:
  • SRTEXT - the well known text representation of the coordinate system associated with the two objects (returned by getSrtext()) should be identical
  • AUTH - the authName and authSrid fields of the two objects should be identical
  • DESC - the descriptions should be identical
  • EXTENT - the extents of the coordinate values ("world" values) that can be represented using the two objects should be equivalent. Two extents are equivalent if the correspondent extents defined in internal coordinate values ("system" values) are identical.
Returns:
true if both coordinate reference objects are equal, otherwise false.

equals

public boolean equals(java.lang.Object anObject)
Compares this object to the specified object. The result is true if and only if the argument is not null and is an object that represents the same coordinate reference as this object.

Overrides:
equals in class java.lang.Object
Parameters:
anObject - the object to compare this object against
Returns:
true if the objects are equal; false otherwise.

hashCode

public int hashCode()
Returns a hash code for this CoordRef object. The result is the exclusive OR of the has codes of every field of this object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.

toString

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

Overrides:
toString in class java.lang.Object
Returns:
The string form of this object

clone

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

Overrides:
clone in class java.lang.Object
Returns:
a copy of this object

Spatial DataBlade
JAVA API v8.21


Licensed Materials - Property of IBM
Copyright IBM Corp. 2002, 2012 All Rights Reserved.