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

Method _initOverlayLayers

src/common/mapping/WebMapV2.js:524–570  ·  view source on GitHub ↗
(layers, _taskID)

Source from the content-addressed store, hash-verified

522 }
523
524 _initOverlayLayers(layers, _taskID) {
525 // 存储地图上所有的图层对象
526 if (this.expectLayerLen > 0) {
527 layers.forEach((layer) => {
528 const type = this.webMapService.getDatasourceType(layer);
529 // TODO --- 暂不支持 SAMPLE_DATA
530 if (type === 'SAMPLE_DATA') {
531 this._addLayerSucceeded();
532 this.fire('layercreatefailed', {
533 error: 'SAMPLE DATA is not supported',
534 layer,
535 map: this.map
536 });
537 return;
538 }
539
540 if (layer.visibleScale) {
541 const { minScale, maxScale } = layer.visibleScale;
542 const crs = this.map.getCRS();
543 layer.minzoom = Math.max(this._transformScaleToZoom(minScale, crs, layer.tileSize), 0);
544 layer.maxzoom = Math.min(this.map.getMaxZoom()+1, this._transformScaleToZoom(maxScale, crs, layer.tileSize) + 0.0000001);
545 }
546
547 if (type === 'tile') {
548 if (layer.autoUpdateTime) {
549 this._layerTimerList.push(
550 setInterval(() => {
551 this._initBaseLayer(layer);
552 }, layer.autoUpdateTime)
553 );
554 }
555 this._initBaseLayer(layer, () => {
556 this._addLayerSucceeded();
557 });
558 } else {
559 this.getLayerFeatures(layer, _taskID, type);
560 if (layer.autoUpdateTime) {
561 this._layerTimerList.push(
562 setInterval(() => {
563 this.getLayerFeatures(layer, _taskID, type);
564 }, layer.autoUpdateTime)
565 );
566 }
567 }
568 }, this);
569 }
570 }
571
572 _initOverlayLayer(layerInfo, features = [], mergeByField, featureProjection) {
573 const { layerID, layerType, visible, style, featureType, projection } = layerInfo;

Callers 1

_handleLayerInfoMethod · 0.95

Calls 12

_addLayerSucceededMethod · 0.95
_transformScaleToZoomMethod · 0.95
_initBaseLayerMethod · 0.95
forEachMethod · 0.80
getDatasourceTypeMethod · 0.80
maxMethod · 0.80
minMethod · 0.80
pushMethod · 0.80
fireMethod · 0.45
getCRSMethod · 0.45
getMaxZoomMethod · 0.45
getLayerFeaturesMethod · 0.45

Tested by

no test coverage detected