界面
绘制
new Draw()
实例化
返回:
- 实例化Draw对象
详情:
实例化
Draw
对象,可以调用绘制模块中的方法示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
console.log(draw)
openDrawPoint()
打开绘制点功能
返回:
- 打开绘制点功能后的回调
详情:
打开绘制点功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
const status = await draw.openDrawPoint()
console.log(status)
drawPoint()
绘制点功能
返回:
- 绘制点功能后的回调
详情:
绘制点功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
const status = await draw.openDrawPoint()
const response = await draw.drawPoint()
console.log(response)
showPoint()
显示点功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 显示点功能后的回调
详情:
显示绘制点功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
const response = await draw.showPoint('123')
console.log(response)
hidePoint()
隐藏点功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 隐藏点功能后的回调
详情:
隐藏绘制点功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
const response = await draw.hidePoint('123')
console.log(response)
deletePoint()
删除点功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 删除点功能后的回调
详情:
删除绘制点功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
const response = await draw.deletePoint('123')
console.log(response)
getPointList()
获取点列表
参数:
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 获取点列表后的回调
详情:
获取点列表
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' } )
const draw = new kapi.Draw()
const response = await draw.getPointList()
console.log(response)
TIP
功能需要完善
closeDrawPoint()
关闭绘制点功能
返回:
- 关闭绘制点功能后的回调
详情:
关闭绘制点功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.openDrawPoint()
// 10秒后关闭绘制点
setTimeout(async e => {
const response = await draw.closeDrawPoint()
console.log(status)
}, 1000 * 10)
drawPath()
开启绘制路径功能
参数:
{String} path 路径参数
{String} option 绘制参数
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
option参数如下表
参数 | 类型 | 描述 |
---|---|---|
id | string | 路径唯一id |
isGraphic | boolean | 是否是地理坐标 |
返回:
- 开启绘制路径功能后的回调
详情:
开启绘制路径功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
draw.addLightFlowEventListener(response => {
console.log(response)
})
clearPath()
清空路径功能
参数:
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 清空路径功能后的回调
详情:
清空路径功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
let response = await draw.clearPath()
console.log(response)
drawDecal()
绘制贴花功能
参数:
{Object} option 绘制参数
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
option参数如下表
参数 | 类型 | 描述 |
---|---|---|
type | string | 绘制贴花【straight 直行引导线;straightright 直行加右转引导线;straightleft 直行加左转引导线;right 右转引导线;left 左转引导线;manholecover 圆形井盖】 |
isGraphic | boolean | 是否是地理坐标 |
location | object | 绘制贴花坐标 |
x | number | x |
y | number | y |
z | number | z |
rotation | object | 姿态 |
roll | number | roll |
pitch | number | pitch |
yaw | number | yaw |
返回:
- 绘制贴花功能后的回调
详情:
绘制贴花功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
let response = await draw.drawDecal()
console.log(response)
removeDecal()
删除贴花功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 删除贴花功能后的回调
详情:
删除贴花功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.removeDecal('123')
console.log(status)
drawContour()
绘制区域轮廓功能
参数:
{String} contour 点数组
{Object} option 绘制参数
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
option参数如下表
参数 | 类型 | 描述 |
---|---|---|
id | string | 路径唯一id |
isGraphic | boolean | 是否是地理坐标 |
返回:
- 绘制区域轮廓功能后的回调
详情:
绘制区域轮廓功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
let response = await draw.drawContour()
console.log(response)
removeContour()
删除区域轮廓功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 删除区域轮廓功能后的回调
详情:
删除区域轮廓功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.removeContour('123')
console.log(status)
drawCircularContour()
绘制圆形区域轮廓功能
参数:
{String} contour 点数组
{Object} option 绘制参数
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
option参数如下表
参数 | 类型 | 描述 |
---|---|---|
radius | number | 半径 |
isGraphic | boolean | 是否是地理坐标 |
location | object | 坐标 |
x | number | x |
y | number | y |
z | number | z |
返回:
- 绘制圆形区域轮廓功能后的回调
详情:
绘制圆形区域轮廓功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
let response = await draw.drawContour()
console.log(response)
removeCircularContour()
删除原形区域轮廓功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 删除圆形区域轮廓功能后的回调
详情:
删除圆形区域轮廓功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.removeCircularContour('123')
console.log(status)
drawLightFlow()
开始绘制光流线功能
参数:
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 开始绘制光流线功能后的回调
详情:
开始绘制光流线功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.drawLightFlow()
console.log(status)
removeLightFlow()
删除光流线功能
参数:
{String} id 点的唯一标识
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 绘制光流线功能后的回调
详情:
绘制光流线功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.drawLightFlow()
console.log(status)
closeDrawLightFlow()
关闭绘制光流线功能
参数:
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 关闭绘制光流线功能后的回调
详情:
关闭绘制光流线功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
const status = await draw.drawLightFlow()
// 10秒后关闭绘制光流线
setTimeout(async e => {
const response = await draw.closeDrawLightFlow()
console.log(status)
}, 1000 * 10)
getAllByWindow()
全选视窗物体
参数:
{String} type 物体类型【staticmesh 静态网格体;tree 树木;car 车辆】
{Boolean} sync [可选]是否要多客户端同步场景,需要开启同步服务器
返回:
- 全选视窗物体功能后的回调
详情:
全选视窗物体
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const draw = new kapi.Draw()
let all = await draw.getAllByWindow('staticmesh')
console.log(all)
LightFlowEventListener
新增光流线生成监听功能
返回:
- 新增光流线生成监听功能后的回调
详情:
新增光流线生成监听功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const event = new kapi.Event()
event.addEventListener(KAPI_CONST.EVENT.DRAW_LIGHT_FLOW, response => {
console.log(response)
})
移除光流线生成监听功能
返回:
- 移除光流线生成监听功能后的回调
详情:
移除光流线生成监听功能
示例:
js
import KAPI from '@ibrucekong/kapi'
const kapi = await KAPI.build('Your Auth Token')
const scene = new kapi.Scene('kapi-container', { server: 'Your Service URL' })
const event = new kapi.Event()
event.removeEventListener(KAPI_CONST.EVENT.DRAW_LIGHT_FLOW)