From 5b0c1af1ecf60efcf53c68bcecf557b06849e937 Mon Sep 17 00:00:00 2001
From: master <master@163.com>
Date: 星期二, 31 五月 2022 19:48:21 +0800
Subject: [PATCH] 添加煤堆时间轴
---
public/hn3d/example/00_hn_new.html | 161 +++++++++++++++++++++++++++++++++++++----------------
1 files changed, 113 insertions(+), 48 deletions(-)
diff --git a/public/hn3d/example/00_hn_new.html b/public/hn3d/example/00_hn_new.html
index eeeac99..8e033a2 100644
--- a/public/hn3d/example/00_hn_new.html
+++ b/public/hn3d/example/00_hn_new.html
@@ -40,6 +40,40 @@
.disable {
pointer-events: none;
}
+
+ .time_line {
+ color: aquamarine;
+ border: 1px solid red;
+ margin: 0;
+ /* position: absolute;
+ z-index: 0;
+ top: 10px; */
+ width: 100%;
+
+ }
+
+ .time_box {
+ display: inline-block;
+ /* position: absolute; */
+ z-index: 10;
+ width: 10px;
+ height: 10px;
+ margin-left: 10px;
+ border-radius: 50%;
+ background-color: aquamarine;
+ }
+
+ .message {
+ visibility: hidden;
+ }
+
+ .time_box:hover+span {
+ visibility: visible;
+ }
+
+ #timeline::-webkit-scrollbar {
+ display: none;
+ }
</style>
</head>
@@ -68,12 +102,11 @@
<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">
- <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 id="timeline"
+ style="white-space:nowrap;height: 20px;width: 500px;position: absolute;bottom: 100px;left: 100px;overflow: scroll;">
+ <!-- <hr class="time_line"> -->
+ </div>
<script src="./js/common.js"></script>
<script type="text/javascript">
@@ -92,6 +125,7 @@
}
var dou_params = []
var model_list = []
+ var point_model = []
// var data_url = 'http://127.0.0.1:8001/admin/business/devicegroup/getdata?bid='
var data_url = 'http://47.92.33.19:8001/admin/business/devicegroup/getdata?bid='
@@ -117,6 +151,29 @@
success: function (data) {
console.log(data, "ajax_data")
dou_params = data.data
+ },
+ error: function (request, textStatus) {
+
+ }
+ })
+ $.ajax({
+ type: 'get',
+ dataType: 'json',
+ async: false,//鍚屾
+ headers: {
+ "Access-Control-Allow-Origin": "*"
+ // "Accept": "application/json"
+ },
+ url: `${data_url}get_point_cloud`,
+ success: function (data) {
+ console.log(data, "point_data")
+ point_model = data.data
+ var time_box_html = ''
+ for (let i = 1; i < point_model.length; i++) {
+ time_box_html += `<span class="time_box "></span>
+ <span class="message">${point_model[i].createTime}</span>`
+ }
+ $("#timeline").append(time_box_html)
},
error: function (request, textStatus) {
@@ -364,7 +421,39 @@
}
});
+ // 鐐瑰嚮鏃堕棿杞村垏鎹㈢叅鍫嗘ā鍨�
+ $(".time_box").click(function (e) {
+ var index_ = $("#timeline .time_box").index(this);
+ $.ajax({
+ type: 'get',
+ dataType: 'json',
+ async: false,//鍚屾
+ headers: {
+ "Access-Control-Allow-Origin": "*"
+ // "Accept": "application/json"
+ },
+ url: `${data_url}get_point_cloud_NO&index_=${index_}`,
+ success: function (data) {
+ console.log(data, "NO_data")
+ let data_path = data.data[0].data_path
+ if (pointPrimitives) {
+ console.log("绉婚櫎")
+ pointPrimitives.destroy(true)
+ }
+ $.ajax({
+ url: data_path,
+ dataType: 'text',
+ success: function (data) {
+ addPointCloud(data)
+ }
+ });
+ },
+ error: function (request, textStatus) {
+ }
+ })
+
+ })
// 璇锋眰鏁版嵁搴撴暟鎹紝瀵规枟杞満妯″瀷杩涜鎿嶄綔
@@ -378,20 +467,20 @@
}
let item = dou_params[model_no]
console.log(item)
- var data_path = item.data_path
- console.log("鎴戠偣鍑讳簡")
- console.log(pointPrimitives)
- if (pointPrimitives) {
- console.log("绉婚櫎")
- pointPrimitives.destroy(true)
- }
- $.ajax({
- url: data_path,
- dataType: 'text',
- success: function (data) {
- addPointCloud(data)
- }
- });
+ // var data_path = item.data_path
+ // console.log("鎴戠偣鍑讳簡")
+ // console.log(pointPrimitives)
+ // if (pointPrimitives) {
+ // console.log("绉婚櫎")
+ // pointPrimitives.destroy(true)
+ // }
+ // $.ajax({
+ // url: data_path,
+ // dataType: 'text',
+ // success: function (data) {
+ // addPointCloud(data)
+ // }
+ // });
dou_move(item.longitude, item.latitude, item.elevation, item.heading_angle)
setTimeout(function () {
@@ -495,7 +584,9 @@
heading: dou_data.heading
})
})
-
+ $("#point_btn").click(function () {
+ $("#timeline").toggle();
+ })
$(function () {
$(".handle > button").click(function () {
@@ -516,33 +607,7 @@
return newArray;
}
-
- // 璇曞姞杞絋XT鐐逛簯鏂囦欢
-
-
- // 璇诲彇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/hn.txt'
- // console.log("鎴戠偣鍑讳簡")
- // $.ajax({
- // url: data_path,
- // dataType: 'text',
- // success: function (data) {
- // addPointCloud(data)
- // }
- // });
- // })
-
+ // 鍔犺浇鐐逛簯鏂规硶
function addPointCloud (data) {
// 鐢虫槑鐐规覆鏌撻泦鍚�
pointPrimitives = map.viewer.scene.primitives.add(new Cesium.PointPrimitiveCollection());
--
Gitblit v1.9.1