mars3d-mapv 3.1.3 → 3.1.4
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/mars3d-mapv-src.js +1071 -0
- package/dist/mars3d-mapv-src.js.map +1 -0
- package/dist/mars3d-mapv.js +3 -3
- package/index.html +6 -7
- package/package.json +3 -3
|
@@ -0,0 +1,1071 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Mars3D平台插件,结合mapv可视化功能插件
|
|
3
|
+
* 版本信息:v3.1.3, hash值: e7af6eea75417613bea4
|
|
4
|
+
* 编译日期:2021-09-16 17:05:53
|
|
5
|
+
* 版权所有:Copyright by 火星科技 http://mars3d.cn
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
10
|
+
module.exports = factory(require("mars3d"), require("mars3d-cesium"), require("mapv"));
|
|
11
|
+
else if(typeof define === 'function' && define.amd)
|
|
12
|
+
define("mars3dMapv", ["mars3d", "mars3d-cesium", "mapv"], factory);
|
|
13
|
+
else if(typeof exports === 'object')
|
|
14
|
+
exports["mars3dMapv"] = factory(require("mars3d"), require("mars3d-cesium"), require("mapv"));
|
|
15
|
+
else
|
|
16
|
+
root["mars3dMapv"] = factory(root["mars3d"], root["Cesium"], root["mapv"]);
|
|
17
|
+
})(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__12__) {
|
|
18
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
19
|
+
/******/ // The module cache
|
|
20
|
+
/******/ var installedModules = {};
|
|
21
|
+
/******/
|
|
22
|
+
/******/ // The require function
|
|
23
|
+
/******/ function __webpack_require__(moduleId) {
|
|
24
|
+
/******/
|
|
25
|
+
/******/ // Check if module is in cache
|
|
26
|
+
/******/ if(installedModules[moduleId]) {
|
|
27
|
+
/******/ return installedModules[moduleId].exports;
|
|
28
|
+
/******/ }
|
|
29
|
+
/******/ // Create a new module (and put it into the cache)
|
|
30
|
+
/******/ var module = installedModules[moduleId] = {
|
|
31
|
+
/******/ i: moduleId,
|
|
32
|
+
/******/ l: false,
|
|
33
|
+
/******/ exports: {}
|
|
34
|
+
/******/ };
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // Execute the module function
|
|
37
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
38
|
+
/******/
|
|
39
|
+
/******/ // Flag the module as loaded
|
|
40
|
+
/******/ module.l = true;
|
|
41
|
+
/******/
|
|
42
|
+
/******/ // Return the exports of the module
|
|
43
|
+
/******/ return module.exports;
|
|
44
|
+
/******/ }
|
|
45
|
+
/******/
|
|
46
|
+
/******/
|
|
47
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
48
|
+
/******/ __webpack_require__.m = modules;
|
|
49
|
+
/******/
|
|
50
|
+
/******/ // expose the module cache
|
|
51
|
+
/******/ __webpack_require__.c = installedModules;
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // define getter function for harmony exports
|
|
54
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
55
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
56
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ };
|
|
59
|
+
/******/
|
|
60
|
+
/******/ // define __esModule on exports
|
|
61
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
62
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
63
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
64
|
+
/******/ }
|
|
65
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
66
|
+
/******/ };
|
|
67
|
+
/******/
|
|
68
|
+
/******/ // create a fake namespace object
|
|
69
|
+
/******/ // mode & 1: value is a module id, require it
|
|
70
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
71
|
+
/******/ // mode & 4: return value when already ns object
|
|
72
|
+
/******/ // mode & 8|1: behave like require
|
|
73
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
74
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
75
|
+
/******/ if(mode & 8) return value;
|
|
76
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
77
|
+
/******/ var ns = Object.create(null);
|
|
78
|
+
/******/ __webpack_require__.r(ns);
|
|
79
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
80
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
81
|
+
/******/ return ns;
|
|
82
|
+
/******/ };
|
|
83
|
+
/******/
|
|
84
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
85
|
+
/******/ __webpack_require__.n = function(module) {
|
|
86
|
+
/******/ var getter = module && module.__esModule ?
|
|
87
|
+
/******/ function getDefault() { return module['default']; } :
|
|
88
|
+
/******/ function getModuleExports() { return module; };
|
|
89
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
90
|
+
/******/ return getter;
|
|
91
|
+
/******/ };
|
|
92
|
+
/******/
|
|
93
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
94
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
95
|
+
/******/
|
|
96
|
+
/******/ // __webpack_public_path__
|
|
97
|
+
/******/ __webpack_require__.p = "";
|
|
98
|
+
/******/
|
|
99
|
+
/******/
|
|
100
|
+
/******/ // Load entry module and return exports
|
|
101
|
+
/******/ return __webpack_require__(__webpack_require__.s = 13);
|
|
102
|
+
/******/ })
|
|
103
|
+
/************************************************************************/
|
|
104
|
+
/******/ ([
|
|
105
|
+
/* 0 */
|
|
106
|
+
/***/ (function(module, exports) {
|
|
107
|
+
|
|
108
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
|
|
109
|
+
|
|
110
|
+
/***/ }),
|
|
111
|
+
/* 1 */
|
|
112
|
+
/***/ (function(module, exports) {
|
|
113
|
+
|
|
114
|
+
function _getPrototypeOf(o) {
|
|
115
|
+
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
116
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
117
|
+
};
|
|
118
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
119
|
+
return _getPrototypeOf(o);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = _getPrototypeOf;
|
|
123
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
124
|
+
|
|
125
|
+
/***/ }),
|
|
126
|
+
/* 2 */
|
|
127
|
+
/***/ (function(module, exports) {
|
|
128
|
+
|
|
129
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
|
130
|
+
|
|
131
|
+
/***/ }),
|
|
132
|
+
/* 3 */
|
|
133
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
134
|
+
|
|
135
|
+
var _typeof = __webpack_require__(10)["default"];
|
|
136
|
+
|
|
137
|
+
var assertThisInitialized = __webpack_require__(7);
|
|
138
|
+
|
|
139
|
+
function _possibleConstructorReturn(self, call) {
|
|
140
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
141
|
+
return call;
|
|
142
|
+
} else if (call !== void 0) {
|
|
143
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return assertThisInitialized(self);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = _possibleConstructorReturn;
|
|
150
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
151
|
+
|
|
152
|
+
/***/ }),
|
|
153
|
+
/* 4 */
|
|
154
|
+
/***/ (function(module, exports) {
|
|
155
|
+
|
|
156
|
+
function _classCallCheck(instance, Constructor) {
|
|
157
|
+
if (!(instance instanceof Constructor)) {
|
|
158
|
+
throw new TypeError("Cannot call a class as a function");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = _classCallCheck;
|
|
163
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
164
|
+
|
|
165
|
+
/***/ }),
|
|
166
|
+
/* 5 */
|
|
167
|
+
/***/ (function(module, exports) {
|
|
168
|
+
|
|
169
|
+
function _defineProperties(target, props) {
|
|
170
|
+
for (var i = 0; i < props.length; i++) {
|
|
171
|
+
var descriptor = props[i];
|
|
172
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
173
|
+
descriptor.configurable = true;
|
|
174
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
175
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
180
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
181
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
182
|
+
return Constructor;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
module.exports = _createClass;
|
|
186
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
187
|
+
|
|
188
|
+
/***/ }),
|
|
189
|
+
/* 6 */
|
|
190
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
191
|
+
|
|
192
|
+
var setPrototypeOf = __webpack_require__(9);
|
|
193
|
+
|
|
194
|
+
function _inherits(subClass, superClass) {
|
|
195
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
196
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
200
|
+
constructor: {
|
|
201
|
+
value: subClass,
|
|
202
|
+
writable: true,
|
|
203
|
+
configurable: true
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
if (superClass) setPrototypeOf(subClass, superClass);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
module.exports = _inherits;
|
|
210
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
211
|
+
|
|
212
|
+
/***/ }),
|
|
213
|
+
/* 7 */
|
|
214
|
+
/***/ (function(module, exports) {
|
|
215
|
+
|
|
216
|
+
function _assertThisInitialized(self) {
|
|
217
|
+
if (self === void 0) {
|
|
218
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return self;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
module.exports = _assertThisInitialized;
|
|
225
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
226
|
+
|
|
227
|
+
/***/ }),
|
|
228
|
+
/* 8 */
|
|
229
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
230
|
+
|
|
231
|
+
var superPropBase = __webpack_require__(11);
|
|
232
|
+
|
|
233
|
+
function _get(target, property, receiver) {
|
|
234
|
+
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
235
|
+
module.exports = _get = Reflect.get;
|
|
236
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
237
|
+
} else {
|
|
238
|
+
module.exports = _get = function _get(target, property, receiver) {
|
|
239
|
+
var base = superPropBase(target, property);
|
|
240
|
+
if (!base) return;
|
|
241
|
+
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
242
|
+
|
|
243
|
+
if (desc.get) {
|
|
244
|
+
return desc.get.call(receiver);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return desc.value;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return _get(target, property, receiver || target);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
module.exports = _get;
|
|
257
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
258
|
+
|
|
259
|
+
/***/ }),
|
|
260
|
+
/* 9 */
|
|
261
|
+
/***/ (function(module, exports) {
|
|
262
|
+
|
|
263
|
+
function _setPrototypeOf(o, p) {
|
|
264
|
+
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
265
|
+
o.__proto__ = p;
|
|
266
|
+
return o;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
270
|
+
return _setPrototypeOf(o, p);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
module.exports = _setPrototypeOf;
|
|
274
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
275
|
+
|
|
276
|
+
/***/ }),
|
|
277
|
+
/* 10 */
|
|
278
|
+
/***/ (function(module, exports) {
|
|
279
|
+
|
|
280
|
+
function _typeof(obj) {
|
|
281
|
+
"@babel/helpers - typeof";
|
|
282
|
+
|
|
283
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
284
|
+
module.exports = _typeof = function _typeof(obj) {
|
|
285
|
+
return typeof obj;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
289
|
+
} else {
|
|
290
|
+
module.exports = _typeof = function _typeof(obj) {
|
|
291
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return _typeof(obj);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
module.exports = _typeof;
|
|
301
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
302
|
+
|
|
303
|
+
/***/ }),
|
|
304
|
+
/* 11 */
|
|
305
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
306
|
+
|
|
307
|
+
var getPrototypeOf = __webpack_require__(1);
|
|
308
|
+
|
|
309
|
+
function _superPropBase(object, property) {
|
|
310
|
+
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
311
|
+
object = getPrototypeOf(object);
|
|
312
|
+
if (object === null) break;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return object;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
module.exports = _superPropBase;
|
|
319
|
+
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
320
|
+
|
|
321
|
+
/***/ }),
|
|
322
|
+
/* 12 */
|
|
323
|
+
/***/ (function(module, exports) {
|
|
324
|
+
|
|
325
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
|
326
|
+
|
|
327
|
+
/***/ }),
|
|
328
|
+
/* 13 */
|
|
329
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
330
|
+
|
|
331
|
+
"use strict";
|
|
332
|
+
// ESM COMPAT FLAG
|
|
333
|
+
__webpack_require__.r(__webpack_exports__);
|
|
334
|
+
|
|
335
|
+
// EXPORTS
|
|
336
|
+
__webpack_require__.d(__webpack_exports__, "MapVLayer", function() { return /* reexport */ MapVLayer_MapVLayer; });
|
|
337
|
+
|
|
338
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/classCallCheck.js
|
|
339
|
+
var classCallCheck = __webpack_require__(4);
|
|
340
|
+
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
|
|
341
|
+
|
|
342
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/createClass.js
|
|
343
|
+
var createClass = __webpack_require__(5);
|
|
344
|
+
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
|
|
345
|
+
|
|
346
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/inherits.js
|
|
347
|
+
var inherits = __webpack_require__(6);
|
|
348
|
+
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
|
|
349
|
+
|
|
350
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/possibleConstructorReturn.js
|
|
351
|
+
var possibleConstructorReturn = __webpack_require__(3);
|
|
352
|
+
var possibleConstructorReturn_default = /*#__PURE__*/__webpack_require__.n(possibleConstructorReturn);
|
|
353
|
+
|
|
354
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/getPrototypeOf.js
|
|
355
|
+
var getPrototypeOf = __webpack_require__(1);
|
|
356
|
+
var getPrototypeOf_default = /*#__PURE__*/__webpack_require__.n(getPrototypeOf);
|
|
357
|
+
|
|
358
|
+
// EXTERNAL MODULE: external {"commonjs2":"mars3d-cesium","amd":"mars3d-cesium","commonjs":"mars3d-cesium","root":"Cesium"}
|
|
359
|
+
var external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_ = __webpack_require__(2);
|
|
360
|
+
|
|
361
|
+
// EXTERNAL MODULE: external "mars3d"
|
|
362
|
+
var external_mars3d_ = __webpack_require__(0);
|
|
363
|
+
|
|
364
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/assertThisInitialized.js
|
|
365
|
+
var assertThisInitialized = __webpack_require__(7);
|
|
366
|
+
var assertThisInitialized_default = /*#__PURE__*/__webpack_require__.n(assertThisInitialized);
|
|
367
|
+
|
|
368
|
+
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.15.3@@babel/runtime/helpers/get.js
|
|
369
|
+
var get = __webpack_require__(8);
|
|
370
|
+
var get_default = /*#__PURE__*/__webpack_require__.n(get);
|
|
371
|
+
|
|
372
|
+
// CONCATENATED MODULE: ./src/mapv/MapVRenderer.js
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }
|
|
382
|
+
|
|
383
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
384
|
+
|
|
385
|
+
//mapv+cesium融合,by http://marsgis.cn
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
var MapVRenderer_mapv = __webpack_require__(12);
|
|
389
|
+
|
|
390
|
+
var baiduMapLayer = MapVRenderer_mapv ? MapVRenderer_mapv.baiduMapLayer : null;
|
|
391
|
+
var BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
392
|
+
var MapVRenderer_MapVRenderer = /*#__PURE__*/function (_BaseLayer) {
|
|
393
|
+
inherits_default()(MapVRenderer, _BaseLayer);
|
|
394
|
+
|
|
395
|
+
var _super = _createSuper(MapVRenderer);
|
|
396
|
+
|
|
397
|
+
//========== 构造方法 ==========
|
|
398
|
+
function MapVRenderer(viewer, dataset, option, mapVLayer) {
|
|
399
|
+
var _this;
|
|
400
|
+
|
|
401
|
+
classCallCheck_default()(this, MapVRenderer);
|
|
402
|
+
|
|
403
|
+
_this = _super.call(this, viewer, dataset, option);
|
|
404
|
+
|
|
405
|
+
if (!BaseLayer) {
|
|
406
|
+
return possibleConstructorReturn_default()(_this);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
_this.map = viewer, _this.scene = viewer.scene, _this.dataSet = dataset;
|
|
410
|
+
option = option || {}, _this.init(option), _this.argCheck(option), _this.initDevicePixelRatio(), _this.canvasLayer = mapVLayer, _this.stopAniamation = !1, _this.animation = option.animation, _this.clickEvent = _this.clickEvent.bind(assertThisInitialized_default()(_this)), _this.mousemoveEvent = _this.mousemoveEvent.bind(assertThisInitialized_default()(_this)), _this.bindEvent();
|
|
411
|
+
return _this;
|
|
412
|
+
} //========== 方法 ==========
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
createClass_default()(MapVRenderer, [{
|
|
416
|
+
key: "initDevicePixelRatio",
|
|
417
|
+
value: function initDevicePixelRatio() {
|
|
418
|
+
this.devicePixelRatio = window.devicePixelRatio || 1;
|
|
419
|
+
}
|
|
420
|
+
}, {
|
|
421
|
+
key: "clickEvent",
|
|
422
|
+
value: function clickEvent(t) {
|
|
423
|
+
var e = t.point;
|
|
424
|
+
|
|
425
|
+
get_default()(getPrototypeOf_default()(MapVRenderer.prototype), "clickEvent", this).call(this, e, t);
|
|
426
|
+
}
|
|
427
|
+
}, {
|
|
428
|
+
key: "mousemoveEvent",
|
|
429
|
+
value: function mousemoveEvent(t) {
|
|
430
|
+
var e = t.point;
|
|
431
|
+
|
|
432
|
+
get_default()(getPrototypeOf_default()(MapVRenderer.prototype), "mousemoveEvent", this).call(this, e, t);
|
|
433
|
+
}
|
|
434
|
+
}, {
|
|
435
|
+
key: "addAnimatorEvent",
|
|
436
|
+
value: function addAnimatorEvent() {}
|
|
437
|
+
}, {
|
|
438
|
+
key: "animatorMovestartEvent",
|
|
439
|
+
value: function animatorMovestartEvent() {
|
|
440
|
+
var t = this.options.animation;
|
|
441
|
+
this.isEnabledTime() && this.animator && (this.steps.step = t.stepsRange.start);
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
key: "animatorMoveendEvent",
|
|
445
|
+
value: function animatorMoveendEvent() {
|
|
446
|
+
this.isEnabledTime() && this.animator;
|
|
447
|
+
}
|
|
448
|
+
}, {
|
|
449
|
+
key: "bindEvent",
|
|
450
|
+
value: function bindEvent() {
|
|
451
|
+
this.map;
|
|
452
|
+
this.options.methods && (this.options.methods.click, this.options.methods.mousemove);
|
|
453
|
+
}
|
|
454
|
+
}, {
|
|
455
|
+
key: "unbindEvent",
|
|
456
|
+
value: function unbindEvent() {
|
|
457
|
+
var t = this.map;
|
|
458
|
+
this.options.methods && (this.options.methods.click && t.off("click", this.clickEvent), this.options.methods.mousemove && t.off("mousemove", this.mousemoveEvent));
|
|
459
|
+
}
|
|
460
|
+
}, {
|
|
461
|
+
key: "getContext",
|
|
462
|
+
value: function getContext() {
|
|
463
|
+
return this.canvasLayer.canvas.getContext(this.context);
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
key: "init",
|
|
467
|
+
value: function init(t) {
|
|
468
|
+
this.options = t;
|
|
469
|
+
this.initDataRange(t);
|
|
470
|
+
this.context = this.options.context || "2d";
|
|
471
|
+
|
|
472
|
+
if (this.options.zIndex && this.canvasLayer && this.canvasLayer.setZIndex) {
|
|
473
|
+
this.canvasLayer.setZIndex(this.options.zIndex);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
this.initAnimator();
|
|
477
|
+
}
|
|
478
|
+
}, {
|
|
479
|
+
key: "_canvasUpdate",
|
|
480
|
+
value: function _canvasUpdate(t) {
|
|
481
|
+
var scene = this.scene;
|
|
482
|
+
|
|
483
|
+
if (this.canvasLayer && !this.stopAniamation) {
|
|
484
|
+
var i = this.options.animation,
|
|
485
|
+
n = this.getContext();
|
|
486
|
+
|
|
487
|
+
if (this.isEnabledTime()) {
|
|
488
|
+
if (void 0 === t) {
|
|
489
|
+
return void this.clear(n);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
"2d" === this.context && (n.save(), n.globalCompositeOperation = "destination-out", n.fillStyle = "rgba(0, 0, 0, .1)", n.fillRect(0, 0, n.canvas.width, n.canvas.height), n.restore());
|
|
493
|
+
} else {
|
|
494
|
+
this.clear(n);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if ("2d" === this.context) {
|
|
498
|
+
for (var o in this.options) {
|
|
499
|
+
n[o] = this.options[o];
|
|
500
|
+
}
|
|
501
|
+
} else {
|
|
502
|
+
n.clear(n.COLOR_BUFFER_BIT);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
var a = {
|
|
506
|
+
transferCoordinate: function transferCoordinate(data) {
|
|
507
|
+
var defVal = null; //[-999, -999]
|
|
508
|
+
|
|
509
|
+
var heightTerrain = scene.mapvFixedHeight;
|
|
510
|
+
|
|
511
|
+
if (scene.mapvAutoHeight) {
|
|
512
|
+
heightTerrain = scene.globe.getHeight(external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["Cartographic"].fromDegrees(data[0], data[1]));
|
|
513
|
+
} //坐标转换
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
var position = external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["Cartesian3"].fromDegrees(data[0], data[1], heightTerrain);
|
|
517
|
+
|
|
518
|
+
if (!position) {
|
|
519
|
+
return defVal;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
var px = scene.cartesianToCanvasCoordinates(position);
|
|
523
|
+
|
|
524
|
+
if (!px) {
|
|
525
|
+
return defVal;
|
|
526
|
+
} //判断是否在球的背面
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
if (scene.mapvDepthTest && scene.mode === external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["SceneMode"].SCENE3D) {
|
|
530
|
+
var occluder = new external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["EllipsoidalOccluder"](scene.globe.ellipsoid, scene.camera.positionWC);
|
|
531
|
+
var visible = occluder.isPointVisible(position); //visible为true说明点在球的正面,否则点在球的背面。
|
|
532
|
+
//需要注意的是不能用这种方法判断点的可见性,如果球放的比较大,点跑到屏幕外面,它返回的依然为true
|
|
533
|
+
|
|
534
|
+
if (!visible) {
|
|
535
|
+
return defVal;
|
|
536
|
+
}
|
|
537
|
+
} //判断是否在球的背面
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
return [px.x, px.y];
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
void 0 !== t && (a.filter = function (e) {
|
|
544
|
+
var n = i.trails || 10;
|
|
545
|
+
return !!(t && e.time > t - n && e.time < t);
|
|
546
|
+
});
|
|
547
|
+
var c = this.dataSet.get(a);
|
|
548
|
+
this.processData(c), "m" === this.options.unit && this.options.size, this.options._size = this.options.size;
|
|
549
|
+
var h = scene.cartesianToCanvasCoordinates(external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["Cartesian3"].fromDegrees(0, 0));
|
|
550
|
+
|
|
551
|
+
if (!h) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
this.drawContext(n, new MapVRenderer_mapv.DataSet(c), this.options, h);
|
|
556
|
+
this.options.updateCallback && this.options.updateCallback(t);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}, {
|
|
560
|
+
key: "updateData",
|
|
561
|
+
value: function updateData(t, e) {
|
|
562
|
+
var i = t;
|
|
563
|
+
i && i.get && (i = i.get()), void 0 !== i && this.dataSet.set(i);
|
|
564
|
+
|
|
565
|
+
get_default()(getPrototypeOf_default()(MapVRenderer.prototype), "update", this).call(this, {
|
|
566
|
+
options: e
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}, {
|
|
570
|
+
key: "addData",
|
|
571
|
+
value: function addData(t, e) {
|
|
572
|
+
var i = t;
|
|
573
|
+
t && t.get && (i = t.get()), this.dataSet.add(i), this.update({
|
|
574
|
+
options: e
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}, {
|
|
578
|
+
key: "getData",
|
|
579
|
+
value: function getData() {
|
|
580
|
+
return this.dataSet;
|
|
581
|
+
}
|
|
582
|
+
}, {
|
|
583
|
+
key: "removeData",
|
|
584
|
+
value: function removeData(t) {
|
|
585
|
+
if (this.dataSet) {
|
|
586
|
+
var e = this.dataSet.get({
|
|
587
|
+
filter: function filter(e) {
|
|
588
|
+
return null == t || "function" !== typeof t || !t(e);
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
this.dataSet.set(e), this.update({
|
|
592
|
+
options: null
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}, {
|
|
597
|
+
key: "clearData",
|
|
598
|
+
value: function clearData() {
|
|
599
|
+
this.dataSet && this.dataSet.clear(), this.update({
|
|
600
|
+
options: null
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
}, {
|
|
604
|
+
key: "draw",
|
|
605
|
+
value: function draw() {
|
|
606
|
+
this.canvasLayer.draw();
|
|
607
|
+
}
|
|
608
|
+
}, {
|
|
609
|
+
key: "clear",
|
|
610
|
+
value: function clear(t) {
|
|
611
|
+
t && t.clearRect && t.clearRect(0, 0, t.canvas.width, t.canvas.height);
|
|
612
|
+
}
|
|
613
|
+
}, {
|
|
614
|
+
key: "destroy",
|
|
615
|
+
value: function destroy() {
|
|
616
|
+
this.unbindEvent();
|
|
617
|
+
this.clear(this.getContext());
|
|
618
|
+
this.clearData();
|
|
619
|
+
this.animator && this.animator.stop();
|
|
620
|
+
this.animator = null;
|
|
621
|
+
this.canvasLayer = null;
|
|
622
|
+
}
|
|
623
|
+
}]);
|
|
624
|
+
|
|
625
|
+
return MapVRenderer;
|
|
626
|
+
}(BaseLayer); //修改mapv内部方法,已适应数据在球背面或看不见的区域的数据不显示的处理
|
|
627
|
+
|
|
628
|
+
MapVRenderer_mapv.DataSet.prototype.transferCoordinate = function (data, transferFn, fromColumn, toColumnName) {
|
|
629
|
+
toColumnName = toColumnName || "_coordinates";
|
|
630
|
+
fromColumn = fromColumn || "coordinates";
|
|
631
|
+
|
|
632
|
+
for (var i = 0; i < data.length; i++) {
|
|
633
|
+
var geometry = data[i].geometry;
|
|
634
|
+
var coordinates = geometry[fromColumn];
|
|
635
|
+
|
|
636
|
+
switch (geometry.type) {
|
|
637
|
+
default:
|
|
638
|
+
break;
|
|
639
|
+
|
|
640
|
+
case "Point":
|
|
641
|
+
{
|
|
642
|
+
var pt = transferFn(coordinates);
|
|
643
|
+
|
|
644
|
+
if (pt) {
|
|
645
|
+
geometry[toColumnName] = pt;
|
|
646
|
+
} else {
|
|
647
|
+
geometry[toColumnName] = [-999, -999];
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
break;
|
|
651
|
+
|
|
652
|
+
case "LineString":
|
|
653
|
+
{
|
|
654
|
+
var newCoordinates = [];
|
|
655
|
+
|
|
656
|
+
for (var j = 0; j < coordinates.length; j++) {
|
|
657
|
+
var _pt = transferFn(coordinates[j]);
|
|
658
|
+
|
|
659
|
+
if (_pt) {
|
|
660
|
+
newCoordinates.push(_pt);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
geometry[toColumnName] = newCoordinates;
|
|
665
|
+
}
|
|
666
|
+
break;
|
|
667
|
+
|
|
668
|
+
case "MultiLineString":
|
|
669
|
+
case "Polygon":
|
|
670
|
+
{
|
|
671
|
+
var _newCoordinates = getPolygon(coordinates);
|
|
672
|
+
|
|
673
|
+
geometry[toColumnName] = _newCoordinates;
|
|
674
|
+
}
|
|
675
|
+
break;
|
|
676
|
+
|
|
677
|
+
case "MultiPolygon":
|
|
678
|
+
{
|
|
679
|
+
var _newCoordinates2 = [];
|
|
680
|
+
|
|
681
|
+
for (var c = 0; c < coordinates.length; c++) {
|
|
682
|
+
var polygon = getPolygon(coordinates[c]);
|
|
683
|
+
|
|
684
|
+
if (polygon.length > 0) {
|
|
685
|
+
_newCoordinates2.push(polygon);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
geometry[toColumnName] = _newCoordinates2;
|
|
690
|
+
}
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
function getPolygon(coordinates) {
|
|
696
|
+
var newCoordinates = [];
|
|
697
|
+
|
|
698
|
+
for (var _c = 0; _c < coordinates.length; _c++) {
|
|
699
|
+
var coordinate = coordinates[_c];
|
|
700
|
+
var newcoordinate = [];
|
|
701
|
+
|
|
702
|
+
for (var _j = 0; _j < coordinate.length; _j++) {
|
|
703
|
+
var _pt2 = transferFn(coordinate[_j]);
|
|
704
|
+
|
|
705
|
+
if (_pt2) {
|
|
706
|
+
newcoordinate.push(_pt2);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (newcoordinate.length > 0) {
|
|
711
|
+
newCoordinates.push(newcoordinate);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
return newCoordinates;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
return data;
|
|
719
|
+
};
|
|
720
|
+
// CONCATENATED MODULE: ./src/mapv/MapVLayer.js
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
function MapVLayer_createSuper(Derived) { var hasNativeReflectConstruct = MapVLayer_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; }
|
|
728
|
+
|
|
729
|
+
function MapVLayer_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
730
|
+
|
|
731
|
+
//mapv+cesium融合,by http://marsgis.cn
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
var MapVLayer_BaseLayer = external_mars3d_["layer"].BaseLayer;
|
|
736
|
+
var divId = 0;
|
|
737
|
+
/**
|
|
738
|
+
* MapV图层
|
|
739
|
+
* 【需要引入 heatmap.js 库 和 mars3d-heatmap 插件库】
|
|
740
|
+
*
|
|
741
|
+
* @param {Object} options 图层参数,包括:
|
|
742
|
+
*
|
|
743
|
+
* @param {Object} [options.mapV本身] 支持mapv本身所有drawOptions图层样式参数,具体查阅 [mapv库drawOptions文档]{@link https://github.com/huiyan-fe/mapv/wiki/%E7%B1%BB%E5%8F%82%E8%80%83} ,也可以 [在线编辑图层样式]{@link https://mapv.baidu.com/editor/}
|
|
744
|
+
*
|
|
745
|
+
* @param {String|Number} [options.id = uuid()] 图层id标识
|
|
746
|
+
* @param {String|Number} [options.pid = -1] 图层父级的id,一般图层管理中使用
|
|
747
|
+
* @param {String} [options.name = '未命名'] 图层名称
|
|
748
|
+
* @param {Boolean} [options.show = true] 图层是否显示
|
|
749
|
+
* @param {Object} [options.center] 图层自定义定位视角
|
|
750
|
+
*
|
|
751
|
+
* @param {Boolean} [options.depthTest=true] 是否进行计算深度判断,在地球背面或被遮挡时不显示(大数据时,需要关闭)
|
|
752
|
+
* @param {Number} [options.fixedHeight=0] 点的固定的海拔高度
|
|
753
|
+
* @param {Boolean} [options.clampToGround=false] 点是否贴地
|
|
754
|
+
* @param {Boolean} [options.pointerEvents=false] 图层是否可以进行鼠标交互,为false时可以穿透操作及缩放地图
|
|
755
|
+
* @param {mapv.DataSet} dataSet MapV数据集,可以参考[ MapV数据集对象说明]{@link https://github.com/huiyan-fe/mapv/blob/master/src/data/DataSet.md}
|
|
756
|
+
*
|
|
757
|
+
* @export
|
|
758
|
+
* @class MapVLayer
|
|
759
|
+
* @extends {BaseLayer}
|
|
760
|
+
*/
|
|
761
|
+
|
|
762
|
+
var MapVLayer_MapVLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
763
|
+
inherits_default()(MapVLayer, _BaseLayer);
|
|
764
|
+
|
|
765
|
+
var _super = MapVLayer_createSuper(MapVLayer);
|
|
766
|
+
|
|
767
|
+
//========== 构造方法 ==========
|
|
768
|
+
function MapVLayer(options, dataSet) {
|
|
769
|
+
var _this;
|
|
770
|
+
|
|
771
|
+
classCallCheck_default()(this, MapVLayer);
|
|
772
|
+
|
|
773
|
+
_this = _super.call(this, options);
|
|
774
|
+
_this._pointerEvents = _this.options.pointerEvents;
|
|
775
|
+
_this.dataSet = dataSet;
|
|
776
|
+
/**
|
|
777
|
+
* 图层对应的Canvas对象
|
|
778
|
+
* @type {HTMLCanvasElement}
|
|
779
|
+
* @readonly
|
|
780
|
+
*/
|
|
781
|
+
|
|
782
|
+
_this.canvas = null;
|
|
783
|
+
return _this;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* 是否可以鼠标交互,为false时可以穿透操作及缩放地图,但无法进行鼠标交互及触发相关事件。true时无法缩放地球,但可以使用mapv相关的事件或toolitp等。
|
|
787
|
+
* @type {Boolean}
|
|
788
|
+
*/
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
createClass_default()(MapVLayer, [{
|
|
792
|
+
key: "pointerEvents",
|
|
793
|
+
get: function get() {
|
|
794
|
+
return this._pointerEvents;
|
|
795
|
+
},
|
|
796
|
+
set: function set(value) {
|
|
797
|
+
this._pointerEvents = value;
|
|
798
|
+
|
|
799
|
+
if (this.canvas) {
|
|
800
|
+
if (value) {
|
|
801
|
+
this.canvas.style.pointerEvents = "all";
|
|
802
|
+
} else {
|
|
803
|
+
/*加上这个css后鼠标可以穿透,但是无法触发单击等鼠标事件*/
|
|
804
|
+
this.canvas.style.pointerEvents = "none";
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
} //========== 方法 ==========
|
|
808
|
+
|
|
809
|
+
}, {
|
|
810
|
+
key: "_showHook",
|
|
811
|
+
value: function _showHook(show) {
|
|
812
|
+
if (show) {
|
|
813
|
+
this.canvas.style.display = "block";
|
|
814
|
+
} else {
|
|
815
|
+
this.canvas.style.display = "none";
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* 对象添加到地图前创建一些对象的钩子方法,
|
|
820
|
+
* 只会调用一次
|
|
821
|
+
* @return {void} 无
|
|
822
|
+
* @private
|
|
823
|
+
*/
|
|
824
|
+
|
|
825
|
+
}, {
|
|
826
|
+
key: "_mountedHook",
|
|
827
|
+
value: function _mountedHook() {
|
|
828
|
+
this._map.scene.mapvDepthTest = external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["defaultValue"](this.options.depthTest, true); //是否进行计算深度(大数据时,需要关闭)
|
|
829
|
+
|
|
830
|
+
this._map.scene.mapvAutoHeight = external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["defaultValue"](this.options.clampToGround, false);
|
|
831
|
+
this._map.scene.mapvFixedHeight = external_commonjs2_mars3d_cesium_amd_mars3d_cesium_commonjs_mars3d_cesium_root_Cesium_["defaultValue"](this.options.fixedHeight, 0);
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* 对象添加到地图上的创建钩子方法,
|
|
835
|
+
* 每次add时都会调用
|
|
836
|
+
* @return {void} 无
|
|
837
|
+
* @private
|
|
838
|
+
*/
|
|
839
|
+
|
|
840
|
+
}, {
|
|
841
|
+
key: "_addedHook",
|
|
842
|
+
value: function _addedHook() {
|
|
843
|
+
this._mapVRenderer = new MapVRenderer_MapVRenderer(this._map, new mapv.DataSet(this.dataSet.data), this.options, this);
|
|
844
|
+
this.initDevicePixelRatio();
|
|
845
|
+
this.canvas = this._createCanvas();
|
|
846
|
+
this.render = this.render.bind(this);
|
|
847
|
+
this.container = this._map.container;
|
|
848
|
+
this.addInnerContainer();
|
|
849
|
+
this.bindEvent();
|
|
850
|
+
|
|
851
|
+
this._reset();
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* 对象从地图上移除的创建钩子方法,
|
|
855
|
+
* 每次remove时都会调用
|
|
856
|
+
* @return {void} 无
|
|
857
|
+
* @private
|
|
858
|
+
*/
|
|
859
|
+
|
|
860
|
+
}, {
|
|
861
|
+
key: "_removedHook",
|
|
862
|
+
value: function _removedHook() {
|
|
863
|
+
//释放
|
|
864
|
+
this.unbindEvent();
|
|
865
|
+
|
|
866
|
+
if (this._mapVRenderer) {
|
|
867
|
+
this._mapVRenderer.destroy();
|
|
868
|
+
|
|
869
|
+
this._mapVRenderer = null;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
this.canvas.parentElement.removeChild(this.canvas);
|
|
873
|
+
}
|
|
874
|
+
}, {
|
|
875
|
+
key: "initDevicePixelRatio",
|
|
876
|
+
value: function initDevicePixelRatio() {
|
|
877
|
+
this.devicePixelRatio = window.devicePixelRatio || 1;
|
|
878
|
+
}
|
|
879
|
+
}, {
|
|
880
|
+
key: "addInnerContainer",
|
|
881
|
+
value: function addInnerContainer() {
|
|
882
|
+
this.container.appendChild(this.canvas);
|
|
883
|
+
}
|
|
884
|
+
}, {
|
|
885
|
+
key: "bindEvent",
|
|
886
|
+
value: function bindEvent() {
|
|
887
|
+
//绑定cesium事件与mapv联动
|
|
888
|
+
this._map.on(external_mars3d_["EventType"].mouseDown, this._onMoveStartEvent, this); //按下
|
|
889
|
+
// this._map.on(mars3d.EventType.mouseUp, this._onMoveEndEvent, this) //释放
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
this._map.on(external_mars3d_["EventType"].cameraMoveStart, this._onMoveStartEvent, this);
|
|
893
|
+
|
|
894
|
+
this._map.on(external_mars3d_["EventType"].cameraMoveEnd, this._onMoveEndEvent, this);
|
|
895
|
+
}
|
|
896
|
+
}, {
|
|
897
|
+
key: "unbindEvent",
|
|
898
|
+
value: function unbindEvent() {
|
|
899
|
+
this._map.off(external_mars3d_["EventType"].mouseDown, this._onMoveStartEvent, this); //按下
|
|
900
|
+
// this._map.off(mars3d.EventType.mouseUp, this._onMoveEndEvent, this) //释放
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
this._map.off(external_mars3d_["EventType"].cameraMoveStart, this._onMoveStartEvent, this);
|
|
904
|
+
|
|
905
|
+
this._map.off(external_mars3d_["EventType"].cameraMoveEnd, this._onMoveEndEvent, this);
|
|
906
|
+
|
|
907
|
+
this._map.off(external_mars3d_["EventType"].postRender, this._reset, this);
|
|
908
|
+
}
|
|
909
|
+
}, {
|
|
910
|
+
key: "_onMoveStartEvent",
|
|
911
|
+
value: function _onMoveStartEvent() {
|
|
912
|
+
if (this._mapVRenderer) {
|
|
913
|
+
this._mapVRenderer.animatorMovestartEvent();
|
|
914
|
+
|
|
915
|
+
this._map.off(external_mars3d_["EventType"].postRender, this._reset, this);
|
|
916
|
+
|
|
917
|
+
this._map.on(external_mars3d_["EventType"].postRender, this._reset, this);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}, {
|
|
921
|
+
key: "_onMoveEndEvent",
|
|
922
|
+
value: function _onMoveEndEvent() {
|
|
923
|
+
if (this._mapVRenderer) {
|
|
924
|
+
this._map.off(external_mars3d_["EventType"].postRender, this._reset, this);
|
|
925
|
+
|
|
926
|
+
this._mapVRenderer.animatorMoveendEvent();
|
|
927
|
+
|
|
928
|
+
this._reset();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* 新增mapv数据
|
|
933
|
+
* @param {mapv.DataSet} dataSet MapV数据集,可以参考[ MapV数据集对象说明]{@link https://github.com/huiyan-fe/mapv/blob/master/src/data/DataSet.md}
|
|
934
|
+
* @returns {void} 无
|
|
935
|
+
*/
|
|
936
|
+
|
|
937
|
+
}, {
|
|
938
|
+
key: "addData",
|
|
939
|
+
value: function addData(dataSet) {
|
|
940
|
+
if (this._mapVRenderer) {
|
|
941
|
+
this._mapVRenderer.addData(dataSet, this.options);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* 更新mapv数据
|
|
946
|
+
* @param {mapv.DataSet} dataSet MapV数据集,可以参考[ MapV数据集对象说明]{@link https://github.com/huiyan-fe/mapv/blob/master/src/data/DataSet.md}
|
|
947
|
+
* @returns {void} 无
|
|
948
|
+
*/
|
|
949
|
+
|
|
950
|
+
}, {
|
|
951
|
+
key: "updateData",
|
|
952
|
+
value: function updateData(dataSet) {
|
|
953
|
+
if (this._mapVRenderer) {
|
|
954
|
+
this._mapVRenderer.updateData(dataSet, this.options);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* 获取数据
|
|
959
|
+
* @return {mapv.DataSet} MapV数据集,可以参考[ MapV数据集对象说明]{@link https://github.com/huiyan-fe/mapv/blob/master/src/data/DataSet.md}
|
|
960
|
+
*/
|
|
961
|
+
|
|
962
|
+
}, {
|
|
963
|
+
key: "getData",
|
|
964
|
+
value: function getData() {
|
|
965
|
+
if (this._mapVRenderer) {
|
|
966
|
+
this.dataSet = this._mapVRenderer.getData();
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
return this.dataSet;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* 删除指定数据
|
|
973
|
+
* @param {mapv.DataSet} data 数据
|
|
974
|
+
* @returns {void} 无
|
|
975
|
+
*/
|
|
976
|
+
|
|
977
|
+
}, {
|
|
978
|
+
key: "removeData",
|
|
979
|
+
value: function removeData(data) {
|
|
980
|
+
if (this._mapVRenderer) {
|
|
981
|
+
this._mapVRenderer.removeData(data);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* 删除所有数据
|
|
986
|
+
* @returns {void} 无
|
|
987
|
+
*/
|
|
988
|
+
|
|
989
|
+
}, {
|
|
990
|
+
key: "removeAllData",
|
|
991
|
+
value: function removeAllData() {
|
|
992
|
+
if (this._mapVRenderer) {
|
|
993
|
+
this._mapVRenderer.clearData();
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}, {
|
|
997
|
+
key: "_createCanvas",
|
|
998
|
+
value: function _createCanvas() {
|
|
999
|
+
var container = document.createElement("canvas");
|
|
1000
|
+
container.id = this.options.layerid || "mapv" + divId++;
|
|
1001
|
+
container.style.position = "absolute";
|
|
1002
|
+
container.style.top = "0px";
|
|
1003
|
+
container.style.left = "0px";
|
|
1004
|
+
container.style.pointerEvents = this._pointerEvents ? "auto" : "none"; //auto时可以交互,但是没法放大地球, none没法交互
|
|
1005
|
+
|
|
1006
|
+
container.style.zIndex = this.options.zIndex || 100;
|
|
1007
|
+
container.width = parseInt(this._map.canvas.width);
|
|
1008
|
+
container.height = parseInt(this._map.canvas.height);
|
|
1009
|
+
container.style.width = this._map.canvas.style.width;
|
|
1010
|
+
container.style.height = this._map.canvas.style.height;
|
|
1011
|
+
var e = this.devicePixelRatio;
|
|
1012
|
+
return "2d" === this.options.context && container.getContext(this.options.context).scale(e, e), container;
|
|
1013
|
+
}
|
|
1014
|
+
}, {
|
|
1015
|
+
key: "_reset",
|
|
1016
|
+
value: function _reset() {
|
|
1017
|
+
this.resize();
|
|
1018
|
+
this.render();
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* 重绘图层
|
|
1022
|
+
* @return {void} 无
|
|
1023
|
+
*/
|
|
1024
|
+
|
|
1025
|
+
}, {
|
|
1026
|
+
key: "draw",
|
|
1027
|
+
value: function draw() {
|
|
1028
|
+
this._reset();
|
|
1029
|
+
}
|
|
1030
|
+
}, {
|
|
1031
|
+
key: "remove",
|
|
1032
|
+
value: function remove() {
|
|
1033
|
+
if (this._mapVRenderer) {
|
|
1034
|
+
this._mapVRenderer.destroy();
|
|
1035
|
+
|
|
1036
|
+
this._mapVRenderer = null;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
this.canvas.parentElement.removeChild(this.canvas);
|
|
1040
|
+
}
|
|
1041
|
+
}, {
|
|
1042
|
+
key: "render",
|
|
1043
|
+
value: function render() {
|
|
1044
|
+
this._mapVRenderer._canvasUpdate();
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* 改变图层canvas容器尺寸
|
|
1048
|
+
* @return {void} 无
|
|
1049
|
+
*/
|
|
1050
|
+
|
|
1051
|
+
}, {
|
|
1052
|
+
key: "resize",
|
|
1053
|
+
value: function resize() {
|
|
1054
|
+
if (void 0 !== this.canvas && null !== this.canvas) {
|
|
1055
|
+
var container = this.canvas;
|
|
1056
|
+
container.style.position = "absolute", container.style.top = "0px", container.style.left = "0px", container.width = parseInt(this._map.canvas.width), container.height = parseInt(this._map.canvas.height), container.style.width = this._map.canvas.style.width, container.style.height = this._map.canvas.style.height;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}]);
|
|
1060
|
+
|
|
1061
|
+
return MapVLayer;
|
|
1062
|
+
}(MapVLayer_BaseLayer); //注册下
|
|
1063
|
+
|
|
1064
|
+
external_mars3d_["LayerUtil"].register("mapv", MapVLayer_MapVLayer);
|
|
1065
|
+
external_mars3d_["layer"].MapVLayer = MapVLayer_MapVLayer;
|
|
1066
|
+
// CONCATENATED MODULE: ./src/index.js
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
/***/ })
|
|
1070
|
+
/******/ ]);
|
|
1071
|
+
});
|