Class TLcyLspRasterFormat
Extension of ALcyLspStyleFormat
for raster and Earth formats. It provides a custom
implementation of the createLayerFactoryImpl()
method, which supports the
same models as documented in TLspRasterLayerBuilder
. This layer factory allows
to make small changes to the created layers before they leave the layer factory by calling
customizeLayer
for
each layer it creates.
Extensions of this class can override the customizeLayer
method but this only makes sense for small changes (e.g. changing the icon of the layer).
Warning: this format should be wrapped with a TLcyLspSafeGuardFormatWrapper
before plugging it into the Lucy back-end.
- Since:
- 2012.0
- See Also:
-
Field Summary
Fields inherited from class com.luciad.lucy.format.lightspeed.ALcyLspStyleFileFormat
DEFAULT_STYLE_FILE_SUFFIX
-
Constructor Summary
ConstructorDescriptionTLcyLspRasterFormat
(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aPreferences, ILcdFilter<ILcdModel> aModelFilter) Create a new raster format -
Method Summary
Modifier and TypeMethodDescriptionprotected final ILspLayerFactory
Creates the layer factory for this format.protected ILcdLayerMeasureProviderFactory
Creates aILcdLayerMeasureProviderFactory
that can create measure providers for a layer created by the layer factories of this format.protected void
customizeLayer
(ILspEditableStyledLayer aRasterLayer) Each layer created by the layer factory of this format is passed to this method.Methods inherited from class com.luciad.lucy.format.lightspeed.ALcyLspStyleFormat
createAll, createLayerStyleCodecFileTypeDescriptors, createLayerStyleCodecImpl, createLayerStyleCodecs, createLayerStyleProviders, retrieveFeatureTypeStyle
Methods inherited from class com.luciad.lucy.format.lightspeed.ALcyLspStyleFileFormat
canHandleModel, createLayerFactory
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, createBalloonContentProviders, createFormatBarFactory, createLayerContextOfFormatFilter, createLayerCustomizerPanelFactories, createLayerCustomizerPanelWorkspaceCodecs, createLayerSelectionTransferHandlers, createLayerWorkspaceCodecs, getBalloonContentProviders, getFormatBarFactory, getLayerCustomizerPanelFactories, getLayerCustomizerPanelWorkspaceCodecs, getLayerFactory, getLayerMeasureProviderFactory, getLayerSelectionTransferHandlers, getLayerStyleCodecFileTypeDescriptors, getLayerStyleCodecs, getLayerStyleProviders, getLayerWorkspaceCodecs, isLayerOfFormat, toString
-
Constructor Details
-
TLcyLspRasterFormat
public TLcyLspRasterFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aPreferences, ILcdFilter<ILcdModel> aModelFilter) Create a new raster format- Parameters:
aLucyEnv
- The Lucy back-endaLongPrefix
- The long prefix of this format.aShortPrefix
- The short prefix of this formataPreferences
- The preferencesaModelFilter
- 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
-
createLayerFactoryImpl
Description copied from class:ALcyLspStyleFormat
Creates the layer factory for this format. This method will be called from the
ALcyLspStyleFileFormat.createLayerFactory()
method. This factory must not returnILcdLayerTreeNode
instances. In case you want to support empty nodes, consider using aTLcyLspLayerTreeNodeFormatWrapper
.Layer requirements
The layers returned by this layer factory should match the following requirements:
- The layers should implement the
ILspStyledLayer
interface. - When using SLD styling, the SLD must be set on the layer using
TLspShapeLayerBuilder.sldStyle(TLcdSLDFeatureTypeStyle)
orTLspRasterLayerBuilder.sldStyle(TLcdSLDFeatureTypeStyle)
. - When not using SLD styling, the
REGULAR_BODY
and theREGULAR_LABEL
stylers must beILspCustomizableStyler
instances containing regularALspStyle
instances.
Layer styling
The default style of this format as defined in the default style file will be automatically applied on each layer. If a style is present next to the model source file of the layer, this style will be applied as well. It is not necessary to include this functionality in the layer factory returned by this method.
Note however that an SLD style file can only be applied on layers which use SLD styling, and customizable styler based style files can only be applied on layers which use an
ILspCustomizableStyler
. This means that the layer factory decides which kind of styling is available for which layer.To facilitate this, this format has
a utility method
to check whether SLD styling can be found for a certain model. The layer factory can opt to use this method to decide between SLD based styling or customizable styler based styling.An example implementation of this method could be:
return new ALspSingleLayerFactory() { @Override public ILspLayer createLayer(ILcdModel aModel) { //This example implementation assumes the data is vector data TLcdSLDFeatureTypeStyle featureTypeStyle = retrieveFeatureTypeStyle(aModel); if(featureTypeStyle == null){ //create a customizable styler with default styles and set it on the layer TLspCustomizableStyler bodyStyler = new TLspCustomizableStyler( TLspLineStyle.newBuilder().elevationMode(ILspWorldElevationStyle.ElevationMode.ON_TERRAIN) .color(Color.WHITE) .width(2) .build(), TLspFillStyle.newBuilder().elevationMode(ILspWorldElevationStyle.ElevationMode.ON_TERRAIN) .color(new Color(255, 255, 0, 128)) .build(), TLspIconStyle.newBuilder().icon(new TLcdSymbol(TLcdSymbol.FILLED_RECT, 5)).build() ); return TLspShapeLayerBuilder.newBuilder() .model(aModel) .bodyStyler(TLspPaintState.REGULAR, bodyStyler) .build(); } else { //Create a layer which uses SLD styling return TLspShapeLayerBuilder.newBuilder() .model(aModel) .sldStyle(featureTypeStyle) .build(); } } @Override public boolean canCreateLayers(ILcdModel aModel) { //the format should be wrapped with a TLcyLspSafeGuardFormatWrapper so we can just return true return true; } };
- Specified by:
createLayerFactoryImpl
in classALcyLspStyleFormat
- Returns:
- The layer factory for this format. May be
null
- The layers should implement the
-
customizeLayer
Each layer created by the layer factory of this format is passed to this method. Overriding this method allows to make changes to the created layers, for example adjusting the icon of the layer.
If you need to make major changes to the layer (for example setting a new painter), it is recommended to extend from
ALcyLspStyleFormat
directly instead of using this format.Warning: the layers must fulfil the requirements documented in the
createLayerFactoryImpl()
method.- Parameters:
aRasterLayer
- The layer created by the layer factory.
-
createLayerMeasureProviderFactory
Creates a
ILcdLayerMeasureProviderFactory
that can create measure providers for a layer created by the layer factories of this format.These measurements could for example used by a mouse readout to display the measure value at the current location of the mouse cursor.
- Overrides:
createLayerMeasureProviderFactory
in classALcyLspFormat
- Returns:
- an
ILcdLayerMeasureProviderFactory
instance. Can benull
. - See Also:
-