Overview
MapInterface is the central interface for the Open Mobile Maps SDK. It manages the map’s rendering context, layers, camera, touch handling, and overall lifecycle. The interface provides both factory methods for creating map instances and instance methods for controlling the map.
Header Location: shared/public/MapInterface.h:29
Factory Methods
Creates a new map instance with custom factories and rendering context. graphicsFactory
std::shared_ptr<GraphicsObjectFactoryInterface>
required
Factory for creating graphics objects
shaderFactory
std::shared_ptr<ShaderFactoryInterface>
required
Factory for creating shader programs
renderingContext
std::shared_ptr<RenderingContextInterface>
required
Rendering context for the map
Map configuration including coordinate system
scheduler
std::shared_ptr<SchedulerInterface>
required
Scheduler for managing asynchronous tasks
Pixel density of the display
Whether to enable 3D rendering capabilities
return
std::shared_ptr<MapInterface>
A non-null shared pointer to the created map instance
Creates a new map instance with default OpenGL rendering. Map configuration including coordinate system
scheduler
std::shared_ptr<SchedulerInterface>
required
Scheduler for managing asynchronous tasks
Pixel density of the display
Whether to enable 3D rendering capabilities
return
std::shared_ptr<MapInterface>
A non-null shared pointer to the created map instance
Configuration Methods
Sets the callback handler for map events. callbackInterface
std::shared_ptr<MapCallbackInterface>
required
Callback interface for map events (nullable)
Sets the camera for the map. camera
std::shared_ptr<MapCameraInterface>
required
Camera interface to control map view
getCamera
std::shared_ptr<MapCameraInterface>
Returns the current camera instance. return
std::shared_ptr<MapCameraInterface>
The current map camera
Sets the touch handler for user interaction. touchHandler
std::shared_ptr<TouchHandlerInterface>
required
Touch handler for processing user input
getTouchHandler
std::shared_ptr<TouchHandlerInterface>
Returns the current touch handler. return
std::shared_ptr<TouchHandlerInterface>
The current touch handler
Sets the viewport size for rendering. Viewport dimensions in pixels
Sets the map background color. Background color for the map
Accessor Methods
getGraphicsObjectFactory
std::shared_ptr<GraphicsObjectFactoryInterface>
Returns the graphics object factory. return
std::shared_ptr<GraphicsObjectFactoryInterface>
Factory for creating graphics objects
getShaderFactory
std::shared_ptr<ShaderFactoryInterface>
Returns the shader factory. return
std::shared_ptr<ShaderFactoryInterface>
Factory for creating shader programs
getScheduler
std::shared_ptr<SchedulerInterface>
Returns the scheduler. return
std::shared_ptr<SchedulerInterface>
Scheduler for asynchronous tasks
getRenderingContext
std::shared_ptr<RenderingContextInterface>
Returns the rendering context. return
std::shared_ptr<RenderingContextInterface>
The rendering context
Returns the map configuration. Current map configuration
getCoordinateConverterHelper
std::shared_ptr<CoordinateConversionHelperInterface>
Returns the coordinate conversion helper. return
std::shared_ptr<CoordinateConversionHelperInterface>
Helper for coordinate conversions
Checks if the map is in 3D mode. True if 3D rendering is enabled
Layer Management
getLayers
std::vector<std::shared_ptr<LayerInterface>>
Returns all layers in the map. return
std::vector<std::shared_ptr<LayerInterface>>
Vector of all layers
getLayersIndexed
std::vector<std::shared_ptr<IndexedLayerInterface>>
Returns all indexed layers in the map. return
std::vector<std::shared_ptr<IndexedLayerInterface>>
Vector of indexed layers
Adds a layer to the top of the layer stack. layer
std::shared_ptr<LayerInterface>
required
Layer to add to the map
Inserts a layer at a specific index. layer
std::shared_ptr<LayerInterface>
required
Layer to insert
Index position for insertion
Inserts a layer above another layer. layer
std::shared_ptr<LayerInterface>
required
Layer to insert
above
std::shared_ptr<LayerInterface>
required
Reference layer to insert above
Inserts a layer below another layer. layer
std::shared_ptr<LayerInterface>
required
Layer to insert
below
std::shared_ptr<LayerInterface>
required
Reference layer to insert below
Removes a layer from the map. layer
std::shared_ptr<LayerInterface>
required
Layer to remove
Sets performance loggers for monitoring. performanceLoggers
std::vector<std::shared_ptr<PerformanceLoggerInterface>>
required
Vector of performance logger instances
getPerformanceLoggers
std::vector<std::shared_ptr<PerformanceLoggerInterface>>
Returns all performance loggers. return
std::vector<std::shared_ptr<PerformanceLoggerInterface>>
Vector of performance loggers
Rendering Methods
The following rendering methods must be called on the rendering thread.
Marks the map as needing a redraw.
Resets the invalidation state.
Prepares the map for rendering.
Checks if compute operations are needed. True if compute operations are pending
Draws a single frame. Must be called on the rendering thread.
Draws a frame to an offscreen render target. target
std::shared_ptr<RenderTargetInterface>
required
Render target for offscreen rendering
Executes compute operations. Must be called on the rendering thread.
Draws a frame when all layers within bounds are ready. Changes camera bounds, checks all layers for readiness, and updates callbacks. Always draws the frame when state is updated in the ready callbacks. Coordinate bounds to check for readiness
Padding percentage around bounds
callbacks
std::shared_ptr<MapReadyCallbackInterface>
required
Callbacks for ready state changes
Lifecycle Methods
Resumes the map rendering. Must be called on the rendering thread.
Pauses the map rendering. Must be called on the rendering thread.
Destroys the map and releases resources.
Forces a complete reload of the map.
Usage Example
// Create a map with OpenGL rendering
auto scheduler = /* create scheduler */ ;
MapConfig config{ MapCoordinateSystem ::EPSG3857};
auto map = MapInterface :: createWithOpenGl (config, scheduler, 2.0 f , false );
// Set viewport size
map -> setViewportSize (Vec2I{ 800 , 600 });
// Add a layer
auto layer = /* create layer */ ;
map -> addLayer (layer);
// Set camera
auto camera = /* create camera */ ;
map -> setCamera (camera);
// Draw frame (on rendering thread)
map -> drawFrame ();
// Clean up
map -> destroy ();
See Also