Commit 12fb48eb authored by Matthias Betz's avatar Matthias Betz
Browse files

platzieren mit geolocation

parent 3e7044fb
This diff is collapsed.
This diff is collapsed.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</VcsLabel> </VcsLabel>
</v-col> </v-col>
<v-col> <v-col>
<VcsTextField id="fileInput" type="file" v-model="state.files" /> <VcsTextField id="fileInput" type="file" @change="onFileSelected" />
</v-col> </v-col>
</v-row> </v-row>
<v-row no-gutters class="justify-center"> <v-row no-gutters class="justify-center">
...@@ -39,9 +39,15 @@ import { ...@@ -39,9 +39,15 @@ import {
import { VContainer, VRow, VForm, VCol } from 'vuetify/components'; import { VContainer, VRow, VForm, VCol } from 'vuetify/components';
import { name } from '../package.json'; import { name } from '../package.json';
import ConverterStatus from "./converterStatus.vue"; import ConverterStatus from "./converterStatus.vue";
import {loadModel} from "./objectList.vue";
export const bimOptionsId = 'upload_ifc_id'; export const bimOptionsId = 'upload_ifc_id';
const errorMessage = "Ein Fehler ist beim konvertieren aufgetreten, die Konvertierung unterstützt " +
"Dateien im IFC Format IFC2x3 und IFC4 Add2 TC1. Bitte stellen Sie sicher, dass die Datei " +
"die korrekte Version hat und nicht korrupt ist. Falls dies der Fall ist dann ist ein " +
"unbekannter Fehler beim Konvertieren aufgetreten, der nicht behoben werden konnte."
export default { export default {
name: 'IFC Konvertierung', name: 'IFC Konvertierung',
components: { components: {
...@@ -65,19 +71,22 @@ export default { ...@@ -65,19 +71,22 @@ export default {
const app = inject('vcsApp'); const app = inject('vcsApp');
const { pluginState, config } = app.plugins.getByKey(name); const { pluginState, config } = app.plugins.getByKey(name);
const disable = ref(false); const disable = ref(false);
const onFileSelected = (event) => {
pluginState.file = event.target.files[0];
}
return { return {
closeSelf() { closeSelf() {
emit('close'); emit('close');
}, },
onFileSelected,
convert() { convert() {
const fileInput = document.getElementById("fileInput");
const fd = new FormData(); const fd = new FormData();
fd.append('file', pluginState.files); fd.append('file', pluginState.file);
const req = fetch(config.convertLink, { const req = fetch(config.convertLink, {
method: 'post', method: 'post',
body: fd /* or aFile[0]*/ body: fd /* or aFile[0]*/
}); // returns a promise }); // returns a promise
let filename = pluginState.files.name.replace(/\.[^/.]+$/, "") + ".glb"; let filename = pluginState.file.name.replace(/\.[^/.]+$/, "") + ".glb";
disable.value = true; disable.value = true;
const convertBtn = document.getElementById("convertBtn"); const convertBtn = document.getElementById("convertBtn");
convertBtn.innerHTML = " Konvertierung läuft "; convertBtn.innerHTML = " Konvertierung läuft ";
...@@ -86,6 +95,11 @@ export default { ...@@ -86,6 +95,11 @@ export default {
disable.value = false; disable.value = false;
convertBtn.innerHTML = " Konvertieren "; convertBtn.innerHTML = " Konvertieren ";
emit('close'); emit('close');
const geolocationString = res.headers.get('X-geolocation');
if (geolocationString) {
const geolocation = JSON.parse(geolocationString);
pluginState.geolocations[filename] = geolocation;
}
if (res.ok) { if (res.ok) {
// status code was 200-299 // status code was 200-299
app.notifier.add({ app.notifier.add({
...@@ -97,20 +111,14 @@ export default { ...@@ -97,20 +111,14 @@ export default {
} else { } else {
app.notifier.add({ app.notifier.add({
type: NotificationType.ERROR, type: NotificationType.ERROR,
message: "Ein Fehler ist beim konvertieren aufgetreten, die Konvertierung unterstützt " + message: errorMessage,
"Dateien im IFC Format IFC2x3 und IFC4 Add2 TC1. Bitte stellen Sie sicher, dass die Datei " +
"die korrekte Version hat und nicht korrupt ist. Falls dies der Fall ist dann ist ein " +
"unbekannter Fehler beim Konvertieren aufgetreten, der nicht behoben werden konnte.",
}); });
} }
}, function (error) { }, function (error) {
app.notifier.add({ app.notifier.add({
type: NotificationType.ERROR, type: NotificationType.ERROR,
message: "Ein Fehler ist beim konvertieren aufgetreten, die Konvertierung unterstützt " + message: errorMessage,
"Dateien im IFC Format IFC2x3 und IFC4 Add2 TC1. Bitte stellen Sie sicher, dass die Datei " +
"die korrekte Version hat und nicht korrupt ist. Falls dies der Fall ist dann ist ein " +
"unbekannter Fehler beim Konvertieren aufgetreten, der nicht behoben werden konnte.",
}); });
}).then((blob) => { }).then((blob) => {
if (blob != null) { if (blob != null) {
...@@ -121,6 +129,7 @@ export default { ...@@ -121,6 +129,7 @@ export default {
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
loadModel(url, filename);
} }
}) })
}, },
......
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