Merge benches theme

This commit is contained in:
Pieter Vander Vennet 2020-10-23 14:01:30 +02:00
commit 546fa1179a
6 changed files with 299 additions and 17 deletions

View file

@ -14,6 +14,7 @@ import * as maps from "../assets/themes/maps/maps.json"
import * as shops from "../assets/themes/shops/shops.json"
import * as bike_monitoring_stations from "../assets/themes/bike_monitoring_station/bike_monitoring_stations.json"
import * as fritures from "../assets/themes/fritures/fritures.json"
import * as benches from "../assets/themes/benches/benches.json";
import {PersonalLayout} from "../Logic/PersonalLayout";
import {StreetWidth} from "./StreetWidth/StreetWidth";
@ -68,6 +69,7 @@ export class AllKnownLayouts {
FromJSON.LayoutFromJSON(cyclestreets),
FromJSON.LayoutFromJSON(maps),
FromJSON.LayoutFromJSON(fritures),
FromJSON.LayoutFromJSON(benches),
AllKnownLayouts.GenerateBuurtNatuur(),
AllKnownLayouts.GenerateBikeMonitoringStations(),

View file

@ -83,11 +83,9 @@ To develop:
0. Make a fork and clone the repository.
1. Install `npm`. Linux: `sudo apt install npm` (or your favourite package manager), windows: install nodeJS: https://nodejs.org/en/download/
1. Install `npm`. Linux: `sudo apt install npm` (or your favourite package manager), Windows: install nodeJS: https://nodejs.org/en/download/
2. Run `npm install` to install the dependencies
3. Download the editor layer index: `cd assets/ && wget https://osmlab.github.io/editor-layer-index/imagery.geojson --output-document=editor-layer-index.json`
3. Run `npm run start` to build and host a local testversion
3. Run `npm run start` to host a local testversion at http://localhost:1234/index.html
4. By default, the 'bookcases'-theme is loaded. In order to load another theme, use `layout=themename` or `userlayout=true#<layout configuration>`. Note that the custom URLs (e.g. `bookcases.html`, `aed.html`, ...) _don't_ exist on the development version. (These are automatically generated from a template on the server).
To deploy:
@ -104,7 +102,7 @@ Help to translate mapcomplete.
A theme has translations into the preset.json (`assets/themes/themename/themename.json`). To add a translation:
1. Modify `"language"` to contain the new language, e.g. `"language": "nl"` becomes `"language": ["nl", "en"]`
2. Add extra strings to the texts. If it used to be a single-language theme, one can replace the strings, e.g.: `"description":"Welcome to Open Bookcase Map"` to `"description": {"en":"Welcome to Open Bookcase Map", "nl": "Welkom bij de OpenBoekenruilkastenKaart", "fr": "Bienvenue sûr la carte des petites bibliotheques"}`. If the correct language is not found, it'll fallback to antoher supported language.
2. Add extra strings to the texts. If it used to be a single-language theme, one can replace the strings, e.g.: `"description": "Welcome to Open Bookcase Map"` to `"description": {"en": "Welcome to Open Bookcase Map", "nl": "Welkom bij de OpenBoekenruilkastenKaart", "fr": "Bienvenue sûr la carte des petites bibliotheques"}`. If the correct language is not found, it'll fallback to another supported language.
3. If you notice missing translations in the core of MapComplete, fork this project, open [the file containing all translations](https://github.com/pietervdvn/MapComplete/blob/master/UI/i18n/Translations.ts), add add a language string there
4. Send a pull request to update the languages, I'll gladly add it! It doesn't have to be a complete translation from the start ;)
@ -114,19 +112,19 @@ Did you make an awesome theme that you want to share with the OpenStreetMap comm
In order to include your theme:
0) Make sure the theme has an english version. This makes it easier for me to understand what is going on. The more other languages, the better of course!
0) Make sure the theme has an English version. This makes it easier for me to understand what is going on. The more other languages, the better of course!
1) Fork this repository
2) Go to `assets/themes` and create a new directory `yourtheme`
3) Create a new file `yourtheme.json`, paste the theme configuration in there. You can find your theme configuration in the customThemeBuilder (the tab with the Floppy)
4) Copy all the images in this new directory: external assets can suddenly break and leak privacy
3) Create a new file `yourtheme.json`, paste the theme configuration in there. You can find your theme configuration in the customThemeBuilder (the tab with the *Floppy disk* icon)
4) Copy all the images into this new directory: external assets can suddenly break and leak privacy
- Make sure the license is suitable, preferable a Creative Commons license. Attribution can be added at the bottom of this document
- If an SVG-version is available, use the SVG-version
- Make sure all the links in `yourtheme.json` are updated. You can use `"./assets/themes/yourtheme/yourimage.svg" instead of the HTML link
- If an SVG version is available, use the SVG version
- Make sure all the links in `yourtheme.json` are updated. You can use `./assets/themes/yourtheme/yourimage.svg` instead of the HTML link
5) Add your theme to the code base:
- Open [AllKnownLayouts.ts](https://github.com/pietervdvn/MapComplete/blob/master/Customizations/AllKnownLayouts.ts)
- Add an import statatement, e.g. `import * as fritures from "../assets/themes/yourtheme/yourthemes.json"
- Add your theme to the `LayoutList`, by adding a line `FromJSON.LayoutFromJSON(maps)`
6) Test your theme: run the project as described above
- Add an import statatement, e.g. `import * as yourtheme from "../assets/themes/yourtheme/yourthemes.json";`
- Add your theme to the `LayoutList`, by adding a line `FromJSON.LayoutFromJSON(yourtheme)`
6) Test your theme: run the project as described [above](#Dev)
7) Happy with your theme? Time to open a Pull Request!
8) Thanks a lot for improving MapComplete!
@ -201,7 +199,6 @@ Bicycle logo, Scott de Jonge
Nature Reserve icon via http://www.onlinewebfonts.com/icon/389579, CC BY 3.0 (@ Эдуард Черных)
Park icon via http://www.onlinewebfonts.com/icon/425974, CC BY 3.0 (@sterankofrank)
Forest icon via https://www.onlinewebfonts.com/icon/498112, CC BY
@ -213,3 +210,5 @@ https://commons.wikimedia.org/w/index.php?title=Antu_chronometer
Fries icon:
https://www.flaticon.com/free-icon/french-fries_1144288
Bench icons from StreetComplete: https://github.com/westnordost/StreetComplete/tree/v25.0-beta1/res/graphics/quest%20icons, GPLv3.0

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<path d="m128 64c0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64 35.346 0 64 28.654 64 64" fill="#9bbe55" stroke-width=".2"/>
<path d="m20.021 39.998c-2.2408 0-4.0449 1.8041-4.0449 4.0449v15.91c0 2.2408 1.8042 4.045 4.0449 4.045h11.955v8h-16v8h16v16h8v-16h48v16h8v-16h16v-8h-16v-8h11.955c2.2408 0 4.0449-1.8042 4.0449-4.045v-15.91c0-2.2408-1.8041-4.0449-4.0449-4.0449zm19.955 24h48v8h-48z" fill-opacity=".2" style="paint-order:normal"/>
<g transform="translate(717 144)">
<path d="m-685.02-84.002h8v32h-8z" fill="#666" style="paint-order:normal"/>
<path d="m-629.02-84.002h8v32h-8z" fill="#666" style="paint-order:normal"/>
<path d="m-696.98-108h87.911c2.2408 0 4.0447 1.804 4.0447 4.0447v15.911c0 2.2408-1.804 4.0447-4.0447 4.0447h-87.911c-2.2408 0-4.0447-1.8039-4.0447-4.0447v-15.911c0-2.2408 1.804-4.0447 4.0447-4.0447z" fill="#ae8862" style="paint-order:normal"/>
<path d="m-693.02-104h80v4h-80z" fill="#896847" style="paint-order:normal"/>
<path d="m-701.02-72.002h96v4h-96z" fill="#896847" style="paint-order:normal"/>
<path d="m-693.02-92.002h80v4h-80z" fill="#896847" style="paint-order:normal"/>
<path d="m-677.02-96.002a4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4 4 4 0 0 1 4 4" fill="#666" style="paint-order:normal"/>
<path d="m-621.02-96.002a4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4 4 4 0 0 1 4 4" fill="#666" style="paint-order:normal"/>
<path d="m-701.02-76.002h96v4h-96z" fill="#ae8862" style="paint-order:normal"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<path d="m128 64c0 35.346-28.654 64-64 64-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64 35.346 0 64 28.654 64 64" fill="#529add" stroke-width=".19997"/>
<path d="m20.021 39.998c-2.2408 0-4.0449 1.8041-4.0449 4.0449v15.91c0 2.2408 1.8042 4.045 4.0449 4.045h11.955v8h-16v8h16v16h8v-16h48v16h8v-16h16v-8h-16v-8h11.955c2.2408 0 4.0449-1.8042 4.0449-4.045v-15.91c0-2.2408-1.8041-4.0449-4.0449-4.0449zm19.955 24h48v8h-48z" fill-opacity=".2" style="paint-order:normal"/>
<g transform="translate(717 144)">
<path d="m-685.02-84.002h8v32h-8z" fill="#666" style="paint-order:normal"/>
<path d="m-629.02-84.002h8v32h-8z" fill="#666" style="paint-order:normal"/>
<path d="m-696.98-108h87.911c2.2408 0 4.0447 1.804 4.0447 4.0447v15.911c0 2.2408-1.804 4.0447-4.0447 4.0447h-87.911c-2.2408 0-4.0447-1.8039-4.0447-4.0447v-15.911c0-2.2408 1.804-4.0447 4.0447-4.0447z" fill="#ae8862" style="paint-order:normal"/>
<path d="m-693.02-104h80v4h-80z" fill="#896847" style="paint-order:normal"/>
<path d="m-701.02-72.002h96v4h-96z" fill="#896847" style="paint-order:normal"/>
<path d="m-693.02-92.002h80v4h-80z" fill="#896847" style="paint-order:normal"/>
<path d="m-677.02-96.002a4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4 4 4 0 0 1 4 4" fill="#666" style="paint-order:normal"/>
<path d="m-621.02-96.002a4 4 0 0 1-4 4 4 4 0 0 1-4-4 4 4 0 0 1 4-4 4 4 0 0 1 4 4" fill="#666" style="paint-order:normal"/>
<path d="m-701.02-76.002h96v4h-96z" fill="#ae8862" style="paint-order:normal"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,248 @@
{
"id": "benches",
"title": {
"en": "Benches",
"de": "Sitzbänke"
},
"shortDescription": {
"en": "A map of benches",
"de": "Eine Karte aller Sitzbänke"
},
"description": {
"en": "This map shows all benches that are recorded in OpenStreetMap: Individual benches, and benches belonging to public transport stops or shelters. With an OpenStreetMap account, you can map new benches or edit details of existing benches.",
"de": "Diese Karte zeigt alle Sitzbänke, die in OpenStreetMap eingetragen sind: Einzeln stehende Bänke und Bänke, die zu Haltestellen oder Unterständen gehören. Mit einem OpenStreetMap-Account können Sie neue Bänke eintragen oder Detailinformationen existierender Bänke bearbeiten."
},
"language": [
"en",
"de"
],
"maintainer": "Florian Edelmann",
"icon": "./assets/themes/benches/bench_poi.svg",
"version": "2020-10-23",
"startLat": 0,
"startLon": 0,
"startZoom": 12,
"widenFactor": 0.05,
"socialImage": "",
"layers": [
{
"id": "amenity=bench",
"name": {
"en": "Benches",
"de": "Sitzbänke"
},
"minzoom": 14,
"overpassTags": {
"and": [
"amenity=bench"
]
},
"title": {
"render": {
"en": "Bench",
"de": "Sitzbank"
},
"mappings": []
},
"description": {},
"tagRenderings": [
{
"render": {
"en": "Backrest",
"de": "Rückenlehne"
},
"freeform": {
"key": "backrest",
"addExtraTags": []
},
"mappings": [
{
"if": {
"and": [
"backrest=yes"
]
},
"then": {
"en": "Backrest: Yes",
"de": "Rückenlehne: Ja"
}
},
{
"if": {
"and": [
"backrest=no"
]
},
"then": {
"en": "Backrest: No",
"de": "Rückenlehne: Nein"
}
}
],
"question": {
"en": "Does this bench have a backrest?",
"de": "Hat diese Bank eine Rückenlehne?"
}
},
{
"render": {
"en": "{seats} seats",
"de": "{seats} Sitzplätze"
},
"freeform": {
"key": "seats",
"type": "nat"
},
"mappings": [],
"question": {
"en": "How many seats does this bench have?",
"de": "Wie viele Sitzplätze hat diese Bank?"
}
},
{
"render": {
"en": "Material: {material}",
"de": "Material: {material}"
},
"freeform": {
"key": "material",
"addExtraTags": []
},
"question": {
"en": "What is the bench (seating) made from?",
"de": "Aus welchem Material besteht die Sitzbank (Sitzfläche)?"
}
},
{
"render": {
"en": "Color: {colour}",
"de": "Farbe: {colour}"
},
"question": {
"en": "Which color does this bench have?",
"de": "Welche Farbe hat diese Sitzbank?"
},
"freeform": {
"key": "colour"
}
}
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
"render": "./assets/themes/benches/bench_poi.svg",
"mappings": []
},
"width": {
"render": "8"
},
"iconSize": {
"render": "20,20,center"
},
"color": {
"render": "#00f"
},
"presets": [
{
"tags": [
"amenity=bench"
],
"title": {
"en": "Bench",
"de": "Sitzbank"
},
"description": {
"en": "Add a new bench",
"de": "Neue Sitzbank eintragen"
}
}
]
},
{
"id": "bench=yes",
"name": {
"en": "Benches at public transport stops",
"de": "Sitzbänke bei Haltestellen"
},
"minzoom": 14,
"overpassTags": {
"or": [
"bench=yes",
"bench=stand_up_bench"
]
},
"title": {
"render": {
"en": "Bench",
"de": "Sitzbank"
},
"mappings": [
{
"if": {
"or": [
"public_transport=platform",
"railway=platform",
"highway=bus_stop"
]
},
"then": {
"en": "Bench at public transport stop",
"de": "Sitzbank bei Haltestelle"
}
},
{
"if": {
"and": [
"amenity=shelter"
]
},
"then": {
"en": "Bench in shelter",
"de": "Sitzbank in Unterstand"
}
}
]
},
"description": {},
"tagRenderings": [
{
"render": {
"en": "{name}",
"de": "{name}"
},
"freeform": {
"key": "name"
}
},
{
"render": {
"en": "Stand up bench",
"de": "Stehbank"
},
"freeform": {
"key": "bench",
"addExtraTags": []
},
"condition": {
"and": [
"bench=stand_up_bench"
]
}
}
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
"render": "./assets/themes/benches/bench_public_transport.svg"
},
"width": {
"render": "8"
},
"iconSize": {
"render": "20,20,center"
},
"color": {
"render": "#00f"
}
}
],
"roamingRenderings": []
}