Package com.luciad.reference.format
Class TLcdEPSGModelReferenceDecoder
java.lang.Object
com.luciad.reference.format.TLcdEPSGModelReferenceDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelReferenceDecoder
@LcdService(service=ILcdModelReferenceDecoder.class,
priority=20000)
public class TLcdEPSGModelReferenceDecoder
extends Object
implements ILcdModelReferenceDecoder, ILcdInputStreamFactoryCapable
This
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.
- Since:
- 8.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.model.ILcdModelReferenceDecoder
ILcdModelReferenceDecoder.ModelReferenceWithSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondecodeModelReference
(String aDataSourceName) Returns the model reference, associated with the specified data source.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.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.
-
Constructor Details
-
TLcdEPSGModelReferenceDecoder
public TLcdEPSGModelReferenceDecoder()
-
-
Method Details
-
setInputStreamFactory
Sets the input stream factory that will be used for accessing .epsg files.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the factory responsible to generate input streams from which the model references will be decoded.- See Also:
-
getInputStreamFactory
Returns the input stream factory that is used for accessing .epsg files.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the factory responsible to generate input streams from which the model references are decoded.
- See Also:
-
decodeModelReference
Returns the model reference, associated with the specified data source. This implementation delegates tofindAndDecodeModelReference(java.lang.String)
and returns the resulting model reference.- Specified by:
decodeModelReference
in interfaceILcdModelReferenceDecoder
- Parameters:
aDataSourceName
- a data source for which to return the model reference; typically a file name or a URL.- Returns:
- the
ILcdModelReference
associated with the data source. Whilenull
is allowed, implementors are advised to throw an error instead. - Throws:
IOException
- if theILcdModelReference
cannot be decoded.
When the thread on which this method is called is interrupted, it is recommended to stop the decoding and throw anInterruptedIOException
. This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding through the UI.
-
findAndDecodeModelReference
public ILcdModelReferenceDecoder.ModelReferenceWithSource findAndDecodeModelReference(String aSource) throws IOException 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.
- Specified by:
findAndDecodeModelReference
in interfaceILcdModelReferenceDecoder
- Parameters:
aSource
- the location of the data file for which to locate and decode a reference file.- Returns:
- an
ILcdModelReference
decoded from one of the files as described above, along with the location of that file. - Throws:
IOException
- if none of the files as described above exists, or when the file found cannot be decoded as a properties file.
-