From 9c7983ccf072544d8f0e6283fb07946aaa6ac149 Mon Sep 17 00:00:00 2001
From: master <master@163.com>
Date: 星期二, 29 三月 2022 01:28:08 +0800
Subject: [PATCH] 通过请求数据库数据,对斗轮机进行操作

---
 public/hn3d/example/00_hn_new.html |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/public/hn3d/example/00_hn_new.html b/public/hn3d/example/00_hn_new.html
index 8b715fd..32d3345 100644
--- a/public/hn3d/example/00_hn_new.html
+++ b/public/hn3d/example/00_hn_new.html
@@ -91,6 +91,7 @@
     var model_list = []
     var data_url = 'http://127.0.0.1:8001/admin/business/devicegroup/getdata?bid='
     var time_btn = $("#time_line button")
+    var model_no = 0
 
     // 椤甸潰鍒濆鎵ц鐨勬柟娉�
     $(document).ready(function () {
@@ -103,7 +104,7 @@
         url: `${data_url}get_dou_params`,
         success: function (data) {
           console.log(data)
-          dou_params = data.data.list
+          dou_params = data.data
         },
         error: function (request, textStatus) {
 
@@ -358,10 +359,13 @@
       // 璇锋眰鏁版嵁搴撴暟鎹紝瀵规枟杞満妯″瀷杩涜鎿嶄綔
       $("#test_btn").click(function () {
         console.log(dou_params)
-        for (let i = 0; i < dou_params.length; i++) {
-          let item = dou_params[i]
-          dou_move(item.longitude, item.latitude, item.elevation)
+        if (model_no < dou_params.length - 1) {
+          model_no++
+        } else {
+          model_no = 0
         }
+        let item = dou_params[model_no]
+        dou_move(item.longitude, item.latitude, item.elevation, item.heading_angle)
       })
 
 
@@ -370,8 +374,8 @@
           console.log(time_btn[i].text)
         }
       })
-
-      function dou_move (lon, lat, h, heading, petch, roll) {
+      // 灏佽鏂楄疆鏈哄伐浣滅Щ鍔ㄦ柟娉�
+      function dou_move (lon, lat, h, heading_angle) {
         dou1.moveTo({
           position: [lon, lat, h]
         })
@@ -384,6 +388,15 @@
         dou4.moveTo({
           position: [lon, lat, h]
         })
+        dou2.setStyle({
+          heading: heading_angle
+        })
+        dou3.setStyle({
+          heading: heading_angle
+        })
+        dou4.setStyle({
+          heading: heading_angle
+        })
       }
 
 

--
Gitblit v1.9.1