mars3d-supermap 3.4.26 → 3.5.0
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-supermap.js +225 -154
- package/package.json +3 -3
package/dist/mars3d-supermap.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mars3D平台插件,结合supermap超图库使用的功能插件 mars3d-supermap
|
|
3
3
|
*
|
|
4
|
-
* 版本信息:v3.
|
|
5
|
-
* 编译日期:2023-03-
|
|
4
|
+
* 版本信息:v3.5.0
|
|
5
|
+
* 编译日期:2023-03-17 08:59:34
|
|
6
6
|
* 版权所有:Copyright by 火星科技 http://mars3d.cn
|
|
7
|
-
* 使用单位:免费公开版 ,2022-
|
|
7
|
+
* 使用单位:免费公开版 ,2022-10-01
|
|
8
8
|
*/
|
|
9
9
|
(function (global, factory) {
|
|
10
10
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, (window.mars3d || require('mars3d'))) :
|
|
@@ -34,14 +34,17 @@
|
|
|
34
34
|
|
|
35
35
|
function ownKeys(object, enumerableOnly) {
|
|
36
36
|
var keys = Object.keys(object);
|
|
37
|
+
|
|
37
38
|
if (Object.getOwnPropertySymbols) {
|
|
38
39
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
39
40
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
40
41
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
41
42
|
})), keys.push.apply(keys, symbols);
|
|
42
43
|
}
|
|
44
|
+
|
|
43
45
|
return keys;
|
|
44
46
|
}
|
|
47
|
+
|
|
45
48
|
function _objectSpread2(target) {
|
|
46
49
|
for (var i = 1; i < arguments.length; i++) {
|
|
47
50
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -51,13 +54,16 @@
|
|
|
51
54
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
52
55
|
});
|
|
53
56
|
}
|
|
57
|
+
|
|
54
58
|
return target;
|
|
55
59
|
}
|
|
60
|
+
|
|
56
61
|
function _classCallCheck(instance, Constructor) {
|
|
57
62
|
if (!(instance instanceof Constructor)) {
|
|
58
63
|
throw new TypeError("Cannot call a class as a function");
|
|
59
64
|
}
|
|
60
65
|
}
|
|
66
|
+
|
|
61
67
|
function _defineProperties(target, props) {
|
|
62
68
|
for (var i = 0; i < props.length; i++) {
|
|
63
69
|
var descriptor = props[i];
|
|
@@ -67,6 +73,7 @@
|
|
|
67
73
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
76
|
+
|
|
70
77
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
71
78
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
72
79
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -75,6 +82,7 @@
|
|
|
75
82
|
});
|
|
76
83
|
return Constructor;
|
|
77
84
|
}
|
|
85
|
+
|
|
78
86
|
function _defineProperty(obj, key, value) {
|
|
79
87
|
if (key in obj) {
|
|
80
88
|
Object.defineProperty(obj, key, {
|
|
@@ -86,12 +94,15 @@
|
|
|
86
94
|
} else {
|
|
87
95
|
obj[key] = value;
|
|
88
96
|
}
|
|
97
|
+
|
|
89
98
|
return obj;
|
|
90
99
|
}
|
|
100
|
+
|
|
91
101
|
function _inherits(subClass, superClass) {
|
|
92
102
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
93
103
|
throw new TypeError("Super expression must either be null or a function");
|
|
94
104
|
}
|
|
105
|
+
|
|
95
106
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
96
107
|
constructor: {
|
|
97
108
|
value: subClass,
|
|
@@ -104,23 +115,28 @@
|
|
|
104
115
|
});
|
|
105
116
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
106
117
|
}
|
|
118
|
+
|
|
107
119
|
function _getPrototypeOf(o) {
|
|
108
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf
|
|
120
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
109
121
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
110
122
|
};
|
|
111
123
|
return _getPrototypeOf(o);
|
|
112
124
|
}
|
|
125
|
+
|
|
113
126
|
function _setPrototypeOf(o, p) {
|
|
114
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
127
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
115
128
|
o.__proto__ = p;
|
|
116
129
|
return o;
|
|
117
130
|
};
|
|
131
|
+
|
|
118
132
|
return _setPrototypeOf(o, p);
|
|
119
133
|
}
|
|
134
|
+
|
|
120
135
|
function _isNativeReflectConstruct() {
|
|
121
136
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
122
137
|
if (Reflect.construct.sham) return false;
|
|
123
138
|
if (typeof Proxy === "function") return true;
|
|
139
|
+
|
|
124
140
|
try {
|
|
125
141
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
126
142
|
return true;
|
|
@@ -128,115 +144,135 @@
|
|
|
128
144
|
return false;
|
|
129
145
|
}
|
|
130
146
|
}
|
|
147
|
+
|
|
131
148
|
function _assertThisInitialized(self) {
|
|
132
149
|
if (self === void 0) {
|
|
133
150
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
134
151
|
}
|
|
152
|
+
|
|
135
153
|
return self;
|
|
136
154
|
}
|
|
155
|
+
|
|
137
156
|
function _possibleConstructorReturn(self, call) {
|
|
138
157
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
139
158
|
return call;
|
|
140
159
|
} else if (call !== void 0) {
|
|
141
160
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
142
161
|
}
|
|
162
|
+
|
|
143
163
|
return _assertThisInitialized(self);
|
|
144
164
|
}
|
|
165
|
+
|
|
145
166
|
function _createSuper(Derived) {
|
|
146
167
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
168
|
+
|
|
147
169
|
return function _createSuperInternal() {
|
|
148
170
|
var Super = _getPrototypeOf(Derived),
|
|
149
|
-
|
|
171
|
+
result;
|
|
172
|
+
|
|
150
173
|
if (hasNativeReflectConstruct) {
|
|
151
174
|
var NewTarget = _getPrototypeOf(this).constructor;
|
|
175
|
+
|
|
152
176
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
153
177
|
} else {
|
|
154
178
|
result = Super.apply(this, arguments);
|
|
155
179
|
}
|
|
180
|
+
|
|
156
181
|
return _possibleConstructorReturn(this, result);
|
|
157
182
|
};
|
|
158
183
|
}
|
|
184
|
+
|
|
159
185
|
function _superPropBase(object, property) {
|
|
160
186
|
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
161
187
|
object = _getPrototypeOf(object);
|
|
162
188
|
if (object === null) break;
|
|
163
189
|
}
|
|
190
|
+
|
|
164
191
|
return object;
|
|
165
192
|
}
|
|
193
|
+
|
|
166
194
|
function _get() {
|
|
167
195
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
168
|
-
_get = Reflect.get
|
|
196
|
+
_get = Reflect.get;
|
|
169
197
|
} else {
|
|
170
198
|
_get = function _get(target, property, receiver) {
|
|
171
199
|
var base = _superPropBase(target, property);
|
|
200
|
+
|
|
172
201
|
if (!base) return;
|
|
173
202
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
203
|
+
|
|
174
204
|
if (desc.get) {
|
|
175
205
|
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
176
206
|
}
|
|
207
|
+
|
|
177
208
|
return desc.value;
|
|
178
209
|
};
|
|
179
210
|
}
|
|
211
|
+
|
|
180
212
|
return _get.apply(this, arguments);
|
|
181
213
|
}
|
|
182
214
|
|
|
183
215
|
var Cesium$2 = mars3d__namespace.Cesium;
|
|
184
216
|
var BaseLayer$1 = mars3d__namespace.layer.BaseLayer;
|
|
185
|
-
|
|
186
217
|
/**
|
|
187
218
|
* 超图S3M三维模型图层,
|
|
188
219
|
* 【需要引入 mars3d-supermap 插件库】
|
|
189
220
|
*
|
|
190
|
-
* @param {
|
|
191
|
-
* @param {
|
|
192
|
-
* @param {
|
|
193
|
-
* @param {
|
|
194
|
-
* @param {
|
|
195
|
-
* @param {
|
|
196
|
-
* @param {
|
|
221
|
+
* @param {object} [options] 参数对象,包括以下:
|
|
222
|
+
* @param {string} options.url supermap的S3M服务地址,示例:"url": "http://www.supermapol.com/realspace/services/3D-Olympic/rest/realspace"
|
|
223
|
+
* @param {string} [options.layername] 指定图层名称,未指定时,打开iserver场景服务下所有图层
|
|
224
|
+
* @param {string} [options.sceneName] 工作空间中有多个场景,需要指定场景名称;设置为undefined,默认打开第一个
|
|
225
|
+
* @param {object} [options.s3mOptions] [S3M支持的参数]{@link http://support.supermap.com.cn:8090/webgl/docs/Documentation/S3MTilesLayer.html?classFilter=S3MTilesLayer} ,示例: {"selectEnabled":false},
|
|
226
|
+
* @param {object} [options.position] 模型新的中心点位置(移动模型)
|
|
227
|
+
* @param {number} options.position.alt 获取或设置底部高程。(单位:米)
|
|
197
228
|
*
|
|
198
|
-
* @param {
|
|
199
|
-
* @param {
|
|
200
|
-
* @param {
|
|
201
|
-
* @param {
|
|
202
|
-
* @param {BaseClass|
|
|
203
|
-
* @param {
|
|
204
|
-
* @param {
|
|
205
|
-
* @param {
|
|
206
|
-
* @param {
|
|
207
|
-
* @param {
|
|
208
|
-
* @param {
|
|
209
|
-
* @param {
|
|
210
|
-
* @param {
|
|
229
|
+
* @param {string|number} [options.id = createGuid()] 图层id标识
|
|
230
|
+
* @param {string|number} [options.pid = -1] 图层父级的id,一般图层管理中使用
|
|
231
|
+
* @param {string} [options.name = ''] 图层名称
|
|
232
|
+
* @param {boolean} [options.show = true] 图层是否显示
|
|
233
|
+
* @param {BaseClass|boolean} [options.eventParent] 指定的事件冒泡对象,默认为map对象,false时不冒泡
|
|
234
|
+
* @param {object} [options.center] 图层自定义定位视角 {@link Map#setCameraView}
|
|
235
|
+
* @param {number} options.center.lng 经度值, 180 - 180
|
|
236
|
+
* @param {number} options.center.lat 纬度值, -90 - 90
|
|
237
|
+
* @param {number} [options.center.alt] 高度值
|
|
238
|
+
* @param {number} [options.center.heading] 方向角度值,绕垂直于地心的轴旋转角度, 0至360
|
|
239
|
+
* @param {number} [options.center.pitch] 俯仰角度值,绕纬度线旋转角度, -90至90
|
|
240
|
+
* @param {number} [options.center.roll] 翻滚角度值,绕经度线旋转角度, -90至90
|
|
241
|
+
* @param {boolean} [options.flyTo] 加载完成数据后是否自动飞行定位到数据所在的区域。
|
|
211
242
|
* @export
|
|
212
243
|
* @class S3MLayer
|
|
213
244
|
* @extends {BaseLayer}
|
|
214
245
|
*/
|
|
246
|
+
|
|
215
247
|
var S3MLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
216
248
|
_inherits(S3MLayer, _BaseLayer);
|
|
249
|
+
|
|
217
250
|
var _super = _createSuper(S3MLayer);
|
|
251
|
+
|
|
218
252
|
function S3MLayer() {
|
|
219
253
|
_classCallCheck(this, S3MLayer);
|
|
254
|
+
|
|
220
255
|
return _super.apply(this, arguments);
|
|
221
256
|
}
|
|
257
|
+
|
|
222
258
|
_createClass(S3MLayer, [{
|
|
223
259
|
key: "layer",
|
|
224
260
|
get:
|
|
225
261
|
/**
|
|
226
262
|
* 模型对应的Cesium.S3MTilesLayer图层组
|
|
227
|
-
* @type {
|
|
263
|
+
* @type {object[]}
|
|
228
264
|
* @readonly
|
|
229
265
|
* @see http://support.supermap.com.cn:8090/webgl/docs/Documentation/S3MTilesLayer.html
|
|
230
266
|
*/
|
|
231
267
|
function get() {
|
|
232
268
|
return this._layerArr;
|
|
233
269
|
}
|
|
234
|
-
|
|
235
270
|
/**
|
|
236
271
|
* 设置S3M图层本身支持的参数
|
|
237
|
-
* @type {
|
|
272
|
+
* @type {object}
|
|
238
273
|
* @see [S3M支持的参数]{@link http://support.supermap.com.cn:8090/webgl/docs/Documentation/S3MTilesLayer.html?classFilter=S3MTilesLayer}
|
|
239
274
|
*/
|
|
275
|
+
|
|
240
276
|
}, {
|
|
241
277
|
key: "s3mOptions",
|
|
242
278
|
get: function get() {
|
|
@@ -246,17 +282,21 @@
|
|
|
246
282
|
for (var key in value) {
|
|
247
283
|
var val = value[key];
|
|
248
284
|
this.options.s3mOptions[key] = val;
|
|
285
|
+
|
|
249
286
|
if (key === "transparentBackColor") {
|
|
250
287
|
// 去黑边,与offset互斥,注意别配置offset
|
|
251
288
|
val = Cesium$2.Color.fromCssColorString(val);
|
|
252
289
|
} else if (key === "transparentBackColorTolerance") {
|
|
253
290
|
val = Number(val);
|
|
254
291
|
}
|
|
292
|
+
|
|
255
293
|
for (var i = 0; i < this._layerArr.length; i++) {
|
|
256
294
|
var layer = this._layerArr[i];
|
|
295
|
+
|
|
257
296
|
if (layer == null) {
|
|
258
297
|
continue;
|
|
259
298
|
}
|
|
299
|
+
|
|
260
300
|
layer[key] = val;
|
|
261
301
|
}
|
|
262
302
|
}
|
|
@@ -266,27 +306,31 @@
|
|
|
266
306
|
value: function _showHook(show) {
|
|
267
307
|
this.eachLayer(function (layer) {
|
|
268
308
|
layer.visible = show; // 不同超图版本,有的是visible,有的是show
|
|
309
|
+
|
|
269
310
|
layer.show = show;
|
|
270
311
|
}, this);
|
|
271
312
|
}
|
|
272
|
-
|
|
273
313
|
/**
|
|
274
314
|
* 对象添加到地图前创建一些对象的钩子方法,
|
|
275
315
|
* 只会调用一次
|
|
276
316
|
* @return {void} 无
|
|
277
317
|
* @private
|
|
278
318
|
*/
|
|
319
|
+
|
|
279
320
|
}, {
|
|
280
321
|
key: "_mountedHook",
|
|
281
322
|
value: function _mountedHook() {
|
|
282
323
|
var _this = this;
|
|
324
|
+
|
|
283
325
|
if (!this._map.scene.open) {
|
|
284
326
|
throw new Error("请引入 超图版本Cesium库 或 超图S3M插件 ");
|
|
285
327
|
}
|
|
286
|
-
var centerOld = this._map.getCameraView();
|
|
287
328
|
|
|
288
|
-
// 场景添加S3M图层服务
|
|
329
|
+
var centerOld = this._map.getCameraView(); // 场景添加S3M图层服务
|
|
330
|
+
|
|
331
|
+
|
|
289
332
|
var promise;
|
|
333
|
+
|
|
290
334
|
if (this.options.layername) {
|
|
291
335
|
promise = this._map.scene.addS3MTilesLayerByScp(this.options.url, {
|
|
292
336
|
name: this.options.layername,
|
|
@@ -298,24 +342,30 @@
|
|
|
298
342
|
autoSetView: this.options.flyTo
|
|
299
343
|
});
|
|
300
344
|
}
|
|
345
|
+
|
|
301
346
|
promise.then(function (smLayer) {
|
|
302
347
|
if (Array.isArray(smLayer)) {
|
|
303
348
|
_this._layerArr = smLayer;
|
|
304
349
|
} else {
|
|
305
350
|
_this._layerArr = [smLayer];
|
|
306
351
|
}
|
|
352
|
+
|
|
307
353
|
for (var i = 0; i < _this._layerArr.length; i++) {
|
|
308
354
|
var layer = _this._layerArr[i];
|
|
355
|
+
|
|
309
356
|
if (!layer) {
|
|
310
357
|
continue;
|
|
311
358
|
}
|
|
359
|
+
|
|
312
360
|
try {
|
|
313
361
|
_this._initModelItem(layer);
|
|
314
362
|
} catch (e) {
|
|
315
363
|
mars3d__namespace.Log.logError("s3m图层初始化出错", e);
|
|
316
364
|
}
|
|
317
365
|
}
|
|
366
|
+
|
|
318
367
|
_this._showHook(_this.show);
|
|
368
|
+
|
|
319
369
|
if (_this.options.flyTo) {
|
|
320
370
|
_this.flyToByAnimationEnd();
|
|
321
371
|
} else if (_this.options.flyTo === false) {
|
|
@@ -323,31 +373,33 @@
|
|
|
323
373
|
duration: 0
|
|
324
374
|
});
|
|
325
375
|
}
|
|
376
|
+
|
|
326
377
|
_this._readyPromise.resolve(_this);
|
|
378
|
+
|
|
327
379
|
_this.fire(mars3d__namespace.EventType.load, {
|
|
328
380
|
layers: _this._layerArr
|
|
329
381
|
});
|
|
330
382
|
}, function (error) {
|
|
331
383
|
var _this$_readyPromise;
|
|
384
|
+
|
|
332
385
|
if ((_this$_readyPromise = _this._readyPromise) !== null && _this$_readyPromise !== void 0 && _this$_readyPromise.reject) {
|
|
333
386
|
_this._readyPromise.reject(error);
|
|
334
387
|
}
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
// this._map.viewer.pickEvent.addEventListener(function (feature) {
|
|
388
|
+
}); // this._map.viewer.pickEvent.addEventListener(function (feature) {
|
|
338
389
|
// debugger;
|
|
339
390
|
// });
|
|
340
|
-
}
|
|
391
|
+
} // 对单个s3m图层处理
|
|
341
392
|
|
|
342
|
-
// 对单个s3m图层处理
|
|
343
393
|
}, {
|
|
344
394
|
key: "_initModelItem",
|
|
345
395
|
value: function _initModelItem(layer) {
|
|
346
396
|
var _this$options, _this$options$positio;
|
|
397
|
+
|
|
347
398
|
// 图层参数合并
|
|
348
399
|
if (this.options.s3mOptions) {
|
|
349
400
|
for (var key in this.options.s3mOptions) {
|
|
350
401
|
var val = this.options.s3mOptions[key];
|
|
402
|
+
|
|
351
403
|
if (key === "transparentBackColor") {
|
|
352
404
|
layer[key] = Cesium$2.Color.fromCssColorString(val); // 去黑边
|
|
353
405
|
} else if (key === "transparentBackColorTolerance") {
|
|
@@ -356,84 +408,87 @@
|
|
|
356
408
|
layer[key] = val;
|
|
357
409
|
}
|
|
358
410
|
}
|
|
359
|
-
}
|
|
411
|
+
} // 选中颜色
|
|
412
|
+
|
|
360
413
|
|
|
361
|
-
// 选中颜色
|
|
362
414
|
if (this.options.highlight) {
|
|
363
415
|
layer.selectedColor = mars3d__namespace.Util.getColorByStyle(this.options.highlight);
|
|
364
|
-
}
|
|
416
|
+
} // 高度调整
|
|
417
|
+
|
|
365
418
|
|
|
366
|
-
// 高度调整
|
|
367
419
|
if ((_this$options = this.options) !== null && _this$options !== void 0 && (_this$options$positio = _this$options.position) !== null && _this$options$positio !== void 0 && _this$options$positio.alt) {
|
|
368
420
|
layer.style3D.altitudeMode = Cesium$2.HeightReference.NONE;
|
|
369
421
|
layer.style3D.bottomAltitude = this.options.position.alt;
|
|
422
|
+
|
|
370
423
|
if (layer.refresh) {
|
|
371
424
|
layer.refresh(); // 设置风格后需刷新
|
|
372
425
|
}
|
|
373
426
|
}
|
|
374
427
|
}
|
|
375
|
-
|
|
376
428
|
/**
|
|
377
429
|
* 对象添加到地图上的创建钩子方法,
|
|
378
430
|
* 每次add时都会调用
|
|
379
431
|
* @return {void} 无
|
|
380
432
|
* @private
|
|
381
433
|
*/
|
|
434
|
+
|
|
382
435
|
}, {
|
|
383
436
|
key: "_addedHook",
|
|
384
437
|
value: function _addedHook() {
|
|
385
438
|
this._showHook(this.show);
|
|
386
439
|
}
|
|
387
|
-
|
|
388
440
|
/**
|
|
389
441
|
* 对象从地图上移除的创建钩子方法,
|
|
390
442
|
* 每次remove时都会调用
|
|
391
443
|
* @return {void} 无
|
|
392
444
|
* @private
|
|
393
445
|
*/
|
|
446
|
+
|
|
394
447
|
}, {
|
|
395
448
|
key: "_removedHook",
|
|
396
449
|
value: function _removedHook() {
|
|
397
450
|
this._showHook(false);
|
|
398
451
|
}
|
|
399
|
-
|
|
400
452
|
/**
|
|
401
453
|
* 遍历每一个子图层并将其作为参数传递给回调函数
|
|
402
454
|
*
|
|
403
455
|
* @param {Function} method 回调方法
|
|
404
|
-
* @param {
|
|
456
|
+
* @param {object} [context] 侦听器的上下文(this关键字将指向的对象)。
|
|
405
457
|
* @return {GroupLayer} 当前对象本身,可以链式调用
|
|
406
458
|
*/
|
|
459
|
+
|
|
407
460
|
}, {
|
|
408
461
|
key: "eachLayer",
|
|
409
462
|
value: function eachLayer(method, context) {
|
|
410
463
|
if (!this._layerArr) {
|
|
411
464
|
return;
|
|
412
465
|
}
|
|
466
|
+
|
|
413
467
|
this._layerArr.forEach(function (layer) {
|
|
414
468
|
method.call(context, layer);
|
|
415
469
|
});
|
|
470
|
+
|
|
416
471
|
return this;
|
|
417
472
|
}
|
|
418
|
-
|
|
419
473
|
/**
|
|
420
474
|
* 设置透明度
|
|
421
|
-
* @param {
|
|
475
|
+
* @param {number} value 透明度
|
|
422
476
|
* @return {void} 无
|
|
423
477
|
*/
|
|
478
|
+
|
|
424
479
|
}, {
|
|
425
480
|
key: "setOpacity",
|
|
426
481
|
value: function setOpacity(value) {
|
|
427
482
|
this.eachLayer(function (layer) {
|
|
428
483
|
layer.style3D.fillForeColor.alpha = value;
|
|
429
484
|
}, this);
|
|
430
|
-
}
|
|
485
|
+
} // 定位至数据区域
|
|
431
486
|
|
|
432
|
-
// 定位至数据区域
|
|
433
487
|
}, {
|
|
434
488
|
key: "flyTo",
|
|
435
489
|
value: function flyTo() {
|
|
436
490
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
491
|
+
|
|
437
492
|
if (this.options.center) {
|
|
438
493
|
return this._map.setCameraView(this.options.center, options);
|
|
439
494
|
} else if (this.options.extent) {
|
|
@@ -441,183 +496,195 @@
|
|
|
441
496
|
}
|
|
442
497
|
}
|
|
443
498
|
}]);
|
|
499
|
+
|
|
444
500
|
return S3MLayer;
|
|
445
501
|
}(BaseLayer$1);
|
|
446
|
-
mars3d__namespace.layer.S3MLayer = S3MLayer;
|
|
502
|
+
mars3d__namespace.layer.S3MLayer = S3MLayer; // 注册下
|
|
447
503
|
|
|
448
|
-
// 注册下
|
|
449
504
|
mars3d__namespace.LayerUtil.register("supermap_s3m", S3MLayer);
|
|
450
505
|
|
|
451
506
|
var Cesium$1 = mars3d__namespace.Cesium;
|
|
452
507
|
var BaseTileLayer = mars3d__namespace.layer.BaseTileLayer;
|
|
453
|
-
|
|
454
508
|
/**
|
|
455
509
|
* 超图影像瓦片服务图层,
|
|
456
510
|
* 【需要引入 mars3d-supermap 插件库】
|
|
457
511
|
*
|
|
458
|
-
* @param {
|
|
459
|
-
* @param {
|
|
460
|
-
* @param {
|
|
461
|
-
* @param {
|
|
462
|
-
* @param {
|
|
463
|
-
* @param {
|
|
464
|
-
* @param {
|
|
465
|
-
* @param {
|
|
512
|
+
* @param {object} [options] 参数对象,包括以下:
|
|
513
|
+
* @param {string} options.url supermap的影像服务地址
|
|
514
|
+
* @param {string|string[]} [options.subdomains] URL模板中用于 {s} 占位符的子域。 如果此参数是单个字符串,则字符串中的每个字符都是一个子域。如果是 一个数组,数组中的每个元素都是一个子域。
|
|
515
|
+
* @param {string} [options.tileFormat] 影像图片格式,默认为png。
|
|
516
|
+
* @param {boolean} [options.transparent=true] 设置请求的地图服务的参数是否为transparent。
|
|
517
|
+
* @param {string|Cesium.Color} [options.transparentBackColor] 设置影像透明色。
|
|
518
|
+
* @param {number} [options.transparentBackColorTolerance] 去黑边,设置影像透明色容限,取值范围为0.0~1.0。0.0表示完全透明,1.0表示完全不透明。
|
|
519
|
+
* @param {string} [options.cacheKey] 影像的三维缓存密钥。
|
|
466
520
|
*
|
|
467
|
-
* @param {
|
|
468
|
-
* @param {
|
|
469
|
-
* @param {
|
|
470
|
-
* @param {
|
|
471
|
-
* @param {
|
|
472
|
-
* @param {
|
|
473
|
-
* @param {
|
|
474
|
-
* @param {
|
|
475
|
-
* @param {
|
|
476
|
-
* @param {
|
|
477
|
-
* @param {
|
|
521
|
+
* @param {number} [options.minimumLevel=0] 瓦片所支持的最低层级,如果数据没有第0层,该参数必须配置,当地图小于该级别时,平台不去请求服务数据。
|
|
522
|
+
* @param {number} [options.maximumLevel] 瓦片所支持的最大层级,大于该层级时会显示上一层拉伸后的瓦片,当地图大于该级别时,平台不去请求服务数据。
|
|
523
|
+
* @param {number} [options.minimumTerrainLevel] 展示影像图层的最小地形细节级别,小于该级别时,平台不显示影像数据。
|
|
524
|
+
* @param {number} [options.maximumTerrainLevel] 展示影像图层的最大地形细节级别,大于该级别时,平台不显示影像数据。
|
|
525
|
+
* @param {object} [options.rectangle] 瓦片数据的矩形区域范围
|
|
526
|
+
* @param {number} options.rectangle.xmin 最小经度值, -180 至 180
|
|
527
|
+
* @param {number} options.rectangle.xmax 最大经度值, -180 至 180
|
|
528
|
+
* @param {number} options.rectangle.ymin 最小纬度值, -90 至 90
|
|
529
|
+
* @param {number} options.rectangle.ymax 最大纬度值, -90 至 90
|
|
530
|
+
* @param {number[]} [options.bbox] bbox规范的瓦片数据的矩形区域范围,与rectangle二选一即可。
|
|
531
|
+
* @param {number} [options.zIndex] 控制图层的叠加层次,默认按加载的顺序进行叠加,但也可以自定义叠加顺序,数字大的在上面(只对同类型图层间有效)。
|
|
478
532
|
* @param {CRS} [options.crs=CRS.EPSG:3857] 瓦片数据的坐标系信息,默认为墨卡托投影
|
|
479
533
|
* @param {ChinaCRS} [options.chinaCRS] 标识瓦片的国内坐标系(用于自动纠偏或加偏),自动将瓦片转为map对应的chinaCRS类型坐标系。
|
|
480
534
|
*
|
|
481
|
-
* @param {
|
|
482
|
-
* @param {
|
|
483
|
-
* @param {
|
|
484
|
-
* @param {
|
|
485
|
-
* @param {
|
|
535
|
+
* @param {string} [options.proxy] 加载资源时要使用的代理服务url。
|
|
536
|
+
* @param {object} [options.templateValues] 一个对象,用于替换Url中的模板值的键/值对
|
|
537
|
+
* @param {object} [options.queryParameters] 一个对象,其中包含在检索资源时将发送的查询参数。比如:queryParameters: {'access_token': '123-435-456-000'},
|
|
538
|
+
* @param {object} [options.headers] 一个对象,将发送的其他HTTP标头。比如:headers: { 'X-My-Header': 'valueOfHeader' },
|
|
539
|
+
* @param {boolean} [options.enablePickFeatures=true] 如果为true,则 {@link UrlTemplateImageryProvider#pickFeatures} 请求 pickFeaturesUrl 并尝试解释响应中包含的功能。
|
|
486
540
|
* 如果为 false{@link UrlTemplateImageryProvider#pickFeatures} 会立即返回未定义(表示没有可拾取的内容) 功能)而无需与服务器通信。如果您知道数据,则将此属性设置为false 源不支持选择功能,或者您不希望该提供程序的功能可供选择。注意 可以通过修改 {@link UriTemplateImageryProvider#enablePickFeatures}来动态覆盖 属性。
|
|
487
541
|
* @param {Cesium.GetFeatureInfoFormat[]} [options.getFeatureInfoFormats] 在某处获取功能信息的格式 调用 {@link UrlTemplateImageryProvider#pickFeatures} 的特定位置。如果这 参数未指定,功能选择已禁用。
|
|
488
542
|
*
|
|
489
|
-
* @param {
|
|
490
|
-
* @param {
|
|
491
|
-
* @param {
|
|
492
|
-
* @param {
|
|
493
|
-
* @param {
|
|
494
|
-
* @param {
|
|
495
|
-
* @param {
|
|
496
|
-
* @param {
|
|
497
|
-
* @param {
|
|
498
|
-
* @param {
|
|
543
|
+
* @param {number} [options.opacity = 1.0] 透明度,取值范围:0.0-1.0。
|
|
544
|
+
* @param {number|Function} [options.alpha=1.0] 同opacity。
|
|
545
|
+
* @param {number|Function} [options.nightAlpha=1.0] 当 enableLighting 为 true 时 ,在地球的夜晚区域的透明度,取值范围:0.0-1.0。
|
|
546
|
+
* @param {number|Function} [options.dayAlpha=1.0] 当 enableLighting 为 true 时,在地球的白天区域的透明度,取值范围:0.0-1.0。
|
|
547
|
+
* @param {number|Function} [options.brightness=1.0] 亮度
|
|
548
|
+
* @param {number|Function} [options.contrast=1.0] 对比度。 1.0使用未修改的图像颜色,小于1.0会降低对比度,而大于1.0则会提高对比度。
|
|
549
|
+
* @param {number|Function} [options.hue=0.0] 色调。 0.0 时未修改的图像颜色。
|
|
550
|
+
* @param {number|Function} [options.saturation=1.0] 饱和度。 1.0使用未修改的图像颜色,小于1.0会降低饱和度,而大于1.0则会增加饱和度。
|
|
551
|
+
* @param {number|Function} [options.gamma=1.0] 伽马校正值。 1.0使用未修改的图像颜色。
|
|
552
|
+
* @param {number} [options.maximumAnisotropy=maximum supported] 使用的最大各向异性水平 用于纹理过滤。如果未指定此参数,则支持最大各向异性 将使用WebGL堆栈。较大的值可使影像在水平方向上看起来更好 视图。
|
|
499
553
|
* @param {Cesium.Rectangle} [options.cutoutRectangle] 制图矩形,用于裁剪此ImageryLayer的一部分。
|
|
500
554
|
* @param {Cesium.Color} [options.colorToAlpha] 用作Alpha的颜色。
|
|
501
|
-
* @param {
|
|
502
|
-
* @param {
|
|
503
|
-
* @param {
|
|
504
|
-
* @param {
|
|
505
|
-
* @param {
|
|
555
|
+
* @param {number} [options.colorToAlphaThreshold=0.004] 颜色到Alpha的阈值。
|
|
556
|
+
* @param {boolean} [options.hasAlphaChannel=true] 如果此图像提供者提供的图像为真 包括一个Alpha通道;否则为假。如果此属性为false,则为Alpha通道,如果 目前,将被忽略。如果此属性为true,则任何没有Alpha通道的图像都将 它们的alpha随处可见。当此属性为false时,内存使用情况 和纹理上传时间可能会减少。
|
|
557
|
+
* @param {number} [options.tileWidth=256] 图像图块的像素宽度。
|
|
558
|
+
* @param {number} [options.tileHeight=256] 图像图块的像素高度。
|
|
559
|
+
* @param {object} [options.customTags] 允许替换网址模板中的自定义关键字。该对象必须具有字符串作为键,并且必须具有值。
|
|
506
560
|
*
|
|
507
|
-
* @param {
|
|
508
|
-
* @param {
|
|
509
|
-
* @param {
|
|
510
|
-
* @param {
|
|
511
|
-
* @param {BaseClass|
|
|
512
|
-
* @param {
|
|
513
|
-
* @param {
|
|
514
|
-
* @param {
|
|
515
|
-
* @param {
|
|
516
|
-
* @param {
|
|
517
|
-
* @param {
|
|
518
|
-
* @param {
|
|
519
|
-
* @param {
|
|
561
|
+
* @param {string|number} [options.id = createGuid()] 图层id标识
|
|
562
|
+
* @param {string|number} [options.pid = -1] 图层父级的id,一般图层管理中使用
|
|
563
|
+
* @param {string} [options.name = ''] 图层名称
|
|
564
|
+
* @param {boolean} [options.show = true] 图层是否显示
|
|
565
|
+
* @param {BaseClass|boolean} [options.eventParent] 指定的事件冒泡对象,默认为map对象,false时不冒泡
|
|
566
|
+
* @param {object} [options.center] 图层自定义定位视角 {@link Map#setCameraView}
|
|
567
|
+
* @param {number} options.center.lng 经度值, 180 - 180
|
|
568
|
+
* @param {number} options.center.lat 纬度值, -90 - 90
|
|
569
|
+
* @param {number} [options.center.alt] 高度值
|
|
570
|
+
* @param {number} [options.center.heading] 方向角度值,绕垂直于地心的轴旋转角度, 0至360
|
|
571
|
+
* @param {number} [options.center.pitch] 俯仰角度值,绕纬度线旋转角度, -90至90
|
|
572
|
+
* @param {number} [options.center.roll] 翻滚角度值,绕经度线旋转角度, -90至90
|
|
573
|
+
* @param {boolean} [options.flyTo] 加载完成数据后是否自动飞行定位到数据所在的区域。
|
|
520
574
|
* @export
|
|
521
575
|
* @class SmImgLayer
|
|
522
576
|
* @extends {BaseTileLayer}
|
|
523
577
|
*
|
|
524
578
|
* @see http://support.supermap.com.cn:8090/webgl/docs/Documentation/SuperMapImageryProvider.html?classFilter=SuperMapImageryProvider
|
|
525
579
|
*/
|
|
580
|
+
|
|
526
581
|
var SmImgLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
527
582
|
_inherits(SmImgLayer, _BaseTileLayer);
|
|
583
|
+
|
|
528
584
|
var _super = _createSuper(SmImgLayer);
|
|
585
|
+
|
|
529
586
|
function SmImgLayer() {
|
|
530
587
|
_classCallCheck(this, SmImgLayer);
|
|
588
|
+
|
|
531
589
|
return _super.apply(this, arguments);
|
|
532
590
|
}
|
|
591
|
+
|
|
533
592
|
_createClass(SmImgLayer, [{
|
|
534
593
|
key: "_createImageryProvider",
|
|
535
|
-
value:
|
|
536
|
-
// 构建ImageryProvider
|
|
594
|
+
value: // 构建ImageryProvider
|
|
537
595
|
function _createImageryProvider(options) {
|
|
538
596
|
return createImageryProvider(options);
|
|
539
|
-
}
|
|
597
|
+
} // 添加时
|
|
540
598
|
|
|
541
|
-
// 添加时
|
|
542
599
|
}, {
|
|
543
600
|
key: "_addedHook",
|
|
544
601
|
value: function _addedHook() {
|
|
545
602
|
_get(_getPrototypeOf(SmImgLayer.prototype), "_addedHook", this).call(this);
|
|
603
|
+
|
|
546
604
|
if (Cesium$1.defined(this.options.transparentBackColor)) {
|
|
547
605
|
this._imageryLayer.transparentBackColor = mars3d__namespace.Util.getCesiumColor(this.options.transparentBackColor);
|
|
548
606
|
this._imageryLayer.transparentBackColorTolerance = this.options.transparentBackColorTolerance; // 去黑边
|
|
549
607
|
}
|
|
550
608
|
}
|
|
551
609
|
}]);
|
|
610
|
+
|
|
552
611
|
return SmImgLayer;
|
|
553
612
|
}(BaseTileLayer);
|
|
613
|
+
|
|
554
614
|
function createImageryProvider(options) {
|
|
555
615
|
options = mars3d__namespace.LayerUtil.converOptions(options);
|
|
616
|
+
|
|
556
617
|
if (options.url instanceof Cesium$1.Resource) {
|
|
557
618
|
options.url = options.url.url;
|
|
558
619
|
}
|
|
620
|
+
|
|
559
621
|
if (Cesium$1.defined(options.transparentBackColor)) {
|
|
560
622
|
delete options.transparentBackColor;
|
|
561
623
|
delete options.transparentBackColorTolerance;
|
|
562
624
|
}
|
|
625
|
+
|
|
563
626
|
return new Cesium$1.SuperMapImageryProvider(options);
|
|
564
627
|
}
|
|
565
|
-
|
|
566
628
|
/**
|
|
567
629
|
* 创建用于图层的 ImageryProvider对象
|
|
568
630
|
*
|
|
569
|
-
* @param {
|
|
631
|
+
* @param {object} options Provider参数,同图层构造参数。
|
|
570
632
|
* @return {Cesium.ImageryProvider} ImageryProvider类
|
|
571
633
|
* @function
|
|
572
634
|
*/
|
|
635
|
+
|
|
636
|
+
|
|
573
637
|
SmImgLayer.createImageryProvider = createImageryProvider;
|
|
574
|
-
mars3d__namespace.layer.SmImgLayer = SmImgLayer;
|
|
638
|
+
mars3d__namespace.layer.SmImgLayer = SmImgLayer; // 注册下
|
|
575
639
|
|
|
576
|
-
// 注册下
|
|
577
640
|
var layerType = "supermap_img";
|
|
578
641
|
mars3d__namespace.LayerUtil.register(layerType, SmImgLayer);
|
|
579
642
|
mars3d__namespace.LayerUtil.registerImageryProvider(layerType, createImageryProvider);
|
|
580
643
|
|
|
581
644
|
var Cesium = mars3d__namespace.Cesium;
|
|
582
645
|
var BaseLayer = mars3d__namespace.layer.BaseLayer;
|
|
583
|
-
|
|
584
646
|
/**
|
|
585
647
|
* 超图MVT矢量瓦片图层,
|
|
586
648
|
* 【需要引入 mars3d-supermap 插件库】
|
|
587
649
|
*
|
|
588
|
-
* @param {
|
|
589
|
-
* @param {
|
|
590
|
-
* @param {
|
|
591
|
-
* @param {
|
|
592
|
-
* @param {
|
|
593
|
-
* @param {
|
|
594
|
-
* @param {
|
|
650
|
+
* @param {object} [options] 参数对象,包括以下:
|
|
651
|
+
* @param {string} options.url 适用于通过SuperMap桌面软件生成mvt数据,经iServer发布为rest风格的地图服务,只需提供服务地址。
|
|
652
|
+
* @param {string} options.layer 图层名称,适用于第三方发布的WMTS服务。
|
|
653
|
+
* @param {number} [options.canvasWidth] 用来绘制矢量的纹理边长。默认是512,越大越精细,越小性能越高。
|
|
654
|
+
* @param {string} [options.format='mvt'] 适用于第三方发布的WMTS服务。
|
|
655
|
+
* @param {object} [options.mapboxStyle] 使用的mapBox风格。
|
|
656
|
+
* @param {object} [options.多个参数] 参考[supermap官方API]{@link http://support.supermap.com.cn:8090/webgl/docs/Documentation/Scene.html#addVectorTilesLayer}
|
|
595
657
|
*
|
|
596
658
|
*
|
|
597
|
-
* @param {
|
|
598
|
-
* @param {
|
|
599
|
-
* @param {
|
|
600
|
-
* @param {
|
|
601
|
-
* @param {BaseClass|
|
|
602
|
-
* @param {
|
|
603
|
-
* @param {
|
|
604
|
-
* @param {
|
|
605
|
-
* @param {
|
|
606
|
-
* @param {
|
|
607
|
-
* @param {
|
|
608
|
-
* @param {
|
|
609
|
-
* @param {
|
|
659
|
+
* @param {string|number} [options.id = createGuid()] 图层id标识
|
|
660
|
+
* @param {string|number} [options.pid = -1] 图层父级的id,一般图层管理中使用
|
|
661
|
+
* @param {string} [options.name = ''] 图层名称
|
|
662
|
+
* @param {boolean} [options.show = true] 图层是否显示
|
|
663
|
+
* @param {BaseClass|boolean} [options.eventParent] 指定的事件冒泡对象,默认为map对象,false时不冒泡
|
|
664
|
+
* @param {object} [options.center] 图层自定义定位视角 {@link Map#setCameraView}
|
|
665
|
+
* @param {number} options.center.lng 经度值, 180 - 180
|
|
666
|
+
* @param {number} options.center.lat 纬度值, -90 - 90
|
|
667
|
+
* @param {number} [options.center.alt] 高度值
|
|
668
|
+
* @param {number} [options.center.heading] 方向角度值,绕垂直于地心的轴旋转角度, 0至360
|
|
669
|
+
* @param {number} [options.center.pitch] 俯仰角度值,绕纬度线旋转角度, -90至90
|
|
670
|
+
* @param {number} [options.center.roll] 翻滚角度值,绕经度线旋转角度, -90至90
|
|
671
|
+
* @param {boolean} [options.flyTo] 加载完成数据后是否自动飞行定位到数据所在的区域。
|
|
610
672
|
* @export
|
|
611
673
|
* @class SmMvtLayer
|
|
612
674
|
* @extends {BaseLayer}
|
|
613
675
|
*/
|
|
676
|
+
|
|
614
677
|
var SmMvtLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
615
678
|
_inherits(SmMvtLayer, _BaseLayer);
|
|
679
|
+
|
|
616
680
|
var _super = _createSuper(SmMvtLayer);
|
|
681
|
+
|
|
617
682
|
function SmMvtLayer() {
|
|
618
683
|
_classCallCheck(this, SmMvtLayer);
|
|
684
|
+
|
|
619
685
|
return _super.apply(this, arguments);
|
|
620
686
|
}
|
|
687
|
+
|
|
621
688
|
_createClass(SmMvtLayer, [{
|
|
622
689
|
key: "layer",
|
|
623
690
|
get:
|
|
@@ -630,78 +697,81 @@
|
|
|
630
697
|
function get() {
|
|
631
698
|
return this._mvtLayer;
|
|
632
699
|
}
|
|
633
|
-
|
|
634
700
|
/**
|
|
635
701
|
* 对象添加到地图前创建一些对象的钩子方法,
|
|
636
702
|
* 只会调用一次
|
|
637
703
|
* @return {void} 无
|
|
638
704
|
* @private
|
|
639
705
|
*/
|
|
706
|
+
|
|
640
707
|
}, {
|
|
641
708
|
key: "_mountedHook",
|
|
642
709
|
value: function _mountedHook() {
|
|
643
710
|
var _this = this;
|
|
711
|
+
|
|
644
712
|
// options参考API文档:http://support.supermap.com.cn:8090/webgl/docs/Documentation/Scene.html
|
|
645
713
|
this._mvtLayer = this._map.scene.addVectorTilesMap(_objectSpread2({
|
|
646
714
|
viewer: this._map.viewer,
|
|
647
715
|
canvasWidth: 512
|
|
648
716
|
}, this.options));
|
|
649
|
-
|
|
650
|
-
|
|
717
|
+
|
|
718
|
+
this._mvtLayer.readyPromise.then(function (data) {// setPaintProperty(layerId, name, value, options)
|
|
651
719
|
// for(var layerId in that.options.style){
|
|
652
720
|
// that._mvtLayer.setPaintProperty(layerId, "fill-color", "rgba(255,0,0,0.8)");
|
|
653
721
|
// }
|
|
654
722
|
});
|
|
723
|
+
|
|
655
724
|
var scene = this._map.scene;
|
|
656
725
|
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
|
657
726
|
handler.setInputAction(function (event) {
|
|
658
727
|
if (!_this.show) {
|
|
659
728
|
return;
|
|
660
729
|
}
|
|
661
|
-
var position = mars3d__namespace.PointUtil.getCurrentMousePosition(scene, event.position);
|
|
662
730
|
|
|
663
|
-
// 查询出相交图层的feature
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
});
|
|
731
|
+
var position = mars3d__namespace.PointUtil.getCurrentMousePosition(scene, event.position); // 查询出相交图层的feature
|
|
732
|
+
|
|
733
|
+
var features = _this._mvtLayer.queryRenderedFeatures([position], {// layers: [selectLayer.id]
|
|
734
|
+
}); // eslint-disable-next-line array-callback-return
|
|
735
|
+
|
|
667
736
|
|
|
668
|
-
// eslint-disable-next-line array-callback-return
|
|
669
737
|
features.reduce(function (memo, result) {
|
|
670
738
|
var attr = result.feature.properties;
|
|
739
|
+
|
|
671
740
|
if (!attr) {
|
|
672
741
|
// eslint-disable-next-line array-callback-return
|
|
673
742
|
return;
|
|
674
743
|
}
|
|
744
|
+
|
|
675
745
|
var content = mars3d__namespace.Util.getPopupForConfig(_this.options, attr);
|
|
676
746
|
var item = {
|
|
677
747
|
data: attr,
|
|
678
748
|
event: event
|
|
679
749
|
};
|
|
750
|
+
|
|
680
751
|
_this._map.openPopup(position, content, item);
|
|
681
752
|
});
|
|
682
753
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
683
754
|
this.handler = handler;
|
|
684
755
|
}
|
|
685
|
-
|
|
686
756
|
/**
|
|
687
757
|
* 对象添加到地图上的创建钩子方法,
|
|
688
758
|
* 每次add时都会调用
|
|
689
759
|
* @return {void} 无
|
|
690
760
|
* @private
|
|
691
761
|
*/
|
|
762
|
+
|
|
692
763
|
}, {
|
|
693
764
|
key: "_addedHook",
|
|
694
765
|
value: function _addedHook() {
|
|
695
|
-
this._mvtLayer.show = true;
|
|
696
|
-
// this._mvtLayer.refresh();
|
|
766
|
+
this._mvtLayer.show = true; // this._mvtLayer.refresh();
|
|
697
767
|
}
|
|
698
|
-
|
|
699
768
|
/**
|
|
700
769
|
* 对象从地图上移除的创建钩子方法,
|
|
701
770
|
* 每次remove时都会调用
|
|
702
771
|
* @return {void} 无
|
|
703
772
|
* @private
|
|
704
773
|
*/
|
|
774
|
+
|
|
705
775
|
}, {
|
|
706
776
|
key: "_removedHook",
|
|
707
777
|
value: function _removedHook() {
|
|
@@ -709,25 +779,25 @@
|
|
|
709
779
|
this._mvtLayer.show = false;
|
|
710
780
|
}
|
|
711
781
|
}
|
|
712
|
-
|
|
713
782
|
/**
|
|
714
783
|
* 设置透明度
|
|
715
|
-
* @param {
|
|
784
|
+
* @param {number} value 透明度
|
|
716
785
|
* @return {void} 无
|
|
717
786
|
*/
|
|
787
|
+
|
|
718
788
|
}, {
|
|
719
789
|
key: "setOpacity",
|
|
720
790
|
value: function setOpacity(value) {
|
|
721
791
|
if (this._mvtLayer) {
|
|
722
792
|
this._mvtLayer.alpha = parseFloat(value);
|
|
723
793
|
}
|
|
724
|
-
}
|
|
794
|
+
} // 定位至数据区域
|
|
725
795
|
|
|
726
|
-
// 定位至数据区域
|
|
727
796
|
}, {
|
|
728
797
|
key: "flyTo",
|
|
729
798
|
value: function flyTo() {
|
|
730
799
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
800
|
+
|
|
731
801
|
if (this.options.center) {
|
|
732
802
|
return this._map.setCameraView(this.options.center, options);
|
|
733
803
|
} else if (this.options.extent) {
|
|
@@ -737,14 +807,15 @@
|
|
|
737
807
|
destination: this._mvtLayer.rectangle
|
|
738
808
|
}));
|
|
739
809
|
}
|
|
810
|
+
|
|
740
811
|
return Promise.resolve(false);
|
|
741
812
|
}
|
|
742
813
|
}]);
|
|
814
|
+
|
|
743
815
|
return SmMvtLayer;
|
|
744
816
|
}(BaseLayer);
|
|
745
|
-
mars3d__namespace.layer.SmMvtLayer = SmMvtLayer;
|
|
817
|
+
mars3d__namespace.layer.SmMvtLayer = SmMvtLayer; // 注册下
|
|
746
818
|
|
|
747
|
-
// 注册下
|
|
748
819
|
mars3d__namespace.LayerUtil.register("supermap_mvt", SmMvtLayer);
|
|
749
820
|
|
|
750
821
|
exports.S3MLayer = S3MLayer;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mars3d-supermap",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Mars3D平台插件,结合supermap超图库使用的功能插件",
|
|
5
5
|
"main": "dist/mars3d-supermap.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
|
-
"
|
|
9
|
+
"peerDependencies": {},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"mars3d": "~3.
|
|
11
|
+
"mars3d": "~3.5.0"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"lint": "eslint ./src/**/*.{js,ts} --fix"
|