Merge branch 'develop' into feature/maproulette

This commit is contained in:
Robin van der Linde 2022-07-12 09:01:18 +00:00 committed by GitHub
commit a1bffc7b7f
14 changed files with 144 additions and 24 deletions

View file

@ -19,7 +19,7 @@ export class AllKnownLayouts {
public static AllPublicLayers(options?: {
includeInlineLayers:true | boolean
}) {
}) : LayerConfig[] {
const allLayers: LayerConfig[] = []
const seendIds = new Set<string>()
AllKnownLayouts.sharedLayers.forEach((layer, key) => {

View file

@ -191,6 +191,9 @@ export default class LayerConfig extends WithContextLoader {
this.doNotDownload = json.doNotDownload ?? false;
this.passAllFeatures = json.passAllFeatures ?? false;
this.minzoom = json.minzoom ?? 0;
if(json["minZoom"] !== undefined){
throw "At "+context+": minzoom is written all lowercase"
}
this.minzoomVisible = json.minzoomVisible ?? this.minzoom;
this.shownByDefault = json.shownByDefault ?? true;
this.forceLoad = json.forceLoad ?? false;

View file

@ -364,7 +364,7 @@ export default class TagRenderingConfig {
* Returns true if it is known or not shown, false if the question should be asked
* @constructor
*/
public IsKnown(tags: any): boolean {
public IsKnown(tags: Record<string, string>): boolean {
if (this.condition &&
!this.condition.matchesProperties(tags)) {
// Filtered away by the condition, so it is kindof known
@ -400,7 +400,7 @@ export default class TagRenderingConfig {
* @param tags
* @constructor
*/
public GetRenderValues(tags: any): { then: Translation, icon?: string, iconClass?: string }[] {
public GetRenderValues(tags: Record<string, string>): { then: Translation, icon?: string, iconClass?: string }[] {
if (!this.multiAnswer) {
return [this.GetRenderValueWithImage(tags)]
}
@ -410,7 +410,7 @@ export default class TagRenderingConfig {
let freeformKeyDefined = this.freeform?.key !== undefined;
let usedFreeformValues = new Set<string>()
// We run over all the mappings first, to check if the mapping matches
const applicableMappings: { then: TypedTranslation<any>, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => {
const applicableMappings: { then: TypedTranslation<Record<string, string>>, img?: string }[] = Utils.NoNull((this.mappings ?? [])?.map(mapping => {
if (mapping.if === undefined) {
return mapping;
}

View file

@ -3,6 +3,9 @@
"name": {
"en": "doctors"
},
"description": {
"en": "This layer shows doctor offices, dentists and other healthcare facilities"
},
"source": {
"osmTags": {
"or": [

View file

@ -4,12 +4,11 @@
"en": "Crossings with rainbow paintings"
},
"description": {
"en": "Crossings with decorative rainbow paintings"
"en": "A layer showing pedestrian crossings with rainbow paintings"
},
"source": {
"osmTags": {
"osmTags":
"highway=crossing"
}
},
"minzoom": 17,
"title": {
@ -35,9 +34,11 @@
"snapToLayer": "cycleways_and_roads",
"maxSnapDistance": 25
}
},
}
],
"tagRenderings": [
{
"images",
{
"id": "crossing-with-rainbow",
"question": {
"en": "Does this crossing has rainbow paintings?"
@ -48,13 +49,26 @@
"if": "crossing:marking=rainbow",
"then": {
"en": "This crossing has rainbow paintings"
},
"icon": {
"path": "./assets/themes/rainbow_crossings/logo.svg",
"class": "medium"
}
},
{
"if": "not:crossing:marking=rainbow",
"then": {
"en": "No rainbow paintings here"
},
"icon": "./assets/themes/rainbow_crossings/crossing.svg"
},
{
"if": "crossing:marking!=rainbow",
"then": {
"en": "No rainbow paintings here"
}
},
"icon": "./assets/themes/rainbow_crossings/crossing.svg",
"hideInAnswer": true
}
]
}
@ -62,16 +76,17 @@
"mapRendering": [
{
"icon": {
"render": "./assets/themes/rainbow_crossings/logo.svg"
"render": "./assets/themes/rainbow_crossings/crossing.svg",
"mappings": [{
"if": "crossing:marking=rainbow",
"then": "./assets/themes/rainbow_crossings/logo.svg"
}]
},
"iconSize": "40,40,bottom",
"iconSize": "40,40,center",
"location": [
"point",
"centroid"
]
}
],
"description": {
"en": "A layer showing pedestrian crossings with rainbow paintings"
}
]
}

View file

@ -9,7 +9,7 @@
"source": {
"osmTags": "highway=street_lamp"
},
"minZoom": 16,
"minzoom": 16,
"title": {
"render": {
"en": "Street Lamp",

View file

@ -38,7 +38,7 @@
{
"builtin": "bicycle_library",
"override": {
"minZoom": 0
"minzoom": 0
}
}
]

View file

@ -283,6 +283,10 @@
"if": "theme=postboxes",
"then": "./assets/themes/postboxes/postbox.svg"
},
{
"if": "theme=rainbow_crossings",
"then": "./assets/themes/rainbow_crossings/logo.svg"
},
{
"if": "theme=shops",
"then": "./assets/themes/shops/shop.svg"

View file

@ -30,7 +30,7 @@
"doctors"
],
"overrideAll" : {
"minZoom" : "15",
"minzoom" : "15",
"mapRendering" : [
{
"label" : null

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 600 600"
version="1.1"
id="svg20"
sodipodi:docname="crossing.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs24" />
<sodipodi:namedview
id="namedview22"
pagecolor="#ffffff"
bordercolor="#111111"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
showgrid="false"
inkscape:zoom="0.75881737"
inkscape:cx="-111.35749"
inkscape:cy="312.32812"
inkscape:window-width="1920"
inkscape:window-height="1007"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg20" />
<rect
style="fill:#959a99;fill-opacity:1;stroke-linecap:round"
id="rect845"
width="602.2915"
height="602.07373"
x="-1.5249536"
y="-1.9649721" />
<rect
x="51.805016"
y="120.82925"
width="100"
height="400"
fill="#ffffff"
stroke-width="2"
stroke="#000000"
id="rect14" />
<rect
x="251.80501"
y="120.82925"
width="100"
height="400"
fill="#ffffff"
stroke-width="2"
stroke="#000000"
id="rect16" />
<rect
x="451.80502"
y="120.82925"
width="100"
height="400"
fill="#ffffff"
stroke-width="2"
stroke="#000000"
id="rect18" />
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,4 +1,12 @@
[
{
"path": "crossing.svg",
"license": "CC0",
"authors": [
"bxl-forever"
],
"sources": []
},
{
"path": "logo.svg",
"license": "CC0",
@ -7,4 +15,4 @@
],
"sources": []
}
]
]

View file

@ -15,7 +15,28 @@
"startZoom": 16,
"widenFactor": 2,
"layers": [
"rainbow_crossings"
{
"builtin": "rainbow_crossings",
"override": {
"minzoom": 10,
"id": "rainbow_crossing_high_zoom",
"name": null,
"=presets": [],
"source": {
"osmTags": {
"and+": ["crossing:marking=rainbow"]
}
}
}
},
"rainbow_crossings",
{
"builtin": "cycleways_and_roads",
"override": {
"minzoom": 18,
"name": null
}
}
]
}

View file

@ -51,7 +51,7 @@
]
}
},
"minZoom": 16,
"minzoom": 16,
"title": {
"render": {
"en": "Lit street",
@ -171,7 +171,7 @@
]
}
},
"minZoom": 19,
"minzoom": 19,
"title": {
"render": {
"en": "Street",

View file

@ -36,7 +36,7 @@
"generate:schemas": "ts2json-schema -p Models/ThemeConfig/Json/ -o Docs/Schemas/ -t tsconfig.json -R . -m \".*ConfigJson\" && ts-node scripts/fixSchemas.ts ",
"generate:service-worker": "tsc service-worker.ts && git_hash=$(git rev-parse HEAD) && sed -i \"s/GITHUB-COMMIT/$git_hash/\" service-worker.js",
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
"reset:layeroverview": "echo {\\\"layers\\\":[], \\\"themes\\\":[]} > ./assets/generated/known_layers_and_themes.json && echo {\\\"layers\\\": []} > ./assets/generated/known_layers.json && rm ./asssets/generated/layers/* && rm ./assets/generated/themes/*",
"reset:layeroverview": "echo {\\\"layers\\\":[], \\\"themes\\\":[]} > ./assets/generated/known_layers_and_themes.json && echo {\\\"layers\\\": []} > ./assets/generated/known_layers.json && rm -f ./asssets/generated/layers/*.json && rm -f ./assets/generated/themes/*.json && npm run generate:layeroverview && ts-node scripts/generateLayerOverview.ts --force",
"generate": "mkdir -p ./assets/generated; npm run reset:layeroverview; npm run generate:images; npm run generate:charging-stations; npm run generate:translations; npm run generate:licenses; npm run generate:layeroverview; npm run generate:service-worker",
"generate:charging-stations": "cd ./assets/layers/charging_station && ts-node csvToJson.ts && cd -",
"prepare-deploy": "npm run generate:service-worker && ./scripts/build.sh",