org.cts
Class CRSFactory

java.lang.Object
  extended by org.cts.CRSFactory

public class CRSFactory
extends Object

This factory is in charge of creating new CoordinateReferenceSystems. It can do so by two way :

Case 1 :

Case 2 :

This class also manages a Cache which return CoordinateReferenceSystems which have already been parsed.

Author:
Erwan Bocher

Nested Class Summary
 class CRSFactory.CRSCache<K,V>
          A simple cache to manage CoordinateReferenceSystem
 
Field Summary
protected  CRSFactory.CRSCache<String,CoordinateReferenceSystem> CRSPOOL
           
 
Constructor Summary
CRSFactory()
          Creates a new factory.
 
Method Summary
 CoordinateReferenceSystem createFromPrj(File file)
          Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).
 CoordinateReferenceSystem createFromPrj(InputStream stream)
          Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).
 CoordinateReferenceSystem createFromPrj(InputStream stream, Charset encoding)
          Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).
 CoordinateReferenceSystem createFromPrj(String prjString)
          Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).
 CoordinateReferenceSystem getCRS(String authorityAndSrid)
          Return a CoordinateReferenceSystem corresponding to an authority and a srid.
 RegistryManager getRegistryManager()
          Return the RegistryManager used in CTS.
 Set<String> getSupportedCodes(String registryName)
          Return a list of supported codes according an registryName.
 boolean isRegistrySupported(String registryName)
          Check if the registry name (ie EPSG, IGNF...) is supported.
 String[] splitRegistryNameAndCode(String authorityAndSrid)
          Return the registry name and the code in a string array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRSPOOL

protected final CRSFactory.CRSCache<String,CoordinateReferenceSystem> CRSPOOL
Constructor Detail

CRSFactory

public CRSFactory()
Creates a new factory.

Method Detail

getCRS

public CoordinateReferenceSystem getCRS(String authorityAndSrid)
                                 throws CRSException
Return a CoordinateReferenceSystem corresponding to an authority and a srid.

Parameters:
authorityAndSrid - the code of the desired CRS (for instance EPSG:4326 or IGNF:LAMBE)
Throws:
CRSException

splitRegistryNameAndCode

public String[] splitRegistryNameAndCode(String authorityAndSrid)
                                  throws RegistryException
Return the registry name and the code in a string array.

Parameters:
authorityAndSrid - a string following the pattern "name:code"
Returns:
an array of two strings (ex. {"epsg", "4326"})
Throws:
RegistryException

getRegistryManager

public RegistryManager getRegistryManager()
Return the RegistryManager used in CTS.


isRegistrySupported

public boolean isRegistrySupported(String registryName)
                            throws RegistryException
Check if the registry name (ie EPSG, IGNF...) is supported.

Parameters:
registryName - (ex : ESPG, IGNF, ESRI)
Throws:
RegistryException

createFromPrj

public CoordinateReferenceSystem createFromPrj(String prjString)
                                        throws CRSException
Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).

Parameters:
prjString - the OGC WKT String defining the CRS
Throws:
CRSException

createFromPrj

public CoordinateReferenceSystem createFromPrj(InputStream stream,
                                               Charset encoding)
                                        throws IOException,
                                               CRSException
Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).

Parameters:
stream - the input stream of bytes defining the OGC WKT String
encoding - the charset used to read the input stream
Throws:
IOException
CRSException

createFromPrj

public CoordinateReferenceSystem createFromPrj(InputStream stream)
                                        throws IOException,
                                               CRSException
Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).

Parameters:
stream - the input stream of bytes defining the OGC WKT String
Throws:
IOException
CRSException

createFromPrj

public CoordinateReferenceSystem createFromPrj(File file)
                                        throws IOException,
                                               CRSException
Creates a CoordinateReferenceSystem defined by an OGC WKT String (PRJ).

Parameters:
file - containing the OGC WKT String that defined the desired CRS
Throws:
IOException - if there is a problem reading the file
CRSException

getSupportedCodes

public Set<String> getSupportedCodes(String registryName)
                              throws RegistryException
Return a list of supported codes according an registryName.

Parameters:
registryName - (ex : EPSG, IGNF, ESRI)
Throws:
RegistryException


Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.