Commit 230a2982 authored by Matthias Betz's avatar Matthias Betz
Browse files

changed hiding mechanism

parent 1cec716b
...@@ -44,7 +44,7 @@ const hidingListener = function(tile) { ...@@ -44,7 +44,7 @@ const hidingListener = function(tile) {
}; };
function updateHideCondition(gmlId) { function updateHideCondition(gmlId) {
conditions.unshift(['${gml_id} === "' + gmlId + '"', false]); conditions.unshift(['${id} === "' + gmlId + '"', false]);
} }
function setScale(scaleValue) { function setScale(scaleValue) {
...@@ -346,6 +346,7 @@ export default function smartVillagesPlugin(config, baseUrl) { ...@@ -346,6 +346,7 @@ export default function smartVillagesPlugin(config, baseUrl) {
id: objectToHide, id: objectToHide,
loops: 0, loops: 0,
}); });
updateHideCondition(objectToHide);
} }
if (objects.hiddenObjects.length > 0) { if (objects.hiddenObjects.length > 0) {
const primitives = vcMap.getScene().primitives; const primitives = vcMap.getScene().primitives;
...@@ -353,10 +354,13 @@ export default function smartVillagesPlugin(config, baseUrl) { ...@@ -353,10 +354,13 @@ export default function smartVillagesPlugin(config, baseUrl) {
const tileSet = primitives.get(i); const tileSet = primitives.get(i);
if (!(tileSet instanceof Cesium3DTileset)) { if (!(tileSet instanceof Cesium3DTileset)) {
continue; continue;
} }
tileSet.tileVisible.addEventListener(hidingListener); tileSet.style = new Cesium3DTileStyle({
show: {
conditions: conditions,
},
});
} }
} }
} }
reader.readAsText(file); reader.readAsText(file);
...@@ -443,21 +447,24 @@ export default function smartVillagesPlugin(config, baseUrl) { ...@@ -443,21 +447,24 @@ export default function smartVillagesPlugin(config, baseUrl) {
id: 'delete', id: 'delete',
name: 'Objekt verstecken', name: 'Objekt verstecken',
callback() { callback() {
const gmlId = event.feature.getProperty("gml_id"); const gmlId = event.feature.getProperty("id");
if (gmlId !== undefined) { if (gmlId !== undefined) {
updateHideCondition(); updateHideCondition(gmlId);
event.feature.tileset.style = new Cesium3DTileStyle({ event.feature.tileset.style = new Cesium3DTileStyle({
show: { show: {
conditions: conditions, conditions: conditions,
}, },
}); });
activeMap.layerCollection.requestRender(); hidingFeatures.push({
id: gmlId,
loops: 0,
});
} else { } else {
const { activeMap } = vcsApp.maps; const { activeMap } = vcsApp.maps;
activeMap.layerCollection.globalHider.addFeature("manual", event.feature); activeMap.layerCollection.globalHider.addFeature("manual", event.feature);
hidingFeatures.push({ hidingFeatures.push({
id: event.feature.featureId, id: event.feature.featureId,
loops: 3, loops: 0,
}); });
activeMap.layerCollection.globalHider.hideObjects(["manual"]); activeMap.layerCollection.globalHider.hideObjects(["manual"]);
} }
...@@ -473,6 +480,17 @@ export default function smartVillagesPlugin(config, baseUrl) { ...@@ -473,6 +480,17 @@ export default function smartVillagesPlugin(config, baseUrl) {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async onVcsAppMounted(vcsApp) { async onVcsAppMounted(vcsApp) {
for (const map of vcsApp.maps) {
console.log(map);
}
const map = vcsApp.maps.getByType("CesiumVisualisationType");
console.log(map);
// tileset.allTilesLoaded.addEventListener(function() {
// console.log('All tiles are loaded');
// });
const bimGroup = { const bimGroup = {
id: 'bim-functions', id: 'bim-functions',
type: ToolboxType.GROUP, type: ToolboxType.GROUP,
......
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