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
A layer type is a factory for layer instances and layer (default) configurations.
Layer types are managed by the
LayerTypeRegistry.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract LayercreateLayer(LayerContext ctx, PropertySet layerConfig) Creates a layer instance for the given application provided context and the given layer configuration.abstract PropertySetCreates a default configuration instance for the type of layers this type can create.booleanTests if this type should be created by default with a new ProductSceneView.String[]Gets the alias names under which this layer type is also known.getName()Gets the name of this layer type.abstract booleanisValidFor(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
-
Constructor Details
-
LayerType
protected LayerType()
-
-
Method Details
-
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
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
LayerTypeMetadataannotation for your special layer type.- Returns:
- The aliases of this layer type.
-
isValidFor
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:
trueif the type is valid with respect to the given context.
-
createWithSceneView
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:
trueif the type should open with the scene view by default
-
createLayer
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
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.
-