Fix build

This commit is contained in:
Pieter Vander Vennet 2020-07-31 17:38:03 +02:00
parent b36b103ed3
commit 79f8940898
64 changed files with 277 additions and 249 deletions

View file

@ -1,17 +1,17 @@
import {All} from "./Layouts/All";
import {StreetWidth} from "./Layouts/StreetWidth";
import {LayerDefinition} from "./LayerDefinition"; import {LayerDefinition} from "./LayerDefinition";
import {ClimbingTrees} from "./Layouts/ClimbingTrees"; import {Layout} from "./Layout";
import {Smoothness} from "./Layouts/Smoothness"; import {All} from "./Layouts/All";
import {Natuurpunt} from "./Layouts/Natuurpunt"; import {CustomLayout} from "../Logic/CustomLayers";
import {Groen} from "./Layouts/Groen"; import {Groen} from "./Layouts/Groen";
import Cyclofix from "./Layouts/Cyclofix"; import Cyclofix from "./Layouts/Cyclofix";
import {Layout} from "./Layout"; import {StreetWidth} from "./Layouts/StreetWidth";
import {CustomLayout} from "../Logic/CustomLayers";
import {GRB} from "./Layouts/GRB"; import {GRB} from "./Layouts/GRB";
import {Artworks} from "./Layouts/Artworks"; import {Artworks} from "./Layouts/Artworks";
import {ClimbingTrees} from "./Layouts/ClimbingTrees";
import {WalkByBrussels} from "./Layouts/WalkByBrussels"; import {WalkByBrussels} from "./Layouts/WalkByBrussels";
import {Smoothness} from "./Layouts/Smoothness";
import {MetaMap} from "./Layouts/MetaMap"; import {MetaMap} from "./Layouts/MetaMap";
import {Natuurpunt} from "./Layouts/Natuurpunt";
import {Bookcases} from "./Layouts/Bookcases"; import {Bookcases} from "./Layouts/Bookcases";
export class AllKnownLayouts { export class AllKnownLayouts {
@ -31,7 +31,8 @@ export class AllKnownLayouts {
new ClimbingTrees(), new ClimbingTrees(),
new Artworks(), new Artworks(),
new Smoothness(), new Smoothness(),
/*new Toilets(), /*
new Toilets(),
*/ */
]; ];

View file

@ -1,7 +1,7 @@
import {Tag, TagsFilter} from "../Logic/TagsFilter"; import {Tag, TagsFilter} from "../Logic/TagsFilter";
import {UIElement} from "../UI/UIElement"; import {UIElement} from "../UI/UIElement";
import {TagRenderingOptions} from "./TagRendering";
import {TagDependantUIElementConstructor} from "./UIElementConstructor"; import {TagDependantUIElementConstructor} from "./UIElementConstructor";
import {TagRenderingOptions} from "./TagRenderingOptions";
export interface Preset { export interface Preset {
tags: Tag[], tags: Tag[],

View file

@ -3,9 +3,9 @@ import {Tag} from "../../Logic/TagsFilter";
import L from "leaflet"; import L from "leaflet";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRendering";
import Website from "../Questions/Website"; import Website from "../Questions/Website";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class Artwork extends LayerDefinition { export class Artwork extends LayerDefinition {

View file

@ -9,9 +9,9 @@ import ShopRepair from "../Questions/bike/ShopRepair";
import ShopDiy from "../Questions/bike/ShopDiy"; import ShopDiy from "../Questions/bike/ShopDiy";
import ShopName from "../Questions/bike/ShopName"; import ShopName from "../Questions/bike/ShopName";
import ShopSecondHand from "../Questions/bike/ShopSecondHand"; import ShopSecondHand from "../Questions/bike/ShopSecondHand";
import { TagRenderingOptions } from "../TagRendering";
import { PhoneNumberQuestion } from "../Questions/PhoneNumberQuestion"; import { PhoneNumberQuestion } from "../Questions/PhoneNumberQuestion";
import Website from "../Questions/Website"; import Website from "../Questions/Website";
import {TagRenderingOptions} from "../TagRenderingOptions";
export default class BikeOtherShops extends LayerDefinition { export default class BikeOtherShops extends LayerDefinition {

View file

@ -10,10 +10,10 @@ import ShopRepair from "../Questions/bike/ShopRepair";
import ShopDiy from "../Questions/bike/ShopDiy"; import ShopDiy from "../Questions/bike/ShopDiy";
import ShopName from "../Questions/bike/ShopName"; import ShopName from "../Questions/bike/ShopName";
import ShopSecondHand from "../Questions/bike/ShopSecondHand"; import ShopSecondHand from "../Questions/bike/ShopSecondHand";
import { TagRenderingOptions } from "../TagRendering";
import {PhoneNumberQuestion} from "../Questions/PhoneNumberQuestion"; import {PhoneNumberQuestion} from "../Questions/PhoneNumberQuestion";
import Website from "../Questions/Website"; import Website from "../Questions/Website";
import {EmailQuestion} from "../Questions/EmailQuestion"; import {EmailQuestion} from "../Questions/EmailQuestion";
import {TagRenderingOptions} from "../TagRenderingOptions";
export default class BikeShops extends LayerDefinition { export default class BikeShops extends LayerDefinition {

View file

@ -12,7 +12,7 @@ import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWi
import PumpOperational from "../Questions/bike/PumpOperational"; import PumpOperational from "../Questions/bike/PumpOperational";
import PumpValves from "../Questions/bike/PumpValves"; import PumpValves from "../Questions/bike/PumpValves";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import { TagRenderingOptions } from "../TagRendering"; import {TagRenderingOptions} from "../TagRenderingOptions";
export default class BikeStations extends LayerDefinition { export default class BikeStations extends LayerDefinition {

View file

@ -1,8 +1,8 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {And, Or, Tag} from "../../Logic/TagsFilter"; import {And, Or, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRendering";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class Birdhide extends LayerDefinition { export class Birdhide extends LayerDefinition {

View file

@ -1,10 +1,10 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {And, Or, Tag} from "../../Logic/TagsFilter"; import {And, Or, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRendering";
import {NameInline} from "../Questions/NameInline"; import {NameInline} from "../Questions/NameInline";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import T from "../../UI/i18n/Translation"; import T from "../../UI/i18n/Translation";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class Bookcases extends LayerDefinition { export class Bookcases extends LayerDefinition {

View file

@ -3,9 +3,9 @@ import {And, Or, Tag} from "../../Logic/TagsFilter";
import {OperatorTag} from "../Questions/OperatorTag"; import {OperatorTag} from "../Questions/OperatorTag";
import * as L from "leaflet"; import * as L from "leaflet";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {TagRenderingOptions} from "../TagRendering";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class DrinkingWater extends LayerDefinition { export class DrinkingWater extends LayerDefinition {

View file

@ -1,10 +1,10 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {Tag} from "../../Logic/TagsFilter"; import {Tag} from "../../Logic/TagsFilter";
import {FixedUiElement} from "../../UI/Base/FixedUiElement"; import {FixedUiElement} from "../../UI/Base/FixedUiElement";
import {TagRenderingOptions} from "../TagRendering";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import L from "leaflet"; import L from "leaflet";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class GhostBike extends LayerDefinition { export class GhostBike extends LayerDefinition {
constructor() { constructor() {

View file

@ -1,6 +1,6 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {And, Regex, Tag} from "../../Logic/TagsFilter"; import {And, Regex, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRenderingOptions";
export class GrbToFix extends LayerDefinition { export class GrbToFix extends LayerDefinition {

View file

@ -1,8 +1,8 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRendering";
import {And, Tag} from "../../Logic/TagsFilter"; import {And, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class InformationBoard extends LayerDefinition { export class InformationBoard extends LayerDefinition {
constructor() { constructor() {

View file

@ -1,8 +1,8 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRendering";
import {And, Tag} from "../../Logic/TagsFilter"; import {And, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class Map extends LayerDefinition { export class Map extends LayerDefinition {
constructor() { constructor() {

View file

@ -1,15 +1,15 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {Or, Tag} from "../../Logic/TagsFilter"; import {Or, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRendering";
import {AccessTag} from "../Questions/AccessTag"; import {AccessTag} from "../Questions/AccessTag";
import {OperatorTag} from "../Questions/OperatorTag"; import {OperatorTag} from "../Questions/OperatorTag";
import {NameQuestion} from "../Questions/NameQuestion"; import {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline"; import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion"; import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class NatureReserves extends LayerDefinition { export class NatureReserves extends LayerDefinition {
constructor(moreQuests: boolean = false) { constructor(moreQuests: boolean = false) {
super("natureReserve"); super("natureReserve");
this.name = "Natuurgebied"; this.name = "Natuurgebied";
@ -30,13 +30,6 @@ export class NatureReserves extends LayerDefinition {
this.style = this.generateStyleFunction(); this.style = this.generateStyleFunction();
this.elementsToShow = [ this.elementsToShow = [
new ImageCarouselWithUploadConstructor(), new ImageCarouselWithUploadConstructor(),
/* new TagRenderingOptions({
freeform: {
key: "_surface",
renderTemplate: "{_surface}m²",
template: "$$$"
}
}),*/
new NameQuestion(), new NameQuestion(),
new AccessTag(), new AccessTag(),
new OperatorTag(), new OperatorTag(),
@ -111,9 +104,9 @@ export class NatureReserves extends LayerDefinition {
return function (properties: any) { return function (properties: any) {
let questionSeverity = 0; let questionSeverity = 0;
for (const qd of self.elementsToShow) { for (const qd of self.elementsToShow) {
if(qd instanceof DescriptionQuestion){ //if(qd instanceof DescriptionQuestion){
continue; // continue;
} //}
if (qd.IsQuestioning(properties)) { if (qd.IsQuestioning(properties)) {
questionSeverity = Math.max(questionSeverity, qd.Priority() ?? 0); questionSeverity = Math.max(questionSeverity, qd.Priority() ?? 0);
} }

View file

@ -2,11 +2,11 @@ import {LayerDefinition} from "../LayerDefinition";
import {And, Or, Tag} from "../../Logic/TagsFilter"; import {And, Or, Tag} from "../../Logic/TagsFilter";
import {AccessTag} from "../Questions/AccessTag"; import {AccessTag} from "../Questions/AccessTag";
import {OperatorTag} from "../Questions/OperatorTag"; import {OperatorTag} from "../Questions/OperatorTag";
import {TagRenderingOptions} from "../TagRendering";
import {NameQuestion} from "../Questions/NameQuestion"; import {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline"; import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion"; import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class Park extends LayerDefinition { export class Park extends LayerDefinition {

View file

@ -3,7 +3,7 @@ import {FixedUiElement} from "../../UI/Base/FixedUiElement";
import FixedText from "../Questions/FixedText"; import FixedText from "../Questions/FixedText";
import {Tag} from "../../Logic/TagsFilter"; import {Tag} from "../../Logic/TagsFilter";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload"; import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRenderingOptions";
export class Viewpoint extends LayerDefinition { export class Viewpoint extends LayerDefinition {

View file

@ -1,8 +1,8 @@
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {And, Not, Or, Tag} from "../../Logic/TagsFilter"; import {And, Not, Or, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRendering";
import {UIEventSource} from "../../UI/UIEventSource"; import {UIEventSource} from "../../UI/UIEventSource";
import {Park} from "./Park"; import {Park} from "./Park";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class Widths extends LayerDefinition { export class Widths extends LayerDefinition {

View file

@ -1,13 +1,13 @@
import {Layout} from "../Layout"; import {Layout} from "../Layout";
import {LayerDefinition} from "../LayerDefinition"; import {LayerDefinition} from "../LayerDefinition";
import {Or, Tag} from "../../Logic/TagsFilter"; import {Or, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRenderingOptions";
export class SmoothnessLayer extends LayerDefinition { export class SmoothnessLayer extends LayerDefinition {
constructor() { constructor() {
super(); super("smoothness");
this.name = "smoothness"; this.name = "smoothness";
this.minzoom = 17; this.minzoom = 17;
this.overpassFilter = new Or([ this.overpassFilter = new Or([

View file

@ -1,7 +1,7 @@
import {TagRenderingOptions} from "../TagRendering";
import {UIEventSource} from "../../UI/UIEventSource"; import {UIEventSource} from "../../UI/UIEventSource";
import {Changes} from "../../Logic/Osm/Changes"; import {Changes} from "../../Logic/Osm/Changes";
import {And, Tag} from "../../Logic/TagsFilter"; import {And, Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class AccessTag extends TagRenderingOptions { export class AccessTag extends TagRenderingOptions {

View file

@ -1,4 +1,4 @@
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRenderingOptions";
export class DescriptionQuestion extends TagRenderingOptions{ export class DescriptionQuestion extends TagRenderingOptions{

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../TagRendering";
import {UIElement} from "../../UI/UIElement"; import {UIElement} from "../../UI/UIElement";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class EmailQuestion extends TagRenderingOptions { export class EmailQuestion extends TagRenderingOptions {

View file

@ -1,5 +1,5 @@
import { TagRenderingOptions } from "../TagRendering";
import {UIElement} from "../../UI/UIElement"; import {UIElement} from "../../UI/UIElement";
import {TagRenderingOptions} from "../TagRenderingOptions";
export default class FixedText extends TagRenderingOptions { export default class FixedText extends TagRenderingOptions {
constructor(category: string | UIElement) { constructor(category: string | UIElement) {

View file

@ -1,7 +1,7 @@
import {TagRenderingOptions} from "../TagRendering";
import {And, Tag} from "../../Logic/TagsFilter"; import {And, Tag} from "../../Logic/TagsFilter";
import {UIElement} from "../../UI/UIElement"; import {UIElement} from "../../UI/UIElement";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class NameInline extends TagRenderingOptions{ export class NameInline extends TagRenderingOptions{

View file

@ -3,8 +3,8 @@
* One is a big 'name-question', the other is the 'edit name' in the title. * One is a big 'name-question', the other is the 'edit name' in the title.
* THis one is the big question * THis one is the big question
*/ */
import {TagRenderingOptions} from "../TagRendering";
import {Tag} from "../../Logic/TagsFilter"; import {Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class NameQuestion extends TagRenderingOptions{ export class NameQuestion extends TagRenderingOptions{

View file

@ -1,7 +1,7 @@
import {TagRenderingOptions} from "../TagRendering";
import {UIEventSource} from "../../UI/UIEventSource"; import {UIEventSource} from "../../UI/UIEventSource";
import {Changes} from "../../Logic/Osm/Changes"; import {Changes} from "../../Logic/Osm/Changes";
import {Tag} from "../../Logic/TagsFilter"; import {Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class OperatorTag extends TagRenderingOptions { export class OperatorTag extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../TagRendering";
import {Img} from "../../UI/Img"; import {Img} from "../../UI/Img";
import {Tag} from "../../Logic/TagsFilter"; import {Tag} from "../../Logic/TagsFilter";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class OsmLink extends TagRenderingOptions { export class OsmLink extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../TagRendering";
import {UIElement} from "../../UI/UIElement"; import {UIElement} from "../../UI/UIElement";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRenderingOptions";
export class PhoneNumberQuestion extends TagRenderingOptions { export class PhoneNumberQuestion extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../TagRendering";
import {UIElement} from "../../UI/UIElement"; import {UIElement} from "../../UI/UIElement";
import Translations from "../../UI/i18n/Translations"; import Translations from "../../UI/i18n/Translations";
import {TagRenderingOptions} from "../TagRenderingOptions";
export default class Website extends TagRenderingOptions { export default class Website extends TagRenderingOptions {

View file

@ -1,4 +1,4 @@
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRenderingOptions";
export class WikipediaLink extends TagRenderingOptions { export class WikipediaLink extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class CafeDiy extends TagRenderingOptions { export default class CafeDiy extends TagRenderingOptions {

View file

@ -1,5 +1,5 @@
import {TagRenderingOptions} from "../../TagRendering";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class CafeName extends TagRenderingOptions { export default class CafeName extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class CafePump extends TagRenderingOptions { export default class CafePump extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class CafeRepair extends TagRenderingOptions { export default class CafeRepair extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import { TagRenderingOptions } from "../../TagRendering";
import { Tag } from "../../../Logic/TagsFilter"; import { Tag } from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ParkingAccessCargo extends TagRenderingOptions { export default class ParkingAccessCargo extends TagRenderingOptions {

View file

@ -1,5 +1,5 @@
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import { TagRenderingOptions } from "../../TagRendering"; import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ParkingCapacity extends TagRenderingOptions { export default class ParkingCapacity extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import { TagRenderingOptions } from "../../TagRendering";
import Combine from "../../../UI/Base/Combine"; import Combine from "../../../UI/Base/Combine";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ParkingCapacityCargo extends TagRenderingOptions { export default class ParkingCapacityCargo extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import { TagRenderingOptions } from "../../TagRendering";
import { Tag } from "../../../Logic/TagsFilter"; import { Tag } from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ParkingCovered extends TagRenderingOptions { export default class ParkingCovered extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag, And} from "../../../Logic/TagsFilter"; import {Tag, And} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ParkingOperator extends TagRenderingOptions { export default class ParkingOperator extends TagRenderingOptions {

View file

@ -1,7 +1,7 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import Combine from "../../../UI/Base/Combine"; import Combine from "../../../UI/Base/Combine";
import {TagRenderingOptions} from "../../TagRenderingOptions";
class ParkingTypeHelper { class ParkingTypeHelper {
static GenerateMappings() { static GenerateMappings() {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class PumpManometer extends TagRenderingOptions { export default class PumpManometer extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class PumpManual extends TagRenderingOptions { export default class PumpManual extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class PumpOperational extends TagRenderingOptions { export default class PumpOperational extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class PumpValves extends TagRenderingOptions{ export default class PumpValves extends TagRenderingOptions{

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopDiy extends TagRenderingOptions { export default class ShopDiy extends TagRenderingOptions {

View file

@ -1,5 +1,5 @@
import {TagRenderingOptions} from "../../TagRendering";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopPump extends TagRenderingOptions { export default class ShopPump extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopPump extends TagRenderingOptions { export default class ShopPump extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopRental extends TagRenderingOptions { export default class ShopRental extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopRepair extends TagRenderingOptions { export default class ShopRepair extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopRetail extends TagRenderingOptions { export default class ShopRetail extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class ShopPump extends TagRenderingOptions { export default class ShopPump extends TagRenderingOptions {

View file

@ -1,5 +1,5 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import {TagRenderingOptions} from "../../TagRenderingOptions";
/** /**

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class StationChain extends TagRenderingOptions { export default class StationChain extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class BikeStationOperator extends TagRenderingOptions { export default class BikeStationOperator extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag, And} from "../../../Logic/TagsFilter"; import {Tag, And} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class BikeStationPumpTools extends TagRenderingOptions { export default class BikeStationPumpTools extends TagRenderingOptions {

View file

@ -1,6 +1,6 @@
import {TagRenderingOptions} from "../../TagRendering";
import {Tag} from "../../../Logic/TagsFilter"; import {Tag} from "../../../Logic/TagsFilter";
import Translations from "../../../UI/i18n/Translations"; import Translations from "../../../UI/i18n/Translations";
import {TagRenderingOptions} from "../../TagRenderingOptions";
export default class BikeStationStand extends TagRenderingOptions { export default class BikeStationStand extends TagRenderingOptions {

View file

@ -3,11 +3,8 @@ import {UIEventSource} from "../UI/UIEventSource";
import {And, Tag, TagsFilter, TagUtils} from "../Logic/TagsFilter"; import {And, Tag, TagsFilter, TagUtils} from "../Logic/TagsFilter";
import {FixedUiElement} from "../UI/Base/FixedUiElement"; import {FixedUiElement} from "../UI/Base/FixedUiElement";
import {SaveButton} from "../UI/SaveButton"; import {SaveButton} from "../UI/SaveButton";
import {Changes} from "../Logic/Osm/Changes";
import {VariableUiElement} from "../UI/Base/VariableUIElement"; import {VariableUiElement} from "../UI/Base/VariableUIElement";
import {Dependencies, TagDependantUIElement, TagDependantUIElementConstructor} from "./UIElementConstructor"; import {TagDependantUIElement} from "./UIElementConstructor";
import {OnlyShowIfConstructor} from "./OnlyShowIf";
import {UserDetails} from "../Logic/Osm/OsmConnection";
import {TextField} from "../UI/Input/TextField"; import {TextField} from "../UI/Input/TextField";
import {InputElement} from "../UI/Input/InputElement"; import {InputElement} from "../UI/Input/InputElement";
import {InputElementWrapper} from "../UI/Input/InputElementWrapper"; import {InputElementWrapper} from "../UI/Input/InputElementWrapper";
@ -15,151 +12,11 @@ import {FixedInputElement} from "../UI/Input/FixedInputElement";
import {RadioButton} from "../UI/Input/RadioButton"; import {RadioButton} from "../UI/Input/RadioButton";
import Translations from "../UI/i18n/Translations"; import Translations from "../UI/i18n/Translations";
import Locale from "../UI/i18n/Locale"; import Locale from "../UI/i18n/Locale";
import * as EmailValidator from 'email-validator';
import {parsePhoneNumberFromString} from 'libphonenumber-js'
import {State} from "../State"; import {State} from "../State";
import {TagRenderingOptions} from "./TagRenderingOptions";
export class TagRenderingOptions implements TagDependantUIElementConstructor { export class TagRendering extends UIElement implements TagDependantUIElement {
public static inputValidation = {
"$": (str) => true,
"string": (str) => true,
"int": (str) => str.indexOf(".") < 0 && !isNaN(Number(str)),
"nat": (str) => str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) > 0,
"float": (str) => !isNaN(Number(str)),
"pfloat": (str) => !isNaN(Number(str)) && Number(str) > 0,
"email": (str) => EmailValidator.validate(str),
"phone": (str, country) => {
return parsePhoneNumberFromString(str, country.toUpperCase())?.isValid() ?? false;
},
}
public static formatting = {
"phone": (str, country) => {
console.log("country formatting", country)
return parsePhoneNumberFromString(str, country.toUpperCase()).formatInternational()
}
}
/**
* Notes: by not giving a 'question', one disables the question form alltogether
*/
public options: {
priority?: number;
question?: string | UIElement;
freeform?: {
key: string;
tagsPreprocessor?: (tags: any) => any;
template: string | UIElement;
renderTemplate: string | UIElement;
placeholder?: string | UIElement;
extraTags?: TagsFilter
};
mappings?: { k: TagsFilter; txt: string | UIElement; priority?: number, substitute?: boolean }[]
};
constructor(options: {
/**
* This is the string that is shown in the popup if this tag is missing.
*
* If 'question' is undefined, then the question is never asked at all
* If the question is "" (empty string) then the question is
*/
question?: UIElement | string,
/**
* What is the priority of the question.
* By default, in the popup of a feature, only one question is shown at the same time. If multiple questions are unanswered, the question with the highest priority is asked first
*/
priority?: number,
/**
* Mappings convert a well-known tag combination into a user friendly text.
* It converts e.g. 'access=yes' into 'this area can be accessed'
*
* If there are multiple tags that should be matched, And can be used. All tags in AND will be added when the question is picked (and the corresponding text will only be shown if all tags are present).
* If AND is used, it is best practice to make sure every used tag is in every option (with empty string) to erase extra tags.
*
* If a 'k' is null, then this one is shown by default. It can be used to force a default value, e.g. to show that the name of a POI is not (yet) known .
* A mapping where 'k' is null will not be shown as option in the radio buttons.
*
*
*/
mappings?: { k: TagsFilter, txt: UIElement | string, priority?: number, substitute?: boolean }[],
/**
* If one wants to render a freeform tag (thus no predefined key/values) or if there are a few well-known tags with a freeform object,
* use this.
* In the question, it'll offer a textfield
*/
freeform?: {
key: string,
template: string | UIElement,
renderTemplate: string | UIElement
placeholder?: string | UIElement,
extraTags?: TagsFilter,
},
/**
* In some very rare cases, tags have to be rewritten before displaying
* This function can be used for that.
* This function is ran on a _copy_ of the original properties
*/
tagsPreprocessor?: ((tags: any) => void)
}) {
this.options = options;
}
OnlyShowIf(tagsFilter: TagsFilter): TagDependantUIElementConstructor {
return new OnlyShowIfConstructor(tagsFilter, this);
}
IsQuestioning(tags: any): boolean {
const tagsKV = TagUtils.proprtiesToKV(tags);
for (const oneOnOneElement of this.options.mappings ?? []) {
if (oneOnOneElement.k === null || oneOnOneElement.k.matches(tagsKV)) {
return false;
}
}
if (this.options.freeform !== undefined && tags[this.options.freeform.key] !== undefined) {
return false;
}
if (this.options.question === undefined) {
return false;
}
return true;
}
construct(dependencies: Dependencies): TagDependantUIElement {
return new TagRendering(dependencies.tags, this.options);
}
IsKnown(properties: any): boolean {
return !this.IsQuestioning(properties);
}
Priority(): number {
return this.options.priority ?? 0;
}
}
class TagRendering extends UIElement implements TagDependantUIElement {
private _priority: number; private _priority: number;
@ -189,13 +46,20 @@ class TagRendering extends UIElement implements TagDependantUIElement {
private readonly _editMode: UIEventSource<boolean> = new UIEventSource<boolean>(false); private readonly _editMode: UIEventSource<boolean> = new UIEventSource<boolean>(false);
private static injected = TagRendering.injectFunction();
static injectFunction() {
// This is a workaround as not to import tagrendering into TagREnderingOptions
TagRenderingOptions.tagRendering = (tags, options) => new TagRendering(tags, options);
return true;
}
constructor(tags: UIEventSource<any>, options: { constructor(tags: UIEventSource<any>, options: {
priority?: number priority?: number
question?: string | UIElement, question?: string | UIElement,
freeform?: { freeform?: {
key: string, key: string,
template: string | UIElement, template: string | UIElement,
renderTemplate: string | UIElement, renderTemplate: string | UIElement,
placeholder?: string | UIElement, placeholder?: string | UIElement,

View file

@ -0,0 +1,146 @@
import {Dependencies, TagDependantUIElement, TagDependantUIElementConstructor} from "./UIElementConstructor";
import * as EmailValidator from "email-validator";
import {parsePhoneNumberFromString} from "libphonenumber-js";
import {UIElement} from "../UI/UIElement";
import {TagsFilter, TagUtils} from "../Logic/TagsFilter";
import {OnlyShowIfConstructor} from "./OnlyShowIf";
import {UIEventSource} from "../UI/UIEventSource";
export class TagRenderingOptions implements TagDependantUIElementConstructor {
public static inputValidation = {
"$": (str) => true,
"string": (str) => true,
"int": (str) => str.indexOf(".") < 0 && !isNaN(Number(str)),
"nat": (str) => str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) > 0,
"float": (str) => !isNaN(Number(str)),
"pfloat": (str) => !isNaN(Number(str)) && Number(str) > 0,
"email": (str) => EmailValidator.validate(str),
"phone": (str, country) => {
return parsePhoneNumberFromString(str, country.toUpperCase())?.isValid() ?? false;
},
}
public static formatting = {
"phone": (str, country) => {
console.log("country formatting", country)
return parsePhoneNumberFromString(str, country.toUpperCase()).formatInternational()
}
}
/**
* Notes: by not giving a 'question', one disables the question form alltogether
*/
public options: {
priority?: number;
question?: string | UIElement;
freeform?: {
key: string;
tagsPreprocessor?: (tags: any) => any;
template: string | UIElement;
renderTemplate: string | UIElement;
placeholder?: string | UIElement;
extraTags?: TagsFilter
};
mappings?: { k: TagsFilter; txt: string | UIElement; priority?: number, substitute?: boolean }[]
};
constructor(options: {
/**
* This is the string that is shown in the popup if this tag is missing.
*
* If 'question' is undefined, then the question is never asked at all
* If the question is "" (empty string) then the question is
*/
question?: UIElement | string,
/**
* What is the priority of the question.
* By default, in the popup of a feature, only one question is shown at the same time. If multiple questions are unanswered, the question with the highest priority is asked first
*/
priority?: number,
/**
* Mappings convert a well-known tag combination into a user friendly text.
* It converts e.g. 'access=yes' into 'this area can be accessed'
*
* If there are multiple tags that should be matched, And can be used. All tags in AND will be added when the question is picked (and the corresponding text will only be shown if all tags are present).
* If AND is used, it is best practice to make sure every used tag is in every option (with empty string) to erase extra tags.
*
* If a 'k' is null, then this one is shown by default. It can be used to force a default value, e.g. to show that the name of a POI is not (yet) known .
* A mapping where 'k' is null will not be shown as option in the radio buttons.
*
*
*/
mappings?: { k: TagsFilter, txt: UIElement | string, priority?: number, substitute?: boolean }[],
/**
* If one wants to render a freeform tag (thus no predefined key/values) or if there are a few well-known tags with a freeform object,
* use this.
* In the question, it'll offer a textfield
*/
freeform?: {
key: string,
template: string | UIElement,
renderTemplate: string | UIElement
placeholder?: string | UIElement,
extraTags?: TagsFilter,
},
/**
* In some very rare cases, tags have to be rewritten before displaying
* This function can be used for that.
* This function is ran on a _copy_ of the original properties
*/
tagsPreprocessor?: ((tags: any) => void)
}) {
this.options = options;
}
OnlyShowIf(tagsFilter: TagsFilter): TagDependantUIElementConstructor {
return new OnlyShowIfConstructor(tagsFilter, this);
}
IsQuestioning(tags: any): boolean {
const tagsKV = TagUtils.proprtiesToKV(tags);
for (const oneOnOneElement of this.options.mappings ?? []) {
if (oneOnOneElement.k === null || oneOnOneElement.k.matches(tagsKV)) {
return false;
}
}
if (this.options.freeform !== undefined && tags[this.options.freeform.key] !== undefined) {
return false;
}
if (this.options.question === undefined) {
return false;
}
return true;
}
public static tagRendering : (tags: UIEventSource<any>, options: { priority?: number; question?: string | UIElement; freeform?: { key: string; tagsPreprocessor?: (tags: any) => any; template: string | UIElement; renderTemplate: string | UIElement; placeholder?: string | UIElement; extraTags?: TagsFilter }; mappings?: { k: TagsFilter; txt: string | UIElement; priority?: number; substitute?: boolean }[] }) => TagDependantUIElement;
construct(dependencies: Dependencies): TagDependantUIElement {
return TagRenderingOptions.tagRendering(dependencies.tags, this.options);
}
IsKnown(properties: any): boolean {
return !this.IsQuestioning(properties);
}
Priority(): number {
return this.options.priority ?? 0;
}
}

View file

@ -1,5 +1,4 @@
import {UIEventSource} from "../UI/UIEventSource"; import {UIEventSource} from "../UI/UIEventSource";
import {Changes} from "../Logic/Osm/Changes";
import {UIElement} from "../UI/UIElement"; import {UIElement} from "../UI/UIElement";

View file

@ -24,6 +24,8 @@ import {LayerSelection} from "./UI/LayerSelection";
import {CustomLayersPanel} from "./Logic/CustomLayersPanel"; import {CustomLayersPanel} from "./Logic/CustomLayersPanel";
import {CustomLayout} from "./Logic/CustomLayers"; import {CustomLayout} from "./Logic/CustomLayers";
import {Preset} from "./Customizations/LayerDefinition"; import {Preset} from "./Customizations/LayerDefinition";
import {VariableUiElement} from "./UI/Base/VariableUIElement";
import {LayerUpdater} from "./Logic/LayerUpdater";
export class InitUiElements { export class InitUiElements {
@ -123,6 +125,26 @@ export class InitUiElements {
}); });
} }
static InitBaseMap(){
State.state.bm = new Basemap("leafletDiv", State.state.locationControl, new VariableUiElement(
State.state.locationControl.map((location) => {
const mapComplete = "<a href='https://github.com/pietervdvn/MapComplete' target='_blank'>Mapcomple</a> " +
" " +
"<a href='https://github.com/pietervdvn/MapComplete/issues' target='_blank'><img src='./assets/bug.svg' alt='Report bug' class='small-userbadge-icon'></a>";
let editHere = "";
if (location !== undefined) {
editHere = " | " +
"<a href='https://www.openstreetmap.org/edit?editor=id#map=" + location.zoom + "/" + location.lat + "/" + location.lon + "' target='_blank'>" +
"<img src='./assets/pencil.svg' alt='edit here' class='small-userbadge-icon'>" +
"</a>"
}
return mapComplete + editHere;
})
));
State.state.layerUpdater = new LayerUpdater(State.state);
}
static InitLayers() { static InitLayers() {

View file

@ -7,7 +7,6 @@ import {Utils} from "./Utils";
import {LayerDefinition, Preset} from "./Customizations/LayerDefinition"; import {LayerDefinition, Preset} from "./Customizations/LayerDefinition";
import {ElementStorage} from "./Logic/ElementStorage"; import {ElementStorage} from "./Logic/ElementStorage";
import {Changes} from "./Logic/Osm/Changes"; import {Changes} from "./Logic/Osm/Changes";
import {Basemap} from "./Logic/Leaflet/Basemap";
import {OsmConnection} from "./Logic/Osm/OsmConnection"; import {OsmConnection} from "./Logic/Osm/OsmConnection";
import Locale from "./UI/i18n/Locale"; import Locale from "./UI/i18n/Locale";
import {VariableUiElement} from "./UI/Base/VariableUIElement"; import {VariableUiElement} from "./UI/Base/VariableUIElement";
@ -43,7 +42,7 @@ export class State {
/** /**
THe basemap with leaflet instance THe basemap with leaflet instance
*/ */
public bm: Basemap; public bm;
/** /**
The user crednetials The user crednetials
*/ */
@ -188,23 +187,7 @@ export class State {
return; return;
} }
this.bm = new Basemap("leafletDiv", this.locationControl, new VariableUiElement(
this.locationControl.map((location) => {
const mapComplete = "<a href='https://github.com/pietervdvn/MapComplete' target='_blank'>Mapcomple</a> " +
" " +
"<a href='https://github.com/pietervdvn/MapComplete/issues' target='_blank'><img src='./assets/bug.svg' alt='Report bug' class='small-userbadge-icon'></a>";
let editHere = "";
if (location !== undefined) {
editHere = " | " +
"<a href='https://www.openstreetmap.org/edit?editor=id#map=" + location.zoom + "/" + location.lat + "/" + location.lon + "' target='_blank'>" +
"<img src='./assets/pencil.svg' alt='edit here' class='small-userbadge-icon'>" +
"</a>"
}
return mapComplete + editHere;
})
));
this.layerUpdater = new LayerUpdater(this);
} }

View file

@ -2,7 +2,6 @@ import {UIElement} from "./UIElement";
import {UIEventSource} from "./UIEventSource"; import {UIEventSource} from "./UIEventSource";
import {ImageCarousel} from "./Image/ImageCarousel"; import {ImageCarousel} from "./Image/ImageCarousel";
import {VerticalCombine} from "./Base/VerticalCombine"; import {VerticalCombine} from "./Base/VerticalCombine";
import {TagRenderingOptions} from "../Customizations/TagRendering";
import {OsmLink} from "../Customizations/Questions/OsmLink"; import {OsmLink} from "../Customizations/Questions/OsmLink";
import {WikipediaLink} from "../Customizations/Questions/WikipediaLink"; import {WikipediaLink} from "../Customizations/Questions/WikipediaLink";
import {And} from "../Logic/TagsFilter"; import {And} from "../Logic/TagsFilter";
@ -12,6 +11,7 @@ import {Changes} from "../Logic/Osm/Changes";
import {UserDetails} from "../Logic/Osm/OsmConnection"; import {UserDetails} from "../Logic/Osm/OsmConnection";
import {FixedUiElement} from "./Base/FixedUiElement"; import {FixedUiElement} from "./Base/FixedUiElement";
import {State} from "../State"; import {State} from "../State";
import {TagRenderingOptions} from "../Customizations/TagRenderingOptions";
export class FeatureInfoBox extends UIElement { export class FeatureInfoBox extends UIElement {

View file

@ -956,7 +956,7 @@ export default class Translations {
}) })
}, },
favourite: { favourite: {
title: "Custom", title: new T({en: "Custom"}),
description: new T({ description: new T({
en: "<h3>Your custom theme</h3>In your custom theme, you can add some favourite layers from other themes to create a custom theme." en: "<h3>Your custom theme</h3>In your custom theme, you can add some favourite layers from other themes to create a custom theme."
}), }),
@ -982,6 +982,8 @@ export default class Translations {
const item = queue.pop(); const item = queue.pop();
if (item instanceof Translation || item.translations !== undefined) { if (item instanceof Translation || item.translations !== undefined) {
tr.push(item); tr.push(item);
} else if (typeof (item) === "string") {
console.warn("Got single string in translationgs file: ", item);
} else { } else {
for (const t in item) { for (const t in item) {
const x = item[t]; const x = item[t];

View file

@ -1,5 +1,6 @@
import {UIElement} from "./UI/UIElement"; import {UIElement} from "./UI/UIElement";
UIElement.runningFromConsole = true; UIElement.runningFromConsole = true;
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts"; import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
import {Layout} from "./Customizations/Layout"; import {Layout} from "./Customizations/Layout";
import {readFileSync, writeFile, writeFileSync} from "fs"; import {readFileSync, writeFile, writeFileSync} from "fs";
@ -7,7 +8,22 @@ import svg2img from 'promise-svg2img';
import Translation from "./UI/i18n/Translation"; import Translation from "./UI/i18n/Translation";
import Locale from "./UI/i18n/Locale"; import Locale from "./UI/i18n/Locale";
import Translations from "./UI/i18n/Translations"; import Translations from "./UI/i18n/Translations";
import {LayerDefinition} from "./Customizations/LayerDefinition";
import {All} from "./Customizations/Layouts/All";
import {StreetWidth} from "./Customizations/Layouts/StreetWidth";
import {LayerDefinition} from"./Customizations/LayerDefinition";
import {ClimbingTrees} from "./Customizations/Layouts/ClimbingTrees";
import {Smoothness} from "./Customizations/Layouts/Smoothness";
import {Natuurpunt} from "./Customizations/Layouts/Natuurpunt";
import {Groen} from "./Customizations/Layouts/Groen";
import Cyclofix from "./Customizations/Layouts/Cyclofix";
import {CustomLayout} from "./Logic/CustomLayers";
import {GRB} from "./Customizations/Layouts/GRB";
import {Artworks} from "./Customizations/Layouts/Artworks";
import {WalkByBrussels} from "./Customizations/Layouts/WalkByBrussels";
import {MetaMap} from "./Customizations/Layouts/MetaMap";
import {Bookcases} from "./Customizations/Layouts/Bookcases";
console.log("Building the layouts") console.log("Building the layouts")
@ -16,7 +32,7 @@ function enc(str: string): string {
} }
function validate(layout: Layout) { function validate(layout: Layout) {
console.log("Validationg ", layout.name)
const translations: Translation[] = []; const translations: Translation[] = [];
const queue: any[] = [layout] const queue: any[] = [layout]
@ -162,7 +178,6 @@ function createLandingPage(layout: Layout) {
const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap"] const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap"]
const all = AllKnownLayouts.allSets; const all = AllKnownLayouts.allSets;
/*
for (const layoutName in all) { for (const layoutName in all) {
if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) { if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) {
console.log(`Skipping a layout with name${layoutName}, it is on the blacklist`); console.log(`Skipping a layout with name${layoutName}, it is on the blacklist`);
@ -175,15 +190,17 @@ for (const layoutName in all) {
}; };
const layout = all[layoutName]; const layout = all[layoutName];
validate(layout) validate(layout)
console.log("Generating manifest")
const manif = JSON.stringify(createManifest(layout, "/MapComplete")); const manif = JSON.stringify(createManifest(layout, "/MapComplete"));
const manifestLocation = encodeURIComponent(layout.name.toLowerCase()) + ".webmanifest"; const manifestLocation = encodeURIComponent(layout.name.toLowerCase()) + ".webmanifest";
writeFile(manifestLocation, manif, err); writeFile(manifestLocation, manif, err);
const landing = createLandingPage(layout); const landing = createLandingPage(layout);
console.log("Generating html-file for ",layout.name)
writeFile(enc(layout.name) + ".html", landing, err) writeFile(enc(layout.name) + ".html", landing, err)
console.log("done")
} }
console.log("COunting all translations")
Translations.CountTranslations(); Translations.CountTranslations();
console.log("All done!")
*/

View file

@ -71,6 +71,7 @@ if (layoutToUse === undefined) {
console.log("Using layout: ", layoutToUse.name); console.log("Using layout: ", layoutToUse.name);
State.state = new State(layoutToUse); State.state = new State(layoutToUse);
InitUiElements.InitBaseMap();
function setupAllLayerElements() { function setupAllLayerElements() {