图形模块 用于向地图加载各种实体对象
Parameters:
Name | Type | Description |
---|---|---|
params |
object
|
|
viewer |
object
|
cesium 实例 |
cesiumGlobal |
object
|
cesium 全局对象 |
defaultStatic |
Array
|
静态资源 |
Extends
Methods
# craeteCorridorGraphics(options) → {corridor}
创建地面指示
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
height |
number
|
高度 |
width |
number
|
宽度 |
material |
object
|
材质 |
outline |
boolean
|
是否显示外边线 |
extrudedHeight |
number
|
拉伸高度 |
cornerType |
string
|
转角类型 |
返回corridor实例
corridor
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteCorridorGraphics({
positions: Cesium.Cartesian3.fromDegreesArray(
110.16018735617934, 31.036076859828338,
110.17845812703679,31.033686527335444,
110.19261040403379, 31.02892781958261,
110.20775152895165,31.02475678594998,
110.2247484728178,31.019315371809977,
110.24033095328579,31.017866033294506),
width: 1500.0,
height: 0,
extrudedHeight: 50,
cornerType: Cesium.CornerType.MITERED,
outline: false,
material:Cesium.Color.BLUE.withAlpha(0.4)
})
# craeteDynamicBlinkCircleGraphics(options) → {ellipse}
创建闪烁圆
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
alp |
number
|
频率 |
flog |
boolean
|
显示雾气效果 |
height |
number
|
高度 |
semiMinorAxis |
number
|
短半轴 |
semiMajorAxis |
number
|
长半轴 |
返回ellipse实例
ellipse
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteDynamicBlinkCircleGraphics({
position:Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
semiMinorAxis: 2000.0,
semiMajorAxis: 2000.0,
height: 10,
alp:2,
flog:true
})
# craeteDynamicCricleGraphics(options) → {ellipse}
创建动态旋转圆
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
center |
object
|
中心坐标数组 |
radius |
number
|
半径 |
rotateAmount |
number
|
旋转频率 |
height |
number
|
高度 |
scale |
number
|
外圆缩放比例 |
scale2 |
number
|
内圆缩放比例 |
imge |
string
|
材质图片 |
material |
object
|
材质(与图片二选一) |
返回ellipse实例
ellipse
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteDynamicCricleGraphics({
center:{ lng: 104.081701757991, lat: 30.627042558105988, alt: 1 },,
imge: "static/data/images/Textures/circle_bg.png",
radius : 800,
rotateAmount: 0.05,
height : 1,
scale:1500,
scale2:800
})
# craeteDynamicCylinderGraphics(options) → {cylinder}
构建动态椎体
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
cylinder |
CylinderGraphics
|
椎体对象 |
entity |
entity
|
entity实体 |
width |
number
|
宽度 |
clampToGround |
boolean
|
是否贴地 |
- See:
返回cylinder实例
cylinder
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteDynamicCylinderGraphics({
entity: new Cesium.Entity({positions:Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200)}),
cylinder:{
length: 500 / 2,
topRadius: 130,
bottomRadius: 20,
material: new Cesium.Color(0, 1, 1, 0.4),
slices: 128,
}
})
# craeteDynamicPolyLineGraphics(options) → {polyline}
构建动态线
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
material |
object
|
材质 |
width |
number
|
宽度 |
clampToGround |
boolean
|
是否贴地 |
返回polyline实例
polyline
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteDynamicPolyLineGraphics({
positions:Cesium.Cartesian3.fromDegreesArray([
104.09816110606057,
30.659821965447698,
104.1120972824757,
30.65330300319938,
104.10758419863926,
30.64592470850288,
104.09351691196979,
30.652434826507452,
104.09816110606057,
30.659821965447698
]),
material: Cesium.Color.CHARTREUSE,
width:5,
clampToGround:false
})
# craeteDynamicShadeWallGraphics(options) → {wall}
动态渐变墙
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
alp |
number
|
透明比例 0~1 |
num |
number
|
渐变步长 |
speed |
number
|
速度 0~1 |
color |
object
|
颜色 |
img |
string
|
材质图片 |
返回wall实例
wall
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteDynamicShadeWallGraphics({
positions: Cesium.Cartesian3.fromDegreesArray(
110.16018735617934, 31.036076859828338,
110.17845812703679,31.033686527335444,
110.19261040403379, 31.02892781958261,
110.20775152895165,31.02475678594998,
110.2247484728178,31.019315371809977,
110.24033095328579,31.017866033294506),
img: "static/data/images/Textures/circle_bg.png",
alp:1,
num :20,
color: Cesium.Color.RED,
speed:0.003;
})
# craeteRotateCylinderGraphics(options) → {cylinder}
创建旋转圆柱
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
length |
number
|
长度 |
topRadius |
number
|
顶部半径 |
bottomRadius |
number
|
底部半径 |
slices |
number
|
垂直分段数量 |
img |
string
|
材质图片 |
material |
object
|
材质(与图片二选一) |
- See:
返回cylinder实例
cylinder
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteRotateCylinderGraphics({
position:Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
length: 500,
topRadius: 500,
bottomRadius: 500,,
material: new Cesium.ImageMaterialProperty({
image:"static/data/images/file/cc2.png",
transparent: true,
repeat: {x: 1,y: -1},
}),
slices: 128,
})
# craeteRotatePlaneGraphics(options) → {plane}
旋转面
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
dimensions |
Cartesian2
|
长宽高 |
image |
string
|
图片 |
返回plane实例
plane
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.craeteRotatePlaneGraphics({
positions: Cesium.Cartesian3.fromDegreesArray([
104.09816110606057,
30.659821965447698,
104.1120972824757,
30.65330300319938,
104.10758419863926,
30.64592470850288),
image: "static/data/images/Textures/circle_bg.png",
dimensions:new Cesium.Cartesian2(200.0, 150.0),
})
# createBoxGraphics(options) → {BoxGraphics}
创建Box
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
show |
boolean
|
是否显示 |
name |
string
|
名称 |
dimensions |
object
|
盒子长宽高 |
distanceDisplayCondition |
object
|
显示条件 |
outlineColor |
object
|
外边线颜色 |
outline |
boolean
|
是否显示外边线 |
fill |
boolean
|
是否填充 |
material |
boolean
|
材质 |
- See:
返回BoxGraphics实例
BoxGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createBoxGraphics({
name: 'boxG',
position:Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
material:Cesium.Color.RED.withAlpha(0.2),
clampToGround:false,
clampToS3M:false
})
# createCanvasGraphics(options) → {rectangle}
canvas 贴图
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
img |
string
|
图片 |
cwidth |
number
|
宽度 |
cheight |
number
|
高度 |
callback |
function
|
回调 |
返回rectangle实例
rectangle
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createCanvasGraphics({
positions:Cesium.Cartesian3.fromDegreesArray(
110.16018735617934, 31.036076859828338,
110.17845812703679,31.033686527335444,
110.19261040403379, 31.02892781958261,
110.20775152895165,31.02475678594998,
110.2247484728178,31.019315371809977,
110.24033095328579,31.017866033294506)
img : "images/ysCesium/logo.png"
cwidth : 500,
cheight:200,
speed:0.06,
callback:res=>{console.log(res)}
})
# createCustomDefBillboardGraphics(options)
自定义标牌气泡框
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
height |
number
|
高度 |
width |
number
|
宽度 |
text |
string
|
文字 |
image |
string
|
气泡窗图片 |
b_pixelOffset |
Cartesian2
|
偏移 |
b_scale |
number
|
缩放比例 |
callback |
function
|
回调返回entity |
- See:
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createCustomDefBillboardGraphics({
position: Cesium.Cartesian3.fromDegrees(110.16018735617934, 31.036076859828338),
image: "static/data/images/Textures/circle_bg.png",
width : 150;
height:80;
text: "建工集团",
b_pixelOffset:new Cesium.Cartesian2(80, -35),
b_scale : 1.5,
})
# createFadeCylinderGraphics(options) → {cylinder}
创建渐变锥体
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
color |
string
|
颜色 |
duration |
number
|
持续时长 |
length |
number
|
长度 |
topRadius |
number
|
顶部半径 |
bottomRadius |
number
|
底部半径 |
slices |
number
|
垂直分段数量 |
返回cylinder实例
cylinder
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createFadeCylinderGraphics({
position:Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
length: 500 / 2,
topRadius: 130,
bottomRadius: 20,
color: new Cesium.Color(0, 1, 1, 0.4),
slices: 128,
duration:5
})
# createFanShape(options) → {wall}
创建扇形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
viewer |
Object
|
cesium 视图对象 |
custMaterial |
Material
|
自定义材质 |
speed |
Number
|
运动速度 |
longitude |
Number
|
纬度 |
latitude |
Number
|
经度 |
alt |
Number
|
高度(z轴) |
direction |
String
|
扫描方向("-"顺时针,"+"逆时针) |
返回wall实例
wall
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createFanShape({
viewer: this.viewer,
longitude: 104.06417395476578,
latitude: 30.636185094244944,
alt: 700,
speed: 2.0,
direction: '+',
custMaterial: Cesium.Color.AQUAMARINE.withAlpha(0.5)
})
# createGifBillboardGraphics(options) → {billboard}
gif 图片投影
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
dimensions |
Cartesian2
|
长宽高 |
url |
string
|
图片 |
normal |
Cartesian3
|
垂直方向 |
返回entity实例
billboard
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createGifBillboardGraphics({
position: Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
url: 'static/data/file/scene1.gif'
})
# createLineGraphics(options) → {PolylineGraphics}
创建线
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
name |
string
|
图形名称 |
oid |
string
|
原始id |
material |
object
|
配置线段材质 |
width |
number
|
线宽 |
clampToGround |
boolean
|
是否贴地 |
label |
object
|
绘制label图形的参数 |
- See:
返回PolylineGraphics实例
PolylineGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createLineGraphics({
name:'pLine',
oid:'pLineID',
positions: Cesium.Cartesian3.fromDegreesArray([
104.09816110606057,
30.659821965447698,
104.1120972824757,
30.65330300319938,
104.10758419863926,
30.64592470850288,
104.09351691196979,
30.652434826507452,
104.09816110606057,
30.659821965447698
]),
show: true,
material: Cesium.Color.YELLOW,
width:1,
clampToGround: false,
})
# createModelGraphics(options) → {ModelGraphics}
创建模型
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
m_url |
string
|
模型url |
url |
string
|
模型url |
m_scale |
number
|
缩放比例 |
scale |
number
|
缩放比例 |
- See:
返回ModelGraphics实例
ModelGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createModelGraphics({
position:Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
url:"model/person.gltf",
scale:2
})
# createPointsGraphics(options) → {Array}
创建点信息
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Array
|
坐标数组 |
name |
string
|
图形名称 |
oid |
string
|
原始id |
material |
boolean
|
材质 |
point |
boolean
|
标识是point图形 |
billboard |
object
|
绘制billboard图形的参数 |
label |
object
|
绘制label图形的参数 |
返回实例数组
Array
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getCylinderGraphics({
name:'cylinderObj',
oid:'cylinderID',
positions: [Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 400.0)],
billboard: {
b_img: 'static/data/images/Textures/billboard2.png',
b_width: 40,
b_height: 25,
b_scale: 1.5,
b_scaleByDistance: new Cesium.NearFarScalar(1.5e2, 2.0, 1.5e7, 0.5)
},
label: {
l_text: '中科较大',
l_fillColor: Cesium.Color.YELLOW,
l_outlineColor: Cesium.Color.KHAKI,
}
})
# createPolygonGraphics(options) → {PolygonGraphics}
创建面
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
坐标数组 |
material |
object
|
配置线段材质 |
clampToGround |
boolean
|
是否贴地 |
clampToS3M |
boolean
|
是否贴s3m模型 |
- See:
返回PolygonGraphics实例
PolygonGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createPolygonGraphics({
positions:Cesium.Cartesian3.fromDegreesArray([
104.09816110606057,
30.659821965447698,
104.1120972824757,
30.65330300319938,
104.10758419863926,
30.64592470850288,
104.09351691196979,
30.652434826507452,
104.09816110606057,
30.659821965447698
]),
material:Cesium.Color.RED.withAlpha(0.2),
clampToGround:false,
clampToS3M:false
})
# createVideoPlaneGraphics(options) → {plane}
视频投放
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
dimensions |
Cartesian2
|
长宽高 |
videoElement |
HTMLElement
|
video绑定dom |
normal |
Cartesian3
|
垂直方向 |
返回plane实例
plane
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.createVideoPlaneGraphics({
position: Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
videoElement: videoDom,
dimensions: new Cesium.Cartesian2(400.0, 200.0),
})
# getBillboardGraphics(options) → {BillboardGraphics}
获取广告牌图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
b_img |
string
|
背景图地址 |
b_width |
number
|
宽度 |
b_height |
number
|
高度 |
b_clampToGround |
boolean
|
贴地 |
b_scale |
number
|
缩放比例 |
b_scaleByDistance |
string
|
缩放远近距离 |
b_pixelOffset |
object
|
偏移 |
返回BillboardGraphics实例
BillboardGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getBillboardGraphics({
b_img: "images/bill.png",
b_width: 35,
b_height : 35,
b_clampToGround : true,
b_scale : 1,
b_pixelOffset :new Cesium.Cartesian2(0, -20),
b_scaleByDistance : new Cesium.NearFarScalar(1.5e2, 0.7, 1.5e7, 0.5),
})
# getBoxGraphics(options) → {BoxGraphics}
获取盒子图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
show |
boolean
|
是否显示 |
dimensions |
object
|
盒子长宽高 |
distanceDisplayCondition |
object
|
显示条件 |
outlineColor |
object
|
外边线颜色 |
outline |
boolean
|
是否显示外边线 |
fill |
boolean
|
是否填充 |
material |
boolean
|
材质 |
返回BoxGraphics实例
BoxGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getBoxGraphics({
show:true,
dimensions:new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
outlineColor: Cesium.Color.YELLOW,
outline: true,
fill: true,
material:Cesium.Color.RED.withAlpha(0.5),
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(2000.0, 4000.0)
})
# getCylinderGraphics(options) → {CylinderGraphics}
获取锥体图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
length |
number
|
长度 |
topRadius |
number
|
顶部半径 |
bottomRadius |
number
|
底部半径 |
material |
boolean
|
材质 |
slices |
number
|
垂直分段数量 |
返回CylinderGraphics实例
CylinderGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getCylinderGraphics({
length: 500 / 2,
topRadius: 130,
bottomRadius: 20,
material: new Cesium.Color(0, 1, 1, 0.4),
slices: 128,
})
# getEllipseGraphics(options) → {EllipseGraphics}
获取椭圆
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
e_semiMajorAxis |
number
|
长半轴 |
e_semiMinorAxis |
number
|
短半轴 |
e_metarial |
object
|
材质 |
e_outline |
boolean
|
是否显示外边线 |
返回EllipseGraphics实例
EllipseGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getEllipseGraphics({
e_semiMajorAxis:1000080.0,
e_semiMinorAxis:1000000.0,
e_metarial:Cesium.Color.RED.withAlpha(0.5),
e_outline:true
})
# getEllipsoidGraphics(options) → {EllipsoidGraphics}
获取球
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
radii |
number
|
半径 |
innerRadii |
number
|
内球半径 |
maximumCone |
number
|
椭圆最大角度 |
stackPartitions |
number
|
垂直分段数 |
slicePartitions |
number
|
平行分段数 |
outlineWidth |
number
|
外边线宽度 |
outlineColor |
object
|
外边线颜色 |
outline |
boolean
|
是否显示外边线 |
fill |
boolean
|
是否填充 |
material |
boolean
|
材质 |
返回EllipsoidGraphics实例
EllipsoidGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getEllipsoidGraphics({
radii: 1000000.0, //单位 米
innerRadii: 50000.0,
maximumCone: Cesium.Math.PI_OVER_TWO,
stackPartitions: 56,
slicePartitions: 56,
outlineWidth: 2.0,
outlineColor: Cesium.Color.YELLOW,
outline: true,
fill: true,
material: Cesium.Color.RED.withAlpha(0.1),
})
# getLabelGraphics(options) → {LabelGraphics}
获取标签图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
l_text |
string
|
标签文字 |
l_font |
string
|
字体 |
l_fillColor |
string
|
颜色 |
l_style |
string
|
风格 |
l_outlineColor |
number
|
外边线颜色 |
l_outlineWidth |
number
|
外边线宽度 |
l_showBackground |
boolean
|
是否显示背景颜色 |
l_backgroundColor |
object
|
背景颜色 |
l_verticalOrigin |
string
|
垂直方向 |
l_pixelOffset |
object
|
偏移 |
返回LabelGraphics实例
LabelGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getLabelGraphics({
l_text:"你好",
l_font : "14px sans-serif",
l_fillColor : Cesium.Color.GOLD,
l_style : Cesium.LabelStyle.FILL_AND_OUTLINE,
l_outlineWidth : 2,
l_showBackground: false,
l_backgroundColor : new Cesium.Color(0.165, 0.165, 0.165, 0.8),
l_verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
l_pixelOffset :new Cesium.Cartesian2(0, -30),
})
# getLineGraphics(options) → {PolylineGraphics}
获取线图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
绘制线图形的坐标数组 |
material |
object
|
配置线段材质 |
width |
number
|
线宽 |
clampToGround |
boolean
|
是否贴地 |
返回PolylineGraphics实例
PolylineGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getLineGraphics({
positions:Cesium.Cartesian3.fromDegreesArray([
104.09816110606057,
30.659821965447698,
104.1120972824757,
30.65330300319938,
104.10758419863926,
30.64592470850288,
104.09351691196979,
30.652434826507452,
104.09816110606057,
30.659821965447698
]),
material:Cesium.Color.RED.withAlpha(0.2),
clampToGround:false,
width:1
})
# getModelGraphics(options) → {ModelGraphics}
获取模型
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
m_url |
string
|
模型url |
url |
string
|
模型url |
m_scale |
number
|
缩放比例 |
scale |
number
|
缩放比例 |
返回ModelGraphics实例
ModelGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getModelGraphics({
url:"model/person.gltf",
scale:2
})
# getPathGraphics(options) → {PathGraphics}
获取路径
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
resolution |
number
|
采样频率 |
glowPower |
number
|
发光强度 |
color |
object
|
颜色 |
width |
number
|
宽度 |
返回PathGraphics实例
PathGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getPathGraphics({
resolution:1,
glowPower:0.1,
color:Cesium.Color.YELLOW,
width:24
})
# getPlaneGraphics(options) → {PlaneGraphics}
获取面板图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
plane |
object
|
面板垂直方向 |
dimensions |
object
|
面板长宽高 |
material |
boolean
|
材质 |
返回PlaneGraphics实例
PlaneGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getPlaneGraphics({
plane: new Cesium.Plane(Cesium.Cartesian3.UNIT_Y, 0.0),
dimensions:new Cesium.Cartesian2(170.0, 130.0),
material:Cesium.Color.BLUE
})
# getPointGraphics(options) → {PointGraphics}
获取点图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
color |
object
|
点颜色 |
pixelSize |
number
|
点大小 |
outlineColor |
number
|
边线颜色 |
outlineWidth |
number
|
边线宽 |
返回PointGraphics实例
PointGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getPointGraphics({
color:Cesium.Color.GREEN,
pixelSize:5,
outlineColor:Cesium.Color.WHITE,
outlineWidth:1
})
# getPolygonGraphics(options) → {PolygonGraphics}
获取面图形
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
positions |
Cartesian3
|
绘制线图形的坐标数组 |
material |
object
|
配置线段材质 |
clampToGround |
boolean
|
是否贴地 |
返回PolygonGraphics实例
PolygonGraphics
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
graphicObj.graphics.getPolygonGraphics({
positions:Cesium.Cartesian3.fromDegreesArray([
104.09816110606057,
30.659821965447698,
104.1120972824757,
30.65330300319938,
104.10758419863926,
30.64592470850288,
104.09351691196979,
30.652434826507452,
104.09816110606057,
30.659821965447698
]),
material:Cesium.Color.RED.withAlpha(0.2),
clampToGround:false
})
# setGraphicsFloat(options)
图形浮动
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
Cartesian3
|
坐标数组 |
entity |
Entity
|
实体对象 |
maxHeiht |
number
|
最大高度 |
minHeiht |
number
|
最小高度 |
cartesians |
Cartesian
|
原始位置 |
speed |
Cartesian
|
速度 |
- See:
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
const billboardGraphics = graphicObj.graphics.getBillboardGraphics({
b_img: "images/bill.png",
b_width: 35,
b_height : 35,
b_clampToGround : true,
b_scale : 1,
b_pixelOffset :new Cesium.Cartesian2(0, -20),
b_scaleByDistance : new Cesium.NearFarScalar(1.5e2, 0.7, 1.5e7, 0.5),
});
graphicObj.graphics.setGraphicsRotate({
entity: billboardGraphics,
cartesians: Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988, 200),
minHeiht : 5,
maxHeiht:100,
speed:0.06,
})
# setGraphicsRotate(options)
设置图形旋转
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
position |
object
|
wgs84坐标 |
entity |
Entity
|
实体对象 |
rotateAmount |
number
|
旋转比例 |
Example
import { Graphics } from 'cesium_dev_kit'
const graphicObj = new Graphics({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
});
const billboardGraphics = graphicObj.graphics.getBillboardGraphics({
b_img: "images/bill.png",
b_width: 35,
b_height : 35,
b_clampToGround : true,
b_scale : 1,
b_pixelOffset :new Cesium.Cartesian2(0, -20),
b_scaleByDistance : new Cesium.NearFarScalar(1.5e2, 0.7, 1.5e7, 0.5),
});
graphicObj.graphics.setGraphicsRotate({
entity:billboardGraphics ,
position: { lng: 104.081701757991, lat: 30.627042558105988, alt: 1 },
rotateAmount: 4,
})