feature request: Solid slicing #2

- Scaling (elevation) of the blend areas
- if the layer is visible, also control the visibility of the respective blend area (via events)
This commit is contained in:
Arno Kaimbacher 2021-05-04 20:26:49 +02:00
parent 0ebd32c79d
commit 78437eb89c
4 changed files with 83 additions and 64 deletions

112
package-lock.json generated
View File

@ -89,12 +89,12 @@
} }
}, },
"node_modules/@babel/generator": { "node_modules/@babel/generator": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.1.tgz",
"integrity": "sha512-C6u00HbmsrNPug6A+CiNl8rEys7TsdcXwg12BHi2ca5rUfAs3+UwZsuDQSXnc+wCElCXMB8gMaJ3YXDdh8fAlg==", "integrity": "sha512-TMGhsXMXCP/O1WtQmZjpEYDhCYC9vFhayWZPJSZCGkPJgUqX0rF0wwtrYvnzVxIjcF80tkUertXVk5cwqi5cAQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.14.0", "@babel/types": "^7.14.1",
"jsesc": "^2.5.1", "jsesc": "^2.5.1",
"source-map": "^0.5.0" "source-map": "^0.5.0"
} }
@ -134,9 +134,9 @@
} }
}, },
"node_modules/@babel/helper-create-class-features-plugin": { "node_modules/@babel/helper-create-class-features-plugin": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.1.tgz",
"integrity": "sha512-6pXDPguA5zC40Y8oI5mqr+jEUpjMJonKvknvA+vD8CYDz5uuXEwWBK8sRAsE/t3gfb1k15AQb9RhwpscC4nUJQ==", "integrity": "sha512-r8rsUahG4ywm0QpGcCrLaUSOuNAISR3IZCg4Fx05Ozq31aCUrQsTLH6KPxy0N5ULoQ4Sn9qjNdGNtbPWAC6hYg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-annotate-as-pure": "^7.12.13", "@babel/helper-annotate-as-pure": "^7.12.13",
@ -367,9 +367,9 @@
} }
}, },
"node_modules/@babel/parser": { "node_modules/@babel/parser": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.1.tgz",
"integrity": "sha512-AHbfoxesfBALg33idaTBVUkLnfXtsgvJREf93p4p0Lwsz4ppfE7g1tpEXVm4vrxUcH4DVhAa9Z1m1zqf9WUC7Q==", "integrity": "sha512-muUGEKu8E/ftMTPlNp+mc6zL3E9zKWmF5sDHZ5MSsoTP9Wyz64AhEf9kD08xYJ7w6Hdcu8H550ircnPyWSIF0Q==",
"dev": true, "dev": true,
"bin": { "bin": {
"parser": "bin/babel-parser.js" "parser": "bin/babel-parser.js"
@ -842,9 +842,9 @@
} }
}, },
"node_modules/@babel/plugin-transform-block-scoping": { "node_modules/@babel/plugin-transform-block-scoping": {
"version": "7.13.16", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.13.16.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.14.1.tgz",
"integrity": "sha512-ad3PHUxGnfWF4Efd3qFuznEtZKoBp0spS+DgqzVzRPV7urEBvPLue3y2j80w4Jf2YLzZHj8TOv/Lmvdmh3b2xg==", "integrity": "sha512-2mQXd0zBrwfp0O1moWIhPpEeTKDvxyHcnma3JATVP1l+CctWBuot6OJG8LQ4DnBj4ZZPSmlb/fm4mu47EOAnVA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.13.0" "@babel/helper-plugin-utils": "^7.13.0"
@ -1243,9 +1243,9 @@
} }
}, },
"node_modules/@babel/preset-env": { "node_modules/@babel/preset-env": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.14.1.tgz",
"integrity": "sha512-GWRCdBv2whxqqaSi7bo/BEXf070G/fWFMEdCnmoRg2CZJy4GK06ovFuEjJrZhDRXYgBsYtxVbG8GUHvw+UWBkQ==", "integrity": "sha512-0M4yL1l7V4l+j/UHvxcdvNfLB9pPtIooHTbEhgD/6UGyh8Hy3Bm1Mj0buzjDXATCSz3JFibVdnoJZCrlUCanrQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/compat-data": "^7.14.0", "@babel/compat-data": "^7.14.0",
@ -1285,7 +1285,7 @@
"@babel/plugin-transform-arrow-functions": "^7.13.0", "@babel/plugin-transform-arrow-functions": "^7.13.0",
"@babel/plugin-transform-async-to-generator": "^7.13.0", "@babel/plugin-transform-async-to-generator": "^7.13.0",
"@babel/plugin-transform-block-scoped-functions": "^7.12.13", "@babel/plugin-transform-block-scoped-functions": "^7.12.13",
"@babel/plugin-transform-block-scoping": "^7.13.16", "@babel/plugin-transform-block-scoping": "^7.14.1",
"@babel/plugin-transform-classes": "^7.13.0", "@babel/plugin-transform-classes": "^7.13.0",
"@babel/plugin-transform-computed-properties": "^7.13.0", "@babel/plugin-transform-computed-properties": "^7.13.0",
"@babel/plugin-transform-destructuring": "^7.13.17", "@babel/plugin-transform-destructuring": "^7.13.17",
@ -1315,7 +1315,7 @@
"@babel/plugin-transform-unicode-escapes": "^7.12.13", "@babel/plugin-transform-unicode-escapes": "^7.12.13",
"@babel/plugin-transform-unicode-regex": "^7.12.13", "@babel/plugin-transform-unicode-regex": "^7.12.13",
"@babel/preset-modules": "^0.1.4", "@babel/preset-modules": "^0.1.4",
"@babel/types": "^7.14.0", "@babel/types": "^7.14.1",
"babel-plugin-polyfill-corejs2": "^0.2.0", "babel-plugin-polyfill-corejs2": "^0.2.0",
"babel-plugin-polyfill-corejs3": "^0.2.0", "babel-plugin-polyfill-corejs3": "^0.2.0",
"babel-plugin-polyfill-regenerator": "^0.2.0", "babel-plugin-polyfill-regenerator": "^0.2.0",
@ -1393,9 +1393,9 @@
} }
}, },
"node_modules/@babel/types": { "node_modules/@babel/types": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.1.tgz",
"integrity": "sha512-O2LVLdcnWplaGxiPBz12d0HcdN8QdxdsWYhz5LSeuukV/5mn2xUUc3gBeU4QBYPJ18g/UToe8F532XJ608prmg==", "integrity": "sha512-S13Qe85fzLs3gYRUnrpyeIrBJIMYv33qSTg1qoBwiG6nPKwUWAD9odSzWhEedpwOIzSEI6gbdQIWEMiCI42iBA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/helper-validator-identifier": "^7.14.0", "@babel/helper-validator-identifier": "^7.14.0",
@ -2125,9 +2125,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001220", "version": "1.0.30001221",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001220.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001221.tgz",
"integrity": "sha512-pjC2T4DIDyGAKTL4dMvGUQaMUHRmhvPpAgNNTa14jaBWHu+bLQgvpFqElxh9L4829Fdx0PlKiMp3wnYldRtECA==", "integrity": "sha512-b9TOZfND3uGSLjMOrLh8XxSQ41x8mX+9MLJYDM4AAHLfaZHttrLNPrScWjVnBITRZbY5sPpCt7X85n7VSLZ+/g==",
"dev": true "dev": true
}, },
"node_modules/caseless": { "node_modules/caseless": {
@ -2430,12 +2430,12 @@
} }
}, },
"node_modules/core-js-compat": { "node_modules/core-js-compat": {
"version": "3.11.1", "version": "3.11.2",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.11.1.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.11.2.tgz",
"integrity": "sha512-aZ0e4tmlG/aOBHj92/TuOuZwp6jFvn1WNabU5VOVixzhu5t5Ao+JZkQOPlgNXu6ynwLrwJxklT4Gw1G1VGEh+g==", "integrity": "sha512-gYhNwu7AJjecNtRrIfyoBabQ3ZG+llfPmg9BifIX8yxIpDyfNLRM73zIjINSm6z3dMdI1nwNC9C7uiy4pIC6cw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"browserslist": "^4.16.5", "browserslist": "^4.16.6",
"semver": "7.0.0" "semver": "7.0.0"
}, },
"funding": { "funding": {
@ -6760,12 +6760,12 @@
} }
}, },
"@babel/generator": { "@babel/generator": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.1.tgz",
"integrity": "sha512-C6u00HbmsrNPug6A+CiNl8rEys7TsdcXwg12BHi2ca5rUfAs3+UwZsuDQSXnc+wCElCXMB8gMaJ3YXDdh8fAlg==", "integrity": "sha512-TMGhsXMXCP/O1WtQmZjpEYDhCYC9vFhayWZPJSZCGkPJgUqX0rF0wwtrYvnzVxIjcF80tkUertXVk5cwqi5cAQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.14.0", "@babel/types": "^7.14.1",
"jsesc": "^2.5.1", "jsesc": "^2.5.1",
"source-map": "^0.5.0" "source-map": "^0.5.0"
} }
@ -6802,9 +6802,9 @@
} }
}, },
"@babel/helper-create-class-features-plugin": { "@babel/helper-create-class-features-plugin": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.14.1.tgz",
"integrity": "sha512-6pXDPguA5zC40Y8oI5mqr+jEUpjMJonKvknvA+vD8CYDz5uuXEwWBK8sRAsE/t3gfb1k15AQb9RhwpscC4nUJQ==", "integrity": "sha512-r8rsUahG4ywm0QpGcCrLaUSOuNAISR3IZCg4Fx05Ozq31aCUrQsTLH6KPxy0N5ULoQ4Sn9qjNdGNtbPWAC6hYg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/helper-annotate-as-pure": "^7.12.13", "@babel/helper-annotate-as-pure": "^7.12.13",
@ -7026,9 +7026,9 @@
} }
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.14.1.tgz",
"integrity": "sha512-AHbfoxesfBALg33idaTBVUkLnfXtsgvJREf93p4p0Lwsz4ppfE7g1tpEXVm4vrxUcH4DVhAa9Z1m1zqf9WUC7Q==", "integrity": "sha512-muUGEKu8E/ftMTPlNp+mc6zL3E9zKWmF5sDHZ5MSsoTP9Wyz64AhEf9kD08xYJ7w6Hdcu8H550ircnPyWSIF0Q==",
"dev": true "dev": true
}, },
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": {
@ -7384,9 +7384,9 @@
} }
}, },
"@babel/plugin-transform-block-scoping": { "@babel/plugin-transform-block-scoping": {
"version": "7.13.16", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.13.16.tgz", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.14.1.tgz",
"integrity": "sha512-ad3PHUxGnfWF4Efd3qFuznEtZKoBp0spS+DgqzVzRPV7urEBvPLue3y2j80w4Jf2YLzZHj8TOv/Lmvdmh3b2xg==", "integrity": "sha512-2mQXd0zBrwfp0O1moWIhPpEeTKDvxyHcnma3JATVP1l+CctWBuot6OJG8LQ4DnBj4ZZPSmlb/fm4mu47EOAnVA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/helper-plugin-utils": "^7.13.0" "@babel/helper-plugin-utils": "^7.13.0"
@ -7692,9 +7692,9 @@
} }
}, },
"@babel/preset-env": { "@babel/preset-env": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.14.1.tgz",
"integrity": "sha512-GWRCdBv2whxqqaSi7bo/BEXf070G/fWFMEdCnmoRg2CZJy4GK06ovFuEjJrZhDRXYgBsYtxVbG8GUHvw+UWBkQ==", "integrity": "sha512-0M4yL1l7V4l+j/UHvxcdvNfLB9pPtIooHTbEhgD/6UGyh8Hy3Bm1Mj0buzjDXATCSz3JFibVdnoJZCrlUCanrQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/compat-data": "^7.14.0", "@babel/compat-data": "^7.14.0",
@ -7734,7 +7734,7 @@
"@babel/plugin-transform-arrow-functions": "^7.13.0", "@babel/plugin-transform-arrow-functions": "^7.13.0",
"@babel/plugin-transform-async-to-generator": "^7.13.0", "@babel/plugin-transform-async-to-generator": "^7.13.0",
"@babel/plugin-transform-block-scoped-functions": "^7.12.13", "@babel/plugin-transform-block-scoped-functions": "^7.12.13",
"@babel/plugin-transform-block-scoping": "^7.13.16", "@babel/plugin-transform-block-scoping": "^7.14.1",
"@babel/plugin-transform-classes": "^7.13.0", "@babel/plugin-transform-classes": "^7.13.0",
"@babel/plugin-transform-computed-properties": "^7.13.0", "@babel/plugin-transform-computed-properties": "^7.13.0",
"@babel/plugin-transform-destructuring": "^7.13.17", "@babel/plugin-transform-destructuring": "^7.13.17",
@ -7764,7 +7764,7 @@
"@babel/plugin-transform-unicode-escapes": "^7.12.13", "@babel/plugin-transform-unicode-escapes": "^7.12.13",
"@babel/plugin-transform-unicode-regex": "^7.12.13", "@babel/plugin-transform-unicode-regex": "^7.12.13",
"@babel/preset-modules": "^0.1.4", "@babel/preset-modules": "^0.1.4",
"@babel/types": "^7.14.0", "@babel/types": "^7.14.1",
"babel-plugin-polyfill-corejs2": "^0.2.0", "babel-plugin-polyfill-corejs2": "^0.2.0",
"babel-plugin-polyfill-corejs3": "^0.2.0", "babel-plugin-polyfill-corejs3": "^0.2.0",
"babel-plugin-polyfill-regenerator": "^0.2.0", "babel-plugin-polyfill-regenerator": "^0.2.0",
@ -7833,9 +7833,9 @@
} }
}, },
"@babel/types": { "@babel/types": {
"version": "7.14.0", "version": "7.14.1",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.0.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.1.tgz",
"integrity": "sha512-O2LVLdcnWplaGxiPBz12d0HcdN8QdxdsWYhz5LSeuukV/5mn2xUUc3gBeU4QBYPJ18g/UToe8F532XJ608prmg==", "integrity": "sha512-S13Qe85fzLs3gYRUnrpyeIrBJIMYv33qSTg1qoBwiG6nPKwUWAD9odSzWhEedpwOIzSEI6gbdQIWEMiCI42iBA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/helper-validator-identifier": "^7.14.0", "@babel/helper-validator-identifier": "^7.14.0",
@ -8442,9 +8442,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001220", "version": "1.0.30001221",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001220.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001221.tgz",
"integrity": "sha512-pjC2T4DIDyGAKTL4dMvGUQaMUHRmhvPpAgNNTa14jaBWHu+bLQgvpFqElxh9L4829Fdx0PlKiMp3wnYldRtECA==", "integrity": "sha512-b9TOZfND3uGSLjMOrLh8XxSQ41x8mX+9MLJYDM4AAHLfaZHttrLNPrScWjVnBITRZbY5sPpCt7X85n7VSLZ+/g==",
"dev": true "dev": true
}, },
"caseless": { "caseless": {
@ -8690,12 +8690,12 @@
} }
}, },
"core-js-compat": { "core-js-compat": {
"version": "3.11.1", "version": "3.11.2",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.11.1.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.11.2.tgz",
"integrity": "sha512-aZ0e4tmlG/aOBHj92/TuOuZwp6jFvn1WNabU5VOVixzhu5t5Ao+JZkQOPlgNXu6ynwLrwJxklT4Gw1G1VGEh+g==", "integrity": "sha512-gYhNwu7AJjecNtRrIfyoBabQ3ZG+llfPmg9BifIX8yxIpDyfNLRM73zIjINSm6z3dMdI1nwNC9C7uiy4pIC6cw==",
"dev": true, "dev": true,
"requires": { "requires": {
"browserslist": "^4.16.5", "browserslist": "^4.16.6",
"semver": "7.0.0" "semver": "7.0.0"
}, },
"dependencies": { "dependencies": {

View File

@ -102,7 +102,6 @@ export class Selection extends Layer {
map.scene.remove(this.touchMeshes); map.scene.remove(this.touchMeshes);
} }
build(app_scene) { build(app_scene) {
// app_scene.add(this.boxMesh); // app_scene.add(this.boxMesh);
app_scene.add(this.displayMeshes); app_scene.add(this.displayMeshes);
@ -131,7 +130,7 @@ export class Selection extends Layer {
scaleZ(z) { scaleZ(z) {
this.scale = z; this.scale = z;
this.boxMesh.scale.z = z; // this.boxMesh.scale.z = z;
this.displayMeshes.scale.z = z; this.displayMeshes.scale.z = z;
this.touchMeshes.scale.z = z; this.touchMeshes.scale.z = z;
this.setUniforms(); this.setUniforms();

View File

@ -106,12 +106,13 @@ class TinLayer extends Layer {
setVisible(visible) { setVisible(visible) {
this.visible = visible; this.visible = visible;
this.objectGroup.visible = visible; this.objectGroup.visible = visible;
this.emit('visibility-change'); this.emit('visibility-change', visible);
} }
scaleZ(z) { scaleZ(z) {
this.scale = z; this.scale = z;
this.objectGroup.scale.z = z; this.objectGroup.scale.z = z;
this.emit('scale-change', z);
} }
async onAdd(map) { async onAdd(map) {

View File

@ -176,7 +176,16 @@ class Application {
let layer = map.layers[i]; let layer = map.layers[i];
if (layer instanceof TinLayer && layer.name != "Topography") { if (layer instanceof TinLayer && layer.name != "Topography") {
let mesh = new Mesh(layer.geometry.clone(), material.frontStencilMaterial); let mesh = new Mesh(layer.geometry.clone(), material.frontStencilMaterial);
mesh.userData.layerId = layer.index;
frontGroup.add(mesh); frontGroup.add(mesh);
layer.on('visibility-change', (args) => {
let visible = args[0];
mesh.visible = visible;
});
layer.on('scale-change', (args) => {
let z = args[0];
mesh.scale.z = z;
});
} }
} }
frontGroup.updateMatrix(); frontGroup.updateMatrix();
@ -188,7 +197,17 @@ class Application {
let layer = map.layers[i]; let layer = map.layers[i];
if (layer instanceof TinLayer && layer.name != "Topography") { if (layer instanceof TinLayer && layer.name != "Topography") {
let mesh = new Mesh(layer.geometry.clone(), material.backStencilMaterial); let mesh = new Mesh(layer.geometry.clone(), material.backStencilMaterial);
mesh.userData.layerId = layer.index;
backGroup.add(mesh); backGroup.add(mesh);
layer.on('visibility-change', (args) => {
let visible = args[0];
mesh.visible = visible;
});
layer.on('scale-change', (args) => {
let z = args[0];
mesh.scale.z = z;
});
} }
} }
backGroup.updateMatrix(); backGroup.updateMatrix();