mapcomplete/LayerDefinition.ts

47 lines
1.5 KiB
TypeScript
Raw Normal View History

2020-06-24 00:35:19 +02:00
import {Basemap} from "./Logic/Basemap";
import {ElementStorage} from "./Logic/ElementStorage";
import {Changes} from "./Logic/Changes";
2020-06-29 03:12:44 +02:00
import {QuestionDefinition} from "./Logic/Question";
import {TagMappingOptions} from "./UI/TagMapping";
2020-06-24 00:35:19 +02:00
import {UIEventSource} from "./UI/UIEventSource";
import {UIElement} from "./UI/UIElement";
import {Tag, TagsFilter} from "./Logic/TagsFilter";
import {FilteredLayer} from "./Logic/FilteredLayer";
import {UserDetails} from "./Logic/OsmConnection";
2020-06-24 00:35:19 +02:00
export class LayerDefinition {
name: string;
newElementTags: Tag[]
icon: string;
minzoom: number;
overpassFilter: TagsFilter;
elementsToShow: (TagMappingOptions | QuestionDefinition | UIElement)[];
questions: QuestionDefinition[]; // Questions are shown below elementsToShow in a questionPicker
style: (tags: any) => any;
2020-06-28 23:33:48 +02:00
/**
* If an object of the next layer is contained for this many percent in this feature, it is eaten and not shown
*/
maxAllowedOverlapPercentage: number = undefined;
2020-06-24 00:35:19 +02:00
2020-06-29 16:21:36 +02:00
asLayer(basemap: Basemap, allElements: ElementStorage, changes: Changes, userDetails: UIEventSource<UserDetails>, selectedElement: UIEventSource<any>,
showOnPopup:UIEventSource<(() => UIElement)>):
2020-06-24 00:35:19 +02:00
FilteredLayer {
return new FilteredLayer(
this.name,
basemap, allElements, changes,
this.overpassFilter,
2020-06-28 23:33:48 +02:00
this.maxAllowedOverlapPercentage,
this.style,
2020-06-29 16:21:36 +02:00
selectedElement,
showOnPopup);
2020-06-24 00:35:19 +02:00
}
}