From fc138d928dc7fe32b40afb1f6b0a0b10bb033409 Mon Sep 17 00:00:00 2001
From: fuchengshen <men883234@gmail.com>
Date: 星期三, 27 七月 2022 15:05:08 +0800
Subject: [PATCH] 为采集设备模型添加下发任务功能
---
public/hn3d/example/00_hn_new.html | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 159 insertions(+), 11 deletions(-)
diff --git a/public/hn3d/example/00_hn_new.html b/public/hn3d/example/00_hn_new.html
index baf7729..6a47cbf 100644
--- a/public/hn3d/example/00_hn_new.html
+++ b/public/hn3d/example/00_hn_new.html
@@ -14,9 +14,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<!--绗笁鏂筶ib-->
- <script type="text/javascript" src="../lib/include-lib.js" libpath="../lib/"
- include="jquery,font-awesome,bootstrap,layer,haoutil,mars3d"></script>
-
+ <!-- <script type="text/javascript" src="../lib/include-lib.js" libpath="../lib/"
+ include="jquery,jquery.range,bootstrap,bootstrap-checkbox,font-awesome,web-icons,layer,haoutil,nprogress,toastr,admui,turf,echarts-liquidfill,mars3d,mars3d-widget,mars3d-esri"></script> -->
+ <script type="text/javascript" src="../lib/include-lib.js?time=20210329" libpath="../lib/"
+ include="jquery,jquery.range,bootstrap,bootstrap-checkbox,font-awesome,web-icons,layer,haoutil,nprogress,toastr,admui,turf,echarts-liquidfill,mars3d,mars3d-widget,mars3d-esri"></script>
<link href="./css/style.css" rel="stylesheet" />
<link rel="stylesheet" href="./css/time_search.css">
<link rel="stylesheet" href="./js/bootstrap/bootstrap-datepicker/bootstrap-datetimepicker.css">
@@ -59,6 +60,14 @@
#timeline::-webkit-scrollbar {
display: none;
}
+
+ #parentDiv {
+ position: absolute;
+ right: 10px;
+ bottom: 100px;
+ width: 300px;
+ height: 500px;
+ }
</style>
</head>
@@ -81,6 +90,9 @@
<input id="pengnei_btn" type="button" class="btn btn-primary" value="妫氬唴" />
</div>
</div>
+
+
+ <!-- <div id="parentDiv"></div> -->
<!-- 鎿嶄綔鎸夐挳鏍� -->
<div class="infoview infoWindows handle">
@@ -139,7 +151,10 @@
var map;
+ var request;
var graphicLayer
+ var simu_layer
+ var simu
var heading_ = 0
var work_ = true
var dou_work
@@ -157,7 +172,7 @@
// 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='
-
+ const socket_ = io("http://127.0.0.1:8001?token=123");
var time_btn = $("#time_line button")
var model_no = 0
var distance_half = 111319.5;
@@ -165,8 +180,12 @@
var time_mars = $('.mars-pannel')
// 椤甸潰鍒濆鎵ц鐨勬柟娉�
$(document).ready(function () {
+ request = haoutil.system.getRequest();
console.log(time_btn)
- //plan 1:鐐瑰嚮鎸夐挳寮忚姹傛暟鎹紝骞跺妯″瀷浣嶇疆杩涜绉诲姩
+
+
+
+
$.ajax({
type: 'get',
dataType: 'json',
@@ -200,7 +219,75 @@
})
- const socket_ = io("http://127.0.0.1:8001?token=123");
+ // widget鍒濆鍖�
+ function initWidget (map) {
+ haoutil.loading.show();
+
+ $.ajax({
+ type: "get",
+ dataType: "json",
+ url: "config/widget.json",
+ timeout: 0,
+ success: function (widgetCfg) {
+ haoutil.loading.hide();
+
+ //url濡傛灉鏈変紶鍙傛椂鐨勫鐞�
+ if (haoutil.isutil.isNotNull(request.widget)) {
+ if (request.onlyStart) {
+ widgetCfg.openAtStart = [];
+ }
+ widgetCfg.openAtStart.push({
+ uri: request.widget,
+ name: request.name || "",
+ windowOptions: {
+ closeBtn: !request.onlyStart,
+ },
+ request: request,
+ });
+ map.flyHome({ duration: 0 });
+ }
+
+ //鍒濆鍖杦idget绠$悊鍣�
+ mars3d.widget.init(map, widgetCfg, "./"); //tip: 绗�3涓弬鏁版敮鎸佸畾涔墂idget鐩綍鐨勭浉瀵硅矾寰勩��
+
+ if (window.lastWidgetItem) {
+ activateWidget(lastWidgetItem);
+ lastWidgetItem = null;
+ }
+ },
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
+ haoutil.loading.hide();
+ haoutil.alert("config/widget.json鏂囦欢鍔犺浇澶辫触锛�");
+ },
+ });
+ mars3d.widget.on(mars3d.widget.EventType.activated, function (event) {
+ console.log("婵�娲讳簡widget", event);
+ });
+ mars3d.widget.on(mars3d.widget.EventType.disabled, function (event) {
+ console.log("閲婃斁浜唚idget", event);
+ });
+ }
+
+
+
+ // 閰嶇疆浠诲姟浜嬩欢锛屾縺娲诲搴旂殑widget鐣岄潰杩涜浠诲姟閰嶇疆
+ function showHistoryPathDetail (logic_id) {
+ if (mars3d.widget.isActivate("widgets/rruRouterReplay/widget.js")) {
+ var detailWiget = mars3d.widget.getClass("widgets/rruRouterReplay/widget.js");
+ detailWiget.reloadData({
+ "logic_id": logic_id
+ });
+ } else {
+ mars3d.widget.activate({
+ uri: "widgets/rruRouterReplay/widget.js",
+ params: {
+ "logic_id": logic_id
+ }
+ });
+ }
+ }
+
+
socket_.on("comm", (data) => {
console.log(data, "鍚庣鎺ㄩ��")
})
@@ -213,6 +300,9 @@
})
socket_.on("disconnect", (data) => {
console.log(data, "鐢ㄦ埛宸叉柇寮�杩炴帴")
+ })
+ socket_.on("test2", (data) => {
+ console.log("test2", data)
})
@@ -234,7 +324,7 @@
})
-
+ // 鐐瑰嚮椤甸潰浣挎椂闂磋酱璇︽儏椤甸潰闅愯棌
$(document).on('click', function () {
console.log("ddd")
@@ -277,7 +367,7 @@
position: {
lng: 121.403176,
lat: 31.467125,
- alt: 0,
+ alt: -10,
},
maximumScreenSpaceError: 1,
maximumMemoryUsage: 1024,
@@ -397,14 +487,74 @@
});
+
+
var eventTarget = new mars3d.BaseClass()
//鍒涘缓涓夌淮鍦扮悆鍦烘櫙
map = new mars3d.Map("mars3dContainer", mapOptions);
+ initWidget(map)
var clockAnimate = new mars3d.control.ClockAnimate({
format: "yyyy-MM-dd HH:mm:ss"
})
map.addControl(clockAnimate)
+ // 娣诲姞閲囬泦璁惧妯″瀷
+ simu_layer = new mars3d.layer.GraphicLayer({
+ name: "鍥涚洰璁惧",
+ show: true
+ })
+ map.addLayer(simu_layer)
+ //鑾峰彇閲囬泦璁惧淇℃伅锛屾牴鎹俊鎭坊鍔犳ā鍨�
+ $.ajax({
+ type: 'get',
+ dataType: 'json',
+ async: false,//鍚屾
+ headers: {
+ "Access-Control-Allow-Origin": "*"
+ // "Accept": "application/json"
+ },
+ url: `${data_url}get_simu`,
+ success: function (data) {
+ console.log(data.data, "simu")
+ simu = new mars3d.graphic.ModelEntity({
+
+ position: [121.406729, 31.467183, 50], // 妤兼爧浣嶇疆
+
+ style: {
+ // url: "http://112.74.77.127:9100/hn/doulunji/dabi/doulunji_dabi.gltf",
+ url: "../model/simu_0322/simu_0322.gltf",
+ scale: 0.005,
+ color: "#ff0000",
+ fill: true
+ },
+ // 寮瑰嚭妗嗕腑鎵撳紑浠诲姟涓嬪彂琛ㄥ崟
+ popup: "<br/><p><a href='#' onclick='javascript:showHistoryPathDetail(" + "12345" + ")' >閰嶇疆浠诲姟</a></p>",
+ allowDrillPick: false,
+ })
+ simu_layer.addGraphic(simu)
+ },
+ error: function (request, textStatus) {
+
+ }
+ })
+
+
+
+ try {
+ socket_.on("test_test", (data) => {
+ console.log(data, "鏂扮殑娴嬭瘯")
+ })
+
+ } catch (err) {
+ console.log("娌℃湁鎺ユ敹鍒�")
+ }
+
+
+
+
+
+
+ // Mars3D浜嬩欢杞寸粍浠�
clockAnimate.on(mars3d.EventType.click, function (event) {
if (event.targetType === "label") {
console.log("鍗曞嚮浜嗘椂闂存枃鏈尯鍩�", event)
@@ -446,8 +596,7 @@
// url: "https://a.amap.com/jsapi_demos/static/gltf/Duck.gltf",
scale: 0.6
},
- poup: '<p>鎴戞槸鏂楄疆</p>',
- tooltip: '<p>鎴戞槸鏂楄疆</p>',
+ popup: "<br/><p><a href='#' onclick='javascript:showHistoryPathDetail(" + "12345" + ")' >閰嶇疆浠诲姟</a></p>",
allowDrillPick: false,
})
graphicLayer.addGraphic(dou2)
@@ -461,7 +610,6 @@
scale: 0.6
},
poup: '<p>鎴戞槸鏂楄疆</p>',
- tooltip: '<p>鎴戞槸鏂楄疆</p>',
allowDrillPick: false,
})
graphicLayer.addGraphic(dou3)
--
Gitblit v1.9.1