Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KOSMIndoorMap
Commits
99e9ce2a
Commit
99e9ce2a
authored
Jun 10, 2021
by
Volker Krause
Browse files
Expand MapCSS grammar for supporting layer selectors
Not used in any way yet though.
parent
d38034d8
Pipeline
#65181
passed with stage
in 20 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/data/mapcss/parser-test.mapcss
View file @
99e9ce2a
...
...
@@ -121,3 +121,16 @@ node[shop=pastry]
node.importantShops { color: "red"; }
way.importantShops|z20- { color: "green"; }
*.importantShops[access=no] { color: "blue"; }
// layer selectors (see https://wiki.openstreetmap.org/wiki/MapCSS/0.2/Proposal_layer_selector)
way[highway]::road {
width: 8;
color: #ffffff;
casing-width: 2;
casing-color: #a0a0a0;
}
way[railway=tram]::tram {
width: 2;
color: #303030;
z-index: 1;
}
autotests/data/mapcss/parser-test.mapcss.ref
View file @
99e9ce2a
...
...
@@ -142,3 +142,18 @@ way.importantShops|z20-
color: "blue";
}
way[highway]
{
width: 8;
color: #ffffffff;
casing-width: 2;
casing-color: #ffa0a0a0;
}
way[railway=tram]
{
width: 2;
color: #ff303030;
z-index: 1;
}
src/map/style/mapcssparser.y
View file @
99e9ce2a
...
...
@@ -119,6 +119,7 @@ using namespace KOSMIndoorMap;
%type <zoomRange> ZoomRange
%type <condition> Condition
%type <binaryOp> BinaryOp
%type <strRef> LayerSelector
%type <strRef> Key
%type <rule> Declarations
%type <declaration> Declaration
...
...
@@ -189,14 +190,14 @@ Selector:
// TODO incomplete: missing pseudo-class
BasicSelector:
T_IDENT[I] ClassSelector[C] ZoomRange[Z] Tests[T] {
T_IDENT[I] ClassSelector[C] ZoomRange[Z] Tests[T]
LayerSelector[L]
{
$$ = new MapCSSBasicSelector;
$$->setClass($C.str, $C.len);
$$->setObjectType($I.str, $I.len);
$$->setZoomRange($Z.low, $Z.high);
$$->setConditions($T);
}
| T_STAR ClassSelector[C] ZoomRange[Z] Tests[T] {
| T_STAR ClassSelector[C] ZoomRange[Z] Tests[T]
LayerSelector[L]
{
$$ = new MapCSSBasicSelector;
$$->objectType = MapCSSBasicSelector::Any;
$$->setClass($C.str, $C.len);
...
...
@@ -236,6 +237,11 @@ BinaryOp:
T_BINARY_OP { $$ = $1; }
| T_EQUALS { $$ = MapCSSCondition::Equal; }
LayerSelector:
%empty { $$.str = nullptr; $$.len = 0; }
| T_COLON T_COLON T_IDENT[L] { $$ = $L; }
;
Key:
T_IDENT { $$ = $1; }
| Key T_COLON T_IDENT { $$.str = $1.str; $$.len = $3.str - $1.str + $3.len; }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment