Overview
LayerInterface is the base interface for all map layers in the Open Mobile Maps SDK. It defines the contract for layer lifecycle management, rendering, visibility control, and interaction with the map. Layers are responsible for building render passes and managing their visual state.
Header Location: shared/public/LayerInterface.h:20
Lifecycle Methods
Called when the layer is added to a map.
Called when the layer is removed from the map.
Pauses the layer, typically stopping animations and data updates.
Resumes the layer after being paused.
Forces the layer to reload all its data and resources.
Rendering Methods
Updates the layer state before rendering. Called each frame to prepare the layer for rendering.
Builds and returns the render passes for this layer.
Vector of render passes that define how the layer should be rendered
Builds and returns the compute passes for this layer.
Vector of compute passes for GPU computation tasks
Sets the primary render target for the layer.
Visibility Control
Hides the layer without removing it from the map.
Shows a previously hidden layer.
Sets the opacity/transparency of the layer.
Returns the current alpha value of the layer.
Current alpha value between 0.0 and 1.0
Sets a rectangular clipping region for the layer.When set, only the portion of the layer within the scissor rectangle will be rendered. Pass an empty optional to remove scissoring.
Masking
Sets a masking object to control where the layer is rendered.
Ready State
Checks if the layer is ready to render offscreen.
Ready state enum indicating layer readiness:
READY(0): Layer is ready to renderNOT_READY(1): Layer is not yet readyERROR(2): Layer encountered an errorTIMEOUT_ERROR(3): Layer timed out while loading
Animation Control
Enables or disables animations for the layer.
Error Handling
Sets the error manager for handling layer errors.
Layer Ready States
TheLayerReadyState enum defines the possible ready states:
Usage Example
Layer Types
Several specialized layer types extendLayerInterface:
- Tiled2dMapRasterLayerInterface - Raster tile layers
- Tiled2dMapVectorLayerInterface - Vector tile layers
- PolygonLayerInterface - Polygon rendering layers
- LineLayerInterface - Line rendering layers
- IconLayerInterface - Icon/marker layers
- TextLayerInterface - Text rendering layers
See Also
- MapInterface - Managing the map and layers
- GraphicsObjectInterface - Graphics rendering primitives
- RenderPassInterface - Render pass configuration