天天热文:nVisual二次开发--关于视图内对象的获取

nVisual作为一个图形化管理软件,首要的是将视图内对象渲染出来,对象渲染的数据来源于diagram接口,本章小编带大家了解这个接口。


【资料图】

接口描述:传入视图节点id,获取视图属性、视图背景、视图内对象数据

URL地址:http://ip:port /wapi/v1/diagram/{diagramId}

访问方法::Get

样例传参:

常规视图:

localhost:8081/wapi/v1/diagram/24000000000001

地图:

localhost:8081/wapi/v1/diagram/24000000173161?top_left_x=12004144.930958997&top_left_y=5606184.75128747&bottom_right_x=13607488.03626885&bottom_right_y=4196074.4534825375&map_zoom=8&map_maxZoom=19

接口会根据传参返回当前视图要加载的数据的一切,包含:当前视图层级、视图权限、视图背景图片、视图宽高、视图比例、视图类型、内部节点对象、内部连线对象等…

返回成功样例

{

"code": 200,

"breadcrumbs": [

"顶层",

"测试学习",

"zyb",

"节点",

"学校",

"node"

],

"node_diagram": {

"id": 24000000160302,

"typeId": 26000000000000,

"parentId": 24000000151465,

"name": "node",

"background": "",

"route": "24000000000001/24000000019900/24000000151441/24000000151463/24000000151465/24000000160302",

"diagramWidth": 1000,

"diagramHeight": 750,

"diagramMarginSize": null,

"hidden": null,

"slotId": null,

"masterId": null,

"insertUserId": 94000000000300,

"templateId": null,

"adaNodeId": null,

"connectorCode": null,

"rackOverrideType": null,

"showContainerChildren": true,

"doubleClickBehavior": "default",

"mapCoordinateLeft": null,

"mapCoordinateTop": null,

"mapCoordinateRight": null,

"mapCoordinateBottom": null,

"mapUnitsType": null,

"dinamicMapSupport": null,

"autoLayoutState": null,

"mapSource": null,

"displayGrid": null,

"snapToGrid": null,

"gridSpacingY": null,

"gridSpacingX": null,

"pageColor": "#FFFFFF",

"overrideTemplateGrid": null,

"readOnlyForNonAdmins": null,

"collectorId": null,

"diagramScale": 10,

"mapZoom": 3,

"blocked": false

},

"node_type_diagram": {

"id": 26000000000000,

"name": "node",

"image": "xejh0pfy.svg",

"image2": "",

"background": "",

"defaultWidth": 117.12777191129884,

"defaultHeight": 117.12777191129884,

"typeGroup": 1,

"hierarchyBrowserLabel": 28000000003736,

"width": 50,

"height": 50,

"templateId": null,

"vendorId": 880,

"description": "节点",

"keepAspectRatio": true,

"showContainerChildren": false,

"doubleClickBehavior": "test",

"categoryId": null,

"snmpOid": "",

"independentMounting": false,

"inStock": -1,

"nodeClassGroupId": 110012,

"nodeClassId": null,

"creator": null,

"createDate": null,

"deep": 0,

"enabled": true,

"system": true,

"favourite": true

},

"vis_links": [

{

"linkId": 25000000114815,

"typeId": 27000000000060,

"name": " ",

"fromNode": 24000000160303,

"toNode": 24000000160304,

"fromRoute": "24000000000001/24000000019900/24000000151441/24000000151463/24000000151465/24000000160302/24000000160303",

"toRoute": "24000000000001/24000000019900/24000000151441/24000000151463/24000000151465/24000000160302/24000000160304",

"visLinkId": 211307,

"diagramId": 24000000160302,

"routepath": null,

"fromAnchorPointX": 0.5,

"fromAnchorPointY": 0.5,

"toAnchorPointX": 0.5,

"toAnchorPointY": 0.5,

"canDelete": true,

"canMove": true,

"displayed": true,

"color": "#cb5b06",

"thickness": 1,

"htLinkType": "{\"linkType\":null,\"startArrowHead\":null,\"endArrowHead\":null,\"autoArrangement\":false}",

"displayedVisLinkFields2": [],

"table": []

}

],

"vis_nodes": [

{

"id": 2550947,

"nodeId": 24000000160303,

"diagramId": 24000000160302,

"x": 217.5785183006974,

"y": 241.13354846368617,

"width": 116.70357514917723,

"height": 160.25068415238206,

"imageOverride": null,

"keepAspectRatio": false,

"angle": 0,

"canMove": true,

"canResize": true,

"canRotate": true,

"canDelete": true,

"zOrder": 0,

"displayed": true,

"typeId": 26000000000000,

"name": "node",

"parentId": 24000000160302,

"slotId": null,

"masterId": null,

"route": "24000000000001/24000000019900/24000000151441/24000000151463/24000000151465/24000000160302/24000000160303",

"mapZoom": 3,

"nodeTypeName": "node",

"nodeTypeImage": "xejh0pfy.svg",

"nodeTypeTypeGroup": 1,

"nodeTypeHeight": 50,

"nodeTypeWidth": 50,

"mountedNodesData": null,

"displayedVisNodeFields": null,

"shapes": null,

"diagramSublink": null,

"diagramSublinks": null,

"unitsHeight": null,

"hasEmbeddedFile": false,

"clusterSize": null,

"table": [],

"blocked": false,

"master": true,

"cluster": null

},

],

"ports": [],

"containerChildren": [],

"slots": [],

"diagram_properties": {

"racks_count": 0,

"nodes_count": 2,

"devices_count": 0,

"links_count": 1

},

"diagram_node_properties": [

{

"propertyId": 28000000003736,

"nodeTypeId": 26000000000000,

"name": "名称",

"defaultValue": "%template%0",

"position": 0,

"mandatory": true,

"displayed": false,

"fontSize": 12,

"fontColor": "#000000",

"notEditable": false,

"offsetX": 0,

"offsetY": 0,

"angle": 0,

"anchorPointX": 1,

"anchorPointY": 1,

"bold": false,

"italic": false,

"underline": false,

"fontFamily": "Arial",

"fillColor": "",

"align": 0,

"lockList": false,

"justification": 0,

"snmpOid": "",

"propertyValueId": 5820681,

"nodeId": 24000000160302,

"value": "node",

"hasPropertyValue": true,

"nodeOverrides": [],

"visNodeFields": {

"visNodeId": 2550946,

"propertyValueId": 5820681,

"offsetY": 0,

"offsetX": 0,

"fontSize": 4.1208791208791204,

"canMove": true,

"color": "#000000",

"state": false,

"angle": 0,

"bold": false,

"italic": false,

"underline": false,

"fontFamily": "Arial",

"backgroundColor": "#FFFFFF",

"align": false,

"anchor": false,

"uprightAlignment": null,

"justification": false,

"mapZoom": 3,

"new": true

},

"system": false,

"inProperties": true,

"typeField": false,

"uniqueForThisType": false,

"uniqueForAllTypes": false

},

],

"free_texts": [],

"diagram_permissions": "Admin"

}

文:李杨帆


关键词: 背景图片 首要的是 视图类型

推荐DIY文章
主机存在磨损或划痕风险 PICO4便携包宣布召回
穿越湖海!特斯拉Cybertruck电动皮卡可以当“船”用
vivoXFold+折叠旗舰开售 配备蔡司全焦段旗舰四摄
飞凡R7正式上市 全系标配换电架构
中兴Axon30S开售 拥有黑色蓝色两款配色
荣耀MagicBookV14 2022正式开售 搭载TOF传感器
it