From bec7c4776d3374613c031111400a48ad57e5fc4e Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 3 Mar 2021 08:55:03 +0100 Subject: [PATCH] - async loading data layers in Map.js class --- package-lock.json | 508 +++++++++++++++++++++++++++++++++------ package.json | 2 +- src/js/clip/Picking.js | 4 + src/js/clip/Selection.js | 24 +- src/js/core/Map.js | 301 +++++++++++------------ src/js/layer/Layer.js | 4 +- src/js/layer/TinLayer.js | 3 + src/js/main.js | 15 +- 8 files changed, 619 insertions(+), 242 deletions(-) diff --git a/package-lock.json b/package-lock.json index 251b897..b0e29de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@babel/plugin-transform-runtime": "^7.12.1", "@babel/preset-env": "^7.12.7", "babel-loader": "^8.2.1", - "concurrently": "^5.3.0", + "concurrently": "^6.0.0", "css-loader": "^5.0.1", "dotenv": "^8.2.0", "file-loader": "^6.2.0", @@ -1374,6 +1374,12 @@ "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", "dev": true }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", + "dev": true + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz", @@ -2154,38 +2160,225 @@ "dev": true }, "node_modules/concurrently": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.3.0.tgz", - "integrity": "sha512-8MhqOB6PWlBfA2vJ8a0bSFKATOdWlHiQlk11IfmQBPaHVP8oP2gsh2MObE6UR3hqDHqvaIvLTyceNW6obVuFHQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.0.0.tgz", + "integrity": "sha512-Ik9Igqnef2ONLjN2o/OVx1Ow5tymVvvEwQeYCQdD/oV+CN9oWhxLk7ibcBdOtv0UzBqHCEKRwbKceYoTK8t3fQ==", "dev": true, "dependencies": { - "chalk": "^2.4.2", - "date-fns": "^2.0.1", - "lodash": "^4.17.15", - "read-pkg": "^4.0.1", - "rxjs": "^6.5.2", + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.20", + "read-pkg": "^5.2.0", + "rxjs": "^6.6.3", "spawn-command": "^0.0.2-1", - "supports-color": "^6.1.0", + "supports-color": "^8.1.0", "tree-kill": "^1.2.2", - "yargs": "^13.3.0" + "yargs": "^16.2.0" }, "bin": { "concurrently": "bin/concurrently.js" }, "engines": { - "node": ">=6.0.0" + "node": ">=10.0.0" + } + }, + "node_modules/concurrently/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/concurrently/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/concurrently/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concurrently/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/concurrently/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/concurrently/node_modules/supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/concurrently/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/concurrently/node_modules/yargs-parser": { + "version": "20.2.6", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", + "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==", + "dev": true, + "engines": { + "node": ">=10" } }, "node_modules/console-control-strings": { @@ -3541,6 +3734,12 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "node_modules/json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -3617,6 +3816,12 @@ "node": ">= 8" } }, + "node_modules/lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "node_modules/load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -4295,16 +4500,21 @@ } }, "node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "dependencies": { + "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" }, "engines": { - "node": ">=4" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/path-exists": { @@ -4369,15 +4579,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -4588,17 +4789,18 @@ } }, "node_modules/read-pkg": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", - "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, "dependencies": { - "normalize-package-data": "^2.3.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0" + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" }, "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/read-pkg-up": { @@ -5746,6 +5948,15 @@ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", "dev": true }, + "node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", @@ -7471,6 +7682,12 @@ "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", "dev": true }, + "@types/normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", + "dev": true + }, "@webassemblyjs/ast": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz", @@ -8116,30 +8333,168 @@ "dev": true }, "concurrently": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.3.0.tgz", - "integrity": "sha512-8MhqOB6PWlBfA2vJ8a0bSFKATOdWlHiQlk11IfmQBPaHVP8oP2gsh2MObE6UR3hqDHqvaIvLTyceNW6obVuFHQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.0.0.tgz", + "integrity": "sha512-Ik9Igqnef2ONLjN2o/OVx1Ow5tymVvvEwQeYCQdD/oV+CN9oWhxLk7ibcBdOtv0UzBqHCEKRwbKceYoTK8t3fQ==", "dev": true, "requires": { - "chalk": "^2.4.2", - "date-fns": "^2.0.1", - "lodash": "^4.17.15", - "read-pkg": "^4.0.1", - "rxjs": "^6.5.2", + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.20", + "read-pkg": "^5.2.0", + "rxjs": "^6.6.3", "spawn-command": "^0.0.2-1", - "supports-color": "^6.1.0", + "supports-color": "^8.1.0", "tree-kill": "^1.2.2", - "yargs": "^13.3.0" + "yargs": "^16.2.0" }, "dependencies": { - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "color-convert": "^2.0.1" } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.6", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", + "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==", + "dev": true } } }, @@ -9189,6 +9544,12 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -9247,6 +9608,12 @@ "integrity": "sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA==", "dev": true }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -9763,13 +10130,15 @@ "dev": true }, "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "requires": { + "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" } }, "path-exists": { @@ -9816,12 +10185,6 @@ "dev": true, "peer": true }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -9969,14 +10332,15 @@ } }, "read-pkg": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", - "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, "requires": { - "normalize-package-data": "^2.3.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0" + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" } }, "read-pkg-up": { @@ -10870,6 +11234,12 @@ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", "dev": true }, + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/package.json b/package.json index 3ff506c..1929e67 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@babel/plugin-transform-runtime": "^7.12.1", "@babel/preset-env": "^7.12.7", "babel-loader": "^8.2.1", - "concurrently": "^5.3.0", + "concurrently": "^6.0.0", "css-loader": "^5.0.1", "dotenv": "^8.2.0", "file-loader": "^6.2.0", diff --git a/src/js/clip/Picking.js b/src/js/clip/Picking.js index 6bff49d..3fc997e 100644 --- a/src/js/clip/Picking.js +++ b/src/js/clip/Picking.js @@ -116,6 +116,10 @@ export class Picking { } beginDrag(event) { + // exit drag method, if not left mouse button was clicked + if (this.touchCapable == false && event.which != 1) { + return; + } // this.mouse.setToNormalizedDeviceCoordinates(event, window); let point = this._getCanvasPoint(event); let width = this.simulation.renderer.domElement.clientWidth; diff --git a/src/js/clip/Selection.js b/src/js/clip/Selection.js index 78fd601..96afa5f 100644 --- a/src/js/clip/Selection.js +++ b/src/js/clip/Selection.js @@ -124,22 +124,16 @@ export class Selection { setUniforms() { let unif = uniforms.clipping; unif.clippingLow.value.copy(this.limitLow); - unif.clippingHigh.value.copy(this.limitHigh); - // let test = this.map.layers[20]; - - + unif.clippingHigh.value.copy(this.limitHigh); - - if ( this.map.layers){ - for (const [key, layer] of Object.entries(this.map.layers)) { - if (layer.uniforms) { - layer.uniforms.clipping.clippingLow.value.copy(this.limitLow); - layer.uniforms.clipping.clippingHigh.value.copy(this.limitHigh); - } - } - } - - + if (this.map.layers) { + for (const [key, layer] of Object.entries(this.map.layers)) { + if (layer.uniforms) { + layer.uniforms.clipping.clippingLow.value.copy(this.limitLow); + layer.uniforms.clipping.clippingHigh.value.copy(this.limitHigh); + } + } + } } setValue(axis, value) { diff --git a/src/js/core/Map.js b/src/js/core/Map.js index c6d9b33..e4285a0 100644 --- a/src/js/core/Map.js +++ b/src/js/core/Map.js @@ -1,150 +1,153 @@ -import { OrbitControls } from '../lib/OrbitControls'; -import * as dom from './domUtil'; -import { HomeButton } from '../controls/HomeButton'; -import { ZoomControl } from '../controls/ZoomControl'; -import * as util from './utilities'; -import { TinLayer } from '../layer/TinLayer'; - -class Map extends OrbitControls { - - container; - _layers; - _controlCorners; - _controlContainer; - _controls; - camera; - length; - width; - height; - x; y; z; - title; - serviceUrl; - basemaps; - title; - - constructor(x, y, z, center, camera, scene, container) { - let size = Math.max(x.max - x.min, y.max - y.min, z.max - z.min); - // call parent constructor of OrbitControls - super(size, center, camera, scene, container); - - this.size = size; - this.camera = camera; - this.container = container; - this.length = x.max - x.min; - this.width = y.max - y.min; - this.height = z.max - z.min; - this.x = x; - this.y = y; - this.z = z; - this.center = center; - - //init the control corners - if (this._initControlPos) { - this._initControlPos(); - } - - // to do: initialize map title via serviceUrl: - // this.title = "Geological 3D model of Vienna"; - - // to do: initialize layers via serviceUrl: - // this.serviceUrl = serviceUrl; - this._layers = {}; - this.initControls(); - - this.basemaps = { - "currentVersion": 10.01, - "services": [ - { "name": "esri:topograhy", "type": "MapServer", 'image': 'background_esri_world_topography.png', 'title': 'ESRI Topograhy' }, - { "name": "esri:imagery", "type": "MapServer", 'image': 'background_esri_world_imagery.png', 'title': 'ESRI Imagery' }, - ] - }; - } - - static async build(x, y, z, center, camera, scene, container, serviceUrl) { - const modelData = await util.getMetadata(serviceUrl); - - // do your async stuff here - // now instantiate and return a class - let map = new Map(x, y, z, center, camera, scene, container); - map._initDataLayers(modelData.mappedfeatures); - map.title = modelData.model.model_name; - return map; - } - - get layers() { - return this._layers; - } - - _initDataLayers(mappedFeatures) { - for (let i = 0; i < mappedFeatures.length; i++) { - let layerData = mappedFeatures[i]; - let dxfLayer = new TinLayer({ - featuregeom_id: layerData.featuregeom_id, - q: true, - type: "3dface", - name: layerData.preview.legend_text, //layerData.legend_description, - description: "test", - color: layerData.preview.legend_color //layerData.color - }); - this.addLayer(dxfLayer); - } - } - - _initControlPos() { - //var test = document.getElementById("webgl"); - - var corners = this._controlCorners = {}; - var l = 'gba-'; - var container = this._controlContainer = - //util.create('div', l + 'control-container', this.domElement); - dom.createDom("div", { "class": l + 'control-container' }, this.container); - - function createCorner(vSide, hSide) { - var className = l + vSide + ' ' + l + hSide; - - //corners[vSide + hSide] = util.create('div', className, container); - corners[vSide + hSide] = dom.createDom("div", { "class": className }, container); - } - - createCorner('top', 'left'); - createCorner('top', 'right'); - createCorner('bottom', 'left'); - createCorner('bottom', 'right'); - } - - initControls() { - this._controls = this._controls || {}; - // this._controls.homeControl = (new HomeButton()).addTo(this); - let homeControl = this._controls.homeControl = new HomeButton(); - homeControl.addTo(this); - - let zoomControl = this._controls.zoomControl = new ZoomControl(); - zoomControl.addTo(this); - } - - addLayer(layer) { - var id = util.stamp(layer); - if (this._layers[id]) { - return this; - } - this._layers[id] = layer; - - //layer._mapToAdd = this; - layer.index = id; - - //if (layer.beforeAdd) { - // layer.beforeAdd(this); - //} - //this.whenReady(layer._layerAdd, layer); - layer._layerAdd(this); - this.emit("change"); - return this; - } - - hasLayer(layer) { - return !!layer && (util.stamp(layer) in this._layers); - } - -} - +import { OrbitControls } from '../lib/OrbitControls'; +import * as dom from './domUtil'; +import { HomeButton } from '../controls/HomeButton'; +import { ZoomControl } from '../controls/ZoomControl'; +import * as util from './utilities'; +import { TinLayer } from '../layer/TinLayer'; + +class Map extends OrbitControls { + + container; + _layers; + _controlCorners; + _controlContainer; + _controls; + camera; + length; + width; + height; + x; y; z; + title; + serviceUrl; + basemaps; + title; + + constructor(x, y, z, center, camera, scene, container) { + let size = Math.max(x.max - x.min, y.max - y.min, z.max - z.min); + // call parent constructor of OrbitControls + super(size, center, camera, scene, container); + + this.size = size; + this.camera = camera; + this.container = container; + this.length = x.max - x.min; + this.width = y.max - y.min; + this.height = z.max - z.min; + this.x = x; + this.y = y; + this.z = z; + this.center = center; + + //init the control corners + if (this._initControlPos) { + this._initControlPos(); + } + + // to do: initialize map title via serviceUrl: + // this.title = "Geological 3D model of Vienna"; + + // to do: initialize layers via serviceUrl: + // this.serviceUrl = serviceUrl; + this._layers = {}; + this.initControls(); + + this.basemaps = { + "currentVersion": 10.01, + "services": [ + { "name": "esri:topograhy", "type": "MapServer", 'image': 'background_esri_world_topography.png', 'title': 'ESRI Topograhy' }, + { "name": "esri:imagery", "type": "MapServer", 'image': 'background_esri_world_imagery.png', 'title': 'ESRI Imagery' }, + ] + }; + } + + static async build(x, y, z, center, camera, scene, container, serviceUrl) { + const modelData = await util.getMetadata(serviceUrl); + + // do your async stuff here + // now instantiate and return a class + let map = new Map(x, y, z, center, camera, scene, container); + map._initDataLayers(modelData.mappedfeatures); + map.title = modelData.model.model_name; + return map; + } + + get layers() { + return this._layers; + } + + async _initDataLayers(mappedFeatures) { + const callStack = []; + for (let i = 0; i < mappedFeatures.length; i++) { + let layerData = mappedFeatures[i]; + let dxfLayer = new TinLayer({ + featuregeom_id: layerData.featuregeom_id, + q: true, + type: "3dface", + name: layerData.preview.legend_text, //layerData.legend_description, + description: "test", + color: layerData.preview.legend_color //layerData.color + }); + callStack.push(this.addLayer(dxfLayer)) + } + await Promise.all(callStack); + this.emit("ready"); + } + + _initControlPos() { + //var test = document.getElementById("webgl"); + + var corners = this._controlCorners = {}; + var l = 'gba-'; + var container = this._controlContainer = + //util.create('div', l + 'control-container', this.domElement); + dom.createDom("div", { "class": l + 'control-container' }, this.container); + + function createCorner(vSide, hSide) { + var className = l + vSide + ' ' + l + hSide; + + //corners[vSide + hSide] = util.create('div', className, container); + corners[vSide + hSide] = dom.createDom("div", { "class": className }, container); + } + + createCorner('top', 'left'); + createCorner('top', 'right'); + createCorner('bottom', 'left'); + createCorner('bottom', 'right'); + } + + initControls() { + this._controls = this._controls || {}; + // this._controls.homeControl = (new HomeButton()).addTo(this); + let homeControl = this._controls.homeControl = new HomeButton(); + homeControl.addTo(this); + + let zoomControl = this._controls.zoomControl = new ZoomControl(); + zoomControl.addTo(this); + } + + async addLayer(layer) { + var id = util.stamp(layer); + if (this._layers[id]) { + return this; + } + this._layers[id] = layer; + + //layer._mapToAdd = this; + layer.index = id; + + //if (layer.beforeAdd) { + // layer.beforeAdd(this); + //} + //this.whenReady(layer._layerAdd, layer); + await layer._layerAdd(this); + this.emit("change"); + return this; + } + + hasLayer(layer) { + return !!layer && (util.stamp(layer) in this._layers); + } + +} + export { Map }; \ No newline at end of file diff --git a/src/js/layer/Layer.js b/src/js/layer/Layer.js index d511fcb..2365e66 100644 --- a/src/js/layer/Layer.js +++ b/src/js/layer/Layer.js @@ -16,7 +16,7 @@ class Layer extends EventEmitter { return this; } - _layerAdd(e) { + async _layerAdd(e) { var map = e;//.target; // check in case layer gets added and then removed before the map is ready @@ -29,7 +29,7 @@ class Layer extends EventEmitter { // map.on(this.getEvents(), this); //} - this.onAdd(map); + await this.onAdd(map); //if (this.getAttribution && this._map.attributionControl) { // this._map.attributionControl.addAttribution(this.getAttribution()); diff --git a/src/js/layer/TinLayer.js b/src/js/layer/TinLayer.js index de70a26..02cd5c2 100644 --- a/src/js/layer/TinLayer.js +++ b/src/js/layer/TinLayer.js @@ -111,6 +111,9 @@ class TinLayer extends Layer { }; this.material = new ShaderMaterial( { + clipIntersection: true, + clipShadows: true, + flatShading: true, uniforms: uniforms.clipping, vertexShader: shader.vertexClipping, fragmentShader: shader.fragmentClippingFront, diff --git a/src/js/main.js b/src/js/main.js index 3eb3522..801b29f 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -106,8 +106,8 @@ class Application { /* Scene: that will hold all our elements such as objects, cameras and lights. */ this.scene = new Scene(); this.capsScene = new Scene(); - this.backStencil = new Scene(); - this.frontStencil = new Scene(); + // this.backStencil = new Scene(); + // this.frontStencil = new Scene(); this._buildDefaultLights(this.scene); //app.scene.autoUpdate = false; //// show axes in the screen @@ -179,17 +179,21 @@ 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; + map.on('ready', () => { + this.selection.setUniforms(); + }, this); this.selection = new Selection( // new Vector3(-7, -14, -14), // new Vector3(14, 9, 3) new Vector3(x.min, y.min, z.min), new Vector3(x.max, y.max, z.max), - map + map ); - + new Picking(size, center, this); - + + // let boxLayer = new BoxLayer({ // width: 10000, height: 10000, depth: 10000, name: 'center-box', color: 800080 , center: center // }); @@ -261,7 +265,6 @@ class Application { this.capsScene.add(this.selection.boxMesh); this.scene.add(this.selection.displayMeshes); this.scene.add(this.selection.touchMeshes); - this.selection.setUniforms(); // domEvent.on(window, 'resize', this.onWindowResize, this); // domEvent.on(window, 'keydown', this.keydown, this);