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

#include <MDrawLayer.h>

Inheritance diagram for Maria::DrawLayer:
Maria::GeoLayer

Classes

struct  DrawObjectStoreGenerations
 
struct  GeneratorStats
 

Public Member Functions

 DrawLayer (const std::string &id, const std::shared_ptr< STK::ShaderProgramManager > &shaderManager, const std::shared_ptr< STK::FontManager > &fontManager, const std::shared_ptr< STK::Screen > &screen, const std::shared_ptr< Maria::SystemTicker > &systemTicker, const std::shared_ptr< DrawObjectManager > &drawObjectManager, const std::shared_ptr< GeoUnitsSetting > &geoUnitsSetting, int depth)
 
bool update (const std::shared_ptr< RasterProjector > &viewport, double scale, float pixelScale, bool sync) override
 Update layer for rendering. This method should determine if there is anything to render in the layer, and prepare the layer for rendering. This includes for example visibility testing, loading of data, generating graphics structures, etc.
 
void syncStores ()
 
int getIntersectingItems (const std::shared_ptr< RasterProjector > &vp, double x, double y, std::vector< ItemId > &items, bool includeDisabledItems=false, int pickRadius=4)
 
void invalidateGraphics (const ItemId &id)
 
void setDrawObjectStyle (const std::string &styleXml)
 
void setDrawObjectStyleCategory (const std::string &styleCategory)
 
void setDisabledFilter (const std::string &filterXml)
 
const std::shared_ptr< ConditiongetDisabledFilter () const
 
std::string getDisabledFilterXml () const
 
void setSymbolSet (const std::string &symbolset)
 
void renderDebug (const std::shared_ptr< RasterProjector > &vp, const STK::Viewport &glViewport)
 
void updateStyling (bool forceFullUpdate)
 
int getVisibleObjectIds (const std::shared_ptr< Maria::RasterProjector > &rp, int bufferPixels, std::vector< ItemId > &items)
 
const std::shared_ptr< Maria::StyleSet > & getStyleSet () const
 
std::shared_ptr< Maria::CompositeStyleItemgetResolvedStyle (const ItemId &objectId)
 
STK::OrientedBoundingBox2f getOrientedViewBoundingBox (const std::shared_ptr< RasterProjector > &vp, ItemId objectId)
 
STK::OrientedBoundingBox2f getOrientedViewBoundingBox (const std::shared_ptr< RasterProjector > &vp, const std::shared_ptr< DrawObjectData > &drawObject)
 
void redraw (const std::shared_ptr< RasterProjector > &vp, const STK::Camera &cam, const STK::Viewport &glViewport) override
 
bool needsRedraw () const override
 Check if a layer requires a redraw on next frame. This will typically be due to changed content, newly loaded data, etc.
 
const std::shared_ptr< PointSymbolRenderer > & getPointSymbolRenderer () const
 
const std::shared_ptr< SymbolLabelRenderer > & getSymbolLabelRenderer () const
 
void setUpdateGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &g)
 
void setGraphicsGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &g)
 
void setSymbolsGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &g)
 
void setLabelsGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &g)
 
void setClusterUpdateGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &graph)
 
void setClusterRenderGraph (const std::shared_ptr< STK::PerformanceGraphs::Graph > &graph)
 
void setSelected (const Maria::ItemId &itemId, bool selected)
 
bool isSelected (const Maria::ItemId &itemId) const
 
void setContextVariable (const std::string &name, const std::string &value)
 
bool deleteContextVariable (const std::string &name)
 
std::string getContextVariable (const std::string &name) const
 
bool isDisabled (const Maria::ItemId &itemId) const
 
void setDisabled (const Maria::ItemId &itemId, bool isDisabled)
 
MariaProtobuf::ClusterSettings getClusteringSettings () const
 
void setClusteringSettings (const MariaProtobuf::ClusterSettings &clusteringSettings)
 
void clearGeoStore ()
 
void setGeoStoreId (const std::string &geoStoreId)
 
void setFilter (const std::string &filterXml, const std::vector< std::string > &listIds)
 
bool isTransientObject (const Maria::ItemId &itemId) const
 
std::shared_ptr< Maria::DrawObjectStoregetDrawObjectStore () const
 
void setViewSymbolScale (double scale)
 
double getViewSymbolScale () const
 
void setSymbolSize (double size)
 
double getSymbolSize () const
 
long getRenderItemCacheGeneration () const
 
void setDefaultDynamicScaleTable (const Maria::ScaleTable &st)
 
- 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
 
void setDepth (int depth)
 
const std::string & getId () const
 
void setOpacity (float opacity)
 
float getOpacity () const
 
bool isEnabled () const
 
void setEnabled (bool enabled)
 
void setNeedsUpdate (bool dirty, const char *msg=nullptr)
 Force update of the layer on next frame. This will also trigger a redraw.
 
bool needsUpdate () const
 True if we have requested an update on the next frame. Will reset on next update.
 
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, bool sync)
 Update layer for rendering. This method should determine if there is anything to render in the layer, and prepare the layer for rendering. This includes for example visibility testing, loading of data, generating graphics structures, etc.
 
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 typically be due to changed content, newly loaded data, etc.
 

Protected Member Functions

long getRenderGeneration () const
 
long getDeletedGeneration () const
 
long getStyleUpdateGeneration () const
 
int64_t getStyleContextUpdateGeneration () const
 
long getFilterGeneration () const
 
uint64_t getStoreIndexGeneration () const
 
uint64_t getStoreFilterGeneration () const
 
std::vector< ItemIdfilterDisabled (const std::vector< ItemId > &items) const
 
void cleanupGeoRenderItemCache (int64_t tLimit)
 
void applyStyleToClusterSettings ()
 
void initializeClustering ()
 
void onCompletedClustering (const std::shared_ptr< Maria::ClusteringResults > &result)
 
std::shared_ptr< Maria::ClusteringResultsgetClusteringResult () const
 
MariaProtobuf::ClusterSettings defaultClusteringSettings () const
 
bool graphicsProjectionUpdate (const std::shared_ptr< Maria::RasterProjector > &rp)
 
void updateActiveItems (const std::shared_ptr< Maria::RasterProjector > &vp, bool sync)
 
void updateActiveAreaObject (const std::shared_ptr< Maria::RasterProjector > &vp, const std::shared_ptr< Maria::DrawObjectData > &drawObject, Maria::GeoRenderItemMap &visibleRenderItems, std::set< Maria::ItemId > &visiblePointItems)
 
void updateActivePointObject (const std::shared_ptr< Maria::RasterProjector > &vp, const std::shared_ptr< Maria::DrawObjectData > &drawObject, std::set< Maria::ItemId > &visiblePointItems)
 
void clearRenderItemCache ()
 
void clearPointSymbols ()
 
long getRenderItemGeneration (const Maria::ItemId &itemId)
 
void setRenderItemGeneration (const Maria::ItemId &itemId, int64_t generation)
 
std::shared_ptr< GeoRenderItemgetGeoRenderItem (const Maria::ItemId &objectId)
 
std::shared_ptr< GeoRenderItemgetOrCreateGeoRenderItem (const DrawObjectData &drawObject)
 
std::shared_ptr< GeoRenderItemcreateOrUpdateGeoRenderItem (const DrawObjectData &drawObject, const std::shared_ptr< Maria::CompositeStyleItem > &style, const std::shared_ptr< GeoRenderItem > &oldGri)
 
void dumpGeneratorStats ()
 
void resetStyling ()
 

Protected Attributes

DrawObjectStoreGenerations _drawObjectStoreGen
 
uint64_t _renderStoreIndexGenerations = 0
 
int64_t _styleContextGeneration = -1
 
double _prevScaleStyleCheck = -1.0
 
long _lastRenderItemCacheGeneration = -1
 
std::chrono::time_point< std::chrono::system_clock > _lastFullRestyle
 
std::unordered_map< int, float > _dimmed
 
uint64_t _currFrame = 0
 
long _screenGeneration = 0
 
std::shared_ptr< Maria::RasterProjector_gfxProjector
 
int _gfxProjectorGeneration = -1
 
std::shared_ptr< STK::Screen_screen
 
std::shared_ptr< Maria::SystemTicker_systemTicker
 
std::shared_ptr< STK::GraphicsRender2D_gfxRender
 
std::shared_ptr< STK::FontManager_fontManager
 
std::shared_ptr< DrawObjectManager_drawObjectManager
 
std::shared_ptr< STK::PerformanceGraphs::Graph_updateGraph
 
std::shared_ptr< STK::PerformanceGraphs::Graph_graphicsGraph
 
std::shared_ptr< STK::PerformanceGraphs::Graph_symbolsGraph
 
std::shared_ptr< STK::PerformanceGraphs::Graph_labelsGraph
 
std::shared_ptr< STK::PerformanceGraphs::Graph_clusterGfxUpdateGraph
 
std::shared_ptr< STK::PerformanceGraphs::Graph_clusterGfxRenderGraph
 
float _baseSymbolSize = 48.0f
 
Maria::ItemContext _styleContext
 
std::string _styleCategoryName
 
std::shared_ptr< Maria::StyleSet_styleSet
 
std::shared_ptr< Maria::Condition_disabledFilter
 
std::string _disabledFilterXml
 
std::map< Maria::ItemId, std::shared_ptr< Maria::CompositeStyleItem > > _resolvedStyles
 
std::mutex _stylingMutex
 
std::shared_ptr< Maria::ItemSelection_selection
 
long _selectionGeneration = 0
 
std::unordered_map< ItemId, long, ItemId::Hash_objectGenerations
 
std::shared_ptr< GeoRenderItemCollection_activeRenderItems
 
std::unordered_map< ItemId, std::shared_ptr< GeoRenderItem >, ItemId::Hash_geoRenderItemCache
 
long _renderItemCacheGeneration = 0
 
std::shared_ptr< DrawObjectStore_geoStore
 
std::shared_ptr< ClusteringProcessor_clusteringProcessor
 
std::shared_ptr< Maria::ClusteringResults_clusteringResult
 
std::mutex _clusteringResultMutex
 
std::shared_ptr< ClusterRenderer_clusterRenderer
 
MariaProtobuf::ClusterSettings _clusteringSettings = defaultClusteringSettings()
 
long _updateFrameNumber = 0
 
long long _geoUnitSettingsGeneration = 0
 
const std::shared_ptr< GeoUnitsSetting_geoUnitsSetting
 
std::unordered_map< std::string, GeneratorStats_generatorStats
 
std::shared_ptr< PointSymbolRenderer_symbolPointRenderer
 
std::shared_ptr< SymbolLabelRenderer_symbolLabelRenderer
 
std::shared_ptr< PointSymbolRenderer_selectedPointRenderer
 
ViewportCollisionGrid _collisionGrid
 
std::shared_ptr< STK::GraphicsRender2D_debugRender
 
std::shared_ptr< std::thread > _storeSyncWorker
 
bool _terminateStoreSync = false
 
- 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

DrawLayer - Short description

Member Function Documentation

◆ getIntersectingItems()

int DrawLayer::getIntersectingItems ( const std::shared_ptr< RasterProjector > &  vp,
double  x,
double  y,
std::vector< ItemId > &  items,
bool  includeDisabledItems = false,
int  pickRadius = 4 
)

Find draw objects intersecting a screen position. Returns a list of all draw objects hit by the input pixel at position x, y, within a radius of pickRadius pixels.

Parameters
includeDisabledItemsIf true, also include items that are filtered by the disabledFilter
pickRadiusRadius in pixels around the query point.

◆ getRenderItemCacheGeneration()

long Maria::DrawLayer::getRenderItemCacheGeneration ( ) const
inline

Keep track of changes in the render item cache. When these change, graphics based values, such as screen bounding box may have changed.

◆ getSymbolSize()

double Maria::DrawLayer::getSymbolSize ( ) const
inline

Get base symbol size (in pixels). This is the default size for all symbols, which may be scaled according to styling.

◆ getViewSymbolScale()

double DrawLayer::getViewSymbolScale ( ) const

Get symbol styling scale factor. This value can be used through the [ViewSymbolScale] style context variable.

◆ getVisibleObjectIds()

int DrawLayer::getVisibleObjectIds ( const std::shared_ptr< Maria::RasterProjector > &  rp,
int  bufferPixels,
std::vector< ItemId > &  items 
)
Parameters
rpRaster Projecter that defines what is "on screen".
bufferPixelsA buffer of pixels for precision purposes.
itemsDestination of all item ids.
Returns
Number of items added to items.

◆ invalidateGraphics()

void Maria::DrawLayer::invalidateGraphics ( const ItemId id)
inline

Will invalidate the graphics for this item, works for both point items and area objects (GeoRenderItems), ensuring that the graphics will be updated on next update().

◆ isTransientObject()

bool Maria::DrawLayer::isTransientObject ( const Maria::ItemId itemId) const
inline

Check if a draw object is transient (local edit copy used during interactive creation workflows and edit tools).

◆ needsRedraw()

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

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

Returns

Reimplemented from Maria::GeoLayer.

◆ redraw()

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

Implements Maria::GeoLayer.

◆ setDefaultDynamicScaleTable()

void Maria::DrawLayer::setDefaultDynamicScaleTable ( const Maria::ScaleTable st)
inline

Set default dynamic scale table. This table will affect all symbols that do not have a custom dynamic scale table.

◆ setSymbolSize()

void Maria::DrawLayer::setSymbolSize ( double  size)
inline

Set base symbol size (in pixels). This is the default size for all symbols, which may be scaled according to styling.

◆ setViewSymbolScale()

void DrawLayer::setViewSymbolScale ( double  scale)

Set symbol styling scale factor. This value can be used through the [ViewSymbolScale] style context variable.

◆ update()

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

Update layer for rendering. This method should determine if there is anything to render in the layer, and prepare the layer for rendering. This includes for example visibility testing, loading of data, generating graphics structures, etc.

Parameters
viewport
scaleMap scale for the current view.
pixelScaleScale factor for the pixel allowed pixel size.
syncSynchronous loading of data. This will be true in settings where we need all data to be loaded synchronously, for example when rendering to a bitmap.
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: