org.deegree_impl.model.cs
Class CoordinateSystemFactory

java.lang.Object
  extended byorg.deegree_impl.model.cs.CoordinateSystemFactory

public class CoordinateSystemFactory
extends java.lang.Object

Builds up complex objects from simpler objects or values. CoordinateSystemFactory allows applications to make coordinate systems that cannot be created by a CoordinateSystemAuthorityFactory. This factory is very flexible, whereas the authority factory is easier to use. So CoordinateSystemAuthorityFactory can be used to make 'standard' coordinate systems, and CoordinateSystemFactory can be used to make "special" coordinate systems. For example, the EPSG authority has codes for USA state plane coordinate systems using the NAD83 datum, but these coordinate systems always use meters. EPSG does not have codes for NAD83 state plane coordinate systems that use feet units. This factory lets an application create such a hybrid coordinate system.

Version:
1.00
Author:
OpenGIS (www.opengis.org), Martin Desruisseaux
See Also:
CS_CoordinateSystemFactory

Nested Class Summary
private  class CoordinateSystemFactory.Export
          Wrap a Info object for use with OpenGIS.
 
Field Summary
private static CoordinateSystemFactory DEFAULT
          Default coordinate system factory.
private  WeakHashSet pool
          Set of weak references to existing coordinate systems.
 
Constructor Summary
protected CoordinateSystemFactory()
          Default constructor.
private CoordinateSystemFactory(WeakHashSet pool)
          Construct a new factory with the specified pool.
 
Method Summary
 CompoundCoordinateSystem createCompoundCoordinateSystem(java.lang.String name, CoordinateSystem head, CoordinateSystem tail)
          Creates a compound coordinate system.
 Ellipsoid createEllipsoid(java.lang.String name, double semiMajorAxis, double semiMinorAxis, Unit unit)
          Creates an ellipsoid from radius values.
 Ellipsoid createFlattenedSphere(java.lang.String name, double semiMajorAxis, double inverseFlattening, Unit unit)
          Creates an ellipsoid from an major radius, and inverse flattening.
 GeographicCoordinateSystem createGeographicCoordinateSystem(java.lang.String name, HorizontalDatum datum)
          Creates a geographic coordinate system.
 GeographicCoordinateSystem createGeographicCoordinateSystem(java.lang.String name, Unit unit, HorizontalDatum datum, PrimeMeridian meridian, AxisInfo axis0, AxisInfo axis1)
          Creates a geographic coordinate system, which could be latitude/longiude or longitude/latitude.
 HorizontalDatum createHorizontalDatum(java.lang.String name, DatumType.Horizontal type, Ellipsoid ellipsoid, WGS84ConversionInfo toWGS84)
          Creates horizontal datum from ellipsoid and Bursa-Wolf parameters.
 HorizontalDatum createHorizontalDatum(java.lang.String name, Ellipsoid ellipsoid)
          Creates horizontal datum from an ellipsoid.
 LocalCoordinateSystem createLocalCoordinateSystem(java.lang.String name, LocalDatum datum, Unit unit, AxisInfo[] axes)
          Creates a local coordinate system.
 LocalDatum createLocalDatum(java.lang.String name, DatumType.Local type)
          Creates a local datum.
 PrimeMeridian createPrimeMeridian(java.lang.String name, Unit unit, double longitude)
          Creates a prime meridian, relative to Greenwich.
 ProjectedCoordinateSystem createProjectedCoordinateSystem(java.lang.String name, GeographicCoordinateSystem gcs, Projection projection)
          Creates a projected coordinate system using the specified geographic system.
 ProjectedCoordinateSystem createProjectedCoordinateSystem(java.lang.String name, GeographicCoordinateSystem gcs, Projection projection, Unit unit, AxisInfo axis0, AxisInfo axis1)
          Creates a projected coordinate system using a projection object.
 Projection createProjection(java.lang.String name, java.lang.String classification, Ellipsoid ellipsoid, java.awt.geom.Point2D centre, java.awt.geom.Point2D translation, double scaleFactor)
          Convenience method for constructing a projection using the specified ellipsoid.
 Projection createProjection(java.lang.String name, java.lang.String classification, ParameterList parameters)
          Creates a projection.
 ParameterList createProjectionParameterList(java.lang.String classification)
          Returns a default parameter list for the specified projection.
 VerticalCoordinateSystem createVerticalCoordinateSystem(java.lang.String name, VerticalDatum datum)
          Creates a vertical coordinate system from a datum.
 VerticalCoordinateSystem createVerticalCoordinateSystem(java.lang.String name, VerticalDatum datum, Unit unit, AxisInfo axis)
          Creates a vertical coordinate system from a datum and linear units.
 VerticalDatum createVerticalDatum(java.lang.String name, DatumType.Vertical type)
          Creates a vertical datum from an enumerated type value.
static CoordinateSystemFactory getDefault()
          Returns the default coordinate system factory.
(package private)  java.lang.Object toOpenGIS(java.lang.Object adapters)
          Returns an OpenGIS interface for this info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

private static CoordinateSystemFactory DEFAULT
Default coordinate system factory. Will be constructed only when first needed.


pool

private final WeakHashSet pool
Set of weak references to existing coordinate systems. This set is used in order to return pre-existing object instead of creating new one.

Constructor Detail

CoordinateSystemFactory

private CoordinateSystemFactory(WeakHashSet pool)
Construct a new factory with the specified pool.


CoordinateSystemFactory

protected CoordinateSystemFactory()
Default constructor.

Method Detail

getDefault

public static CoordinateSystemFactory getDefault()
Returns the default coordinate system factory.


createGeographicCoordinateSystem

public GeographicCoordinateSystem createGeographicCoordinateSystem(java.lang.String name,
                                                                   HorizontalDatum datum)
Creates a geographic coordinate system. This coordinate system will use longitude/latitude ordinates with longitude values increasing east and latitude values increasing north. Angular units are degrees and prime meridian is Greenwich.

Parameters:
name - Name to give new object.
datum - Horizontal datum for created coordinate system.

createGeographicCoordinateSystem

public GeographicCoordinateSystem createGeographicCoordinateSystem(java.lang.String name,
                                                                   Unit unit,
                                                                   HorizontalDatum datum,
                                                                   PrimeMeridian meridian,
                                                                   AxisInfo axis0,
                                                                   AxisInfo axis1)
Creates a geographic coordinate system, which could be latitude/longiude or longitude/latitude.

Parameters:
name - Name to give new object.
unit - Angular units for created coordinate system.
datum - Horizontal datum for created coordinate system.
meridian - Prime Meridian for created coordinate system.
axis0 - Details of 0th ordinates.
axis1 - Details of 1st ordinates.

createProjectedCoordinateSystem

public ProjectedCoordinateSystem createProjectedCoordinateSystem(java.lang.String name,
                                                                 GeographicCoordinateSystem gcs,
                                                                 Projection projection)
Creates a projected coordinate system using the specified geographic system. Projected coordinates will be in meters, x values increasing east and y values increasing north.

Parameters:
name - Name to give new object.
gcs - Geographic coordinate system to base projection on.
projection - Projection from geographic to projected coordinate system.

createProjectedCoordinateSystem

public ProjectedCoordinateSystem createProjectedCoordinateSystem(java.lang.String name,
                                                                 GeographicCoordinateSystem gcs,
                                                                 Projection projection,
                                                                 Unit unit,
                                                                 AxisInfo axis0,
                                                                 AxisInfo axis1)
Creates a projected coordinate system using a projection object.

Parameters:
name - Name to give new object.
gcs - Geographic coordinate system to base projection on.
projection - Projection from geographic to projected coordinate system.
unit - Linear units of returned PCS.
axis0 - Details of 0th ordinates in returned PCS coordinates.
axis1 - Details of 1st ordinates in returned PCS coordinates.

createVerticalCoordinateSystem

public VerticalCoordinateSystem createVerticalCoordinateSystem(java.lang.String name,
                                                               VerticalDatum datum)
Creates a vertical coordinate system from a datum. Units will be metres and values will be increasing upward.

Parameters:
name - Name to give new object.
datum - Datum to use for new coordinate system.

createVerticalCoordinateSystem

public VerticalCoordinateSystem createVerticalCoordinateSystem(java.lang.String name,
                                                               VerticalDatum datum,
                                                               Unit unit,
                                                               AxisInfo axis)
Creates a vertical coordinate system from a datum and linear units.

Parameters:
name - Name to give new object.
datum - Datum to use for new coordinate system.
unit - Units to use for new coordinate system.
axis - Axis to use for new coordinate system.

createCompoundCoordinateSystem

public CompoundCoordinateSystem createCompoundCoordinateSystem(java.lang.String name,
                                                               CoordinateSystem head,
                                                               CoordinateSystem tail)
Creates a compound coordinate system.

Parameters:
name - Name to give new object.
head - Coordinate system to use for earlier ordinates.
tail - Coordinate system to use for later ordinates.

createLocalCoordinateSystem

public LocalCoordinateSystem createLocalCoordinateSystem(java.lang.String name,
                                                         LocalDatum datum,
                                                         Unit unit,
                                                         AxisInfo[] axes)
Creates a local coordinate system. The dimension of the local coordinate system is determined by the size of the axis array. All the axes will have the same units. If you want to make a coordinate system with mixed units, then you can make a compound coordinate system from different local coordinate systems.

Parameters:
name - Name to give new object.
datum - Local datum to use in created CS.
unit - Units to use for all axes in created CS.
axes - Axes to use in created CS.

createEllipsoid

public Ellipsoid createEllipsoid(java.lang.String name,
                                 double semiMajorAxis,
                                 double semiMinorAxis,
                                 Unit unit)
Creates an ellipsoid from radius values.

Parameters:
name - Name to give new object.
semiMajorAxis - Equatorial radius in supplied linear units.
semiMinorAxis - Polar radius in supplied linear units.
unit - Linear units of ellipsoid axes.

createFlattenedSphere

public Ellipsoid createFlattenedSphere(java.lang.String name,
                                       double semiMajorAxis,
                                       double inverseFlattening,
                                       Unit unit)
Creates an ellipsoid from an major radius, and inverse flattening.

Parameters:
name - Name to give new object.
semiMajorAxis - Equatorial radius in supplied linear units.
inverseFlattening - Eccentricity of ellipsoid.
unit - Linear units of major axis.

createPrimeMeridian

public PrimeMeridian createPrimeMeridian(java.lang.String name,
                                         Unit unit,
                                         double longitude)
Creates a prime meridian, relative to Greenwich.

Parameters:
name - Name to give new object.
unit - Angular units of longitude.
longitude - Longitude of prime meridian in supplied angular units East of Greenwich.

createProjection

public Projection createProjection(java.lang.String name,
                                   java.lang.String classification,
                                   ParameterList parameters)
Creates a projection. The client must ensure that all the linear parameters are expressed in meters, and all the angular parameters are expressed in degrees. Also, they must supply "semi_major" and "semi_minor" parameters. The set of legal parameters and their default values can be queried using createProjectionParameterList(java.lang.String). Example:
  {link ParameterList} param = createProjectionParameterList("Transverse_Mercator")
                                      .setParameter("semi_major", 6378206.4)
                                      .setParameter("semi_minor", 6356583.8);
  Projection proj = createProjection("My projection", "Transverse_Mercator", param);
 

Parameters:
name - Name to give new object.
classification - Classification string for projection (e.g. "Transverse_Mercator").
parameters - Parameters to use for projection. A default set of parameters can be constructed using createProjectionParameterList(classification) and initialized using a chain of setParameter(...) calls.

createProjection

public Projection createProjection(java.lang.String name,
                                   java.lang.String classification,
                                   Ellipsoid ellipsoid,
                                   java.awt.geom.Point2D centre,
                                   java.awt.geom.Point2D translation,
                                   double scaleFactor)
Convenience method for constructing a projection using the specified ellipsoid.

Parameters:
name - Name to give new object.
classification - Classification string for projection (e.g. "Transverse_Mercator").
ellipsoid - Ellipsoid parameter. If non-null, then "semi_major" and "semi_minor" parameters will be set according.
centre - Central meridian and latitude of origin, in degrees. If non-null, then "central_meridian" and "latitude_of_origin" will be set according.
translation - False easting and northing, in metres. If non-null, then "false_easting" and "false_northing" will be set according.

createProjectionParameterList

public ParameterList createProjectionParameterList(java.lang.String classification)
Returns a default parameter list for the specified projection.

Parameters:
classification - Classification string for projection (e.g. "Transverse_Mercator").
Returns:
A default parameter list for the supplied projection class.
See Also:
createProjection(String, String, ParameterList)

createHorizontalDatum

public HorizontalDatum createHorizontalDatum(java.lang.String name,
                                             DatumType.Horizontal type,
                                             Ellipsoid ellipsoid,
                                             WGS84ConversionInfo toWGS84)
Creates horizontal datum from ellipsoid and Bursa-Wolf parameters. Since this method contains a set of Bursa-Wolf parameters, the created datum will always have a relationship to WGS84. If you wish to create a horizontal datum that has no relationship with WGS84, then you can either specify DatumType.Horizontal.OTHER as the horizontalDatumType, or create it via WKT.

Parameters:
name - Name to give new object.
type - Type of horizontal datum to create.
ellipsoid - Ellipsoid to use in new horizontal datum.
toWGS84 - Suggested approximate conversion from new datum to WGS84.

createHorizontalDatum

public HorizontalDatum createHorizontalDatum(java.lang.String name,
                                             Ellipsoid ellipsoid)
Creates horizontal datum from an ellipsoid. The datum type will be DatumType.Horizontal.OTHER.

Parameters:
name - Name to give new object.
ellipsoid - Ellipsoid to use in new horizontal datum.

createVerticalDatum

public VerticalDatum createVerticalDatum(java.lang.String name,
                                         DatumType.Vertical type)
Creates a vertical datum from an enumerated type value.

Parameters:
name - Name to give new object.
type - Type of vertical datum to create.

createLocalDatum

public LocalDatum createLocalDatum(java.lang.String name,
                                   DatumType.Local type)
Creates a local datum.

Parameters:
name - Name to give new object.
type - Type of local datum to create.

toOpenGIS

final java.lang.Object toOpenGIS(java.lang.Object adapters)
Returns an OpenGIS interface for this info. The returned object is suitable for RMI use. Note: The returned type is a generic Object in order to avoid too early class loading of OpenGIS interface.