From 8b4ace6763dbcae1f32a68f2fb72148a9496064e Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Thu, 11 Feb 2021 15:33:05 +0100 Subject: [PATCH] - uninstall less-loader - trial: local clipping planes for DemLayer and TinLayer via material parameter - start with selcetion boxes for interactive clipping: SelectionBoxFace.js - main.js: this.renderer.localClippingEnabled = true; --- index.html | 12 +- package-lock.json | 443 ------------------------------- package.json | 1 - src/js/clip/SelectionBoxFace.js | 42 +++ src/js/controls/SlicerControl.js | 77 ++++++ src/js/layer/DemLayer.js | 25 +- src/js/layer/TinLayer.js | 16 +- src/js/main.js | 35 ++- 8 files changed, 176 insertions(+), 475 deletions(-) create mode 100644 src/js/clip/SelectionBoxFace.js create mode 100644 src/js/controls/SlicerControl.js diff --git a/index.html b/index.html index 42a29ad..f8c917e 100644 --- a/index.html +++ b/index.html @@ -50,7 +50,8 @@
@@ -66,7 +67,7 @@ -->
  • - + About @@ -121,6 +122,13 @@ Download + +
    +
    +
    +
    +
    +
  • diff --git a/package-lock.json b/package-lock.json index 49c44cc..5a615ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,6 @@ "dotenv": "^8.2.0", "file-loader": "^6.2.0", "img-loader": "^3.0.2", - "less-loader": "^7.1.0", "mini-css-extract-plugin": "^1.3.1", "node-sass": "^5.0.0", "resolve-url-loader": "^3.1.2", @@ -2093,16 +2092,6 @@ "safe-buffer": "~5.1.1" } }, - "node_modules/copy-anything": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.3.tgz", - "integrity": "sha512-GK6QUtisv4fNS+XcI7shX0Gx9ORg7QqIznyfho79JTnX1XhLiyZHfftvGiziqzRiEi/Bjhgpi+D2o7HxJFPnDQ==", - "dev": true, - "peer": true, - "dependencies": { - "is-what": "^3.12.0" - } - }, "node_modules/core-js-compat": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.8.3.tgz", @@ -2464,20 +2453,6 @@ "node": ">=4" } }, - "node_modules/errno": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", - "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "prr": "~1.0.1" - }, - "bin": { - "errno": "cli.js" - } - }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -3193,20 +3168,6 @@ "node": ">=10.17.0" } }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/icss-utils": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", @@ -3229,20 +3190,6 @@ "node": ">= 4" } }, - "node_modules/image-size": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", - "integrity": "sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=", - "dev": true, - "optional": true, - "peer": true, - "bin": { - "image-size": "bin/image-size.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/imagemin": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/imagemin/-/imagemin-7.0.1.tgz", @@ -3438,13 +3385,6 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, - "node_modules/is-what": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.12.0.tgz", - "integrity": "sha512-2ilQz5/f/o9V7WRWJQmpFYNmQFZ9iM+OXRonZKcYgTkCzjb949Vi4h282PD1UfmgHk666rcWonbRJ++KI41VGw==", - "dev": true, - "peer": true - }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -3619,131 +3559,6 @@ "node": ">= 8" } }, - "node_modules/less": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/less/-/less-4.1.1.tgz", - "integrity": "sha512-w09o8tZFPThBscl5d0Ggp3RcrKIouBoQscnOMgFH3n5V3kN/CXGHNfCkRPtxJk6nKryDXaV9aHLK55RXuH4sAw==", - "dev": true, - "peer": true, - "dependencies": { - "copy-anything": "^2.0.1", - "errno": "^0.1.1", - "graceful-fs": "^4.1.2", - "image-size": "~0.5.0", - "make-dir": "^2.1.0", - "mime": "^1.4.1", - "needle": "^2.5.2", - "parse-node-version": "^1.0.1", - "source-map": "~0.6.0", - "tslib": "^1.10.0" - }, - "bin": { - "lessc": "bin/lessc" - }, - "engines": { - "node": ">=6" - }, - "optionalDependencies": { - "errno": "^0.1.1", - "graceful-fs": "^4.1.2", - "image-size": "~0.5.0", - "make-dir": "^2.1.0", - "mime": "^1.4.1", - "needle": "^2.5.2", - "source-map": "~0.6.0" - } - }, - "node_modules/less-loader": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-7.3.0.tgz", - "integrity": "sha512-Mi8915g7NMaLlgi77mgTTQvK022xKRQBIVDSyfl3ErTuBhmZBQab0mjeJjNNqGbdR+qrfTleKXqbGI4uEFavxg==", - "dev": true, - "dependencies": { - "klona": "^2.0.4", - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "less": "^3.5.0 || ^4.0.0", - "webpack": "^4.0.0 || ^5.0.0" - } - }, - "node_modules/less-loader/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" - } - }, - "node_modules/less-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==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/less/node_modules/make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/less/node_modules/pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true, - "optional": true, - "peer": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/less/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, - "optional": true, - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -3948,20 +3763,6 @@ "node": ">=8" } }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true, - "optional": true, - "peer": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/mime-db": { "version": "1.45.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", @@ -4124,36 +3925,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/needle": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz", - "integrity": "sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - }, - "bin": { - "needle": "bin/needle" - }, - "engines": { - "node": ">= 4.4.x" - } - }, - "node_modules/needle/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "ms": "^2.1.1" - } - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -4493,16 +4264,6 @@ "node": ">=4" } }, - "node_modules/parse-node-version": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -4729,14 +4490,6 @@ "wkt-parser": "^1.2.4" } }, - "node_modules/prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -5334,14 +5087,6 @@ } } }, - "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true, - "optional": true, - "peer": true - }, "node_modules/schema-utils": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", @@ -8211,16 +7956,6 @@ "safe-buffer": "~5.1.1" } }, - "copy-anything": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.3.tgz", - "integrity": "sha512-GK6QUtisv4fNS+XcI7shX0Gx9ORg7QqIznyfho79JTnX1XhLiyZHfftvGiziqzRiEi/Bjhgpi+D2o7HxJFPnDQ==", - "dev": true, - "peer": true, - "requires": { - "is-what": "^3.12.0" - } - }, "core-js-compat": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.8.3.tgz", @@ -8486,17 +8221,6 @@ "integrity": "sha512-TQXTYFVVwwluWSFis6K2XKxgrD22jEv0FTuLCQI+OjH7rn93+iY0fSSFM5lrSxFY+H1+B0/cvvlamr3UsBivdQ==", "dev": true }, - "errno": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", - "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "prr": "~1.0.1" - } - }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -9059,17 +8783,6 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, "icss-utils": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", @@ -9084,14 +8797,6 @@ "dev": true, "peer": true }, - "image-size": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", - "integrity": "sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=", - "dev": true, - "optional": true, - "peer": true - }, "imagemin": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/imagemin/-/imagemin-7.0.1.tgz", @@ -9242,13 +8947,6 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, - "is-what": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.12.0.tgz", - "integrity": "sha512-2ilQz5/f/o9V7WRWJQmpFYNmQFZ9iM+OXRonZKcYgTkCzjb949Vi4h282PD1UfmgHk666rcWonbRJ++KI41VGw==", - "dev": true, - "peer": true - }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -9389,90 +9087,6 @@ "integrity": "sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA==", "dev": true }, - "less": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/less/-/less-4.1.1.tgz", - "integrity": "sha512-w09o8tZFPThBscl5d0Ggp3RcrKIouBoQscnOMgFH3n5V3kN/CXGHNfCkRPtxJk6nKryDXaV9aHLK55RXuH4sAw==", - "dev": true, - "peer": true, - "requires": { - "copy-anything": "^2.0.1", - "errno": "^0.1.1", - "graceful-fs": "^4.1.2", - "image-size": "~0.5.0", - "make-dir": "^2.1.0", - "mime": "^1.4.1", - "needle": "^2.5.2", - "parse-node-version": "^1.0.1", - "source-map": "~0.6.0", - "tslib": "^1.10.0" - }, - "dependencies": { - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true, - "optional": true, - "peer": true - }, - "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, - "optional": true, - "peer": true - } - } - }, - "less-loader": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-7.3.0.tgz", - "integrity": "sha512-Mi8915g7NMaLlgi77mgTTQvK022xKRQBIVDSyfl3ErTuBhmZBQab0mjeJjNNqGbdR+qrfTleKXqbGI4uEFavxg==", - "dev": true, - "requires": { - "klona": "^2.0.4", - "loader-utils": "^2.0.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==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - } - } - }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -9635,14 +9249,6 @@ "picomatch": "^2.0.5" } }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true, - "optional": true, - "peer": true - }, "mime-db": { "version": "1.45.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", @@ -9760,32 +9366,6 @@ "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", "dev": true }, - "needle": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz", - "integrity": "sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "optional": true, - "peer": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -10041,13 +9621,6 @@ "json-parse-better-errors": "^1.0.1" } }, - "parse-node-version": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", - "dev": true, - "peer": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -10210,14 +9783,6 @@ "wkt-parser": "^1.2.4" } }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true, - "optional": true, - "peer": true - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -10677,14 +10242,6 @@ "neo-async": "^2.6.2" } }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true, - "optional": true, - "peer": true - }, "schema-utils": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", diff --git a/package.json b/package.json index 9beff06..28703dd 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "dotenv": "^8.2.0", "file-loader": "^6.2.0", "img-loader": "^3.0.2", - "less-loader": "^7.1.0", "mini-css-extract-plugin": "^1.3.1", "node-sass": "^5.0.0", "resolve-url-loader": "^3.1.2", diff --git a/src/js/clip/SelectionBoxFace.js b/src/js/clip/SelectionBoxFace.js new file mode 100644 index 0000000..0d65f59 --- /dev/null +++ b/src/js/clip/SelectionBoxFace.js @@ -0,0 +1,42 @@ +import { Mesh } from 'three/src/objects/Mesh'; + +export class SelectionBoxFace { + + constructor(axis, v0, v1, v2, v3, selection) { + + let frontFaceGeometry = new PlaneGeometry(v0, v1, v2, v3); + frontFaceGeometry.dynamic = true; + selection.meshGeometries.push(frontFaceGeometry); + + let frontFaceMesh = new Mesh(frontFaceGeometry, MATERIAL.Invisible); + frontFaceMesh.axis = axis; + frontFaceMesh.guardian = this; + selection.touchMeshes.add(frontFaceMesh); + selection.selectables.push(frontFaceMesh); + + let backFaceGeometry = new PlaneGeometry(v3, v2, v1, v0); + backFaceGeometry.dynamic = true; + selection.meshGeometries.push(backFaceGeometry); + + let backFaceMesh = new Mesh(backFaceGeometry, MATERIAL.BoxBackFace); + selection.displayMeshes.add(backFaceMesh); + + this.lines = new Array(); + + } + + rayOver() { + this.highlightLines(true); + } + + rayOut() { + this.highlightLines(false); + } + + highlightLines(b) { + for (let i = 0; i < this.lines.length; i++) { + this.lines[i].setHighlight(b); + } + } + +} \ No newline at end of file diff --git a/src/js/controls/SlicerControl.js b/src/js/controls/SlicerControl.js new file mode 100644 index 0000000..476c120 --- /dev/null +++ b/src/js/controls/SlicerControl.js @@ -0,0 +1,77 @@ +import { Control } from "./Control"; +import * as dom from '../core/domUtil'; +import * as util from '../core/utilities'; +import * as domEvent from '../core/domEvent'; + +export class SlicerControl extends Control { + + options = { + position: 'topright' + }; + map; + + constructor(options) { + super(options); + util.setOptions(this, options); + } + + onAdd(map) { + this.map = map; + let className = "gba-controllayers"; + let container; + let toggleable = false; + + if (this.options.parentDiv) { + container = this._container = document.getElementById(this.options.parentDiv); + dom.addClass(container, className); + toggleable = false; + } else { + container = this._container = dom.createDom("div", { "class": className }); + toggleable = true; + } + + this._initLayout(container); + + + + if (!this.options.parentDiv) { + return container; + } + } + + _initLayout(container) { + this._slicerMenu = dom.createDom('div', { id: "range-slider", "class": 'gba-slicer-menu' }, container); + dom.createDom("span", { innerHTML: "SLICER", "class": "gbaLegendServiceLabel" }, this._slicerMenu); + + let table = dom.createDom('table', { width: "95%" }, this._slicerMenu); + let tblBody = dom.createDom("tbody", {}, table); + + let sliderValue1 = Math.round(this.map.width / 2); + let row = dom.createDom("tr", {}, tblBody); + let leftTd = dom.createDom("td", { align: "left", style: "width:20px;" }, row); + dom.createDom("span", { innerHTML: "x", }, leftTd); + let rightTd = dom.createDom("td", { align: "left" }, row); + // this.slider = new RangeSlider({ + // orientation: "vertical", + // value: sliderValue1, + // max: this.map.x.max, + // min: this.map.x.min, + // id: "slider1" + // }); + // this.slider.addTo(rightTd); + let btnSlice = dom.createDom("span", { innerHTML: "slice", class: "button button-primary" }, rightTd); + domEvent.on(btnSlice, 'mousedown', domEvent.stopPropagation); + domEvent.on(btnSlice, 'click', domEvent.stopPropagation); + domEvent.on(btnSlice, 'dblclick', domEvent.stopPropagation); + domEvent.on(btnSlice, 'mousedown', domEvent.preventDefault); + domEvent.on(btnSlice, 'mousedown', this._slice, this); + } + + _slice() { + let x = 4471470; + this.map.currentBasemap.filterMaterial(x, this.map.y.max); + this.map.layers[16].filterMaterial(x, this.map.y.max); + this.map.update(); + } + +} \ No newline at end of file diff --git a/src/js/layer/DemLayer.js b/src/js/layer/DemLayer.js index 40fa779..4723a0d 100644 --- a/src/js/layer/DemLayer.js +++ b/src/js/layer/DemLayer.js @@ -11,7 +11,8 @@ import { DoubleSide, FlatShading, LinearFilter } from 'three/src/constants'; import * as browser from '../core/browser'; import { Texture } from 'three/src/textures/Texture'; import { TextureLoader } from 'three/src/loaders/TextureLoader'; - +import { Plane } from 'three/src/math/Plane'; +import { Vector3 } from 'three/src/math/Vector3'; export class DemLayer extends Layer { images = [{ @@ -59,9 +60,9 @@ export class DemLayer extends Layer { async initMaterials() { if (this.materialParameter.length === 0) return; - // this.xLocalPlane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 50); - // //this.addObject(this.xLocalPlane, false); - // this.yLocalPlane = new THREE.Plane(new THREE.Vector3(0, 1, 0), 39); + this.xLocalPlane = new Plane(new Vector3(-1, 0, 0), this._map.x.max); + //this.addObject(this.xLocalPlane, false); + this.yLocalPlane = new Plane(new Vector3(0, 1, 0), this._map.y.max); let sum_opacity = 0; this.material; @@ -96,10 +97,10 @@ export class DemLayer extends Layer { if (m.w) opt.wireframe = true; //opt.wireframe = true; - // // Clipping setup: - // opt.clippingPlanes = [this.xLocalPlane, this.yLocalPlane]; - // opt.clipIntersection = false; - // opt.clipShadows = true; + // Clipping setup: + opt.clippingPlanes = [this.xLocalPlane, this.yLocalPlane]; + opt.clipIntersection = false; + opt.clipShadows = true; let MaterialType = { MeshLambert: 0, MeshPhong: 1, LineBasic: 2, Sprite: 3, Unknown: -1 }; @@ -134,6 +135,12 @@ export class DemLayer extends Layer { this.opacity = sum_opacity / this.materials.length; } + + filterMaterial(filterX, filterY) { + this.xLocalPlane.constant = filterX; + this.yLocalPlane.constant = filterY; + } + scaleZ(z) { // this.mainMesh.scale.z = z; this.objectGroup.scale.z = z; @@ -188,7 +195,7 @@ export class DemLayer extends Layer { const textureLoader = new TextureLoader(); return new Promise((resolve, reject) => { textureLoader.load( - texturePath, + texturePath, (texture) => resolve(texture), undefined, err => reject(err) diff --git a/src/js/layer/TinLayer.js b/src/js/layer/TinLayer.js index 767dc1b..9e17bcf 100644 --- a/src/js/layer/TinLayer.js +++ b/src/js/layer/TinLayer.js @@ -6,6 +6,8 @@ import { DoubleSide } from 'three/src/constants'; import { Mesh } from 'three/src/objects/Mesh'; import { Layer } from './Layer'; import { BitStream } from '../lib/bitstream'; +import { Plane } from 'three/src/math/Plane'; +import { Vector3 } from 'three/src/math/Vector3'; const POINTURL = 'https://geusegdi01.geus.dk/geom3d/data/nodes/'; const EDGEURL = 'https://geusegdi01.geus.dk/geom3d/data/triangles/'; @@ -78,13 +80,20 @@ class TinLayer extends Layer { geometry.computeVertexNormals();// computed vertex normals are orthogonal to the face f geometry.computeBoundingBox(); + this.xLocalPlane = new Plane(new Vector3(-1, 0, 0), this._map.x.max); + //this.addObject(this.xLocalPlane, false); + this.yLocalPlane = new Plane(new Vector3(0, 1, 0), this._map.y.max); + let color = parseInt(this.color, 16); this.material = new MeshStandardMaterial({ color: color, metalness: 0.1, roughness: 0.75, flatShading: true, - side: DoubleSide + side: DoubleSide, + clippingPlanes: [this.xLocalPlane, this.yLocalPlane], + clipIntersection: false, + clipShadows: true, }); this.materialsArray.push(this.material); let mesh = this.mainMesh = new Mesh(geometry, this.material); @@ -96,6 +105,11 @@ class TinLayer extends Layer { } } + filterMaterial(filterX, filterY) { + this.xLocalPlane.constant = filterX; + this.yLocalPlane.constant = filterY; + } + async points(geomId) { const url = POINTURL + geomId; diff --git a/src/js/main.js b/src/js/main.js index 04f4bb7..307b7d3 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -14,6 +14,7 @@ import { NorthArrow } from './controls/NorthArrow'; import { LayerControl } from './controls/LayerControl'; import { BasemapControl } from './controls/BasemapControl'; import { SliderControl } from './controls/SliderControl'; +// import { SlicerControl } from './controls/SlicerControl'; import { Mesh } from 'three/src/objects/Mesh'; import { SphereGeometry } from 'three/src/geometries/SphereGeometry'; import { MeshLambertMaterial } from 'three/src/materials/MeshLambertMaterial'; @@ -88,22 +89,17 @@ class Application { // let bgcolor = 0xfdfdfd; this.renderer = new WebGLRenderer({ alpha: true, antialias: true, preserveDrawingBuffer: true }); this.renderer.setPixelRatio(window.devicePixelRatio); - // this.renderer.setSize(window.innerWidth, window.innerHeight); - // document.body.appendChild(this.renderer.domElement); this.renderer.setSize(this.width, this.height); - //this.renderer.setClearColor(bgcolor, 1); // second param is opacity, 0 => transparent - this.renderer.setClearColor(0x000000, 0.0); + this.renderer.setClearColor(0x000000, 0.0); // second param is opacity, 0 => transparent + // enable clipping // let Empty = Object.freeze([]); // this.renderer.clippingPlanes = Empty; // GUI sets it to globalPlanes - // this.renderer.localClippingEnabled = true; + this.renderer.localClippingEnabled = true; this.container.appendChild(this.renderer.domElement); /* Scene: that will hold all our elements such as objects, cameras and lights. */ this.scene = new Scene(); - //app.scene.add(new THREE.AmbientLight(0xeeeeee)); - // const ambient = new AmbientLight( 0xffffff, 0.5 ); - // this.scene.add(ambient); this._buildDefaultLights(this.scene); //app.scene.autoUpdate = false; //// show axes in the screen @@ -128,15 +124,15 @@ class Application { // let y = { min: 2182271.6538, max: 2504028.3462 , avg: 2302070 }; // let z = { min: -60066, max: 3574.94, avg: -13616.3 }; - let x = { min: 4415940, max: 4508490, avg: 4463200 }; + let x = { min: 4415940, max: 4508490, avg: 4463200 }; // let y = { min: 2351480, max: 2475820 , avg: 2412610 }; - let y = { min: 2351229.9140, max: 2476070.0860 , avg: 2412610 }; + let y = { min: 2351229.9140, max: 2476070.0860, avg: 2412610 }; let z = { min: -8798.15, max: 1401.92, avg: -155.17 }; const center = new Vector3((x.min + x.max) / 2, (y.min + y.max) / 2, 0); // const center = new Vector3(x.avg, y.avg, z.avg); - const size = Math.max(x.max - x.min, y.max - y.min, z.max - z.min); - let baseExtent= { + const size = Math.max(x.max - x.min, y.max - y.min, z.max - z.min); + let baseExtent = { x: x, y: y }; @@ -144,8 +140,8 @@ class Application { const camDirection = new Vector3(-0.5, -Math.SQRT1_2, 0.5); // const camDirection = new Vector3(0, 0, 1); const camOffset = camDirection.multiplyScalar(size * 2); - this.camera.position.copy(center); - this.camera.position.add(camOffset); + this.camera.position.copy(center); + this.camera.position.add(camOffset); this.camera.near = size * 0.1; this.camera.far = size * 25; this.camera.updateProjectionMatrix(); @@ -167,8 +163,6 @@ class Application { let map = this.map = await Map.build(x, y, z, center, this.camera, this.scene, this.container, 'https://geusegdi01.geus.dk/meta3d/rpc/model_meta_all?modelid=20'); this.mapTitle = document.querySelector('#map-title'); this.mapTitle.innerHTML += map.title; - // this.map.minDistance = size*0.75; - // this.map.maxDistance = size*15; // let boxLayer = new BoxLayer({ // width: 10000, height: 10000, depth: 10000, name: 'center-box', color: 800080 , center: center @@ -193,9 +187,9 @@ class Application { "i": 0, "materialtypee": 0, "ds": 1, - "bottomZ": 3000, + "bottomZ": 3000, }] - }); + }); demLayer.addBlock({ "width": 173, //267, "plane": { @@ -214,7 +208,7 @@ class Application { this.map.addLayer(demLayer); this.map.currentBasemap = demLayer; - this.gridlayer = new GridLayer({ center: center, name: "coordinate grid", appWidth: this.width, appHeight: this.height }); + this.gridlayer = new GridLayer({ center: center, name: "coordinate grid", appWidth: this.width, appHeight: this.height }); this.map.addLayer(this.gridlayer); new LayerControl(this.map.layers, { @@ -229,6 +223,9 @@ class Application { //slider for scaling z value this.slider = new SliderControl({ layers: this.map.layers }).addTo(this.map); + //slice on x and y axes: + // this.slicer = new SlicerControl({ parentDiv: 'slicer-control' }).addTo(this.map); + // domEvent.on(window, 'resize', this.onWindowResize, this); // domEvent.on(window, 'keydown', this.keydown, this); this.start();