Skip to content

创建MapEntity

  • 包装处理 ,自己创建的Entity 对象融入SDK使用
  • 支持独立事件绑定
typescript
// 1. 使用cesium 创建Entity
const entity = new Cesium.Entity({
  position: Cesium.Cartesian3.fromDegrees(117, 35),
  ellipse: {
    semiMajorAxis: new Cesium.CallbackProperty(() => 100, false),
    semiMinorAxis: new Cesium.CallbackProperty(() => 100, false),
    material: Cesium.Color.WHITE,
    outline: true,
    fill: true,
    outlineColor: Cesium.Color.CHOCOLATE,
    outlineWidth: 20,
    heightReference: Cesium.HeightReference.NONE
  },
  label: { text: 'adfsadf' },
  billboard: {
    show: true,
    image: './assets/img/point.png',
    height: 32,
    width: 32,
    height: 32,
    scale: 1
  }
})
// 2. 使用SDK提供的方法创建Entity
const entity =  createEntity(options)

const mapEntity = new MapEntity({ 
    entity, 
    property: {} //要添加的属性
    entityCollection:   //要添加的目标集合对象
}) 

配置