|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectFactory
ReferencingFactory
AbstractAuthorityFactory
DirectAuthorityFactory
WKTParsingAuthorityFactory
@ThreadSafe public class WKTParsingAuthorityFactory
A CRS Authority Factory that manages object creation by parsing Well Known Text
(WKT) strings. The strings may be loaded from property files or be queried in a database (for
example the "spatial_ref_sys" table in a PostGIS database).
This base implementation expects a map of (code, WKT) entries, where the
authority codes are the keys and WKT strings are the values. If the map is backed by a store
which may throw checked exceptions (for example a connection to a PostGIS database), then it
shall wrap the checked exceptions in BackingStoreExceptions.
Declaring more than one authority
There is usually only one authority for a given instance of WKTParsingAuthorityFactory,
but more authorities can be given to the constructor if the CRS objects to create should have
more than one identifier, each with the
same code but different namespace. For example a
factory for CRS defined
by ESRI uses the "ESRI" namespace, but also the "EPSG" namespace because
those CRS are used as extension of the EPSG database. Consequently the same CRS can be
identified as both "ESRI:53001" and "EPSG:53001", where "53001"
is a unused code in the official EPSG database.
Caching of CRS objects
This factory doesn't cache any result. Any call to a createFoo method
will trig a new WKT parsing. For adding caching service, this factory should
be wrapped in CachingAuthorityFactory.
| referencing/geotk-referencing (download) | View source code for this class |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class Factory |
|---|
Factory.Availability, Factory.Organizer |
| Field Summary |
|---|
| Fields inherited from class DirectAuthorityFactory |
|---|
factories |
| Fields inherited from class AbstractAuthorityFactory |
|---|
nameFactory |
| Fields inherited from class ReferencingFactory |
|---|
LOGGER |
| Fields inherited from class Factory |
|---|
EMPTY_HINTS, hints |
| Constructor Summary | |
|---|---|
WKTParsingAuthorityFactory(Hints userHints,
Map<String,String> definitions,
Citation... authorities)
Creates a factory for the specified authorities using the definitions in the given map. |
|
| Method Summary | |
|---|---|
ConformanceResult |
availability()
Returns whatever this factory is ready for use. |
CoordinateReferenceSystem |
createCoordinateReferenceSystem(String code)
Returns a coordinate reference system from a code. |
IdentifiedObject |
createObject(String code)
Returns an arbitrary object from a code. |
protected void |
dispose(boolean shutdown)
Releases resources immediately instead of waiting for the garbage collector. |
Citation |
getAuthority()
Returns the authority. |
Set<String> |
getAuthorityCodes(Class<? extends IdentifiedObject> type)
Returns the set of authority codes of the given type. |
InternationalString |
getDescriptionText(String code)
Gets a description of the object corresponding to a code. |
IdentifiedObjectFinder |
getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
Returns a finder which can be used for looking up unidentified objects. |
protected String |
trimAuthority(String code)
Trims the authority scope, if presents. |
| Methods inherited from class DirectAuthorityFactory |
|---|
getImplementationHints |
| Methods inherited from class ReferencingFactory |
|---|
ensureNonNull, getVendor |
| Methods inherited from class Factory |
|---|
equals, hasCompatibleHints, hashCode, setOrdering, toString |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface Factory |
|---|
getVendor |
| Constructor Detail |
|---|
public WKTParsingAuthorityFactory(Hints userHints,
Map<String,String> definitions,
Citation... authorities)
userHints - An optional set of hints, or null for the default ones.definitions - The object definitions as a map with authority codes as keys and WKT strings as values.authorities - The organizations or parties responsible for definition and maintenance of the database.| Method Detail |
|---|
public ConformanceResult availability()
availability in class Factorypublic Citation getAuthority()
getAuthority in interface AuthorityFactorygetAuthority in class AbstractAuthorityFactory
public Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type)
throws FactoryException
type argument specifies
the base class. For example if this factory is an instance of CRSAuthorityFactory,
then:
CoordinateReferenceSystem.class asks for all authority codes accepted by
createGeographicCRS,
createProjectedCRS,
createVerticalCRS,
createTemporalCRS
and any other method returning a sub-type of CoordinateReferenceSystem.ProjectedCRS.class asks only for authority codes accepted by
createProjectedCRS.
The default implementation filters the set of codes based on the
"PROJCS" and "GEOGCS" at the start of the WKT strings.
type - The spatial reference objects type (can be IdentifiedObject.class).
FactoryException - if access to the underlying database failed.
public InternationalString getDescriptionText(String code)
throws NoSuchAuthorityCodeException,
FactoryException
code - Value allocated by authority.
null if the object
corresponding to the specified code has no description.
NoSuchAuthorityCodeException - if the specified code was not found.
FactoryException - if the query failed for some other reason.
public IdentifiedObject createObject(String code)
throws NoSuchAuthorityCodeException,
FactoryException
createObject in interface AuthorityFactorycreateObject in class AbstractAuthorityFactorycode - Value allocated by authority.
NoSuchAuthorityCodeException - if the specified code was not found.
FactoryException - if the object creation failed for some other reason.
public CoordinateReferenceSystem createCoordinateReferenceSystem(String code)
throws NoSuchAuthorityCodeException,
FactoryException
createCoordinateReferenceSystem in class AbstractAuthorityFactorycode - Value allocated by authority.
NoSuchAuthorityCodeException - if the specified code was not found.
FactoryException - if the object creation failed for some other reason.protected String trimAuthority(String code)
trimAuthority in class AbstractAuthorityFactorycode - The code to trim.
public IdentifiedObjectFinder getIdentifiedObjectFinder(Class<? extends IdentifiedObject> type)
throws FactoryException
getIdentifiedObjectFinder in class AbstractAuthorityFactorytype - The type of objects to look for. Should be a GeoAPI interface like
GeographicCRS.class, but this method accepts also implementation
class. If the type is unknown, use IdentifiedObject.class. A more
accurate type may help to speed up the search, since it reduces the amount
of tables to scan in some implementations (for example the factories backed
by EPSG databases).
FactoryException - if the finder can not be created.protected void dispose(boolean shutdown)
dispose in class AbstractAuthorityFactory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||