CloudRenderApp

CloudRenderApp

new CloudRenderApp(config)

Description:
  • 渲染类,游戏引擎交互场景,可以通过场景设置与游戏引擎的连接方式,渲染和移除物体,也可使用场景内置方法,如:快速移动到目标位置、巡游等等
Source:
  • engine/CloudRenderApp.js, line42
Parameters:
Name Type Description
config object 配置信息
Properties
Name Type Description
controllers object 控制器
print_stats boolean 打印状态信息
print_inputs boolean 打印输入信息
connect_on_load boolean 连接
is_reconnection boolean 开启重连
wsUrl string websocket服务的地址,如果使用主从服务器模式,则不需要传改参数
forceTURN boolean 是否使用turn server,如果采用调度模式,会被调度服务器回传的链接方式覆盖,默认false
projectName string 项目名,默认为default
matchmakerIP string 云渲染调度服务的ip
matchmakerPort string 云渲染调度服务的端口号
matchViewportResolution boolean 匹配分辨率
shouldShowPlayOverlay boolean 显示播放信息
afk object AFK
VideoEncoderQP string 视频编解码
styleCursor string 鼠标样式
inputOptions object 输入配置信息
Properties
Name Type Description
controlScheme boolean 控制模式
suppressBrowserKeys boolean 支持网页键,默认false
fakeMouseWithTouches boolean 将touch转成mouse, 默认false
isShowTestUI boolean 显隐测试UI
UDSParams boolean 天气系统默认参数

Extends

  • EventDispatcher

Methods

Swtich3DTilesMode(options)

Description:
  • 切换指定3dtiles的渲染模式
Source:
  • engine/CloudRenderApp.js, line1935
Parameters:
Name Type Description
options 参数
Properties
Name Type Description
mode string 渲染模式,默认为'Normal',可选值:LULC, Normal
tilesName string 瓦片名称

addToScene(obj)

Description:
  • 动态添加obj到场景
Source:
  • engine/CloudRenderApp.js, line2465
Parameters:
Name Type Description
obj * 需要被添加的对象

buildingGrowthAnimate(options)

Description:
  • 建筑生长动画效果
Source:
  • engine/CloudRenderApp.js, line1861
Parameters:
Name Type Description
options object 动画选项
Properties
Name Type Description
group number 生长组,默认为1, 可选项: 1,2,3,4,5,分别对应建筑生长组1,2,3,4,5
state string 动画状态,默认为'play', 可选项: play, stop
duration number 动画持续时间,默认为3000毫秒
startHeight number 动画开始高度,默认为0, 单位米
endHeight number 动画结束高度,默认为100, 单位米, 建议不要低于场景内最高建筑的高度
loop boolean 是否循环播放,默认为false
easing string 缓动函数,默认为线性函数Linear, 可选项:Linear,Quadratic,Cubic,Sinusoidal,Exponential
sliceColor object 建筑切割区域颜色 默认红色{r: 1, g: 0, b: 0}
sliceBrightness number 建筑切割区域自发光亮度,默认30,0为不发光
option.ColorHeight number 建筑切割区域厚度,默认为100, 单位厘米

changeResolution(width, height)

Description:
  • 改变分辨率
Source:
  • engine/CloudRenderApp.js, line1898
Parameters:
Name Type Description
width number 宽度
height number 高度

changeTime(hour, minute)

Description:
  • 根据目标时间修改时间
Source:
  • engine/CloudRenderApp.js, line2002
Parameters:
Name Type Default Description
hour number 8 24小时制,例如:22表示晚上10点
minute number 10 60分钟制,例如:30表示30分

changeWeather(weatherType)

Description:
  • 根据传入的UDS字段来设置天气类型
Source:
  • engine/CloudRenderApp.js, line1988
Parameters:
Name Type Description
weatherType * UDS字段

closeEdit()

Description:
  • 关闭编辑,关闭后通过editResult事件返回绘制信息,建议在此方法之前添加editResult事件,否则首次无法获取信息
Source:
  • engine/CloudRenderApp.js, line2678

destoryObject(obj)

Description:
  • 销毁物体,并释放内存
Source:
  • engine/CloudRenderApp.js, line2520
Parameters:
Name Type Description
obj *

enable3DTilesByName(options)

Description:
  • 通过名称启用或禁用3dtiles
Source:
  • engine/CloudRenderApp.js, line1953
Parameters:
Name Type Description
options 选项
Properties
Name Type Description
enable boolean 是否启用3D瓦片,默认为true
tilesName string 瓦片名称

enableDataLayerByName(dataLayerName, visible)

Description:
  • 开关数据层的显示根据名称
Source:
  • engine/CloudRenderApp.js, line2367
Parameters:
Name Type Description
dataLayerName string 图层或者数据层名字
visible boolean 显隐

enableEdit(drawOrMeasure, type, style)

Description:
  • 开始编辑绘制
Source:
  • engine/CloudRenderApp.js, line2550
Parameters:
Name Type Description
drawOrMeasure string 是绘制还是量测,默认值 draw,可选measure
type type 类型。点线面,可选point,line,polygon,measurearea,measureline,locationpoint,surfaceline
style object 样式配置

eventListenerUpdate(obj)

Description:
  • 更新事件监听器
Source:
  • engine/CloudRenderApp.js, line355
Parameters:
Name Type Description
obj 对象

excuteEngineConsoleCommand(command)

Description:
  • 执行UE的控制台命令
Source:
  • engine/CloudRenderApp.js, line1915
Parameters:
Name Type Description
command 要执行的命令

exit()

Description:
  • 退出客户端系统
Source:
  • engine/CloudRenderApp.js, line2436

focusOn(object, options)

Description:
  • 移动相机和视口到给定物体的区域,会根据物体的包围盒自动计算最佳视口,也可以设置最终相机的状态和移动过程的事件,轨迹等参数,如果给了回调函数,移动过程技术后,会触发回调函数
Source:
  • engine/CloudRenderApp.js, line2169
Parameters:
Name Type Description
object object 物体(必选)
options object {duration,preload,index,rotation,flyOverLongitude,callback}
Properties
Name Type Description
index number 索引,如果object是一个group,可以使用index缩放至其中一个child,默认值-1表示缩放至整个group
rotation object {roll,pitch,yaw}
duration number 持续时间,单位秒,默认值1.0
preload bool 是否开启远距离预加载,bool,默认值false
flyOverLongitude bool 是否开启曲线跳跃 默认为false 可选
callback bool 结束的回调函数 默认为null 可选

getAltitudeFromCoordinate(params, callback)

Description:
  • 获取指定坐标位置的高程
Source:
  • engine/CloudRenderApp.js, line2414
Parameters:
Name Type Description
params Object
Properties
Name Type Description
coordinate Vector2 经纬度坐标{x,y}
detectLength number 检测长度,单位米, 默认100
callback * 返回结果的回调函数

hidden3DTilesItem(options)

Description:
  • 隐藏3dtiles中的部分元素
Source:
  • engine/CloudRenderApp.js, line1970
Parameters:
Name Type Description
options 选项
Properties
Name Type Description
hiddenList Array 字符串数组,隐藏列表,默认为空数组
tilesName string 瓦片名称

initCamera()

Description:
  • 初始化相机,并监听相机回调
Source:
  • engine/CloudRenderApp.js, line399

initObjectBBox()

Description:
  • 初始化拾取物体的包围盒
Source:
  • engine/CloudRenderApp.js, line433

interval()

Description:
  • 定时更新
Source:
  • engine/CloudRenderApp.js, line245

moveCamera(options)

Description:
  • 移动摄像机
Source:
  • engine/CloudRenderApp.js, line2100
Parameters:
Name Type Description
options object 包含以下参数:
Properties
Name Type Description
multiplier number 移动速度倍数,默认为1
x number 左右方向的移动系数,默认为0,范围[-1,1],-1代表向负方向移动,1代表向正方向移动
y number 前后方向的移动系数,默认为0,范围[-1,1],-1代表向负方向移动,1代表向正方向移动

moveTo(location, rotation, options)

Description:
  • 移动相机和视口到给定位置,可以设置最终相机的状态和移动过程的事件,轨迹等参数,如果给了回调函数,移动过程技术后,会触发回调函数
Source:
  • engine/CloudRenderApp.js, line2046
Parameters:
Name Type Description
location object 目标点的经纬度坐标值{x,y,z}或者Vector3,单位度,(必选)
rotation object {roll,pitch,yaw} 翻滚角,俯仰角,平扫角,默认为{roll:0,pitch:0,yaw:0}
options object {duration,preload,detectLength,flyOverLongitude,zoom,callback}
Properties
Name Type Description
duration number 持续时间,单位秒,默认值1.0
preload bool 是否开启远距离预加载,bool,默认值false
number bool 标记改方法的序号,int,默认值0
endLineDetect bool 是否开启末端射线检测 默认为false 可选
detectLength number 末端射线检测距离 默认为50000 单位cm 可选
zoom number 摄像机的最终位置与目标位置之间的距离,默认为-1 可选,-1代表不调整Zoom值,该值的单位是cm
flyOverLongitude bool 是否开启曲线跳跃 默认为false 可选
globalCityCenter object 球面坐标系统下,要跳转的城市的中心点经纬度,{x,y,z}或者Vector3, 默认null 可选,平面无需该值
isGlobalMove bool 是否是球面移动,默认为false 可选
callback null | function 完成时的回调函数 默认为null,可选
Description:
  • 根据关键点进行路径巡航
Source:
  • engine/CloudRenderApp.js, line2221
Parameters:
Name Type Description
points Array 经纬度坐标点数组,[[lon,lat,alt,roll,pitch,yaw],[lon,lat,alt,roll,pitch,yaw],[lon,lat,alt,roll,pitch,yaw],[lon,lat,alt,roll,pitch,yaw]]
options object
Properties
Name Type Description
lockAll boolean rotation和zoom在巡航中锁定,默认true
speed number 巡航速度,默认36km/h, 如果速度小于0,则采用时间控制
time number 巡航时间, 单位秒, 默认为0,如果速度大于0,优先使用速度控制
name string 巡航名字,默认为空
ignoreLag boolean 是否忽略摄像机平滑延迟,默认为false
patrolType string 巡游类型,可选:default默认,Car汽车巡游,Car巡游可以按下键盘V键进行视角切换
FollowRotation object 巡游时是否旋转控制,patrolType不为default时有效,默认{Roll: false, Pitch:false, Yaw:false}
rayDetectionDistance number 车辆巡游地面射线检测距离,patrolType不为default时有效,默认1000, 单位厘米
finishDestory boolean 车辆巡游结束后销毁车辆,patrolType不为default时有效,默认true, 销毁,false会在下次车辆巡游是销毁
startCallback Functio 巡航开始回调,默认null
finishCallback Functio 巡航结束回调,默认null

pauseNavigation(options)

Description:
  • 暂停巡航
Source:
  • engine/CloudRenderApp.js, line2316
Parameters:
Name Type Description
options object
Properties
Name Type Description
patrolType string 控制的巡游类型,可选:default默认,Car汽车巡游

project(vector, callback)

Description:
  • 世界坐标转屏幕坐标 world space into the camera's normalized device coordinate (NDC)
Source:
  • engine/CloudRenderApp.js, line2380
Parameters:
Name Type Description
vector object 经纬度坐标{x:,y:,z:}
callback function 计算结果回调函数

removeAllEditObjects(drawOrMeasure, classes)

Description:
  • 移除所有的编辑几何体
Source:
  • engine/CloudRenderApp.js, line2710
Parameters:
Name Type Default Description
drawOrMeasure string all 全部测绘还是绘制项或量测项,默认值 all,可选measure,draw,all
classes string 删除形状类型,默认值 ['point', 'line', 'polygon', 'surfaceLine']

removeAllFromScene()

Description:
  • 从场景中移除所有物体,并销毁
Source:
  • engine/CloudRenderApp.js, line2508

removeFromScene(obj)

Description:
  • 从场景中移除物体,并销毁
Source:
  • engine/CloudRenderApp.js, line2500
Parameters:
Name Type Description
obj *

restartGame()

Description:
  • 回到场景初始状态
Source:
  • engine/CloudRenderApp.js, line2454

restartLevel()

Description:
  • 关卡重置,已弃用
Source:
  • engine/CloudRenderApp.js, line2443

resumeNavigation(options)

Description:
  • 继续巡航
Source:
  • engine/CloudRenderApp.js, line2332
Parameters:
Name Type Description
options object
Properties
Name Type Description
patrolType string 控制的巡游类型,可选:default默认,Car汽车巡游

rotateCamera(options)

Description:
  • 移动摄像机
Source:
  • engine/CloudRenderApp.js, line2119
Parameters:
Name Type Description
options object 包含以下参数:
Properties
Name Type Description
multiplier number 移动速度倍数,默认为1
yaw number 围绕y轴旋转的角度,默认为0,范围[-1,1],-1代表向负方向移动,1代表向正方向移动
pitch number 围绕x轴旋转的角度,默认为0,范围[-1,1],-1代表向负方向移动,1代表向正方向移动

sendStringBufferData(messageType, descriptorString, total, index)

Description:
  • 将数据转成arrayBuffer发送到UE
Source:
  • engine/CloudRenderApp.js, line1610
Parameters:
Name Type Default Description
messageType number 消息类型(必选)
descriptorString string 消息(必选)
total number 1 总传输次数
index number 1 当前传输次数

setFPS(status)

Description:
  • 设置帧率
Source:
  • engine/CloudRenderApp.js, line2695
Parameters:
Name Type Default Description
status false 是否显示帧率,默认为false

setWorldCenterPoint(longitude, latitude, altitude)

Description:
  • 设置场景中心点位置
Source:
  • engine/CloudRenderApp.js, line2013
Parameters:
Name Type Default Description
longitude number 经度
latitude number 纬度
altitude number 10 高度

setupModelInfo(url, body, header, staticResourceURL)

Description:
  • 获取资产管理平台所有模型信息
Source:
  • engine/CloudRenderApp.js, line3022
Parameters:
Name Type Description
url string 地址,必须
body object 模型信息请求体内容,必须
header object 模型信息请求header,可选
staticResourceURL string 静态资源地址请求url,可选

stopNavigation(options)

Description:
  • 终止巡航
Source:
  • engine/CloudRenderApp.js, line2349
Parameters:
Name Type Description
options object
Properties
Name Type Description
delayTime number 多长时间后进行终止,默认值100ms
patrolType string 控制的巡游类型,可选:default默认,Car汽车巡游

unproject(vector, callback)

Description:
  • 屏幕坐标转世界坐标 the camera's normalized device coordinate (NDC) space into world space
Source:
  • engine/CloudRenderApp.js, line2396
Parameters:
Name Type Description
vector object 屏幕坐标{x:,y:}
callback function 计算结果回调函数

zoomIn(multiplier)

Description:
  • 缩进
Source:
  • engine/CloudRenderApp.js, line2135
Parameters:
Name Type Default Description
multiplier 1 缩进倍数,默认为1

zoomOut(multiplier)

Description:
  • 缩远
Source:
  • engine/CloudRenderApp.js, line2149
Parameters:
Name Type Default Description
multiplier 1 缩小的倍数,默认为1