Commit a0d59dee authored by Luna Riegel's avatar Luna Riegel
Browse files

Make loading continue with missing objects

Loading a placement file now continues even if some of the referenced
objects have not been uploaded.
parent c8ae5ff2
......@@ -353,6 +353,7 @@ export default function smartVillagesPlugin(config, baseUrl) {
const content = readerEvent.target.result;
const objects = JSON.parse(content);
const vcMap = app.maps.activeMap;
let missingModels = [];
for (const loadingObject of objects.placedObjects) {
let objectUrl;
for (const loadedObject of pluginState.objects) {
......@@ -378,12 +379,9 @@ export default function smartVillagesPlugin(config, baseUrl) {
objectUrl = model.url;
}
}else {
app.notifier.add({
type: NotificationType.ERROR,
message: "Objekt mit dem namen: " + loadingObject.name + " konnte nicht in den geladenen Objekten gefunden werden. Konfiguration konnte nicht vollständig geladen werden.",
});
// abort
return;
missingModels.push(loadingObject.name);
// go to next model
continue;
}
}
const cartPos = Cartesian3.fromDegrees(loadingObject.position[0], loadingObject.position[1], loadingObject.position[2]);
......@@ -408,7 +406,18 @@ export default function smartVillagesPlugin(config, baseUrl) {
name: loadingObject.name,
});
}
if (missingModels.length > 0) {
let objects = '';
for (const objectName of missingModels) {
objects += ' ' + objectName + ',';
}
objects = objects.substring(1, objects.length-1);
app.notifier.add({
type: NotificationType.ERROR,
message: "Konfiguration konnte nicht vollständig geladen werden. Folgende Modelle fehlen in der Objektliste:" + objects,
});
window.alert("Konfiguration konnte nicht vollständig geladen werden. Folgende Modelle fehlen in der Objektliste: \n" + objects);
}
for (const objectToHide of objects.hiddenObjects) {
hidingFeatures.push({
id: objectToHide,
......
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