关于javascript:ThingJS官方demo3D可视化地下管线提升城市应急能力

1次阅读

共计 1265 个字符,预计需要花费 4 分钟才能阅读完成。

对于城市来说,公开管线及其从属设施,是保障城市运行的重要基础设施和生命线,现在想要晋升公开管线建设管理水平,3D 可视化的需要应运而生。

如何应用 thingjs 迅速生成管线可视化 demo,我来为你解答。

在物联网中,对于管线的检测始终存在难度,如何用可视化的形式来解决这个管线监管问题呢?不论是城市管线还是社区,商场、大厦里的管线,想要实时检测到管线的状态都是比拟艰难的。咱们又该如何通过现如今的技术来实现管线的可视化治理呢?

智慧电力可视化零碎构建发电、输电、变电、配电、用电、调度、通信信息各个环节逐级可视。具备电站环境可视化、电力设备可视化、电力安防可视化规范性能,同时展现输电网、变电站及其外部的设施地位散布。

ThingJS- 面向物联网的 3D 可视化开发平台

管线.js

 
/**
* 阐明:管线利用
*/
var app = new THING.App({});

// 随机管线连接点
function randomPoints() {var points = [[0, 0, 0]];
    var oldType = 2;
    for (var i = 0; i < 50; i++) {var old = points[points.length - 1];
        var type = Math.floor(Math.random() * 100) % 3;
        while (oldType == type) {type = Math.floor(Math.random() * 100) % 3;
        }
        oldType = type;
        var offset = (Math.random() * 2 + 1) * (Math.random() > 0.5 ? 1 : -1);
        points.push([type === 0 ? (old[0] + offset) : old[0],
            type === 1 ? (old[1] + offset) : old[1],
            type === 2 ? (old[2] + offset) : old[2],
        ]);
    }
    return points;
}

// 安排管线
var line = null;
var lineIdx = 1;
function build() {
    // 删除原管线
    if (line) {line.destroy(); }

    // 创立管线
    line = app.create({
        type: 'PolygonLine',
        points: randomPoints(),
        width: 0.2,
        style: {image: 'https://thingjs.com/static/images/poly_line_0' + lineIdx + '.png', // 管线中的纹理资源}
    });

    // 切换线贴图
    if (lineIdx < 4) {lineIdx++;}
    else {lineIdx = 1;}

    // 开启 UV 动画
    line.scrollUV = true;

    // 设置最适宜的摄像机察看地位
    app.camera.fit();}
build();
new THING.widget.Button('从新安排', build);
 

将这个脚本放入到 thingjs 在线开发平台中,点击运行即可造成如图的管线案例。

城市公开管线体系是在不断完善中的,Thingjs 针对管线 3D 可视化可使城市应急救灾能力大幅晋升。

正文完
 0