| | |
| | | <button type="button" id="meipeng_pati_madao" class="btn btn-primary" style="width: 100%;">爬梯马道</button> |
| | | <button type="button" id="meipeng_tiejia" class="btn btn-primary" style="width: 100%;">钢结构架</button> |
| | | <button type="button" id="meipeng_dimian" class="btn btn-primary" style="width: 100%;">煤棚地面</button> |
| | | <button type="button" id="dou_move" class="btn btn-primary" style="width: 100%;">移动</button> |
| | | <!-- <button type="button" id="dou_move" class="btn btn-primary" style="width: 100%;">移动</button> |
| | | <button type="button" id="dou_rote" class="btn btn-primary" style="width: 100%;">旋转</button> |
| | | <button type="button" id="dou_work" class="btn btn-primary" style="width: 100%;">挖煤</button> |
| | | <button type="button" id="dou_work" class="btn btn-primary" style="width: 100%;">挖煤</button> --> |
| | | <button type="button" id="test_btn" class="btn btn-primary" style="width: 100%;">测试</button> |
| | | <button type="button" id="point_btn" class="btn btn-primary" style="width: 100%;">煤堆</button> |
| | | </div> |
| | | <div class="infoview handle" id="time_line"> |
| | | <!-- <div class="infoview handle" id="time_line"> |
| | | <button type="button" class="btn btn-primary" style="width: 100%;">time1</button> |
| | | <button type="button" class="btn btn-primary" style="width: 100%;">time2</button> |
| | | <button type="button" class="btn btn-primary" style="width: 100%;">time3</button> |
| | | <button type="button" class="btn btn-primary" style="width: 100%;">time4</button> |
| | | </div> |
| | | </div> --> |
| | | |
| | | <script src="./js/common.js"></script> |
| | | <script type="text/javascript"> |
| | |
| | | var data_url = 'http://127.0.0.1:8001/admin/business/devicegroup/getdata?bid=' |
| | | var time_btn = $("#time_line button") |
| | | var model_no = 0 |
| | | |
| | | var distance_half = 111319.5; |
| | | // 页面初始执行的方法 |
| | | $(document).ready(function () { |
| | | console.log(time_btn) |
| | |
| | | ], |
| | | }); |
| | | |
| | | |
| | | addCustomLayers() |
| | | |
| | | |
| | | //创建三维地球场景 |
| | |
| | | parent: dou_parent |
| | | }) |
| | | graphicLayer.addGraphic(dou3) |
| | | |
| | | |
| | | var dou4 = new mars3d.graphic.ModelEntity({ |
| | | |
| | |
| | | dimian_model.show = false; |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | |
| | | $(this).addClass("active"); |
| | | }); |
| | | }); |
| | | |
| | | |
| | | |
| | | // group方法可以将一个数组按照指定长度进行分组 |
| | | function group (array, subGroupLength) { |
| | | let index = 0; |
| | | let newArray = []; |
| | | while (index < array.length) { |
| | | newArray.push(array.slice(index, index += subGroupLength)); |
| | | } |
| | | return newArray; |
| | | } |
| | | |
| | | |
| | | // 试加载TXT点云文件 |
| | | |
| | | |
| | | // 读取TXT文件并将TXT内容转换为数组 |
| | | |
| | | // $.ajax({ |
| | | // url: 'http://112.74.77.127:9100/hn/pointcloud/hn4.txt', |
| | | // dataType: 'text', |
| | | // success: function (data) { |
| | | // addPointCloud(data) |
| | | // } |
| | | // }); |
| | | |
| | | |
| | | $("#point_btn").click(function () { |
| | | var data_path = 'http://112.74.77.127:9100/hn/pointcloud/hn4.txt' |
| | | console.log("我点击了") |
| | | $.ajax({ |
| | | url: data_path, |
| | | dataType: 'text', |
| | | success: function (data) { |
| | | addPointCloud(data) |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | function addPointCloud (data) { |
| | | var pointPrimitives = null;// 申明点渲染集合 |
| | | pointPrimitives = map.viewer.scene.primitives.add(new Cesium.PointPrimitiveCollection()); |
| | | datas = data.split(/\s|[\r\n]/)//将txt每行内容根据空格和换行进行切割 |
| | | data_list = datas.map(Number)//将切割后的xyz左边转换为数字格式 |
| | | list = group(data_list, 3)//将转换后的数据每六个分为一组 |
| | | // 循环数组,加载点云 |
| | | for (var i = 0; i < list.length; i++) { |
| | | var hn_lon = Number(list[i][0]) / distance_half + 121.398442; |
| | | var hn_lat = Number(list[i][1]) / distance_half + 31.460107; |
| | | var hn_h = 300 - Number(list[i][2]); |
| | | var color_b = Math.floor(hn_h) |
| | | if (hn_h <= 50) { |
| | | color = Cesium.Color.fromCssColorString(`rgba(0, ${color_b}, ${color_b}, 1)`) |
| | | } else if (hn_h <= 80) { |
| | | color = Cesium.Color.fromCssColorString(`rgba(${color_b}, 0, ${color_b}, 1)`) |
| | | } else { |
| | | color = Cesium.Color.fromCssColorString(`rgba(${color_b}, ${color_b}, 0, 1)`) |
| | | } |
| | | var position = Cesium.Cartesian3.fromDegrees(hn_lon, hn_lat, hn_h); |
| | | pointPrimitives.add({ |
| | | pixelSize: 1, |
| | | color: color, |
| | | // outlineColor: Cesium.Color.BLUE, |
| | | outlineWidth: 0, |
| | | position: position |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //键盘漫游 |
| | | map.keyboardRoam.setOptions({ |
| | | moveStep: 0.1, //平移步长 (米)。 |
| | |
| | | |
| | | |
| | | |
| | | // 试加载TXT点云文件 |
| | | function addPrimitivesPointFromJSONTest () { |
| | | console.log(map, "map") |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | pitch: -18, |
| | | }); |
| | | } |
| | | |
| | | function addCustomLayers () { |
| | | addPrimitivesPointFromJSONTest() |
| | | } |
| | | </script> |
| | | </body> |
| | | |