Skip to content

Commit f2b1a3a

Browse files
committed
优化高性能图层性能
1 parent e9c9774 commit f2b1a3a

File tree

10 files changed

+50
-12
lines changed

10 files changed

+50
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454

5555
- `addGraphics`: 追加点要素
5656

57+
- `clear`: 释放图层资源
58+
5759
- `removeGraphics`: 移除所有要素
5860

5961

@@ -112,7 +114,7 @@
112114

113115
- `addGraphics`: 追加点要素
114116

115-
- `clear`: 移除所有要素
117+
- `clear`: 释放图层资源
116118

117119
- `removeGraphics`: 移除所有要素
118120

dist/iclient9-leaflet.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65439,7 +65439,7 @@ var GraphicLayer = exports.GraphicLayer = _leaflet2["default"].Path.extend({
6543965439
initialize: function initialize(graphics, options) {
6544065440
options = options || {};
6544165441
_leaflet2["default"].setOptions(this, options);
65442-
this.graphics = graphics;
65442+
this.graphics = [].concat(graphics);
6544365443
},
6544465444

6544565445
/**
@@ -65497,6 +65497,15 @@ var GraphicLayer = exports.GraphicLayer = _leaflet2["default"].Path.extend({
6549765497
},
6549865498

6549965499

65500+
/**
65501+
* @function L.supermap.graphicLayer.prototype.clear
65502+
* @description 释放图层资源
65503+
*/
65504+
clear: function clear() {
65505+
this.removeGraphics();
65506+
},
65507+
65508+
6550065509
/**
6550165510
* @function L.supermap.graphicLayer.prototype.removeGraphics
6550265511
* @description 移除所有要素

dist/iclient9-leaflet.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/iclient9-mapboxgl.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58655,7 +58655,7 @@ var GraphicLayer = exports.GraphicLayer = function () {
5865558655
* @member mapboxgl.supermap.GraphicLayer.prototype.graphics - {Array<mapboxgl.supermap.Graphic>}
5865658656
* @description 点要素对象数组
5865758657
*/
58658-
this.graphics = opt.graphics;
58658+
this.graphics = [].concat(opt.graphics);
5865958659
}
5866058660

5866158661
/**
@@ -58847,6 +58847,17 @@ var GraphicLayer = exports.GraphicLayer = function () {
5884758847
this.layer.setState(state);
5884858848
}
5884958849

58850+
/**
58851+
* @function mapboxgl.supermap.GraphicLayer.prototype.clear
58852+
* @description 释放图层资源
58853+
*/
58854+
58855+
}, {
58856+
key: 'clear',
58857+
value: function clear() {
58858+
this.removeGraphics();
58859+
}
58860+
5885058861
/**
5885158862
* @function mapboxgl.supermap.GraphicLayer.prototype.removeGraphics
5885258863
* @description 移除所有要素

dist/iclient9-mapboxgl.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/iclient9-openlayers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62881,7 +62881,7 @@ var Graphic = exports.Graphic = function (_ol$source$ImageCanva) {
6288162881
state: options.state
6288262882
}));
6288362883

62884-
_this.graphics_ = options.graphics;
62884+
_this.graphics_ = [].concat(options.graphics);
6288562885
_this.map = options.map;
6288662886
_this.highLightStyle = options.highLightStyle;
6288762887
//是否支持高亮,默认支持
@@ -63052,7 +63052,7 @@ var Graphic = exports.Graphic = function (_ol$source$ImageCanva) {
6305263052

6305363053
/**
6305463054
* @function ol.source.Graphic.prototype.clear
63055-
* @description 清除所有要素
63055+
* @description 释放图层资源
6305663056
*/
6305763057

6305863058
}, {

dist/iclient9-openlayers.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.

src/leaflet/overlay/GraphicLayer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export var GraphicLayer = L.Path.extend({
1515
initialize: function (graphics, options) {
1616
options = options || {};
1717
L.setOptions(this, options);
18-
this.graphics = graphics;
18+
this.graphics = [].concat(graphics);
1919
},
2020

2121
/**
@@ -71,6 +71,14 @@ export var GraphicLayer = L.Path.extend({
7171
this._update();
7272
},
7373

74+
/**
75+
* @function L.supermap.graphicLayer.prototype.clear
76+
* @description 释放图层资源
77+
*/
78+
clear() {
79+
this.removeGraphics();
80+
},
81+
7482
/**
7583
* @function L.supermap.graphicLayer.prototype.removeGraphics
7684
* @description 移除所有要素

src/mapboxgl/overlay/GraphicLayer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class GraphicLayer {
4747
* @member mapboxgl.supermap.GraphicLayer.prototype.graphics - {Array<mapboxgl.supermap.Graphic>}
4848
* @description 点要素对象数组
4949
*/
50-
this.graphics = opt.graphics;
50+
this.graphics = [].concat(opt.graphics);
5151
}
5252

5353
/**
@@ -221,6 +221,14 @@ export class GraphicLayer {
221221
this.layer.setState(state);
222222
}
223223

224+
/**
225+
* @function mapboxgl.supermap.GraphicLayer.prototype.clear
226+
* @description 释放图层资源
227+
*/
228+
clear() {
229+
this.removeGraphics();
230+
}
231+
224232
/**
225233
* @function mapboxgl.supermap.GraphicLayer.prototype.removeGraphics
226234
* @description 移除所有要素

src/openlayers/overlay/Graphic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Graphic extends ol.source.ImageCanvas {
3434
resolutions: options.resolutions,
3535
state: options.state
3636
});
37-
this.graphics_ = options.graphics;
37+
this.graphics_ = [].concat(options.graphics);
3838
this.map = options.map;
3939
this.highLightStyle = options.highLightStyle;
4040
//是否支持高亮,默认支持
@@ -196,7 +196,7 @@ export class Graphic extends ol.source.ImageCanvas {
196196

197197
/**
198198
* @function ol.source.Graphic.prototype.clear
199-
* @description 清除所有要素
199+
* @description 释放图层资源
200200
*/
201201
clear() {
202202
this.removeGraphics();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy