JSAPI Three API Reference
    正在准备搜索索引...

    墙体网格对象,用于在地图上创建无厚度的墙体效果。支持自定义高度、颜色、纹理和动画效果。

    // 创建一个基础墙体
    const wall = engine.add(new mapvthree.Wall({
    height: 200,
    color: '#00ffff',
    opacity: 0.8
    }));

    // 设置数据源
    const data = mapvthree.GeoJSONDataSource.fromGeoJSON([{
    type: 'Feature',
    geometry: {
    type: 'LineString',
    coordinates: [[116.404, 39.915], [116.405, 39.920]]
    }
    }]);
    wall.dataSource = data;

    // 添加动画效果
    wall.enableAnimation = true;
    wall.animationTailType = 3;
    wall.animationSpeed = 1;

    层级

    • GeoMesh
      • Wall
    索引

    构造函数

    • 构造函数

      参数

      • parameters: {
            animationBales?: number;
            animationIdle?: number;
            animationRatio?: number;
            animationSpeed?: number;
            animationTailLength?: number;
            animationTailRatio?: number;
            animationTailType?: number;
            color?: string;
            enableAnimation?: boolean;
            height?: number;
            map?: string;
            mapScale?: number | number[];
            maxOpacity?: number;
            minOpacity?: number;
            opacity?: number;
            vertexColors?: boolean;
        }

        配置参数

        • 可选animationBales?: number

          条纹上升动画显示组数,值大于等于1,仅在animationTailType=4.0时生效, 默认5

        • 可选animationIdle?: number

          拖尾动画间隔时间, 默认1000

        • 可选animationRatio?: number

          条纹上升动画一组实虚线中实线所占比,范围0-1之间,仅在animationTailType=4.0时生效, 默认0.5

        • 可选animationSpeed?: number

          动画速度, 默认1

        • 可选animationTailLength?: number

          拖尾动画真实长度, 默认100

        • 可选animationTailRatio?: number

          拖尾动画长度比例, 默认0.2

        • 可选animationTailType?: number

          动画类型, 默认3

        • 可选color?: string

          墙的颜色, 默认#00ffff

        • 可选enableAnimation?: boolean

          是否开启墙动画, 默认false

        • 可选height?: number

          墙的高度, 默认100

        • 可选map?: string

          纹理贴图的路径

        • 可选mapScale?: number | number[]

          纹理贴图的缩放系数, 默认1

        • 可选maxOpacity?: number

          墙的最高透明度, 默认1

        • 可选minOpacity?: number

          墙的最低透明度, 默认0

        • 可选opacity?: number

          墙的整体透明系数, 默认1

        • 可选vertexColors?: boolean

          是否通过数据携带颜色配置, 默认false

      返回 Wall

    属性

    animationBales: number

    条纹上升动画显示组数

    5
    
    wall.animationBales = 3;
    
    animationIdle: number

    拖尾动画间隔时间,单位:毫秒

    1000
    
    wall.animationIdle = 2000;
    
    animationRatio: number

    条纹上升动画一组实虚线中实线所占比

    0.5
    
    wall.animationRatio = 0.7;
    
    animationSpeed: number

    动画速度

    1
    
    wall.animationSpeed = 2;
    
    animationTailLength: number

    拖尾动画真实长度

    100
    
    wall.animationTailLength = 200;
    
    animationTailRatio: number

    拖尾动画长度比例

    0.2
    
    wall.animationTailRatio = 0.3;
    
    animationTailType: 1 | 2 | 3 | 4

    动画类型

    • 1: 按墙长度比例,需设置animationTailRatio属性
    • 2: 按固定长度,需设置animationTailLength属性
    • 3: 垂直方向动画
    • 4: 条纹上升动画
    3
    
    // 设置为垂直方向动画
    wall.animationTailType = 3;
    color: string

    墙的颜色

    '#00ffff'
    
    wall.color = '#ff0000';
    
    enableAnimation: boolean

    是否开启墙动画

    false
    
    wall.enableAnimation = true;
    
    height: number

    墙的高度

    100
    
    wall.height = 200;
    
    isGeoObject: true

    类型为GeoObject的标识

    isMesh: true

    类型为Mesh的标识

    map: string

    纹理贴图的路径

    null
    
    wall.map = 'path/to/texture.png';
    
    maxOpacity: number

    墙的最高透明度

    1
    
    wall.maxOpacity = 0.9;
    
    minOpacity: number

    墙的最低透明度

    0
    
    wall.minOpacity = 0.2;
    
    opacity: number

    墙的整体透明系数

    1
    
    wall.opacity = 0.8;
    
    vertexColors: boolean

    是否通过数据携带颜色配置

    false
    
    wall.vertexColors = true;
    

    方法

    • 添加属性重命名

      参数

      • key: string

        原始属性名,该组件的属性名

      • value: string

        重命名后的属性名,数据源的属性名

      返回 void

    • 清空属性重命名

      返回 void

    • 销毁object上的geometry和material实例,释放资源, 调用engine.remove(object)会自动销毁资源,不需要手动调用

      返回 void

    • 移除属性重命名

      参数

      • key: string

        原始属性名

      返回 void

    访问器

    • get dataSource(): DataSource

      object连接的数据源[[DataSource]]类

      返回 DataSource

    • set dataSource(dataSource: DataSource): void

      设置object的数据源

      参数

      • dataSource: DataSource

        数据源

      返回 void

    • get needsUpdate(): boolean

      是否需要更新

      返回 boolean

    • set needsUpdate(value: boolean): void

      设置object是否在下一帧更新

      参数

      • value: boolean

        设置为true,则下一帧渲染前更新该object

      返回 void