2.1.6、拓扑链接
文章插图
拓扑图主要在管线的走向,这里走向较多,只列举一个
//创建路径var path=[{"x":0,"y":0,"z":0},{"x":0,"y":0,"z":-150},{"x":0,"y":-1,"z":-150},{"x":0,"y":-250,"z":-150},{"x":-1,"y":-250,"z":-150},{"x":-350,"y":-250,"z":-150},{"x":-350,"y":-250,"z":-149},{"x":-350,"y":-250,"z":30},{"x":-350,"y":-251,"z":30},{"x":-350,"y":-680,"z":30}];
var model={"show":true,"uuid":"","name":"dev_flowtube_2_3","objType":"flowTube","points":path,"position":{"x":1560.492,"y":976.703,"z":605.466},"scale":{"x":1,"y":1,"z":1},"rotation":[{"direction":"x","degree":0},{"direction":"y","degree":0},{"direction":"z","degree":0}],"style":{"skinColor":16772846,"imgurl":"../../img/3dImg/lightL2.png","opacity":1,"canvasSkin":{"cwidth":512,"cheight":8,"cwNub":16,"chNub":2,"cMarginW":0.5,"cMarginH":0,"speed":2,"fps":40,"direction":"w","forward":"f","side":1,"run":true,"bgcolor":"rgba(0,221,255,0.39)"}},"segments":9,"radialSegments":6,"closed":false,"radius":2,"showSortNub":100,"customType1":"","customType2":"","animation":null,"dbclickEvents":null,"BindDevId":null,"BindDevName":null,"devInfo":null,"BindMeteId":null,"BindMeteName":null,"copyFrom":"dev_flowtube_2_2"}
//创建模型
WT3Dobj.createLineByModelJSon(model)
2.2、数据接入
2.2.1、创建Ajax请求通用库
var httpInvoke = function (url, type, data, successCb, failedCb, userData, async) {return $.ajax({url: url,type: type,data: data,headers: {},async: async,times: 0,beforeSend: function (request) { },success: function (response, status, hreq) {if(response.code==401){//写这里layer.msg('登录失效,请重新登录~')window.location.href = 'https://www.huyubaike.com/jigongly/login'return}if (successCb != null) {successCb(response, status, userData);}},error: function (err) {console.log(err);if (failedCb != null) {failedCb(err.statusCode(), userData);}}})}2.2.2、创建API仓库
function WebAPI() {this.serverHead = "";this.serverHead2 = "";/*站点介绍/station空调系统/air?name=1-1消防系统/fire-ctrl?name=1-1PCS系统/pcs?name=1-1电池柜基本信息/battery-basic?name=1-1/3Dapi/cnz/battery-power?name=1-1月电量趋势图/electric-month充放电功率/dis-chargeSOC/soc月收益趋势图/profit-month日负荷曲线/load*/this.urls = {station: this.serverHead2+"/station",airConditioner: this.serverHead2+"/air",fireControl: this.serverHead2 +"/fire-ctrl",pcs: this.serverHead2+"/pcs",batteryCabinetBasic: this.serverHead2 + "/battery-basic",batteryPower: this.serverHead2 + "/battery-power",powerMonth: this.serverHead2 + "/electric-month",chargeDischarge: this.serverHead2 + "/dis-charge",so: this.serverHead2 + "/soc",profitmonth: this.serverHead2 + "/profit-month",load: this.serverHead2 + "/load",surplus: this.serverHead2 + "/surplus-power/",hostPowerMonth: this.serverHead2+"/ac/host-power-month",powerYear: this.serverHead2+"/ac/power-year",abstract: this.serverHead2+"/ac/abstract",consumptionDay: this.serverHead2+"/consumption-day/",chargeDay: this.serverHead2+"/charge-day/",temperatures: "../demoData/tempTureData.json",//}}例如请求温度信息:
WebAPI.prototype.TempsCache = {};WebAPI.prototype.getTemptureValue = https://www.huyubaike.com/biancheng/function (sunFunc) {var _this = this;var url = this.serverHead + this.urls.temperatures +"?positionId=" + _this.roomid;httpGet(url, function (response) {if (response && response.data && sunFunc) {if (response.data && response.data.length > 0) {$.each(response.data, function (_index, _obj) {_obj.id = _obj.name;_obj.type = 0;_obj.temptureValue = https://www.huyubaike.com/biancheng/_obj.t1MValue;_obj.temptureValueUp = _obj.t1UValue;_obj.temptureValueDown = _obj.t1DValue;_obj.lastUptime = new Date().getTime();_obj.allBearing = 0;_this.TempsCache["temp_" + _obj.name] = _obj});}sunFunc(response.data);/*{"pbPValue":1.40,"paIValue":5.32,"t1DValue":21.20,"paVValue":231.10,"t1MValue":21.70,"t2MValue":22.81,"t2UValue":25.25,"positionId":18,"assetId":1449,"t1UValue":23.68,"name":"M211-01-01-01","t2DValue":21.11,"id":1,"pbIValue":6.07,"pbVValue":231.20,"paPValue":1.22}*/}}, function () {layer.msg("获取数据异常");});}
经验总结扩展阅读
- three.js 如何用webgl搭建一个3D库房,3D仓库3D码头,3D集装箱,车辆定位,叉车定位可视化孪生系统——第十五课
- three.js 如何用webgl搭建一个3D库房,3D仓库,3D码头,3D集装箱可视化孪生系统——第十五课
- 出租屋顶安装光伏发电对房屋有害吗
- 光伏玻璃的原材料是什么
- 2023光伏工程技术专业学什么课程 就业前景及方向
- 如何清洗光伏发电组件
- 搞笑GIF:光伏电站的技术和施工人员都明白“接地”的重要性