类名 TerrainProfile

# new TerrainProfile(viewer, optionsopt)

参数:

名称 类型 默认值 描述
viewer Viewer

场景视图对象

options Object

包含以下属性的对象

echart Object

echart图表对象,如果resultShowType设置为1和2,则这个值必须传入

polygonColor Cesium.Color Cesium.Color.BLUE.withAlpha(0.5)

垂直面颜色

polygonHeight Number 50

垂直面高度,相较于最大地形高程

polyLineColor Cesium.Color Cesium.Color.RED.withAlpha(1)

垂直线颜色

polylineGroundColor Cesium.Color Cesium.Color.RED.withAlpha(1)

贴地线颜色

pointColor Cesium.Color Cesium.Color.RED.withAlpha(1)

贴地点颜色

samplePrecision Number 1

采样精度

showPolygon Boolean true

是否显示垂直面

profileType Number 0

分析类型.0代表地形,1代表地形和模型兼容

sampleLever Number 0

地形采样级别.0代表采最精细级别,1-20为自定义采样级别,数值越大,越精细

sampleSceneMostDetail Boolean false

是否对场景进行最精细的高程采样,默认为false,仅对当前场景深度进行采样,当值为true时,要求采样区域的模型缓存的叶子结点的数据不能全为空

resultShowType Number 2

结果展示形式.0代表仅场景中展示结果(直接在地形上绘制结果),1表示仅echart图表中展示结果,2表示场景和图表都展示结果

positions Array

可选,Cartesian3数组,需要分析的坐标点集,数组内至少要有两个点.如果未传入positions,则接口内部调用绘制的接口,进行绘制获取点集

示例
// ES5引入方式
const { TerrainProfile } = zondy.cesium
// ES6引入方式
import { TerrainProfile } from "@mapgis/webclient-cesium-plugin"

const webGlobe = new Cesium.WebSceneControl('cesiumContainer', {});
const viewer = webGlobe.viewer;
const terrainProfile
if(!Cesium.defined(terrainProfile)){
  terrainProfile = new TerrainProfile(viewer,{polygonColor:Cesium.Color.RED.withAlpha(0.5),polygonHeight:0,polyLineColor:Cesium.Color.BLUE.withAlpha(1)});
}
  terrainProfile.profile();
}

方法

# destroy()

结束剖面分析,清除场景对象

# profile(callback)

开启地形剖切功能接口,左键画线,右键停止

参数:

名称 类型 描述
callback function

执行成功返回回调函数

# stopDrawing()

停止绘制 解决绘制一半后需要停止绘制问题 wanghan 20231010

构造函数
成员变量
方法
事件