MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / add

Method add

src/mapboxgl/mapping/GeojsonSource.js:30–55  ·  view source on GitHub ↗

* @function GeojsonSource.prototype.add * @description 添加数据源。 * @param {string} id - 数据源 Id。 * @param {Object} source

(id, source)

Source from the content-addressed store, hash-verified

28 * @param {Object} source
29 */
30 add(id, source) {
31 if (this.map.getSource(id)) {
32 return;
33 }
34 const newData = cloneDeep(source.data);
35 featureEach(newData, (currentFeature) => {
36 coordEach(currentFeature, (curCoords) => {
37 let transCurCoords = proj4('EPSG:4326', 'EPSG:3857', curCoords);
38 let transCoords = this.coordTransfer.toVideoCoordinate(transCurCoords);
39 curCoords.length = 0;
40 curCoords.push(
41 ...transformCoord({
42 videoPoint: transCoords.data64F,
43 videoWidth: this.videoWidth,
44 videoHeight: this.videoHeight,
45 originCoordsRightBottom: this.originCoordsRightBottom,
46 originCoordsLeftTop: this.originCoordsLeftTop
47 })
48 );
49 });
50 });
51
52 source.data = newData;
53
54 this.map.addSource(id, source);
55 }
56 /**
57 * @function GeojsonSource.prototype.remove
58 * @description 移除数据源。

Callers 3

addSourceMethod · 0.95
_addVideoLayerMethod · 0.45
getLabelPxLocationMethod · 0.45

Calls 5

transformCoordFunction · 0.90
toVideoCoordinateMethod · 0.80
pushMethod · 0.80
addSourceMethod · 0.80
getSourceMethod · 0.45

Tested by

no test coverage detected