Skip to content

创建墙体

  • 支持独立事件绑定

例:

typescript
 const wall = _3umap.createWall({
          positions: [
            [104.07263175401185, 30.647622150198725, 500],
            [104.06369117158526, 30.648834374000277, 500.0],
            [104.06437182811021, 30.62274533905387, 500.0],
            [104.07463538167119, 30.62285687644371, 500.0],
            [104.07263175401185, 30.647622150198725, 500.0]
          ],
          far: Infinity
        })

配置参数

typescript
 type CreateWall = {
  /**
   *@description 创建墙体
   *@param options
   *@param options.show 显示消失
   *@param options.material 材质
   *@param options.fill 是否填充
   *@param options.outline 是否显示轮廓线
   *@param options.outlineWidth 线宽
   *@param options.outlineColor 线颜色
   *@param options.shadows 阴影
   *@param options.near 近距离
   *@param options.far 远距离
   *@param options.maxHeight 最大高度
   *@param options.minHeight 最小高度
   *@param options.positions 经纬度坐标数组或者经纬度高程坐标数组
   *@param options.viewFrom 设置相机观察Entity的位置
   *@param options.parent 设置父级Entity建立组织关系
   *@param options.property 挂载的属性
   *@param options.entityCollection 集合对象
   *@param options.label 标签选项
   *@param options.label.show 显示消失
   *@param options.label.text 文字内容
   *@param options.label.position 位置坐标
   *@param options.label.fontColor 文字颜色
   *@param options.label.fontSize 字体大小
   *@param options.label.fillColor 背景填充颜色
   *@param options.label.showBackground 是否显示背景
   *@param options.label.padding 内边距
   *@param options.label.style 填充样式
   *@param options.label.outlineWidth 描边大小
   *@param options.label.outlineColor 描边颜色
   *@param options.label.verticalOrigin 垂直对齐方式
   *@param options.label.horizontalOrigin 水平对齐方式
   *@param options.label.offset 偏移量
   *@param options.label.near 近距离
   *@param options.label.far 远距离
   *@param options.label.nearScale 近距离缩放
   *@param options.label.farScale 远距离缩放
   *@param options.label.absolute 是否绝对定位
   *@param globeID 地球ID
   *@return void
   */
  (options: WallOptions, globeID?: string): Wall;
};

提示

maxHeight minHeight 配置时如果传递的数组,数量要和坐标数量一致,否则报错

内置材质

颜色材质

typescript
const wall = _3umap.createWall({
          positions: [
            [104.07263175401185, 30.647622150198725, 500],
            [104.06369117158526, 30.648834374000277, 500.0],
            [104.06437182811021, 30.62274533905387, 500.0],
            [104.07463538167119, 30.62285687644371, 500.0],
            [104.07263175401185, 30.647622150198725, 500.0]
          ],
    	  material: MaterialMap.color({ color: Color.random() }) 
          far: Infinity
        })

image-20240618173901381

闪烁材质

typescript
const wall = _3umap.createWall({
          positions: [
            [104.07263175401185, 30.647622150198725, 500],
            [104.06369117158526, 30.648834374000277, 500.0],
            [104.06437182811021, 30.62274533905387, 500.0],
            [104.07463538167119, 30.62285687644371, 500.0],
            [104.07263175401185, 30.647622150198725, 500.0]
          ],
    	  material: MaterialMap.flashing({ color: Color.random(), speed:0.001, isDynamic:true }) 
          far: Infinity
        })

image-20240618174115506

图片材质

typescript
const wall = _3umap.createWall({
          positions: [
            [104.07263175401185, 30.647622150198725, 500],
            [104.06369117158526, 30.648834374000277, 500.0],
            [104.06437182811021, 30.62274533905387, 500.0],
            [104.07463538167119, 30.62285687644371, 500.0],
            [104.07263175401185, 30.647622150198725, 500.0]
          ],
    	  material: MaterialMap.image({ img:'./point.png'}) 
          far: Infinity
        })

image-20240618174227430

循环流动材质

typescript
const wall = _3umap.createWall({
          positions: [
            [104.07263175401185, 30.647622150198725, 500],
            [104.06369117158526, 30.648834374000277, 500.0],
            [104.06437182811021, 30.62274533905387, 500.0],
            [104.07463538167119, 30.62285687644371, 500.0],
            [104.07263175401185, 30.647622150198725, 500.0]
          ],
    	  material: MaterialMap.textureScroll({  
              img:assetsPath.textures.b2.path, 
              direction: '+', 
              orientation: 'vertical', 
              speed: 1.0, 
              count: 2
          }) 
          far: Infinity
        })

image-20240618174423831

配置