Class: MarkManager
标注管理类
创建标注、导出标注层、更新标注层
Examples
let markManager =await cloud.getMarkManager();
let markManager =await cloud.getMarkManager();
Hierarchy
Callable
↳
MarkManager
Methods
getMarkLayerByName
▸ getMarkLayerByName(layerName
): Promise
<null
| MarkLayer
>
Details
根据层名获取标注层对象
Examples
调用示例:
const markManager = await cloud.getMarkManager()
await markManager.getMarkLayerByName("1")
const markManager = await cloud.getMarkManager()
await markManager.getMarkLayerByName("1")
Parameters
Name | Type | Description |
---|---|---|
layerName | string | 层名 |
Returns
Promise
<null
| MarkLayer
>
标注层对象,不存在时返回空
clearAllLayer
▸ clearAllLayer(): Promise
<any
>
Details
清除所有图层及其标注
Examples
调用示例:
const markManager = await cloud.getMarkManager()
await markManager.clearAllLayer()
const markManager = await cloud.getMarkManager()
await markManager.clearAllLayer()
Returns
Promise
<any
>
无
removeMarkLayer
▸ removeMarkLayer(layerList
): Promise
<boolean
>
Details
移除对应层
Examples
调用示例:
const markManager = await cloud.getMarkManager()
var layerList = await markManager.getAllMarkLayer()
await markManager.removeMarkLayer(layerList)
const markManager = await cloud.getMarkManager()
var layerList = await markManager.getAllMarkLayer()
await markManager.removeMarkLayer(layerList)
Parameters
Name | Type | Description |
---|---|---|
layerList | MarkLayer [] | 层列表 |
Returns
Promise
<boolean
>
是否移除成功
getAllMarkLayer
▸ getAllMarkLayer(): Promise
<MarkLayer
[]>
Details
获取所有层
Examples
调用示例:
const markManager = await cloud.getMarkManager()
var layerList = await markManager.getAllMarkLayer()
const markManager = await cloud.getMarkManager()
var layerList = await markManager.getAllMarkLayer()
Returns
Promise
<MarkLayer
[]>
所有层对象
createMark
▸ createMark(layerName
, markStyle
, markData
): Promise
<boolean
>
Details
创建标注,(样式和数据的类型需相同,否则仅使用标注数据创建标注)
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
style: markStyle,
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const textData: TextMarkData = {
type: "textMark",
normalDir: {x:1, z:1, y:1},
pos: {X:6.0, y:11.5, z:5.0},
content :"22"
}
const markManager = await cloud.getMarkManager()
await markManager.createMark("1",textStyle,textData)
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
style: markStyle,
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const textData: TextMarkData = {
type: "textMark",
normalDir: {x:1, z:1, y:1},
pos: {X:6.0, y:11.5, z:5.0},
content :"22"
}
const markManager = await cloud.getMarkManager()
await markManager.createMark("1",textStyle,textData)
Parameters
Name | Type | Description |
---|---|---|
layerName | string | 层名 |
markStyle | null | MarkStyle | 标注样式 |
markData | MarkData | 标注数据 |
Returns
Promise
<boolean
>
是否成功
updateLayerStyle
▸ updateLayerStyle(layerNameList
, markStyle
, markData
): Promise
<boolean
>
Details
更新图层标注样式,根据参数类型更新所传图层内对应标注的样式和数据
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
style: markStyle,
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const textData: TextMarkData = {
type: "textMark",
normalDir: {x:1, z:1, y:1},
pos: {X:6.0, y:11.5, z:5.0},
content :"22"
}
const layerNameList = ['1','qq']
const markManager = await cloud.getMarkManager()
await markManager.updateLayerStyle(layerNameList,textStyle,textData)
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
style: markStyle,
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const textData: TextMarkData = {
type: "textMark",
normalDir: {x:1, z:1, y:1},
pos: {X:6.0, y:11.5, z:5.0},
content :"22"
}
const layerNameList = ['1','qq']
const markManager = await cloud.getMarkManager()
await markManager.updateLayerStyle(layerNameList,textStyle,textData)
Parameters
Name | Type | Description |
---|---|---|
layerNameList | string [] | 层名列表 |
markStyle | null | MarkStyle | 标注样式 |
markData | null | MarkData | 标注数据 |
Returns
Promise
<boolean
>
是否成功
updateMarkStyle
▸ updateMarkStyle(mark
, markStyle
, markData
): Promise
<boolean
>
Details
更新某一标注对象样式数据(与标注是同一类型的样式和数据才会成功)
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
style: markStyle,
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const textData: TextMarkData = {
type: "textMark",
normalDir: {x:1, z:1, y:1},
pos: {X:6.0, y:11.5, z:5.0},
content :"22"
}
var markManager = await cloud.getMarkManager()
var layerList = await markManager.getAllMarkLayer()
var markList = await layerList[0].getAllMark()
await markManager.updateMarkStyle(markList[0],TextMarkStyle,TextMarkData)
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
style: markStyle,
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const textData: TextMarkData = {
type: "textMark",
normalDir: {x:1, z:1, y:1},
pos: {X:6.0, y:11.5, z:5.0},
content :"22"
}
var markManager = await cloud.getMarkManager()
var layerList = await markManager.getAllMarkLayer()
var markList = await layerList[0].getAllMark()
await markManager.updateMarkStyle(markList[0],TextMarkStyle,TextMarkData)
Parameters
Name | Type | Description |
---|---|---|
mark | MarkObject | 标注对象 |
markStyle | null | MarkStyle | 标注样式 |
markData | null | MarkData | 标注数据 |
Returns
Promise
<boolean
>
是否成功
addMarkByUrl
▸ addMarkByUrl(url
): Promise
<null
| object
>
Details
根据url批量创建层以及层中的标注
Examples
调用示例:
//文件内参数 注:importLayer注释中包含六种标注的构建
{
"marks": [
{
"layerName": "焊点",
"markList": [
{
markStyle: {
type: 'textMark', // 标注类型
style: { // 标注样式
dimLineColor: '0xff87ceeb', // 标注线颜色
fontLabelStyle: { // 标牌样式
face: '宋体', // 字体
color: '0xff87ceeb', // 字体颜色
size: 30, // 字体大小,尽量靠近高度
fontLabelPos: 6, // 文字位置
backgroundColor: '0x00ff0000', // 背景颜色
height: 35, // 文字高度
textScale: 0.4, // 文字缩放系数
outLineColor: '0x00000000', // 字体轮廓线颜色
outLineWide: 0, // 字体轮廓线大小
borderColor: '0x00000000', // 边框线颜色
fontDir: 0, // 文字方向 0:从左到右,1:从右到左(仅对space(3D)标牌类型起作用)
fontOff: 0.01, // 文字偏移距离(仅对space(3D)标牌类型起作用)
},
labelType: 'space', // 标牌类型 "screen":2.5D标牌 "space":3D标牌(默认为3D标牌)
accuracy: 3, // 数字进度
geometryStyle: { // 几何体参数
cylinderRadius: 0.001, // 圆柱半径
rigthConeRadius: 0.002, // 圆锥半径
rigthConeHeight: 0.008, // 圆锥高度
},
},
skewLeadLength: 1, // 斜引线
flatLeadLength: 0.6, // 平引线,仅当平引线长度大于文字宽度时起作用
slopeAngle: 60, // 倾斜角度[0,180]
},
markData: {
type: 'textMark', // 标注类型
normalDir: { // 法线方向
x: 0,
y: 1,
z: 0,
},
extensionDir: { // 延申方向
x: 1,
y: 0,
z: 1,
},
pos: { // 文字起点位置
x: 6.0,
y: 11.5,
z: 5.0,
},
content: '22', // 内容
},
}
],
}
]
}
const markManager = await cloud.getMarkManager()
var import = await markManager.addMarkByUrl('http://127.0.0.1/a')
//文件内参数 注:importLayer注释中包含六种标注的构建
{
"marks": [
{
"layerName": "焊点",
"markList": [
{
markStyle: {
type: 'textMark', // 标注类型
style: { // 标注样式
dimLineColor: '0xff87ceeb', // 标注线颜色
fontLabelStyle: { // 标牌样式
face: '宋体', // 字体
color: '0xff87ceeb', // 字体颜色
size: 30, // 字体大小,尽量靠近高度
fontLabelPos: 6, // 文字位置
backgroundColor: '0x00ff0000', // 背景颜色
height: 35, // 文字高度
textScale: 0.4, // 文字缩放系数
outLineColor: '0x00000000', // 字体轮廓线颜色
outLineWide: 0, // 字体轮廓线大小
borderColor: '0x00000000', // 边框线颜色
fontDir: 0, // 文字方向 0:从左到右,1:从右到左(仅对space(3D)标牌类型起作用)
fontOff: 0.01, // 文字偏移距离(仅对space(3D)标牌类型起作用)
},
labelType: 'space', // 标牌类型 "screen":2.5D标牌 "space":3D标牌(默认为3D标牌)
accuracy: 3, // 数字进度
geometryStyle: { // 几何体参数
cylinderRadius: 0.001, // 圆柱半径
rigthConeRadius: 0.002, // 圆锥半径
rigthConeHeight: 0.008, // 圆锥高度
},
},
skewLeadLength: 1, // 斜引线
flatLeadLength: 0.6, // 平引线,仅当平引线长度大于文字宽度时起作用
slopeAngle: 60, // 倾斜角度[0,180]
},
markData: {
type: 'textMark', // 标注类型
normalDir: { // 法线方向
x: 0,
y: 1,
z: 0,
},
extensionDir: { // 延申方向
x: 1,
y: 0,
z: 1,
},
pos: { // 文字起点位置
x: 6.0,
y: 11.5,
z: 5.0,
},
content: '22', // 内容
},
}
],
}
]
}
const markManager = await cloud.getMarkManager()
var import = await markManager.addMarkByUrl('http://127.0.0.1/a')
Parameters
Name | Type | Description |
---|---|---|
url | string | url地址 |
Returns
Promise
<null
| object
>
依次输出导入层中的标注是否成功创建,若无法ping通url或者文件参数中不包含层列表则直接返回false
addMarkByJson
▸ addMarkByJson(marks
): Promise
<null
| object
>
Details
根据标注json对象批量创建层以及层中的标注
Examples
调用示例:
注:importLayer注释中包含六种标注的构建
const marks = [
{
layerName: '焊点',
markList: [
{
markStyle: {
type: 'textMark', // 标注类型
style: { // 标注样式
dimLineColor: '0xff87ceeb', // 标注线颜色
fontLabelStyle: { // 标牌样式
face: '宋体', // 字体
color: '0xff87ceeb', // 字体颜色
size: 30, // 字体大小,尽量靠近高度
fontLabelPos: 6, // 文字位置
backgroundColor: '0x00ff0000', // 背景颜色
height: 35, // 文字高度
textScale: 0.4, // 文字缩放系数
outLineColor: '0x00000000', // 字体轮廓线颜色
outLineWide: 0, // 字体轮廓线大小
borderColor: '0x00000000', // 边框线颜色
fontDir: 0, // 文字方向 0:从左到右,1:从右到左(仅对space(3D)标牌类型起作用)
fontOff: 0.01, // 文字偏移距离(仅对space(3D)标牌类型起作用)
},
labelType: 'space', // 标牌类型 "screen":2.5D标牌 "space":3D标牌(默认为3D标牌)
accuracy: 3, // 数字进度
geometryStyle: { // 几何体参数
cylinderRadius: 0.001, // 圆柱半径
rigthConeRadius: 0.002, // 圆锥半径
rigthConeHeight: 0.008, // 圆锥高度
},
},
skewLeadLength: 1, // 斜引线
flatLeadLength: 0.6, // 平引线,仅当平引线长度大于文字宽度时起作用
slopeAngle: 60, // 倾斜角度[0,180]
},
markData: {
type: 'textMark', // 标注类型
normalDir: { // 法线方向
x: 0,
y: 1,
z: 0,
},
extensionDir: { // 延申方向
x: 1,
y: 0,
z: 1,
},
pos: { // 文字起点位置
x: 6.0,
y: 11.5,
z: 5.0,
},
content: '22', // 内容
},
},
],
},
];
const markManager = await cloud.getMarkManager()
var import = await markManager.addMarkByJson(marks)
注:importLayer注释中包含六种标注的构建
const marks = [
{
layerName: '焊点',
markList: [
{
markStyle: {
type: 'textMark', // 标注类型
style: { // 标注样式
dimLineColor: '0xff87ceeb', // 标注线颜色
fontLabelStyle: { // 标牌样式
face: '宋体', // 字体
color: '0xff87ceeb', // 字体颜色
size: 30, // 字体大小,尽量靠近高度
fontLabelPos: 6, // 文字位置
backgroundColor: '0x00ff0000', // 背景颜色
height: 35, // 文字高度
textScale: 0.4, // 文字缩放系数
outLineColor: '0x00000000', // 字体轮廓线颜色
outLineWide: 0, // 字体轮廓线大小
borderColor: '0x00000000', // 边框线颜色
fontDir: 0, // 文字方向 0:从左到右,1:从右到左(仅对space(3D)标牌类型起作用)
fontOff: 0.01, // 文字偏移距离(仅对space(3D)标牌类型起作用)
},
labelType: 'space', // 标牌类型 "screen":2.5D标牌 "space":3D标牌(默认为3D标牌)
accuracy: 3, // 数字进度
geometryStyle: { // 几何体参数
cylinderRadius: 0.001, // 圆柱半径
rigthConeRadius: 0.002, // 圆锥半径
rigthConeHeight: 0.008, // 圆锥高度
},
},
skewLeadLength: 1, // 斜引线
flatLeadLength: 0.6, // 平引线,仅当平引线长度大于文字宽度时起作用
slopeAngle: 60, // 倾斜角度[0,180]
},
markData: {
type: 'textMark', // 标注类型
normalDir: { // 法线方向
x: 0,
y: 1,
z: 0,
},
extensionDir: { // 延申方向
x: 1,
y: 0,
z: 1,
},
pos: { // 文字起点位置
x: 6.0,
y: 11.5,
z: 5.0,
},
content: '22', // 内容
},
},
],
},
];
const markManager = await cloud.getMarkManager()
var import = await markManager.addMarkByJson(marks)
Parameters
Name | Type | Description |
---|---|---|
marks | object | 标注json对象 |
Returns
Promise
<null
| object
>
依次输出导入层中的标注是否成功创建,若无法ping通url或者文件参数中不包含层列表则直接返回false
importLayer
▸ importLayer(layerName
, markList
): Promise
<object
>
Details
批量导入层中的标注
Examples
调用示例:
const markList = [
{
"markStyle": {
"type": "textMark",//标注类型
"style": {//标注样式
"dimLineColor": "0xff87ceeb",//标注线颜色
"fontLabelStyle": {//标牌样式
"face": "宋体",//字体
"color": "0xff87ceeb",//字体颜色
"size": 30,//字体大小,尽量靠近高度
"fontLabelPos": 6,//文字位置
"backgroundColor": "0x00ff0000",//背景颜色
"height": 35,//文字高度
"textScale": 0.4,//文字缩放系数
"outLineColor": "0x00000000",//字体轮廓线颜色
"outLineWide": 0,//字体轮廓线大小
"borderColor": "0x00000000",//边框线颜色
"fontDir": 0,//文字方向 0:从左到右,1:从右到左(仅对space(3D)标牌类型起作用)
"fontOff": 0.01//文字偏移距离(仅对space(3D)标牌类型起作用)
},
"labelType": "space",//标牌类型 "screen":2.5D标牌 "space":3D标牌(默认为3D标牌)
"accuracy": 3,//数字进度
"geometryStyle": {//几何体参数
"cylinderRadius": 0.001,//圆柱半径
"rigthConeRadius": 0.002,//圆锥半径
"rigthConeHeight": 0.008//圆锥高度
}
},
"skewLeadLength": 1,//斜引线
"flatLeadLength": 0.6,//平引线,仅当平引线长度大于文字宽度时起作用
"slopeAngle": 60//倾斜角度[0,180]
},
"markData": {
"type": "textMark",//标注类型
"normalDir": {//法线方向
"x": 0,
"y": 1,
"z": 0
},
"extensionDir": {//延申方向
"x": 1,
"y": 0,
"z": 1
},
"pos": {//文字起点位置
"x": 6.0,
"y": 11.5,
"z": 5.0
},
"content": "22"//内容
}
},
{
"markStyle": {
"type": "linesMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"bDummyLine": false//是否设置为虚线
},
"markData": {
"type": "linesMark",
"lines": [//线的点,每一组为一条直线
[
{
"x": 6.0,
"y": 11.0,
"z": 5.0
},
{
"x": 6.0,
"y": 11.5,
"z": 5.0
}
],
[
{
"x": 6.0,
"y": 11.5,
"z": 5.0
},
{
"x": 7,
"y": 11.5,
"z": 5.0
}
]
],
"normalDir": {//文字法向
"x": 0,
"y": 1,
"z": 0
},
"extensionDir": {//文字延申方向
"x": 1,
"y": 1,
"z": 1
},
"textPos": {//文字位置
"x": 6.0,
"y": 11.5,
"z": 5.0
},
"content": "22"//文字内容
}
},
{
"markStyle": {
"type": "otherMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
}
},
"markData": {
"type": "otherMark",
"geometry": {//几何体集合
"lines": [//多线段,每一组为连续直线
[
{
"x": 6.0,
"y": 11.0,
"z": 5.0
},
{
"x": 6.0,
"y": 11.5,
"z": 5.0
},
{
"x": 7.0,
"y": 11.5,
"z": 5.0
}
],
[
{
"x": 7.0,
"y": 11.5,
"z": 5.0
},
{
"x": 8.0,
"y": 11.5,
"z": 5.0
}
]
],
"text":[//文字列表
{
"content": "7777777777",//内容
"textEulerAngle": {//文字欧拉角
"heading": 0.0,
"pitch": -180.0,
"roll": 0.0
},
"textPos": {//文字位置
"x": 8.0,
"y": 11.5,
"z": 5.0
},
"textScale":0.001,//文字缩放系数
"textLabelPos":7//文字位置
}
]
}
}
},
{
"markStyle": {
"type": "lengthMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"leadLength": 0,//引线长度
"showRatio": 0.5,//示比例,当传入leadLength值为0时,起作用
"unit": "m"//单位
},
"markData": {
"type": "lengthMark",
"normalDir": {//法向
"x": 0,
"y": 1,
"z": 1
},
"startPos": {//起点
"x": 6.0,
"y": 11.5,
"z": 5.0
},
"endPos": {//终点
"x": 8.0,
"y": 11.5,
"z": 5.0
}
}
},
{
"markStyle": {
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"leadLength": 0.0,//引线长度
"unit": "m",//单位
"type": "radiusMark"
},
"markData": {
"type": "radiusMark",
"normalDir": {//法向
"x": 1,
"y": 0,
"z": 0
},
"centerPos": {//圆心位置
"x": 4.005,
"y": 11.00,
"z": 6.0
},
"onCirclePos": {//圆上一点位置
"x": 4.005,
"y": 11.059,
"z": 5.909
}
}
},
{
"markStyle": {
"type": "angleMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"rayLength": 0.0,//射线长度,为0时,取最长角度线为射线长度
"showRatio": 0.5,//弧线显示位置比例,弧线与角的顶点距离和射线长度的比例
"unit": "degrees"//单位,'degrees'(度分秒)、'decimalDegrees'(十进制)
},
"markData": {
"type": "angleMark",
"normalDir": {//法向
"x": 0,
"y": 1,
"z": 0
},
"pos": [//构成角度的三个点
{
"x": 6.0,
"y": 11.5,
"z": 5.0
},
{
"x": 8.0,
"y": 11.5,
"z": 5.0
},
{
"x": 6.0,
"y": 11.5,
"z": 3.0
}
]
}
}
]
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.importLayer('1',markList)
const markList = [
{
"markStyle": {
"type": "textMark",//标注类型
"style": {//标注样式
"dimLineColor": "0xff87ceeb",//标注线颜色
"fontLabelStyle": {//标牌样式
"face": "宋体",//字体
"color": "0xff87ceeb",//字体颜色
"size": 30,//字体大小,尽量靠近高度
"fontLabelPos": 6,//文字位置
"backgroundColor": "0x00ff0000",//背景颜色
"height": 35,//文字高度
"textScale": 0.4,//文字缩放系数
"outLineColor": "0x00000000",//字体轮廓线颜色
"outLineWide": 0,//字体轮廓线大小
"borderColor": "0x00000000",//边框线颜色
"fontDir": 0,//文字方向 0:从左到右,1:从右到左(仅对space(3D)标牌类型起作用)
"fontOff": 0.01//文字偏移距离(仅对space(3D)标牌类型起作用)
},
"labelType": "space",//标牌类型 "screen":2.5D标牌 "space":3D标牌(默认为3D标牌)
"accuracy": 3,//数字进度
"geometryStyle": {//几何体参数
"cylinderRadius": 0.001,//圆柱半径
"rigthConeRadius": 0.002,//圆锥半径
"rigthConeHeight": 0.008//圆锥高度
}
},
"skewLeadLength": 1,//斜引线
"flatLeadLength": 0.6,//平引线,仅当平引线长度大于文字宽度时起作用
"slopeAngle": 60//倾斜角度[0,180]
},
"markData": {
"type": "textMark",//标注类型
"normalDir": {//法线方向
"x": 0,
"y": 1,
"z": 0
},
"extensionDir": {//延申方向
"x": 1,
"y": 0,
"z": 1
},
"pos": {//文字起点位置
"x": 6.0,
"y": 11.5,
"z": 5.0
},
"content": "22"//内容
}
},
{
"markStyle": {
"type": "linesMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"bDummyLine": false//是否设置为虚线
},
"markData": {
"type": "linesMark",
"lines": [//线的点,每一组为一条直线
[
{
"x": 6.0,
"y": 11.0,
"z": 5.0
},
{
"x": 6.0,
"y": 11.5,
"z": 5.0
}
],
[
{
"x": 6.0,
"y": 11.5,
"z": 5.0
},
{
"x": 7,
"y": 11.5,
"z": 5.0
}
]
],
"normalDir": {//文字法向
"x": 0,
"y": 1,
"z": 0
},
"extensionDir": {//文字延申方向
"x": 1,
"y": 1,
"z": 1
},
"textPos": {//文字位置
"x": 6.0,
"y": 11.5,
"z": 5.0
},
"content": "22"//文字内容
}
},
{
"markStyle": {
"type": "otherMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
}
},
"markData": {
"type": "otherMark",
"geometry": {//几何体集合
"lines": [//多线段,每一组为连续直线
[
{
"x": 6.0,
"y": 11.0,
"z": 5.0
},
{
"x": 6.0,
"y": 11.5,
"z": 5.0
},
{
"x": 7.0,
"y": 11.5,
"z": 5.0
}
],
[
{
"x": 7.0,
"y": 11.5,
"z": 5.0
},
{
"x": 8.0,
"y": 11.5,
"z": 5.0
}
]
],
"text":[//文字列表
{
"content": "7777777777",//内容
"textEulerAngle": {//文字欧拉角
"heading": 0.0,
"pitch": -180.0,
"roll": 0.0
},
"textPos": {//文字位置
"x": 8.0,
"y": 11.5,
"z": 5.0
},
"textScale":0.001,//文字缩放系数
"textLabelPos":7//文字位置
}
]
}
}
},
{
"markStyle": {
"type": "lengthMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"leadLength": 0,//引线长度
"showRatio": 0.5,//示比例,当传入leadLength值为0时,起作用
"unit": "m"//单位
},
"markData": {
"type": "lengthMark",
"normalDir": {//法向
"x": 0,
"y": 1,
"z": 1
},
"startPos": {//起点
"x": 6.0,
"y": 11.5,
"z": 5.0
},
"endPos": {//终点
"x": 8.0,
"y": 11.5,
"z": 5.0
}
}
},
{
"markStyle": {
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"leadLength": 0.0,//引线长度
"unit": "m",//单位
"type": "radiusMark"
},
"markData": {
"type": "radiusMark",
"normalDir": {//法向
"x": 1,
"y": 0,
"z": 0
},
"centerPos": {//圆心位置
"x": 4.005,
"y": 11.00,
"z": 6.0
},
"onCirclePos": {//圆上一点位置
"x": 4.005,
"y": 11.059,
"z": 5.909
}
}
},
{
"markStyle": {
"type": "angleMark",
"style": {
"dimLineColor": "0xff87ceeb",
"fontLabelStyle": {
"face": "宋体",
"color": "0xff87ceeb",
"size": 30,
"fontLabelPos": 6,
"backgroundColor": "0x00ff0000",
"height": 35,
"textScale": 0.4,
"outLineColor": "0x00000000",
"outLineWide": 0,
"borderColor": "0x00000000",
"fontDir": 0,
"fontOff": 0.01
},
"labelType": "space",
"accuracy": 3,
"geometryStyle": {
"cylinderRadius": 0.001,
"rigthConeRadius": 0.002,
"rigthConeHeight": 0.008
}
},
"rayLength": 0.0,//射线长度,为0时,取最长角度线为射线长度
"showRatio": 0.5,//弧线显示位置比例,弧线与角的顶点距离和射线长度的比例
"unit": "degrees"//单位,'degrees'(度分秒)、'decimalDegrees'(十进制)
},
"markData": {
"type": "angleMark",
"normalDir": {//法向
"x": 0,
"y": 1,
"z": 0
},
"pos": [//构成角度的三个点
{
"x": 6.0,
"y": 11.5,
"z": 5.0
},
{
"x": 8.0,
"y": 11.5,
"z": 5.0
},
{
"x": 6.0,
"y": 11.5,
"z": 3.0
}
]
}
}
]
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.importLayer('1',markList)
Parameters
Name | Type | Description |
---|---|---|
layerName | null | string | 层名 |
markList | object | 标注参数列表 |
Returns
Promise
<object
>
每一个层中所有标注的参数及层名
exportAllLayer
▸ exportAllLayer(): Promise
<object
>
Details
获取所有层的参数
Examples
调用示例:
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.exportAllLayer()
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.exportAllLayer()
Returns
Promise
<object
>
每一个层中所有标注的参数及层名
drawLengthMark
▸ drawLengthMark(layerName
, markStyle
): Promise
<object
>
Details
开启长度标注交互绘制
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const lengthStyle: LengthMarkStyle = {
type: "lengthMark",
style: markStyle,
leadLength: 1,
showRatio: 0.6,
unit: "m"
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawLengthMark(null,lengthStyle)
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const lengthStyle: LengthMarkStyle = {
type: "lengthMark",
style: markStyle,
leadLength: 1,
showRatio: 0.6,
unit: "m"
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawLengthMark(null,lengthStyle)
Parameters
Name | Type | Description |
---|---|---|
layerName | null | string | 层名 |
markStyle | null | LengthMarkStyle | 样式 |
Returns
Promise
<object
>
无
drawRadiusMark
▸ drawRadiusMark(layerName
, markStyle
): Promise
<object
>
Details
开启半径标注交互绘制
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const radiusStyle: RadiusMarkStyle = {
type: "radiusMark",
style: markStyle,
leadLength: 1,
unit: "m"
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawRadiusMark(null,radiusStyle)
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const radiusStyle: RadiusMarkStyle = {
type: "radiusMark",
style: markStyle,
leadLength: 1,
unit: "m"
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawRadiusMark(null,radiusStyle)
Parameters
Name | Type | Description |
---|---|---|
layerName | null | string | 层名 |
markStyle | null | RadiusMarkStyle | 样式 |
Returns
Promise
<object
>
无
drawTextMark
▸ drawTextMark(layerName
, markStyle
, content
): Promise
<object
>
Details
开启文字标注交互绘制
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawTextMark(null,textStyle,'Hello World!')
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const textStyle: TextMarkStyle = {
type: "textMark",
skewLeadLength: 1,
flatLeadLength: 0.6,
slopeAngle: 60
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawTextMark(null,textStyle,'Hello World!')
Parameters
Name | Type | Description |
---|---|---|
layerName | null | string | 层名 |
markStyle | null | TextMarkStyle | 样式 |
content | null | string | 文本内容 |
Returns
Promise
<object
>
无
drawAngleMark
▸ drawAngleMark(layerName
, markStyle
): Promise
<object
>
Details
开启角度标注交互绘制
Examples
调用示例:
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const angletyle: AngleMarkStyle = {
type: "angleMark",
rayLength: 1,
showRatio: 0.6,
unit: "degrees"
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawAngleMark(null,angletyle)
const markStyle: MarkUniversalStyle = {
dimLineColor: 0xffff0000,
fontLabelStyle: {
face: '宋体',
color: 0xffffff00,
size: 30,
fontLabelPos: 6,
backgroundColor: 0xeeff0000,
height: 35,
textScale: 0.4,
outLineColor: 0xff000000,
outLineWide: 0,
borderColor: 0xffff0000,
fontDir:0,
fontOff:0.01
},
labelType: 'space',
accuracy: 3,
geometryStyle: {
cylinderRadius: 0.01,
rigthConeRadius: 0.02,
rigthConeHeight: 0.10
}
}
const angletyle: AngleMarkStyle = {
type: "angleMark",
rayLength: 1,
showRatio: 0.6,
unit: "degrees"
}
const markManager = await cloud.getMarkManager()
var layerParam = await markManager.drawAngleMark(null,angletyle)
Parameters
Name | Type | Description |
---|---|---|
layerName | null | string | 层名 |
markStyle | null | AngleMarkStyle | 样式 |
Returns
Promise
<object
>
无
loadMarkFromWlkx
▸ loadMarkFromWlkx(): Promise
<any
>
Details
加载wlkx中存在的标注
Examples
调用示例:
const markManager = await cloud.getMarkManager()
await markManager.loadMarkFromWlkx()
const markManager = await cloud.getMarkManager()
await markManager.loadMarkFromWlkx()
Returns
Promise
<any
>
无
setMarkSelected
▸ setMarkSelected(fn
): void
Details
设置标注拾取的回调函数
Examples
调用示例:
function SetMarkSelected(mark: MarkObject) {
console.log(mark)
}
cloud.markManager.setMarkSelected(SetMarkSelected)
function SetMarkSelected(mark: MarkObject) {
console.log(mark)
}
cloud.markManager.setMarkSelected(SetMarkSelected)
Parameters
Name | Type | Description |
---|---|---|
fn | (mark : MarkObject ) => void | 回调函数,mark为标注 |
Returns
void