Package com.bc.ceres.glayer
Class LayerType
- java.lang.Object
-
- com.bc.ceres.core.ExtensibleObject
-
- com.bc.ceres.glayer.LayerType
-
- All Implemented Interfaces:
Extensible
- Direct Known Subclasses:
BackgroundLayer.Type
,CollectionLayer.Type
,GraticuleLayerType
,ImageLayer.Type
,ShapeLayer.Type
public abstract class LayerType extends ExtensibleObject
A layer type is a factory for layer instances and layer (default) configurations. Layer types are managed by theLayerTypeRegistry
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LayerType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Layer
createLayer(LayerContext ctx, PropertySet layerConfig)
Creates a layer instance for the given application provided context and the given layer configuration.abstract PropertySet
createLayerConfig(LayerContext ctx)
Creates a default configuration instance for the type of layers this type can create.boolean
createWithSceneView(LayerContext ctx)
Tests if this type should be created by default with a new ProductSceneView.String[]
getAliases()
Gets the alias names under which this layer type is also known.String
getName()
Gets the name of this layer type.abstract boolean
isValidFor(LayerContext ctx)
Tests if this type can create layers for the given application provided context.-
Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
-
-
-
Method Detail
-
getName
public String getName()
Gets the name of this layer type. This name is used to persist / externalise layers of this type.The default implementation returns the name given by the
LayerTypeMetadata.name()
annotation property, if any. Otherwise, the fully qualified class name is returned.As of Ceres 0.13, it is not recommended to override this method. Instead use the
LayerTypeMetadata.name()
annotation property for your special layer type.- Returns:
- The name of this layer type.
-
getAliases
public String[] getAliases()
Gets the alias names under which this layer type is also known. The intention is to allow changing the type name and be backwards compatible with respect to layer types that have been persisted / externalised before the name change occurred.The default implementation returns the alias names given by the
LayerTypeMetadata.aliasNames()
annotation property, if any. Otherwise, an empty array is returned.As of Ceres 0.13, it is not recommended to override this method. Instead use the
LayerTypeMetadata
annotation for your special layer type.- Returns:
- The aliases of this layer type.
-
isValidFor
public abstract boolean isValidFor(LayerContext ctx)
Tests if this type can create layers for the given application provided context. Note that some applications may provide their context through the extension object interface (seeExtensibleObject.getExtension(Class)
).- Parameters:
ctx
- An application-dependent layer context.- Returns:
true
if the type is valid with respect to the given context.
-
createWithSceneView
public boolean createWithSceneView(LayerContext ctx)
Tests if this type should be created by default with a new ProductSceneView. LayerTypes should check preferences to determine if a user wants this layer type enabled by default when opening a new ProductSceneView.- Parameters:
ctx
- An application-dependent layer context.- Returns:
true
if the type should open with the scene view by default
-
createLayer
public abstract Layer createLayer(LayerContext ctx, PropertySet layerConfig)
Creates a layer instance for the given application provided context and the given layer configuration. The configuration may contain both, inmutable construction parameters passed to specific layer constructor as well as mutable layer properties.- Parameters:
ctx
- An application provided context, may benull
. The parameter may be ignored by many layer types.layerConfig
- The layer configuration.- Returns:
- A new layer instance.
-
createLayerConfig
public abstract PropertySet createLayerConfig(LayerContext ctx)
Creates a default configuration instance for the type of layers this type can create. After a default configuration has been created it is usually modified to specify a layer's construction parameters, e.g. for an image layer this could be the file path to the image file. Then, an application will pass the configuration to thecreateLayer(com.bc.ceres.glayer.LayerContext, com.bc.ceres.binding.PropertySet)
method in order to create a new layer instance.- Parameters:
ctx
- An application provided context, may benull
. The parameter may be ignored by many layer types.- Returns:
- A new layer (default) configuration.
-
-