From f6bc0a837a03ce28d4af8c70f6711621864a9483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A8=81=E5=8B=9D=20=E5=BC=B5?= Date: Thu, 15 Feb 2024 12:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=A1=E5=9C=92=E7=9B=B8?= =?UTF-8?q?=E6=A9=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Engineering/Engineering_Index.cshtml | 153 ++++++++++++++++- .../Views/Engineering/Map_RTSP.cshtml | 158 +++++++++++++++++- 2 files changed, 304 insertions(+), 7 deletions(-) diff --git a/Parking_spaces/Views/Engineering/Engineering_Index.cshtml b/Parking_spaces/Views/Engineering/Engineering_Index.cshtml index bdcad70..25b40e0 100644 --- a/Parking_spaces/Views/Engineering/Engineering_Index.cshtml +++ b/Parking_spaces/Views/Engineering/Engineering_Index.cshtml @@ -99,7 +99,8 @@
即時影像
- +

@@ -656,6 +657,47 @@ }); } + function CAM_RTSP_2(IP) { + console.log(IP) + IP_1 = IP + $.ajax({ + type: "GET", + url: 'http://140.125.50.178:5000/IP/' + IP, + headers: { + 'Authorization': token + }, + success: function (response) { + stop = false + RTSP_START_2(response) + token_check = "true" + //from_token_import_id() + }, + error: function (xhr) { + console.log("111") + window.alert("相機未連線"); + } + + }); + } + + function CAM_RTSP_3() { + console.log(IP_1) + $.ajax({ + type: "GET", + url: 'http://140.125.50.178:5000/IP/' + IP_1, + headers: { + 'Authorization': token + }, + success: function (response) { + //webcam_view.showModal() + RTSP_START_2(response) + + token_check = "true" + //from_token_import_id() + }, + + }); + } @@ -670,12 +712,23 @@ } } + function RTSP_START_2(img_base_64) { + //console.log(img) + img = document.getElementById("img_id") + img.src = img_base_64 + if (stop == false) { + setTimeout('CAM_RTSP_3()', 20); + } + + } @@ -708,6 +761,14 @@ }).addTo(map); }; + for (var i = 0; i < Y_location_name_list.length; i++) { + var location = [Y_location_lat_list[i], Y_location_lng_list[i]]; + cam_ip = L.marker(location, { + icon: cam_icon, + title: "", + opacity: 1.0 + }).addTo(map); + }; // 載入圖資 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { @@ -723,16 +784,28 @@ lng = e.latlng.lng; // 經度 ////console.log(lat, lng) + //自己的 for (var i = 0; i < location_name_list.length; i++) { var location = [location_lat_list[i], location_lng_list[i]]; if (isDifferenceGreaterThan5Percent(location[0], lat) < 3 && isDifferenceGreaterThan5Percent(location[1], lng) < 3) { - ////console.log() + //console.log() get_RTSP_data_3(location_name_list[i]) //CAM_RTSP('192.168.100.82') } }; + //雲科校園的 + for (var i = 0; i < Y_location_name_list.length; i++) { + var location = [Y_location_lat_list[i], Y_location_lng_list[i]]; + if (isDifferenceGreaterThan5Percent(location[0], lat) < 3 && isDifferenceGreaterThan5Percent(location[1], lng) < 3) { + //console.log() + get_RTSP_data_5(Y_location_name_list[i]) + //CAM_RTSP('192.168.100.82') + } + + }; + } @@ -760,6 +833,10 @@ var location_lat_list = [] var location_lng_list = [] + var Y_location_name_list = [] + var Y_location_lat_list = [] + var Y_location_lng_list = [] + function get_RTSP_data() { //token_check = document.getElementById("token_check_id").value @@ -791,11 +868,29 @@ contentType: "application/json", success: function (Model) { set_RTSP_data_2(Model) - map_show() + get_RTSP_data_4() } }); } + function get_RTSP_data_4() { + //token_check = document.getElementById("token_check_id").value + + $.ajax({ + type: "GET", + url: "http://140.125.20.183:7700/api/Yuntech_cam_total_table", + data: {}, + headers: { + 'Authorization': token + }, + contentType: "application/json", + success: function (Model) { + console.log(Model) + set_RTSP_data_4(Model) + map_show() + } + }); + } var location_name function get_RTSP_data_3(location_name) { @@ -817,6 +912,25 @@ }); } + function get_RTSP_data_5(location_name) { + location_name = location_name + $.ajax({ + type: "GET", + url: "http://140.125.20.183:7700/api/Yuntech_cam", + data: {}, + headers: { + 'Authorization': token + }, + contentType: "application/json", + success: function (Model) { + console.log(location_name) + set_RTSP_data_5(Model, location_name) + + + } + }); + } + @@ -852,6 +966,20 @@ } + function set_RTSP_data_4(Model) { + for (var i = 0; i < Model.length; i++) { + + var hasValue = Y_location_name_list.includes(Model[i].location_name); + if (hasValue == false) { + Y_location_name_list.push(Model[i].location_name) + Y_location_lat_list.push(Model[i].latitude) + Y_location_lng_list.push(Model[i].longitude) + } + + } + + } + function set_RTSP_data_3(Model, location_name) { Button = '' + Button += '' + Button += '