Skip to content

Commit 190348d

Browse files
committed
【fix】 fixed SuperMap#45 mapv 动态图层删除时报错问题 review by songym
1 parent b05b5ce commit 190348d

File tree

12 files changed

+212
-166
lines changed

12 files changed

+212
-166
lines changed

dist/classic/iclient-classic-es6.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7768,35 +7768,37 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
77687768
SuperMap_SuperMap.Util.extend(this, options);
77697769
}
77707770
//MapV图要求使用canvas绘制,判断是否支持
7771-
this.canvas = document.createElement("canvas");
7771+
this.canvas = document.createElement('canvas');
77727772
if (!this.canvas.getContext) {
77737773
return;
77747774
}
77757775
this.supported = true;
77767776
//构建绘图面板
7777-
this.canvas.style.position = "absolute";
7778-
this.canvas.style.top = 0 + "px";
7779-
this.canvas.style.left = 0 + "px";
7777+
this.canvas.style.position = 'absolute';
7778+
this.canvas.style.top = 0 + 'px';
7779+
this.canvas.style.left = 0 + 'px';
77807780
this.div.appendChild(this.canvas);
7781-
var context = this.options && this.options.context || "2d";
7781+
var context = (this.options && this.options.context) || '2d';
77827782
this.canvasContext = this.canvas.getContext(context);
77837783
var global$2 = typeof window === 'undefined' ? {} : window;
7784-
var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio;
7784+
var devicePixelRatio = (this.devicePixelRatio = global$2.devicePixelRatio);
77857785
if (context == '2d') {
77867786
this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
77877787
}
7788-
this.attribution = "© 2018 百度 <a href='http://mapv.baidu.com' target='_blank'>MapV</a> with <span>© <a target='_blank' href='http://iclient.supermap.io' " +
7788+
this.attribution =
7789+
"© 2018 百度 <a href='http://mapv.baidu.com' target='_blank'>MapV</a> with <span>© <a target='_blank' href='http://iclient.supermap.io' " +
77897790
"style='color: #08c;text-decoration: none;'>SuperMap iClient</a></span>";
77907791

7791-
this.CLASS_NAME = "SuperMap.Layer.MapVLayer";
7792+
this.CLASS_NAME = 'SuperMap.Layer.MapVLayer';
77927793
}
77937794

7794-
77957795
/**
77967796
* @function SuperMap.Layer.MapVLayer.prototype.destroy
77977797
* @override
77987798
*/
77997799
destroy() {
7800+
this.renderer.animator && this.renderer.animator.stop();
7801+
this.renderer.animator = null;
78007802
this.dataSet = null;
78017803
this.options = null;
78027804
this.renderer = null;
@@ -7808,7 +7810,6 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
78087810
super.destroy();
78097811
}
78107812

7811-
78127813
/**
78137814
* @function SuperMap.Layer.MapVLayer.prototype.addData
78147815
* @description 追加数据。
@@ -7819,7 +7820,6 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
78197820
this.renderer && this.renderer.addData(dataSet, options);
78207821
}
78217822

7822-
78237823
/**
78247824
* @function SuperMap.Layer.MapVLayer.prototype.
78257825
* @description 设置数据。
@@ -7830,7 +7830,6 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
78307830
this.renderer && this.renderer.setData(dataSet, options);
78317831
}
78327832

7833-
78347833
/**
78357834
* @function SuperMap.Layer.MapVLayer.prototype.getData
78367835
* @description 获取数据。
@@ -7867,7 +7866,6 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
78677866
this.renderer.clearData();
78687867
}
78697868

7870-
78717869
/**
78727870
* @function SuperMap.Layer.MapVLayer.prototype.setMap
78737871
* @description 图层已经添加到 Map 中。
@@ -7899,21 +7897,21 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
78997897
}
79007898
this.zoomChanged = zoomChanged;
79017899
if (!dragging) {
7902-
this.div.style.visibility = "hidden";
7903-
this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px";
7904-
this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px";
7900+
this.div.style.visibility = 'hidden';
7901+
this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + 'px';
7902+
this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + 'px';
79057903
/*this.canvas.style.left = this.div.style.left;
79067904
this.canvas.style.top = this.div.style.top;*/
79077905
var size = this.map.getSize();
7908-
this.div.style.width = parseInt(size.w) + "px";
7909-
this.div.style.height = parseInt(size.h) + "px";
7906+
this.div.style.width = parseInt(size.w) + 'px';
7907+
this.div.style.height = parseInt(size.h) + 'px';
79107908
this.canvas.width = parseInt(size.w);
79117909
this.canvas.height = parseInt(size.h);
79127910
this.canvas.style.width = this.div.style.width;
79137911
this.canvas.style.height = this.div.style.height;
79147912
this.maxWidth = size.w;
79157913
this.maxHeight = size.h;
7916-
this.div.style.visibility = "";
7914+
this.div.style.visibility = '';
79177915
if (!zoomChanged) {
79187916
this.renderer && this.renderer.render();
79197917
}
@@ -7924,26 +7922,25 @@ class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
79247922
}
79257923
}
79267924

7927-
79287925
/**
79297926
* @function SuperMap.Layer.MapVLayer.prototype.transferToMapLatLng
79307927
* @description 将经纬度转成底图的投影坐标。
79317928
* @param {SuperMap.Lonlat} latLng - 经纬度坐标。
79327929
* @deprecated
79337930
*/
79347931
transferToMapLatLng(latLng) {
7935-
var source = "EPSG:4326",
7936-
dest = "EPSG:4326";
7937-
var unit = this.map.getUnits() || "degree";
7938-
if (["m", "meter"].indexOf(unit.toLowerCase()) > -1) {
7939-
dest = "EPSG:3857";
7932+
var source = 'EPSG:4326',
7933+
dest = 'EPSG:4326';
7934+
var unit = this.map.getUnits() || 'degree';
7935+
if (['m', 'meter'].indexOf(unit.toLowerCase()) > -1) {
7936+
dest = 'EPSG:3857';
79407937
}
79417938
return new SuperMap_SuperMap.LonLat(latLng.lon, latLng.lat).transform(source, dest);
79427939
}
7943-
79447940
}
79457941

79467942
SuperMap_SuperMap.Layer.MapVLayer = MapVLayer_MapVLayer;
7943+
79477944
// CONCATENATED MODULE: ./src/classic/overlay/mapv/index.js
79487945
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
79497946
* This program are made available under the terms of the Apache License, Version 2.0

dist/classic/iclient-classic-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/classic/iclient-classic.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10364,17 +10364,17 @@ var MapVLayer = exports.MapVLayer = function (_SuperMap$Layer) {
1036410364
_SuperMap.SuperMap.Util.extend(_this, options);
1036510365
}
1036610366
//MapV图要求使用canvas绘制,判断是否支持
10367-
_this.canvas = document.createElement("canvas");
10367+
_this.canvas = document.createElement('canvas');
1036810368
if (!_this.canvas.getContext) {
1036910369
return _possibleConstructorReturn(_this);
1037010370
}
1037110371
_this.supported = true;
1037210372
//构建绘图面板
10373-
_this.canvas.style.position = "absolute";
10374-
_this.canvas.style.top = 0 + "px";
10375-
_this.canvas.style.left = 0 + "px";
10373+
_this.canvas.style.position = 'absolute';
10374+
_this.canvas.style.top = 0 + 'px';
10375+
_this.canvas.style.left = 0 + 'px';
1037610376
_this.div.appendChild(_this.canvas);
10377-
var context = _this.options && _this.options.context || "2d";
10377+
var context = _this.options && _this.options.context || '2d';
1037810378
_this.canvasContext = _this.canvas.getContext(context);
1037910379
var global$2 = typeof window === 'undefined' ? {} : window;
1038010380
var devicePixelRatio = _this.devicePixelRatio = global$2.devicePixelRatio;
@@ -10383,7 +10383,7 @@ var MapVLayer = exports.MapVLayer = function (_SuperMap$Layer) {
1038310383
}
1038410384
_this.attribution = "© 2018 百度 <a href='http://mapv.baidu.com' target='_blank'>MapV</a> with <span>© <a target='_blank' href='http://iclient.supermap.io' " + "style='color: #08c;text-decoration: none;'>SuperMap iClient</a></span>";
1038510385

10386-
_this.CLASS_NAME = "SuperMap.Layer.MapVLayer";
10386+
_this.CLASS_NAME = 'SuperMap.Layer.MapVLayer';
1038710387
return _this;
1038810388
}
1038910389

@@ -10396,6 +10396,8 @@ var MapVLayer = exports.MapVLayer = function (_SuperMap$Layer) {
1039610396
_createClass(MapVLayer, [{
1039710397
key: 'destroy',
1039810398
value: function destroy() {
10399+
this.renderer.animator && this.renderer.animator.stop();
10400+
this.renderer.animator = null;
1039910401
this.dataSet = null;
1040010402
this.options = null;
1040110403
this.renderer = null;
@@ -10515,21 +10517,21 @@ var MapVLayer = exports.MapVLayer = function (_SuperMap$Layer) {
1051510517
}
1051610518
this.zoomChanged = zoomChanged;
1051710519
if (!dragging) {
10518-
this.div.style.visibility = "hidden";
10519-
this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px";
10520-
this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + "px";
10520+
this.div.style.visibility = 'hidden';
10521+
this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + 'px';
10522+
this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + 'px';
1052110523
/*this.canvas.style.left = this.div.style.left;
1052210524
this.canvas.style.top = this.div.style.top;*/
1052310525
var size = this.map.getSize();
10524-
this.div.style.width = parseInt(size.w) + "px";
10525-
this.div.style.height = parseInt(size.h) + "px";
10526+
this.div.style.width = parseInt(size.w) + 'px';
10527+
this.div.style.height = parseInt(size.h) + 'px';
1052610528
this.canvas.width = parseInt(size.w);
1052710529
this.canvas.height = parseInt(size.h);
1052810530
this.canvas.style.width = this.div.style.width;
1052910531
this.canvas.style.height = this.div.style.height;
1053010532
this.maxWidth = size.w;
1053110533
this.maxHeight = size.h;
10532-
this.div.style.visibility = "";
10534+
this.div.style.visibility = '';
1053310535
if (!zoomChanged) {
1053410536
this.renderer && this.renderer.render();
1053510537
}
@@ -10550,11 +10552,11 @@ var MapVLayer = exports.MapVLayer = function (_SuperMap$Layer) {
1055010552
}, {
1055110553
key: 'transferToMapLatLng',
1055210554
value: function transferToMapLatLng(latLng) {
10553-
var source = "EPSG:4326",
10554-
dest = "EPSG:4326";
10555-
var unit = this.map.getUnits() || "degree";
10556-
if (["m", "meter"].indexOf(unit.toLowerCase()) > -1) {
10557-
dest = "EPSG:3857";
10555+
var source = 'EPSG:4326',
10556+
dest = 'EPSG:4326';
10557+
var unit = this.map.getUnits() || 'degree';
10558+
if (['m', 'meter'].indexOf(unit.toLowerCase()) > -1) {
10559+
dest = 'EPSG:3857';
1055810560
}
1055910561
return new _SuperMap.SuperMap.LonLat(latLng.lon, latLng.lat).transform(source, dest);
1056010562
}

0 commit comments

Comments
 (0)