Appearance
特效地标图操作
目录
1. 添加特效地标图
引入版本:3.0 起支持
功能描述
在三维场景中添加特效地标图
调用方法
JavaScript
let jsonData = {
id: '3DMarkerLayerId',
coordType: 0,
coordTypeZ: 0,
snapSurface: 0,
alpha: 1,
markerMaxDistance: 7500,
iconMaxDistance: 10000,
markerLandmarkDataId: 'id3DMarkerLandmarkData1',
visible: true,
legends: [
{
name: 'legendName1',
markerType: 'Revolve02',
scale: 150,
iconName: 'icon1',
titleColor: '#ffffff',
titleBackgroundColor: '#333333',
},
{
name: 'legendName2',
markerType: 'Revolve04',
scale: 150,
iconName: 'icon1',
titleColor: '#ffffff',
titleBackgroundColor: '#333333',
},
{
name: 'legendName3',
markerType: 'Revolve06',
scale: 150,
iconName: 'icon1',
titleColor: '#ffffff',
titleBackgroundColor: '#333333',
},
],
data: [
{
id: 'objId1',
titleText: '标题',
coord: [114.079516146565,22.5571223225079],
coordZ: -0.5,
rotation: [0, 0, 0],
type: 'legendName1',
},
{
id: 'objId2',
titleText: '标题',
coord: [114.084516146565,22.5571223225079],
coordZ: -0.5,
rotation: [0, 0, 0],
type: 'legendName2',
},
{
id: 'objId3',
titleText: '标题',
coord: [114.089516146565,22.5571223225079],
coordZ: -0.5,
rotation: [0, 0, 0],
type: 'legendName3',
},
],
};
appInstance.uniCall(
'clearOverlayType',
{
overlayType: '3DMarkerLandmarkLayer',
},
result => {
console.log(result);
}
);
appInstance.uniCall('add3DMarkerLandmarkLayer', jsonData, result => {
console.log(result);
if (result.result === 1) {
appInstance.uniCall(
'focusById',
{
id: '3DMarkerLayerId',
overlayType: '3DMarkerLandmarkLayer',
distance: 2000,
},
focusResult => {
console.log(focusResult);
}
);
}
});参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| id | String | 模型对象 id,新建时调用者自己传入的唯一标识,用于各种操作的对象识别 |
| coordType | Number | XY 轴坐标类别,0:X 经度,Y 纬度;1:X 米,Y 米,相对世界 00 点 |
| coordTypeZ | Number | Z 轴坐标类别,0:相对 3D 世界 0 海拔;1:相对 3D 世界地表;2:相对 3D 模型表面(单位:米) |
| snapSurface | Number | 启用自动贴地 |
| alpha | Number | 透明度,0:完全透明;1:完全不透明 |
| markerMaxDistance | Number | 特效最大可见距离(单位:米),不可见后显示 icon |
| iconMaxDistance | Number | icon 最大可见距离(单位:米),不可见后隐藏 |
| markerLandmarkDataId | String | 对应本服务器上 3DMarkerLandmark 数据 Id,如果找到 id,则下方的 data 不起作用 |
| visible | Boolean | 添加当前图层时默认显示还是隐藏 |
| name | String | 图层内图例名称,新建时调用者自己传入的唯一名称,用于各种操作的图例识别 |
| markerType | String | 特效样式类别 Radar01 Revolve01 Revolve02 Revolve03 Revolve04 Spread01 Spread02 Spread03 Spread04 Spread05 Spread06 Spread07 Spread08 Spread09 Square01 |
| scale | Number | 整体放缩倍数(单位:倍) |
| iconName | String | 内置图标名称,或根据项目,在场景中预置好的图标对象的名称,包含文字样式定义,具体图标名称参考下表和下图册 |
| titleColor | String | 特效标签文本颜色,可选值,默认白色 |
| titleBackgroundColor | String | 特效标签文本背景颜色,可选值,默认灰色 |
| id | String | 特效对象 id,新建时调用者自己传入的唯一标识,用于各种操作的对象识别 |
| titleText | String | 特效标签文本 |
| coord | Array | XY 轴坐标,X:经度;Y:纬度 |
| coordZ | Number | Z 轴高度(单位:米) |
| rotation | Array | XYZ 三轴旋转度数 [偏航角(单位:角度,0 正北, -360 ~ 360),俯仰角(单位:角度,0 水平, -360 ~ 360),翻滚角(单位:角度,0 水平, -360 ~ 360)] |
| type | String | 特效图例类别 |
| overlayType | String | 覆盖物类型,支持 all |
回调数据
JSON
{
"result": 1,
"message": "成功。"
}回调数据参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| result | Number | 1:代表成功;0:代表失败 |
| message | String | 成功或者失败原因 |
具体内置图标名称(iconName)详情
| 图标类型 | 图标名称 |
|---|---|
| 市政设施 | camera |
| streetlamp | |
| manholecover | |
| sensor | |
| utilitypole | |
| transmission | |
| broadcast | |
| wifi | |
| firehydrant | |
| equipmentbox | |
| trafficlight | |
| charge | |
| gasstation | |
| wc | |
| dustbin | |
| 地点建筑 | trainstation |
| airport | |
| anchor | |
| government | |
| netpoint | |
| metro | |
| finance | |
| school | |
| hospital | |
| factory | |
| constructionsite | |
| residence | |
| mergencyshelter | |
| park | |
| diningroom | |
| warehouse | |
| store | |
| tollgate | |
| officebuilding | |
| busstation | |
| 人员 | people |
| policeman | |
| doctor | |
| specialpeople | |
| criminal | |
| 交通 | car |
| policecar | |
| fireengine | |
| ambulance | |
| taxi | |
| truck | |
| bus | |
| newscar | |
| militarycar | |
| municipal | |
| electriccar | |
| watercar | |
| train | |
| ship | |
| cargoship | |
| 飞行器 | airplane |
| helicopter | |
| uav | |
| satellite | |
| rocket | |
| 事件 | event_01 |
| event_03 | |
| event_03 | |
| 通用 | icon_01 |
| icon_02 | |
| icon_03 | |
| icon_04 | |
| 地名 | site_01 |
| site_02 | |
| site_03 |
具体内置图标名称(iconName)效果
![]()
2. 更新特效地标图数据
引入版本:3.3 起支持
功能描述
更新三维场景中添加特效地标图的数据
调用方法
JavaScript
let jsonData = {
id: '3DMarkerLayerId',
coordType: 0,
coordTypeZ: 0,
data: [
{
id: 'objId1',
titleText: '标题1',
coord: [114.083816146565,22.5571223225079],
coordZ: -0.5,
rotation: [0, 0, 0],
type: 'legendName1',
},
{
id: 'objId2',
titleText: '标题2',
coord: [114.088816146565,22.5571223225079],
coordZ: -0.5,
rotation: [0, 45, 0],
type: 'legendName2',
},
{
id: 'objId3',
titleText: '标题3',
coord: [114.09381614656499,22.5571223225079],
coordZ: -0.5,
rotation: [0, 0, 0],
type: 'legendName3',
},
],
};
appInstance.uniCall('update3DMarkerLandmarkLayerCoord', jsonData, result => {
console.log(result);
});参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| id | String | 模特效对象图层 id,新建时调用者自己传入的唯一标识,用于各种操作的对象识别 |
| coordType | Number | XY 轴坐标类别,0:X 经度,Y 纬度;1:X 米,Y 米,相对世界 00 点 |
| coordTypeZ | Number | Z 轴坐标类别,0:相对 3D 世界 0 海拔;1:相对 3D 世界地表;2:相对 3D 模型表面(单位:米) |
| id | String | 特效对象 id,新建时调用者自己传入的唯一标识,用于各种操作的对象识别 |
| titleText | String | 特效标签文本 |
| coord | Array | XY 轴坐标,X:经度;Y:纬度 |
| coordZ | Number | Z 轴高度(单位:米) |
| rotation | Array | XYZ 三轴旋转度数 [偏航角(单位:角度,0 正北, -360 ~ 360),俯仰角(单位:角度,0 水平, -360 ~ 360),翻滚角(单位:角度,0 水平, -360 ~ 360)] |
| type | String | 特效图例类别 |
回调数据
JSON
{
"result": 1,
"message": "成功。"
}回调数据参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| result | Number | 1:代表成功;0:代表失败 |
| message | String | 成功或者失败原因 |
3. 更新特效地标图样式
引入版本:3.3 起支持
功能描述
更新三维场景中添加特效地标图的样式
调用方法
JavaScript
let jsonData = {
id: '3DMarkerLayerId',
alpha: 1,
markerMaxDistance: 7500,
iconMaxDistance: 10000,
legends: [
{
name: 'legendName1',
markerType: 'Spread04',
scale: 125,
iconName: '摄像头',
titleColor: '#ffffff',
titleBackgroundColor: '#333333',
},
{
name: 'legendName2',
markerType: 'Spread05',
scale: 125,
iconName: '摄像头',
titleColor: '#ffffff',
titleBackgroundColor: '#333333',
},
{
name: 'legendName3',
markerType: 'Spread06',
scale: 125,
iconName: '摄像头',
titleColor: '#ffffff',
titleBackgroundColor: '#333333',
},
],
};
appInstance.uniCall('update3DMarkerLandmarkLayerStyle', jsonData, result => {
console.log(result);
});参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| id | String | 特效对象图层 id,新建时调用者自己传入的唯一标识,用于各种操作的对象识别 |
| alpha | Number | 透明度,0:完全透明;1:完全不透明 |
| markerMaxDistance | Number | 特效最大可见距离(单位:米),不可见后显示 icon |
| iconMaxDistance | Number | icon 最大可见距离(单位:米),不可见后隐藏 |
| name | String | 图层内图例名称,新建时调用者自己传入的唯一名称,用于各种操作的图例识别 |
| markerType | String | 特效样式类别 Radar01 Revolve01 Revolve02 Revolve03 Revolve04 Spread01 Spread02 Spread03 Spread04 Spread05 Spread06 Spread07 Spread08 Spread09 Square01 |
| scale | Number | 整体放缩倍数(单位:倍) |
| iconName | String | 内置图标名称,见图观官网统一 API 开发手册 |
| titleColor | String | 特效标签文本颜色,可选值,默认白色 |
| titleBackgroundColor | String | 特效标签文本背景颜色,可选值,默认灰色 |
回调数据
JSON
{
"result": 1,
"message": "成功。"
}回调数据参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| result | Number | 1:代表成功;0:代表失败 |
| message | String | 成功或者失败原因 |
4. 删除特效地标图
引入版本:3.0 起支持
功能描述
删除特效地标图
调用方法
JavaScript
let jsonData = {
id: '3DMarkerLayerId',
overlayType: '3DMarkerLandmarkLayer',
};
appInstance.uniCall('removeOverlay', jsonData, (result) => {
console.log(result);
});参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| id | String | 图层对象 id,新建时调用者自己传入的唯一标识,用于各种操作的对象识别 |
| overlayType | String | 图层对象类别 |
回调数据
JSON
{
"result": 1,
"message": "成功。"
}回调数据参数描述
| 属性 | 类型 | 说明 |
|---|---|---|
| result | Number | 1:代表成功;0:代表失败 |
| message | String | 成功或者失败原因 |