• Ajax
  • Ant design
  • Axios-Fetch
  • Avue
  • Browser
  • Canvas
  • CSS
  • Dos-bat
  • Dva
  • Dedecms
  • Echart
  • ElementUI
  • Editors
  • Git
  • GeoServer
  • GIS
  • H5
  • Jquery
  • Java安卓
  • Json
  • Javascript
  • Leaflet
  • Linux
  • Life-Info
  • Mock
  • MongoDB
  • Network
  • NodeJS
  • NPM
  • React
  • 设计运营
  • SEO
  • SVG
  • TypeScript
  • Tools
  • umi
  • uni-APP
  • Vant
  • Vue
  • Windows
  • webpack
  • 位置:OC中文网 > Cesium >

    Cesium设置面Entity高亮显示

    来源:直接复制网 时间:12-13

     cesium怎么设置entity高亮呢? 以下是方法:

    参数描述:

    • id: Entity实体id
    • heightEntity:高亮结果Entity
    • defaultLayer和tempLayer均是DataSource的集合

    代码

    1. let heightEntity = null
    2. HighlightPolygonEntity(id) { 
    3.     if (heightEntity) { 
    4.       defaultLayer.entities.remove(heightEntity); 
    5.     } 
    6.     if (!id) { 
    7.       return
    8.     } 
    9.     let e = tempLayer.entities.getById(id); 
    10.     heightEntity = defaultLayer.entities.add({ 
    11.       polyline: { 
    12.         positions: e.polygon.hierarchy.getValue().positions, 
    13.         width: 10, 
    14.         material: new Cesium.PolylineGlowMaterialProperty({ 
    15.           glowPower: 0.5, // 一个数字属性,指定发光强度,占总线宽的百分比。 
    16.           color: Cesium.Color.ORANGERED, 
    17.         }), 
    18.         clampToGround: true
    19.       }, 
    20.     }); 
    21.     window.viewer.dataSources.raiseToTop(defaultLayer);//设置defaultLayer置顶 
    22.   } 

    使用方法

    • 高亮:HighlightPolygonEntity("id")
    • 取消高亮:HighlightPolygonEntity(null)