mapcomplete/Customizations/JSON/SourceConfig.ts

35 lines
916 B
TypeScript
Raw Normal View History

2021-03-29 00:41:53 +02:00
import {TagsFilter} from "../../Logic/Tags/TagsFilter";
export default class SourceConfig {
osmTags?: TagsFilter;
overpassScript?: string;
geojsonSource?: string;
geojsonZoomLevel?: number;
constructor(params: {
osmTags?: TagsFilter,
overpassScript?: string,
geojsonSource?: string,
geojsonSourceLevel?: number
}) {
let defined = 0;
if (params.osmTags) {
defined++;
}
if (params.overpassScript) {
defined++;
}
if (params.geojsonSource) {
defined++;
}
if (defined == 0) {
throw "Source: nothing correct defined in the source"
}
this.osmTags = params.osmTags;
this.overpassScript = params.overpassScript;
this.geojsonSource = params.geojsonSource;
this.geojsonZoomLevel = params.geojsonSourceLevel;
}
}