Class TLcdRasterGXYLayerCodec
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdOutputStreamFactoryCapable
,ILcdGXYLayerDecoder
,ILcdGXYLayerEncoder
,ILcdGXYLayerFactory
ILcdGXYLayerDecoder
, ILcdGXYLayerEncoder
and
ILcdGXYLayerFactory
for ILcdGXYLayer
s whose
ILcdModel
contains (single level) rasters
(ILcdRaster
).
This codec should only be used to encode the ILcdGXYLayer
s that
were created by using createGXYLayer( ILcdModel )
or by using
decodeGXYLayer( ILcdModel, String )
.
This codec should only be used to decode ILcdGXYLayer
s for the
correct ILcdModel
s (see above) and for files that were created
by its encodeGXYLayer
method.
This codec should only be used to create ILcdGXYLayer
s for the
correct models (see above).
This codec is capable of writing all layer and painter properties in a style
file (encodeGXYLayer
). These style files can also be decoded
(decodeGXYLayer
), meaning that all properties defined in the
style file will be set to the decoded layer. When a layer is created using
createGXYLayer
it will automatically try to find an associated
style file next to the source of the ILcdModel
(ILcdModel.getModelDescriptor().getSourceName()
). If such a
layer file is found, it will be decoded, if not the default properties will
be used.
Note that this codec supports the encoding/decoding of raster coloring when
a TLcdIndexColorModel
is used. However layers created by createGXYLayer(ILcdModel)
method do not have this specific color model
set by default. For example, it does not make sense to color a satellite picture
with a TLcdIndexColorModel
, but it does make sense to color
elevation data with a TLcdIndexColorModel
.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdRasterGXYLayerCodec
, ready to be used. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeGXYLayer
(ILcdModel aModel, String aSourceName) Prints out useful debug information in case false is returned.boolean
canEncodeGXYLayer
(ILcdGXYLayer aGXYLayer, String aDestinationName) Prints out useful debug information in case false is returned.protected TLcdGXYLayer
This factory method creates a new, uninitializedTLcdGXYLayer
.createGXYLayer
(ILcdModel aModel) Creates aILcdGXYLayer
for the givenILcdModel
(see super).protected ILcdGXYLayer
createGXYLayer
(ILcdModel aModel, String aPrefix, Properties aProperties) Creates aILcdGXYLayer
from the givenProperties
object.protected TLcdRasterPainter
This factory method creates a new, uninitializedTLcdRasterPainter
.decodeGXYLayer
(ILcdModel aModel, String aSourceName) Reads the given source name as aProperties
file and then creates aILcdGXYLayer
for the given model while respecting the read properties.void
encodeGXYLayer
(ILcdGXYLayer aGXYLayer, String aDestinationName) Encodes the given layer to the given destination name.protected void
encodeGXYLayer
(ILcdGXYLayer aGXYLayer, String aPrefix, Properties aPropertiesSFCT) Encodes the givenILcdGXYLayer
into the givenProperties
object.Returns the defaultProperties
for this codec.Returns the display name of this codec.Returns the file extension that is used by this encoder/decoder.Returns theILcdInputStreamFactory
that is used to create input streams for the source names passed indecodeGXYLayer
andcanDecodeGXYLayer
.Returns theILcdFilter
that is used to filter theILcdModel
s that are accepted incanDecodeGXYLayer
andcanEncodeGXYLayer
.Returns theILcdOutputStreamFactory
that is used to create output streams for the destination names passed inencodeGXYLayer
.int
Returns the screen resolution in dots per inch (dpi).boolean
Deprecated.This method has been deprecated.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setDefaultProperties
(Properties aDefaultProperties) Sets the defaultProperties
for this codec.void
setDisplayName
(String aDisplayName) Sets the display name that will be returned bygetDisplayName
.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets theILcdInputStreamFactory
that is used to create input streams for the source names passed indecodeGXYLayer
andcanDecodeGXYLayer
.void
setModelFilter
(ILcdFilter aModelFilter) Sets theILcdFilter
that is used to filter theILcdModel
s that are accepted incanDecodeGXYLayer
andcanEncodeGXYLayer
.void
setOutputStreamFactory
(ILcdOutputStreamFactory aOutputStreamFactory) Sets theILcdOutputStreamFactory
that is used to create output streams for the destination names passed inencodeGXYLayer
.void
setScreenResolution
(int aScreenResolution) Sets the screen resolution in dots per inch (dpi).void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.
-
Constructor Details
-
TLcdRasterGXYLayerCodec
public TLcdRasterGXYLayerCodec()Creates a newTLcdRasterGXYLayerCodec
, ready to be used.
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
getDisplayName
Returns the display name of this codec.- Specified by:
getDisplayName
in interfaceILcdGXYLayerDecoder
- Specified by:
getDisplayName
in interfaceILcdGXYLayerEncoder
- Returns:
- the display name of this codec.
- See Also:
-
setDisplayName
Sets the display name that will be returned bygetDisplayName
.- Parameters:
aDisplayName
- The new display name for this codec.- See Also:
-
getFileExtension
Returns the file extension that is used by this encoder/decoder. The extension is without the dot.This decoder/encoder reads/writes from/to files. These files must have the extension returned by this method.
- Returns:
- the file extension (without the dot).
-
getInputStreamFactory
Returns theILcdInputStreamFactory
that is used to create input streams for the source names passed indecodeGXYLayer
andcanDecodeGXYLayer
.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- The associated
ILcdInputStreamFactory
. - See Also:
-
setInputStreamFactory
Sets theILcdInputStreamFactory
that is used to create input streams for the source names passed indecodeGXYLayer
andcanDecodeGXYLayer
.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- TheILcdInputStreamFactory
to set.- See Also:
-
getOutputStreamFactory
Returns theILcdOutputStreamFactory
that is used to create output streams for the destination names passed inencodeGXYLayer
.- Specified by:
getOutputStreamFactory
in interfaceILcdOutputStreamFactoryCapable
- Returns:
- The associated
ILcdOutputStreamFactory
. - See Also:
-
setOutputStreamFactory
Sets theILcdOutputStreamFactory
that is used to create output streams for the destination names passed inencodeGXYLayer
.- Specified by:
setOutputStreamFactory
in interfaceILcdOutputStreamFactoryCapable
- Parameters:
aOutputStreamFactory
- TheILcdOutputStreamFactory
to set.- See Also:
-
getModelFilter
Returns theILcdFilter
that is used to filter theILcdModel
s that are accepted incanDecodeGXYLayer
andcanEncodeGXYLayer
. If the filter is null, allILcdModel
s will be accepted, otherwise only theILcdModel
s for which theaccept
method of theILcdFilter
returnstrue
will be accepted. The default model filter only acceptsILcdModel
s of which theILcdModelDescriptor
is an instance ofTLcdRasterModelDescriptor
.- Returns:
- The
ILcdFilter
that is used to filter theILcdModel
s. - See Also:
-
setModelFilter
Sets theILcdFilter
that is used to filter theILcdModel
s that are accepted incanDecodeGXYLayer
andcanEncodeGXYLayer
.- Parameters:
aModelFilter
- The newILcdFilter
that is used to filter theILcdModel
s.- See Also:
-
getScreenResolution
public int getScreenResolution()Returns the screen resolution in dots per inch (dpi).The screen resolution is used to accurately convert map scales (e.g. 1/100000) to LuciadLightspeed scales (e.g. pixels per meter).
The default value is
Toolkit.getDefaultToolkit().getScreenResolution()
.- Returns:
- the screen resolution in dots per inch (dpi).
- See Also:
-
setScreenResolution
public void setScreenResolution(int aScreenResolution) Sets the screen resolution in dots per inch (dpi).- Parameters:
aScreenResolution
- The screen resolution in dots per inch (dpi).- See Also:
-
getDefaultProperties
Returns the defaultProperties
for this codec. In case a property is missing in the file that needs to be decoded, or in case aILcdGXYLayer
is created usingcreateGXYLayer( ILcdModel )
, the values in thisProperties
object will be used. If a necessary value is also missing in the defaultProperties
object, or if the defaultProperties
are null (default), a hardcoded default will be used. The properties that can be set as default properties are the same properties as those that are available in a style file. UseencodeGXYLayer(ILcdGXYLayer, String)
on aILcdGXYLayer
created usingcreateGXYLayer(com.luciad.model.ILcdModel)
with a validILcdModel
(valid meansgetModelFilter()
accepts the model) to quickly create such a style file.- Returns:
- The default properties.
- See Also:
-
setDefaultProperties
Sets the defaultProperties
for this codec.- Parameters:
aDefaultProperties
- The new defaultProperties
.- See Also:
-
canDecodeGXYLayer
Prints out useful debug information in case false is returned. UsesetClassTraceOn
orsetTraceOn
to enable trace output.- Specified by:
canDecodeGXYLayer
in interfaceILcdGXYLayerDecoder
- Parameters:
aModel
- TheILcdModel
of theILcdGXYLayer
to decode.aSourceName
- The source name of the layer, e.g. a file name or a database name, ...- Returns:
- true if an
ILcdGXYLayer
can be decoded from a given source name, false otherwise. - See Also:
-
canEncodeGXYLayer
Prints out useful debug information in case false is returned. UsesetClassTraceOn
orsetTraceOn
to enable trace output.- Specified by:
canEncodeGXYLayer
in interfaceILcdGXYLayerEncoder
- Parameters:
aGXYLayer
- The layer to be encoded.aDestinationName
- The destination name to encode the layer to, e.g. a file name, a database name, ...- Returns:
- true if the given layer can be encoded to the given destination name, false otherwise.
- See Also:
-
decodeGXYLayer
Reads the given source name as aProperties
file and then creates aILcdGXYLayer
for the given model while respecting the read properties. If values are missing in the readProperties
object, the values of the defaultProperties
object will be used. If the necessary values are missing there as well, a hardcoded default will be used.The painters and editors of the layer are specified in
createGXYLayer
.- Specified by:
decodeGXYLayer
in interfaceILcdGXYLayerDecoder
- Parameters:
aModel
- See super.aSourceName
- The file name of theProperties
file.- Returns:
- See super.
- Throws:
IOException
- See super.- See Also:
-
encodeGXYLayer
Description copied from interface:ILcdGXYLayerEncoder
Encodes the given layer to the given destination name.The method
canEncodeGXYLayer
should returntrue
(for the same arguments) before this method is used.- Specified by:
encodeGXYLayer
in interfaceILcdGXYLayerEncoder
- Parameters:
aGXYLayer
- The layer to encode.aDestinationName
- The destination name to encode the layer to, e.g. a file name, a database name, ...- Throws:
IOException
- In case of io failure.- See Also:
-
createGXYLayer
Creates aILcdGXYLayer
for the givenILcdModel
(see super).Tries to find a layer file next to the model source name (ILcdModel.getModelDescriptor().getSourceName) that has the same name, but a different extension (getFileExtension()). If this file exists, it will be decoded. Otherwise, the default properties will be used. If some necessary values are missing there as well, a hardcoded default will be used.
The
ILcdGXYPainterProvider
of the returnedILcdGXYLayer
will be aTLcdRasterPainter
. Although no color model is set to this painter by default, the encoding and decoding process can handle a color model of typeTLcdIndexColorModel
. If you want to use the encoding/decoding of the coloring, you must overwrite this method and set aTLcdIndexColorModel
to theTLcdRasterPainter
of the returned layer if no such color model is already set.- Specified by:
createGXYLayer
in interfaceILcdGXYLayerFactory
- Parameters:
aModel
- TheILcdModel
that will be set to theILcdGXYLayer
.- Returns:
- The newly created
ILcdGXYLayer
. - See Also:
-
createGXYLayer
This factory method creates a new, uninitializedTLcdGXYLayer
. This method can be extended to for instance return an extension ofTLcdGXYLayer
.- Returns:
- A new, uninitialized
TLcdGXYLayer
.
-
createRasterPainter
This factory method creates a new, uninitializedTLcdRasterPainter
. This method can be extended to for instance return an extension ofTLcdRasterPainter
.- Returns:
- A new, uninitialized
TLcdRasterPainter
.
-
createGXYLayer
Creates aILcdGXYLayer
from the givenProperties
object. This method is used bydecodeGXYLayer
andcreateGXYLayer(ILcdModel)
. This method can be extended to read additional properties.- Parameters:
aModel
- aModel TheILcdModel
that will be set to theILcdGXYLayer
.aPrefix
- The prefix to be used to read keys from theProperties
object.aProperties
- The properties object to read. If values are missing in theseProperties
, a hardcoded default will be used.- Returns:
- The newly created
ILcdGXYLayer
.
-
encodeGXYLayer
Encodes the givenILcdGXYLayer
into the givenProperties
object. This method can be extended to write additional properties.- Parameters:
aGXYLayer
- TheILcdGXYLayer
to encode.aPrefix
- The prefix to be used to write keys into theProperties
object.aPropertiesSFCT
- The properties object to write to.
-