org.deegree_impl.model.ct
Class MathTransformProvider

java.lang.Object
  extended byorg.deegree_impl.model.ct.MathTransformProvider
Direct Known Subclasses:
AbridgedMolodenskiTransform.Provider, GeocentricTransform.Provider, MapProjection.Provider, MatrixTransform.Provider

public abstract class MathTransformProvider
extends java.lang.Object

Base class for MathTransform providers. Instance of this class allow the creation of transform objects from a classification name.

Note: this class is not part of OpenGIS specification and may change in a future version. Do not rely strongly on it.

Version:
1.0
Author:
Martin Desruisseaux

Field Summary
private  java.lang.String classification
          The classification name.
static ParameterListDescriptor DEFAULT_PROJECTION_DESCRIPTOR
          A default parameter list descriptor for map projections.
private  ParameterListDescriptor descriptor
          The parameter list descriptor.
protected static Range LATITUDE_RANGE
          Range of latitude values.
protected static Range LONGITUDE_RANGE
          Range of longitude values.
private  int nameKey
          Resources key for a human readable name.
protected static Range POSITIVE_RANGE
          Range of positives values.
private  java.lang.Object[] properties
          The set parameters to use for ParameterListDescriptor construction, or null if the descriptor is already constructed.
private static int RECORD_LENGTH
          Number of colunms in table properties below.
private static java.lang.Double ZERO
          The zero value.
 
Constructor Summary
(package private) MathTransformProvider(java.lang.String classification, int nameKey, ParameterListDescriptor inherit)
          Construct a new provider.
protected MathTransformProvider(java.lang.String classification, ParameterListDescriptor inherit)
          Construct a new provider.
 
Method Summary
abstract  MathTransform create(ParameterList parameters)
          Returns a transform for the specified parameters.
 java.lang.String getClassName()
          Returns the classification name.
private static ParameterListDescriptor getDescriptor(java.lang.Object[] properties)
          Returns the parameter list descriptor for the specified properties list.
 java.lang.String getName(java.util.Locale locale)
          Returns a human readable name localized for the specified locale.
 ParameterList getParameterList()
          Returns a newly created parameter list.
(package private)  ParameterListDescriptor getParameterListDescriptor()
          Returns the parameter list descriptor.
private  void put(java.lang.String parameter, java.lang.Class type, java.lang.Object defaultValue, Range range)
          Adds or changes a parameter to this math transform provider.
protected  void put(java.lang.String parameter, double defaultValue, Range range)
          Adds or changes a parameter to this math transform provider.
(package private)  void putInt(java.lang.String parameter, int defaultValue, Range range)
          Adds or changes an integer parameter to this math transform provider.
 java.lang.String toString()
          Returns a string representation for this provider.
private static java.lang.Object wrap(double value)
          Wrap the specified double value in an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

private static final java.lang.Double ZERO
The zero value.


POSITIVE_RANGE

protected static final Range POSITIVE_RANGE
Range of positives values. Range goes from 0 exclusive to positive infinity.


LONGITUDE_RANGE

protected static final Range LONGITUDE_RANGE
Range of longitude values. Range goes from -180° to +180° inclusives.


LATITUDE_RANGE

protected static final Range LATITUDE_RANGE
Range of latitude values. Range goes from -90° to +90° inclusives.


RECORD_LENGTH

private static final int RECORD_LENGTH
Number of colunms in table properties below.

See Also:
Constant Field Values

DEFAULT_PROJECTION_DESCRIPTOR

public static final ParameterListDescriptor DEFAULT_PROJECTION_DESCRIPTOR
A default parameter list descriptor for map projections. This descriptor declare "semi_major", "semi_minor", "central_meridian", "latitude_of_origin", "false_easting" and "false_northing" parameters.


properties

private java.lang.Object[] properties
The set parameters to use for ParameterListDescriptor construction, or null if the descriptor is already constructed.


descriptor

private ParameterListDescriptor descriptor
The parameter list descriptor. This object will be constructed only the first time it is needed.


classification

private final java.lang.String classification
The classification name. This name do not contains leading or trailing blanks.


nameKey

private final int nameKey
Resources key for a human readable name. This is used for getName(java.util.Locale) implementation.

Constructor Detail

MathTransformProvider

protected MathTransformProvider(java.lang.String classification,
                                ParameterListDescriptor inherit)
Construct a new provider.

Parameters:
classification - The classification name.
inherit - The parameter list descriptor to inherit from, or null if there is none. All parameter descriptions from inherit will be copied into this newly created MathTransformProvider. For map projections, this argument may be DEFAULT_PROJECTION_DESCRIPTOR. Subclasses may add or change parameters in their constructor by invoking put(java.lang.String, double, Range).

MathTransformProvider

MathTransformProvider(java.lang.String classification,
                      int nameKey,
                      ParameterListDescriptor inherit)
Construct a new provider.

Parameters:
classification - The classification name.
nameKey - Resources key for a human readable name. This is used for getName(java.util.Locale) implementation.
inherit - The parameter list descriptor to inherit from, or null if there is none. All parameter descriptions from inherit will be copied into this newly created MathTransformProvider. For map projections, this argument may be DEFAULT_PROJECTION_DESCRIPTOR. Subclasses may add or change parameters in their constructor by invoking put(java.lang.String, double, Range).
Method Detail

put

protected final void put(java.lang.String parameter,
                         double defaultValue,
                         Range range)
                  throws java.lang.IllegalStateException
Adds or changes a parameter to this math transform provider. If this MathTransformProvider has been constructed with DEFAULT_PROJECTION_DESCRIPTOR as argument, then default values are already provided for "semi_major", "semi_minor", "central_meridian" and "latitude_of_origin". Subclasses may call this method in their constructor for adding or changing parameters.

Parameters:
parameter - The parameter name.
defaultValue - The default value for this parameter, or Double.NaN if there is none.
range - The range of legal values. May be one of the predefined constants (POSITIVE_RANGE, LONGITUDE_RANGE, LATITUDE_RANGE) or any other Range object. May be null if all values are valid for this parameter.
Throws:
java.lang.IllegalStateException - If getParameterList() has already been invoked prior to this call.

putInt

final void putInt(java.lang.String parameter,
                  int defaultValue,
                  Range range)
           throws java.lang.IllegalStateException
Adds or changes an integer parameter to this math transform provider. Support of integer values help to make the API clearer, but the true OpenGIS's parameter class support only double values. This is why this method is not yet public. Current SEAGIS version use integer parameters only for matrix dimension and for a custom parameter in geocentric transform. We hope the user will barely notice it...

Parameters:
parameter - The parameter name.
defaultValue - The default value for this parameter.
range - The range of legal values. This is up to the caller to build is own range with integer values (predefined ranges like POSITIVE_RANGE will not work).
Throws:
java.lang.IllegalStateException - If getParameterList() has already been invoked prior to this call.

put

private void put(java.lang.String parameter,
                 java.lang.Class type,
                 java.lang.Object defaultValue,
                 Range range)
          throws java.lang.IllegalStateException
Adds or changes a parameter to this math transform provider.

Parameters:
parameter - The parameter name.
type - The parameter type.
defaultValue - The default value for this parameter.
range - The range of legal values.
Throws:
java.lang.IllegalStateException - If getParameterList() has already been invoked prior to this call.

wrap

private static java.lang.Object wrap(double value)
Wrap the specified double value in an object.


getDescriptor

private static ParameterListDescriptor getDescriptor(java.lang.Object[] properties)
Returns the parameter list descriptor for the specified properties list.


getClassName

public java.lang.String getClassName()
Returns the classification name.


getName

public java.lang.String getName(java.util.Locale locale)
Returns a human readable name localized for the specified locale. If no name is available for the specified locale, this method may returns a name in an arbitrary locale.


getParameterListDescriptor

final ParameterListDescriptor getParameterListDescriptor()
Returns the parameter list descriptor.


getParameterList

public ParameterList getParameterList()
Returns a newly created parameter list. The set of parameter depend of the transform this provider is for. Parameters may have default values and a range of validity.


create

public abstract MathTransform create(ParameterList parameters)
Returns a transform for the specified parameters.

Parameters:
parameters - The parameter values in standard units.
Returns:
A MathTransform object of this classification.

toString

public java.lang.String toString()
Returns a string representation for this provider.