Class ALcyLspStyleFileFormat
- Direct Known Subclasses:
ALcyLspStyleFormat
This ALcyLspFormat
is designed for layers where the layer style is stored into a style
file. The format allows to configure a default style file
which will be applied to every layer created in the layer factory. It also supports to store a
style file next to the source file of the model. Those style files will be applied on the layer
created for that model.
It is up to the extensions of this class to create the ILcyLayerStyleProvider
and
ILcyLayerStyleCodec
. When your layer uses an ILspCustomizableStyler
, it might be better to extend from ALcyLspStyleFormat
directly. That format provides default implementations for the layer style provider and codec.
Configuration options
This format checks for the following properties in the ALcyProperties
:
# The path to the file containing the default style to apply on each created layer
shortPrefix.defaultStyleFile = path/to/defaultStyleFile.sty
Warning: this format should be wrapped with a TLcyLspSafeGuardFormatWrapper
before plugging it into the Lucy back-end.
- Since:
- 2012.1
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Suffix to use in the properties to specify the location of the default style file. -
Constructor Summary
ModifierConstructorDescriptionprotected
ALcyLspStyleFileFormat
(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties, ILcdFilter<ILcdModel> aModelFilter) Create a new style file format -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
canHandleModel
(ILcdModel aModel) Returnstrue
if and only if the given model can be visualized by this format.protected final ILspLayerFactory
Creates a layer factory for this format, based on a layer factory created bycreateLayerFactoryImpl
.
protected abstract ILspLayerFactory
Creates the layer factory for this format.protected ALcyFileTypeDescriptor[]
CreatesALcyFileTypeDescriptor
s for theILcyLayerStyleCodec
s.protected abstract ILcyLayerStyleCodec
Creates the actualILcyLayerStyleCodec
protected ILcyLayerStyleCodec[]
Creates theILcyLayerStyleCodec
instances which can encode/decode the style of the layers created by the layer factory of this format.Methods inherited from class com.luciad.lucy.format.lightspeed.ALcyLspGeneralFormat
getLongPrefix, getLucyEnv, getProperties, getShortPrefix
Methods inherited from class com.luciad.lucy.format.lightspeed.ALcyLspFormat
checkInitialized, createAll, createBalloonContentProviders, createFormatBarFactory, createLayerContextOfFormatFilter, createLayerCustomizerPanelFactories, createLayerCustomizerPanelWorkspaceCodecs, createLayerMeasureProviderFactory, createLayerSelectionTransferHandlers, createLayerStyleProviders, createLayerWorkspaceCodecs, getBalloonContentProviders, getFormatBarFactory, getLayerCustomizerPanelFactories, getLayerCustomizerPanelWorkspaceCodecs, getLayerFactory, getLayerMeasureProviderFactory, getLayerSelectionTransferHandlers, getLayerStyleCodecFileTypeDescriptors, getLayerStyleCodecs, getLayerStyleProviders, getLayerWorkspaceCodecs, isLayerOfFormat, toString
-
Field Details
-
DEFAULT_STYLE_FILE_SUFFIX
Suffix to use in the properties to specify the location of the default style file. This style will be applied on every layer created by the layer factory of this format. The
createLayerStyleCodecs()
will be used to apply this style on the layer.Note that the default style file should be included in one of the created file type descriptors. If this is not the case, the default style file will be simply ignored.
The complete key to be used in the properties is the short prefix of the format +
DEFAULT_STYLE_FILE_SUFFIX
.- See Also:
-
-
Constructor Details
-
ALcyLspStyleFileFormat
protected ALcyLspStyleFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties, ILcdFilter<ILcdModel> aModelFilter) Create a new style file format- Parameters:
aLucyEnv
- The Lucy back-endaLongPrefix
- The long prefix of this formataShortPrefix
- The short prefix of this formataProperties
- The propertiesaModelFilter
- Filter used to determine whether a model can be handled by this format. When the model can be handled by this format, it should be accepted by the filter. Filter must not benull
.null
models will never be passed to the filter, but always rejected.
-
-
Method Details
-
canHandleModel
Description copied from class:ALcyLspFormat
Returns
true
if and only if the given model can be visualized by this format.- Specified by:
canHandleModel
in classALcyLspFormat
- Parameters:
aModel
- The model to check- Returns:
true
if and only if the given model can be visualized by this format.
-
createLayerFactory
Creates a layer factory for this format, based on a layer factory created by
createLayerFactoryImpl
. This method may return
null
.- Specified by:
createLayerFactory
in classALcyLspFormat
- Returns:
- The
ILspLayerFactory
for this format. May benull
- See Also:
-
createLayerStyleCodecFileTypeDescriptors
Creates
ALcyFileTypeDescriptor
s for theILcyLayerStyleCodec
s. The length of the returned array must be equal to that ofALcyLspFormat.createLayerStyleCodecs()
.The default implementation returns a zero-length array.
This format uses these
ALcyFileTypeDescriptor
instances to determine whether a style file is located next to source file of a layer, and apply that style when such a layer is created in the layer factory. The layer factory will only try to find style files with an extension defined by the returnedALcyFileTypeDescriptor
s of this method.Another example usage of these
ALcyFileTypeDescriptor
instances is the File | Save layer style action which is available in Lucy. It allows to save the style of a layer to a file ending with an extension as specified by theseALcyFileTypeDescriptor
s. When noALcyFileTypeDescriptor
s are available (or onlynull
ALcyFileTypeDescriptor
s) it will not be possible to save the layer style to file.The default implementation returns a file type descriptor based on the info contained in the properties of this format, or a default file type descriptor in case the properties do not contain this info. The file type descriptor can be configured in the configuration file as follows (where "shortPrefix." stands for the short prefix of this format):
shortPrefix.style.fileTypeDescriptor.displayName=... shortPrefix.style.fileTypeDescriptor.defaultExtension=... shortPrefix.style.fileTypeDescriptor.filters=... shortPrefix.style.fileTypeDescriptor.groupIDs=...
Warning: when overriding this method, make sure to either return an array of length 1 or to override
createLayerStyleCodecs()
()} as well.- Overrides:
createLayerStyleCodecFileTypeDescriptors
in classALcyLspFormat
- Returns:
- An array of
ALcyFileTypeDescriptor
instances. Must not benull
and its length must be equal to the length of the array of layer style encoders created by this format. May containnull
. - See Also:
-
createLayerStyleCodecs
Creates the
ILcyLayerStyleCodec
instances which can encode/decode the style of the layers created by the layer factory of this format.The default implementation returns an empty array.
The default implementation returns an array containing the
ILcyLayerStyleCodec
created increateLayerStyleCodecImpl()
.Warning: when overriding this method, make sure to either return an array of length 1 or to override
createLayerStyleCodecFileTypeDescriptors()
as well.- Overrides:
createLayerStyleCodecs
in classALcyLspFormat
- Returns:
- an array of
ILcyLayerStyleCodec
instances. Must not benull
. The array may be empty, but must not containnull
. - See Also:
-
createLayerFactoryImpl
Creates the layer factory for this format. The default style will automatically be applied on each layer created by this factory. A style file located next to the model source file will be applied on the created layers as well.- Returns:
- the layer factory for this format. May be
null
-
createLayerStyleCodecImpl
Creates the actualILcyLayerStyleCodec
- Returns:
- a new
ILcyLayerStyleCodec
for the layers of this format. Must not benull
. - See Also:
-