Commit 79bb134e authored by Adrien Pavie's avatar Adrien Pavie
Browse files

Managing @import in MapCSS, more elements in default style

parent 71c9cc3c
......@@ -61,7 +61,6 @@ imagesuiv: $(IMG_UIV:%.svg=%.png)
%.png: %.svg
inkscape -z -e $*.png -w 32 -h 32 $*.svg
# Core compile
coredev: coreprepare corebundlejs corebundlecss coreminifycss
coreprod: coreprepare corebundleminifyjs corebundlecss coreminifycss
......@@ -71,7 +70,7 @@ coreprepare:
# Copy HTML/Conf files
cp $(SRC_FOLDER)/*.html $(DIST_FOLDER)/
cp -r $(SRC_FOLDER)/conf $(DIST_FOLDER)/
cp -r $(SRC_FOLDER)/styles $(DIST_FOLDER)/
./mapcss.import.sh
# Prepare images
mkdir -p $(DIST_FOLDER)/img
cp -r $(IMG_FOLDER)/features-raster/* $(DIST_FOLDER)/img/
......
#!/bin/bash
# Replace a MapCSS @import line with actual content of wanted MapCSS
# Use: mapcss.import.sh <file_to_read>
STYLE_FOLDER=./src/styles
OUTPUT_FOLDER=./dist/styles
IFS=''
function process {
output=$OUTPUT_FOLDER/`basename $1`
# Clear previous output
echo "" > $output
regex="^@import url\('(.*)'\)\;$"
# Read MapCSS
cat $1 | while read line; do
# If @import markup, import file
if [[ $line =~ $regex ]]; then
# Check if file exists
if ! test -r $STYLE_FOLDER/${BASH_REMATCH[1]}; then
echo "File ${BASH_REMATCH[1]} not readable"
else
echo "/** Import of ${BASH_REMATCH[1]} **/" >> $output
cat $STYLE_FOLDER/${BASH_REMATCH[1]} >> $output
fi
# If not, echo line
else
echo "$line" >> $output
fi
done
}
for i in $STYLE_FOLDER/*.mapcss; do
process $i
done
{
"styles": {
"buildingpart|indoor|room": [
{
"name": "Vertical passage",
"description": "Elevetor, stairs (as polygons)",
"onTags": [ { "buildingpart": "verticalpassage" }, { "room": "stairs|escalator" }, { "indoor": "elevator" }, { "stairs": "yes" } ],
"style": { "color": "#7495DA", "fillColor": "#AEBDDA", "opacity": 1, "fillOpacity": 1, "weight": 2.5, "levelup": true, "layer": -1 }
},
{
"name": "Elevator",
"description": "Elevator",
"onTags": [ { "buildingpart:verticalpassage": "elevator" }, { "indoor": "elevator" } ],
"style": { "icon": "passage_elevator.png" }
},
{
"name": "Stairs",
"description": "Stairs (verticalpassage)",
"onTags": [ { "buildingpart:verticalpassage": "stairway" }, { "room": "stairs" }, { "stairs": "yes" } ],
"style": { "icon": "passage_stairs.png" }
},
{
"name": "Escalator",
"description": "Escalator (verticalpassage)",
"onTags": [ { "buildingpart:verticalpassage": "escalator" }, { "room": "escalator" }, { "conveying": "yes" } ],
"style": { "icon": "passage_escalator.png" }
},
{
"name": "Emergency stairs",
"description": "Stairs for emergency only (as polygons)",
"onTags": [ { "buildingpart": "verticalpassage", "access": "emergency" }, { "room": "stairs", "access": "emergency" }, { "stairs": "yes", "access": "emergency" } ],
"style": { "color": "#009262", "fillColor": "#C0FFCB", "icon": "emergency_stairs.png" }
},
{
"name": "Pillar",
"description": "Pillar",
"onTags": [ { "indoor": "column" } ],
"style": { "color": "#656565", "opacity": 1, "weight": 2.5, "lineCap": "butt", "fillColor": "#656565", "fillOpacity": 1, "radius": 4, "layer": 0 }
},
{
"name": "Glass cabinet",
"description": "Glass cabinet",
"onTags": [ { "indoor": "glass_cabinet" } ],
"isDetail": true,
"style": { "color": "#A2CCC8", "fillColor": "#E3F3F5", "opacity": 1, "fillOpacity": 1, "lineJoin": "miter", "weight": 2, "layer": -1 }
},
{
"name": "Door",
"description": "Default door",
"onTags": [ { "buildingpart": "door" }, { "indoor": "door" } ],
"isDetail": true,
"style": { "icon": "door.png", "color": "#888888", "opacity": 1, "weight": 2, "lineCap": "butt", "dashArray": "5,5" }
},
{
"name": "${laboratory} lab",
"description": "Laboratory icons",
"onTags": [ { "laboratory": "*" } ],
"style": {
"icon": "laboratory_${laboratory}.png",
"iconAlias": { "biological": "biology", "physical": "physics", "electronic": "electronics" }
}
},
{
"name": "Restricted area",
"description": "Area/room only for a limited amount of people",
"onTags": [ { "indoor": "room|area|corridor", "access": "private|no" }, { "buildingpart": "verticalpassage|hall|room|area|corridor", "access": "private|no" }, { "room": "technical" } ],
"style": { "fillColor": "#A2A2A2" }
}
],
"door|entrance": [
{
"name": "Door",
"description": "Default door",
"onTags": [ { "door": "*" }, { "entrance": "*" } ],
"style": { "icon": "door.png", "color": "#888888", "opacity": 1, "weight": 2, "lineCap": "butt", "dashArray": "5,5" },
"isDetail": true
},
{
"name": "Passage",
"description": "door=no nodes",
"onTags": [ { "door": "no" } ],
"style": { "color": "#0BB848", "fillColor": "#0BB848", "opacity": 1, "fillOpacity": 1, "radius": 3, "icon": "none", "showMissingIcon": false, "dashArray": "none" }
},
{
"name": "Sliding door",
"description": "Door=sliding nodes",
"onTags": [ { "door": "sliding" } ],
"style": { "icon": "door_sliding.png" }
},
{
"name": "${entrance} (entrance)",
"description": "Entrance doors",
"onTags": [ { "entrance": "service|emergency|exit|main" } ],
"style": { "icon": "entrance_${entrance}.png" }
}
],
"highway": [
{
"name": "Path",
"description": "Highways (default)",
"onTags": [ { "highway": "*" } ],
"style": { "color": "#F98072", "opacity": 0.2 }
},
{
"name": "Path (Guide strips)",
"description": "Path with guide strips",
"onTags": [ { "highway": "*", "guide_strips": "yes" } ],
"style": { "color": "#316EDD", "icon": "guide_strips.png" }
},
{
"name": "Area",
"description": "Pedestrian areas",
"onTags": [ { "highway": "pedestrian|footway|corridor", "area": "yes" } ],
"style": { "color": "#AAAAAA", "opacity": 1, "weight": 0.8, "fillColor": "#EEEEEE", "fillOpacity": 1, "layer": -6, "label": "name", "labelStyle": "area" }
},
{
"name": "Bus stop",
"description": "Bus stop",
"onTags": [ { "highway": "bus_stop" } ],
"style": { "icon": "highway_bus_stop.png" }
},
{
"name": "Stairs",
"description": "Stairs",
"onTags": [ { "highway": "steps" } ],
"style": { "color": "#F98072", "opacity": 1, "weight": 10, "lineCap": "butt", "dashArray": "2,1", "levelup": true, "level": -1 }
},
{
"name": "Conveying path",
"description": "Conveying path",
"onTags": [ { "conveying": "yes|forward|backward|reversible" } ],
"style": { "icon": "passage_escalator.png", "color": "#848484", "opacity": 1, "weight": 10, "lineCap": "butt", "dashArray": "3,1", "levelup": true }
},
{
"description": "Conveying path",
"onTags": [ { "highway": "footway", "conveying": "yes|forward|backward|reversible" } ],
"style": { "dashArray": "3,2", "icon": "none" }
},
{
"name": "Vertical passage",
"description": "Elevetor, stairs",
"onTags": [ { "highway": "elevator|lift" }, { "highway": "steps", "area": "yes" } ],
"style": { "color": "#7495DA", "fillColor": "#AEBDDA", "opacity": 1, "fillOpacity": 1, "weight": 2.5, "levelup": true, "layer": -1, "dashArray": "null" }
},
{
"name": "Elevator",
"description": "Elevator",
"onTags": [ { "highway": "elevator|lift" } ],
"style": { "icon": "passage_elevator.png" }
},
{
"name": "Stairs",
"description": "Stairs (verticalpassage)",
"onTags": [ { "area": "yes", "highway": "steps" } ],
"style": { "icon": "passage_stairs.png" }
},
{
"name": "Escalator",
"description": "Escalator (verticalpassage)",
"onTags": [ { "area": "yes", "conveying": "yes|forward|backward|reversible" } ],
"style": { "icon": "passage_escalator.png" }
},
{
"description": "Oneway path",
"onTags": [ { "oneway": "yes" }, { "conveying": "forward" } ],
"style": { "icon": "arrow_up_1.png", "rotateIcon": true }
},
{
"description": "Oneway path",
"onTags": [ { "oneway": "-1" }, { "conveying": "backward" } ],
"style": { "icon": "arrow_down_1.png", "rotateIcon": true }
}
],
"amenity": [
{
"name": "${amenity} (amenity)",
......@@ -252,12 +76,6 @@
],
"barrier": [
{
"name": "${barrier} (barrier)",
"description": "Barrier icons",
"onTags": [ { "barrier": "*" } ],
"style": { "color": "#5B5B5B", "icon": "barrier_${barrier}.png", "opacity": 1, "fillOpacity": 1, "weight": 2, "lineCap": "butt", "showMissingIcon": false }
},
{
"name": "Hedge",
"description": "Hedge",
......@@ -295,12 +113,6 @@
],
"man_made": [
{
"name": "Pillar",
"description": "Pillar",
"onTags": [ { "man_made": "pillar" } ],
"style": { "color": "#656565", "opacity": 1, "weight": 2.5, "lineCap": "butt", "fillColor": "#656565", "fillOpacity": 1, "radius": 4, "layer": 0 }
},
{
"name": "CCTV",
"description": "Surveillance",
......@@ -495,28 +307,6 @@
"iconAlias": { "news_papers": "newspapers", "drinks": "drink", "vegetables": "vegetable" }
}
}
],
"building|building:part": [
{
"name": "Building",
"description": "Building",
"onTags": [ { "building": "*" }, { "building:part": "floor" } ],
"style": { "color": "#909090", "opacity": 1, "weight": 2.5, "fillColor": "#D4CACA", "fillOpacity": 1, "layer": -10, "popup": "yes" }
},
{
"name": "Pillar",
"description": "Pillar",
"onTags": [ { "building:part": "column" } ],
"style": { "color": "#656565", "opacity": 1, "weight": 2.5, "lineCap": "butt", "fillColor": "#656565", "fillOpacity": 1, "radius": 4, "layer": 0 }
},
{
"name": "Tier",
"description": "Tier (gradins)",
"onTags": [ { "building:part": "tier" } ],
"style": { "color": "#B4ADB3", "opacity": 1, "weight": 1, "fillColor": "#BABABA", "fillOpacity": 1, "layer": -4 }
}
]
},
......
@import url('default.mapcss');
meta {
title: 'Accessibility';
}
line[highway][guide_strips=yes] {
color: #316EDD;
icon: url('guide_strips.png');
}
@import url('default.mapcss');
meta {
title: 'Basic';
}
/****************************************************************************
* Labels
*/
*[name][amenity] {
text-color: #3E3E3E;
}
*[name][shop] {
text-color: #AC39AC;
}
*[name][tourism] {
text-color: #0099E4;
}
/****************************************************************************
* Public transport objects
*/
*[highway=bus_stop] {
icon-image: url('highway_bus_stop.png');
}
/****************************************************************************
* Tourism-related objects
*/
/** Glass cabinet **/
*[indoor=glass_cabinet] {
color: #A2CCC8;
fill-color: #E3F3F5;
opacity: 1;
fill-opacity: 1;
weight: 2;
z-index: -1;
}
......@@ -2,6 +2,7 @@ meta {
title: 'Default';
}
/****************************************************************************
* Labels
*/
......@@ -19,18 +20,6 @@ line[name] {
text-position: line;
}
*[name][amenity] {
text-color: #3E3E3E;
}
*[name][shop] {
text-color: #AC39AC;
}
*[name][tourism] {
text-color: #0099E4;
}
/****************************************************************************
* Indoor structures
......@@ -64,14 +53,27 @@ relation[type=multipolygon][indoor=wall] {
area[indoor=~/area|corridor/],
area[buildingpart=~/corridor|hall/],
area[room=~/corridor|hall|entry|gallery|collection|entrance/],
area[highway=~/pedestrian|footway|corridor/],
relation[type=multipolygon][indoor=~/area|corridor/],
relation[type=multipolygon][buildingpart=~/corridor|hall/],
relation[type=multipolygon][room=~/corridor|hall|entry|gallery|collection|entrance/] {
relation[type=multipolygon][room=~/corridor|hall|entry|gallery|collection|entrance/],
relation[type=multipolygon][highway=~/pedestrian|footway|corridor/] {
fill-color: #EEEEEE;
fill-opacity: 1;
z-index: -6;
}
/** Restricted room/areas **/
area[indoor=~/room|area|corridor/][access=~/private|no/],
area[buildingpart][access=~/private|no/],
area[room=technical],
relation[type=multipolygon][indoor=~/room|area|corridor/][access=~/private|no/],
relation[type=multipolygon][buildingpart][access=~/private|no/],
relation[type=multipolygon][room=technical]{
fill-color: #A2A2A2;
}
/*
* Walls of objects
*/
......@@ -80,9 +82,14 @@ relation[type=multipolygon][room=~/corridor|hall|entry|gallery|collection|entran
area[indoor=~/room|corridor|wall/],
area[buildingpart=~/room|corridor|hall/],
area[room],
*[indoor=column],
area[building],
area[building:part=floor],
relation[type=multipolygon][indoor=~/room|corridor/],
relation[type=multipolygon][buildingpart=~/room|corridor|hall/],
relation[type=multipolygon][room] {
relation[type=multipolygon][room],
relation[type=multipolygon][building],
relation[type=multipolygon][building:part=floor] {
color: #999999;
opacity: 1;
width: 2.5;
......@@ -96,6 +103,15 @@ relation[type=multipolygon][indoor=area] {
width: 0.5;
}
/** Pillars **/
*[indoor=column],
*[man_made=pillar],
*[building:part=column] {
fill-color: #999999;
fill-opacity: 1;
}
/*
* Room/area icons
*/
......@@ -118,3 +134,183 @@ area[area],
relation[type=multipolygon][area] {
icon-image: url('room_$[area].png');
}
/** Laboratories **/
area[laboratory],
relation[type=multipolygon][laboratory]
{
icon-image: url('laboratory_$[laboratory].png');
icon-image-aliases: '"biological": "biology", "physical": "physics", "electronic": "electronics"';
}
/*
* Doors
*/
*[door][door!=no],
*[entrance] {
icon-image: url('door.png');
color: #888888;
opacity: 1;
width: 2;
linecap: none;
dashes: 5,5;
}
/** Passages **/
*[door=no] {
color: #EEEEEE;
fill-color: #EEEEEE;
opacity: 1;
width: 3;
linecap: none;
}
/** Entrance icons **/
*[entrance] {
icon-image: url('entrance_$[entrance].png');
}
/** Sliding door icon **/
*[door=sliding] {
icon-image: url('door_sliding.png');
}
/*
* Vertical passages
*/
/** General definition **/
area[buildingpart=verticalpassage],
area[buildingpart:verticalpassage],
area[room=~/stairs|escalator/],
area[indoor=elevator],
area[highway=~/elevator|lift|steps/],
area[stairs=yes] {
color: #7495DA;
fill-color: #AEBDDA;
opacity: 1;
fill-opacity: 1;
width: 2.5;
z-index: -1;
}
/** Icons **/
*[buildingpart=verticalpassage],
*[buildingpart:verticalpassage],
*[room=~/stairs|escalator/],
*[indoor=elevator],
*[highway=elevator],
*[stairs=yes] {
icon-width: 24;
icon-height: 24;
icon-opacity: 1;
}
*[buildingpart:verticalpassage=elevator],
*[indoor=elevator],
*[highway=~/elevator|lift/] {
icon-image: url('passage_elevator.png');
}
*[buildingpart:verticalpassage=stairway],
*[room=stairs],
*[stairs=yes],
area[highway=steps] {
icon-image: url('passage_stairs.png');
}
*[buildingpart:verticalpassage=escalator],
*[room=escalator],
*[conveying=yes],
area[conveying=~/yes|forward|backward|reversible/] {
icon-image: url('passage_escalator.png');
}
/** Emergency stairs **/
area[buildingpart=verticalpassage][access=emergency],
area[room=stairs][access=emergency],
area[stairs=yes][access=emergency] {
color: #009262;
fill-color: #C0FFCB;
icon-image: url('emergency_stairs.png');
}
/*
* Building delimitation
*/
area[building],
area[building:part=floor],
relation[type=multipolygon][building],
relation[type=multipolygon][building:part=floor] {
fill-color: #D4CACA;
fill-opacity: 1;
z-index: -10;
}
/** Gradins **/
area[building:part=tier],
relation[type=multipolygon][building:part=tier] {
color: #B4ADB3;
opacity: 1;
width: 1;
fill-color: #BABABA;
fill-opacity: 1;
z-index: -4;
}
/****************************************************************************
* Road objects
*/
line[highway] {
color: #F98072;
opacity: 0.2;
}
line[highway=steps] {
color: #F98072;
opacity: 1;
width: 10;
linecap: none;
dashes: 2,1;
z-index: -1;
}
/** Escalator **/
line[conveying=~/yes|forward|backward|reversible/] {
color: #848484;
opacity: 1;
width: 10;
linecap: none;
dashes: 3,1;
}
line[conveying=~/yes|forward|backward|reversible/][highway!=footway] {
icon-image: url('passage_escalator.png');
}
/** Flat escalator **/
line[conveying=~/yes|forward|backward|reversible/][highway=footway] {
dashes: 3,2;
}
/****************************************************************************
* Barriers
*/
*[barrier] {
icon-image: url('barrier_$[barrier].png');
color: #5B5B5B;
opacity: 1;
fill-opacity: 1;
fill-color: #5B5B5B;
width: 2;
linecap: none;
}
@import url('default.mapcss');
meta {
title: 'Details';