three.js 如何使用webgl实现3D储能,3D储能站,3D智慧储能、储能柜的三维可视化解决方案——第十七课( 四 )

 1.6、设备巡检
每一个储能柜进行状态巡检
重点在于创建巡检路径 , 路径上添加巡检设备 , 对每一个设备进行数据请求 。

three.js 如何使用webgl实现3D储能,3D储能站,3D智慧储能、储能柜的三维可视化解决方案——第十七课

文章插图
ModelBussiness.prototype.doRoute = function (routeId) {    var _this = this;    _this.routeDev = 0;    _this.normalDev = 0;    _this.exceptionDev = 0;    _this.routeState = 1;//修改右侧html列表    $("#d24value1").html(modelBussiness.routeDev + "  <font>台</font>");    $("#d24value2").html(modelBussiness.normalDev + "  <font>台</font>");    $("#d24value3").html(modelBussiness.exceptionDev + "  <font>台</font>");    $("#routeDataList").html("");    //创建巡检路径    var points = [{"position":{"x":298,"y":2851,"z":-6347},"target":{"x":81,"y":195,"z":-920}},...,{"position":{"x":3785,"y":191,"z":-316},"target":{"x":2782,"y":100,"z":-230}}];         //开始回调巡检    function doMove(index) {        var _obj = points[index];        if (_obj && modelBussiness.routeState == 1) {            WT3DObj.commonFunc.changeCameraPosition(_obj.position, _obj.target, 1000, function () {                if (_obj.addtion_name) {                    modelBussiness.showDevDetail(_obj.addtion_name, function () {//递归                        doMove(index + 1);                    });                } else {//递归实现                    doMove(index + 1);                }            });        } else {            layer.msg("巡检已结束!")        }    }    doMove(0)} 二、实现逻辑
2.1、模型创建
2.1.1、地基模型
跟其它项目一样 , 首先根据图纸 , 创建基础地基模型 , 这里的地基模型还是以代码实现方式为主 , 这样一个场景 , 代码实现模型后 , 也就几kb的占用 , 很适合网络传输 。
three.js 如何使用webgl实现3D储能,3D储能站,3D智慧储能、储能柜的三维可视化解决方案——第十七课

文章插图
模型代码如下:
[{"show":true,"showHelper":true,"uuid":"","name":"DirectionalLight_20","objType":"DirectionalLight","shadowCameraNear":1,"shadowCameraFar":10000,"shadowCameraLeft":-10000,"shadowCameraRight":10000,"shadowCameraTop":10000,"shadowCameraBottom":-10000,"shadowMapWidth":2048,"shadowMapHeight":2048,"distance":10000,"targetName":"floor","intensity":1,"color":16777215,"castShadow":true,"position":{"x":-741.608,"y":1024.43,"z":357.243},"showSortNub":20,"customType1":"","customType2":"","animation":null,"dbclickEvents":null,"shadowCameraFov":null,"decay":2,"BindDevId":null,"BindDevName":null,"devInfo":null,"BindMeteId":null,"BindMeteName":null},{"show":true,"uuid":"","name":"wall_10_1","objType":"ExtrudeGeometry","position":{"x":824.387,"y":-1200,"z":-840},"style":{"skinColor":16711680,"skin":{"skin_up":{"skinColor":12432556,"side":1,"opacity":1,"imgurl":"../img/3dImg/wall/dls.jpg","repeatx":true,"width":0.01,"repeaty":true,"height":0.01},"skin_down":{"skinColor":16711680,"side":1,"opacity":1},"skin_side":{"skinColor":12432556,"materialType":"lambert","opacity":1,"imgurl":"../img/3dImg/wall/dls.jpg","repeatx":true,"width":0.01,"repeaty":true,"height":0.01}}},"scale":{"x":1,"y":1,"z":1},"shapeParm":{"points":[{"x":0,"y":0,"type":"nomal"},{"x":0,"y":160,"type":"nomal"},{"x":10,"y":160,"type":"nomal"},{"x":10,"y":0,"type":"nomal"}],"holes":[]},"extrudeSettings":{"amount":1050,"curveSegments":1,"steps":1,"bevelEnabled":false,"bevelThickness":1,"bevelSize":1,"bevelSegments":1,"extrudePathPoints":[]},"showSortNub":30,"customType1":"","customType2":"","animation":null,"dbclickEvents":null,"rotation":[{"direction":"x","degree":0},{"direction":"y","degree":0},{"direction":"z","degree":0}],"BindDevId":null,"BindDevName":null,"devInfo":null,"BindMeteId":null,"BindMeteName":null},{"show":true,"uuid":"","name":"wall_10_222","objType":"ExtrudeGeometry","position":{"x":820.153,"y":-1200,"z":-611.506},"style":{"skinColor":16711680,"skin":{"skin_up":{"skinColor":12432556,"side":1,"opacity":1,"imgurl":"../img/3dImg/wall/dls.jpg","repeatx":true,"width":0.01,"repeaty":true,"height":0.01},"skin_down":{"skinColor":16711680,"side":1,"opacity":1},"skin_side":{"skinColor":16775673,"materialType":"lambert","opacity":1,"imgurl":"../img/3dImg/wall/dlswhite.jpg","repeatx":true,"width":0.008,"repeaty":true,"height":0.004}}},"scale":{"x":1,"y":1,"z":1},"shapeParm":{"points":[{"x":0,"y":0,"type":"nomal"},{"x":0,"y":130,"type":"nomal"},{"x":10,"y":130,"type":"nomal"},{"x":10,"y":0,"type":"nomal"}],"holes":[]

经验总结扩展阅读