alaCarte Maps
Renderer for OpenStreetMap tiles
|
#include <mapcss_parser.hpp>
Public Member Functions | |
void | addAttributeToTemplate (StylePtr &style, const shared_ptr< AttributeCreator > &attrType, const string &specifier, const ParseInfo &info) |
Converts a given string into a text position. More... | |
void | applyStyleToRules (std::vector< RulePtr > &rules, const StylePtr &style) |
Sets a given style as the style of given rules. More... | |
SelectorPtr | createSelectorFromObjectType (const SelectorPtr &next, const shared_ptr< Rule > &rule, obj::ObjectTypeEnum objType, Rule::AcceptableTypes &type) |
Creates an selector used to match geoobject types. More... | |
SelectorPtr | createChildSelectorFromObjectType (const SelectorPtr &next, const shared_ptr< Rule > &rule, obj::ObjectTypeEnum objType) |
Creates a selector, selecting children of the specified type. More... | |
SelectorPtr | createSelectorFromUnaryCondition (const SelectorPtr &next, const shared_ptr< Rule > &rule, const UnaryCondition &condition) |
Creates a selector using an unary operator. More... | |
SelectorPtr | createSelectorFromBinaryCondition (const SelectorPtr &next, const shared_ptr< Rule > &rule, const BinaryCondition &condition) |
Creates a selector using an binary operator. More... | |
SelectorPtr | createSelectorFromCondition (const SelectorPtr &next, const shared_ptr< Rule > &rule, const ConditionType &condition) |
Creates a selector for a given condition. More... | |
RulePtr | createSelectorChain (const std::vector< SelectorItem > &items) |
Creates a chain of selectors from given subselectors. More... | |
void | warnUnsupportedAttribute (const string &attribute) const |
Emits a warning for unknown mapcss attribute. More... | |
MapCssParser (const shared_ptr< Geodata > &geodata) | |
Initializes the parser. More... | |
void | load (const string &path) |
Loads a file from the given path and tries to parse the content into a stylesheet. More... | |
Public Attributes | |
shared_ptr< Geodata > | geodata |
The geodata used to inject them in the rules. More... | |
shared_ptr< Stylesheet > | parsedStylesheet |
The parsed stylesheet. More... | |
excp::ParseException | catchedException |
The exception that may be catched. More... | |
shared_ptr< ParserLogger > | logger |
Output logger for errors and warnings. More... | |
Definition at line 39 of file mapcss_parser.hpp.
MapCssParser::MapCssParser | ( | const shared_ptr< Geodata > & | geodata | ) |
Initializes the parser.
geodata | used in created rules |
Definition at line 338 of file mapcss_parser.cpp.
void MapCssParser::addAttributeToTemplate | ( | StylePtr & | style, |
const shared_ptr< AttributeCreator > & | attrType, | ||
const string & | specifier, | ||
const ParseInfo & | info | ||
) |
Converts a given string into a text position.
specifier | selecting text position (values are "line" and "center") |
style | to add the attribute |
attrType | type of the attribute |
specifier | for the attribute |
Definition at line 118 of file mapcss_parser.cpp.
Sets a given style as the style of given rules.
rules | rules, where the style should applied to |
style | which should be applied to the rules |
Definition at line 144 of file mapcss_parser.cpp.
SelectorPtr MapCssParser::createChildSelectorFromObjectType | ( | const SelectorPtr & | next, |
const shared_ptr< Rule > & | rule, | ||
obj::ObjectTypeEnum | objType | ||
) |
Creates a selector, selecting children of the specified type.
next | selector which is called, if this selector matches |
rule | containing the selector |
objType | which should be selected by this selector |
Definition at line 184 of file mapcss_parser.cpp.
RulePtr MapCssParser::createSelectorChain | ( | const std::vector< SelectorItem > & | items | ) |
Creates a chain of selectors from given subselectors.
The last selector will always be an applyselector, which applies the style of the rule
items | to be converted into a selector chain |
Definition at line 286 of file mapcss_parser.cpp.
SelectorPtr MapCssParser::createSelectorFromBinaryCondition | ( | const SelectorPtr & | next, |
const shared_ptr< Rule > & | rule, | ||
const BinaryCondition & | condition | ||
) |
Creates a selector using an binary operator.
next | selector which is called, if this selector matches |
rule | containing the selector |
condition | used to select objects |
Definition at line 230 of file mapcss_parser.cpp.
SelectorPtr MapCssParser::createSelectorFromCondition | ( | const SelectorPtr & | next, |
const shared_ptr< Rule > & | rule, | ||
const ConditionType & | condition | ||
) |
Creates a selector for a given condition.
next | selector which is called, if this selector matches |
rule | containing the selector |
condition | used to select objects |
Definition at line 263 of file mapcss_parser.cpp.
SelectorPtr MapCssParser::createSelectorFromObjectType | ( | const SelectorPtr & | next, |
const shared_ptr< Rule > & | rule, | ||
obj::ObjectTypeEnum | objType, | ||
Rule::AcceptableTypes & | type | ||
) |
Creates an selector used to match geoobject types.
next | selector which is called, if this selector matches |
rule | containing the selector |
objType | which should be selected by the selector |
Definition at line 160 of file mapcss_parser.cpp.
SelectorPtr MapCssParser::createSelectorFromUnaryCondition | ( | const SelectorPtr & | next, |
const shared_ptr< Rule > & | rule, | ||
const UnaryCondition & | condition | ||
) |
Creates a selector using an unary operator.
next | selector which is called, if this selector matches |
rule | containing the selector |
condition | used to select objects |
Definition at line 207 of file mapcss_parser.cpp.
void MapCssParser::load | ( | const string & | path | ) |
Loads a file from the given path and tries to parse the content into a stylesheet.
path | to a file containing a stylesheet in mapcss form |
Definition at line 350 of file mapcss_parser.cpp.
void MapCssParser::warnUnsupportedAttribute | ( | const string & | attribute | ) | const |
Emits a warning for unknown mapcss attribute.
attribute | name |
Definition at line 329 of file mapcss_parser.cpp.
excp::ParseException MapCssParser::catchedException |
The exception that may be catched.
Definition at line 59 of file mapcss_parser.hpp.
shared_ptr<Geodata> MapCssParser::geodata |
The geodata used to inject them in the rules.
Definition at line 55 of file mapcss_parser.hpp.
shared_ptr<ParserLogger> MapCssParser::logger |
Output logger for errors and warnings.
Definition at line 61 of file mapcss_parser.hpp.
shared_ptr<Stylesheet> MapCssParser::parsedStylesheet |
The parsed stylesheet.
Definition at line 57 of file mapcss_parser.hpp.