2023-06-16 02:36:11 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
|
|
|
import EditLayerState from "./EditLayerState";
|
2023-07-28 14:37:51 +02:00
|
|
|
import layerSchemaRaw from "../../../assets/layerconfigmeta.json"
|
2023-06-16 02:36:11 +02:00
|
|
|
import Region from "./Region.svelte";
|
|
|
|
import TabbedGroup from "../Base/TabbedGroup.svelte";
|
|
|
|
import {UIEventSource} from "../../Logic/UIEventSource";
|
|
|
|
import type {ConfigMeta} from "./configMeta";
|
|
|
|
import {Utils} from "../../Utils";
|
|
|
|
|
2023-07-28 14:37:51 +02:00
|
|
|
import drinking_water from "../../../assets/layers/drinking_water/drinking_water.json"
|
2023-06-16 02:36:11 +02:00
|
|
|
|
|
|
|
const layerSchema: ConfigMeta[] = layerSchemaRaw
|
2023-06-18 00:44:57 +02:00
|
|
|
let state = new EditLayerState(layerSchema)
|
2023-06-23 16:14:43 +02:00
|
|
|
state.configuration.setData(drinking_water)
|
|
|
|
/**
|
|
|
|
* Blacklist for the general area tab
|
|
|
|
*/
|
2023-06-23 17:28:44 +02:00
|
|
|
const regionBlacklist = ["hidden",undefined,"infobox", "tagrenderings","maprendering", "editing"]
|
2023-06-23 16:14:43 +02:00
|
|
|
const allNames = Utils.Dedup(layerSchema.map(meta => meta.hints.group))
|
2023-06-16 02:36:11 +02:00
|
|
|
|
|
|
|
const perRegion: Record<string, ConfigMeta[]> = {}
|
2023-06-23 16:14:43 +02:00
|
|
|
for (const region of allNames) {
|
2023-06-16 02:36:11 +02:00
|
|
|
perRegion[region] = layerSchema.filter(meta => meta.hints.group === region)
|
|
|
|
}
|
2023-06-23 16:14:43 +02:00
|
|
|
|
2023-06-23 17:28:44 +02:00
|
|
|
const baselayerRegions: string[] = ["Basic", "presets","filters","advanced","expert"]
|
2023-06-23 16:14:43 +02:00
|
|
|
for (const baselayerRegion of baselayerRegions) {
|
|
|
|
if(perRegion[baselayerRegion] === undefined){
|
|
|
|
console.error("BaseLayerRegions in editLayer: no items have group '"+baselayerRegion+'"')
|
|
|
|
}
|
|
|
|
}
|
2023-06-23 17:28:44 +02:00
|
|
|
const leftoverRegions : string[] = allNames.filter(r => regionBlacklist.indexOf(r) <0 && baselayerRegions.indexOf(r) <0 )
|
2023-06-16 02:36:11 +02:00
|
|
|
</script>
|
|
|
|
|
2023-06-18 00:44:57 +02:00
|
|
|
<h3>Edit layer</h3>
|
2023-06-16 02:36:11 +02:00
|
|
|
|
2023-06-23 16:14:43 +02:00
|
|
|
<div class="m4">
|
|
|
|
{allNames}
|
2023-06-23 17:28:44 +02:00
|
|
|
<TabbedGroup tab={new UIEventSource(1)}>
|
2023-06-16 02:36:11 +02:00
|
|
|
<div slot="title0">General properties</div>
|
|
|
|
<div class="flex flex-col" slot="content0">
|
2023-06-23 16:14:43 +02:00
|
|
|
{#each baselayerRegions as region}
|
|
|
|
<Region {state} configs={perRegion[region]} title={region}/>
|
|
|
|
{/each}
|
2023-06-23 17:28:44 +02:00
|
|
|
|
|
|
|
{#each leftoverRegions as region}
|
2023-06-16 02:36:11 +02:00
|
|
|
<Region {state} configs={perRegion[region]} title={region}/>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div slot="title1">Information panel (questions and answers)</div>
|
|
|
|
<div slot="content1">
|
2023-06-26 10:23:42 +02:00
|
|
|
<Region {state} configs={perRegion["title"]} title="Title"/>
|
2023-06-23 16:14:43 +02:00
|
|
|
<Region {state} configs={perRegion["tagrenderings"]} title="Infobox"/>
|
2023-06-23 17:28:44 +02:00
|
|
|
<Region {state} configs={perRegion["editing"]} title="Other editing elements"/>
|
2023-06-16 02:36:11 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div slot="title2">Rendering on the map</div>
|
|
|
|
<div slot="content2">
|
|
|
|
TODO: rendering on the map
|
|
|
|
</div>
|
|
|
|
</TabbedGroup>
|
2023-06-23 16:14:43 +02:00
|
|
|
|
|
|
|
</div>
|