From 65a099547c96dc90cc5212f30270f3baac64545a Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Tue, 6 Jul 2021 11:08:59 +0200 Subject: [PATCH] - slicing box default off - default geology tab - dynmic email link from service contact - egdi_disclaimer.html - add model and border groups to Map.ts --- GeotiefExplore.code-workspace | 2 +- egdi_disclaimer.html | 56 +++++ index.html | 10 +- package-lock.json | 319 +++++++++++----------------- package.json | 3 +- src/js/clip/Selection.ts | 3 +- src/js/clip/UpdatableBoxGeometry.ts | 33 ++- src/js/clip/material.ts | 57 +++-- src/js/constants.ts | 12 ++ src/js/controls/BoreholePopup.ts | 2 +- src/js/core/Map.ts | 25 +++ src/js/layer/Layer.ts | 5 + src/js/layer/TinLayer.ts | 296 ++++++++++++-------------- src/js/main.js | 127 ++++++----- src/js/tasks/BoreholeIdentify.js | 8 +- webpack.config.js | 4 + 16 files changed, 504 insertions(+), 458 deletions(-) create mode 100644 egdi_disclaimer.html create mode 100644 src/js/constants.ts diff --git a/GeotiefExplore.code-workspace b/GeotiefExplore.code-workspace index b09fd1d..c9fe0a6 100644 --- a/GeotiefExplore.code-workspace +++ b/GeotiefExplore.code-workspace @@ -16,7 +16,7 @@ "request": "launch", "name": "Launch Chrome against localhost", // "port": 9222, - "url": "http://localhost:8080", + "url": "http://localhost:8080?modelid=20", "webRoot": "${workspaceFolder}", "breakOnLoad": true, "runtimeExecutable": "C:/ProgramData/scoop/apps/googlechrome/current/chrome.exe", diff --git a/egdi_disclaimer.html b/egdi_disclaimer.html new file mode 100644 index 0000000..2a0ca11 --- /dev/null +++ b/egdi_disclaimer.html @@ -0,0 +1,56 @@ + + + + + + GeoTief 3DViewer - Haftungsausschluß + + + + + + +
+

+

Disclaimer/Haftungsausschluss GBA:
+

+

+ + Dem in diesem Web Viewer dargestellten, geologischen 3D Modell liegen verschiedene Untergrunddaten zugrunde. + Diese umfassen u. A. geologische Strukturkarten, Profilschnitte, Bohrprofile, geophysikalische Messungen + etc. + Diese Informationen dienen nach Prüfung ihrer Plausibilität als Interpretationsgrundlage für die + Erststellung eines geologischen 3D Modells. + Die Qualität der modellierten Grenzflächen ist abhängig von Dichte und Qualität der verwendeten Datenpunkte, + der regional-geologischen Expertise der modellierenden Personen und der geologischen Komplexität des zu + modellierenden Gebiets. +

+

+ Wenngleich die Geologische Bundesanstalt die verwendeten Informationen mit bestem Wissen und Gewissen bei + der Modellerstellung berücksichtigt hat, + garantiert die Geologische Bundesanstalt weder Vollständigkeit noch Richtigkeit des Modells. + Daraus abgeleitete Informationen (z.B. virtuelle Bohrprofile) entsprechen dem Modell aber nicht der + Realität! + Die Geologische Bundesanstalt haftet weder für Fehler oder Unzulänglichkeiten des Modells, noch für jegliche + Ansprüche oder Kosten, + die durch den Gebrauch des Modells entstehen könnten. + Darüber hinaus gibt das dargestellte Modell nur die Interpretation der bei der Erstellung verwendeten + Untergrunddaten wieder. + Zukünftige oder neu herangezogene Daten sowie technische Fortschritte können die Qualität des Modells + verbessern. +

+ +
+ + + + \ No newline at end of file diff --git a/index.html b/index.html index f42a748..4dca73a 100644 --- a/index.html +++ b/index.html @@ -72,12 +72,12 @@ Download Map - - Contact + + Disclaimer - - Report an issue + + Contact @@ -184,7 +184,7 @@
diff --git a/package-lock.json b/package-lock.json index 372bb06..d5431ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "@fortawesome/fontawesome-free": "^5.15.2", "@types/three": "^0.129.1", "bulma": "^0.9.2", - "hull.js": "^0.2.11", "lodash": "^4.17.21", "normalize.css": "^8.0.1", "proj4": "^2.6.3", @@ -33,7 +32,7 @@ "dotenv": "^10.0.0", "file-loader": "^6.2.0", "img-loader": "^4.0.0", - "mini-css-extract-plugin": "^1.3.1", + "mini-css-extract-plugin": "^2.0.0", "node-sass": "^6.0.0", "resolve-url-loader": "^4.0.0", "sass-loader": "^12.1.0", @@ -1733,9 +1732,9 @@ "peer": true }, "node_modules/@types/debug": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz", - "integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.6.tgz", + "integrity": "sha512-7fDOJFA/x8B+sO1901BmHlf5dE1cxBU8mRXj8QOEDnn16hhGJv/IHxJtZhvsabZsIMn0eLIyeOKAeqSNJJYTpA==", "dev": true, "peer": true }, @@ -1778,9 +1777,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "15.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.5.tgz", - "integrity": "sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.0.0.tgz", + "integrity": "sha512-TmCW5HoZ2o2/z2EYi109jLqIaPIi9y/lc2LmDCWzuCi35bcaQ+OtUh6nwBiFK7SOu25FAU5+YKdqFZUwtqGSdg==", "dev": true }, "node_modules/@types/normalize-package-data": { @@ -1790,9 +1789,9 @@ "dev": true }, "node_modules/@types/three": { - "version": "0.129.1", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.129.1.tgz", - "integrity": "sha512-31VTcjAQNggIrCH9NVotTYsr5Ws/QMGGTaMK6RP3EgyzW2WEuZdm25TNidd6PJ3e4a6/hbswNacnTsjwc7ksbw==" + "version": "0.129.2", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.129.2.tgz", + "integrity": "sha512-fZDNRtUFnq3baNjDiAzi4QoHYcczWtEdsduH/tpiwk91fbVk8COJiT/iLoN3tIOjLKMySoYsjUfP0VTmUfZKLw==" }, "node_modules/@webassemblyjs/ast": { "version": "1.11.0", @@ -2359,9 +2358,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001241", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz", - "integrity": "sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==", + "version": "1.0.30001242", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz", + "integrity": "sha512-KvNuZ/duufelMB3w2xtf9gEWCSxJwUgoxOx5b6ScLXC4kPc9xsczUVCPrQU26j5kOsHM4pSUL54tAZt5THQKug==", "dev": true, "funding": { "type": "opencollective", @@ -2744,12 +2743,12 @@ } }, "node_modules/css-loader/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" }, @@ -2814,9 +2813,9 @@ } }, "node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -2921,9 +2920,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.762", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.762.tgz", - "integrity": "sha512-LehWjRpfPcK8F1Lf/NZoAwWLWnjJVo0SZeQ9j/tvnBWYcT99qDqgo4raAfS2oTKZjPrR/jxruh85DGgDUmywEA==", + "version": "1.3.768", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.768.tgz", + "integrity": "sha512-I4UMZHhVSK2pwt8jOIxTi3GIuc41NkddtKT/hpuxp9GO5UWJgDKTBa4TACppbVAuKtKbMK6BhQZvT5tFF1bcNA==", "dev": true }, "node_modules/emoji-regex": { @@ -3143,9 +3142,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", + "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", "dev": true, "peer": true, "dependencies": { @@ -3187,12 +3186,12 @@ } }, "node_modules/file-loader/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" }, @@ -3602,11 +3601,6 @@ "npm": ">=1.3.7" } }, - "node_modules/hull.js": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/hull.js/-/hull.js-0.2.11.tgz", - "integrity": "sha512-WEmMRCFqoZA0d7bD9KY9RK0rTBKRfNqDExi8OvFz5A57hpywyc0Wd5N4egF9cU+E69p1KjE/fTIYU4CjOgXdZQ==" - }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -4228,47 +4222,31 @@ } }, "node_modules/mini-css-extract-plugin": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz", - "integrity": "sha512-WhDvO3SjGm40oV5y26GjMJYjd2UMqrLAGKy5YS2/3QKJy2F7jgynuHTir/tgUUOiNQu5saXHdc8reo7YuhhT4Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.1.0.tgz", + "integrity": "sha512-SV1GgjMcfqy6hW07rAniUbQE4qS3inh3v4rZEUySkPRWy3vMbS3jUCjMOvNI4lUnDlQYJEmuUqKktTCNY5koFQ==", "dev": true, "dependencies": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0", - "webpack-sources": "^1.1.0" + "schema-utils": "^3.0.0" }, "engines": { - "node": ">= 10.13.0" + "node": ">= 12.13.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^4.4.0 || ^5.0.0" - } - }, - "node_modules/mini-css-extract-plugin/node_modules/loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "engines": { - "node": ">=8.9.0" + "webpack": "^5.0.0" } }, "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" }, @@ -6040,12 +6018,12 @@ } }, "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" }, @@ -6306,12 +6284,12 @@ } }, "node_modules/url-loader/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" }, @@ -6383,9 +6361,9 @@ } }, "node_modules/webpack": { - "version": "5.41.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.41.1.tgz", - "integrity": "sha512-AJZIIsqJ/MVTmegEq9Tlw5mk5EHdGiJbDdz9qP15vmUH+oxI1FdWcL0E9EO8K/zKaRPWqEs7G/OPxq1P61u5Ug==", + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.42.1.tgz", + "integrity": "sha512-msikozzXrG2Hdx+dElq0fyNvxPFsaM2dKLc/l+xkMmhO/1qwVJ9K9gY+fi/49MYWcpSP7alnK5Q78Evrd1LiqQ==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.0", @@ -6393,7 +6371,7 @@ "@webassemblyjs/ast": "1.11.0", "@webassemblyjs/wasm-edit": "1.11.0", "@webassemblyjs/wasm-parser": "1.11.0", - "acorn": "^8.2.1", + "acorn": "^8.4.1", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.8.0", @@ -6495,13 +6473,16 @@ } }, "node_modules/webpack-sources": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", - "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz", + "integrity": "sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ==", "dev": true, "dependencies": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" + "source-list-map": "^2.0.1", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10.13.0" } }, "node_modules/webpack-sources/node_modules/source-map": { @@ -6514,12 +6495,12 @@ } }, "node_modules/webpack/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" }, @@ -6531,28 +6512,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/webpack/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/webpack-sources": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz", - "integrity": "sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ==", - "dev": true, - "dependencies": { - "source-list-map": "^2.0.1", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -7964,9 +7923,9 @@ "peer": true }, "@types/debug": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz", - "integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.6.tgz", + "integrity": "sha512-7fDOJFA/x8B+sO1901BmHlf5dE1cxBU8mRXj8QOEDnn16hhGJv/IHxJtZhvsabZsIMn0eLIyeOKAeqSNJJYTpA==", "dev": true, "peer": true }, @@ -8009,9 +7968,9 @@ "dev": true }, "@types/node": { - "version": "15.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.5.tgz", - "integrity": "sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.0.0.tgz", + "integrity": "sha512-TmCW5HoZ2o2/z2EYi109jLqIaPIi9y/lc2LmDCWzuCi35bcaQ+OtUh6nwBiFK7SOu25FAU5+YKdqFZUwtqGSdg==", "dev": true }, "@types/normalize-package-data": { @@ -8021,9 +7980,9 @@ "dev": true }, "@types/three": { - "version": "0.129.1", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.129.1.tgz", - "integrity": "sha512-31VTcjAQNggIrCH9NVotTYsr5Ws/QMGGTaMK6RP3EgyzW2WEuZdm25TNidd6PJ3e4a6/hbswNacnTsjwc7ksbw==" + "version": "0.129.2", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.129.2.tgz", + "integrity": "sha512-fZDNRtUFnq3baNjDiAzi4QoHYcczWtEdsduH/tpiwk91fbVk8COJiT/iLoN3tIOjLKMySoYsjUfP0VTmUfZKLw==" }, "@webassemblyjs/ast": { "version": "1.11.0", @@ -8493,9 +8452,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001241", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz", - "integrity": "sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==", + "version": "1.0.30001242", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001242.tgz", + "integrity": "sha512-KvNuZ/duufelMB3w2xtf9gEWCSxJwUgoxOx5b6ScLXC4kPc9xsczUVCPrQU26j5kOsHM4pSUL54tAZt5THQKug==", "dev": true }, "caseless": { @@ -8796,12 +8755,12 @@ } }, "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } @@ -8839,9 +8798,9 @@ "dev": true }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -8919,9 +8878,9 @@ } }, "electron-to-chromium": { - "version": "1.3.762", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.762.tgz", - "integrity": "sha512-LehWjRpfPcK8F1Lf/NZoAwWLWnjJVo0SZeQ9j/tvnBWYcT99qDqgo4raAfS2oTKZjPrR/jxruh85DGgDUmywEA==", + "version": "1.3.768", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.768.tgz", + "integrity": "sha512-I4UMZHhVSK2pwt8jOIxTi3GIuc41NkddtKT/hpuxp9GO5UWJgDKTBa4TACppbVAuKtKbMK6BhQZvT5tFF1bcNA==", "dev": true }, "emoji-regex": { @@ -9092,9 +9051,9 @@ "dev": true }, "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", + "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", "dev": true, "peer": true, "requires": { @@ -9123,12 +9082,12 @@ } }, "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } @@ -9432,11 +9391,6 @@ "sshpk": "^1.7.0" } }, - "hull.js": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/hull.js/-/hull.js-0.2.11.tgz", - "integrity": "sha512-WEmMRCFqoZA0d7bD9KY9RK0rTBKRfNqDExi8OvFz5A57hpywyc0Wd5N4egF9cU+E69p1KjE/fTIYU4CjOgXdZQ==" - }, "human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -9902,34 +9856,21 @@ "dev": true }, "mini-css-extract-plugin": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz", - "integrity": "sha512-WhDvO3SjGm40oV5y26GjMJYjd2UMqrLAGKy5YS2/3QKJy2F7jgynuHTir/tgUUOiNQu5saXHdc8reo7YuhhT4Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.1.0.tgz", + "integrity": "sha512-SV1GgjMcfqy6hW07rAniUbQE4qS3inh3v4rZEUySkPRWy3vMbS3jUCjMOvNI4lUnDlQYJEmuUqKktTCNY5koFQ==", "dev": true, "requires": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0", - "webpack-sources": "^1.1.0" + "schema-utils": "^3.0.0" }, "dependencies": { - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } @@ -11254,12 +11195,12 @@ } }, "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } @@ -11438,12 +11379,12 @@ } }, "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } @@ -11500,9 +11441,9 @@ } }, "webpack": { - "version": "5.41.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.41.1.tgz", - "integrity": "sha512-AJZIIsqJ/MVTmegEq9Tlw5mk5EHdGiJbDdz9qP15vmUH+oxI1FdWcL0E9EO8K/zKaRPWqEs7G/OPxq1P61u5Ug==", + "version": "5.42.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.42.1.tgz", + "integrity": "sha512-msikozzXrG2Hdx+dElq0fyNvxPFsaM2dKLc/l+xkMmhO/1qwVJ9K9gY+fi/49MYWcpSP7alnK5Q78Evrd1LiqQ==", "dev": true, "requires": { "@types/eslint-scope": "^3.7.0", @@ -11510,7 +11451,7 @@ "@webassemblyjs/ast": "1.11.0", "@webassemblyjs/wasm-edit": "1.11.0", "@webassemblyjs/wasm-parser": "1.11.0", - "acorn": "^8.2.1", + "acorn": "^8.4.1", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.8.0", @@ -11531,31 +11472,15 @@ }, "dependencies": { "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.0.tgz", + "integrity": "sha512-tTEaeYkyIhEZ9uWgAjDerWov3T9MgX8dhhy2r0IGeeX4W8ngtGl1++dUve/RUqzuaASSh7shwCDJjEzthxki8w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.6", + "@types/json-schema": "^7.0.7", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "webpack-sources": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz", - "integrity": "sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ==", - "dev": true, - "requires": { - "source-list-map": "^2.0.1", - "source-map": "^0.6.1" - } } } }, @@ -11599,13 +11524,13 @@ } }, "webpack-sources": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", - "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.0.tgz", + "integrity": "sha512-WyOdtwSvOML1kbgtXbTDnEW0jkJ7hZr/bDByIwszhWd/4XX1A3XMkrbFMsuH4+/MfLlZCUzlAdg4r7jaGKEIgQ==", "dev": true, "requires": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" + "source-list-map": "^2.0.1", + "source-map": "^0.6.1" }, "dependencies": { "source-map": { diff --git a/package.json b/package.json index 9fed887..990a7a1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "@fortawesome/fontawesome-free": "^5.15.2", "@types/three": "^0.129.1", "bulma": "^0.9.2", - "hull.js": "^0.2.11", "lodash": "^4.17.21", "normalize.css": "^8.0.1", "proj4": "^2.6.3", @@ -30,7 +29,7 @@ "dotenv": "^10.0.0", "file-loader": "^6.2.0", "img-loader": "^4.0.0", - "mini-css-extract-plugin": "^1.3.1", + "mini-css-extract-plugin": "^2.0.0", "node-sass": "^6.0.0", "resolve-url-loader": "^4.0.0", "sass-loader": "^12.1.0", diff --git a/src/js/clip/Selection.ts b/src/js/clip/Selection.ts index 33e3bbb..50da8df 100644 --- a/src/js/clip/Selection.ts +++ b/src/js/clip/Selection.ts @@ -28,7 +28,7 @@ export class Selection extends Layer { constructor(parameters, low, high) { super(); this.type = 'Selection'; - this.visible = true; + this.visible = false; this.opacity = 1; for (var k in parameters) { this[k] = parameters[k]; @@ -98,6 +98,7 @@ export class Selection extends Layer { onAdd(map) { this.map = map; this.build(this.getScene()); + this.setVisible(this.visible); this.emit('add'); if (this.map.layers) { diff --git a/src/js/clip/UpdatableBoxGeometry.ts b/src/js/clip/UpdatableBoxGeometry.ts index ac29944..464f65c 100644 --- a/src/js/clip/UpdatableBoxGeometry.ts +++ b/src/js/clip/UpdatableBoxGeometry.ts @@ -3,6 +3,7 @@ import { Uint16BufferAttribute } from 'three/src/core/BufferAttribute'; import { Vector3 } from 'three/src/math/Vector3'; import { Float32BufferAttribute } from 'three/src/core/BufferAttribute'; import { eventMixin } from '../core/eventMixin'; +import { Plane } from 'three/src/math/Plane'; class UpdatableBoxGeometry extends BufferGeometry { @@ -10,11 +11,14 @@ class UpdatableBoxGeometry extends BufferGeometry { indexArray: Array; uvs: Array; groupStart: number; + clipPlanes: Array; constructor(vertices: Array) { // call parent constructor super(); + this.clipPlanes = [new Plane(new Vector3(0, 1, 0))]; + this.type = 'UpdatableBoxGeometry'; this.indexArray = new Array(); this.vertices = new Array(); @@ -23,11 +27,11 @@ class UpdatableBoxGeometry extends BufferGeometry { // helper variables for material index this.groupStart = 0; - this.buildPlane(0, vertices[0], vertices[1], vertices[5], vertices[4], 0); //y1 south - this.buildPlane(4, vertices[0], vertices[2], vertices[3], vertices[1], 1); //z1 bottom - this.buildPlane(8, vertices[0], vertices[4], vertices[6], vertices[2], 2); //x1 east - this.buildPlane(12, vertices[7], vertices[5], vertices[1], vertices[3], 3); //x2 west - this.buildPlane(16, vertices[7], vertices[3], vertices[2], vertices[6], 4); //y2 nort + this.buildPlane(0, vertices[0], vertices[1], vertices[5], vertices[4], 0); //y1 south 0 1 2 3 + this.buildPlane(4, vertices[0], vertices[2], vertices[3], vertices[1], 1); //z1 bottom 4 5 6 7 + this.buildPlane(8, vertices[0], vertices[4], vertices[6], vertices[2], 2); //x1 east 8 9 10 11 + this.buildPlane(12, vertices[7], vertices[5], vertices[1], vertices[3], 3); //x2 west 12 13 14 15 + this.buildPlane(16, vertices[7], vertices[3], vertices[2], vertices[6], 4); //y2 nort 15 16 17 18 this.buildPlane(20, vertices[7], vertices[6], vertices[4], vertices[5], 5); //z2 this.setFromPoints(this.vertices); @@ -68,8 +72,25 @@ class UpdatableBoxGeometry extends BufferGeometry { update() { this.setFromPoints(this.vertices); this.attributes.position.needsUpdate = true; + this.computeBoundingBox(); this.computeBoundingSphere(); - this.dispatchEvent( { type: 'update', message: "example" } ); + this.dispatchEvent({ type: 'update', message: "example" } ); + } + + clippingPlanes() { + const a = this.gVect(0); + const b = this.gVect(1); + const c = this.gVect(2); + this.clipPlanes[0] = new Plane(new Vector3(0, -1, 0), a.y); + // this.clipPlanes[0]= new Plane(new Vector3(-1, 0, 0), a.x); + + + return this.clipPlanes[0]; + } + + // grab position from geometry + private gVect(idx) { + return new Vector3().fromBufferAttribute(this.attributes.position, idx); } } diff --git a/src/js/clip/material.ts b/src/js/clip/material.ts index beb5474..6afac42 100644 --- a/src/js/clip/material.ts +++ b/src/js/clip/material.ts @@ -4,9 +4,11 @@ import { LineBasicMaterial } from 'three/src/materials/LineBasicMaterial'; import { ShaderMaterial } from 'three/src/materials/ShaderMaterial'; import { uniforms } from "./uniforms"; import { shader } from './shader'; -import { DoubleSide, BackSide, FrontSide, EqualStencilFunc, KeepStencilOp, DecrementStencilOp, IncrementStencilOp, InvertStencilOp, GreaterStencilFunc, NeverStencilFunc, LessStencilFunc, LessEqualStencilFunc } from 'three/src/constants'; +import { DoubleSide, BackSide, FrontSide, EqualStencilFunc, KeepStencilOp, DecrementStencilOp, IncrementStencilOp, InvertStencilOp } from 'three/src/constants'; import { DecrementWrapStencilOp, IncrementWrapStencilOp } from 'three/src/constants'; import { NotEqualStencilFunc, ReplaceStencilOp, AlwaysStencilFunc } from 'three/src/constants'; +import { Vector3 } from 'three/src/math/Vector3'; +import { Plane } from 'three/src/math/Plane'; // let profileMaterial = new ShaderMaterial({ // // metalness: 0.1, @@ -22,34 +24,40 @@ import { NotEqualStencilFunc, ReplaceStencilOp, AlwaysStencilFunc } from 'three/ // vertexShader: shader.vertex, // fragmentShader: shader.fragment // }); +// y normal will not clip models on northern hemisphere +// but why not -1 ?? +function dummyPlane() { + const normal = new Vector3( 0, 1, 0 ); + return new Plane( normal, 0 ); +} + +let featureMat = new MeshStandardMaterial({ + color: 0xC1FF07, + metalness: 0.1, + roughness: 0.75, + flatShading: true, + side: DoubleSide, + // clippingPlanes: [ dummyPlane() ] +}); + + let profileMaterial = new MeshStandardMaterial( { color: 0xE91E63, metalness: 0.1, roughness: 0.75, flatShading: true, - stencilWrite: true, - stencilRef: 0, + stencilWrite: true, + // stencilRef: 0, stencilFunc: NotEqualStencilFunc, stencilFail: ReplaceStencilOp, stencilZFail: ReplaceStencilOp, - stencilZPass: ReplaceStencilOp + stencilZPass: ReplaceStencilOp, // stencilFunc: NotEqualStencilFunc, // stencilFail: ReplaceStencilOp, // stencilZFail: ReplaceStencilOp, // stencilZPass: ReplaceStencilOp } ); -let stencilMaterial = new ShaderMaterial({ - depthWrite: false, - depthTest: false, - colorWrite: false, - stencilWrite: true, - stencilFunc: AlwaysStencilFunc, - // uniforms: uniforms.clipping, - vertexShader: shader.vertexClipping, - fragmentShader: shader.fragmentClippingFront, -}); - let frontStencilMaterial = new ShaderMaterial({ depthWrite: false, depthTest: false, @@ -59,6 +67,7 @@ let frontStencilMaterial = new ShaderMaterial({ uniforms: uniforms.clipping, vertexShader: shader.vertexClipping, fragmentShader: shader.fragmentClippingFront, + // clippingPlanes: [dummyPlane()], side: FrontSide, // stencilFail: DecrementWrapStencilOp, // stencilZFail: DecrementWrapStencilOp, @@ -77,6 +86,7 @@ let backStencilMaterial = new ShaderMaterial({ uniforms: uniforms.clipping, vertexShader: shader.vertexClipping, fragmentShader: shader.fragmentClippingFront, + // clippingPlanes: [ dummyPlane() ], side: BackSide, // stencilFail: IncrementWrapStencilOp, // stencilZFail: IncrementWrapStencilOp, @@ -102,21 +112,6 @@ let Invisible = new ShaderMaterial({ side: DoubleSide }); -// export const profileMat = new MeshStandardMaterial( { - -// color: 0xE91E63, -// metalness: 0.1, -// roughness: 0.75, -// flatShading: true, -// stencilWrite: true, -// // stencilRef: 0, -// stencilFunc: NotEqualStencilFunc, -// stencilFail: ReplaceStencilOp, -// stencilZFail: ReplaceStencilOp, -// stencilZPass: ReplaceStencilOp -// } ); - - function toBack(mat) { const material = mat.clone(); material.side = BackSide, @@ -140,7 +135,7 @@ function toFront(mat) { export { toBack, toFront, - stencilMaterial, + featureMat, profileMaterial, frontStencilMaterial, backStencilMaterial, diff --git a/src/js/constants.ts b/src/js/constants.ts new file mode 100644 index 0000000..aa7ef68 --- /dev/null +++ b/src/js/constants.ts @@ -0,0 +1,12 @@ + +declare const POINT_URL: string; +declare const EDGE_URL: string; +declare const SERVICE_URL: string; + +const _EDGE_URL = EDGE_URL; +const _POINT_URL = POINT_URL; +const _SERVICE_URL = SERVICE_URL; + +export {_EDGE_URL as EDGE_URL}; +export {_POINT_URL as POINT_URL}; +export {_SERVICE_URL as SERVICE_URL}; \ No newline at end of file diff --git a/src/js/controls/BoreholePopup.ts b/src/js/controls/BoreholePopup.ts index 20e7117..b168f1a 100644 --- a/src/js/controls/BoreholePopup.ts +++ b/src/js/controls/BoreholePopup.ts @@ -101,7 +101,7 @@ export class BoreholePopup extends Control { domEvent.on(this._clearButton, 'click', domEvent.preventDefault); domEvent.on(this._clearButton, 'click', this.close, this);; - // this._toggleVisibility(false); + this._setVisibility(false); if (!this.options.parentDiv) { return container; diff --git a/src/js/core/Map.ts b/src/js/core/Map.ts index 92a8ee8..659ce47 100644 --- a/src/js/core/Map.ts +++ b/src/js/core/Map.ts @@ -8,6 +8,7 @@ import * as util from './utilities'; import { TinLayer } from '../layer/TinLayer'; import { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera'; import { Vector3 } from 'three/src/math/Vector3'; +import { Group } from 'three'; class Map extends OrbitControls { @@ -27,6 +28,10 @@ class Map extends OrbitControls { public basemaps: Object; public baseExtent: Object; public currentBasemap; + public contact: string; + private _modelNode: Group; + private _stencilNode: Group; + private _profileNode: Group; constructor(x, y, z, scene, container) { @@ -57,6 +62,7 @@ class Map extends OrbitControls { this.size = size; this.camera = camera; this.container = container; + this.scene = scene; this.length = x.max - x.min; this.width = y.max - y.min; this.height = z.max - z.min; @@ -68,6 +74,12 @@ class Map extends OrbitControls { x: x, y: y }; + this._modelNode = new Group(); + this._stencilNode = new Group(); + this._profileNode = new Group(); + this.scene.add(this._modelNode); + this.scene.add(this._stencilNode); + this.scene.add(this._profileNode); //init the control corners if (this._initControlPos) { @@ -100,9 +112,22 @@ class Map extends OrbitControls { map._initControls(); map.title = modelData.model.model_name; + map.contact = modelData.model.model_owner; return map; } + get modelNode(): Group { + return this._modelNode; + } + + get stencilNode(): Group { + return this._stencilNode; + } + + get profileNode(): Group { + return this._profileNode; + } + get layers() { return this._layers; } diff --git a/src/js/layer/Layer.ts b/src/js/layer/Layer.ts index 5496dd2..f456f1c 100644 --- a/src/js/layer/Layer.ts +++ b/src/js/layer/Layer.ts @@ -2,6 +2,7 @@ import { EventEmitter } from '../core/EventEmitter'; import { BoreholePopup } from '../controls/BoreholePopup'; import { Map } from '../core/Map'; import { Scene } from 'three/src/scenes/Scene'; +import { Group } from 'three'; abstract class Layer extends EventEmitter { @@ -58,6 +59,10 @@ abstract class Layer extends EventEmitter { return this._map.scene; } + getModelNode(): Group { + return this._map.scene; + } + // @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this // Binds a popup to the layer with the passed `content` and sets up the // neccessary event listeners. If a `Function` is passed it will receive diff --git a/src/js/layer/TinLayer.ts b/src/js/layer/TinLayer.ts index eebd289..731a140 100644 --- a/src/js/layer/TinLayer.ts +++ b/src/js/layer/TinLayer.ts @@ -6,7 +6,6 @@ import { Layer } from './Layer'; import { BitStream } from '../lib/bitstream'; import { Vector3 } from 'three/src/math/Vector3'; import { MyMeshStandardMaterial } from '../clip/MyMeshStandardMaterial'; -import { MeshBasicMaterial } from 'three/src/materials/MeshBasicMaterial'; import { Group } from 'three/src/objects/Group'; import { TextureLoader } from 'three/src/loaders/TextureLoader'; import proj4 from 'proj4/dist/proj4-src'; @@ -20,22 +19,20 @@ import { uniforms } from '../clip/uniforms'; import { UpdatableBoxGeometry } from '../clip/UpdatableBoxGeometry'; import { Scene } from 'three/src/scenes/Scene'; import * as material from '../clip/material'; +import { POINT_URL, EDGE_URL } from "../constants"; import { Plane } from 'three/src/math/Plane'; import { PlaneGeometry } from '../clip/PlaneGeometry'; import { Line3 } from 'three/src/math/Line3'; -import { LineBasicMaterial } from 'three/src/materials/LineBasicMaterial'; -import { LineSegments } from 'three/src/objects/LineSegments'; -import { PointsMaterial } from 'three/src/materials/PointsMaterial'; -import { Points } from 'three/src/objects/Points'; -import { Line } from 'three/src/objects/Line'; -import hull from 'hull.js/src/hull'; +// import { LineBasicMaterial } from 'three/src/materials/LineBasicMaterial'; +// import { LineSegments } from 'three/src/objects/LineSegments'; +// import { PointsMaterial } from 'three/src/materials/PointsMaterial'; +// import { Points } from 'three/src/objects/Points'; +// import { Line } from 'three/src/objects/Line'; import { Color } from 'three/src/math/Color'; - - -const POINTURL = 'https://geusegdi01.geus.dk/geom3d/data/nodes/'; -const EDGEURL = 'https://geusegdi01.geus.dk/geom3d/data/triangles/'; +// const POINTURL = 'https://geusegdi01.geus.dk/geom3d/data/nodes/'; +// const EDGEURL = 'https://geusegdi01.geus.dk/geom3d/data/triangles/'; export class Point3 extends Vector3 { // public x: number; @@ -128,6 +125,10 @@ class TinLayer extends Layer { tolerance: number = 0.01; pointsOfIntersection: BufferGeometry; borderMaterial; + xLocalPlane; + yLocalPlane; + pointUrl: string; + edgeUrl: string; constructor(params) { super(); @@ -147,6 +148,18 @@ class TinLayer extends Layer { this.q = true; this.uniforms = uniforms; this.borderGroup = new Group(); + + this.xLocalPlane = new Plane(new Vector3(-1, 0, 0), 4508490); + this.yLocalPlane = new Plane(new Vector3(0, 1, 0), 2350280); + + this.pointUrl = 'https://geusegdi01.geus.dk/geom3d/data/nodes/'; + this.edgeUrl = 'https://geusegdi01.geus.dk/geom3d/data/triangles/'; + if (POINT_URL != "") { + this.pointUrl = POINT_URL; + } + if (EDGE_URL != "") { + this.edgeUrl = EDGE_URL; + } } buildBorder(vertices) { @@ -155,9 +168,7 @@ class TinLayer extends Layer { let color = parseInt(this.color, 16); - - let planeGeom = new PlaneGeometry(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); - + let planeGeom = this.planeGeom = new PlaneGeometry(this.box.vertices[12], this.box.vertices[13], this.box.vertices[14], this.box.vertices[15]); let caps = { // red color: { type: "c", value: new Color(color) } @@ -169,10 +180,7 @@ class TinLayer extends Layer { // this.borderMesh.name = 'stencilFeatureBack_' + this.index; this.borderMesh.name = 'profilePlane_' + this.name; // this.borderMesh.onAfterRender = this.debugRenderOrder; - - - // this.boxMesh = new Mesh(box, material.profileMaterial); - + let self = this; // //let planeGeom = this.planeGeom = new PlaneGeometry(vertices[0], vertices[1], vertices[5], vertices[4]); @@ -198,7 +206,7 @@ class TinLayer extends Layer { // var points = new Points(pointsOfIntersection, pointsMaterial); // this._addObject(points, false); - + // var lines = new LineSegments(pointsOfIntersection, new LineBasicMaterial({ // color: 0xa9a9a9 @@ -211,7 +219,7 @@ class TinLayer extends Layer { // let meshMaterial = new MeshBasicMaterial({ // color: 0xa9a9a9 // }); - + let a = new Vector3(), b = new Vector3(), @@ -224,127 +232,116 @@ class TinLayer extends Layer { lineCA = new Line3(); // let pointOfIntersection = new Vector3(); - // box.addEventListener("update", (event) => { - // let ar = new Array(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); - // this.planeGeom.setFromPoints(ar); - // this.planeGeom.update(); + box.addEventListener("update", (event) => { + let ar = new Array(this.box.vertices[12], this.box.vertices[13], this.box.vertices[14], this.box.vertices[15]); + this.planeGeom.setFromPoints(ar); + this.planeGeom.update(); - // this.borderGroup.clear(); - - // this.p_vertices = []; - // vertices = []; - - // let mathPlane = new Plane(); - // plane.localToWorld(planePointA.copy(plane.geometry.vertices[0])); - // plane.localToWorld(planePointB.copy(plane.geometry.vertices[1])); - // plane.localToWorld(planePointC.copy(plane.geometry.vertices[2])); - // mathPlane.setFromCoplanarPoints(planePointA, planePointB, planePointC); + self.xLocalPlane.constant = self.box.vertices[12].x; - // let geom = this.mainMesh.geometry; - // // this.mainMesh.geometry.faces.forEach(function (face) { - // for (let vi = 0; vi < geom.index.array.length; vi += 3) { + // this.borderGroup.clear(); - // let idx0 = geom.index.array[vi]; - // let idx1 = geom.index.array[vi + 1]; - // let idx2 = geom.index.array[vi + 2]; + // this.p_vertices = []; + // vertices = []; - // let vx0 = geom.attributes.position.array[3 * idx0]; - // let vy0 = geom.attributes.position.array[3 * idx0 + 1]; - // let vz0 = geom.attributes.position.array[3 * idx0 + 2]; + // let mathPlane = new Plane(); + // plane.localToWorld(planePointA.copy(plane.geometry.vertices[0])); + // plane.localToWorld(planePointB.copy(plane.geometry.vertices[1])); + // plane.localToWorld(planePointC.copy(plane.geometry.vertices[2])); + // mathPlane.setFromCoplanarPoints(planePointA, planePointB, planePointC); - // let vx1 = geom.attributes.position.array[3 * idx1]; - // let vy1 = geom.attributes.position.array[3 * idx1 + 1]; - // let vz1 = geom.attributes.position.array[3 * idx1 + 2]; - // let vx2 = geom.attributes.position.array[3 * idx2]; - // let vy2 = geom.attributes.position.array[3 * idx2 + 1]; - // let vz2 = geom.attributes.position.array[3 * idx2 + 2]; + // let geom = this.mainMesh.geometry; + // // this.mainMesh.geometry.faces.forEach(function (face) { + // for (let vi = 0; vi < geom.index.array.length; vi += 3) { - // let v0 = new Vector3(vx0, vy0, vz0); - // let v1 = new Vector3(vx1, vy1, vz1); - // let v2 = new Vector3(vx2, vy2, vz2); + // let idx0 = geom.index.array[vi]; + // let idx1 = geom.index.array[vi + 1]; + // let idx2 = geom.index.array[vi + 2]; - // this.mainMesh.localToWorld(a.copy(v0)); - // this.mainMesh.localToWorld(b.copy(v1)); - // this.mainMesh.localToWorld(c.copy(v2)); - // lineAB = new Line3(a, b); - // lineBC = new Line3(b, c); - // lineCA = new Line3(c, a); - // let p1 = this.setPointOfIntersection(lineAB, mathPlane, vi); - // let p2 = this.setPointOfIntersection(lineBC, mathPlane, vi); - // let p3 = this.setPointOfIntersection(lineCA, mathPlane, vi); - // // if (p1.x != 0 && p1.y != 0 && p1.z != 0 && p2.x != 0 && p2.y != 0 && p2.z != 0 && p3.x != 0 && p3.y != 0 && p3.z != 0) { - // // this.p_vertices.push(p1, p2, p3); - // // } + // let vx0 = geom.attributes.position.array[3 * idx0]; + // let vy0 = geom.attributes.position.array[3 * idx0 + 1]; + // let vz0 = geom.attributes.position.array[3 * idx0 + 2]; - // } - // if (this.p_vertices.length > 0) { - // // pointsOfIntersection.setFromPoints(p_vertices); - // // pointsOfIntersection.computeBoundingSphere() - // // pointsOfIntersection.attributes.position.needsUpdate = true; + // let vx1 = geom.attributes.position.array[3 * idx1]; + // let vy1 = geom.attributes.position.array[3 * idx1 + 1]; + // let vz1 = geom.attributes.position.array[3 * idx1 + 2]; - // // // convexGeometry.setFromPoints(p_vertices); - // // convexGeometry = new ConvexGeometry( p_vertices ); - // // convexGeometry.computeBoundingSphere() - // // convexGeometry.attributes.position.needsUpdate = true; + // let vx2 = geom.attributes.position.array[3 * idx2]; + // let vy2 = geom.attributes.position.array[3 * idx2 + 1]; + // let vz2 = geom.attributes.position.array[3 * idx2 + 2]; - // // let test = this.p_vertices.map(v => { - // // return [v.x, v.z]; - // // }); - // // // const indexHull = hull(test, 20); // returns points of the hull (in clockwise order) - // // const indexHull = concaveman(test, 1.5); - // // let vertices = indexHull.map(a => { - // // return new Vector3(a[0], this.p_vertices[0].y, a[1]); - // // }); - // // let cntrGeom = new BufferGeometry(); - // // cntrGeom.setFromPoints(vertices); - // // let contour = new Line(cntrGeom, new LineBasicMaterial({ - // // color: Math.random() * 0xffffff //0x777777 + 0x777777 - // // })); - // // this.borderGroup.add(contour); + // let v0 = new Vector3(vx0, vy0, vz0); + // let v1 = new Vector3(vx1, vy1, vz1); + // let v2 = new Vector3(vx2, vy2, vz2); - // // const indexAlpha = concaveman(test, 1); - // // let vertices = indexAlpha.map(a => { - // // return new Vector3(a[0], a[1], a[2]); - // // }); + // this.mainMesh.localToWorld(a.copy(v0)); + // this.mainMesh.localToWorld(b.copy(v1)); + // this.mainMesh.localToWorld(c.copy(v2)); + // lineAB = new Line3(a, b); + // lineBC = new Line3(b, c); + // lineCA = new Line3(c, a); + // let p1 = this.setPointOfIntersection(lineAB, mathPlane, vi); + // let p2 = this.setPointOfIntersection(lineBC, mathPlane, vi); + // let p3 = this.setPointOfIntersection(lineCA, mathPlane, vi); + // // if (p1.x != 0 && p1.y != 0 && p1.z != 0 && p2.x != 0 && p2.y != 0 && p2.z != 0 && p3.x != 0 && p3.y != 0 && p3.z != 0) { + // // this.p_vertices.push(p1, p2, p3); + // // } - // pointsOfIntersection.setFromPoints(this.p_vertices); - // pointsOfIntersection.computeBoundingSphere() - // pointsOfIntersection.attributes.position.needsUpdate = true; + // } + // if (this.p_vertices.length > 0) { + // // pointsOfIntersection.setFromPoints(p_vertices); + // // pointsOfIntersection.computeBoundingSphere() + // // pointsOfIntersection.attributes.position.needsUpdate = true; - // let contours = this.getContours(this.p_vertices, [], true); - // contours.forEach(cntr => { - // let cntrGeom = new BufferGeometry(); - // cntrGeom.setFromPoints(cntr); - // let contour = new Line(cntrGeom, new LineBasicMaterial({ - // color: Math.random() * 0xffffff //0x777777 + 0x777777 - // })); - // this.borderGroup.add(contour); - // }); - // } + // // // convexGeometry.setFromPoints(p_vertices); + // // convexGeometry = new ConvexGeometry( p_vertices ); + // // convexGeometry.computeBoundingSphere() + // // convexGeometry.attributes.position.needsUpdate = true; + + // // let test = this.p_vertices.map(v => { + // // return [v.x, v.z]; + // // }); + // // // const indexHull = hull(test, 20); // returns points of the hull (in clockwise order) + // // const indexHull = concaveman(test, 1.5); + // // let vertices = indexHull.map(a => { + // // return new Vector3(a[0], this.p_vertices[0].y, a[1]); + // // }); + // // let cntrGeom = new BufferGeometry(); + // // cntrGeom.setFromPoints(vertices); + // // let contour = new Line(cntrGeom, new LineBasicMaterial({ + // // color: Math.random() * 0xffffff //0x777777 + 0x777777 + // // })); + // // this.borderGroup.add(contour); + + // // const indexAlpha = concaveman(test, 1); + // // let vertices = indexAlpha.map(a => { + // // return new Vector3(a[0], a[1], a[2]); + // // }); + + // pointsOfIntersection.setFromPoints(this.p_vertices); + // pointsOfIntersection.computeBoundingSphere() + // pointsOfIntersection.attributes.position.needsUpdate = true; + + // let contours = this.getContours(this.p_vertices, [], true); + // contours.forEach(cntr => { + // let cntrGeom = new BufferGeometry(); + // cntrGeom.setFromPoints(cntr); + // let contour = new Line(cntrGeom, new LineBasicMaterial({ + // color: Math.random() * 0xffffff //0x777777 + 0x777777 + // })); + // this.borderGroup.add(contour); + // }); + // } - // }); - - - - // this.frontStencil = new Scene(); - // let frontMesh = new Mesh(this.geometry.clone(), material.frontStencilMaterial); - // frontMesh.userData.layerId = this.index; - // this.frontStencil.add(frontMesh); - - // this.backStencil = new Scene(); - // let backMesh = new Mesh(this.geometry.clone(), material.backStencilMaterial); - // backMesh.userData.layerId = this.index; - // this.backStencil.add(frontMesh); - - // this.capsScene = new Scene(); - // this.capsScene.add(this.borderMesh); + }); } - debugRenderOrder() { + + private debugRenderOrder() { console.log(this.name); } @@ -462,35 +459,6 @@ class TinLayer extends Layer { return index; } - - - // animate() { - // let gl = this._map.renderer.getContext(); - - // if (gl != undefined && this.capsScene != undefined) { - // gl.enable(gl.STENCIL_TEST); - // // this.renderer.state.setStencilFunc( true ); - // // gl.stencilFunc( gl.ALWAYS, 1, 0xff ); - // // gl.stencilOp( gl.REPLACE, gl.REPLACE, gl.REPLACE ); - - // gl.stencilFunc(gl.ALWAYS, 1, 0xff); - // gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); - // this._map.renderer.render(this.backStencil, this._map.camera); - - // gl.stencilFunc(gl.ALWAYS, 1, 0xff); - // gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); - // this._map.renderer.render(this.frontStencil, this._map.camera); - - // gl.stencilFunc(gl.EQUAL, 1, 0xff); - // gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - // this._map.renderer.render(this.capsScene, this._map.camera); - - - // // disable stencil test - // gl.disable(gl.STENCIL_TEST); - // } - // } - setWireframeMode(wireframe) { this.materialsArray.forEach(function (mat) { //if (m.w) return; @@ -508,14 +476,15 @@ class TinLayer extends Layer { scaleZ(z) { this.scale = z; - this.objectGroup.scale.z = z; + // this.objectGroup.scale.z = z; + this.mainMesh.scale.z = z; this.emit('scale-change', z); } async onAdd(map) { proj4.defs("EPSG:4312", "+proj=longlat +ellps=bessel +towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232 +no_defs"); proj4.defs("EPSG:3034", "+proj=lcc +lat_1=35 +lat_2=65 +lat_0=52 +lon_0=10 +x_0=4000000 +y_0=2800000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"); - await this.build(this.getScene()); + await this.build(this.getModelNode()); map.update(); } @@ -699,7 +668,7 @@ class TinLayer extends Layer { } - async build(app_scene) { + async build(modelNode) { let geometry = this.geometry = new BufferGeometry(); let vertices = await (this.points(this.featuregeom_id)); @@ -813,11 +782,23 @@ class TinLayer extends Layer { flatShading: true, side: DoubleSide, }, this.uniforms.clipping); - // }, this.uniforms.clipping); + + + // this.material = new MeshStandardMaterial({ + // color: color, + // metalness: 0.1, + // roughness: 0.75, + // flatShading: true, + // side: DoubleSide, + // clippingPlanes: [ this.xLocalPlane ] + // }); + + } this.materialsArray.push(this.material); let mesh = this.mainMesh = new Mesh(geometry, this.material); + mesh.name = this.name; mesh.userData.layerId = this.index; mesh.castShadow = true; mesh.receiveShadow = true; @@ -825,6 +806,9 @@ class TinLayer extends Layer { // if (app_scene) { // app_scene.add(this.objectGroup); // } + if (modelNode) { + modelNode.add(this.mainMesh); + } } private _addObject(object, queryable) { @@ -845,13 +829,13 @@ class TinLayer extends Layer { } async points(geomId) { - const url = POINTURL + geomId; + const url = this.pointUrl + geomId; const buffer = await this._request(url); return this._unpackVertices(buffer); } async edges(geomId) { - const url = EDGEURL + geomId; + const url = this.edgeUrl + geomId; const buffer = await this._request(url); return this._unpackEdges(buffer); } diff --git a/src/js/main.js b/src/js/main.js index 4e9d942..21f3907 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -21,8 +21,7 @@ import * as domUtil from './core/domUtil'; import { PickingTool } from './clip/PickingTool'; import { ShowModal } from './components/ShowModal'; import * as material from './clip/material'; -import { Group } from 'three/src/objects/Group'; - +import { Color } from 'three/src/math/Color'; import { Selection } from './clip/Selection'; import _ from "lodash"; @@ -65,9 +64,9 @@ class Application { let parentContainer = document.getElementById("app"); this.dialog = new ShowModal("Help", parentContainer, { klass: "fm_about" }); - // this.dialog = new MobileDialog("Help", container, { klass: "fm_about" }); this.aboutIcon = document.querySelector('#menu-about-icon'); - // this.createScene(); + this.menuEmailButton = document.querySelector('#menu-email-button'); + // this.addEventListeners(); } async build() { @@ -94,6 +93,11 @@ class Application { } + debugRenderOrder() { + + console.log(this.name); + } + async createScene() { let dirNode = document.getElementsByTagName("body")[0]; if (browser.touch == true && browser.mobile == true) { @@ -175,91 +179,106 @@ class Application { // this.camera.position.set(0, -0.1, 150); // this.camera.lookAt(new Vector3(0, 0, 0)); + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + let modelid = 20; + let serviceUrl = 'https://geusegdi01.geus.dk/meta3d/rpc/model_meta_all?modelid='; + if (urlParams.has('modelid')) { + modelid = urlParams.get('modelid'); + } + if (SERVICE_URL != "") { + serviceUrl = SERVICE_URL; + } let map = this.map = await Map.build( this.scene, this.container, - 'https://geusegdi01.geus.dk/meta3d/rpc/model_meta_all?modelid=20' + serviceUrl + modelid ); this.mapTitle = document.querySelector('#map-title'); this.mapTitle.innerHTML += map.title; + this.menuEmailButton.href = 'mailto:' + map.contact; + map.on('ready', () => { this.selectionBox.setUniforms(); - - // this.capsScene.add(this.selectionBox.boxMesh); // this.scene.add(this.selection.displayMeshes); // this.scene.add(this.selection.touchMeshes); + this.map.addLayer(this.selectionBox); - - let modelNode = new Group(); - let profileNode = new Group(); - let stencilNode = new Group(); + // this.selectionBox.toggle(); + for (const [i, layer] of Object.entries(this.map.layers)) { // let layer = map.layers[i]; if (layer instanceof TinLayer && layer.name != "Topography") { - modelNode.add(layer.mainMesh); - // this.capsScene.add(layer.borderMesh); - profileNode.add(layer.borderMesh); + // modelNode.add(layer.mainMesh); - // const stencilMaterial = material.stencilMaterial.clone(); + // let f_color = parseInt(layer.color, 16); + // let featureMaterial = this.material = new MyMeshStandardMaterial({ + // color: f_color, + // metalness: 0.1, + // roughness: 0.75, + // flatShading: true, + // side: DoubleSide, + // }, uniforms.clipping); + // featureMaterial.color = new Color(f_color); + // // featureMaterial.clippingPlanes[0] = layer.xLocalPlane; - let stencilFeatureBack = new Mesh(layer.geometry, material.backStencilMaterial.clone()); + // let volume = new Mesh(layer.geometry, featureMaterial); + // // featureMaterial.clippingPlanes[0] = layer.yLocalPlane; + // // featureMaterial.clipIntersection = false; + // volume.name = layer.name + i; + // map.modelNode.add(volume); + // volume.onAfterRender = this.debugRenderOrder; + + + let backStencilMaterial = material.backStencilMaterial; + let stencilFeatureBack = new Mesh(layer.geometry, backStencilMaterial); stencilFeatureBack.name = 'stencilFeatureBack_' + i; stencilFeatureBack.userData.layerId = layer.index; - stencilNode.add(stencilFeatureBack); + // backStencilMaterial.clippingPlanes[0] = layer.xLocalPlane; + map.stencilNode.add(stencilFeatureBack); + // stencilFeatureBack.onAfterRender = this.debugRenderOrder; - let stencilFeatureFront = new Mesh(layer.geometry, material.frontStencilMaterial.clone()); + + let frontStencilMaterial = material.frontStencilMaterial; + let stencilFeatureFront = new Mesh(layer.geometry, frontStencilMaterial); stencilFeatureFront.name = 'stencilFeatureFront_' + i; stencilFeatureFront.userData.layerId = layer.index; - stencilNode.add(stencilFeatureFront); + // frontStencilMaterial.clippingPlanes[0] = layer.xLocalPlane; + map.stencilNode.add(stencilFeatureFront); + // stencilFeatureFront.onAfterRender = this.debugRenderOrder; + + // this.capsScene.add(layer.borderMesh); + // profileNode.add(layer.borderMesh); + // layer.borderMesh.onAfterRender = this.debugRenderOrder; + let profileMaterial = material.profileMaterial.clone(); + let color = parseInt(layer.color, 16); + profileMaterial.color = new Color(color); + // profileMaterial.uniforms = caps; + let borderMesh = new Mesh(layer.box, profileMaterial); + // this.borderMesh.name = 'stencilFeatureBack_' + this.index; + borderMesh.name = 'profilePlane_' + i; + map.profileNode.add(borderMesh); + // borderMesh.onAfterRender = this.debugRenderOrder; + layer.on('visibility-change', (args) => { let visible = args[0]; stencilFeatureFront.visible = visible; stencilFeatureBack.visible = visible; - layer.borderMesh.visible = visible; + borderMesh.visible = visible; }); layer.on('scale-change', (args) => { let z = args[0]; stencilFeatureFront.scale.z = z; stencilFeatureBack.scale.z = z; - layer.borderMesh.scale.z = z; + borderMesh.scale.z = z; }); } - } - // this.scene.add(profileNode); + } - // for (var i in map.layers) { - // let layer = map.layers[i]; - // if (layer instanceof TinLayer && layer.name != "Topography") { - // let stencilFeatureBack = new Mesh(layer.geometry, material.backStencilMaterial); - // stencilFeatureBack.name = 'stencilFeatureBack_' + i; - // stencilFeatureBack.userData.layerId = layer.index; - // stencilNode.add(stencilFeatureBack); - - // let stencilFeatureFront = new Mesh(layer.geometry, material.frontStencilMaterial); - // stencilFeatureFront.name = 'stencilFeatureFront_' + i; - // stencilFeatureFront.userData.layerId = layer.index; - // stencilNode.add(stencilFeatureFront); - // layer.on('visibility-change', (args) => { - // let visible = args[0]; - // stencilFeatureFront.visible = visible; - // stencilFeatureBack.visible = visible; - // }); - // layer.on('scale-change', (args) => { - // let z = args[0]; - // stencilFeatureFront.scale.z = z; - // stencilFeatureBack.scale.z = z; - // }); - // } - // } - - // scene.add(node('selectNode')); - this.scene.add(modelNode); - this.scene.add(stencilNode); - this.scene.add(profileNode); this.animate(); }, this); @@ -398,7 +417,7 @@ class Application { // if (this.showCaps && gl != undefined) { // // enable stencil test - // gl.enable(gl.STENCIL_TEST); + // gl.enable(gl.STENCIL_TEST); // // for (let i in this.map.layers) { // // let layer = this.map.layers[i]; @@ -421,7 +440,7 @@ class Application { // this.renderer.render(this.capsScene, this.map.camera); // // disable stencil test - // gl.disable(gl.STENCIL_TEST); + // gl.disable(gl.STENCIL_TEST); // // gl.stencilMask(0); // // this.renderer.state.setStencilFunc( false ); // } diff --git a/src/js/tasks/BoreholeIdentify.js b/src/js/tasks/BoreholeIdentify.js index 5b16992..2191f48 100644 --- a/src/js/tasks/BoreholeIdentify.js +++ b/src/js/tasks/BoreholeIdentify.js @@ -136,14 +136,14 @@ export class BoreholeIdentify { //}; // create a highlight object (if layer type is Point, slightly bigger than the object) - var highlightObject = new THREE.Group(); + // var highlightObject = new THREE.Group(); //var clone; //var s = (layer.type == Q3D.LayerType.Point) ? 1.01 : 1; var geo = new THREE.Geometry(); - var v1 = new THREE.Vector3(f.Punkt0.x, f.Punkt0.y, f.Punkt0.z); - var v2 = new THREE.Vector3(f.Punkt1.x, f.Punkt1.y, f.Punkt1.z); - var v3 = new THREE.Vector3(f.Punkt2.x, f.Punkt2.y, f.Punkt2.z); + var v1 = new Vector3(f.Punkt0.x, f.Punkt0.y, f.Punkt0.z); + var v2 = new Vector3(f.Punkt1.x, f.Punkt1.y, f.Punkt1.z); + var v3 = new Vector3(f.Punkt2.x, f.Punkt2.y, f.Punkt2.z); geo.vertices.push(v1); geo.vertices.push(v2); geo.vertices.push(v3); diff --git a/webpack.config.js b/webpack.config.js index 48b0a4c..3cabe47 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -155,6 +155,10 @@ module.exports = { CONSTANT_VALUE: JSON.stringify(process.env.CONSTANT_VALUE), MATOMO_SITE_ID: JSON.stringify(process.env.MATOMO_SITE_ID), MATOMO_TRACKER_URL: JSON.stringify(process.env.MATOMO_TRACKER_URL), + SERVICE_URL : JSON.stringify(process.env.SERVICE_URL), + POINT_URL : JSON.stringify(process.env.POINT_URL), + EDGE_URL : JSON.stringify(process.env.EDGE_URL), + CUSTOM_VAR: JSON.stringify('value5 goes here'), // no quotes needed, string value }), // extractLess,