Constructor
new Oper(viewer)
Parameters:
Name | Type | Description |
---|---|---|
viewer |
Methods
AddClockOnTickFunc(func, scope)
注册时钟每帧变动回调函数
Parameters:
Name | Type | Description |
---|---|---|
func |
回调函数 |
|
scope |
(this)回调函数执行的this指针 |
Returns:
None
addPolygonByTypeID(ptArray, typeID, styleopt)
在场景中添加多边形实体,并且给实体设置类型属性 可通过类型进行批量删除
设置贴地属性时点组自带的高度和默认高度都不生效,不贴地时若定义了默认高度则统一用默认高度,没定义则使用点组高度或0
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ptArray |
Array | 区域点组 点类型[经,纬,高] 二维数组表示多边形外轮廓 三维点组表示多边形带洞 |
||||||||||||||||||||||||||||||||
typeID |
String | 类型ID |
||||||||||||||||||||||||||||||||
style |
Object |
<optional> |
{}
|
多边形样式 Properties
|
Returns:
None
AddPostRenderFunc(func, scope)
注册渲染后处理回调函数
Parameters:
Name | Type | Description |
---|---|---|
func |
回调函数 |
|
scope |
(this)回调函数执行的this指针 |
Returns:
None
CartesianToScreenPoint(position)
获取Cartesian3坐标位置对应的屏幕位置
Parameters:
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 笛卡尔坐标点 |
Returns:
Cartesian2
ClampCartesian3ToGlobe(position)
获取点在地球表面的投射位置 (地形在在可视场景内方可以获取到,否则返回输入点在地球0平面上方的位置)
Parameters:
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 笛卡尔坐标点 |
Returns:
Cartesian3 返回场景投射点
ClampCartesian3ToScene(position, excludeLayers)
获取点在场景中的投射位置(场景在可视场景内方可以获取到,否则返回原输入点)
注意-慎用本函数:该函数每次调用占用一帧
Parameters:
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 笛卡尔坐标点 |
excludeLayers |
Array | 排除的层 |
Returns:
Cartesian3 返回场景投射点
clearColorStatusByStyle(tileset, attrName, values, typeBeStringopt, bClearAllopt)
清除通过style设置的颜色状态 若只传tileset参数则清空图层所有颜色状态 否则会根据attrName和values来清空符合条件的实体的颜色状态
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||
attrName |
String | 属性名 仅3dtiles图层需要 |
||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
bClearAll |
Boolean |
<optional> |
true
|
假如对某实体设置了三次颜色状态,那么当前操作是要清除所有的状态还是只清除最后一次设置的 仅3dtiles图层需要 |
Returns:
None
clearShowStatusByStyle(tileset, attrName, values, typeBeStringopt, bClearAllopt)
清除通过style设置的显示状态 若只传tileset参数则清空图层所有显示状态 否则会根据attrName和values来清空符合条件的实体的显示状态
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||
attrName |
String | 属性名 仅3dtiles图层需要 |
||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
bClearAll |
Boolean |
<optional> |
true
|
假如对某实体设置了三次显示状态,那么当前操作是要清除所有的显示状态还是只清除最后一次设置的 |
Returns:
None
createTextPrimitive(basePt, text, color, options) → {Primitive|Array}
创建一个或一组文本实体
eg:
创建单行文本 比如管径标绘
var curPrimitive = viewer.zz.oper.createTextPrimitive(pt,'300X300', Cesium.Color.RED, {angle:0,entHeight:20});
创建多行文本 比如扯旗标绘
var strArray = [];
strArray.push(["管类","材质","规格","埋深","高程"]);
strArray.push(["热水","钢","90","6.63","12.5"]);
strArray.push(["路灯","铝","60","3.75","10.09"]);
strArray.push(["污水","砼","75","1.60","65.64"]);
strArray.push(["天然气","PE","250","1.38","66.75"]);
strArray.push(["电信","光纤","300X300","1.28","67.08"]);
strArray.push(["移动","光纤","300X300","1.28","67.08"]);
strArray.push(["联通","光纤","300X300","1.28","67.08"]);
var colorArray = [];
colorArray.push(Cesium.Color.BLACK);
colorArray.push(Cesium.Color.DARKORANGE);
colorArray.push(Cesium.Color.RED);
colorArray.push(Cesium.Color.PERU);
colorArray.push(Cesium.Color.ORCHID);
colorArray.push(Cesium.Color.LIME);
colorArray.push(Cesium.Color.LIME);
colorArray.push(Cesium.Color.LIME);
var curPrimitive = viewer.zz.oper.createTextPrimitive(pt,strArray, colorArray, {angle:0,entHeight:40});
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
basePt |
Cartesian3 | Array | 一个或多个点组 点类型Cartesian3 |
||||||||||||||||||||||||||||||||||||||||
text |
String | Array | 显示的文字 文字为多行时需要用二维数组表示 |
||||||||||||||||||||||||||||||||||||||||
color |
Color | Array | 文字颜色或颜色数组 |
||||||||||||||||||||||||||||||||||||||||
options |
Object | 可选参数 Properties
|
Returns:
primitive 生成的实体对象
- Type
- Primitive | Array
deletePolygonByTypeID(typeID)
根据类型ID对相应实体进行批量删除
Parameters:
Name | Type | Description |
---|---|---|
typeID |
String | 类型ID |
Returns:
None
deletePrimitiveByID(id)
根据ID删除对应实体
Parameters:
Name | Type | Description |
---|---|---|
id |
String | 实体id |
deletePrimitiveByTypeID(typeID)
根据类型ID对相应实体进行批量删除
Parameters:
Name | Type | Description |
---|---|---|
typeID |
String | 类型ID |
DisablePostProcessStages(options)
禁用后处理特效
Parameters:
Name | Type | Description |
---|---|---|
options |
选项 |
Returns:
None
EnablePostProcessStages(options)
启用/修改后处理特效
Parameters:
Name | Type | Description |
---|---|---|
options |
* | 选项{BlackAndWhiteStage: {gradations:, enabled:}, BrightnessStage: {brightness:, enabled:}, NightVisionStage: {enabled:}} |
Returns:
None
EnableScreenLayerSplit(mode:)
启用卷帘窗口的模式
Parameters:
Name | Type | Description |
---|---|---|
mode: |
0-None|1-left|2-right |
Returns:
None
flashingEntByAttribute(tileset, attrName, values, firstColoropt, secondColoropt, typeBeStringopt, flashCountopt, bEndClearopt, optionsopt)
根据指定属性和颜色高亮闪烁实体 所有实体共用一种高亮色 清除此高亮请调用clearColorStatusByStyle接口
Parameters:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||||||||||
attrName |
String | 属性名 仅3dtiles图层需要 |
||||||||||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||||||||||
firstColor |
Array |
<optional> |
[0.11,0.56,1.0,0.5]
|
表示颜色的rgba的数组, eg:[1,0,0,1] |
||||||||
secondColor |
Array |
<optional> |
[0.11,0.56,1.0,0.5]
|
表示颜色的rgba的数组,闪烁时会在firstColor和secondColor直接跳转,不传该参数时会自动生成 |
||||||||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
||||||||
flashCount |
Number |
<optional> |
6
|
闪烁次数 |
||||||||
bEndClear |
Boolean |
<optional> |
true
|
高亮结束时是恢复到高亮前的颜色状态还是保持高亮颜色 默认恢复到高亮前 |
||||||||
options |
Object |
<optional> |
{}
|
追加参数 Properties
|
Returns:
None
flashingEntByAttributeSimple(tileset, attrName, values, firstColoropt, secondColoropt, typeBeStringopt, flashCountopt, bEndClearopt, optionsopt)
简易的高亮闪烁接口 根据指定属性和颜色高亮闪烁实体 高亮闪烁时会自动终止上个实体的高亮闪烁 什么都不传时也会自动终止上个实体的高亮闪烁
Parameters:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||||||||||
attrName |
String | 属性名 仅3dtiles图层需要 |
||||||||||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||||||||||
firstColor |
Array |
<optional> |
[0.11,0.56,1.0,0.5]
|
表示颜色的rgba的数组, eg:[1,0,0,1] |
||||||||
secondColor |
Array |
<optional> |
[0.11,0.56,1.0,0.5]
|
表示颜色的rgba的数组,闪烁时会在firstColor和secondColor直接跳转,不传该参数时会自动生成 |
||||||||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
||||||||
flashCount |
Number |
<optional> |
6
|
闪烁次数 |
||||||||
bEndClear |
Boolean |
<optional> |
true
|
高亮结束时是恢复到高亮前的颜色状态还是保持高亮颜色 默认恢复到高亮前 |
||||||||
options |
Object |
<optional> |
{}
|
追加参数 Properties
|
Returns:
None
flashingEntity(tileset, firstColoropt, secondColoropt, flashCountopt, bEndClearopt, optionsopt)
用颜色交替的方式高亮实体Entity或者Model
Parameters:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tileset |
Entity | Model | 目标对象 |
||||||||||
firstColor |
Array |
<optional> |
[0.11,0.56,1.0,0.5]
|
表示颜色的rgba的数组, eg:[1,0,0,1] |
||||||||
secondColor |
Array |
<optional> |
[0.11,0.56,1.0,0.5]
|
表示颜色的rgba的数组,闪烁时会在firstColor和secondColor直接跳转,不传该参数时会自动生成 |
||||||||
flashCount |
Number |
<optional> |
6
|
闪烁次数 |
||||||||
bEndClear |
Boolean |
<optional> |
true
|
高亮结束时是恢复到高亮前的颜色状态还是保持高亮颜色 默认恢复到高亮前 |
||||||||
options |
Object |
<optional> |
{}
|
追加参数 Properties
|
Returns:
None
GenerateSamplePositions(positions, options)
获取点采样
Parameters:
Name | Type | Description |
---|---|---|
positions |
Cartesian3点数组 |
|
options |
* | {speed: 30, loopTimes: 1} |
Returns:
object
getCameraPos() → {Object}
获取当前相机的位置信息 包括位置、朝向、上方向 数据类型均为Cartesian3
返回对象的ent字段存储pick到的实体 property字段存储实体的属性
Returns:
eg:{pos:XXX,dir:XXX,up:XXX}
- Type
- Object
GetCanvas(None)
获取canvas
Parameters:
Name | Type | Description |
---|---|---|
None |
Returns:
canvas
GetGeocoderSearchCompleteEvent()
获取geocoder search fly 结束时的事件
Returns:
Event
GetPickObjectPosition(ptx, pty, pickGlobeopt) → {Cesium.Cartesian3}
获取Pick到物体的笛卡尔坐标, Pick不到时返回undefined
注意-慎用本函数:该函数每次调用占用一帧
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ptx |
Number | 点击屏幕位置的x坐标 |
||
pty |
Number | 点击屏幕位置的y坐标 |
||
pickGlobe |
Boolean |
<optional> |
true
|
当Pick不到物体时,是否尝试获取地球表面的坐标点 |
Returns:
- Type
- Cesium.Cartesian3
GetSceneDegreesByScreenPoint() → {Cesium.Cartesian3}
获取屏幕位置的经纬度坐标度数值, Pick不到时返回undefined,参数同GetScenePositionByScreenPoint
注意-慎用pickObject选项,pickObject选项启用时每次调用占用一帧,禁止用于循环处理中
Returns:
- Type
- Cesium.Cartesian3
GetScenePositionByScreenPoint(ptx, pty, options) → {Cesium.Cartesian3}
获取屏幕位置的笛卡尔坐标, Pick不到时返回undefined
注意-慎用该函数,pickObject选项启用时每次调用占用一帧,禁止用于循环处理中
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ptx |
Number | 屏幕位置的x坐标 |
|||||||||||||||
pty |
Number | 屏幕位置的y坐标 |
|||||||||||||||
options |
Object | 点击屏幕位置的y坐标 Properties
|
Returns:
- Type
- Cesium.Cartesian3
GetScreenShotCanvas(options) → {None}
获取场景屏幕截屏Canvas
Parameters:
Name | Type | Description |
---|---|---|
options |
* | 选项 可选参数: {width:, height:} |
Returns:
- Type
- None
GetScreenShotData(options) → {None}
获取场景屏幕截屏数据流
Parameters:
Name | Type | Description |
---|---|---|
options |
* | 选项 可选参数: {width:, height:} |
Returns:
- Type
- None
Is2DMode()
是否2D模式
Returns:
Boolean
pickEntGetPropertyByScenePt(scenePt, diropt) → {Object}
根据提供的场景坐标点和方向构建射线并和场景求交 获取pick到的第一个对象以及属性信息 假如没pick到实体则返回空对象
返回对象的ent字段存储pick到的实体 property字段存储实体的属性
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
scenePt |
Cartesian3 | 三维场景坐标点 |
|
dir |
Cartesian3 |
<optional> |
求交方向 默认从场景点开始竖直向下 |
Returns:
eg:{ent:XXX,property:{layerId:1,objectId:123}}
- Type
- Object
pickEntGetPropertyByScreenPt(screenX, screenY) → {Object}
pick屏幕上的指定点并获取pick对象以及属性信息 假如没pick到实体则返回空对象
返回对象的ent字段存储pick到的实体 property字段存储实体的属性
Parameters:
Name | Type | Description |
---|---|---|
screenX |
Number | 采样相机的高程值 |
screenY |
Number | 采样相机的高程值 |
Returns:
eg:{ent:XXX,property:{layerId:1,objectId:123}}
- Type
- Object
RemoveClockOnTickFunc(func, scope)
注销后时钟每帧回调函数
Parameters:
Name | Type | Description |
---|---|---|
func |
回调函数 |
|
scope |
传入注册时使用的scope |
Returns:
None
RemovePostRenderFunc(func, scope)
注销后处理回调函数
Parameters:
Name | Type | Description |
---|---|---|
func |
回调函数 |
|
scope |
传入注册时使用的scope |
Returns:
None
revertSampleCameraHeight()
重置高程采样相机的高度值为系统默认值
Returns:
None
setEntColorByAttribute(tileset, attrName, values, colors, typeBeStringopt, optionsopt)
根据指定属性设置实体颜色 清除此颜色请调用clearColorStatusByStyle接口
Parameters:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||||||||||
attrName |
String | 属性名 仅3dtiles图层需要 |
||||||||||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||||||||||
colors |
Array | 颜色值rgba eg:[ [1,0,0,1], [0,1,0,1]... ] 颜色值和属性值必须一一对应 |
||||||||||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
||||||||
options |
Object |
<optional> |
{}
|
追加参数 Properties
|
Returns:
None
setEntColorByAttributeSimple(tileset, attrName, values, colors, typeBeStringopt, optionsopt)
简易的高亮接口 高亮当前实体时会自动取消上个实体的高亮 参数什么都不传时也会自动清除上个实体的高亮
Parameters:
Name | Type | Attributes | Default | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||||||||||
attrName |
String | 属性名 仅3dtiles图层需要 |
||||||||||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||||||||||
colors |
Array | 颜色值rgba eg:[1,0,0,1] 所有实体共用同种高亮色 |
||||||||||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
||||||||
options |
Object |
<optional> |
{}
|
追加参数 Properties
|
Returns:
None
setFlowDirByTileset(tileset, objectID, dir)
通过图层对象tileset来设置实体的流向 内部处理时占用了高亮的黑色[0,0,0] 因此高亮色请务必不要设置成黑色
Parameters:
Name | Type | Description |
---|---|---|
tileset |
Object | 管线图层 |
objectID |
Number | 实体对象ID |
dir |
Number | 流向标识 0:去除流向效果 1:正向 2:反向 |
setLocationTarget(position)
设置双击定位的目标点
Parameters:
Name | Type | Description |
---|---|---|
position |
Cartesian3 | 笛卡尔坐标点 |
Returns:
None
setSampleCameraHeight(采样相机的高程值)
设置高程采样相机的高度值
Parameters:
Name | Type | Description |
---|---|---|
采样相机的高程值 |
Number |
Returns:
None
SetSceneMode(mode, options)
设置场景模式2D/3D
Parameters:
Name | Type | Description |
---|---|---|
mode |
必选参数 "2D"|"3D" |
|
options |
* | 可选参数 {duration: 0|过渡时间} |
Returns:
None
SetScreenLayerSplitPosition(position:)
设置卷帘窗口的位置
Parameters:
Name | Type | Description |
---|---|---|
position: |
[0-1] |
Returns:
None
showOrHideEntByAttribute(tileset, attrName, values, bShowopt, typeBeStringopt, othersBeShowopt)
根据指定属性显示或隐藏实体 清除此状态请调用clearShowStatusByStyle接口
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||
attrName |
String | 属性名 仅3dtiles图层需要 |
||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||
bShow |
Boolean | Array |
<optional> |
false
|
属性名和属性值确定的实体是否显示,默认隐藏 |
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
othersBeShow |
Boolean |
<optional> |
其他实体是否显示 注意:设置该参数时当前显示状态为覆盖,不设置时为追加 |
Returns:
None
stopFlash(tileset, attrName, values, typeBeStringopt)
终止闪烁高亮 后三个参数有效时仅终止该条件下的高亮闪烁 后三个参数无效时终止整个图层的高亮闪烁
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tileset |
Cesium3DTileset | Entity | Model | 目标实体或图层 |
||
attrName |
String | 属性名 仅3dtiles图层需要 |
||
values |
Array | 属性值,eg:[value1,values2...] 仅3dtiles图层需要 |
||
typeBeString |
Boolean |
<optional> |
true
|
属性值的类型是否为字符串类型 仅3dtiles图层需要 |
Returns:
None