画笔模块
Parameters:
Name | Type | Description |
---|---|---|
params |
object
|
|
viewer |
object
|
cesium 实例 |
cesiumGlobal |
object
|
cesium 全局对象 |
defaultStatic |
Array
|
静态资源 |
Extends
Methods
# drawCircleGraphics(options)
画圆
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
boolean
|
图形风格配置 |
height |
number
|
拉伸高度 |
callback |
function
|
回调函数 |
- See:
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawCircleGraphics({
height:300,
style:{
width: 3,
material: Cesium.Color.BLUE.withAlpha(0.5),
clampToGround: true,
}
callback=(res)=>{console.log(res)}
})
# drawCorridorGraphics(options)
绘制走廊
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
width |
number
|
走廊宽度 |
height |
number
|
高度 |
extrudedHeight |
number
|
拉伸高度 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawCorridorGraphics({
width:420,
height:3,
extrudedHeight:500,
callback=(res)=>{console.log(res)}
})
# drawCylinderGraphics(options)
绘制圆柱体 or 圆锥
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
topRadius |
number
|
圆柱顶部半径 |
bottomRadius |
number
|
圆柱底部半径 |
length |
number
|
圆柱长度 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawCylinderGraphics({
length:420,
topRadius:100,
bottomRadius:5,
callback=(res)=>{console.log(res)}
})
# drawEllipsoidGraphics(options)
绘制球体
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
boolean
|
图形风格配置 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawEllipsoidGraphics({
style:{}
callback=(res)=>{console.log(res)}
})
# drawLineGraphics(options)
画线 or 测距
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
measure |
boolean
|
是否为测量 |
width |
number
|
线宽 |
material |
object
|
材质 默认值Cesium.Color.BLUE.withAlpha(0.8) |
clampToGround |
boolean
|
是否贴地 |
clampToS3M |
boolean
|
是否贴于s3m 模型上 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawLineGraphics({
measure:false,
width:3,
material:Cesium.Color.BLUE.withAlpha(0.8),
clampToGround:true,
clampToS3M:false,
callback=(res)=>{console.log(res)}
})
# drawPointGraphics(options)
画点
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
object
|
样式对象 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawPointGraphics({
style:{
image:"static/data/images/file/location4.png",
width: 35,
height: 40,
clampToGround: true,
scale: 1,
pixelOffset: new Cesium.Cartesian2(0, -20),
},
callback=(position,entityObj)=>{console.log(position,entityObj)}
})
# drawPolygonGraphics(options)
画面 or 测面积
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
boolean
|
图形风格配置 |
measure |
boolean
|
是否为量测 |
height |
number
|
拉伸高度 |
clampToGround |
boolean
|
是否贴地 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawPolygonGraphics({
measure:false,
height:300,
clampToGround:true,
style:{
width: 3,
material: Cesium.Color.BLUE.withAlpha(0.8),
clampToGround: true,
}
callback=(res)=>{console.log(res)}
})
# drawPolylineVolumeGraphics(options)
绘制管道
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
color |
number
|
图形颜色 |
rOuter |
number
|
管道外圆半径 |
rInner |
number
|
管道内圆半径 |
circleRadius |
number
|
管道半径 |
arms |
number
|
管道角数量 |
shape |
number
|
管道形状 如:fivePoint |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawPolylineVolumeGraphics({
color:Cesium.Color.RED,,
height:3,
extrudedHeight:500,
callback=(res)=>{console.log(res)}
})
# drawRectangleGraphics(options)
画矩形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
boolean
|
图形风格配置 |
height |
number
|
拉伸高度 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawRectangleGraphics({
height:300,
style:{
width: 3,
material: Cesium.Color.BLUE.withAlpha(0.5),
clampToGround: true,
}
callback=(res)=>{console.log(res)}
})
# drawTrianglesGraphics(options)
画三角量测
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
boolean
|
图形风格配置 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawTrianglesGraphics({
style:{
width: 3,
material: Cesium.Color.BLUE.withAlpha(0.5),
}
callback=(res)=>{console.log(res)}
})
# drawWallGraphics(options)
画围栏
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
style |
object
|
图形风格配置 |
style.material |
Material
|
图形材质 |
style.outline |
boolean
|
是否显示外边线 |
style.outlineColor |
Color
|
外边线颜色 |
style.clampToGround |
boolean
|
图形是否贴地 |
style.maximumHeights |
Array
|
设定每个点的最大高度 |
style.minimumHeights |
Array
|
设定每个点的最小高度 |
callback |
function
|
回调函数 |
Example
import { Draw } from 'cesium_dev_kit'
const drawObj = new Draw({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
drawObj.draw.drawWallGraphics({
style:{
material: Cesium.Color.BLUE.withAlpha(0.5),
outline: true,
outlineColor: Cesium.Color.WHITE,
maximumHeights: [600,600],
minimumHeights: [0,0],
clampToGround:true
}
callback=(res)=>{console.log(res)}
})