KOSMIndoorMap::MapCSSStyle

Search for usage in LXR

KOSMIndoorMap::MapCSSStyle Class Reference

#include <mapcssstyle.h>

Public Member Functions

 MapCSSStyle ()
 
 MapCSSStyle (const MapCSSStyle &)=delete
 
 MapCSSStyle (MapCSSStyle &&) noexcept
 
ClassSelectorKey classKey (const char *className) const
 
void compile (OSM::DataSet &dataSet)
 
void evaluate (const MapCSSState &state, MapCSSResult &result) const
 
void evaluateCanvas (const MapCSSState &state, MapCSSResult &result) const
 
void initializeState (MapCSSState &state) const
 
bool isEmpty () const
 
LayerSelectorKey layerKey (const char *layerName) const
 
MapCSSStyleoperator= (const MapCSSStyle &)=delete
 
MapCSSStyleoperator= (MapCSSStyle &&) noexcept
 
void write (QIODevice *out) const
 

Detailed Description

A parsed MapCSS style sheet.

See also
MapCSSParser::parse for how to obtain a valid instance

Definition at line 32 of file mapcssstyle.h.

Constructor & Destructor Documentation

◆ MapCSSStyle()

MapCSSStyle::MapCSSStyle ( )
explicit

Creates an invalid/empty style.

Definition at line 20 of file mapcssstyle.cpp.

Member Function Documentation

◆ classKey()

ClassSelectorKey MapCSSStyle::classKey ( const char * className) const
nodiscard

Look up a class selector key for the given name, if it exists.

If no such key exists in the style sheet, an null key is returned. Use this for checking if a class is set on an evaluation result.

Definition at line 99 of file mapcssstyle.cpp.

◆ compile()

void MapCSSStyle::compile ( OSM::DataSet & dataSet)

Optimizes style sheet rules for application against dataSet.

This does resolve tag keys and is therefore mandatory when changing the data set.

Definition at line 33 of file mapcssstyle.cpp.

◆ evaluate()

void MapCSSStyle::evaluate ( const MapCSSState & state,
MapCSSResult & result ) const

Evaluates the style sheet for a given state state (OSM element, view state, element state, etc).

The result is not returned but added to result for reusing allocated memory between evaluations.

Note
state has to be initialized using MapCSSStyle initializeState() for this to produce correct results.

Definition at line 75 of file mapcssstyle.cpp.

◆ evaluateCanvas()

void MapCSSStyle::evaluateCanvas ( const MapCSSState & state,
MapCSSResult & result ) const

Evaluate canvas style rules.

Definition at line 84 of file mapcssstyle.cpp.

◆ initializeState()

void MapCSSStyle::initializeState ( MapCSSState & state) const

Initializes the evaluation state.

Call this on a MapCSSState instance for each element being evaluated. The state object can be reused for multiple elements to reduce allocations. The state object can also be reused for expression evaluations on the style sheet evaluation result.

Definition at line 42 of file mapcssstyle.cpp.

◆ isEmpty()

bool MapCSSStyle::isEmpty ( ) const
nodiscard

Returns true if this is a default-constructed or otherwise empty/invalud style.

Definition at line 28 of file mapcssstyle.cpp.

◆ layerKey()

LayerSelectorKey MapCSSStyle::layerKey ( const char * layerName) const
nodiscard

Look up a layer selector key for the given name, if it exists.

If no such key exists in the style sheet, an null key is returned. Use this for accessing specific result layers.

Definition at line 104 of file mapcssstyle.cpp.

◆ write()

void MapCSSStyle::write ( QIODevice * out) const

Write this style as MapCSS to out.

Mainly used for testing.

Definition at line 92 of file mapcssstyle.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:57:47 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.