Commit 58a77157 authored by Luna Riegel's avatar Luna Riegel
Browse files

Implement object library GUI

parent bcadfe1a
...@@ -5,24 +5,32 @@ ...@@ -5,24 +5,32 @@
<p>Objektbibliothek:</p> <p>Objektbibliothek:</p>
<span>Die Objektbibliothek.</span> <span>Die Objektbibliothek.</span>
</template> </template>
<template #default>
<v-expansion-panels v-for = "(subcats, categoryName) in objLib" :key="categoryName">
<v-expansion-panel title="categoryName">
<v-expansion-panel-title>{{ categoryName }}</v-expansion-panel-title>
<v-container class="py-1 px-1"> <v-container class="py-1 px-1">
<v-row no-gutters> <v-list v-for="(entries, subCategory) in subcats" :key = "subCategory" title="subCategory">
<vcs-list <v-list-item
:items="items" v-for="entry in entries"
:draggable="draggable" :key="entry.title"
:selectable="selectable" class="d-flex align-center"
:single-select="selectSingle" >
:searchable="searchable" <template #prepend>
:show-title="showTitle" <v-avatar size="32">
:icon="titleIconSrc" <img :src="entry.icon" :alt="entry.title" />
:actions="titleActionsArray" </v-avatar>
:title="title" </template>
v-model="selected" <v-list-item-title>{{ entry.title }}</v-list-item-title>
@item-moved="move" </v-list-item>
@item-renamed="({ item, newTitle }) => (item.title = newTitle)" </v-list>
/>
</v-row>
</v-container> </v-container>
</v-expansion-panel>
</v-expansion-panels>
</template>
</VcsFormSection> </VcsFormSection>
<VcsFormSection heading="Objektliste"> <VcsFormSection heading="Objektliste">
<template #help> <template #help>
...@@ -93,7 +101,7 @@ ...@@ -93,7 +101,7 @@
<script> <script>
import { import {
Icons, Icons,
NotificationType, NotificationType, VcsExpansionPanel,
VcsFormButton, VcsFormButton,
VcsFormSection, VcsFormSection,
VcsList, VcsList,
...@@ -102,14 +110,14 @@ import { ...@@ -102,14 +110,14 @@ import {
VcsTreeviewTitle, VcsTreeviewTitle,
} from '@vcmap/ui'; } from '@vcmap/ui';
import {VCard, VCol, VContainer, VDialog, VForm, VRow, VSheet, VSwitch,} from 'vuetify/components'; import {VCard, VCol, VContainer, VDialog, VForm, VRow, VSheet, VSwitch,} from 'vuetify/components';
import {computed, inject, ref} from 'vue'; import {computed, inject, onMounted, ref} from 'vue';
import {name} from '../package.json'; import {name} from '../package.json';
import * as THREE from 'three'; import * as THREE from 'three';
import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js'; import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js';
import {GLTFExporter} from 'three/addons/exporters/GLTFExporter.js'; import {GLTFExporter} from 'three/addons/exporters/GLTFExporter.js';
import {Cartesian2} from '@vcmap-cesium/engine'; import {Cartesian2} from '@vcmap-cesium/engine';
const objLib = {}; const objLib = ref({});
const defaultItems = []; const defaultItems = [];
const items = ref(defaultItems); const items = ref(defaultItems);
...@@ -129,10 +137,10 @@ async function loadCataloguesFromConfig(config) { ...@@ -129,10 +137,10 @@ async function loadCataloguesFromConfig(config) {
const linkPrefix = cat.url.replace(/\/[^/]*catalog\.json$/, '/'); const linkPrefix = cat.url.replace(/\/[^/]*catalog\.json$/, '/');
const entries = getCatalogueEntries(catJson, linkPrefix); const entries = getCatalogueEntries(catJson, linkPrefix);
if (!objLib[category]) { if (!objLib.value[category]) {
objLib[category] = [entries]; objLib.value[category] = entries;
} else { } else {
objLib[category].push(entries); Object.assign(objLib.value[category], entries);
} }
} }
...@@ -304,6 +312,7 @@ function uploadModel() { ...@@ -304,6 +312,7 @@ function uploadModel() {
export default { export default {
name: 'objectList', name: 'objectList',
components: { components: {
VcsExpansionPanel,
VcsTreeview, VcsTreeview,
VcsTreeviewTitle, VcsTreeviewTitle,
VcsList, VcsList,
...@@ -345,7 +354,8 @@ function uploadModel() { ...@@ -345,7 +354,8 @@ function uploadModel() {
const dialog = ref(false); const dialog = ref(false);
setupModelFunction = setupModel; setupModelFunction = setupModel;
projectStateObject = pluginState; projectStateObject = pluginState;
loadCataloguesFromConfig(config).then(response => {console.log(objLib);}); // loadCataloguesFromConfig(config).then(response => {console.log(objLib);});
onMounted(()=>loadCataloguesFromConfig(config).then(response => {console.log(objLib)}));
return { return {
draggable, draggable,
selectable, selectable,
...@@ -360,6 +370,7 @@ function uploadModel() { ...@@ -360,6 +370,7 @@ function uploadModel() {
items, items,
newItem, newItem,
dialog, dialog,
objLib,
required: [ required: [
(v) => !!v || 'Input may not be null', (v) => !!v || 'Input may not be null',
(v) => v.length > 0 || 'Input must have a length', (v) => v.length > 0 || 'Input must have a length',
...@@ -445,6 +456,7 @@ function uploadModel() { ...@@ -445,6 +456,7 @@ function uploadModel() {
saveObjects(); saveObjects();
}, },
}; };
}, },
}; };
</script> </script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment