diff --git a/Customizations/AllKnownLayouts.ts b/Customizations/AllKnownLayouts.ts
index 8d04ef7..54813d9 100644
--- a/Customizations/AllKnownLayouts.ts
+++ b/Customizations/AllKnownLayouts.ts
@@ -38,9 +38,6 @@ export class AllKnownLayouts {
new Smoothness(),
new Groen(),
- /*
- new Toilets(),
- */
];
diff --git a/Customizations/JSON/CustomLayoutFromJSON.ts b/Customizations/JSON/CustomLayoutFromJSON.ts
index 5c69f96..8bc2d15 100644
--- a/Customizations/JSON/CustomLayoutFromJSON.ts
+++ b/Customizations/JSON/CustomLayoutFromJSON.ts
@@ -9,17 +9,18 @@ import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWi
import {UIEventSource} from "../../Logic/UIEventSource";
import {TagDependantUIElementConstructor} from "../UIElementConstructor";
import {Map} from "../Layers/Map";
+import {UIElement} from "../../UI/UIElement";
export interface TagRenderingConfigJson {
// If this key is present, then...
key?: string,
// Use this string to render
- render: string,
+ render?: string | any,
// One of string, int, nat, float, pfloat, email, phone. Default: string
type?: string,
// If it is not known (and no mapping below matches), this question is asked; a textfield is inserted in the rendering above
- question?: string,
+ question?: string | any,
// If a value is added with the textfield, this extra tag is addded. Optional field
addExtraTags?: string | { k: string, v: string }[];
// Extra tags: rendering is only shown/asked if these tags are present
@@ -29,7 +30,7 @@ export interface TagRenderingConfigJson {
mappings?:
{
if: string,
- then: string
+ then: string | any
}[]
}
@@ -43,23 +44,27 @@ export interface LayerConfigJson {
color?: TagRenderingConfigJson;
width?: TagRenderingConfigJson;
overpassTags: string | { k: string, v: string }[];
- wayHandling: number,
- presets: Preset[]
- ,
+ wayHandling?: number,
+ presets: {
+ tags: string,
+ title: string | any,
+ description?: string | any,
+ icon?: string
+ }[],
tagRenderings: TagRenderingConfigJson []
}
export interface LayoutConfigJson {
- widenFactor: number;
+ widenFactor?: number;
name: string;
- title: string;
- description: string;
+ title: string | any;
+ description: string | any;
maintainer: string;
- language: string[];
+ language: string | string[];
layers: LayerConfigJson[],
- startZoom: number;
- startLat: number;
- startLon: number;
+ startZoom: string | number;
+ startLat: string | number;
+ startLon: string | number;
/**
* Either a URL or a base64 encoded value (which should include 'data:image/svg+xml;base64,'
*/
@@ -271,17 +276,19 @@ export class CustomLayoutFromJSON {
public static LayoutFromJSON(json: LayoutConfigJson) {
const t = CustomLayoutFromJSON.MaybeTranslation;
- let languages = json.language;
+ let languages : string[] ;
if(typeof (json.language) === "string"){
languages = [json.language];
+ }else{
+ languages = json.language
}
const layout = new Layout(json.name,
languages,
t(json.title),
json.layers.map(CustomLayoutFromJSON.LayerFromJson),
- json.startZoom,
- json.startLat,
- json.startLon,
+ parseInt(""+json.startZoom),
+ parseFloat(""+json.startLat),
+ parseFloat(""+json.startLon),
new Combine(['
', t(json.title), '
', t(json.description)])
);
layout.icon = json.icon;
diff --git a/Customizations/LayerDefinition.ts b/Customizations/LayerDefinition.ts
index cbe3820..34db35c 100644
--- a/Customizations/LayerDefinition.ts
+++ b/Customizations/LayerDefinition.ts
@@ -3,7 +3,7 @@ import {UIElement} from "../UI/UIElement";
import {TagDependantUIElementConstructor} from "./UIElementConstructor";
import {TagRenderingOptions} from "./TagRenderingOptions";
import Translation from "../UI/i18n/Translation";
-import {LayerConfigJson} from "./JSON/CustomLayoutFromJSON";
+import {LayerConfigJson, TagRenderingConfigJson} from "./JSON/CustomLayoutFromJSON";
export interface Preset {
tags: Tag[],
@@ -128,7 +128,7 @@ export class LayerDefinition {
this.wayHandling = options.wayHandling ?? LayerDefinition.WAYHANDLING_DEFAULT;
}
-
+/*
ToJson() {
function t(translation: string | Translation | UIElement) {
@@ -144,8 +144,16 @@ export class LayerDefinition {
return translation.InnerRender();
}
+ function tr(tagRendering : TagRenderingOptions) : TagRenderingConfigJson{
+ const o = tagRendering.options;
+ return {
+ key: o.freeform.key,
+ render: o.freeform.renderTemplate,
+ type: o.freeform.template.
+ }
+ }
- const layerConfig /* : LayerConfigJson */= {
+ const layerConfig : LayerConfigJson = {
name: t(this.name),
description: t(this.description),
maxAllowedOverlapPercentage: this.maxAllowedOverlapPercentage,
@@ -161,5 +169,5 @@ export class LayerDefinition {
};
return JSON.stringify(layerConfig)
- }
+ }*/
}
\ No newline at end of file
diff --git a/Logic/FilteredLayer.ts b/Logic/FilteredLayer.ts
index 52397b8..34c2603 100644
--- a/Logic/FilteredLayer.ts
+++ b/Logic/FilteredLayer.ts
@@ -227,7 +227,10 @@ export class FilteredLayer {
// We monky-patch the feature element with an update-style
feature.updateStyle = () => {
if (layer.setIcon) {
- layer.setIcon(L.icon(self._style(feature.properties).icon))
+ const icon = self._style(feature.properties).icon;
+ if (icon.iconUrl) {
+ layer.setIcon(L.icon(icon))
+ }
} else {
self._geolayer.setStyle(function (featureX) {
const style = self._style(featureX.properties);
diff --git a/State.ts b/State.ts
index a96bee1..036b8c9 100644
--- a/State.ts
+++ b/State.ts
@@ -24,7 +24,7 @@ export class State {
// The singleton of the global state
public static state: State;
- public static vNumber = "0.0.5h";
+ public static vNumber = "0.0.6";
// The user journey states thresholds when a new feature gets unlocked
public static userJourney = {
diff --git a/UI/CustomThemeGenerator/ThemeGenerator.ts b/UI/CustomThemeGenerator/ThemeGenerator.ts
index 056e375..c80f4c4 100644
--- a/UI/CustomThemeGenerator/ThemeGenerator.ts
+++ b/UI/CustomThemeGenerator/ThemeGenerator.ts
@@ -395,6 +395,18 @@ class LayerGenerator extends UIElement {
});
self.CreateElements(fullConfig, layerConfig);
self.Update();
+ }),
+
+ new Button("Remove this layer", () => {
+ const layers = fullConfig.data.layers;
+ for (let i = 0; i < layers.length; i++) {
+ if(layers[i] === layerConfig){
+ layers.splice(i, 1);
+ break;
+ }
+ }
+ self.Update();
+ pingThemeObject();
})
]
@@ -469,7 +481,7 @@ class AllLayerComponent extends UIElement {
minzoom: 12,
overpassTags: "",
wayHandling: LayerDefinition.WAYHANDLING_CENTER_AND_WAY,
- presets: [{}],
+ presets: [],
tagRenderings: []
});
diff --git a/UI/MoreScreen.ts b/UI/MoreScreen.ts
index a9cc9d0..f2e8d04 100644
--- a/UI/MoreScreen.ts
+++ b/UI/MoreScreen.ts
@@ -6,6 +6,7 @@ import Combine from "./Base/Combine";
import {SubtleButton} from "./Base/SubtleButton";
import {State} from "../State";
import {CustomLayout} from "../Logic/CustomLayers";
+import {VariableUiElement} from "./Base/VariableUIElement";
export class MoreScreen extends UIElement {
@@ -16,10 +17,23 @@ export class MoreScreen extends UIElement {
}
InnerRender(): string {
-
+
const tr = Translations.t.general.morescreen;
const els: UIElement[] = []
+
+ els.push(new VariableUiElement(
+ State.state.osmConnection.userDetails.map(userDetails => {
+ if (userDetails.csCount < State.userJourney.themeGeneratorUnlock) {
+ return tr.requestATheme.Render();
+ }
+ return new SubtleButton("./assets/pencil.svg", tr.createYourOwnTheme, {
+ url: "https://pietervdvn.github.io/MapComplete/customGenerator.html",
+ newTab: false
+ }).Render();
+ })
+ ));
+
for (const k in AllKnownLayouts.allSets) {
const layout = AllKnownLayouts.allSets[k]
if (layout.hideFromOverview && State.state.osmConnection.userDetails.data.name !== "Pieter Vander Vennet") {
@@ -28,6 +42,7 @@ export class MoreScreen extends UIElement {
if (layout.name === State.state.layoutToUse.data.name) {
continue;
}
+
if (layout.name === CustomLayout.NAME) {
if (!State.state.osmConnection.userDetails.data.loggedIn) {
continue;
@@ -60,7 +75,6 @@ export class MoreScreen extends UIElement {
return new VerticalCombine([
tr.intro,
- tr.requestATheme,
new VerticalCombine(els),
tr.streetcomplete
]).Render();
diff --git a/UI/i18n/Translations.ts b/UI/i18n/Translations.ts
index f9f1a60..505d08c 100644
--- a/UI/i18n/Translations.ts
+++ b/UI/i18n/Translations.ts
@@ -901,6 +901,9 @@ export default class Translations {
en: "Another, similar application is StreetComplete",
fr: "Une autre application similaire est StreetComplete",
nl: "Een andere, gelijkaardige Android-applicatie is StreetComplete"
+ }),
+ createYourOwnTheme: new T({
+ en: "Create your own MapComplete theme from scratch"
})
},
readYourMessages: new T({
diff --git a/assets/statue.svg b/assets/statue.svg
new file mode 100644
index 0000000..ddf4019
--- /dev/null
+++ b/assets/statue.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/assets/themes/bookcases/Bookcases.json b/assets/themes/bookcases/Bookcases.json
index 7100f5b..906f296 100644
--- a/assets/themes/bookcases/Bookcases.json
+++ b/assets/themes/bookcases/Bookcases.json
@@ -54,7 +54,8 @@
"title": {
"en": "Bookcase",
"nl": "Boekenruilkast"
- }
+ },
+ "tags": "amenity=public_bookcase"
}
],
"tagRenderings": [