Class TLcdMultilevelRasterGXYLayerCodec
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdOutputStreamFactoryCapable,ILcdGXYLayerDecoder,ILcdGXYLayerEncoder,ILcdGXYLayerFactory
ILcdGXYLayerDecoder, ILcdGXYLayerEncoder and
ILcdGXYLayerFactory for ILcdGXYLayers whose
ILcdModel contains multi level rasters
(ILcdMultilevelRaster).
This codec should only be used to encode the ILcdGXYLayers that
were created by using createGXYLayer( ILcdModel ) or by using
decodeGXYLayer( ILcdModel, String ).
This codec should only be used to decode ILcdGXYLayers for the
correct ILcdModels (see above) and for files that were created
by its encodeGXYLayer method.
This codec should only be used to create ILcdGXYLayers 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
ConstructorsConstructorDescriptionCreates a newTLcdMultilevelRasterGXYLayerCodec, ready to be used. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeGXYLayer(ILcdModel aModel, String aSourceName) Prints out useful debug information in case false is returned.booleancanEncodeGXYLayer(ILcdGXYLayer aGXYLayer, String aDestinationName) Prints out useful debug information in case false is returned.protected TLcdGXYLayerThis factory method creates a new, uninitializedTLcdGXYLayer.createGXYLayer(ILcdModel aModel) Creates aILcdGXYLayerfor the givenILcdModel(see super).protected ILcdGXYLayercreateGXYLayer(ILcdModel aModel, String aPrefix, Properties aProperties) Creates aILcdGXYLayerfrom the givenPropertiesobject.protected TLcdMultilevelRasterPainterThis factory method creates a new, uninitializedTLcdMultilevelRasterPainter.decodeGXYLayer(ILcdModel aModel, String aSourceName) Reads the given source name as aPropertiesfile and then creates aILcdGXYLayerfor the given model while respecting the read properties.voidencodeGXYLayer(ILcdGXYLayer aGXYLayer, String aDestinationName) Encodes the given layer to the given destination name.protected voidencodeGXYLayer(ILcdGXYLayer aGXYLayer, String aPrefix, Properties aPropertiesSFCT) Encodes the givenILcdGXYLayerinto the givenPropertiesobject.Returns the defaultPropertiesfor this codec.Returns the display name of this codec.Returns the file extension that is used by this encoder/decoder.Returns theILcdInputStreamFactorythat is used to create input streams for the source names passed indecodeGXYLayerandcanDecodeGXYLayer.Returns theILcdFilterthat is used to filter theILcdModels that are accepted incanDecodeGXYLayerandcanEncodeGXYLayer.Returns theILcdOutputStreamFactorythat is used to create output streams for the destination names passed inencodeGXYLayer.intReturns the screen resolution in dots per inch (dpi).booleanDeprecated.This method has been deprecated.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidsetDefaultProperties(Properties aDefaultProperties) Sets the defaultPropertiesfor this codec.voidsetDisplayName(String aDisplayName) Sets the display name that will be returned bygetDisplayName.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets theILcdInputStreamFactorythat is used to create input streams for the source names passed indecodeGXYLayerandcanDecodeGXYLayer.voidsetModelFilter(ILcdFilter aModelFilter) Sets theILcdFilterthat is used to filter theILcdModels that are accepted incanDecodeGXYLayerandcanEncodeGXYLayer.voidsetOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory) Sets theILcdOutputStreamFactorythat is used to create output streams for the destination names passed inencodeGXYLayer.voidsetScreenResolution(int aScreenResolution) Sets the screen resolution in dots per inch (dpi).voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.
-
Constructor Details
-
TLcdMultilevelRasterGXYLayerCodec
public TLcdMultilevelRasterGXYLayerCodec()Creates a newTLcdMultilevelRasterGXYLayerCodec, 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 istruethen 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 eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen 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.Returnstrueif 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:
getDisplayNamein interfaceILcdGXYLayerDecoder- Specified by:
getDisplayNamein 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 theILcdInputStreamFactorythat is used to create input streams for the source names passed indecodeGXYLayerandcanDecodeGXYLayer.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- The associated
ILcdInputStreamFactory. - See Also:
-
setInputStreamFactory
Sets theILcdInputStreamFactorythat is used to create input streams for the source names passed indecodeGXYLayerandcanDecodeGXYLayer.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Parameters:
aInputStreamFactory- TheILcdInputStreamFactoryto set.- See Also:
-
getOutputStreamFactory
Returns theILcdOutputStreamFactorythat is used to create output streams for the destination names passed inencodeGXYLayer.- Specified by:
getOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Returns:
- The associated
ILcdOutputStreamFactory. - See Also:
-
setOutputStreamFactory
Sets theILcdOutputStreamFactorythat is used to create output streams for the destination names passed inencodeGXYLayer.- Specified by:
setOutputStreamFactoryin interfaceILcdOutputStreamFactoryCapable- Parameters:
aOutputStreamFactory- TheILcdOutputStreamFactoryto set.- See Also:
-
getModelFilter
Returns theILcdFilterthat is used to filter theILcdModels that are accepted incanDecodeGXYLayerandcanEncodeGXYLayer. If the filter is null, allILcdModels will be accepted, otherwise only theILcdModels for which theacceptmethod of theILcdFilterreturnstruewill be accepted. The default model filter only acceptsILcdModels of which theILcdModelDescriptoris an instance ofTLcdMultilevelRasterModelDescriptor.- Returns:
- The
ILcdFilterthat is used to filter theILcdModels. - See Also:
-
setModelFilter
Sets theILcdFilterthat is used to filter theILcdModels that are accepted incanDecodeGXYLayerandcanEncodeGXYLayer. If the filter is null (default), allILcdModels will be accepted, otherwise only theILcdModels for which theacceptmethod of theILcdFilterreturnstruewill be accepted.- Parameters:
aModelFilter- The newILcdFilterthat is used to filter theILcdModels.- 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 defaultPropertiesfor this codec. In case a property is missing in the file that needs to be decoded, or in case aILcdGXYLayeris created usingcreateGXYLayer( ILcdModel ), the values in thisPropertiesobject will be used. If a necessary value is also missing in the defaultPropertiesobject, or if the defaultPropertiesare 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 aILcdGXYLayercreated 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 defaultPropertiesfor this codec.- Parameters:
aDefaultProperties- The new defaultProperties.- See Also:
-
canDecodeGXYLayer
Prints out useful debug information in case false is returned. UsesetClassTraceOnorsetTraceOnto enable trace output.- Specified by:
canDecodeGXYLayerin interfaceILcdGXYLayerDecoder- Parameters:
aModel- TheILcdModelof theILcdGXYLayerto decode.aSourceName- The source name of the layer, e.g. a file name or a database name, ...- Returns:
- true if an
ILcdGXYLayercan be decoded from a given source name, false otherwise. - See Also:
-
canEncodeGXYLayer
Prints out useful debug information in case false is returned. UsesetClassTraceOnorsetTraceOnto enable trace output.- Specified by:
canEncodeGXYLayerin 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 aPropertiesfile and then creates aILcdGXYLayerfor the given model while respecting the read properties. If values are missing in the readPropertiesobject, the values of the defaultPropertiesobject 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:
decodeGXYLayerin interfaceILcdGXYLayerDecoder- Parameters:
aModel- See super.aSourceName- The file name of thePropertiesfile.- Returns:
- See super.
- Throws:
IOException- See super.- See Also:
-
encodeGXYLayer
Description copied from interface:ILcdGXYLayerEncoderEncodes the given layer to the given destination name.The method
canEncodeGXYLayershould returntrue(for the same arguments) before this method is used.- Specified by:
encodeGXYLayerin 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 aILcdGXYLayerfor 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
ILcdGXYPainterProviderof the returnedILcdGXYLayerwill be aTLcdMultilevelRasterPainter. 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 aTLcdIndexColorModelto theTLcdMultilevelRasterPainterof the returned layer if no such color model is already set.- Specified by:
createGXYLayerin interfaceILcdGXYLayerFactory- Parameters:
aModel- TheILcdModelthat 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.
-
createMultilevelRasterPainter
This factory method creates a new, uninitializedTLcdMultilevelRasterPainter. This method can be extended to for instance return an extension ofTLcdMultilevelRasterPainter.- Returns:
- A new, uninitialized
TLcdMultilevelRasterPainter.
-
createGXYLayer
Creates aILcdGXYLayerfrom the givenPropertiesobject. This method is used bydecodeGXYLayerandcreateGXYLayer(ILcdModel). This method can be extended to read additional properties.- Parameters:
aModel- aModel TheILcdModelthat will be set to theILcdGXYLayer.aPrefix- The prefix to be used to read keys from thePropertiesobject.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 givenILcdGXYLayerinto the givenPropertiesobject. This method can be extended to write additional properties.- Parameters:
aGXYLayer- TheILcdGXYLayerto encode.aPrefix- The prefix to be used to write keys into thePropertiesobject.aPropertiesSFCT- The properties object to write to.
-