Class Importer
java.lang.Object
org.locationtech.proj4j.geoapi.Importer
Builder of PROJ4J objects from GeoAPI objects. If the GeoAPI object has been created by a
call to a
Wrappers.geoapi(…) method, then the wrapped object is returned directly.
Otherwise, this class tries to creates new PROJ4J instances using the information provided
in the GeoAPI object. It may fail, in which case an UnconvertibleInstanceException
is thrown.- Author:
- Martin Desruisseaux (Geomatys)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RegistryA registry for creatingProjectioninstances if needed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(org.opengis.parameter.ParameterValueGroup src) Returns the given parameters as a PROJ4J implementation.convert(org.opengis.referencing.crs.CRSAuthorityFactory src) Returns the given authority factory as a PROJ4J implementation.convert(org.opengis.referencing.crs.SingleCRS src) Returns the given CRS as a PROJ4J implementation.convert(org.opengis.referencing.datum.Ellipsoid src) Returns the given ellipsoid as a PROJ4J implementation.convert(org.opengis.referencing.datum.GeodeticDatum src) Returns the given datum as a PROJ4J implementation.convert(org.opengis.referencing.datum.PrimeMeridian src) Returns the given prime meridian as a PROJ4J implementation.convert(org.opengis.referencing.operation.CoordinateOperation src) Returns the given coordinate operation as a PROJ4J implementation.convert(org.opengis.referencing.operation.CoordinateOperationFactory src) Returns the given coordinate operation factory as a PROJ4J implementation.Returns the registry to use for creating PROJ4J objects from a name.
-
Field Details
-
registry
A registry for creatingProjectioninstances if needed. Ifnull, a default instance will be created when first needed.- See Also:
-
-
Constructor Details
-
Importer
public Importer()Creates a default instance. -
Importer
Creates an importer which will use the given registry.- Parameters:
registry- a registry for creatingProjectioninstances, ornullfor default
-
-
Method Details
-
getRegistry
Returns the registry to use for creating PROJ4J objects from a name.. If no registry was specified at construction time, a default instance is created the first time that this method is invoked.- Returns:
- the registry to use for creating PROJ4J objects from a name
-
convert
Returns the given authority factory as a PROJ4J implementation. This method returns the backing implementation. If the given factory is not backed by a PROJ4J implementation, then the current implementation throws an exception.- Parameters:
src- the object to unwrap or convert, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
Returns the given CRS as a PROJ4J implementation. This method tries to return the backing implementation if possible, or otherwise copies the properties in a new PROJ4J instance.- Parameters:
src- the object to unwrap or convert, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
Returns the given datum as a PROJ4J implementation. This method tries to return the backing implementation if possible, or otherwise copies the properties in a new PROJ4J instance.- Parameters:
src- the object to unwrap or convert, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
Returns the given ellipsoid as a PROJ4J implementation. This method tries to return the backing implementation if possible, or otherwise copies the properties in a new PROJ4J instance.- Parameters:
src- the object to unwrap or convert, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
Returns the given prime meridian as a PROJ4J implementation. This method tries to return the backing implementation if possible, or an equivalent PROJ4J instance otherwise.- Parameters:
src- the object to unwrap, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
Returns the given parameters as a PROJ4J implementation. This method tries to return the backing implementation if possible, or an equivalent PROJ4J instance otherwise.- Parameters:
src- the object to unwrap, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
public CoordinateTransformFactory convert(org.opengis.referencing.operation.CoordinateOperationFactory src) Returns the given coordinate operation factory as a PROJ4J implementation. This method returns the backing implementation. If the given factory is not backed by a PROJ4J implementation, then the current implementation throws an exception.- Parameters:
src- the object to unwrap or convert, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-
convert
Returns the given coordinate operation as a PROJ4J implementation. This method returns the backing implementation. If the given factory is not backed by a PROJ4J implementation, then the current implementation throws an exception.- Parameters:
src- the object to unwrap or convert, ornull- Returns:
- the PROJ4J implementation, or
nullif the given object was null - Throws:
UnconvertibleInstanceException- if the given object cannot be unwrapped or converted
-