# new MeasureSlopeTool(viewer, options)
坡度测量
参数:
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
viewer |
Object | 视图 |
|
options |
Object | 包含以下属性的对象 |
|
callBack |
Boolean | function(result, positions){} | 回调函数 |
labelCallBack |
Boolean | function(result, label){} | 测量完毕后提示框的回调函数,可以覆盖提示内容 |
disableDepthTestDistance |
Number | Number.POSITIVE_INFINITY | 只要小于这个距离深度检测就会失效,就会一直显示在最前面 不会被遮挡 |
lineColor |
Cesium.Color | 线段颜色 |
|
pointColor |
Cesium.Color | 点颜色 |
|
style |
Cesium.LabelStyle | Cesium.LabelStyle.FILL | label 文字的样式,支持填充、线框。填充和线框, FILL, OUTLINE, FILL_AND_OUTLINE |
font |
String | '12pt 楷体' | label 的字体以及大小 @see https://html.spec.whatwg.org/multipage/canvas.html#text-styles |
fillColor |
Cesium.Color | Cesium.Color.WHITE | label 的字体颜色 |
outlineColor |
Cesium.Color | Cesium.Color.WHITE | label 文字线框的颜色 |
outlineWidth |
Number | 4.0 | label 的外轮廓边线 |
verticalOrigin |
Cesium.VerticalOrigin | Cesium.VerticalOrigin.BOTTOM | label 的摆放位置 |
showBackground |
Boolean | true | 是否显示 label 的背景 |
backgroundColor |
Cesium.Color | new Cesium.Color(0, 0, 0, 0.4) | lable 背景的颜色 |
pixelOffset |
Cesium.Cartesian2 | new Cesium.Cartesian2(0, -4) | label 相对于设定点的偏移位置 |
示例
// ES5引入方式
const { MeasureSlopeTool } = zondy.cesium
// ES6引入方式
import { MeasureSlopeTool } from "@mapgis/webclient-cesium-plugin"
function callBack(arg){ }
var MeasureSlopeTool = new MeasureSlopeTool(viewer,{callBack:callBack});
MeasureSlopeTool.startTool(); //开始测量
//MeasureSlopeTool.stopTool(); //结束测量