@LcdService(service=ILcdModelReferenceDecoder.class, priority=20000) public class TLcdEPSGModelReferenceDecoder extends Object implements ILcdModelReferenceDecoder, ILcdInputStreamFactoryCapable
ILcdModelReferenceDecoder
decodes model references
based on .epsg files corresponding to the given source files.
A .epsg file contains a single decimal EPSG code, formatted as "n"
or "EPSG:n", that defines a georeference. Any lines starting with
a hash sign "#" are treated as comments and ignored.
The decoder first tries to find a .epsg file by replacing the extension of
the source file by .epsg
.
If this fails, it tries to find a directory.epsg
file next to
the source file.
If this fails, it tries to find a DIRECTORY.EPSG
file next to
the source file.
If this fails, it throws an IOException
.
See TLcdEPSGReferenceParser
for a list of supported epsg codes.
TLcdEPSGReferenceParser
,
TLcdCompositeModelReferenceDecoder
ILcdModelReferenceDecoder.ModelReferenceWithSource
Constructor and Description |
---|
TLcdEPSGModelReferenceDecoder() |
Modifier and Type | Method and Description |
---|---|
ILcdModelReference |
decodeModelReference(String aDataSourceName)
Returns the model reference, associated with the specified data source.
|
ILcdModelReferenceDecoder.ModelReferenceWithSource |
findAndDecodeModelReference(String aSource)
Tries to locate the model reference file by
replacing the suffix by '.epsg', or adding the suffix '.epsg' if there was no suffix
looking for a 'directory.epsg' in the same directory,
looking for a 'DIRECTORY.EPSG' in the same directory.
If no such file is found, an IOException is thrown.
|
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used for accessing .epsg files.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for accessing .epsg files.
|
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the factory responsible to generate input streams
from which the model references will be decoded.getInputStreamFactory()
public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory(ILcdInputStreamFactory)
public ILcdModelReference decodeModelReference(String aDataSourceName) throws IOException
findAndDecodeModelReference(java.lang.String)
and returns the resulting model reference.decodeModelReference
in interface ILcdModelReferenceDecoder
aDataSourceName
- a data source for which to return the model reference; typically a file name or a URL.ILcdModelReference
associated with the data source. While null
is allowed,
implementors are advised to throw an error instead.IOException
- if the ILcdModelReference
cannot be decoded.
InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.public ILcdModelReferenceDecoder.ModelReferenceWithSource findAndDecodeModelReference(String aSource) throws IOException
findAndDecodeModelReference
in interface ILcdModelReferenceDecoder
aSource
- the location of the data file for which to locate and decode a reference file.ILcdModelReference
decoded from one of the files as described above, along with the
location of that file.IOException
- if none of the files as described above exists, or when the file found
cannot be decoded as a properties file.