From 0647fd26414fc8a3ab077d355f50da6e3e36ad63 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 15 一月 2025 17:40:57 +0800 Subject: [PATCH] 实现原本功能 --- src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue | 201 ++++++-------- src/model/map/OLMap.ts | 235 ++++++++++++++++++ package-lock.json | 304 +++++++++++++++++++++++ package.json | 1 4 files changed, 625 insertions(+), 116 deletions(-) diff --git a/package-lock.json b/package-lock.json index 458dbba..616e1aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,6 +47,7 @@ "mitt": "^3.0.0", "moment": "^2.29.4", "nprogress": "^0.2.0", + "ol": "^10.3.1", "pinia": "^2.0.33", "print-js": "^1.6.0", "qrcodejs2-fixes": "^0.0.2", @@ -1056,6 +1057,11 @@ "node": ">= 8" } }, + "node_modules/@petamoriken/float16": { + "version": "3.9.1", + "resolved": "https://registry.npmmirror.com/@petamoriken/float16/-/float16-3.9.1.tgz", + "integrity": "sha512-j+ejhYwY6PeB+v1kn7lZFACUIG97u90WxMuGosILFsl9d4Ovi0sjk0GlPfoEcx+FzvXZDAfioD+NGnnPamXgMA==" + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -1452,6 +1458,11 @@ "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" + }, + "node_modules/@types/rbush": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/@types/rbush/-/rbush-4.0.0.tgz", + "integrity": "sha512-+N+2H39P8X+Hy1I5mC6awlTX54k3FhiUmvt7HWzGJZvF+syUAAxP/stwppS8JE84YHqFgRMv6fCy31202CMFxQ==" }, "node_modules/@types/react": { "version": "18.3.3", @@ -3382,6 +3393,36 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "node_modules/color-parse": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/color-parse/-/color-parse-2.0.2.tgz", + "integrity": "sha512-eCtOz5w5ttWIUcaKLiktF+DxZO1R9KLNY/xhbV6CkhM7sR3GhVghmt6X6yOnzeaM24po+Z9/S1apbXMwA3Iepw==", + "dependencies": { + "color-name": "^2.0.0" + } + }, + "node_modules/color-parse/node_modules/color-name": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-2.0.0.tgz", + "integrity": "sha512-SbtvAMWvASO5TE2QP07jHBMXKafgdZz8Vrsrn96fiL+O92/FN/PLARzUW5sKt013fjAprK2d2iCn2hk2Xb5oow==", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/color-rgba": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/color-rgba/-/color-rgba-3.0.0.tgz", + "integrity": "sha512-PPwZYkEY3M2THEHHV6Y95sGUie77S7X8v+h1r6LSAPF3/LL2xJ8duUXSrkic31Nzc4odPwHgUbiX/XuTYzQHQg==", + "dependencies": { + "color-parse": "^2.0.0", + "color-space": "^2.0.0" + } + }, + "node_modules/color-space": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-space/-/color-space-2.0.1.tgz", + "integrity": "sha512-nKqUYlo0vZATVOFHY810BSYjmCARrG7e5R3UE3CQlyjJTvv5kSSmPG1kzm/oDyyqjehM+lW1RnEt9It9GNa5JA==" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -4023,6 +4064,11 @@ "resolved": "https://registry.npmmirror.com/duplexer3/-/duplexer3-0.1.5.tgz", "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", "dev": true + }, + "node_modules/earcut": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/earcut/-/earcut-3.0.1.tgz", + "integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==" }, "node_modules/eastasianwidth": { "version": "0.2.0", @@ -5080,6 +5126,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/geotiff": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/geotiff/-/geotiff-2.1.3.tgz", + "integrity": "sha512-PT6uoF5a1+kbC3tHmZSUsLHBp2QJlHasxxxxPW47QIY1VBKpFB+FcDvX+MxER6UzgLQZ0xDzJ9s48B9JbOCTqA==", + "dependencies": { + "@petamoriken/float16": "^3.4.7", + "lerc": "^3.0.0", + "pako": "^2.0.4", + "parse-headers": "^2.0.2", + "quick-lru": "^6.1.1", + "web-worker": "^1.2.0", + "xml-utils": "^1.0.2", + "zstddec": "^0.1.0" + }, + "engines": { + "node": ">=10.19" + } + }, + "node_modules/geotiff/node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -5986,6 +6055,11 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/lerc": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/lerc/-/lerc-3.0.0.tgz", + "integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==" + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -6861,6 +6935,24 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, + "node_modules/ol": { + "version": "10.3.1", + "resolved": "https://registry.npmmirror.com/ol/-/ol-10.3.1.tgz", + "integrity": "sha512-D1nRQVLOBCRempVqBFV8pSI5H13BtnhuLDjGl+3NKdMOFyjx/UqRX/tcMspEw3LhFOSPWn1Ev+1KIRV8AlHM7A==", + "dependencies": { + "@types/rbush": "4.0.0", + "color-rgba": "^3.0.0", + "color-space": "^2.0.1", + "earcut": "^3.0.0", + "geotiff": "^2.1.3", + "pbf": "4.0.1", + "rbush": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/openlayers" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -7070,6 +7162,11 @@ "node": ">=6" } }, + "node_modules/parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -7135,6 +7232,17 @@ "dev": true, "engines": { "node": ">=8" + } + }, + "node_modules/pbf": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/pbf/-/pbf-4.0.1.tgz", + "integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==", + "dependencies": { + "resolve-protobuf-schema": "^2.1.0" + }, + "bin": { + "pbf": "bin/pbf" } }, "node_modules/pend": { @@ -7469,6 +7577,11 @@ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", "dev": true }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -7547,6 +7660,30 @@ "url": "https://feross.org/support" } ] + }, + "node_modules/quick-lru": { + "version": "6.1.2", + "resolved": "https://registry.npmmirror.com/quick-lru/-/quick-lru-6.1.2.tgz", + "integrity": "sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/quickselect": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/quickselect/-/quickselect-3.0.0.tgz", + "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==" + }, + "node_modules/rbush": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/rbush/-/rbush-4.0.1.tgz", + "integrity": "sha512-IP0UpfeWQujYC8Jg162rMNc01Rf0gWMMAb2Uxus/Q0qOFw4lCcq6ZnQEZwUoJqWyUGJ9th7JjwI4yIWo+uvoAQ==", + "dependencies": { + "quickselect": "^3.0.0" + } }, "node_modules/rc-input-number": { "version": "7.4.2", @@ -7995,6 +8132,14 @@ "dev": true, "engines": { "node": ">=4" + } + }, + "node_modules/resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "dependencies": { + "protocol-buffers-schema": "^3.3.1" } }, "node_modules/responselike": { @@ -9661,6 +9806,11 @@ "defaults": "^1.0.3" } }, + "node_modules/web-worker": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/web-worker/-/web-worker-1.3.0.tgz", + "integrity": "sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==" + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -9853,6 +10003,11 @@ "engines": { "node": ">=12" } + }, + "node_modules/xml-utils": { + "version": "1.10.1", + "resolved": "https://registry.npmmirror.com/xml-utils/-/xml-utils-1.10.1.tgz", + "integrity": "sha512-Dn6vJ1Z9v1tepSjvnCpwk5QqwIPcEFKdgnjqfYOABv1ngSofuAhtlugcUC3ehS1OHdgDWSG6C5mvj+Qm15udTQ==" }, "node_modules/xmlchars": { "version": "2.2.0", @@ -10149,6 +10304,11 @@ "dependencies": { "tslib": "2.3.0" } + }, + "node_modules/zstddec": { + "version": "0.1.0", + "resolved": "https://registry.npmmirror.com/zstddec/-/zstddec-0.1.0.tgz", + "integrity": "sha512-w2NTI8+3l3eeltKAdK8QpiLo/flRAr2p8AGeakfMZOXBxOg9HIu4LVDxBi81sYgVhFhdJjv1OrB5ssI8uFPoLg==" } }, "dependencies": { @@ -10752,6 +10912,11 @@ "fastq": "^1.6.0" } }, + "@petamoriken/float16": { + "version": "3.9.1", + "resolved": "https://registry.npmmirror.com/@petamoriken/float16/-/float16-3.9.1.tgz", + "integrity": "sha512-j+ejhYwY6PeB+v1kn7lZFACUIG97u90WxMuGosILFsl9d4Ovi0sjk0GlPfoEcx+FzvXZDAfioD+NGnnPamXgMA==" + }, "@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -11014,6 +11179,11 @@ "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" + }, + "@types/rbush": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/@types/rbush/-/rbush-4.0.0.tgz", + "integrity": "sha512-+N+2H39P8X+Hy1I5mC6awlTX54k3FhiUmvt7HWzGJZvF+syUAAxP/stwppS8JE84YHqFgRMv6fCy31202CMFxQ==" }, "@types/react": { "version": "18.3.3", @@ -12432,6 +12602,35 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "color-parse": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/color-parse/-/color-parse-2.0.2.tgz", + "integrity": "sha512-eCtOz5w5ttWIUcaKLiktF+DxZO1R9KLNY/xhbV6CkhM7sR3GhVghmt6X6yOnzeaM24po+Z9/S1apbXMwA3Iepw==", + "requires": { + "color-name": "^2.0.0" + }, + "dependencies": { + "color-name": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-2.0.0.tgz", + "integrity": "sha512-SbtvAMWvASO5TE2QP07jHBMXKafgdZz8Vrsrn96fiL+O92/FN/PLARzUW5sKt013fjAprK2d2iCn2hk2Xb5oow==" + } + } + }, + "color-rgba": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/color-rgba/-/color-rgba-3.0.0.tgz", + "integrity": "sha512-PPwZYkEY3M2THEHHV6Y95sGUie77S7X8v+h1r6LSAPF3/LL2xJ8duUXSrkic31Nzc4odPwHgUbiX/XuTYzQHQg==", + "requires": { + "color-parse": "^2.0.0", + "color-space": "^2.0.0" + } + }, + "color-space": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-space/-/color-space-2.0.1.tgz", + "integrity": "sha512-nKqUYlo0vZATVOFHY810BSYjmCARrG7e5R3UE3CQlyjJTvv5kSSmPG1kzm/oDyyqjehM+lW1RnEt9It9GNa5JA==" + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -12968,6 +13167,11 @@ "resolved": "https://registry.npmmirror.com/duplexer3/-/duplexer3-0.1.5.tgz", "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", "dev": true + }, + "earcut": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/earcut/-/earcut-3.0.1.tgz", + "integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==" }, "eastasianwidth": { "version": "0.2.0", @@ -13810,6 +14014,28 @@ "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" }, + "geotiff": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/geotiff/-/geotiff-2.1.3.tgz", + "integrity": "sha512-PT6uoF5a1+kbC3tHmZSUsLHBp2QJlHasxxxxPW47QIY1VBKpFB+FcDvX+MxER6UzgLQZ0xDzJ9s48B9JbOCTqA==", + "requires": { + "@petamoriken/float16": "^3.4.7", + "lerc": "^3.0.0", + "pako": "^2.0.4", + "parse-headers": "^2.0.2", + "quick-lru": "^6.1.1", + "web-worker": "^1.2.0", + "xml-utils": "^1.0.2", + "zstddec": "^0.1.0" + }, + "dependencies": { + "pako": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + } + } + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -14518,6 +14744,11 @@ } } } + }, + "lerc": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/lerc/-/lerc-3.0.0.tgz", + "integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==" }, "levn": { "version": "0.4.1", @@ -15230,6 +15461,20 @@ } } }, + "ol": { + "version": "10.3.1", + "resolved": "https://registry.npmmirror.com/ol/-/ol-10.3.1.tgz", + "integrity": "sha512-D1nRQVLOBCRempVqBFV8pSI5H13BtnhuLDjGl+3NKdMOFyjx/UqRX/tcMspEw3LhFOSPWn1Ev+1KIRV8AlHM7A==", + "requires": { + "@types/rbush": "4.0.0", + "color-rgba": "^3.0.0", + "color-space": "^2.0.1", + "earcut": "^3.0.0", + "geotiff": "^2.1.3", + "pbf": "4.0.1", + "rbush": "^4.0.0" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -15384,6 +15629,11 @@ "callsites": "^3.0.0" } }, + "parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==" + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -15431,6 +15681,14 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true + }, + "pbf": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/pbf/-/pbf-4.0.1.tgz", + "integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==", + "requires": { + "resolve-protobuf-schema": "^2.1.0" + } }, "pend": { "version": "1.2.0", @@ -15648,6 +15906,11 @@ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", "dev": true }, + "protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, "proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -15698,6 +15961,24 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "quick-lru": { + "version": "6.1.2", + "resolved": "https://registry.npmmirror.com/quick-lru/-/quick-lru-6.1.2.tgz", + "integrity": "sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==" + }, + "quickselect": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/quickselect/-/quickselect-3.0.0.tgz", + "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==" + }, + "rbush": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/rbush/-/rbush-4.0.1.tgz", + "integrity": "sha512-IP0UpfeWQujYC8Jg162rMNc01Rf0gWMMAb2Uxus/Q0qOFw4lCcq6ZnQEZwUoJqWyUGJ9th7JjwI4yIWo+uvoAQ==", + "requires": { + "quickselect": "^3.0.0" + } }, "rc-input-number": { "version": "7.4.2", @@ -16041,6 +16322,14 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true + }, + "resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "requires": { + "protocol-buffers-schema": "^3.3.1" + } }, "responselike": { "version": "1.0.2", @@ -17236,6 +17525,11 @@ "defaults": "^1.0.3" } }, + "web-worker": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/web-worker/-/web-worker-1.3.0.tgz", + "integrity": "sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==" + }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -17374,6 +17668,11 @@ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", "dev": true + }, + "xml-utils": { + "version": "1.10.1", + "resolved": "https://registry.npmmirror.com/xml-utils/-/xml-utils-1.10.1.tgz", + "integrity": "sha512-Dn6vJ1Z9v1tepSjvnCpwk5QqwIPcEFKdgnjqfYOABv1ngSofuAhtlugcUC3ehS1OHdgDWSG6C5mvj+Qm15udTQ==" }, "xmlchars": { "version": "2.2.0", @@ -17621,6 +17920,11 @@ "requires": { "tslib": "2.3.0" } + }, + "zstddec": { + "version": "0.1.0", + "resolved": "https://registry.npmmirror.com/zstddec/-/zstddec-0.1.0.tgz", + "integrity": "sha512-w2NTI8+3l3eeltKAdK8QpiLo/flRAr2p8AGeakfMZOXBxOg9HIu4LVDxBi81sYgVhFhdJjv1OrB5ssI8uFPoLg==" } } } diff --git a/package.json b/package.json index 2099791..5b93cc9 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "mitt": "^3.0.0", "moment": "^2.29.4", "nprogress": "^0.2.0", + "ol": "^10.3.1", "pinia": "^2.0.33", "print-js": "^1.6.0", "qrcodejs2-fixes": "^0.0.2", diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue index c97f4cd..cd110df 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue @@ -9,6 +9,39 @@ <div class="ywifont text-[20px] text-black rounded-lg ywicon-fullscreen"></div> </el-tooltip> </div> + <div ref="infoWindowRef" v-show="infoWindowIsShow"> + <div + class="bg-white rounded-md text-nowrap flex flex-col w-fit border border-solid border-blue-600 relative z-[1]" + style="padding: 12px" + > + <span + @click="closeInfoWindow" + class="guanbi absolute ywifont ywicon-guanbi right-[4px] top-[-2px] font-bold text-[#c3c3c3] cursor-pointer" + ></span> + + <div class="space-x-4 flex w-full"> + <div class="flex flex-col w-1/2 key-list"> + <span + v-for="(col, index) in colsArray" + :key="index" + class="flex-items-center justify-start text-gray-600" + style="height: 20px" + >{{ col.title ?? '' }}</span + > + </div> + + <div class="flex flex-col w-1/2 value-list" v-if="infoWindowMapRow"> + <span + v-for="(col, index) in colsArray" + :key="index" + class="flex-items-center justify-end text-black" + style="height: 20px" + >{{ infoWindowMapRow[index] ?? '' }}</span + > + </div> + </div> + </div> + </div> <!-- Teleport 鍏ㄥ睆鍦板浘 --> <Teleport to=".layout-parent"> @@ -37,14 +70,15 @@ </template> <script setup lang="ts"> -import { onMounted, ref, nextTick, onDeactivated, onUnmounted } from 'vue'; - -import equipPic from './img/equip.svg'; +import 'ol/ol.css'; +import { computed, nextTick, onDeactivated, onMounted, onUnmounted, ref } from 'vue'; import equipSelectPic from './img/equip-select.svg'; +import equipPic from './img/equip.svg'; +import { OLMap } from '/@/model/map/OLMap'; -import type { GaoDePosition, LabelMarkerData } from '/@/model/map/GaoDeMap'; -import { GaoDeMap } from '/@/model/map/GaoDeMap'; +import type Overlay from 'ol/Overlay'; import EquipCurve from '../components/EquipCurve.vue'; +import { GaoDeMap } from '/@/model/map/GaoDeMap'; let gaoDeMap = new GaoDeMap(); const containerRef = ref<HTMLDivElement>(null); const fullscreenContainerRef = ref<HTMLDivElement>(null); @@ -52,50 +86,47 @@ const props = defineProps(['data']); const emit = defineEmits(['equipClick', 'closeInfoWindow']); -const createInfoWindow = () => { - // title - // <div class="title flex-center bg-[#ca0dab] text-white py-0.5 mb-2 w-full over-ellipsis"> - // 缃楁眽楸� - // </div> - const dom = `<div class="rounded-md text-nowrap flex flex-col w-fit border border-solid border-blue-600 relative" style="padding: 12px"> - <span class="guanbi absolute ywifont ywicon-guanbi right-[4px] top-[-2px] font-bold text-[#c3c3c3] cursor-pointer" ></span> - - <div class="space-x-4 flex w-full"> - <div class="flex flex-col w-1/2 key-list"> - - </div> - <div class="flex flex-col w-1/2 value-list"> - - </div> - </div> - </div>`; +const colsArray = computed(() => { + return props.data.cols ?? []; +}); - return dom; +const infoWindowRef = ref<HTMLDivElement>(null); +const infoWindowIsShow = ref(false); +const infoWindowMapRow = ref(null); +let olMap: OLMap; +let infoWindowOverlay: Overlay; +let lastOverlay: Overlay; +const setMarkerIcon = (overlay, icon: string) => { + if (!overlay) return; + const ele = overlay.getElement() as HTMLImageElement; + if (!ele) return; + ele.src = icon; +}; +const showInfoWindow = (overlay, row, position) => { + lastOverlay && setMarkerIcon(lastOverlay, equipPic); + if (isFullscreen.value) { + showCurve(row); + } else { + emit('equipClick', row); + } + infoWindowIsShow.value = true; + infoWindowOverlay.setPosition(position); + infoWindowMapRow.value = row; + setMarkerIcon(overlay, equipSelectPic); + lastOverlay = overlay; +}; +const closeInfoWindow = () => { + if (isFullscreen.value) { + closeChartDlg(); + } else { + emit('closeInfoWindow'); + } + infoWindowIsShow.value = false; + infoWindowMapRow.value = null; + setMarkerIcon(lastOverlay, equipPic); }; -const updateInfoWindow = (item) => { - const cellHeight = '20px'; - const keyListDom = infoWindow.dom.querySelector('.key-list'); - const valueListDom = infoWindow.dom.querySelector('.value-list'); - - const colsArray = props.data.cols ?? []; - const keyItemHtml = colsArray - .map((col) => { - return `<span class="flex-items-center justify-start text-gray-600" style="height:${cellHeight}">${col.title ?? ''}</span>`; - }) - .join(''); - - const valueItemHtml = colsArray - .map((col, index) => { - return `<span class="flex-items-center justify-end text-black" style="height:${cellHeight}">${item[index] ?? ''}</span>`; - }) - .join(''); - - keyListDom.innerHTML = keyItemHtml; - valueListDom.innerHTML = valueItemHtml; -}; -let curMarkerLabel: AMap.LabelMarker; const addMarkerLayer = () => { const map = props.data.map; if (map.pos_x == null && map.pos_y == null) return; @@ -111,73 +142,22 @@ title: item.title, }; }); - gaoDeMap.addMarkerLayer(dataList, { + olMap.addMarkerLayer(dataList, { markerOpt: { icon: { url: equipPic, size: 30, selectUrl: equipSelectPic, }, - click(e, label) { - curMarkerLabel && curMarkerLabel !== label && restoreLabel(); - curMarkerLabel = label; - infoWindow.open(gaoDeMap.map, label.getPosition() as any); - const extData = label.getExtData(); - if (isFullscreen.value) { - showCurve(extData); - } else { - emit('equipClick', extData); - } - label.setRank(999); + click(e, label, item, position) { + const extData = item.extData; - updateInfoWindow(extData); + showInfoWindow(label, extData, position); }, }, layerOpt: { // allowCollision:false }, - }); -}; - -const bottomBarIsShow = ref(false); -const chartIsShow = ref(true); -const toggleShowChart = () => { - chartIsShow.value = !chartIsShow.value; -}; - -let infoWindow: AMap.InfoWindow; -const restoreLabel = () => { - // 鍏抽棴鎭㈠鍥剧墖 - curMarkerLabel?.setIcon({ - image: equipPic, - }); - curMarkerLabel?.setRank(1); -}; - -// 鍒濆鍖栦俊鎭獥鍙� -const initInfoWindow = () => { - infoWindow = new AMap.InfoWindow({ - content: createInfoWindow(), - anchor: 'top-left', - closeWhenClickMap: true, - }); - - (infoWindow as any).on('close', () => { - restoreLabel(); - curMarkerLabel = null; - if (isFullscreen.value) { - closeChartDlg(); - } else { - emit('closeInfoWindow'); - } - }); - - // 鑷甫鍏抽棴鍘绘帀锛岃嚜甯﹀叧闂洃鍚� close 浼氬娆¤Е鍙� close 浜嬩欢 - const closeBtnDom = infoWindow.dom.querySelector('.amap-info-close'); - closeBtnDom.remove(); - const myCloseBtn = infoWindow.dom.querySelector('.guanbi'); - myCloseBtn.addEventListener('click', () => { - infoWindow.close(); }); }; @@ -189,6 +169,7 @@ await nextTick(); // 閲嶆柊鍒濆鍖栧湴鍥� if (isFullscreen.value) { + closeInfoWindow(); await initMap(fullscreenContainerRef.value); } else { // await initMap(containerRef.value); @@ -197,24 +178,12 @@ // 鍒濆鍖栧湴鍥� const initMap = async (container: HTMLDivElement) => { - // 閿�姣佹棫瀹炰緥 - // gaoDeMap.map?.destroy(); - gaoDeMap = new GaoDeMap(); - - // 鍒濆鍖栨柊瀹炰緥 - await gaoDeMap.init({ + olMap = new OLMap({ container, - aMapOption: { - resizeEnable: true, - }, }); - - gaoDeMap.applyBasicPlugins(); addMarkerLayer(); - gaoDeMap.map.setFitView(); - - // 鍒濆鍖栦俊鎭獥鍙� - initInfoWindow(); + infoWindowOverlay = olMap.createEleOverlay(infoWindowRef.value); + olMap.map.addOverlay(infoWindowOverlay); }; //#region ====================== 璁惧鏇茬嚎 ====================== const chartDlgIsShow = ref(false); @@ -238,7 +207,7 @@ }; onMounted(async () => { - await initMap(containerRef.value); + initMap(containerRef.value); // 娣诲姞 ESC 閿洃鍚� document.addEventListener('keydown', handleEscKey); }); diff --git a/src/model/map/OLMap.ts b/src/model/map/OLMap.ts new file mode 100644 index 0000000..d972754 --- /dev/null +++ b/src/model/map/OLMap.ts @@ -0,0 +1,235 @@ +import { defaultsDeep } from 'lodash-es'; +import { Map as OpenLayerMap, Overlay, View } from 'ol'; +import type { Extent } from 'ol/extent'; +import { getTopLeft, getWidth } from 'ol/extent'; +import Tile from 'ol/layer/Tile'; +import { fromLonLat, get as getProjection } from 'ol/proj'; +import { XYZ } from 'ol/source'; +import WMTS from 'ol/source/WMTS'; +import WMTSTileGrid from 'ol/tilegrid/WMTS'; +import type { ViewOptions } from 'ol/View'; + +export type LangType = 'zh_cn' | 'en'; +export const enum GaoDeSourceType { + /** @description 榛樿鍦板浘 */ + Default = 0, + /** @description 褰卞儚鍦板浘 */ + Satellite = 1, + /** @description 鐭㈤噺鍦板浘 */ + Vector = 2, + /** @description 褰卞儚璺綉 */ + SatelliteRoad = 3, +} + +export const GaoDeSourceTypeMap = { + [GaoDeSourceType.Default]: '榛樿鍦板浘', + [GaoDeSourceType.Satellite]: '褰卞儚鍦板浘', + [GaoDeSourceType.Vector]: '鐭㈤噺鍦板浘', + [GaoDeSourceType.SatelliteRoad]: '褰卞儚璺綉', +}; + +export const getGaoDeSourceUrl = (type: GaoDeSourceType, lang: LangType = 'zh_cn') => { + const urlMap = { + [GaoDeSourceType.Satellite]: `http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=${lang}&size=1&scl=1&style=6`, + [GaoDeSourceType.Vector]: `http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=${lang}&size=1&scl=1&style=7`, + [GaoDeSourceType.SatelliteRoad]: `http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=${lang}&size=1&scl=1&style=8`, + [GaoDeSourceType.Default]: `http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=${lang}&size=1&scl=2&style=7`, + }; + return urlMap[type]; +}; + +type OLEventType = 'blackClick'; +type OLMapOptions = { + container: HTMLDivElement; + + view?: ViewOptions; +}; +export class OLMap { + map: OpenLayerMap; + source: XYZ; + private eventMap: Map<OLEventType, Function[]>; + + private emit(eventName: OLEventType, ...args: any[]) { + const handlers = this.eventMap.get(eventName); + if (handlers) { + handlers.forEach((handler) => handler(...args)); + } + } + + on(eventName: OLEventType, handler: Function) { + if (!this.eventMap) { + this.eventMap = new Map(); + } + + if (!this.eventMap.has(eventName)) { + this.eventMap.set(eventName, []); + } + + this.eventMap.get(eventName).push(handler); + } + + off(eventName: OLEventType, handler: Function) { + const handlers = this.eventMap.get(eventName); + if (handlers) { + const index = handlers.indexOf(handler); + if (index > -1) { + handlers.splice(index, 1); + } + } + } + + constructor(options: OLMapOptions) { + const { container, view } = defaultsDeep(options, { + view: { + center: [13247019.404399557, 4721671.572580107], + zoom: 8, + }, + } as OLMapOptions) as OLMapOptions; + this.source = new XYZ({ + crossOrigin: 'anonymous', + /** @description 楂樺痉鍦板浘鏈�澶ф敮鎸�18绾�, 瓒呰繃浼氭樉绀虹┖鐧� */ + maxZoom: 18, + /** @description 楂樺痉鍦板浘鏈�灏忔敮鎸�3绾�, 灏忎簬3绾т細鏄剧ず绌虹櫧 */ + minZoom: 3, + }); + + // this.source = this.getWMTS(); + const layer = new Tile({ + source: this.source, + }); + this.map = new OpenLayerMap({ + target: container, // 缁戝畾 DOM 瀹瑰櫒 + layers: [layer], // 娣诲姞鍥惧眰 + view: new View(view), + }); + this.setSourceUrl(); + this.listenMapClick(); + } + + setSourceUrl(type: GaoDeSourceType = GaoDeSourceType.Vector) { + const url = getGaoDeSourceUrl(type); + this.source.setUrl(url); + } + addMarkerLayer(dataList: any[], options: any) { + const { markerOpt } = options; + const markers: Overlay[] = []; + + // 鍒涘缓鏍囪鐐� + dataList.forEach((item) => { + const marker = this.createMarker(item, markerOpt); + markers.push(marker); + this.map.addOverlay(marker); + }); + + // 璁$畻骞惰皟鏁磋鍥捐寖鍥� + this.adjustViewToMarkers(dataList); + } + + createEleOverlay(dom: string | HTMLElement, position = [0, 0]) { + const ele = typeof dom === 'string' ? (document.querySelector(dom) as HTMLElement) : dom; + if (!ele) return; + const eleOverlay = new Overlay({ + element: ele, + position: position, + positioning: 'top-left', + stopEvent: false, + className: 'z-[999]', + }); + // // 鐢变簬 setVisible 鏄彈淇濇姢鐨勬柟娉�,鏀圭敤 set('visible', true) 鏉ヨ缃彲瑙佹�� + // eleOverlay.set('visible', true); + return eleOverlay; + } + + private createMarker(item: any, markerOpt: any): Overlay { + // 鍒涘缓鍥剧墖鍏冪礌 + const markerImg = document.createElement('img'); + markerImg.src = markerOpt.icon.url; + markerImg.style.width = `${markerOpt.icon.size}px`; + markerImg.style.height = `${markerOpt.icon.size}px`; + markerImg.style.cursor = 'pointer'; + const position = fromLonLat(item.position); + + // 鍒涘缓 Overlay + const overlay = new Overlay({ + element: markerImg, + position: position, + positioning: 'center-center', + stopEvent: false, + }); + + overlay.set('extData', item.extData); + // 娣诲姞鐐瑰嚮浜嬩欢 + markerImg.addEventListener('click', (event) => { + if (markerOpt.icon.selectUrl) { + markerImg.src = markerOpt.icon.selectUrl; + } + markerOpt.click?.(event, overlay, item, position); + }); + + return overlay; + } + + private adjustViewToMarkers(dataList: any[]) { + // 璁$畻鎵�鏈夌偣鐨勮寖鍥� + const extent = dataList.reduce((ext, item) => { + const coord = fromLonLat(item.position); + if (!ext) { + return [coord[0], coord[1], coord[0], coord[1]]; + } + return [Math.min(ext[0], coord[0]), Math.min(ext[1], coord[1]), Math.max(ext[2], coord[0]), Math.max(ext[3], coord[1])]; + }, null); + + // 璋冩暣瑙嗗浘浠ラ�傚簲鏍囪鐐硅寖鍥� + if (extent) { + this.fitExtend(extent); + } + } + + private fitExtend(extent: Extent) { + this.map.getView().fit(extent, { + padding: [50, 50, 50, 50], // 璁剧疆杈硅窛锛屼娇鏍囪鐐逛笉浼氬お闈犺繎鍦板浘杈圭紭 + duration: 0, // 鍔ㄧ敾鎸佺画鏃堕棿(姣) + maxZoom: 15, // 闄愬埗鏈�澶х缉鏀剧骇鍒�,闃叉鍗曚釜璁惧鏃剁缉鏀捐繃澶� + }); + } + /** + * 鐩戝惉鍦板浘绌虹櫧鍖哄煙鐐瑰嚮 + */ + listenMapClick() { + this.map.on('click', (event) => { + const feature = this.map.forEachFeatureAtPixel(event.pixel, (feature) => feature); + + if (!feature) { + // overlay 鏃犳硶鍒ゆ柇 + this.emit('blackClick', event); + } + }); + } + + getWMTS = () => { + const projection = getProjection('EPSG:3857'); + const projectionExtent = projection.getExtent(); + const size = getWidth(projectionExtent) / 256; + const resolutions = new Array(19); + const matrixIds = new Array(19); + for (let z = 0; z < 19; ++z) { + const pow = Math.pow(2, z); + resolutions[z] = size / pow; + matrixIds[z] = z; + } + return new WMTS({ + url: 'https://wmts-service.pre-fc.alibaba-inc.com/amap/service/wmts', //WMTS 鏈嶅姟鐨� url 鍦板潃 + layer: 'map:shanghai', + matrixSet: 'GoogleMapsCompatible', + format: 'image/png', + projection: projection, + tileGrid: new WMTSTileGrid({ + origin: getTopLeft(projectionExtent), + resolutions: resolutions, + matrixIds: matrixIds, + }), + style: 'default', + wrapX: true, + }); + }; +} -- Gitblit v1.9.3