Various fixes

This commit is contained in:
Pieter Vander Vennet 2020-08-22 14:59:52 +02:00
parent 0e4cd630e6
commit 2df565dc50
9 changed files with 76 additions and 12 deletions

View file

@ -39,6 +39,7 @@ export interface LayerConfigJson {
minzoom: number, minzoom: number,
color: TagRenderingConfigJson; color: TagRenderingConfigJson;
overpassTags: string | string[] | { k: string, v: string }[]; overpassTags: string | string[] | { k: string, v: string }[];
wayHandling: number,
presets: [ presets: [
{ {
// icon: optional. Uses the layer icon by default // icon: optional. Uses the layer icon by default
@ -231,7 +232,7 @@ export class CustomLayoutFromJSON {
json.id, json.id,
{ {
description: t(json.description), description: t(json.description),
name: t(json.title), name: t(json.title.render),
icon: icon, icon: icon,
minzoom: json.minzoom, minzoom: json.minzoom,
title: tr(json.title), title: tr(json.title),
@ -241,7 +242,7 @@ export class CustomLayoutFromJSON {
elementsToShow: elementsToShow:
[new ImageCarouselWithUploadConstructor()].concat(json.tagRenderings.map(tr)), [new ImageCarouselWithUploadConstructor()].concat(json.tagRenderings.map(tr)),
overpassFilter: new And(tags), overpassFilter: new And(tags),
wayHandling: LayerDefinition.WAYHANDLING_CENTER_AND_WAY, wayHandling: parseInt(json.wayHandling) ?? LayerDefinition.WAYHANDLING_CENTER_AND_WAY,
maxAllowedOverlapPercentage: 0, maxAllowedOverlapPercentage: 0,
style: CustomLayoutFromJSON.StyleFromJson(json, json.style) style: CustomLayoutFromJSON.StyleFromJson(json, json.style)
} }

View file

@ -59,9 +59,14 @@ export class CustomLayersPanel extends UIElement {
const image = (layer.icon ? `<img src='${layer.icon}'>` : Img.checkmark); const image = (layer.icon ? `<img src='${layer.icon}'>` : Img.checkmark);
const noimage = (layer.icon ? `<img src='${layer.icon}'>` : Img.no_checkmark); const noimage = (layer.icon ? `<img src='${layer.icon}'>` : Img.no_checkmark);
let name = layer.name;
if(typeof (name) !== "string"){
name = name.InnerRender();
}
const content = new Combine([ const content = new Combine([
"<span>", "<span>",
"<b>", layer.name ?? "", "</b> ", "<b>", name ?? "", "</b> ",
layer.description !== undefined ? new Combine(["<br/>", layer.description]) : "", layer.description !== undefined ? new Combine(["<br/>", layer.description]) : "",
"</span>"]) "</span>"])
const cb = new CheckBox( const cb = new CheckBox(

View file

@ -313,11 +313,12 @@ export class OsmConnection {
`<tag k="created_by" v="MapComplete ${State.vNumber}" />`, `<tag k="created_by" v="MapComplete ${State.vNumber}" />`,
`<tag k="comment" v="Adding data with #MapComplete"/>`, `<tag k="comment" v="Adding data with #MapComplete"/>`,
`<tag k="theme" v="${layout.name}"/>`, `<tag k="theme" v="${layout.name}"/>`,
layout.maintainer !== undefined ? `<tag k="theme-creator" v="${layout.maintainer}">` : "", layout.maintainer !== undefined ? `<tag k="theme-creator" v="${layout.maintainer}"/>` : "",
`</changeset></osm>`].join("") `</changeset></osm>`].join("")
}, function (err, response) { }, function (err, response) {
if (response === undefined) { if (response === undefined) {
console.log("err", err); console.log("err", err);
alert("Could not upload change (opening failed). Please file a bug report")
return; return;
} else { } else {
continuation(response); continuation(response);

View file

@ -24,7 +24,7 @@ export class State {
// The singleton of the global state // The singleton of the global state
public static state: State; public static state: State;
public static vNumber = "0.0.5"; public static vNumber = "0.0.5b";
public static runningFromConsole: boolean = false; public static runningFromConsole: boolean = false;

View file

@ -17,6 +17,7 @@ import {TextField, ValidatedTextField} from "../Input/TextField";
import {Tag} from "../../Logic/TagsFilter"; import {Tag} from "../../Logic/TagsFilter";
import {DropDown} from "../Input/DropDown"; import {DropDown} from "../Input/DropDown";
import {TagRendering} from "../../Customizations/TagRendering"; import {TagRendering} from "../../Customizations/TagRendering";
import {LayerDefinition} from "../../Customizations/LayerDefinition";
TagRendering.injectFunction(); TagRendering.injectFunction();
@ -267,9 +268,13 @@ class LayerGenerator extends UIElement {
}), }),
createFieldUI("The tags to load from overpass", "overpassTags", layerConfig, { createFieldUI("The tags to load from overpass", "overpassTags", layerConfig, {
type: "tags", type: "tags",
description: "Tags to load from overpass. The format is <span class='literal-code'>key=value&key0=value0&key1=value1</span>, e.g. <span class='literal-code'>amenity=public_bookcase</span> or <span class='literal-code'>amenity=compressed_air&bicycle=yes</span>. Note that a wildcard is supported, e.g. <span class='literal-code'>key=*</span>" description: "Tags to load from overpass. The format is <span class='literal-code'>key=value&key0=value0&key1=value1</span>, e.g. <span class='literal-code'>amenity=public_bookcase</span> or <span class='literal-code'>amenity=compressed_air&bicycle=yes</span>. Note that a wildcard is supported, e.g. <span class='literal-code'>key=*</span> to have everything. An missing tag can be expressed as <span class='literal-code'>key=</span>, not as <span class='literal-code'>key!=value</span>. E.g. something that is indoor and not private and has no name tag can be queried as <span class='literal-code'>indoor=yes&name=&access!=private</span>"
}), }),
createFieldUI("Wayhandling","wayHandling", layerConfig, {
type:"wayhandling",
description: "Specifies how ways (lines and areas) are handled: either the way is shown, a center point is shown or both"
}),
new TagRenderingGenerator(fullConfig, layerConfig, layerConfig.title ?? { new TagRenderingGenerator(fullConfig, layerConfig, layerConfig.title ?? {
key: "", key: "",
@ -415,6 +420,7 @@ class AllLayerComponent extends UIElement {
description: "", description: "",
minzoom: 12, minzoom: 12,
overpassTags: "", overpassTags: "",
wayHandling: LayerDefinition.WAYHANDLING_CENTER_AND_WAY,
presets: [{}], presets: [{}],
tagRenderings: [] tagRenderings: []
}); });
@ -490,6 +496,22 @@ export class ThemeGenerator extends UIElement {
textField = new DropDown<string>("", textField = new DropDown<string>("",
options, options,
value) value)
} else if (options.type === "wayhandling") {
const options: { value: string, shown: string | UIElement }[] =
[{value: "" + LayerDefinition.WAYHANDLING_DEFAULT, shown: "Show a line/area as line/area"},
{
value: "" + LayerDefinition.WAYHANDLING_CENTER_AND_WAY,
shown: "Show a line/area as line/area AND show an icon at the center"
},
{
value: "" + LayerDefinition.WAYHANDLING_CENTER_ONLY,
shown: "Only show the centerpoint of a way"
}];
textField = new DropDown<string>("",
options,
value)
} else if (options.type === "tags") { } else if (options.type === "tags") {
textField = ValidatedTextField.TagTextField(value.map(CustomLayoutFromJSON.TagsFromJson, [], tags => { textField = ValidatedTextField.TagTextField(value.map(CustomLayoutFromJSON.TagsFromJson, [], tags => {
if (tags === undefined) { if (tags === undefined) {

View file

@ -58,7 +58,7 @@ export class ImageUploadFlow extends UIElement {
} }
if (!State.state.osmConnection.userDetails.data.loggedIn) { if (!State.state.osmConnection.userDetails.data.loggedIn) {
return `<div class='activate-osm-authentication'>${t.pleaseLogin.Render()}</div>`; return t.pleaseLogin.Render();
} }
let currentState: UIElement[] = []; let currentState: UIElement[] = [];
@ -78,7 +78,7 @@ export class ImageUploadFlow extends UIElement {
let currentStateHtml = ""; let currentStateHtml = "";
if (currentState.length > 0) { if (currentState.length > 0) {
currentStateHtml = new VerticalCombine(currentState).Render(); currentStateHtml = new Combine(currentState).Render();
if (!this._allDone.data) { if (!this._allDone.data) {
currentStateHtml = "<span class='alert'>" + currentStateHtml = "<span class='alert'>" +
currentStateHtml + currentStateHtml +

View file

@ -93,12 +93,12 @@ export class ShareScreen extends UIElement {
const switches = [{urlName: "fs-userbadge", human: "Enable the login-button"}, const switches = [{urlName: "fs-userbadge", human: "Enable the login-button"},
{urlName: "fs-search", human: "Enable search bar"}, {urlName: "fs-search", human: "Enable the search bar"},
{urlName: "fs-welcome-message", human: "Enable the welcome message"}, {urlName: "fs-welcome-message", human: "Enable the welcome message"},
{urlName: "fs-layers", human: "Enable layer control"}, {urlName: "fs-layers", human: "Enable thelayer control"},
{urlName: "layer-control-toggle", human: "Start with the layer control expanded", reverse:true},
{urlName: "fs-add-new", human: "Enable the 'add new POI' button"}, {urlName: "fs-add-new", human: "Enable the 'add new POI' button"},
{urlName: "fs-geolocation", human: "Enable the 'geolocate-me' button"}, {urlName: "fs-geolocation", human: "Enable the 'geolocate-me' button"},
{urlName: "layer-control-toggle", human: "Start with the layer control expanded", reverse:true}
] ]

View file

@ -0,0 +1,32 @@
{
"layers": [
{
"id": "Fietsstraat",
"title": {
"render": "{name}",
"key": "name"
},
"icon": {
"key": ""
},
"color": {
"key": "",
"render": "#0000ff"
},
"description": "Een fietsstraat is een straat",
"minzoom": "13",
"presets": [],
"tagRenderings": [],
"overpassTags": "cyclestreet=yes"
}
],
"language": "nl",
"startLat": "51.2095",
"startZoom": "14",
"maintainer": "Not logged in",
"name": "Fietsstraten",
"title": "Fietsstraten",
"startLon": "3.2228",
"icon": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Belgian_road_sign_F111.svg/400px-Belgian_road_sign_F111.svg.png",
"description": "Een fietsstraat is een straat waar automobilisten geen fietsers mogen inhalen en waar een maximumsnelheid van 30km/h geldt. "
}

View file

@ -1155,8 +1155,10 @@ form {
.tab-single-header img { .tab-single-header img {
height: 3em; height: 3em;
width: 3em; max-width: 3em;
padding: 0.5em; padding: 0.5em;
display:block;
margin:auto;
} }
@ -1181,6 +1183,7 @@ form {
z-index: 5001; z-index: 5001;
box-shadow: 0 0 10px black; box-shadow: 0 0 10px black;
border: 1px solid white; border: 1px solid white;
min-width: 4em;
} }
.tab-non-active { .tab-non-active {