zoukankan      html  css  js  c++  java
  • 掩膜要素

    想清楚思路很有必要!需要一个空的数组来存放准备掩膜的要素ID

    var map = new WebScene({

      portalItem:{id:"10ede348e4c54c77b45f6ebab2d018db"}

    });

    var view = new SceneView({

      container:"viewDiv",

      map:map

    });

    map.when(function(){

      var scenelayer = map.layers.find(function(l){return l.title === "Buildings"});  //获取房屋图层

      var hidebuild = [];  //新建一个空的数组用于存放掩膜房屋的ID

      view.on("click",function(){

        view.hitTest(event).then(function(response){

          var graphic = response.results[0].graphic;

          if(graphic && graphic.layer.title === "Buildings"){

            hidebuild.push(graphic.attributes.OBJECTID);

            scenelayer.definitionExpression = "OBJECTID NOT IN ("+hidebuild.join(",")+")";

          }

        })

      });

      document.getElementById("clear").addEventListener("click",function(){

        hidebuild = [];

        scenelayer.definitionExpression = "";

      })

    })

  • 相关阅读:
    Remove Element
    Binary Tree Inorder Traversal
    Symmetric Tree
    Roman to Integer
    Search Insert Position
    Reverse Integer
    Pascal's Triangle
    Merge Sorted Array
    Same Tree
    Visual Studio Code 做PHP开发
  • 原文地址:https://www.cnblogs.com/GIS-Yangol/p/10418358.html
Copyright © 2011-2022 走看看