forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
c916d5fe66
43 changed files with 802 additions and 275 deletions
4
Models/OsmFeature.ts
Normal file
4
Models/OsmFeature.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import {Feature, Geometry} from "@turf/turf";
|
||||
|
||||
export type OsmTags = Record<string, string> & {id: string}
|
||||
export type OsmFeature = Feature<Geometry, OsmTags>
|
|
@ -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;
|
||||
|
|
|
@ -20,7 +20,7 @@ export interface Mapping {
|
|||
readonly ifnot?: TagsFilter,
|
||||
readonly then: TypedTranslation<object>,
|
||||
readonly icon: string,
|
||||
readonly iconClass: string
|
||||
readonly iconClass: string | "small" | "medium" | "large" | "small-height" | "medium-height" | "large-height",
|
||||
readonly hideInAnswer: boolean | TagsFilter
|
||||
readonly addExtraTags: Tag[],
|
||||
readonly searchTerms?: Record<string, string[]>
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue