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

    类 SimplePoint

    点对象,用于在地图上绘制基础的点标记。支持自定义颜色、大小等特性。

    // 创建一个基础点对象
    const point = engine.add(new mapvthree.SimplePoint({
    color: 'rgba(250, 90, 50, 1)',
    size: 50,
    opacity: 0.8,
    vertexColors: true,
    vertexSizes: true,
    }));

    // 设置数据源
    const data = mapvthree.GeoJSONDataSource.fromGeoJSON([{
    type: 'Feature',
    geometry: {
    type: 'Point',
    coordinates: [116.404, 39.915]
    },
    properties: {
    color: '#ff0000',
    size: 30
    }
    }]);

    // 定义color和size属性映射
    data.defineAttribute('color', 'color');
    data.defineAttribute('size', 'size');
    point.dataSource = data;

    层级

    • GeoPoints
      • SimplePoint
    索引

    构造函数

    • 构造函数

      参数

      • parameters: {
            clampToGround?: boolean;
            color?: any;
            groundTargets?: any[];
            opacity?: number;
            size?: number;
            transparent?: boolean;
            vertexColors?: boolean;
            vertexSizes?: boolean;
        }

        配置参数

        • 可选clampToGround?: boolean

          锚点贴合三维实体表面,保留自身朝向

        • 可选color?: any

          点颜色,默认0xffff00

        • 可选groundTargets?: any[]

          接收对象根节点;省略时自动发现,空数组表示不接收

        • 可选opacity?: number

          透明度,默认1

        • 可选size?: number

          点大小,默认30

        • 可选transparent?: boolean

          是否启用透明,默认false

        • 可选vertexColors?: boolean

          是否启用数据驱动的颜色配置,默认false

        • 可选vertexSizes?: boolean

          是否启用数据驱动的大小配置,默认false

      返回 SimplePoint

    属性

    color: string

    点颜色

    point.color = 'rgba(250, 90, 50, 1)';
    
    isGeoObject: true

    类型为GeoObject的标识

    isPoints: true

    类型为Points的标识

    opacity: number

    不透明度, 若想实现半透明效果, 需要transparent设置为true

    1
    
    point.opacity = 0.8;
    
    size: number

    点大小

    point.size = 50;
    
    strokeColor: string | any[]

    描边颜色(仅圆形形态生效)

    '#000000'
    
    point.strokeColor = '#1a73e8';
    
    strokeWidth: number

    描边宽度(像素)。0 表示不描边。仅圆形形态生效。

    0
    
    point.strokeWidth = 2;
    
    vertexColors: boolean

    是否启用数据驱动的颜色配置

    false
    
    point.vertexColors = true;
    
    vertexSizes: boolean

    是否启用数据驱动的大小配置

    false
    
    point.vertexSizes = true;
    

    方法

    • 添加属性重命名

      参数

      • key: string

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

      • value: string

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

      返回 void

    • 清空属性重命名

      返回 void

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

      返回 void

    • 视锥剔除测试。

      见 GeoMesh.intersectsFrustum 的说明:three r18x 起剔除改由物体自身实现, 本类只打了 isPoints 标记、不继承 three 的 Points,必须自己实现,否则新版 three 下永不渲染。

      参数

      • frustum: Frustum

        视锥

      返回 boolean

      是否与视锥相交

    • 移除属性重命名

      参数

      • key: string

        原始属性名

      返回 void

    访问器

    • get clampToGround(): boolean

      Only move the anchor; flat, rotation and pixel offsets keep their original semantics.

      返回 boolean

    • get dataSource(): DataSource

      对象连接的 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