@ohuoy/easymap 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +13 -2
- package/dist/example - /345/211/257/346/234/254/bundle.js" +13 -2
- package/dist/example - /345/211/257/346/234/254/index.html" +88 -12
- package/lib/threebox-plugin/CHANGELOG.md +665 -0
- package/lib/threebox-plugin/LICENSE.txt +97 -0
- package/lib/threebox-plugin/README.md +199 -0
- package/lib/threebox-plugin/exports.js +2 -0
- package/lib/threebox-plugin/main.js +8 -0
- package/lib/threebox-plugin/package.json +44 -0
- package/lib/threebox-plugin/server.stop.js +13 -0
- package/lib/threebox-plugin/src/Threebox.js +1216 -0
- package/lib/threebox-plugin/src/animation/AnimationManager.js +483 -0
- package/lib/threebox-plugin/src/camera/CameraSync.js +302 -0
- package/lib/threebox-plugin/src/objects/CSS2DRenderer.js +245 -0
- package/lib/threebox-plugin/src/objects/LabelRenderer.js +71 -0
- package/lib/threebox-plugin/src/objects/Object3D.js +34 -0
- package/lib/threebox-plugin/src/objects/effects/BuildingShadows.js +111 -0
- package/lib/threebox-plugin/src/objects/extrusion.js +61 -0
- package/lib/threebox-plugin/src/objects/fflate.min.js +15 -0
- package/lib/threebox-plugin/src/objects/label.js +29 -0
- package/lib/threebox-plugin/src/objects/line.js +1386 -0
- package/lib/threebox-plugin/src/objects/loadObj.js +142 -0
- package/lib/threebox-plugin/src/objects/loaders/ColladaLoader.js +3751 -0
- package/lib/threebox-plugin/src/objects/loaders/FBXLoader.js +3864 -0
- package/lib/threebox-plugin/src/objects/loaders/GLTFLoader.js +3857 -0
- package/lib/threebox-plugin/src/objects/loaders/MTLLoader.js +498 -0
- package/lib/threebox-plugin/src/objects/loaders/OBJLoader.js +818 -0
- package/lib/threebox-plugin/src/objects/objects.js +1113 -0
- package/lib/threebox-plugin/src/objects/sphere.js +28 -0
- package/lib/threebox-plugin/src/objects/tooltip.js +27 -0
- package/lib/threebox-plugin/src/objects/tube.js +35 -0
- package/lib/threebox-plugin/src/three.js +6 -0
- package/lib/threebox-plugin/src/three.module.js +54571 -0
- package/lib/threebox-plugin/src/utils/ValueGenerator.js +11 -0
- package/lib/threebox-plugin/src/utils/constants.js +21 -0
- package/lib/threebox-plugin/src/utils/material.js +52 -0
- package/lib/threebox-plugin/src/utils/suncalc.js +322 -0
- package/lib/threebox-plugin/src/utils/utils.js +424 -0
- package/lib/threebox-plugin/src/utils/validate.js +115 -0
- package/main.js +6 -1
- package/package.json +18 -18
- package/src/components/layer/AlarmLayer.js +1 -1
- package/src/components/layer/AnimationBarbsLayer.js +1 -1
- package/src/components/layer/AnimationLayer copy.js +1 -1
- package/src/components/layer/AnimationLayer.js +1 -1
- package/src/components/layer/CustomIconLayer.js +1 -1
- package/src/components/layer/ExtrusionLayer.js +1 -1
- package/src/components/layer/ExtrusionLayerold.js +2 -1
- package/src/components/layer/MarkerAreaLayer.js +1 -1
- package/src/components/layer/PathLineLayer.js +1 -1
- package/src/components/layer/ThreeScanLayer.js +104 -9
- package/src/components/layer/ThreeWallLayer.js +1 -1
- package/src/components/mapOutScreen.js +181 -0
- package/webpack.config.js +2 -1
package/dist/bundle.js
CHANGED
|
@@ -4661,7 +4661,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4661
4661
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4662
4662
|
|
|
4663
4663
|
"use strict";
|
|
4664
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EasyMap: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.EasyMap),\n/* harmony export */ EffectComposer: () => (/* reexport safe */
|
|
4664
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EasyMap: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.EasyMap),\n/* harmony export */ EffectComposer: () => (/* reexport safe */ three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_11__.EffectComposer),\n/* harmony export */ EmComponents: () => (/* reexport module object */ _src_components_index__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ EmUtils: () => (/* reexport module object */ _src_utils_util__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ FXAAShader: () => (/* reexport safe */ three_examples_jsm_shaders_FXAAShader_js__WEBPACK_IMPORTED_MODULE_18__.FXAAShader),\n/* harmony export */ FontLoader: () => (/* reexport safe */ three_addons_loaders_FontLoader_js__WEBPACK_IMPORTED_MODULE_17__.FontLoader),\n/* harmony export */ GammaCorrectionShader: () => (/* reexport safe */ three_examples_jsm_shaders_GammaCorrectionShader_js__WEBPACK_IMPORTED_MODULE_19__.GammaCorrectionShader),\n/* harmony export */ Line2: () => (/* reexport safe */ three_addons_lines_Line2_js__WEBPACK_IMPORTED_MODULE_6__.Line2),\n/* harmony export */ LineGeometry: () => (/* reexport safe */ three_addons_lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_15__.LineGeometry),\n/* harmony export */ LineMaterial: () => (/* reexport safe */ three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_16__.LineMaterial),\n/* harmony export */ OrbitControls: () => (/* reexport safe */ three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_7__.OrbitControls),\n/* harmony export */ OutlinePass: () => (/* reexport safe */ three_examples_jsm_postprocessing_OutlinePass_js__WEBPACK_IMPORTED_MODULE_14__.OutlinePass),\n/* harmony export */ RenderPass: () => (/* reexport safe */ three_examples_jsm_postprocessing_RenderPass_js__WEBPACK_IMPORTED_MODULE_12__.RenderPass),\n/* harmony export */ ShaderPass: () => (/* reexport safe */ three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_13__.ShaderPass),\n/* harmony export */ Three: () => (/* reexport module object */ three__WEBPACK_IMPORTED_MODULE_9__),\n/* harmony export */ TrackballControls: () => (/* reexport safe */ three_addons_controls_TrackballControls_js__WEBPACK_IMPORTED_MODULE_10__.TrackballControls),\n/* harmony export */ UnrealBloomPass: () => (/* reexport safe */ three_examples_jsm_postprocessing_UnrealBloomPass__WEBPACK_IMPORTED_MODULE_8__.UnrealBloomPass),\n/* harmony export */ ant7: () => (/* reexport module object */ _lib_antv_l7__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ mapOutScreen: () => (/* reexport safe */ _src_components_mapOutScreen_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ mapboxgl: () => (/* reexport safe */ _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])\n/* harmony export */ });\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ \"./index.js\");\n/* harmony import */ var _src_components_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/components/index */ \"./src/components/index.js\");\n/* harmony import */ var _src_utils_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/mapbox-gl/dist/mapbox-gl.js */ \"./lib/mapbox-gl/dist/mapbox-gl.js\");\n/* harmony import */ var _lib_antv_l7__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/@antv/l7 */ \"./lib/@antv/l7/es/index.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var three_addons_controls_TrackballControls_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! three/addons/controls/TrackballControls.js */ \"./node_modules/three/examples/jsm/controls/TrackballControls.js\");\n/* harmony import */ var three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three/addons/controls/OrbitControls.js */ \"./node_modules/three/examples/jsm/controls/OrbitControls.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! three/examples/jsm/postprocessing/EffectComposer.js */ \"./node_modules/three/examples/jsm/postprocessing/EffectComposer.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_RenderPass_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! three/examples/jsm/postprocessing/RenderPass.js */ \"./node_modules/three/examples/jsm/postprocessing/RenderPass.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! three/examples/jsm/postprocessing/ShaderPass.js */ \"./node_modules/three/examples/jsm/postprocessing/ShaderPass.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_OutlinePass_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! three/examples/jsm/postprocessing/OutlinePass.js */ \"./node_modules/three/examples/jsm/postprocessing/OutlinePass.js\");\n/* harmony import */ var three_examples_jsm_shaders_FXAAShader_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! three/examples/jsm/shaders/FXAAShader.js */ \"./node_modules/three/examples/jsm/shaders/FXAAShader.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_UnrealBloomPass__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! three/examples/jsm/postprocessing/UnrealBloomPass */ \"./node_modules/three/examples/jsm/postprocessing/UnrealBloomPass.js\");\n/* harmony import */ var three_addons_lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! three/addons/lines/LineGeometry.js */ \"./node_modules/three/examples/jsm/lines/LineGeometry.js\");\n/* harmony import */ var three_addons_lines_Line2_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three/addons/lines/Line2.js */ \"./node_modules/three/examples/jsm/lines/Line2.js\");\n/* harmony import */ var three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! three/examples/jsm/lines/LineMaterial.js */ \"./node_modules/three/examples/jsm/lines/LineMaterial.js\");\n/* harmony import */ var three_addons_loaders_FontLoader_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! three/addons/loaders/FontLoader.js */ \"./node_modules/three/examples/jsm/loaders/FontLoader.js\");\n/* harmony import */ var three_examples_jsm_shaders_GammaCorrectionShader_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! three/examples/jsm/shaders/GammaCorrectionShader.js */ \"./node_modules/three/examples/jsm/shaders/GammaCorrectionShader.js\");\n/* harmony import */ var _src_components_mapOutScreen_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./src/components/mapOutScreen.js */ \"./src/components/mapOutScreen.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nwindow.EasyMap = _index__WEBPACK_IMPORTED_MODULE_0__.EasyMap;\nwindow.EmComponents = _src_components_index__WEBPACK_IMPORTED_MODULE_1__;\nwindow.EmUtils = _src_utils_util__WEBPACK_IMPORTED_MODULE_2__;\nwindow.mapOutScreen = _src_components_mapOutScreen_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n// const modulesFiles = import.meta.glob('./src/components/*.js')\n// console.log(modulesFiles)\n// Object.entries(modulesFiles).forEach(a=>{\n// console.log(a)\n// })\n\n\n\n//# sourceURL=webpack://@ohuoy/easymap/./main.js?");
|
|
4665
4665
|
|
|
4666
4666
|
/***/ }),
|
|
4667
4667
|
|
|
@@ -4958,7 +4958,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4958
4958
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4959
4959
|
|
|
4960
4960
|
"use strict";
|
|
4961
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ThreeScanLayer)\n/* harmony export */ });\n/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../lib/mapbox-gl/dist/mapbox-gl.js */ \"./lib/mapbox-gl/dist/mapbox-gl.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! threebox-plugin */ \"./node_modules/threebox-plugin/main.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(threebox_plugin__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\nvar tb = {};\nvar ThreeScanLayer = /*#__PURE__*/function () {\n function ThreeScanLayer(id, config) {\n _classCallCheck(this, ThreeScanLayer);\n _defineProperty(this, \"drawArray\", []);\n _defineProperty(this, \"opacity\", 0.8);\n _defineProperty(this, \"textClass\", '');\n _defineProperty(this, \"forceClear\", false);\n this.id = id;\n this.opacity = Number(config.opacity);\n this.textClass = config.textClass ? config.textClass : '';\n this.type = 'custom';\n this.renderingMode = '2d';\n this.forceClear = config === null || config === void 0 ? void 0 : config.forceClear;\n }\n\n //同时渲染多个地点图片文本\n return _createClass(ThreeScanLayer, [{\n key: \"drawImageList\",\n value: function () {\n var _drawImageList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(list) {\n var _this = this;\n var delay,\n i,\n _loop,\n _i,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n delay = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 300;\n _context2.t0 = _regeneratorRuntime().keys(list);\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 8;\n break;\n }\n i = _context2.t1.value;\n _context2.next = 6;\n return this.update(list[i]);\n case 6:\n _context2.next = 2;\n break;\n case 8:\n _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(_i) {\n var _point;\n return _regeneratorRuntime().wrap(function _loop$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _point = list.find(function (a) {\n return a.center[0] == _this.drawArray[_i].center[0] && a.center[1] == _this.drawArray[_i].center[1];\n });\n if (!_point) {\n _this.remove(_this.drawArray[_i]);\n _this.drawArray[_i] = null;\n }\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _loop);\n });\n _context2.t2 = _regeneratorRuntime().keys(this.drawArray);\n case 10:\n if ((_context2.t3 = _context2.t2()).done) {\n _context2.next = 15;\n break;\n }\n _i = _context2.t3.value;\n return _context2.delegateYield(_loop(_i), \"t4\", 13);\n case 13:\n _context2.next = 10;\n break;\n case 15:\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n _context2.next = 20;\n return (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.sleep)(delay);\n case 20:\n return _context2.abrupt(\"return\", this.map.getCanvas().toDataURL());\n case 21:\n case \"end\":\n return _context2.stop();\n }\n }, _callee, this);\n }));\n function drawImageList(_x) {\n return _drawImageList.apply(this, arguments);\n }\n return drawImageList;\n }()\n }, {\n key: \"remove\",\n value: function remove(point) {\n point.mesh.label.element.remove();\n tb.remove(point.mesh);\n }\n }, {\n key: \"removeAll\",\n value: function removeAll() {\n for (var i in this.drawArray) {\n this.remove(this.drawArray[i]);\n this.drawArray[i] = null;\n }\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n }\n }, {\n key: \"setOpacity\",\n value: function setOpacity(opacity) {\n this.opacity = opacity;\n for (var i in this.drawArray) {\n this.drawArray[i].mesh.model.material.opacity = this.opacity;\n }\n }\n }, {\n key: \"update\",\n value: function () {\n var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(point) {\n var texture, _texture2, _w, dep, p, index, _point, geometry, material, mesh, dom;\n return _regeneratorRuntime().wrap(function _callee2$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n point.text = point.text ? point.text : '';\n if (this.forceClear) {\n three__WEBPACK_IMPORTED_MODULE_3__.Cache.clear();\n (_texture2 = texture) === null || _texture2 === void 0 || _texture2.dispose();\n }\n if (!point.image) {\n _context3.next = 9;\n break;\n }\n _w = point.distance * point.rp * 2;\n dep = point.rp * 2;\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(point.image, _w, _w, three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);\n // var width = 32; //纹理宽度\n // var height = 32; //纹理高度\n // var size = width * height; //像素大小\n // var data = new Uint8Array(size * 3); //size*3:像素在缓冲区占用空间\n // for (let i = 0; i < size * 3; i += 3) {\n // // 随机设置RGB分量的值\n // data[i] = 255 * Math.random()\n // data[i + 1] = 255 * Math.random()\n // data[i + 2] = 255 * Math.random()\n\n // 创建数据文理对象 RGB格式:THREE.RGBFormat\n //texture = new THREE.DataTexture(data, width, height, THREE.RGBFormat);\n texture.needsUpdate = true; //纹理更新\n _context3.next = 15;\n break;\n case 9:\n if (!point.url) {\n _context3.next = 15;\n break;\n }\n if (this.forceClear) {\n point.url += \"?tempid=\".concat(Math.random());\n }\n p = function p() {\n return new Promise(function (resolve, reject) {\n new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url, function (_texture) {\n resolve(_texture);\n });\n });\n };\n _context3.next = 14;\n return p();\n case 14:\n texture = _context3.sent;\n case 15:\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n //texture.flipX = true; \n index = this.drawArray.findIndex(function (a) {\n return a.center[0] == point.center[0] && a.center[1] == point.center[1];\n });\n if (index >= 0) {\n _point = this.drawArray[index];\n if (this.forceClear) {\n _point.mesh.model.material.map.dispose();\n }\n _point.mesh.model.material.map = texture;\n _point.mesh.label.element.innerHTML = point.text;\n } else {\n geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20); //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n mesh.label.element.innerHTML = point.text;\n point.mesh = mesh;\n this.drawArray.push(point);\n }\n case 19:\n case \"end\":\n return _context3.stop();\n }\n }, _callee2, this);\n }));\n function update(_x2) {\n return _update.apply(this, arguments);\n }\n return update;\n }()\n }, {\n key: \"drawImage\",\n value: function drawImage(point) {\n var texture;\n if (point.image) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader(point.image);\n } else if (point.url) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url);\n }\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n var geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20);\n //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n var material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n var mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n var dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n point.mesh = mesh;\n }\n }, {\n key: \"onAdd\",\n value: function onAdd(map, gl) {\n this.map = map;\n tb = new threebox_plugin__WEBPACK_IMPORTED_MODULE_2__.Threebox(map, gl,\n //get the context from Mapbox\n {\n defaultLights: true,\n passiveRendering: false\n });\n }\n }, {\n key: \"render\",\n value: function render(gl, matrix) {\n tb.update();\n this.map.triggerRepaint();\n }\n }]);\n}();\n\n\n//# sourceURL=webpack://@ohuoy/easymap/./src/components/layer/ThreeScanLayer.js?");
|
|
4961
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ThreeScanLayer)\n/* harmony export */ });\n/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../lib/mapbox-gl/dist/mapbox-gl.js */ \"./lib/mapbox-gl/dist/mapbox-gl.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! threebox-plugin */ \"./node_modules/threebox-plugin/main.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(threebox_plugin__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\n\nvar tb = {};\nvar ThreeScanLayer = /*#__PURE__*/function () {\n function ThreeScanLayer(id, config) {\n _classCallCheck(this, ThreeScanLayer);\n _defineProperty(this, \"drawArray\", []);\n _defineProperty(this, \"opacity\", 0.8);\n _defineProperty(this, \"textClass\", '');\n _defineProperty(this, \"forceClear\", false);\n _defineProperty(this, \"rectMesh\", {\n mesh: null,\n w: 0.5,\n lng: 0,\n lat: 0\n });\n this.id = id;\n this.opacity = Number(config.opacity);\n this.textClass = config.textClass ? config.textClass : '';\n this.type = 'custom';\n this.renderingMode = '2d';\n this.forceClear = config === null || config === void 0 ? void 0 : config.forceClear;\n }\n\n //同时渲染多个地点图片文本\n return _createClass(ThreeScanLayer, [{\n key: \"drawImageList\",\n value: function () {\n var _drawImageList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(list) {\n var _this = this;\n var delay,\n i,\n _loop,\n _i,\n canvas,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n delay = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 300;\n _context2.t0 = _regeneratorRuntime().keys(list);\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 8;\n break;\n }\n i = _context2.t1.value;\n _context2.next = 6;\n return this.update(list[i]);\n case 6:\n _context2.next = 2;\n break;\n case 8:\n _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(_i) {\n var _point;\n return _regeneratorRuntime().wrap(function _loop$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _point = list.find(function (a) {\n return a.center[0] == _this.drawArray[_i].center[0] && a.center[1] == _this.drawArray[_i].center[1];\n });\n if (!_point) {\n _this.remove(_this.drawArray[_i]);\n _this.drawArray[_i] = null;\n }\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _loop);\n });\n _context2.t2 = _regeneratorRuntime().keys(this.drawArray);\n case 10:\n if ((_context2.t3 = _context2.t2()).done) {\n _context2.next = 15;\n break;\n }\n _i = _context2.t3.value;\n return _context2.delegateYield(_loop(_i), \"t4\", 13);\n case 13:\n _context2.next = 10;\n break;\n case 15:\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n _context2.next = 20;\n return (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.sleep)(delay);\n case 20:\n canvas = this.map.getCanvas();\n return _context2.abrupt(\"return\", canvas.toDataURL());\n case 22:\n case \"end\":\n return _context2.stop();\n }\n }, _callee, this);\n }));\n function drawImageList(_x) {\n return _drawImageList.apply(this, arguments);\n }\n return drawImageList;\n }()\n }, {\n key: \"remove\",\n value: function remove(point) {\n point.mesh.label.element.remove();\n tb.remove(point.mesh);\n }\n }, {\n key: \"removeAll\",\n value: function removeAll() {\n for (var i in this.drawArray) {\n this.remove(this.drawArray[i]);\n this.drawArray[i] = null;\n }\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n }\n }, {\n key: \"setOpacity\",\n value: function setOpacity(opacity) {\n this.opacity = opacity;\n for (var i in this.drawArray) {\n this.drawArray[i].mesh.model.material.opacity = this.opacity;\n }\n }\n }, {\n key: \"updateRect\",\n value: function updateRect(point) {\n var w = point.rect.width ? point.rect.width : this.rectMesh.w;\n if (!this.rectMesh.mesh || w != this.rectMesh.w || point.rect.position[0] != this.rectMesh.lng || point.rect.position[1] != this.rectMesh.lat) {\n if (this.rectMesh.mesh) {\n tb.remove(this.rectMesh.mesh);\n }\n var bounds = (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.getLayerMapPosition)(w, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.rect.position));\n bounds.push(bounds[0]);\n var lineOptions = {\n geometry: bounds,\n color: 0xff1f00,\n // color based on latitude of endpoint\n width: 20 // random width between 1 and 2\n };\n var lineMesh = tb.line(lineOptions);\n this.rectMesh.mesh = lineMesh;\n tb.add(lineMesh);\n // if(this.rectMesh.mesh){\n // tb.remove(this.rectMesh.mesh)\n // }\n // let plane = new THREE.PlaneGeometry( w*20,w*20);\n // let material = new THREE.MeshLambertMaterial({\n // color: 0x004444,\n // transparent:true,\n // opacity:0.5,\n // });\n // let mesh = new THREE.Mesh(plane, material);\n // let edges = new THREE.EdgesGeometry(plane);\n // let edgesMaterial = new THREE.LineBasicMaterial({\n // color: 0xffffff,\n // linewidth:5\n // })\n\n // let line = new THREE.LineSegments(edges, edgesMaterial);\n // mesh.add(line);\n // mesh = tb.Object3D({ obj: mesh, units: 'meters',fixedZoom :15 ,anchor:'center'});\n // this.rectMesh.mesh = mesh;\n // this.rectMesh.w = w;\n }\n // if(this.rectMesh.mesh){\n // this.rectMesh.mesh.setCoords(transform(point.rect.position))\n // tb.add(this.rectMesh.mesh);\n // }\n }\n }, {\n key: \"update\",\n value: function () {\n var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(point) {\n var texture, _texture2, _w, dep, p, index, _point, geometry, material, mesh, dom, _geometry, _material, _mesh, _dom;\n return _regeneratorRuntime().wrap(function _callee2$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n point.text = point.text ? point.text : '';\n if (this.forceClear) {\n three__WEBPACK_IMPORTED_MODULE_3__.Cache.clear();\n (_texture2 = texture) === null || _texture2 === void 0 || _texture2.dispose();\n }\n if (!point.image) {\n _context3.next = 9;\n break;\n }\n _w = point.distance * point.rp * 2;\n dep = point.rp * 2;\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(point.image, _w, _w, three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);\n // var width = 32; //纹理宽度\n // var height = 32; //纹理高度\n // var size = width * height; //像素大小\n // var data = new Uint8Array(size * 3); //size*3:像素在缓冲区占用空间\n // for (let i = 0; i < size * 3; i += 3) {\n // // 随机设置RGB分量的值\n // data[i] = 255 * Math.random()\n // data[i + 1] = 255 * Math.random()\n // data[i + 2] = 255 * Math.random()\n\n // 创建数据文理对象 RGB格式:THREE.RGBFormat\n //texture = new THREE.DataTexture(data, width, height, THREE.RGBFormat);\n texture.needsUpdate = true; //纹理更新\n _context3.next = 15;\n break;\n case 9:\n if (!point.url) {\n _context3.next = 15;\n break;\n }\n if (this.forceClear) {\n point.url += \"?tempid=\".concat(Math.random());\n }\n p = function p() {\n return new Promise(function (resolve, reject) {\n new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url, function (_texture) {\n resolve(_texture);\n });\n });\n };\n _context3.next = 14;\n return p();\n case 14:\n texture = _context3.sent;\n case 15:\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n //texture.flipX = true; \n index = this.drawArray.findIndex(function (a) {\n return a.center[0] == point.center[0] && a.center[1] == point.center[1];\n });\n if (index >= 0) {\n _point = this.drawArray[index];\n if (_point && point.width != _point.width) {\n this.remove(this.drawArray[index]);\n this.drawArray[index] = null;\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20); //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n mesh.label.element.innerHTML = point.text;\n point.mesh = mesh;\n this.drawArray.push(point);\n if (point.rect) {\n this.updateRect(point);\n }\n } else {\n if (this.forceClear) {\n _point.mesh.model.material.map.dispose();\n }\n _point.mesh.model.material.map = texture;\n _point.mesh.label.element.innerHTML = point.text;\n if (point.rect) {\n this.updateRect(point);\n }\n }\n } else {\n _geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20); //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n _material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n _material.color.convertSRGBToLinear();\n _mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(_geometry, _material);\n _mesh.name = 'scanimg';\n _mesh = tb.Object3D({\n obj: _mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n _mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(_mesh);\n _dom = document.createElement('div');\n _mesh.addLabel(_dom, true, {\n x: _mesh.anchor.x,\n y: _mesh.anchor.y + point.distance * 1200,\n z: _mesh.anchor.z\n }, 0);\n _mesh.label.element.className += '' + this.textClass;\n _mesh.label.element.style.fontSize = '24px';\n _mesh.label.element.innerHTML = point.text;\n point.mesh = _mesh;\n this.drawArray.push(point);\n if (point.rect) {\n this.updateRect(point);\n }\n }\n case 19:\n case \"end\":\n return _context3.stop();\n }\n }, _callee2, this);\n }));\n function update(_x2) {\n return _update.apply(this, arguments);\n }\n return update;\n }()\n }, {\n key: \"drawImage\",\n value: function drawImage(point) {\n var texture;\n if (point.image) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader(point.image);\n } else if (point.url) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url);\n }\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n var geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20);\n //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n var material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n var mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n var dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n point.mesh = mesh;\n }\n }, {\n key: \"onAdd\",\n value: function onAdd(map, gl) {\n this.map = map;\n tb = new threebox_plugin__WEBPACK_IMPORTED_MODULE_2__.Threebox(map, gl,\n //get the context from Mapbox\n {\n defaultLights: true,\n passiveRendering: false\n });\n }\n }, {\n key: \"render\",\n value: function render(gl, matrix) {\n tb.update();\n this.map.triggerRepaint();\n }\n }]);\n}();\n\n\n//# sourceURL=webpack://@ohuoy/easymap/./src/components/layer/ThreeScanLayer.js?");
|
|
4962
4962
|
|
|
4963
4963
|
/***/ }),
|
|
4964
4964
|
|
|
@@ -4984,6 +4984,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4984
4984
|
|
|
4985
4985
|
/***/ }),
|
|
4986
4986
|
|
|
4987
|
+
/***/ "./src/components/mapOutScreen.js":
|
|
4988
|
+
/*!****************************************!*\
|
|
4989
|
+
!*** ./src/components/mapOutScreen.js ***!
|
|
4990
|
+
\****************************************/
|
|
4991
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4992
|
+
|
|
4993
|
+
"use strict";
|
|
4994
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_antv_l7__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../lib/@antv/l7 */ \"./lib/@antv/l7/es/index.js\");\n/* harmony import */ var _lib_antv_l7_maps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/@antv/l7-maps */ \"./lib/@antv/l7-maps/es/mapbox/index.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\nvar mapOutScreen = /*#__PURE__*/function () {\n function mapOutScreen(center, distance) {\n var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n target: null,\n style: 'http://192.168.11.93:1234/api/styles/osm',\n type: 'blob',\n pix: {\n w: 1024,\n h: 1024\n },\n callback: function callback() {}\n };\n var progress = arguments.length > 3 ? arguments[3] : undefined;\n _classCallCheck(this, mapOutScreen);\n _defineProperty(this, \"config\", void 0);\n _defineProperty(this, \"center\", void 0);\n _defineProperty(this, \"distance\", void 0);\n _defineProperty(this, \"target\", void 0);\n _defineProperty(this, \"canvas\", void 0);\n _defineProperty(this, \"map\", void 0);\n _defineProperty(this, \"ctx\", void 0);\n _defineProperty(this, \"progress\", function () {});\n this.config = Object.assign({}, {\n target: null,\n type: 'blob',\n delay: 300,\n pix: {\n w: 1024,\n h: 1024\n },\n opacity: 0.7,\n style: 'http://192.168.11.93:1234/api/styles/osm',\n callback: function callback() {}\n }, config);\n if (!this.config.target) {\n this.target = document.createElement('div');\n } else {\n this.target = this.config.target;\n }\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n var pix = this.config.pix;\n this.distance = distance;\n this.center = center;\n this.progress = progress ? progress : this.progress;\n this.target.style = \"width:\".concat(pix.w, \"px;height:\").concat(pix.h, \"px;z-index:-1;\");\n this.canvas.width = pix.w;\n this.canvas.height = pix.h;\n document.body.appendChild(this.target);\n }\n return _createClass(mapOutScreen, [{\n key: \"getImageList\",\n value: function () {\n var _getImageList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(imageList) {\n var _this = this;\n var padding,\n center,\n distance,\n bounds,\n ret,\n scene,\n base64,\n scanLayer,\n i,\n a,\n _base2,\n nBase64,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n padding = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 26;\n center = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : null;\n distance = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : null;\n distance = distance ? distance : this.distance;\n center = center ? center : this.center;\n bounds = (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.getLayerMapPosition)(distance, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(center));\n ret = [];\n if (this.map) {\n _context2.next = 13;\n break;\n }\n scene = new _lib_antv_l7__WEBPACK_IMPORTED_MODULE_1__.Scene({\n id: this.target,\n // map: new Mapbox({\n // mapInstance: map,\n // }),\n map: new _lib_antv_l7_maps__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n style: this.config.style,\n preserveDrawingBuffer: true,\n //center:transform([114.7198975,23.0446]),\n bounds: [bounds[0], bounds[2]],\n fitBoundsOptions: {\n padding: padding\n },\n container: this.target,\n opacity: 0.7,\n pitch: 0,\n zoom: 0,\n rotation: 0,\n token: '' //'pk.eyJ1Ijoid2hpdGVidWxkaW5nIiwiYSI6ImNsc3UwaXlnZDIwbDkybG1qbXJ6YnRtcmwifQ.jtQeo0gt3UNTCWw5FEyv_w',\n })\n });\n this.map = scene.map;\n return _context2.abrupt(\"return\", new Promise(function (resolve, reject) {\n scene.map.on('load', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var base64, scanLayer, i, a, _base, nBase64;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!(!imageList || imageList.length == 0)) {\n _context.next = 5;\n break;\n }\n base64 = scene.map._canvas.toDataURL();\n if (_this.config.type == 'download') {\n (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileByBase64)(base64, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.guid)());\n } //downloadFileByBase64(base64,guid())\n else if (_this.config.type == 'blob') {\n if (_this.config.callback) _this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n }\n _context.next = 27;\n break;\n case 5:\n scanLayer = _this.map.getLayer('threescan-layer');\n if (!scanLayer) {\n scanLayer = new EmComponents.ThreeScanLayer('threescan-layer', {\n opacity: _this.config.opacity,\n textClass: ' map-time zmax '\n });\n _this.map.addLayer(scanLayer);\n }\n _context.t0 = _regeneratorRuntime().keys(imageList);\n case 8:\n if ((_context.t1 = _context.t0()).done) {\n _context.next = 27;\n break;\n }\n i = _context.t1.value;\n a = imageList[i];\n _context.next = 13;\n return scanLayer.drawImageList(a, _this.config.delay);\n case 13:\n _base = _context.sent;\n _this.progress(i / (imageList.length - 1), a);\n if (!a[0].addTime) {\n _context.next = 23;\n break;\n }\n _context.next = 18;\n return _this.drawText(a[0], _base);\n case 18:\n nBase64 = _context.sent;\n if (_this.config.callback) _this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n _context.next = 25;\n break;\n case 23:\n if (_this.config.callback) _this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base));\n case 25:\n _context.next = 8;\n break;\n case 27:\n resolve(ret);\n //target.remove() \n case 28:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n })));\n }));\n case 13:\n this.map.fitBounds([bounds[0], bounds[2]], {\n duration: 200\n });\n _context2.next = 16;\n return (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.sleep)(600);\n case 16:\n if (!(!imageList || imageList.length == 0)) {\n _context2.next = 21;\n break;\n }\n base64 = this.map._canvas.toDataURL();\n if (config.type == 'download') {\n (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileByBase64)(base64, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.guid)());\n ret.push(base64);\n } //downloadFileByBase64(base64,guid())\n else if (this.config.type == 'blob') {\n if (this.config.callback) this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n }\n _context2.next = 43;\n break;\n case 21:\n scanLayer = this.map.getLayer('threescan-layer');\n if (!scanLayer) {\n scanLayer = new EmComponents.ThreeScanLayer('threescan-layer', {\n opacity: this.config.opacity,\n textClass: ' map-time zmax '\n });\n this.map.addLayer(scanLayer);\n }\n _context2.t0 = _regeneratorRuntime().keys(imageList);\n case 24:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 43;\n break;\n }\n i = _context2.t1.value;\n a = imageList[i];\n _context2.next = 29;\n return scanLayer.drawImageList(a, this.config.delay);\n case 29:\n _base2 = _context2.sent;\n this.progress(i / (imageList.length - 1), a);\n // map.getCanvas().toDataURL()\n if (!a[0].addTime) {\n _context2.next = 39;\n break;\n }\n _context2.next = 34;\n return this.drawText(a[0], _base2);\n case 34:\n nBase64 = _context2.sent;\n if (this.config.callback) this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n _context2.next = 41;\n break;\n case 39:\n if (this.config.callback) this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base2));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base2));\n case 41:\n _context2.next = 24;\n break;\n case 43:\n return _context2.abrupt(\"return\", ret);\n case 44:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function getImageList(_x) {\n return _getImageList.apply(this, arguments);\n }\n return getImageList;\n }()\n }, {\n key: \"drawText\",\n value: function drawText(point, base64) {\n var _this2 = this;\n return new Promise(function (resolve) {\n _this2.ctx.clearRect(0, 0, _this2.canvas.width, _this2.canvas.height);\n var imgItemEl = new Image();\n imgItemEl.crossOrigin = \"anonymous\";\n imgItemEl.src = base64;\n imgItemEl.onload = function (b) {\n _this2.ctx.drawImage(b.currentTarget, 0, 0, _this2.canvas.width, _this2.canvas.height);\n _this2.ctx.font = point.addTime.font ? point.addTime.font : '32px SimHei';\n _this2.ctx.fillText(point.addTime.text, point.addTime.left, point.addTime.top);\n resolve(_this2.canvas.toDataURL());\n };\n });\n }\n }]);\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mapOutScreen);\n\n//# sourceURL=webpack://@ohuoy/easymap/./src/components/mapOutScreen.js?");
|
|
4995
|
+
|
|
4996
|
+
/***/ }),
|
|
4997
|
+
|
|
4987
4998
|
/***/ "./src/utils/CameraSync.js":
|
|
4988
4999
|
/*!*********************************!*\
|
|
4989
5000
|
!*** ./src/utils/CameraSync.js ***!
|
|
@@ -4661,7 +4661,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4661
4661
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4662
4662
|
|
|
4663
4663
|
"use strict";
|
|
4664
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EasyMap: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.EasyMap),\n/* harmony export */ EffectComposer: () => (/* reexport safe */
|
|
4664
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EasyMap: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.EasyMap),\n/* harmony export */ EffectComposer: () => (/* reexport safe */ three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_11__.EffectComposer),\n/* harmony export */ EmComponents: () => (/* reexport module object */ _src_components_index__WEBPACK_IMPORTED_MODULE_1__),\n/* harmony export */ EmUtils: () => (/* reexport module object */ _src_utils_util__WEBPACK_IMPORTED_MODULE_2__),\n/* harmony export */ FXAAShader: () => (/* reexport safe */ three_examples_jsm_shaders_FXAAShader_js__WEBPACK_IMPORTED_MODULE_18__.FXAAShader),\n/* harmony export */ FontLoader: () => (/* reexport safe */ three_addons_loaders_FontLoader_js__WEBPACK_IMPORTED_MODULE_17__.FontLoader),\n/* harmony export */ GammaCorrectionShader: () => (/* reexport safe */ three_examples_jsm_shaders_GammaCorrectionShader_js__WEBPACK_IMPORTED_MODULE_19__.GammaCorrectionShader),\n/* harmony export */ Line2: () => (/* reexport safe */ three_addons_lines_Line2_js__WEBPACK_IMPORTED_MODULE_6__.Line2),\n/* harmony export */ LineGeometry: () => (/* reexport safe */ three_addons_lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_15__.LineGeometry),\n/* harmony export */ LineMaterial: () => (/* reexport safe */ three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_16__.LineMaterial),\n/* harmony export */ OrbitControls: () => (/* reexport safe */ three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_7__.OrbitControls),\n/* harmony export */ OutlinePass: () => (/* reexport safe */ three_examples_jsm_postprocessing_OutlinePass_js__WEBPACK_IMPORTED_MODULE_14__.OutlinePass),\n/* harmony export */ RenderPass: () => (/* reexport safe */ three_examples_jsm_postprocessing_RenderPass_js__WEBPACK_IMPORTED_MODULE_12__.RenderPass),\n/* harmony export */ ShaderPass: () => (/* reexport safe */ three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_13__.ShaderPass),\n/* harmony export */ Three: () => (/* reexport module object */ three__WEBPACK_IMPORTED_MODULE_9__),\n/* harmony export */ TrackballControls: () => (/* reexport safe */ three_addons_controls_TrackballControls_js__WEBPACK_IMPORTED_MODULE_10__.TrackballControls),\n/* harmony export */ UnrealBloomPass: () => (/* reexport safe */ three_examples_jsm_postprocessing_UnrealBloomPass__WEBPACK_IMPORTED_MODULE_8__.UnrealBloomPass),\n/* harmony export */ ant7: () => (/* reexport module object */ _lib_antv_l7__WEBPACK_IMPORTED_MODULE_4__),\n/* harmony export */ mapOutScreen: () => (/* reexport safe */ _src_components_mapOutScreen_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]),\n/* harmony export */ mapboxgl: () => (/* reexport safe */ _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])\n/* harmony export */ });\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ \"./index.js\");\n/* harmony import */ var _src_components_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/components/index */ \"./src/components/index.js\");\n/* harmony import */ var _src_utils_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/mapbox-gl/dist/mapbox-gl.js */ \"./lib/mapbox-gl/dist/mapbox-gl.js\");\n/* harmony import */ var _lib_antv_l7__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/@antv/l7 */ \"./lib/@antv/l7/es/index.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var three_addons_controls_TrackballControls_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! three/addons/controls/TrackballControls.js */ \"./node_modules/three/examples/jsm/controls/TrackballControls.js\");\n/* harmony import */ var three_addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! three/addons/controls/OrbitControls.js */ \"./node_modules/three/examples/jsm/controls/OrbitControls.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_EffectComposer_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! three/examples/jsm/postprocessing/EffectComposer.js */ \"./node_modules/three/examples/jsm/postprocessing/EffectComposer.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_RenderPass_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! three/examples/jsm/postprocessing/RenderPass.js */ \"./node_modules/three/examples/jsm/postprocessing/RenderPass.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_ShaderPass_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! three/examples/jsm/postprocessing/ShaderPass.js */ \"./node_modules/three/examples/jsm/postprocessing/ShaderPass.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_OutlinePass_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! three/examples/jsm/postprocessing/OutlinePass.js */ \"./node_modules/three/examples/jsm/postprocessing/OutlinePass.js\");\n/* harmony import */ var three_examples_jsm_shaders_FXAAShader_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! three/examples/jsm/shaders/FXAAShader.js */ \"./node_modules/three/examples/jsm/shaders/FXAAShader.js\");\n/* harmony import */ var three_examples_jsm_postprocessing_UnrealBloomPass__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! three/examples/jsm/postprocessing/UnrealBloomPass */ \"./node_modules/three/examples/jsm/postprocessing/UnrealBloomPass.js\");\n/* harmony import */ var three_addons_lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! three/addons/lines/LineGeometry.js */ \"./node_modules/three/examples/jsm/lines/LineGeometry.js\");\n/* harmony import */ var three_addons_lines_Line2_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! three/addons/lines/Line2.js */ \"./node_modules/three/examples/jsm/lines/Line2.js\");\n/* harmony import */ var three_examples_jsm_lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! three/examples/jsm/lines/LineMaterial.js */ \"./node_modules/three/examples/jsm/lines/LineMaterial.js\");\n/* harmony import */ var three_addons_loaders_FontLoader_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! three/addons/loaders/FontLoader.js */ \"./node_modules/three/examples/jsm/loaders/FontLoader.js\");\n/* harmony import */ var three_examples_jsm_shaders_GammaCorrectionShader_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! three/examples/jsm/shaders/GammaCorrectionShader.js */ \"./node_modules/three/examples/jsm/shaders/GammaCorrectionShader.js\");\n/* harmony import */ var _src_components_mapOutScreen_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./src/components/mapOutScreen.js */ \"./src/components/mapOutScreen.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nwindow.EasyMap = _index__WEBPACK_IMPORTED_MODULE_0__.EasyMap;\nwindow.EmComponents = _src_components_index__WEBPACK_IMPORTED_MODULE_1__;\nwindow.EmUtils = _src_utils_util__WEBPACK_IMPORTED_MODULE_2__;\nwindow.mapOutScreen = _src_components_mapOutScreen_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n// const modulesFiles = import.meta.glob('./src/components/*.js')\n// console.log(modulesFiles)\n// Object.entries(modulesFiles).forEach(a=>{\n// console.log(a)\n// })\n\n\n\n//# sourceURL=webpack://@ohuoy/easymap/./main.js?");
|
|
4665
4665
|
|
|
4666
4666
|
/***/ }),
|
|
4667
4667
|
|
|
@@ -4958,7 +4958,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4958
4958
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4959
4959
|
|
|
4960
4960
|
"use strict";
|
|
4961
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ThreeScanLayer)\n/* harmony export */ });\n/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../lib/mapbox-gl/dist/mapbox-gl.js */ \"./lib/mapbox-gl/dist/mapbox-gl.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! threebox-plugin */ \"./node_modules/threebox-plugin/main.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(threebox_plugin__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\nvar tb = {};\nvar ThreeScanLayer = /*#__PURE__*/function () {\n function ThreeScanLayer(id, config) {\n _classCallCheck(this, ThreeScanLayer);\n _defineProperty(this, \"drawArray\", []);\n _defineProperty(this, \"opacity\", 0.8);\n _defineProperty(this, \"textClass\", '');\n _defineProperty(this, \"forceClear\", false);\n this.id = id;\n this.opacity = Number(config.opacity);\n this.textClass = config.textClass ? config.textClass : '';\n this.type = 'custom';\n this.renderingMode = '2d';\n this.forceClear = config === null || config === void 0 ? void 0 : config.forceClear;\n }\n\n //同时渲染多个地点图片文本\n return _createClass(ThreeScanLayer, [{\n key: \"drawImageList\",\n value: function () {\n var _drawImageList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(list) {\n var _this = this;\n var delay,\n i,\n _loop,\n _i,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n delay = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 300;\n _context2.t0 = _regeneratorRuntime().keys(list);\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 8;\n break;\n }\n i = _context2.t1.value;\n _context2.next = 6;\n return this.update(list[i]);\n case 6:\n _context2.next = 2;\n break;\n case 8:\n _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(_i) {\n var _point;\n return _regeneratorRuntime().wrap(function _loop$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _point = list.find(function (a) {\n return a.center[0] == _this.drawArray[_i].center[0] && a.center[1] == _this.drawArray[_i].center[1];\n });\n if (!_point) {\n _this.remove(_this.drawArray[_i]);\n _this.drawArray[_i] = null;\n }\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _loop);\n });\n _context2.t2 = _regeneratorRuntime().keys(this.drawArray);\n case 10:\n if ((_context2.t3 = _context2.t2()).done) {\n _context2.next = 15;\n break;\n }\n _i = _context2.t3.value;\n return _context2.delegateYield(_loop(_i), \"t4\", 13);\n case 13:\n _context2.next = 10;\n break;\n case 15:\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n _context2.next = 20;\n return (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.sleep)(delay);\n case 20:\n return _context2.abrupt(\"return\", this.map.getCanvas().toDataURL());\n case 21:\n case \"end\":\n return _context2.stop();\n }\n }, _callee, this);\n }));\n function drawImageList(_x) {\n return _drawImageList.apply(this, arguments);\n }\n return drawImageList;\n }()\n }, {\n key: \"remove\",\n value: function remove(point) {\n point.mesh.label.element.remove();\n tb.remove(point.mesh);\n }\n }, {\n key: \"removeAll\",\n value: function removeAll() {\n for (var i in this.drawArray) {\n this.remove(this.drawArray[i]);\n this.drawArray[i] = null;\n }\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n }\n }, {\n key: \"setOpacity\",\n value: function setOpacity(opacity) {\n this.opacity = opacity;\n for (var i in this.drawArray) {\n this.drawArray[i].mesh.model.material.opacity = this.opacity;\n }\n }\n }, {\n key: \"update\",\n value: function () {\n var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(point) {\n var texture, _texture2, _w, dep, p, index, _point, geometry, material, mesh, dom;\n return _regeneratorRuntime().wrap(function _callee2$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n point.text = point.text ? point.text : '';\n if (this.forceClear) {\n three__WEBPACK_IMPORTED_MODULE_3__.Cache.clear();\n (_texture2 = texture) === null || _texture2 === void 0 || _texture2.dispose();\n }\n if (!point.image) {\n _context3.next = 9;\n break;\n }\n _w = point.distance * point.rp * 2;\n dep = point.rp * 2;\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(point.image, _w, _w, three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);\n // var width = 32; //纹理宽度\n // var height = 32; //纹理高度\n // var size = width * height; //像素大小\n // var data = new Uint8Array(size * 3); //size*3:像素在缓冲区占用空间\n // for (let i = 0; i < size * 3; i += 3) {\n // // 随机设置RGB分量的值\n // data[i] = 255 * Math.random()\n // data[i + 1] = 255 * Math.random()\n // data[i + 2] = 255 * Math.random()\n\n // 创建数据文理对象 RGB格式:THREE.RGBFormat\n //texture = new THREE.DataTexture(data, width, height, THREE.RGBFormat);\n texture.needsUpdate = true; //纹理更新\n _context3.next = 15;\n break;\n case 9:\n if (!point.url) {\n _context3.next = 15;\n break;\n }\n if (this.forceClear) {\n point.url += \"?tempid=\".concat(Math.random());\n }\n p = function p() {\n return new Promise(function (resolve, reject) {\n new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url, function (_texture) {\n resolve(_texture);\n });\n });\n };\n _context3.next = 14;\n return p();\n case 14:\n texture = _context3.sent;\n case 15:\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n //texture.flipX = true; \n index = this.drawArray.findIndex(function (a) {\n return a.center[0] == point.center[0] && a.center[1] == point.center[1];\n });\n if (index >= 0) {\n _point = this.drawArray[index];\n if (this.forceClear) {\n _point.mesh.model.material.map.dispose();\n }\n _point.mesh.model.material.map = texture;\n _point.mesh.label.element.innerHTML = point.text;\n } else {\n geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20); //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n mesh.label.element.innerHTML = point.text;\n point.mesh = mesh;\n this.drawArray.push(point);\n }\n case 19:\n case \"end\":\n return _context3.stop();\n }\n }, _callee2, this);\n }));\n function update(_x2) {\n return _update.apply(this, arguments);\n }\n return update;\n }()\n }, {\n key: \"drawImage\",\n value: function drawImage(point) {\n var texture;\n if (point.image) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader(point.image);\n } else if (point.url) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url);\n }\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n var geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20);\n //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n var material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n var mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n var dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n point.mesh = mesh;\n }\n }, {\n key: \"onAdd\",\n value: function onAdd(map, gl) {\n this.map = map;\n tb = new threebox_plugin__WEBPACK_IMPORTED_MODULE_2__.Threebox(map, gl,\n //get the context from Mapbox\n {\n defaultLights: true,\n passiveRendering: false\n });\n }\n }, {\n key: \"render\",\n value: function render(gl, matrix) {\n tb.update();\n this.map.triggerRepaint();\n }\n }]);\n}();\n\n\n//# sourceURL=webpack://@ohuoy/easymap/./src/components/layer/ThreeScanLayer.js?");
|
|
4961
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ThreeScanLayer)\n/* harmony export */ });\n/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_mapbox_gl_dist_mapbox_gl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../lib/mapbox-gl/dist/mapbox-gl.js */ \"./lib/mapbox-gl/dist/mapbox-gl.js\");\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! threebox-plugin */ \"./node_modules/threebox-plugin/main.js\");\n/* harmony import */ var threebox_plugin__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(threebox_plugin__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\n\nvar tb = {};\nvar ThreeScanLayer = /*#__PURE__*/function () {\n function ThreeScanLayer(id, config) {\n _classCallCheck(this, ThreeScanLayer);\n _defineProperty(this, \"drawArray\", []);\n _defineProperty(this, \"opacity\", 0.8);\n _defineProperty(this, \"textClass\", '');\n _defineProperty(this, \"forceClear\", false);\n _defineProperty(this, \"rectMesh\", {\n mesh: null,\n w: 0.5,\n lng: 0,\n lat: 0\n });\n this.id = id;\n this.opacity = Number(config.opacity);\n this.textClass = config.textClass ? config.textClass : '';\n this.type = 'custom';\n this.renderingMode = '2d';\n this.forceClear = config === null || config === void 0 ? void 0 : config.forceClear;\n }\n\n //同时渲染多个地点图片文本\n return _createClass(ThreeScanLayer, [{\n key: \"drawImageList\",\n value: function () {\n var _drawImageList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(list) {\n var _this = this;\n var delay,\n i,\n _loop,\n _i,\n canvas,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n delay = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 300;\n _context2.t0 = _regeneratorRuntime().keys(list);\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 8;\n break;\n }\n i = _context2.t1.value;\n _context2.next = 6;\n return this.update(list[i]);\n case 6:\n _context2.next = 2;\n break;\n case 8:\n _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(_i) {\n var _point;\n return _regeneratorRuntime().wrap(function _loop$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _point = list.find(function (a) {\n return a.center[0] == _this.drawArray[_i].center[0] && a.center[1] == _this.drawArray[_i].center[1];\n });\n if (!_point) {\n _this.remove(_this.drawArray[_i]);\n _this.drawArray[_i] = null;\n }\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _loop);\n });\n _context2.t2 = _regeneratorRuntime().keys(this.drawArray);\n case 10:\n if ((_context2.t3 = _context2.t2()).done) {\n _context2.next = 15;\n break;\n }\n _i = _context2.t3.value;\n return _context2.delegateYield(_loop(_i), \"t4\", 13);\n case 13:\n _context2.next = 10;\n break;\n case 15:\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n _context2.next = 20;\n return (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.sleep)(delay);\n case 20:\n canvas = this.map.getCanvas();\n return _context2.abrupt(\"return\", canvas.toDataURL());\n case 22:\n case \"end\":\n return _context2.stop();\n }\n }, _callee, this);\n }));\n function drawImageList(_x) {\n return _drawImageList.apply(this, arguments);\n }\n return drawImageList;\n }()\n }, {\n key: \"remove\",\n value: function remove(point) {\n point.mesh.label.element.remove();\n tb.remove(point.mesh);\n }\n }, {\n key: \"removeAll\",\n value: function removeAll() {\n for (var i in this.drawArray) {\n this.remove(this.drawArray[i]);\n this.drawArray[i] = null;\n }\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n tb.update();\n this.map.triggerRepaint();\n }\n }, {\n key: \"setOpacity\",\n value: function setOpacity(opacity) {\n this.opacity = opacity;\n for (var i in this.drawArray) {\n this.drawArray[i].mesh.model.material.opacity = this.opacity;\n }\n }\n }, {\n key: \"updateRect\",\n value: function updateRect(point) {\n var w = point.rect.width ? point.rect.width : this.rectMesh.w;\n if (!this.rectMesh.mesh || w != this.rectMesh.w || point.rect.position[0] != this.rectMesh.lng || point.rect.position[1] != this.rectMesh.lat) {\n if (this.rectMesh.mesh) {\n tb.remove(this.rectMesh.mesh);\n }\n var bounds = (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.getLayerMapPosition)(w, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.rect.position));\n bounds.push(bounds[0]);\n var lineOptions = {\n geometry: bounds,\n color: 0xff1f00,\n // color based on latitude of endpoint\n width: 20 // random width between 1 and 2\n };\n var lineMesh = tb.line(lineOptions);\n this.rectMesh.mesh = lineMesh;\n tb.add(lineMesh);\n // if(this.rectMesh.mesh){\n // tb.remove(this.rectMesh.mesh)\n // }\n // let plane = new THREE.PlaneGeometry( w*20,w*20);\n // let material = new THREE.MeshLambertMaterial({\n // color: 0x004444,\n // transparent:true,\n // opacity:0.5,\n // });\n // let mesh = new THREE.Mesh(plane, material);\n // let edges = new THREE.EdgesGeometry(plane);\n // let edgesMaterial = new THREE.LineBasicMaterial({\n // color: 0xffffff,\n // linewidth:5\n // })\n\n // let line = new THREE.LineSegments(edges, edgesMaterial);\n // mesh.add(line);\n // mesh = tb.Object3D({ obj: mesh, units: 'meters',fixedZoom :15 ,anchor:'center'});\n // this.rectMesh.mesh = mesh;\n // this.rectMesh.w = w;\n }\n // if(this.rectMesh.mesh){\n // this.rectMesh.mesh.setCoords(transform(point.rect.position))\n // tb.add(this.rectMesh.mesh);\n // }\n }\n }, {\n key: \"update\",\n value: function () {\n var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(point) {\n var texture, _texture2, _w, dep, p, index, _point, geometry, material, mesh, dom, _geometry, _material, _mesh, _dom;\n return _regeneratorRuntime().wrap(function _callee2$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n point.text = point.text ? point.text : '';\n if (this.forceClear) {\n three__WEBPACK_IMPORTED_MODULE_3__.Cache.clear();\n (_texture2 = texture) === null || _texture2 === void 0 || _texture2.dispose();\n }\n if (!point.image) {\n _context3.next = 9;\n break;\n }\n _w = point.distance * point.rp * 2;\n dep = point.rp * 2;\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.DataTexture(point.image, _w, _w, three__WEBPACK_IMPORTED_MODULE_3__.RGBAFormat);\n // var width = 32; //纹理宽度\n // var height = 32; //纹理高度\n // var size = width * height; //像素大小\n // var data = new Uint8Array(size * 3); //size*3:像素在缓冲区占用空间\n // for (let i = 0; i < size * 3; i += 3) {\n // // 随机设置RGB分量的值\n // data[i] = 255 * Math.random()\n // data[i + 1] = 255 * Math.random()\n // data[i + 2] = 255 * Math.random()\n\n // 创建数据文理对象 RGB格式:THREE.RGBFormat\n //texture = new THREE.DataTexture(data, width, height, THREE.RGBFormat);\n texture.needsUpdate = true; //纹理更新\n _context3.next = 15;\n break;\n case 9:\n if (!point.url) {\n _context3.next = 15;\n break;\n }\n if (this.forceClear) {\n point.url += \"?tempid=\".concat(Math.random());\n }\n p = function p() {\n return new Promise(function (resolve, reject) {\n new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url, function (_texture) {\n resolve(_texture);\n });\n });\n };\n _context3.next = 14;\n return p();\n case 14:\n texture = _context3.sent;\n case 15:\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n //texture.flipX = true; \n index = this.drawArray.findIndex(function (a) {\n return a.center[0] == point.center[0] && a.center[1] == point.center[1];\n });\n if (index >= 0) {\n _point = this.drawArray[index];\n if (_point && point.width != _point.width) {\n this.remove(this.drawArray[index]);\n this.drawArray[index] = null;\n this.drawArray = this.drawArray.filter(function (a) {\n return a;\n });\n geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20); //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n mesh.label.element.innerHTML = point.text;\n point.mesh = mesh;\n this.drawArray.push(point);\n if (point.rect) {\n this.updateRect(point);\n }\n } else {\n if (this.forceClear) {\n _point.mesh.model.material.map.dispose();\n }\n _point.mesh.model.material.map = texture;\n _point.mesh.label.element.innerHTML = point.text;\n if (point.rect) {\n this.updateRect(point);\n }\n }\n } else {\n _geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20); //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n _material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n _material.color.convertSRGBToLinear();\n _mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(_geometry, _material);\n _mesh.name = 'scanimg';\n _mesh = tb.Object3D({\n obj: _mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n _mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(_mesh);\n _dom = document.createElement('div');\n _mesh.addLabel(_dom, true, {\n x: _mesh.anchor.x,\n y: _mesh.anchor.y + point.distance * 1200,\n z: _mesh.anchor.z\n }, 0);\n _mesh.label.element.className += '' + this.textClass;\n _mesh.label.element.style.fontSize = '24px';\n _mesh.label.element.innerHTML = point.text;\n point.mesh = _mesh;\n this.drawArray.push(point);\n if (point.rect) {\n this.updateRect(point);\n }\n }\n case 19:\n case \"end\":\n return _context3.stop();\n }\n }, _callee2, this);\n }));\n function update(_x2) {\n return _update.apply(this, arguments);\n }\n return update;\n }()\n }, {\n key: \"drawImage\",\n value: function drawImage(point) {\n var texture;\n if (point.image) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader(point.image);\n } else if (point.url) {\n texture = new three__WEBPACK_IMPORTED_MODULE_3__.TextureLoader().load(point.url);\n }\n texture.encoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n texture.flipY = false;\n var geometry = new three__WEBPACK_IMPORTED_MODULE_3__.PlaneGeometry(point.width * 20, point.width * 20);\n //geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));\n var material = new three__WEBPACK_IMPORTED_MODULE_3__.MeshPhongMaterial({\n map: texture,\n opacity: this.opacity,\n transparent: true\n });\n material.color.convertSRGBToLinear();\n var mesh = new three__WEBPACK_IMPORTED_MODULE_3__.Mesh(geometry, material);\n mesh.name = 'scanimg';\n mesh = tb.Object3D({\n obj: mesh,\n units: 'meters',\n fixedZoom: 15,\n anchor: 'center'\n });\n mesh.setCoords((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(point.center));\n tb.renderer.outputEncoding = three__WEBPACK_IMPORTED_MODULE_3__.sRGBEncoding;\n tb.add(mesh);\n var dom = document.createElement('div');\n mesh.addLabel(dom, true, {\n x: mesh.anchor.x,\n y: mesh.anchor.y + point.distance * 1200,\n z: mesh.anchor.z\n }, 0);\n mesh.label.element.className += '' + this.textClass;\n mesh.label.element.style.fontSize = '24px';\n point.mesh = mesh;\n }\n }, {\n key: \"onAdd\",\n value: function onAdd(map, gl) {\n this.map = map;\n tb = new threebox_plugin__WEBPACK_IMPORTED_MODULE_2__.Threebox(map, gl,\n //get the context from Mapbox\n {\n defaultLights: true,\n passiveRendering: false\n });\n }\n }, {\n key: \"render\",\n value: function render(gl, matrix) {\n tb.update();\n this.map.triggerRepaint();\n }\n }]);\n}();\n\n\n//# sourceURL=webpack://@ohuoy/easymap/./src/components/layer/ThreeScanLayer.js?");
|
|
4962
4962
|
|
|
4963
4963
|
/***/ }),
|
|
4964
4964
|
|
|
@@ -4984,6 +4984,17 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
4984
4984
|
|
|
4985
4985
|
/***/ }),
|
|
4986
4986
|
|
|
4987
|
+
/***/ "./src/components/mapOutScreen.js":
|
|
4988
|
+
/*!****************************************!*\
|
|
4989
|
+
!*** ./src/components/mapOutScreen.js ***!
|
|
4990
|
+
\****************************************/
|
|
4991
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4992
|
+
|
|
4993
|
+
"use strict";
|
|
4994
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/util */ \"./src/utils/util.js\");\n/* harmony import */ var _lib_antv_l7__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../lib/@antv/l7 */ \"./lib/@antv/l7/es/index.js\");\n/* harmony import */ var _lib_antv_l7_maps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/@antv/l7-maps */ \"./lib/@antv/l7-maps/es/mapbox/index.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\nvar mapOutScreen = /*#__PURE__*/function () {\n function mapOutScreen(center, distance) {\n var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n target: null,\n style: 'http://192.168.11.93:1234/api/styles/osm',\n type: 'blob',\n pix: {\n w: 1024,\n h: 1024\n },\n callback: function callback() {}\n };\n var progress = arguments.length > 3 ? arguments[3] : undefined;\n _classCallCheck(this, mapOutScreen);\n _defineProperty(this, \"config\", void 0);\n _defineProperty(this, \"center\", void 0);\n _defineProperty(this, \"distance\", void 0);\n _defineProperty(this, \"target\", void 0);\n _defineProperty(this, \"canvas\", void 0);\n _defineProperty(this, \"map\", void 0);\n _defineProperty(this, \"ctx\", void 0);\n _defineProperty(this, \"progress\", function () {});\n this.config = Object.assign({}, {\n target: null,\n type: 'blob',\n delay: 300,\n pix: {\n w: 1024,\n h: 1024\n },\n opacity: 0.7,\n style: 'http://192.168.11.93:1234/api/styles/osm',\n callback: function callback() {}\n }, config);\n if (!this.config.target) {\n this.target = document.createElement('div');\n } else {\n this.target = this.config.target;\n }\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n var pix = this.config.pix;\n this.distance = distance;\n this.center = center;\n this.progress = progress ? progress : this.progress;\n this.target.style = \"width:\".concat(pix.w, \"px;height:\").concat(pix.h, \"px;z-index:-1;\");\n this.canvas.width = pix.w;\n this.canvas.height = pix.h;\n document.body.appendChild(this.target);\n }\n return _createClass(mapOutScreen, [{\n key: \"getImageList\",\n value: function () {\n var _getImageList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(imageList) {\n var _this = this;\n var padding,\n center,\n distance,\n bounds,\n ret,\n scene,\n base64,\n scanLayer,\n i,\n a,\n _base2,\n nBase64,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n padding = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 26;\n center = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : null;\n distance = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : null;\n distance = distance ? distance : this.distance;\n center = center ? center : this.center;\n bounds = (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.getLayerMapPosition)(distance, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.transform)(center));\n ret = [];\n if (this.map) {\n _context2.next = 13;\n break;\n }\n scene = new _lib_antv_l7__WEBPACK_IMPORTED_MODULE_1__.Scene({\n id: this.target,\n // map: new Mapbox({\n // mapInstance: map,\n // }),\n map: new _lib_antv_l7_maps__WEBPACK_IMPORTED_MODULE_2__[\"default\"]({\n style: this.config.style,\n preserveDrawingBuffer: true,\n //center:transform([114.7198975,23.0446]),\n bounds: [bounds[0], bounds[2]],\n fitBoundsOptions: {\n padding: padding\n },\n container: this.target,\n opacity: 0.7,\n pitch: 0,\n zoom: 0,\n rotation: 0,\n token: '' //'pk.eyJ1Ijoid2hpdGVidWxkaW5nIiwiYSI6ImNsc3UwaXlnZDIwbDkybG1qbXJ6YnRtcmwifQ.jtQeo0gt3UNTCWw5FEyv_w',\n })\n });\n this.map = scene.map;\n return _context2.abrupt(\"return\", new Promise(function (resolve, reject) {\n scene.map.on('load', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var base64, scanLayer, i, a, _base, nBase64;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!(!imageList || imageList.length == 0)) {\n _context.next = 5;\n break;\n }\n base64 = scene.map._canvas.toDataURL();\n if (_this.config.type == 'download') {\n (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileByBase64)(base64, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.guid)());\n } //downloadFileByBase64(base64,guid())\n else if (_this.config.type == 'blob') {\n if (_this.config.callback) _this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n }\n _context.next = 27;\n break;\n case 5:\n scanLayer = _this.map.getLayer('threescan-layer');\n if (!scanLayer) {\n scanLayer = new EmComponents.ThreeScanLayer('threescan-layer', {\n opacity: _this.config.opacity,\n textClass: ' map-time zmax '\n });\n _this.map.addLayer(scanLayer);\n }\n _context.t0 = _regeneratorRuntime().keys(imageList);\n case 8:\n if ((_context.t1 = _context.t0()).done) {\n _context.next = 27;\n break;\n }\n i = _context.t1.value;\n a = imageList[i];\n _context.next = 13;\n return scanLayer.drawImageList(a, _this.config.delay);\n case 13:\n _base = _context.sent;\n _this.progress(i / (imageList.length - 1), a);\n if (!a[0].addTime) {\n _context.next = 23;\n break;\n }\n _context.next = 18;\n return _this.drawText(a[0], _base);\n case 18:\n nBase64 = _context.sent;\n if (_this.config.callback) _this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n _context.next = 25;\n break;\n case 23:\n if (_this.config.callback) _this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base));\n case 25:\n _context.next = 8;\n break;\n case 27:\n resolve(ret);\n //target.remove() \n case 28:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n })));\n }));\n case 13:\n this.map.fitBounds([bounds[0], bounds[2]], {\n duration: 200\n });\n _context2.next = 16;\n return (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.sleep)(600);\n case 16:\n if (!(!imageList || imageList.length == 0)) {\n _context2.next = 21;\n break;\n }\n base64 = this.map._canvas.toDataURL();\n if (config.type == 'download') {\n (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileByBase64)(base64, (0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.guid)());\n ret.push(base64);\n } //downloadFileByBase64(base64,guid())\n else if (this.config.type == 'blob') {\n if (this.config.callback) this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(base64));\n }\n _context2.next = 43;\n break;\n case 21:\n scanLayer = this.map.getLayer('threescan-layer');\n if (!scanLayer) {\n scanLayer = new EmComponents.ThreeScanLayer('threescan-layer', {\n opacity: this.config.opacity,\n textClass: ' map-time zmax '\n });\n this.map.addLayer(scanLayer);\n }\n _context2.t0 = _regeneratorRuntime().keys(imageList);\n case 24:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 43;\n break;\n }\n i = _context2.t1.value;\n a = imageList[i];\n _context2.next = 29;\n return scanLayer.drawImageList(a, this.config.delay);\n case 29:\n _base2 = _context2.sent;\n this.progress(i / (imageList.length - 1), a);\n // map.getCanvas().toDataURL()\n if (!a[0].addTime) {\n _context2.next = 39;\n break;\n }\n _context2.next = 34;\n return this.drawText(a[0], _base2);\n case 34:\n nBase64 = _context2.sent;\n if (this.config.callback) this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(nBase64));\n _context2.next = 41;\n break;\n case 39:\n if (this.config.callback) this.config.callback((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base2));\n ret.push((0,_utils_util__WEBPACK_IMPORTED_MODULE_0__.downloadFileBlobByBase64)(_base2));\n case 41:\n _context2.next = 24;\n break;\n case 43:\n return _context2.abrupt(\"return\", ret);\n case 44:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function getImageList(_x) {\n return _getImageList.apply(this, arguments);\n }\n return getImageList;\n }()\n }, {\n key: \"drawText\",\n value: function drawText(point, base64) {\n var _this2 = this;\n return new Promise(function (resolve) {\n _this2.ctx.clearRect(0, 0, _this2.canvas.width, _this2.canvas.height);\n var imgItemEl = new Image();\n imgItemEl.crossOrigin = \"anonymous\";\n imgItemEl.src = base64;\n imgItemEl.onload = function (b) {\n _this2.ctx.drawImage(b.currentTarget, 0, 0, _this2.canvas.width, _this2.canvas.height);\n _this2.ctx.font = point.addTime.font ? point.addTime.font : '32px SimHei';\n _this2.ctx.fillText(point.addTime.text, point.addTime.left, point.addTime.top);\n resolve(_this2.canvas.toDataURL());\n };\n });\n }\n }]);\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mapOutScreen);\n\n//# sourceURL=webpack://@ohuoy/easymap/./src/components/mapOutScreen.js?");
|
|
4995
|
+
|
|
4996
|
+
/***/ }),
|
|
4997
|
+
|
|
4987
4998
|
/***/ "./src/utils/CameraSync.js":
|
|
4988
4999
|
/*!*********************************!*\
|
|
4989
5000
|
!*** ./src/utils/CameraSync.js ***!
|