Maria GDK 5.0.0.737
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::MapLayer Class Reference

#include <MMapLayer.h>

Inheritance diagram for Maria::MapLayer:
Maria::GeoLayer

Public Member Functions

 MapLayer (const std::string &id, const std::shared_ptr< STK::ShaderProgramManager > &shaderManager, const std::shared_ptr< STK::FontManager > &fontManager, std::shared_ptr< Maria::SystemTicker >systemTicker, const std::shared_ptr< Maria::TileCacheManager > tileCacheManager, int depth)
 
void clearRenderData (bool keepCurrentFrame)
 
void clearRenderData (const std::string &layerId)
 
void setTemplate (const MapTemplate &tpl)
 Utility method to create map layers from a map template.
 
std::shared_ptr< TiledMapLayercreateMapLayer (const std::string &id, Maria::MapContentQuery &mapQuery, int timeout=5000)
 
std::shared_ptr< TiledShadingLayercreateShadingLayer (const std::string &id, Maria::MapContentQuery &mapQuery, int timeout=5000)
 
void clearLayers ()
 Clear all sub layers.
 
void removeLayer (const std::string &id)
 Remove the sub layer with the given Id.
 
void removeLayer (const std::shared_ptr< Maria::MapSubLayer > &layer)
 
void addLayer (const std::shared_ptr< Maria::MapSubLayer > &layer)
 Add sub layer (mostly for unit testing).
 
int numSubLayers () const
 
virtual bool update (const std::shared_ptr< RasterProjector > &viewport, double scale, float pixelScale) override
 Update layer for rendering. This method should determine if there is anything to render in the layer, and prepare the layer for rendering.
 
virtual void redraw (const std::shared_ptr< RasterProjector > &vp, const STK::Camera &cam, const STK::Viewport &glViewport) override
 
virtual bool needsRedraw () const override
 Check if a layer requires a redraw on next frame. This will typicall be due to changed content, newly loaded data, etc.
 
void setSyncTileLoading (bool syncTileLoading)
 
bool getSyncTileLoading () const
 
void setSyncTileLoadingTimeout (long timeout)
 
long getSyncTileLoadingTimeout () const
 
MapMetadata getMetadata (const RasterProjector &rp, double mapScale, double pixelScale=1.5, long timeout_ms=0)
 Get metdata for the given area.
 
MapMetadata getMetadata (const BasicGeoTypes::GeoPos &pos, double mapScale, double resolution=0.0, long timeout_ms=0)
 Get metdata for the given point.
 
- Public Member Functions inherited from Maria::GeoLayer
 GeoLayer (const std::string &id, int depth)
 
void setClippingMargins (int left, int right, int top, int bottom)
 
void getClippingMargins (int &left, int &right, int &top, int &bottom)
 
bool needsClipping () const
 
void beginClipping (const STK::Viewport &glViewport)
 
void endClipping ()
 
int getDepth () const
 
const std::string & getId () const
 
void setOpacity (float opacity)
 
float getOpacity () const
 
bool isEnabled () const
 
void setEnabled (bool enabled)
 
void setLayerDirty (bool dirty)
 
bool isLayerDirty () const
 
void setPerformanceGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &perf)
 
const std::shared_ptr< STK::PerformanceGraphs::Graph > & getPerformanceGraph () const
 
virtual bool update (const std::shared_ptr< RasterProjector > &viewport, double scale, float pixelScale)
 Update layer for rendering. This method should determine if there is anything to render in the layer, and prepare the layer for rendering.
 
virtual void redraw (const std::shared_ptr< RasterProjector > &vp, const STK::Camera &cam, const STK::Viewport &glViewport)=0
 
virtual void cleanupCaches (bool keepCurrentFrame)
 This method is called at regular intervals to clean up cached data, such as OpenGL textures, graphics buffers etc. Only data that can be reproduced automatically should be cleaned up by this method.
 
virtual bool needsRedraw () const
 Check if a layer requires a redraw on next frame. This will typicall be due to changed content, newly loaded data, etc.
 

Additional Inherited Members

- Protected Attributes inherited from Maria::GeoLayer
int _depth = -1
 
std::string _id
 
float _opacity = 1.0f
 
bool _enabled = true
 
int _clipLeft = 0
 
int _clipRight = 0
 
int _clipTop = 0
 
int _clipBottom = 0
 
std::shared_ptr< STK::PerformanceGraphs::Graph_perfGraph
 

Detailed Description

MapLayer - Short description

Member Function Documentation

◆ addLayer()

void Maria::MapLayer::addLayer ( const std::shared_ptr< Maria::MapSubLayer > &  layer)
inline

Add sub layer (mostly for unit testing).

Parameters
layer

◆ clearRenderData()

void MapLayer::clearRenderData ( bool  keepCurrentFrame)

clear all render tiles from cache.

Parameters
keepCurrentFrameIf true, keep the render tiles visible in the current frame.

◆ getMetadata() [1/2]

MapMetadata Maria::MapLayer::getMetadata ( const BasicGeoTypes::GeoPos pos,
double  mapScale,
double  resolution = 0.0,
long  timeout_ms = 0 
)

Get metdata for the given point.

Parameters
posPosition to query.
mapScaleIf given and != 0, only map layers with scale ranges matching the given map scale will be considered. If 0, any map layer that intersects the area is included.
resolutionGet tiles with resolution closest to the given number (in m/pixel). The returned tile will typically be the first quadtree level with resolution better than the required number. If 0, return the highest available resolution.
timeout_msMaximum ms to wait for loading of tiles. If 0, wait indefinitely. If < 0, do not wait, only tiles that are already loaded will be considered.
Returns
A map metadata structure containing all metadata fields for the point, arranged by map data layer. Top layer first.

◆ getMetadata() [2/2]

MapMetadata Maria::MapLayer::getMetadata ( const RasterProjector rp,
double  mapScale,
double  pixelScale = 1.5,
long  timeout_ms = 0 
)

Get metdata for the given area.

Parameters
rpRaster projector describing the area and projection of interest.
mapScaleIf given and != 0, only map layers with scale ranges matching the given map scale will be considered. If 0, any map layer that intersects the area is included.
pixelScalePixel scale factor. This scale factor influences the tile level selection. The default value of 1.5 causes level shifts to occur at the resolution halfway between two tile levels.
timeout_msMaximum ms to wait for loading of tiles. If 0, wait indefinitely. If < 0, do not wait, only tiles that are already loaded will be considered.
Returns
A map metadata structure containing all metadata fields for the area, arranged by map data layer. Top layer first.

◆ needsRedraw()

bool Maria::MapLayer::needsRedraw ( ) const
overridevirtual

Check if a layer requires a redraw on next frame. This will typicall be due to changed content, newly loaded data, etc.

Returns

Reimplemented from Maria::GeoLayer.

◆ redraw()

void MapLayer::redraw ( const std::shared_ptr< RasterProjector > &  vp,
const STK::Camera cam,
const STK::Viewport glViewport 
)
overridevirtual

Implements Maria::GeoLayer.

◆ removeLayer()

void Maria::MapLayer::removeLayer ( const std::string &  id)

Remove the sub layer with the given Id.

Parameters
id

◆ setTemplate()

void MapLayer::setTemplate ( const MapTemplate tpl)

Utility method to create map layers from a map template.

Parameters
tpl

◆ update()

bool MapLayer::update ( const std::shared_ptr< RasterProjector > &  viewport,
double  scale,
float  pixelScale 
)
overridevirtual

Update layer for rendering. This method should determine if there is anything to render in the layer, and prepare the layer for rendering.

Parameters
viewport
scaleMap scale for the current view.
pixelScaleScale factor for the pixel allowed pixel size.
Returns
True if the layer should be rendered, false if not.

Reimplemented from Maria::GeoLayer.


The documentation for this class was generated from the following files: