MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / _addDataflowLayer

Method _addDataflowLayer

src/common/mapping/WebMapV2.js:1184–1243  ·  view source on GitHub ↗
(layerInfo, feature)

Source from the content-addressed store, hash-verified

1182 }
1183
1184 async _addDataflowLayer(layerInfo, feature) {
1185 const layerID = layerInfo.layerID;
1186 if (layerInfo.layerType === 'DATAFLOW_HEAT') {
1187 if (!this.map.getSource(layerID)) {
1188 this._createHeatLayer(layerInfo, [feature], false);
1189 } else {
1190 this._updateDataFlowFeature(layerID, feature, layerInfo);
1191 }
1192 } else {
1193 const layerStyle = layerInfo.pointStyle;
1194 layerInfo.style = layerStyle;
1195 if (!this.map.getSource(layerID)) {
1196 const iconRotateExpression = this._getDataFlowRotateStyle(
1197 [feature],
1198 layerInfo.directionField,
1199 layerInfo.identifyField
1200 );
1201 if (['BASIC_POINT', 'SVG_POINT', 'IMAGE_POINT'].includes(layerStyle.type)) {
1202 await this._createGraphicLayer(layerInfo, [feature], null, iconRotateExpression, false);
1203 } else {
1204 this._createSymbolLayer(layerInfo, [feature], null, iconRotateExpression, false);
1205 }
1206 } else {
1207 this._updateDataFlowFeature(layerID, feature, layerInfo, 'point');
1208 }
1209 if (layerInfo.labelStyle && layerInfo.visible) {
1210 const labelSymbolLayerId = this._getSymbolLabelLayerName(layerID);
1211 if (!this.map.getSource(labelSymbolLayerId)) {
1212 this._addLabelLayer(layerInfo, [feature], true);
1213 } else {
1214 this._updateDataFlowFeature(labelSymbolLayerId, feature, layerInfo);
1215 }
1216 }
1217 if (layerInfo.lineStyle && layerInfo.visible) {
1218 if (!this.map.getSource(layerID + '-line')) {
1219 const geometry = feature.geometry.coordinates;
1220 const lineFeature = {
1221 type: 'Feature',
1222 properties: feature.properties,
1223 geometry: {
1224 type: 'LineString',
1225 coordinates: [geometry]
1226 }
1227 };
1228 this._createVectorLayer(
1229 {
1230 style: layerInfo.lineStyle,
1231 featureType: 'LINE',
1232 visible: 'visible',
1233 layerID: layerID + '-line',
1234 parentLayerId: layerID
1235 },
1236 [lineFeature]
1237 );
1238 } else {
1239 this._updateDataFlowFeature(layerID + '-line', feature, layerInfo, 'line');
1240 }
1241 }

Callers 1

Calls 9

_createHeatLayerMethod · 0.95
_createGraphicLayerMethod · 0.95
_createSymbolLayerMethod · 0.95
_addLabelLayerMethod · 0.95
_createVectorLayerMethod · 0.95
getSourceMethod · 0.45

Tested by

no test coverage detected