1. GridLayer

Extends: Layer

1.1. 初始化 new GridLayer(options)

空间网格图层(根据包围盒顶点生成空间网格)

Param Type Default Description
options Object
options.name String

必填,图层名称;

[options.show] Boolean false

是否显示;

[options.customGroupId] String

若使用自定义分组,该图层所在分组

Example

var geomap = new BOSGeo.GeoMap('container');
const gridLayer = geomap.layerManager.createLayer(
    BOSGeo.LayerType.GRID,
    '空间网格',
    {
        customGroupId: 'Point1',
    }
);

1.2. 方法

1.2.1. gridLayer.add(options) ⇒ String

添加单个网格

Kind : instance method of GridLayer

Returns : String -

primitiveId 网格图元id

Param Type Default Description
options Object
options.positions Array.<(Cartesian3或Array.<Number>)>

网格顶点坐标(笛卡尔坐标数组或经纬度与高程坐标数组,坐标点个数至少为3, 建议依次输入8个顶点坐标)

[options.fillColor] Color BOSGeo.Color.RED.withAlpha(0.5)

网格填充颜色

[options.outlineColor] Color BOSGeo.Color.RED

网格轮廓线颜色

[options.style] GeometryStyle BOSGeo.GeometryStyle.FILL_AND_OUTLINE

网格样式,默认为填充和轮廓

[options.depthTestEnabled] Boolean true

是否开启深度测试(true则不采用深度测试失败材质)

Example

var positions = [
    [113.10789465893555, 23.028055100830077, 10],
    [113.10801704785156, 23.028055100830077, 10],
    [113.10801704785156, 23.028168772338866, 10],
    [113.10789465893555, 23.028168772338866, 10],
    [113.10789465893555, 23.028055100830077, 21.639962500000024],
    [113.10801704785156, 23.028055100830077, 21.639962500000024],
    [113.10801704785156, 23.028168772338866, 21.639962500000024],
    [113.10789465893555, 23.028168772338866, 21.639962500000024],
];
var gridId = gridLayer.add(
    {positions}
);
gridLayer.flyToGrid(gridId);

1.2.2. gridLayer.addInBatch(options) ⇒ String

批量添加网格

Returns : String -

primitiveId 网格图元id

Param Type Default Description
options Object
options.grids Array.<Array.<(Cartesian3或Array.<Number>)>>

多个网格顶点坐标(每个网格由笛卡尔坐标数组或经纬度与高程坐标数组组成,坐标点个数至少为3, 建议依次输入8个顶点坐标)

[options.fillColor] Color BOSGeo.Color.RED.withAlpha(0.5)

网格填充颜色

[options.outlineColor] Color BOSGeo.Color.YEELLOW

网格轮廓线颜色

[options.style] GeometryStyle BOSGeo.GeometryStyle.FILL_AND_OUTLINE

网格样式,默认为填充和轮廓

[options.depthTestEnabled] Boolean true

是否开启深度测试(true则不采用深度测试失败材质)

1.2.3. gridLayer.updateGridStyle(primitiveId, options) ⇒ Boolean

更新网格样式

Returns : Boolean -

是否更新成功

Param Type Description
primitiveId String

网格图元id(在添加时返回)

options Object

修改的样式

options.fillColor Colorundefined

填充颜色

options.outlineColor Colorundefined

轮廓颜色

options.style GeometryStyleundefined

网格类型

Example

gridLayer.updateGridStyle(gridId, {style: BOSGeo.GeometryStyle.OUTLINE});

1.2.4. gridLayer.updateGridDepthTest(primitiveId, [latestDepthTestEnabled]) ⇒ Boolean

更新网格深度测试失败材质属性

Returns : Boolean -

是否更新成功

Param Type Default Description
primitiveId String

网格图元id(在添加时返回)

[latestDepthTestEnabled] Boolean true

是否开启深度测试(true则不采用深度测试失败材质)

Example

gridLayer.updateGridDepthTest(gridId, false);

1.2.5. gridLayer.flyToGrid(primitiveId, options)

定位到指定图元id的网格

See : add

Param Type Description
primitiveId String

网格图元id

options Object

定位的设置参数

[options.offset] HeadingPitchRange

基于要素对象包围球中心的偏移

options.callback function

定位后的回调函数

1.2.6. gridLayer.zoomToLayer(callback)

缩放至本图层

Param Type Description
callback function

回调函数

Example

gridLayer.zoomToLayer();

1.2.7. gridLayer.remove(primitiveId) ⇒ Boolean

移除单个空间网格

Returns : Boolean -

是否移除成功, false表示不存在当前id的网格或移除失败

Param Type Description
primitiveId String

网格唯一编码

Example

gridLayer.remove(gridId);

1.2.8. gridLayer.removeAll()

移除所有网格

Example

gridLayer.removeAll();

1.2.9. gridLayer.destroy()

销毁图层

版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-07-19 11:34:25

results matching ""

    No results matching ""