當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


JavaScript ArcGIS Sublayer.sublayers用法及代碼示例


基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/layers/support/Sublayer"], (Sublayer) => { /* code goes here */ });

ESM: import Sublayer from "@arcgis/core/layers/support/Sublayer";

類: esri/layers/support/Sublayer

繼承: Sublayer > Accessor

自從:用於 JavaScript 4.1 的 ArcGIS API

用法說明

Sublayer.sublayers函數(或屬性)的定義如下:

sublayers Collection<Sublayer>


如果子層包含子層,則此屬性是屬於具有子層的給定子層的Sublayer 個對象的Collection

例子:

// test function for determining if a MapImageLayer's sublayers
// contain at least one dynamic data layer
function hasDynamicDataLayer (layer){
  if (layer.sublayers && layer.sublayers.sublayers){
    return layer.sublayers.sublayers.some(function(sublayer){
      return sublayer.source.type === "data-layer";
    });
  } else {
    console.log("layer does not have sublayers or nested sublayers");
    return false;
  }
}

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 Sublayer.sublayers。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。