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

Method _addBaselayer

src/common/mapping/WebMapV2.js:2610–2656  ·  view source on GitHub ↗
({
      url,
      layerID,
      parentLayerId,
      visibility = true,
      minzoom = 0,
      maxzoom,
      isIserver = false,
      tileSize = 256,
      bounds
    })

Source from the content-addressed store, hash-verified

2608 }
2609
2610 _addBaselayer({
2611 url,
2612 layerID,
2613 parentLayerId,
2614 visibility = true,
2615 minzoom = 0,
2616 maxzoom,
2617 isIserver = false,
2618 tileSize = 256,
2619 bounds
2620 }) {
2621 const source = {
2622 type: 'raster',
2623 tiles: url,
2624 minzoom: minzoom || 0,
2625 maxzoom: maxzoom || this.map.getMaxZoom() + 1,
2626 tileSize: isIserver ? this.rasterTileSize : tileSize,
2627 rasterSource: isIserver ? 'iserver' : '',
2628 prjCoordSys:
2629 isIserver && !this.isOnlineBaseLayer(url[0], this.baseProjection) && +this.baseProjection.split(':')[1] > 0
2630 ? { epsgCode: this.baseProjection.split(':')[1] }
2631 : '',
2632 proxy: this.baseLayerProxy
2633 };
2634 if (bounds) {
2635 source.bounds = bounds;
2636 }
2637 let sourceId = source;
2638 if (this.map.getSource(layerID) && (!this.map.getLayer(layerID) || !this.checkSameLayer || !this._isSameRasterLayer(layerID, source))) {
2639 sourceId = `${layerID}_${+new Date()}`;
2640 this.map.addSource(sourceId, source);
2641 }
2642 this._addLayer(
2643 {
2644 id: layerID,
2645 type: 'raster',
2646 source: sourceId,
2647 minzoom: minzoom || 0,
2648 maxzoom: maxzoom || this.map.getMaxZoom() + 1,
2649 layout: {
2650 visibility: this._getVisibility(visibility)
2651 }
2652 },
2653 parentLayerId
2654 );
2655 this.baseLayerProxy = null;
2656 }
2657
2658 /**
2659 * @private

Callers 7

_createTiandituLayerMethod · 0.95
_createWMTSLayerMethod · 0.95
_createBingLayerMethod · 0.95
_createXYZLayerMethod · 0.95
_createZXYLayerMethod · 0.95
_createWMSLayerMethod · 0.95

Calls 8

isOnlineBaseLayerMethod · 0.95
_isSameRasterLayerMethod · 0.95
_addLayerMethod · 0.95
_getVisibilityMethod · 0.95
addSourceMethod · 0.80
getMaxZoomMethod · 0.45
getSourceMethod · 0.45
getLayerMethod · 0.45

Tested by

no test coverage detected