diff --git a/Aida/airelay_init.html b/Aida/airelay_init.html index 4f2fc04..1d90264 100644 --- a/Aida/airelay_init.html +++ b/Aida/airelay_init.html @@ -147,7 +147,8 @@ script.onload = function () { // console.log('[script ' + currentIndex + '] ' + src + ' has been successfully loaded'); index++; - setTimeout(loadNextScript, interval); // 加載下一個腳本之前等待一段時間 + // setTimeout(loadNextScript, interval); // 加載下一個腳本之前等待一段時間 + loadNextScript(); // 2024-11-05 被抱怨等太久,取消 setTimeout 機制 loadCount++; }; @@ -183,7 +184,7 @@ function preloadImagesWithDelay() { var imgIndex = 0; - var interval = 150; // 每次迭代之間的延遲時間,單位是毫秒 + var interval = 10; //150; // 每次迭代之間的延遲時間,單位是毫秒 function loadNextImage() { if (imgIndex < imagesToPreload.length) { @@ -197,7 +198,9 @@ link.onload = function () { // console.log('[img ' + imgIndex + '] ' + src + ' has been successfully preloaded'); imgIndex++; - setTimeout(loadNextImage, interval); // 加載下一個影像之前等待一段時間 + + // setTimeout(loadNextImage, interval); // 加載下一個影像之前等待一段時間 + loadNextImage(); // 2024-11-05 被抱怨等太久,取消 setTimeout 機制 }; link.onerror = function () { @@ -352,9 +355,8 @@ // -------------------------------------------------------------------------------- - var checkIntervalTime = 500; - var hideLoadPageDeferTime = 1500; - var preloadImgDisplayTime = 500; + var checkIntervalTime = 100; + var hideLoadPageDeferTime = 500;//1500; var intervalID = null; var checkPercentageStuckCounter = 0; var percentage = 0; @@ -599,7 +601,7 @@ localStorage.setItem('current_state_hide_or_open_label', 0); } else { - localStorage.setItem('current_state_hide_or_open_label', 1); + localStorage.setItem('current_state_hide_or_open_label', 0); } } diff --git a/Aida/alarm.html b/Aida/alarm.html index 473a058..f8fe276 100644 --- a/Aida/alarm.html +++ b/Aida/alarm.html @@ -1970,7 +1970,64 @@ } } } - click_canvas_all = count_zone; + + // 08-24 確認是否有設定警戒線的 Zone,額外再加上紅線物件 + var arrow_num = 0; + for (var index_zone = 0; index_zone < count_zone; index_zone++) { + // console.log(`[func_show_all_zone] check current_trigger[${index_zone}]: ${current_trigger[index_zone]}`); + + // 比照 func_listen_to_enable_or_disable_show_direction 開啟紅線物件可見性的條件 + if ( + current_trigger[index_zone] == 4 + || current_trigger[index_zone] == 17 + || current_trigger[index_zone] == 18 + || current_trigger[index_zone] == 19 + ) { + arrow_num++; + var arrow_obj = null; + // ------------------------------------------------------ + // 比照 clone 寫法位置會有問題,改仿照 Edit_Arrow 內部流程新增紅線物件 + // if (index_zone == 0) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire1.getObjects()[1]); + // } + // else if (index_zone == 1) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire2.getObjects()[1]); + // } + // else if (index_zone == 2) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire3.getObjects()[1]); + // } + // else if (index_zone == 3) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire4.getObjects()[1]); + // } + + // console.log("clone arrow_obj:"); + // console.log(arrow_obj); + // ------------------------------------------------------ + // 參照 Edit_Arrow + points_array = GetPointLocation(index_zone); + + var index_point = g_mydirection[g_zone_id] - 1; + var next_point = index_point + 1 >= 4 ? 0 : index_point + 1; + var start_x = points_array[next_point].x; + var start_y = points_array[next_point].y; + var end_x = points_array[index_point].x; + var end_y = points_array[index_point].y; + + arrow_obj = AddArrowObject(start_x, start_y, end_x, end_y) + arrow_obj.visible = true; + // ------------------------------------------------------ + if (arrow_obj != null) { + canvasTripwire_all.add(arrow_obj); + } + } + } + + // click_canvas_all = count_zone; + click_canvas_all = count_zone + arrow_num; // 確保多新增的紅線物件不會馬上被 RefreshCanvasObject 保護物件數量參數給清除掉 canvasTripwire_all.requestRenderAll(); //document.getElementById('IDOK').disabled = true; @@ -4286,7 +4343,7 @@ disabelIteraction(canvasTripwire7.getObjects()[0]); Edit8(); } - + func_getbar(); show_tof_map(); } @@ -4455,28 +4512,35 @@ } function func_seteventsfile(json_data) { + waitSeconds(100); $.ajax({ url: "/seteventsfile", method: "POST", async: false, data: json_data, - contentType: false, + //contentType: false, processData: false, + timeout: 5000, + cache: false, + xhrFields: { + withCredentials: true // 設置為 true 如果需要帶上 Cookies 或其他認證 + }, + contentType: 'text/plain', // 傳送純文本 beforeSend: function (xmlHttp) { xmlHttp.setRequestHeader("If-Modified-Since", "0"); xmlHttp.setRequestHeader("Cache-Control", "no-cache"); //xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); }, - success: function () { + success: function (retdata) { //console.info(); }, - error: function () { - console.warn(); + error: function (retdata) { + console.warn(retdata); k_index++; if (k_index <= 94) { - waitSeconds(500); + waitSeconds(1000); func_seteventsfile(json_data); } } @@ -4485,27 +4549,34 @@ } function func_setconfigfile(json_data) { + waitSeconds(100); $.ajax({ url: "/setconfigfile", method: "POST", async: false, data: json_data, - contentType: false, + //contentType: false, processData: false, + timeout: 5000, + cache: false, + xhrFields: { + withCredentials: true // 設置為 true 如果需要帶上 Cookies 或其他認證 + }, + contentType: 'text/plain', // 傳送純文本 beforeSend: function (xmlHttp) { xmlHttp.setRequestHeader("If-Modified-Since", "0"); xmlHttp.setRequestHeader("Cache-Control", "no-cache"); //xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); }, - success: function () { + success: function (retdata) { //console.info(); }, - error: function () { - console.warn(); + error: function (retdata) { + console.warn(retdata); k_index++; if (k_index <= 94) { - waitSeconds(500); + waitSeconds(1000); func_setconfigfile(json_data); } } @@ -6814,8 +6885,11 @@ var json_data = '{"view_setting":{"camera01":{"obj_max_proportion": "' + obj_max_proportion; json_data += '","obj_min_proportion": "' + obj_min_proportion + '","enable_traffic": "' + enable_traffic + '","enable_unknown_object": "' + enable_unknown_object + '","enable_track": "' + enable_track; json_data += '","confidence2": "' + confidence_traffic + '","count_zone": ' + count_zone; - json_data += ',"detection_zone":['; + json_data += '}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; json_data += '{"enable_direction1": "' + enable_direction[0]; json_data += '","direction1": "' + func_get_direction(0).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[0]; @@ -6842,8 +6916,12 @@ json_data += ',"y5": ' + Math.round(points_array_0[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_0[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_0[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},' json_data += '{"enable_direction1": "' + enable_direction[1]; json_data += '","direction1": "' + func_get_direction(1).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[1]; @@ -6870,8 +6948,12 @@ json_data += ',"y5": ' + Math.round(points_array_1[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_1[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_1[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},'; json_data += '{"enable_direction1": "' + enable_direction[2]; json_data += '","direction1": "' + func_get_direction(2).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[2]; @@ -6898,8 +6980,12 @@ json_data += ',"y5": ' + Math.round(points_array_2[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_2[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_2[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[3]; json_data += '","direction1": "' + func_get_direction(3).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[3]; @@ -6926,8 +7012,12 @@ json_data += ',"y5": ' + Math.round(points_array_3[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_3[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_3[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[4]; json_data += '","direction1": "' + func_get_direction(4).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[4]; @@ -6954,8 +7044,12 @@ json_data += ',"y5": ' + Math.round(points_array_4[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_4[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_4[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[5]; json_data += '","direction1": "' + func_get_direction(5).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[5]; @@ -6982,8 +7076,12 @@ json_data += ',"y5": ' + Math.round(points_array_5[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_5[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_5[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[6]; json_data += '","direction1": "' + func_get_direction(6).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[6]; @@ -7010,8 +7108,12 @@ json_data += ',"y5": ' + Math.round(points_array_6[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_6[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_6[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[7]; json_data += '","direction1": "' + func_get_direction(7).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[7]; @@ -7039,8 +7141,6 @@ json_data += ',"x6": ' + Math.round(points_array_7[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_7[5].y * tab_view_size[1] / image_height); json_data += '}]}}}'; - - //console.log(json_data); func_setconfigfile(json_data); var text_checked_trigger_events = new Array(MAX_DETECTION_ZONE); diff --git a/Aida/alarm.js b/Aida/alarm.js index d983cce..802af72 100644 --- a/Aida/alarm.js +++ b/Aida/alarm.js @@ -309,7 +309,7 @@ function insertTrafficLightRectangle(r_left, r_top, r_width, r_height, r_direct, if (r_name == "person") { color_type = '#FF8C00'; } - else { + else if(r_name == "car"){ color_type = '#800080'; } } @@ -3046,7 +3046,12 @@ function GetAlarm(alarm_data) { var complete_data = ""; var n1 = -1, n2 = -1, n2_temp = -1; + // console.log("[GetAlarm] localStorage fetchHttpGetalarm:", localStorage.getItem("fetchHttpGetalarm")); + // console.log("[GetAlarm] g_max_protected_objects:", g_max_protected_objects); + + var max_protected_objects = g_max_protected_objects; + if (g_enable_show_pixel === 1) { max_protected_objects = g_max_protected_objects + 2; } @@ -3059,6 +3064,8 @@ function GetAlarm(alarm_data) { n2 = complete_data.indexOf('}', n2_temp); + // console.log(`[GetAlarm] n1:${n1} , n2_temp:${n2_temp} , n2:${n2}`); + if (n1 > 0 && n2_temp > 0 && n2 > 0 && (n1 + 7) < n2_temp && n2_temp < n2) { wait_count = 0; clear_count = 0; @@ -3073,6 +3080,9 @@ function GetAlarm(alarm_data) { buffer_cam_time = ""; buffer_cam_time = datas[i].slice(); }*/ + + // console.log(`datas[${i}].length: ${datas[i].length}`); + if (datas[i].length > 12 && datas[i].substring(0, 12) == '{"AiEngine":' && datas[i].length < 8192 * 8) { //datas[i].replace(/\\'/g, "'"); //datas[i].replace('\"', '"'); @@ -3100,6 +3110,9 @@ function GetAlarm(alarm_data) { ai_json = JSON.parse(temp); //ai_json = validatingJSON(temp); + // console.log("ai_json:"); + // console.log(ai_json); + datas[i] = null; //check_cam_time = 1; @@ -3123,7 +3136,7 @@ function GetAlarm(alarm_data) { } }*/ - //console.log(ai_json); + // console.log(ai_json); if (localStorage.getItem("ToF_recognition") === "Yes"){ // console.log("ai_json.AIToF:"); @@ -3154,12 +3167,15 @@ function GetAlarm(alarm_data) { /*if (clear_count_2 >= 3) */ { //clear_count_2 = 0; - + // console.log("[WebSocket] max_protected_objects: ", max_protected_objects); RefreshCanvasObject(max_protected_objects); } //console.log("bbox_count: " + bbox_count.toString()); + // console.log("ai_json.counter_count:", ai_json.counter_count); + + if (ai_json != null && typeof ai_json.counter_count !== 'undefined') { counter_count_msg = ""; @@ -3233,12 +3249,15 @@ function GetAlarm(alarm_data) { insert_red_text = "FPS:" + AI_fps.toString() + ","; } - var insert_red_text_max = ""; var insert_red_text_min = ""; + + + if (current_state_hide_or_open_getalarmmotion == 1) { for (var i = 0; i < bbox_count /*&& i <= 10*/; i++) { + // console.log(ai_json.AiEngine[i]); if (ai_json.AiEngine[i]) { if (ai_json.AiEngine[i].parent_idx == -1) { @@ -3336,8 +3355,8 @@ function GetAlarm(alarm_data) { continue; } if (canvasTripwire_all && canvasTripwire && canvasTripwire1 && canvasTripwire2 && canvasTripwire3 && canvasTripwire4 && canvasTripwire5 && canvasTripwire6 && canvasTripwire7 && canvasTripwire8) { - var translate_name = func_translate_name(plate_name); + var behavior_id = ai_json.AiEngine[i].behavior_id; var detection_zone_id = ai_json.AiEngine[i].detection_zone_id; @@ -3583,6 +3602,13 @@ function GetAlarm(alarm_data) { canvasTripwire8.add(insertTrafficLightRectangle(x * 0.25, y * 0.3, w * 0.25, h * 0.3, 1, 1, plate_name, number_row)); } else { + // 11-01 + // console.log("trigger any events... , behavior_id: ", behavior_id); // 禁區 0 , 久留 4, 警戒線 8 + // console.log(ai_json.AiEngine[i]); // 沒有和 zone index 相關的資訊 + // console.log("detection_zone_id: ", detection_zone_id); // undefined + + func_checkTriggerZoneStatus(behavior_id); // 為了連動 zone polygon 變顏色 + canvasTripwire_all.add(insertTrafficLightRectangle_Red(x * 0.25, y * 0.3, w * 0.25, h * 0.3, 1, 1, plate_name)); canvasTripwire.add(insertTrafficLightRectangle_Red(x * 0.25, y * 0.3, w * 0.25, h * 0.3, 1, 1, plate_name)); canvasTripwire1.add(insertTrafficLightRectangle_Red(x * 0.25, y * 0.3, w * 0.25, h * 0.3, 1, 1, plate_name)); @@ -3647,7 +3673,7 @@ function GetAlarm(alarm_data) { } } } - + var bbox_count_short = 0; var bbox_count_long = 0; @@ -3923,6 +3949,9 @@ function GetAlarm(alarm_data) { canvasTripwire8.getObjects()[0].stroke = "#ff0000"; } + // 11-01 + func_checkZoneColor(); + if (canvasTripwire_all && canvasTripwire && canvasTripwire1 && canvasTripwire2 && canvasTripwire3 && canvasTripwire4 && canvasTripwire5 && canvasTripwire6 && canvasTripwire7 && canvasTripwire8) { for (var index_zone = 0; index_zone < count_zone; index_zone++) { if (parseInt(parking_space[index_zone], 10) >= 1 && parseInt(parking_line[index_zone], 10) >= 1) { @@ -4190,27 +4219,6 @@ function AssignPlateObject(ai_json,i_index,plate_name) { var h = parseInt(ai_json.AiEngine[i_index].h, 10); var text_y = parseInt((ai_json.AiEngine[i_index].y + ai_json.AiEngine[i_index].h), 10); //console.log(text_y); - /*if (x * 0.25 <= 20) { - x = 80; - } - else if (x * 0.25 >= 460) { - x = 1840; - } - - if (y * 0.3 <= 20) { - y = 66; - } - else if (y * 0.3 >= 300) { - y = 999; - } - - if (x * 0.25 + w * 0.25 >= 460) { - w = parseInt((460 - x * 0.25) * 4, 10); - } - - if (y * 0.3 + h * 0.3 >= 300) { - h = parseInt((300 - y * 0.3) * 3.33, 10); - }*/ text_y = y - 66; @@ -4394,16 +4402,22 @@ function RenderAllCanvas() { function RefreshCanvasObject(max_protected_objects) { if (typeof canvasTripwire !== 'undefined') { //Clear all objects + // console.log(canvasTripwire.getObjects()); while (canvasTripwire.getObjects().length > 0) { var items = canvasTripwire.getObjects(); if (items[canvasTripwire.getObjects().length - 1]) { canvasTripwire.remove(items[canvasTripwire.getObjects().length - 1]); } + // canvasTripwire.remove(items[canvasTripwire.getObjects().length - 1]); } + + // console.log(canvasTripwire.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire1 !== 'undefined') { //Clear all objects + // console.log(canvasTripwire1.getObjects()); while (canvasTripwire1.getObjects().length > max_protected_objects) { var items = canvasTripwire1.getObjects(); if (items[canvasTripwire1.getObjects().length - 1]) { @@ -4411,10 +4425,14 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire1.getObjects()[0].stroke = "#ffff00"; + + // console.log(canvasTripwire1.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire2 !== 'undefined') { + // console.log(canvasTripwire2.getObjects()); //Clear all objects while (canvasTripwire2.getObjects().length > max_protected_objects) { var items = canvasTripwire2.getObjects(); @@ -4423,10 +4441,14 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire2.getObjects()[0].stroke = "#ffff00"; + + // console.log(canvasTripwire2.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire3 !== 'undefined') { + // console.log(canvasTripwire3.getObjects()); //Clear all objects while (canvasTripwire3.getObjects().length > max_protected_objects) { var items = canvasTripwire3.getObjects(); @@ -4435,9 +4457,13 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire3.getObjects()[0].stroke = "#ffff00"; + + // console.log(canvasTripwire3.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire4 !== 'undefined') { + // console.log(canvasTripwire4.getObjects()); //Clear all objects while (canvasTripwire4.getObjects().length > max_protected_objects) { var items = canvasTripwire4.getObjects(); @@ -4446,9 +4472,13 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire4.getObjects()[0].stroke = "#ffff00"; + + // console.log(canvasTripwire4.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire5 !== 'undefined') { + // console.log(canvasTripwire5.getObjects()); //Clear all objects while (canvasTripwire5.getObjects().length > max_protected_objects) { var items = canvasTripwire5.getObjects(); @@ -4457,9 +4487,13 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire5.getObjects()[0].stroke = "#ffff00"; + + // console.log(canvasTripwire5.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire6 !== 'undefined') { + // console.log(canvasTripwire6.getObjects()); //Clear all objects while (canvasTripwire6.getObjects().length > max_protected_objects) { var items = canvasTripwire6.getObjects(); @@ -4468,9 +4502,13 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire6.getObjects()[0].stroke = "#ffff00"; + + // console.log(canvasTripwire6.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire7 !== 'undefined') { + // console.log(canvasTripwire7.getObjects()); //Clear all objects while (canvasTripwire7.getObjects().length > max_protected_objects) { var items = canvasTripwire7.getObjects(); @@ -4479,9 +4517,12 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire7.getObjects()[0].stroke = "#ffff00"; + // console.log(canvasTripwire7.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire8 !== 'undefined') { + // console.log(canvasTripwire8.getObjects()); //Clear all objects while (canvasTripwire8.getObjects().length > max_protected_objects) { var items = canvasTripwire8.getObjects(); @@ -4490,20 +4531,27 @@ function RefreshCanvasObject(max_protected_objects) { } } canvasTripwire8.getObjects()[0].stroke = "#ffff00"; + // console.log(canvasTripwire8.getObjects()); + // console.log("--------------------------"); } if (typeof canvasTripwire_all !== 'undefined') { + // console.log("click_canvas_all:", click_canvas_all); + // console.log(canvasTripwire_all.getObjects()); //Clear all objects while (canvasTripwire_all.getObjects().length > click_canvas_all) { var items = canvasTripwire_all.getObjects(); if (items[canvasTripwire_all.getObjects().length - 1]) { canvasTripwire_all.remove(items[canvasTripwire_all.getObjects().length - 1]); } + // canvasTripwire_all.remove(items[canvasTripwire_all.getObjects().length - 1]); } for (var index_click = 0; index_click < click_canvas_all; index_click++) { canvasTripwire_all.getObjects()[index_click].stroke = "#ffff00"; } + // console.log(canvasTripwire_all.getObjects()); + // console.log("--------------------------"); } } @@ -4582,6 +4630,7 @@ function GetRequest_WebSocket() { //console.log("WebSocket is supported by your Browser!"); //console.log(navigator.userAgent); // Let us open a web socket + if ( navigator.userAgent.indexOf( "nvr_auth=" ) != -1 ) ws = new WebSocket("ws://" + window.location.hostname + ":" + GetUrlPort() + "/getalarmmotion?" + navigator.userAgent ); else @@ -4666,6 +4715,7 @@ function GetRequest_WebSocket() { //console.log("WebSocket NOT supported by your Browser!"); } } + /* function reConnect() { //console.log("socket 連線斷開,正在嘗試重新建立連線"); @@ -4720,6 +4770,8 @@ function GetRequest_Http() { } function func_set_coldobjects(object_x, object_y, object_w, object_h, object_name) { + //console.log(`[func_set_coldobjects] obj x:${object_x} , y:${object_y} , w:${object_w} , h:${object_h} , name:${object_name}`); + $.ajax({ url: "/setconfig?coldobjects&x=" + object_x + "&y=" + object_y + "&w=" + object_w + "&h=" + object_h + "&Object=" + object_name, method: "GET", @@ -4834,7 +4886,6 @@ function func_translate_name(translate_name) { var label_names_zh_tw = data_zh_tw[key]; var label_names_ja_jp = data_ja_jp[key]; var label_names_it_it = data_it_it[key]; - if (localStorage.getItem("events_default_version") != null && localStorage.getItem("events_default_version") == "4") { if (translate_name == "person") { if (G_LANG == "zh_tw") @@ -4873,7 +4924,6 @@ function func_translate_name(translate_name) { else if (G_LANG == "it_it") translate_name = label_names_it_it; } - break; } } @@ -5321,3 +5371,119 @@ function func_changeColorBarMinMax(tofInfo) { } } + +// 11-01 +var defaultPolygonColor = "#ffff00"; // 預設色號 亮黃色的 Zone +var alarmColor = "#ff0000"; // 觸發 禁區、違停、警戒線 事件時,顯示紅色的 Zone ( Polygon ) +var defaultZoneAlarmStatus = {'behavior_id': 0, 'red_zone': 0, 'time_stamp': 0}; +var g_zoneAlarmStatus = func_initZoneAlarmStatus(defaultZoneAlarmStatus); +var g_zoneAlarmColorDisplayTime = 2; // Unit : second + +function func_checkZoneColor() +{ + // console.log("g_zoneAlarmStatus: ", g_zoneAlarmStatus); + + var currentTimeDiff = null; + var zoneColor = defaultPolygonColor; + for (var zoneIndex = 0; zoneIndex < MAX_DETECTION_ZONE; zoneIndex++) + { + zoneColor = defaultPolygonColor; + + if (g_zoneAlarmStatus[zoneIndex]['time_stamp'] > 0) + { + currentTimeDiff = new Date().getTime() - g_zoneAlarmStatus[zoneIndex]['time_stamp']; + if (currentTimeDiff > (g_zoneAlarmColorDisplayTime * 1000)) + { + // console.log(`[func_checkZoneColor] reset g_zoneAlarmStatus[${zoneIndex}]`); + + g_zoneAlarmStatus[zoneIndex]['behavior_id'] = 0; + g_zoneAlarmStatus[zoneIndex]['red_zone'] = 0; + g_zoneAlarmStatus[zoneIndex]['time_stamp'] = 0; + } // else 的 zone 仍在顯示時間內,仰賴 red_zone 賦予警報顏色 + + if (g_zoneAlarmStatus[zoneIndex]['red_zone'] == 1) + { + zoneColor = alarmColor; + } // else 的 zone 應是剛被 reset 狀態值的,以預設顏色顯示 + + } // else 是 時間戳被歸零的 以預設顏色顯示 + + // console.log(`[func_checkZoneColor] check zone ${(zoneIndex+1)} color:${zoneColor}`); + + // check all zone + // console.log("check show_all_zone: ", show_all_zone); + if (show_all_zone == 0) + { + // check which canvas is active + try + { + window["canvasTripwire"+(zoneIndex+1)].getObjects()[0].stroke = zoneColor; + } + catch (error) + { + console.log(error); + } + + } + else + { + if (zoneIndex < count_zone) { + // console.log(`[func_checkZoneColor] activeZoneIndex: ${zoneIndex}`); + canvasTripwire_all.getObjects()[zoneIndex].stroke = zoneColor; + } + + + } + } + +} + + +function func_checkTriggerZoneStatus(behavior_id) +{ + // console.log("checked_trigger_events:"); + // console.log(checked_trigger_events); + + //var trigger_index = null; + + /*if (behavior_id == 1) // 禁區 + { + trigger_index = 0; + } + else if (behavior_id == 4) // 違停 + { + trigger_index = 1; + } + else if (behavior_id == 8) // 警戒線 + { + trigger_index = 4; + }*/ + + for (var zoneIndex = 0; zoneIndex < MAX_DETECTION_ZONE; zoneIndex++) { + for (var trigger_index = 0; trigger_index < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; trigger_index++) { + if (checked_trigger_events[zoneIndex][trigger_index] == 1) { + if (g_zoneAlarmStatus[zoneIndex]['time_stamp'] == 0) { + g_zoneAlarmStatus[zoneIndex]['behavior_id'] = behavior_id; + g_zoneAlarmStatus[zoneIndex]['time_stamp'] = new Date().getTime(); + // console.log(`[func_checkTriggerZoneStatus] init g_zoneAlarmStatus[${zoneIndex}]['time_stamp']:${g_zoneAlarmStatus[zoneIndex]['time_stamp']}`); + g_zoneAlarmStatus[zoneIndex]['red_zone'] = 1; + } + break; + } + } + } + + // console.log("[func_checkTriggerZoneStatus] check g_zoneAlarmStatus:"); + // console.log(g_zoneAlarmStatus); +} + +function func_initZoneAlarmStatus(defaultValue) +{ + var array = []; + for (var i = 0; i < MAX_DETECTION_ZONE; i++) + { + // 確保每個元素都是一個新的副本,避免不同 Zone 紀載不同行為時互相干擾狀態值 + array.push(JSON.parse(JSON.stringify(defaultValue))); + } + return array; +} \ No newline at end of file diff --git a/Aida/alarm_on_airelay.html b/Aida/alarm_on_airelay.html index 1e8a4cc..4ba35dc 100644 --- a/Aida/alarm_on_airelay.html +++ b/Aida/alarm_on_airelay.html @@ -5,7 +5,7 @@ + content="no-store, must-revalidate" /> + body, html { font-family: "Arial"; } @@ -384,8 +385,8 @@ var g_times_get_bar = 0; var g_check_if_run_setting = 0; - var DETECT_EVENT_ID_ARRAY = ["0x00000001", "0x00000004", "0x00200000", "0x00400000", "0x00000008", "0x00000010", "0x00000020", "0x10000000", "0x20000000", "0x00800000", "0x01000000", "0x02000000", "0x04000000", "0x40000000", "0x80000000", "0x00002000", "0x00004000", "0x00000400", "0x00000800", "0x00001000", "0x00008000", "0x00040000", "0x08000000"]; + var DETECT_EVENT_ID_ARRAY = ["0x00000001", "0x00000004", "0x00200000", "0x00400000", "0x00000008", "0x00000010", "0x00000020", "0x10000000", "0x20000000", "0x00800000", "0x01000000", "0x02000000", "0x04000000", "0x40000000", "0x80000000", "0x00002000", "0x00004000", "0x00000400", "0x00000800", "0x00001000", "0x00008000", "0x00040000", "0x08000000"]; function update_canvas() { clearInterval(g_Canvas_BackgroundImage); @@ -756,9 +757,9 @@ event_stream = create_canvas_stream1(); var checkH264StreamIntervalID = null; - var checkH264StreamIntervalTime = 200; + var checkH264StreamIntervalTime = 10; var checkStreamingCounter = 0; - var checkCounterThreshold = 12; + var checkCounterThreshold = 15; clearInterval(checkH264StreamIntervalID); checkH264StreamIntervalID = setInterval(function () { @@ -774,7 +775,6 @@ if (checkStreamingCounter > checkCounterThreshold) { localStorage.setItem("receivedH264", check_h264_received); clearInterval(checkH264StreamIntervalID); - // 08-15 TODO 嘗試確認 getalarmmotion fetch 連線是否中斷 } }, checkH264StreamIntervalTime) @@ -1047,16 +1047,13 @@ -
- -
@@ -1175,7 +1172,6 @@
-
@@ -2157,8 +2153,7 @@ // 08-24 確認是否有設定警戒線的 Zone,額外再加上紅線物件 var arrow_num = 0; - for (var index_zone = 0; index_zone < count_zone; index_zone++) - { + for (var index_zone = 0; index_zone < count_zone; index_zone++) { // console.log(`[func_show_all_zone] check current_trigger[${index_zone}]: ${current_trigger[index_zone]}`); // 比照 func_listen_to_enable_or_disable_show_direction 開啟紅線物件可見性的條件 @@ -2194,14 +2189,14 @@ // ------------------------------------------------------ // 參照 Edit_Arrow points_array = GetPointLocation(index_zone); - + var index_point = g_mydirection[g_zone_id] - 1; var next_point = index_point + 1 >= 4 ? 0 : index_point + 1; var start_x = points_array[next_point].x; var start_y = points_array[next_point].y; var end_x = points_array[index_point].x; var end_y = points_array[index_point].y; - + arrow_obj = AddArrowObject(start_x, start_y, end_x, end_y) arrow_obj.visible = true; // ------------------------------------------------------ @@ -2281,6 +2276,7 @@ } function func_listen_to_enable_or_disable_show_direction() { + if (current_trigger[get_current_index_zone()] == 4 || current_trigger[get_current_index_zone()] == 17 || current_trigger[get_current_index_zone()] == 18 || @@ -7155,7 +7151,7 @@ // console.log("set zone 2 config"); var json_data_zone_2 = '{"view_setting":{"camera01":{'; json_data_zone_2 += '"detection_zone":['; - json_data_zone_2 += '{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_2 += '{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_2 += '{"queuing_count": "' + queuing_count[1]; json_data_zone_2 += '","enable_ivs_zone": "' + enable_ivs_zone[1]; json_data_zone_2 += '","parking_line": "' + parking_line[1]; @@ -7180,7 +7176,7 @@ // console.log("set zone 3 config"); var json_data_zone_3 = '{"view_setting":{"camera01":{'; json_data_zone_3 += '"detection_zone":['; - json_data_zone_3 += '{},{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_3 += '{},{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_3 += '{"queuing_count": "' + queuing_count[2]; json_data_zone_3 += '","enable_ivs_zone": "' + enable_ivs_zone[2]; json_data_zone_3 += '","parking_line": "' + parking_line[2]; @@ -7201,12 +7197,11 @@ func_setconfigfile(json_data_zone_3); } - if (count_zone >= 4) { // console.log("set zone 4 config"); var json_data_zone_4 = '{"view_setting":{"camera01":{'; json_data_zone_4 += '"detection_zone":['; - json_data_zone_4 += '{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_4 += '{},{},{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_4 += '{"queuing_count": "' + queuing_count[3]; json_data_zone_4 += '","enable_ivs_zone": "' + enable_ivs_zone[3]; json_data_zone_4 += '","parking_line": "' + parking_line[3]; @@ -7231,7 +7226,7 @@ // console.log("set zone 5 config"); var json_data_zone_5 = '{"view_setting":{"camera01":{'; json_data_zone_5 += '"detection_zone":['; - json_data_zone_5 += '{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_5 += '{},{},{},{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_5 += '{"queuing_count": "' + queuing_count[4]; json_data_zone_5 += '","enable_ivs_zone": "' + enable_ivs_zone[4]; json_data_zone_5 += '","parking_line": "' + parking_line[4]; @@ -7252,12 +7247,11 @@ func_setconfigfile(json_data_zone_5); } - if (count_zone >= 6) { // console.log("set zone 6 config"); var json_data_zone_6 = '{"view_setting":{"camera01":{'; json_data_zone_6 += '"detection_zone":['; - json_data_zone_6 += '{},{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_6 += '{},{},{},{},{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_6 += '{"queuing_count": "' + queuing_count[5]; json_data_zone_6 += '","enable_ivs_zone": "' + enable_ivs_zone[5]; json_data_zone_6 += '","parking_line": "' + parking_line[5]; @@ -7277,13 +7271,12 @@ // console.log("------------------------------------------------"); func_setconfigfile(json_data_zone_6); } - - + if (count_zone >= 7) { // console.log("set zone 7 config"); var json_data_zone_7 = '{"view_setting":{"camera01":{'; json_data_zone_7 += '"detection_zone":['; - json_data_zone_7 += '{},{},{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_7 += '{},{},{},{},{},{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_7 += '{"queuing_count": "' + queuing_count[6]; json_data_zone_7 += '","enable_ivs_zone": "' + enable_ivs_zone[6]; json_data_zone_7 += '","parking_line": "' + parking_line[6]; @@ -7304,12 +7297,11 @@ func_setconfigfile(json_data_zone_7); } - if (count_zone >= 8) { // console.log("set zone 8 config"); var json_data_zone_8 = '{"view_setting":{"camera01":{'; json_data_zone_8 += '"detection_zone":['; - json_data_zone_8 += '{},{},{},{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式 + json_data_zone_8 += '{},{},{},{},{},{},{},'; // 補上index之前 空的 dict,確保次序對上既有格式 json_data_zone_8 += '{"queuing_count": "' + queuing_count[7]; json_data_zone_8 += '","enable_ivs_zone": "' + enable_ivs_zone[7]; json_data_zone_8 += '","parking_line": "' + parking_line[7]; @@ -7930,7 +7922,6 @@ } } - var json_data_trigger = '{"view_setting":{"camera01":{"detection_zone":['; for (var i = 0; i < count_zone; i++) { if (i == count_zone - 1) { @@ -8197,9 +8188,6 @@ } isMouseDown = false; - - - if (typeof canvasTripwire_all !== 'undefined') { console.log("[onMouseUp] #metadata_mouse_coldobjects val:", $('#metadata_mouse_coldobjects').val()); diff --git a/Aida/alarm_on_airelay.js b/Aida/alarm_on_airelay.js index 71b9265..a6a4a0f 100644 --- a/Aida/alarm_on_airelay.js +++ b/Aida/alarm_on_airelay.js @@ -704,7 +704,7 @@ function insertTrafficLightRectangle(r_left, r_top, r_width, r_height, r_direct, if (r_name == "person") { color_type = '#FF8C00'; } - else { + else if(r_name == "car"){ color_type = '#800080'; } } @@ -1616,7 +1616,6 @@ var red_light_zone6; var red_light_zone7; var red_light_zone8; - function createCanvasTrafficLight_alarm(mypoints1, mypoints2, mypoints3, mypoints4, mypoints5, mypoints6, mypoints7, mypoints8) { currentPointPosition1 = mypoints1; currentPointPosition2 = mypoints2; @@ -3970,6 +3969,7 @@ function GetAlarm(alarm_data) { else { label_word = color; } + //console.log(label_word); if (plate_name == "tof_point") { if ((ai_json.AiEngine[i].max_distance != 0 && ai_json.AiEngine[i].max_height != 0) || @@ -4021,7 +4021,7 @@ function GetAlarm(alarm_data) { // console.log("detection_zone_id: ", detection_zone_id); // undefined func_checkTriggerZoneStatus(behavior_id); // 為了連動 zone polygon 變顏色 - + canvasTripwire_all.add(insertTrafficLightRectangle_Red(x * G_CANVAS_WIDTH_RATIO, y * G_CANVAS_HEIGHT_RATIO, w * G_CANVAS_WIDTH_RATIO, h * G_CANVAS_HEIGHT_RATIO, 1, 1, plate_name)); canvasTripwire.add(insertTrafficLightRectangle_Red(x * G_CANVAS_WIDTH_RATIO, y * G_CANVAS_HEIGHT_RATIO, w * G_CANVAS_WIDTH_RATIO, h * G_CANVAS_HEIGHT_RATIO, 1, 1, plate_name)); canvasTripwire1.add(insertTrafficLightRectangle_Red(x * G_CANVAS_WIDTH_RATIO, y * G_CANVAS_HEIGHT_RATIO, w * G_CANVAS_WIDTH_RATIO, h * G_CANVAS_HEIGHT_RATIO, 1, 1, plate_name)); @@ -4594,7 +4594,8 @@ function GetAlarm(alarm_data) { } } } - } + } + RenderAllCanvas(); ai_json = null; } @@ -5967,44 +5968,6 @@ function func_changeColorBarMinMax(tofInfo) { } -// JVC version -// function create_canvas_stream(specifyProfileNo) { -// console.log("[create_canvas_stream] init H264 streaming"); -// //var g_profileno = GetCookie('profileno'); - -// var ui_width = G_VIEW_CANVAS_X; -// var ui_height = G_VIEW_CANVAS_Y; - -// var l_cgi = "/websocket?"; -// var l_token = ""; - -// //var event_uri = l_cgi + 'eventstream=' + g_profileno + l_token; -// var event_uri = l_cgi + 'eventstream=0' + l_token; - -// var g_event_para = new _codec_para(); -// g_event_para.worker_num = 1; - -// //g_event_para.vc[0] = { width: g_setup_PROFILE_Width[g_profileno], height: g_setup_PROFILE_Height[g_profileno], id: "video_container", frameszie: 4096000 }; -// g_event_para.vc[0] = { width: '1920', height: '1080', id: "CanvasBgContainer", frameszie: 4096000 }; - -// g_event_para.droplatencydecoded = true; - -// g_event_stream = new _codec(g_event_para); - -// g_event_stream.streamType = WS_WR; - -// var node = document.getElementById(g_event_para.vc[0].id); - -// node.appendChild(g_event_stream.get_vc_element(0)); - -// g_event_stream.set_vc_element_size(0, ui_width, ui_height); //display size - -// g_event_stream.init_event(0, 0, event_uri); - -// g_event_stream.DecodeInit('1', 5, '1920', '1080', '10', '8000', 16000); - -// console.log('[create_canvas_stream] start H264 streaming'); -// } var g_event_stream = null; @@ -6093,27 +6056,34 @@ function openIVSsettins() { var k_count = -1; function func_setconfigfile(json_data) { + waitSeconds(100); $.ajax({ url: '/' + g_tcp_tunnel_token + "/setconfigfile", method: "POST", async: false, data: json_data, - contentType: false, + //contentType: false, processData: false, + timeout: 5000, + cache: false, + xhrFields: { + withCredentials: true // 設置為 true 如果需要帶上 Cookies 或其他認證 + }, + contentType: 'text/plain', // 傳送純文本 beforeSend: function (xmlHttp) { xmlHttp.setRequestHeader("If-Modified-Since", "0"); xmlHttp.setRequestHeader("Cache-Control", "no-cache"); //xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); }, - success: function () { + success: function (retdata) { //console.info(); }, - error: function () { - console.warn(); + error: function (retdata) { + console.warn(retdata); k_count++; if (k_count <= 94) { - waitSeconds(500); + waitSeconds(1000); func_setconfigfile(json_data); } } @@ -6193,9 +6163,9 @@ function func_checkTriggerZoneStatus(behavior_id) // console.log("checked_trigger_events:"); // console.log(checked_trigger_events); - var trigger_index = null; + //var trigger_index = null; - if (behavior_id == 1) // 禁區 + /*if (behavior_id == 1) // 禁區 { trigger_index = 0; } @@ -6206,23 +6176,24 @@ function func_checkTriggerZoneStatus(behavior_id) else if (behavior_id == 8) // 警戒線 { trigger_index = 4; - } + }*/ for (var zoneIndex = 0; zoneIndex < MAX_DETECTION_ZONE; zoneIndex++) { - if (checked_trigger_events[zoneIndex][trigger_index] == 1) - { - if (g_zoneAlarmStatus[zoneIndex]['time_stamp'] == 0) { - g_zoneAlarmStatus[zoneIndex]['behavior_id'] = behavior_id; - g_zoneAlarmStatus[zoneIndex]['time_stamp'] = new Date().getTime(); - // console.log(`[func_checkTriggerZoneStatus] init g_zoneAlarmStatus[${zoneIndex}]['time_stamp']:${g_zoneAlarmStatus[zoneIndex]['time_stamp']}`); - g_zoneAlarmStatus[zoneIndex]['red_zone'] = 1; + for (var trigger_index = 0; trigger_index < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; trigger_index++) { + if (checked_trigger_events[zoneIndex][trigger_index] == 1) { + if (g_zoneAlarmStatus[zoneIndex]['time_stamp'] == 0) { + g_zoneAlarmStatus[zoneIndex]['behavior_id'] = behavior_id; + g_zoneAlarmStatus[zoneIndex]['time_stamp'] = new Date().getTime(); + // console.log(`[func_checkTriggerZoneStatus] init g_zoneAlarmStatus[${zoneIndex}]['time_stamp']:${g_zoneAlarmStatus[zoneIndex]['time_stamp']}`); + g_zoneAlarmStatus[zoneIndex]['red_zone'] = 1; + } + break; } } } // console.log("[func_checkTriggerZoneStatus] check g_zoneAlarmStatus:"); // console.log(g_zoneAlarmStatus); - } function func_initZoneAlarmStatus(defaultValue) diff --git a/Aida/alarm_on_nvr.html b/Aida/alarm_on_nvr.html index 78be6e4..651f400 100644 --- a/Aida/alarm_on_nvr.html +++ b/Aida/alarm_on_nvr.html @@ -278,8 +278,8 @@ var g_times_get_bar = 0; var g_check_if_run_setting = 0; - var DETECT_EVENT_ID_ARRAY = ["0x00000001", "0x00000004", "0x00200000", "0x00400000", "0x00000008", "0x00000010", "0x00000020", "0x10000000", "0x20000000", "0x00800000", "0x01000000", "0x02000000", "0x04000000", "0x40000000", "0x80000000", "0x00002000", "0x00004000", "0x00000400", "0x00000800", "0x00001000", "0x00008000", "0x00040000", "0x08000000"]; + var DETECT_EVENT_ID_ARRAY = ["0x00000001", "0x00000004", "0x00200000", "0x00400000", "0x00000008", "0x00000010", "0x00000020", "0x10000000", "0x20000000", "0x00800000", "0x01000000", "0x02000000", "0x04000000", "0x40000000", "0x80000000", "0x00002000", "0x00004000", "0x00000400", "0x00000800", "0x00001000", "0x00008000", "0x00040000", "0x08000000"]; function update_canvas() { clearInterval(g_Canvas_BackgroundImage); @@ -1390,7 +1390,7 @@ // reversed:true, // disabled:true, min: 0, - max: 100, + max: 30, // step:2.5, //提示格式函数 tipFormatter: function (value) { @@ -1967,7 +1967,64 @@ } } } - click_canvas_all = count_zone; + + // 08-24 確認是否有設定警戒線的 Zone,額外再加上紅線物件 + var arrow_num = 0; + for (var index_zone = 0; index_zone < count_zone; index_zone++) { + // console.log(`[func_show_all_zone] check current_trigger[${index_zone}]: ${current_trigger[index_zone]}`); + + // 比照 func_listen_to_enable_or_disable_show_direction 開啟紅線物件可見性的條件 + if ( + current_trigger[index_zone] == 4 + || current_trigger[index_zone] == 17 + || current_trigger[index_zone] == 18 + || current_trigger[index_zone] == 19 + ) { + arrow_num++; + var arrow_obj = null; + // ------------------------------------------------------ + // 比照 clone 寫法位置會有問題,改仿照 Edit_Arrow 內部流程新增紅線物件 + // if (index_zone == 0) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire1.getObjects()[1]); + // } + // else if (index_zone == 1) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire2.getObjects()[1]); + // } + // else if (index_zone == 2) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire3.getObjects()[1]); + // } + // else if (index_zone == 3) + // { + // arrow_obj = fabric.util.object.clone(canvasTripwire4.getObjects()[1]); + // } + + // console.log("clone arrow_obj:"); + // console.log(arrow_obj); + // ------------------------------------------------------ + // 參照 Edit_Arrow + points_array = GetPointLocation(index_zone); + + var index_point = g_mydirection[g_zone_id] - 1; + var next_point = index_point + 1 >= 4 ? 0 : index_point + 1; + var start_x = points_array[next_point].x; + var start_y = points_array[next_point].y; + var end_x = points_array[index_point].x; + var end_y = points_array[index_point].y; + + arrow_obj = AddArrowObject(start_x, start_y, end_x, end_y) + arrow_obj.visible = true; + // ------------------------------------------------------ + if (arrow_obj != null) { + canvasTripwire_all.add(arrow_obj); + } + } + } + + // click_canvas_all = count_zone; + click_canvas_all = count_zone + arrow_num; // 確保多新增的紅線物件不會馬上被 RefreshCanvasObject 保護物件數量參數給清除掉 canvasTripwire_all.requestRenderAll(); //document.getElementById('IDOK').disabled = true; @@ -4283,7 +4340,7 @@ disabelIteraction(canvasTripwire7.getObjects()[0]); Edit8(); } - + func_getbar(); show_tof_map(); } @@ -4410,6 +4467,7 @@ } } + function func_setAlarmData() { if (lock_IDOK == 1) { alert(IDC_STATIC_SHOW_ALL_ALERT); @@ -6773,8 +6831,11 @@ var json_data = '{"view_setting":{"camera01":{"obj_max_proportion": "' + obj_max_proportion; json_data += '","obj_min_proportion": "' + obj_min_proportion + '","enable_traffic": "' + enable_traffic + '","enable_unknown_object": "' + enable_unknown_object + '","enable_track": "' + enable_track; json_data += '","confidence2": "' + confidence_traffic + '","count_zone": ' + count_zone; - json_data += ',"detection_zone":['; + json_data += '}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; json_data += '{"enable_direction1": "' + enable_direction[0]; json_data += '","direction1": "' + func_get_direction(0).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[0]; @@ -6801,8 +6862,12 @@ json_data += ',"y5": ' + Math.round(points_array_0[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_0[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_0[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},' json_data += '{"enable_direction1": "' + enable_direction[1]; json_data += '","direction1": "' + func_get_direction(1).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[1]; @@ -6829,8 +6894,12 @@ json_data += ',"y5": ' + Math.round(points_array_1[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_1[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_1[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},'; json_data += '{"enable_direction1": "' + enable_direction[2]; json_data += '","direction1": "' + func_get_direction(2).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[2]; @@ -6857,8 +6926,12 @@ json_data += ',"y5": ' + Math.round(points_array_2[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_2[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_2[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[3]; json_data += '","direction1": "' + func_get_direction(3).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[3]; @@ -6885,8 +6958,12 @@ json_data += ',"y5": ' + Math.round(points_array_3[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_3[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_3[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[4]; json_data += '","direction1": "' + func_get_direction(4).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[4]; @@ -6913,8 +6990,12 @@ json_data += ',"y5": ' + Math.round(points_array_4[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_4[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_4[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[5]; json_data += '","direction1": "' + func_get_direction(5).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[5]; @@ -6941,8 +7022,12 @@ json_data += ',"y5": ' + Math.round(points_array_5[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_5[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_5[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[6]; json_data += '","direction1": "' + func_get_direction(6).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[6]; @@ -6969,8 +7054,12 @@ json_data += ',"y5": ' + Math.round(points_array_6[4].y * tab_view_size[1] / image_height); json_data += ',"x6": ' + Math.round(points_array_6[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_6[5].y * tab_view_size[1] / image_height); - json_data += '},'; + json_data += '}]}}}'; + func_setconfigfile(json_data); + json_data = '{"view_setting":{"camera01":{'; + json_data += '"detection_zone":['; + json_data += '{},{},{},{},{},{},{},'; json_data += '{"enable_direction1": "' + enable_direction[7]; json_data += '","direction1": "' + func_get_direction(7).toString(); json_data += '","enable_ivs_zone": "' + enable_ivs_zone[7]; @@ -6998,8 +7087,6 @@ json_data += ',"x6": ' + Math.round(points_array_7[5].x * tab_view_size[0] / image_width); json_data += ',"y6": ' + Math.round(points_array_7[5].y * tab_view_size[1] / image_height); json_data += '}]}}}'; - - //console.log(json_data); func_setconfigfile(json_data); var text_checked_trigger_events = new Array(MAX_DETECTION_ZONE); @@ -7274,7 +7361,7 @@ //k_index = 95; } else if (k_index == 100) { - func_run_osd_server(); + //func_run_osd_server(); $(".progress-bar").css("visibility", "hidden"); //$(".progress-bar").css("width", "0%").text("0 %"); diff --git a/Aida/codemirror.min.css b/Aida/codemirror.min.css index 60c4ea2..2ef25ea 100644 --- a/Aida/codemirror.min.css +++ b/Aida/codemirror.min.css @@ -1,434 +1 @@ -.CodeMirror { - font-family: monospace; - height: 300px; - color: #000; - direction: ltr; - position: relative; - overflow: hidden; - background: #fff; -} - -.CodeMirror-lines { - padding: 4px 0; -} - -.CodeMirror pre.CodeMirror-line, -.CodeMirror pre.CodeMirror-line-like { - padding: 0 4px; -} - -.CodeMirror-gutter-filler, -.CodeMirror-scrollbar-filler { - background-color: #fff; -} - -.CodeMirror-gutters { - border-right: 1px solid #ddd; - background-color: #f7f7f7; - white-space: nowrap; -} - -.CodeMirror-linenumber { - padding: 0 3px 0 5px; - min-width: 20px; - text-align: right; - color: #999; - white-space: nowrap; -} - -.CodeMirror-guttermarker { - color: #000; -} - -.CodeMirror-guttermarker-subtle { - color: #999; -} - -.CodeMirror-cursor { - border-left: 1px solid #000; - border-right: none; - width: 0; -} - -div.CodeMirror-secondarycursor { - border-left: 1px solid silver; -} - -.cm-fat-cursor .CodeMirror-cursor { - width: auto; - border: 0 !important; - background: #7e7; -} - -.cm-fat-cursor div.CodeMirror-cursors { - z-index: 1; -} - -.cm-fat-cursor .CodeMirror-line::selection, -.cm-fat-cursor .CodeMirror-line > span::selection, -.cm-fat-cursor .CodeMirror-line > span > span::selection { - background: transparent; -} - -.cm-fat-cursor .CodeMirror-line::-moz-selection, -.cm-fat-cursor .CodeMirror-line > span::-moz-selection, -.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { - background: transparent; -} - -.cm-fat-cursor { - caret-color: transparent; -} - -@-moz-keyframes blink { - 50% { - background-color: transparent; - } -} - -@-webkit-keyframes blink { - 50% { - background-color: transparent; - } -} - -@keyframes blink { - 50% { - background-color: transparent; - } -} - -.cm-tab { - display: inline-block; - text-decoration: inherit; -} - -.CodeMirror-rulers { - position: absolute; - left: 0; - right: 0; - top: -50px; - bottom: 0; - overflow: hidden; -} - -.CodeMirror-ruler { - border-left: 1px solid #ccc; - top: 0; - bottom: 0; - position: absolute; -} - -.cm-s-default .cm-header { - color: #00f; -} - -.cm-s-default .cm-quote { - color: #090; -} - -.cm-negative { - color: #d44; -} - -.cm-positive { - color: #292; -} - -.cm-header, -.cm-strong { - font-weight: 700; -} - -.cm-em { - font-style: italic; -} - -.cm-link { - text-decoration: underline; -} - -.cm-strikethrough { - text-decoration: line-through; -} - -.cm-s-default .cm-keyword { - color: #708; -} - -.cm-s-default .cm-atom { - color: #219; -} - -.cm-s-default .cm-number { - color: #164; -} - -.cm-s-default .cm-def { - color: #00f; -} - -.cm-s-default .cm-variable-2 { - color: #05a; -} - -.cm-s-default .cm-type, -.cm-s-default .cm-variable-3 { - color: #085; -} - -.cm-s-default .cm-comment { - color: #a50; -} - -.cm-s-default .cm-string { - color: #a11; -} - -.cm-s-default .cm-string-2 { - color: #f50; -} - -.cm-s-default .cm-meta, -.cm-s-default .cm-qualifier { - color: #555; -} - -.cm-s-default .cm-builtin { - color: #30a; -} - -.cm-s-default .cm-bracket { - color: #997; -} - -.cm-s-default .cm-tag { - color: #170; -} - -.cm-s-default .cm-attribute, -.cm-s-default .cm-link { - color: #00c; -} - -.cm-s-default .cm-hr { - color: #999; -} - -.cm-s-default .cm-error, -.cm-invalidchar { - color: red; -} - -.CodeMirror-composing { - border-bottom: 2px solid; -} - -div.CodeMirror span.CodeMirror-matchingbracket { - color: #0b0; -} - -div.CodeMirror span.CodeMirror-nonmatchingbracket { - color: #a22; -} - -.CodeMirror-matchingtag { - background: rgba(255, 150, 0, 0.3); -} - -.CodeMirror-activeline-background { - background: #e8f2ff; -} - -.CodeMirror-scroll { - overflow: scroll !important; - margin-bottom: -50px; - margin-right: -50px; - padding-bottom: 50px; - height: 100%; - outline: 0; - position: relative; - z-index: 0; -} - -.CodeMirror-sizer { - position: relative; - border-right: 50px solid transparent; -} - -.CodeMirror-gutter-filler, -.CodeMirror-hscrollbar, -.CodeMirror-scrollbar-filler, -.CodeMirror-vscrollbar { - position: absolute; - z-index: 6; - display: none; - outline: 0; -} - -.CodeMirror-vscrollbar { - right: 0; - top: 0; - overflow-x: hidden; - overflow-y: scroll; -} - -.CodeMirror-hscrollbar { - bottom: 0; - left: 0; - overflow-y: hidden; - overflow-x: scroll; -} - -.CodeMirror-scrollbar-filler { - right: 0; - bottom: 0; -} - -.CodeMirror-gutter-filler { - left: 0; - bottom: 0; -} - -.CodeMirror-gutters { - position: absolute; - left: 0; - top: 0; - min-height: 100%; - z-index: 3; -} - -.CodeMirror-gutter { - white-space: normal; - height: 100%; - display: inline-block; - vertical-align: top; - margin-bottom: -50px; -} - -.CodeMirror-gutter-wrapper { - position: absolute; - z-index: 4; - background: transparent !important; - border: none !important; -} - -.CodeMirror-gutter-background { - position: absolute; - top: 0; - bottom: 0; - z-index: 4; -} - -.CodeMirror-gutter-elt { - position: absolute; - cursor: default; - z-index: 4; -} - -.CodeMirror-gutter-wrapper ::selection, -.CodeMirror-gutter-wrapper ::-moz-selection { - background-color: transparent; -} - -.CodeMirror-lines { - cursor: text; - min-height: 1px; -} - -.CodeMirror pre.CodeMirror-line, -.CodeMirror pre.CodeMirror-line-like { - border-radius: 0; - border-width: 0; - background: transparent; - font-family: inherit; - font-size: inherit; - margin: 0; - white-space: pre; - word-wrap: normal; - line-height: inherit; - color: inherit; - z-index: 2; - position: relative; - overflow: visible; - -webkit-tap-highlight-color: transparent; - -webkit-font-variant-ligatures: contextual; - font-variant-ligatures: contextual; -} - -.CodeMirror-wrap pre.CodeMirror-line, -.CodeMirror-wrap pre.CodeMirror-line-like { - word-wrap: break-word; - white-space: pre-wrap; - word-break: normal; -} - -.CodeMirror-linebackground { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - z-index: 0; -} - -.CodeMirror-linewidget { - position: relative; - z-index: 2; - padding: 0.1px; -} - -.CodeMirror-rtl pre { - direction: rtl; -} - -.CodeMirror-code { - outline: 0; -} - -.CodeMirror-selected { - background: #d9d9d9; -} - -.CodeMirror-focused .CodeMirror-selected { - background: #d7d4f0; -} - -.CodeMirror-crosshair { - cursor: crosshair; -} - -.CodeMirror-line::selection, -.CodeMirror-line > span::selection, -.CodeMirror-line > span > span::selection { - background: #d7d4f0; -} - -.CodeMirror-line::-moz-selection, -.CodeMirror-line > span::-moz-selection, -.CodeMirror-line > span > span::-moz-selection { - background: #d7d4f0; -} - -.cm-searching { - background-color: #ffa; - background-color: rgba(255, 255, 0, 0.4); -} - -.cm-force-border { - padding-right: 0.1px; -} - -@media print { - .CodeMirror div.CodeMirror-cursors { - visibility: hidden; - } -} - -.cm-tab-wrap-hack:after { - content: ''; -} - -span.CodeMirror-selectedtext { - background: transparent; -} +.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0} \ No newline at end of file diff --git a/Aida/cool_counter.js b/Aida/cool_counter.js index eedf620..0f9d602 100644 --- a/Aida/cool_counter.js +++ b/Aida/cool_counter.js @@ -70,7 +70,7 @@ function insertTrafficLightRectangle(r_left, r_top, r_width, r_height, r_direct, if (r_name == "person") { color_type = '#FF8C00'; } - else { + else if (r_name == "car") { color_type = '#800080'; } } diff --git a/Aida/heatmap.js b/Aida/heatmap.js index 06b2dda..685ea88 100644 --- a/Aida/heatmap.js +++ b/Aida/heatmap.js @@ -230,7 +230,7 @@ function insertTrafficLightRectangle(r_left, r_top, r_width, r_height, r_direct, if (r_name == "person") { color_type = '#FF8C00'; } - else { + else if (r_name == "car") { color_type = '#800080'; } } diff --git a/Aida/images/blank.gif b/Aida/images/blank.gif deleted file mode 100644 index 1d11fa9..0000000 Binary files a/Aida/images/blank.gif and /dev/null differ diff --git a/Aida/images/loading.gif b/Aida/images/loading.gif deleted file mode 100644 index 68f01d0..0000000 Binary files a/Aida/images/loading.gif and /dev/null differ diff --git a/Aida/index.html b/Aida/index.html index 33ae955..b0b6874 100644 --- a/Aida/index.html +++ b/Aida/index.html @@ -1437,7 +1437,7 @@ localStorage.setItem('current_state_hide_or_open_label', 0); } else { - localStorage.setItem('current_state_hide_or_open_label', 1); + localStorage.setItem('current_state_hide_or_open_label', 0); } } diff --git a/Aida/label_names.js b/Aida/label_names.js index 8823b5c..f8d0f38 100644 --- a/Aida/label_names.js +++ b/Aida/label_names.js @@ -200,8 +200,8 @@ var LABEL_NAMES = '{' + '"LABEL_NAMES_161": "fishing",' + '"LABEL_NAMES_162": "carrier",' + '"LABEL_NAMES_163": "yacht",' + - '"LABEL_NAMES_164": "bridge_crane_up",' + - '"LABEL_NAMES_165": "bridge_crane_down"' + + '"LABEL_NAMES_164": "_s",' + //bridge_crane_up + '"LABEL_NAMES_165": "_s"' + //bridge_crane_down '}],' + '"AIFRONTBACK" : [{' + '"LABEL_NAMES_340": "dual_headlight",' + @@ -558,8 +558,8 @@ var LABEL_NAMES_zh_tw = '{' + '"LABEL_NAMES_161": "釣魚",' + '"LABEL_NAMES_162": "載體",' + '"LABEL_NAMES_163": "遊艇",' + - '"LABEL_NAMES_164": "橋式起重機運作中",' + - '"LABEL_NAMES_165": "橋式起重機停機"' + + '"LABEL_NAMES_164": "_s",' +//橋式起重機運作中 + '"LABEL_NAMES_165": "_s"' +//橋式起重機停機 '}],' + '"AIFRONTBACK" : [{' + '"LABEL_NAMES_340": "雙車燈",' + @@ -916,8 +916,8 @@ var LABEL_NAMES_ja_jp = '{' + '"LABEL_NAMES_161": "釣り",' + '"LABEL_NAMES_162": "キャリア",' + '"LABEL_NAMES_163": "ヨット",' + - '"LABEL_NAMES_164": "ブリッジクレーンアップ",' + - '"LABEL_NAMES_165": "ブリッジクレーンダウン"' + + '"LABEL_NAMES_164": "_s",' +//ブリッジクレーンアップ + '"LABEL_NAMES_165": "_s"' +//ブリッジクレーンダウン '}],' + '"AIFRONTBACK" : [{' + '"LABEL_NAMES_340": "ダブルヘッドライト",' + @@ -1274,8 +1274,8 @@ var LABEL_NAMES_it_it = '{' + '"LABEL_NAMES_161": "pesca",' + '"LABEL_NAMES_162": "vettore",' + '"LABEL_NAMES_163": "yacht",' + - '"LABEL_NAMES_164": "gru_a_ponte_su",' + - '"LABEL_NAMES_165": "gru_a_ponte_giù"' + + '"LABEL_NAMES_164": "_s",' +//gru_a_ponte_su + '"LABEL_NAMES_165": "_s"' +//gru_a_ponte_giù '}],' + '"AIFRONTBACK" : [{' + '"LABEL_NAMES_340": "doppio_faro",' + diff --git a/Aida/lang.js b/Aida/lang.js index 46e467f..d651460 100644 --- a/Aida/lang.js +++ b/Aida/lang.js @@ -1041,8 +1041,8 @@ var LANGUAGE = '{'+ '"IDC_STATIC_FPS": "FPS",' + '"IDC_STATIC_SETTING_PORT": "通信埠 / Port #",' + '"IDC_STATIC_ENABLE_SYSTEM_LOGS": "開啟紀錄",' + - '"IDC_STATIC_ENABLE_PYTHON": "開啟 python",' + - '"IDC_STATIC_ENABLE_PYTHON_FILE": "啟動 python 檔案",' + + '"IDC_STATIC_ENABLE_PYTHON": "開啟python",' + + '"IDC_STATIC_ENABLE_PYTHON_FILE": "Python狀態",' + '"HTTP_TITLE01": "車牌辨識",'+ '"HTTP_TITLE02": "車牌辨識清單",'+ '"HTTP_TITLE03": "車牌轉換表",'+ @@ -1796,7 +1796,7 @@ var LANGUAGE = '{'+ '"IDC_STATIC_SETTING_PORT": "ポート / Port #",' + '"IDC_STATIC_ENABLE_SYSTEM_LOGS": "ログを有効にする",' + '"IDC_STATIC_ENABLE_PYTHON": "Pythonを有効にする",' + - '"IDC_STATIC_ENABLE_PYTHON_FILE": "Python アーカイブを有効にする",'+ + '"IDC_STATIC_ENABLE_PYTHON_FILE": "Python像",'+ '"HTTP_TITLE01": "ナンバープレート",'+ '"HTTP_TITLE02": "LPR リスト",'+ '"HTTP_TITLE03": "リンクデータベース",'+ @@ -2536,8 +2536,8 @@ var LANGUAGE = '{'+ '"IDC_STATIC_FPS": "FPS",' + '"IDC_STATIC_SETTING_PORT": "Porta #",' + '"IDC_STATIC_ENABLE_SYSTEM_LOGS": "Abilita i log",' + - '"IDC_STATIC_ENABLE_PYTHON": "Abilita Python",' + - '"IDC_STATIC_ENABLE_PYTHON_FILE": "Abilita gli archivi Python",' + + '"IDC_STATIC_ENABLE_PYTHON": "Abilita python",' + + '"IDC_STATIC_ENABLE_PYTHON_FILE": "Stato",' + '"HTTP_TITLE01": "LPR",'+ '"HTTP_TITLE02": "LPR LISTA",'+ '"HTTP_TITLE03": "MAPPING",'+ diff --git a/Aida/lilin.png b/Aida/lilin.png index 1bd6d07..6a9a121 100644 Binary files a/Aida/lilin.png and b/Aida/lilin.png differ diff --git a/Aida/menu_on_nvr.html b/Aida/menu_on_nvr.html index 2521110..3b81acd 100644 --- a/Aida/menu_on_nvr.html +++ b/Aida/menu_on_nvr.html @@ -58,7 +58,7 @@ localStorage.setItem('current_state_hide_or_open_label', 0); } else { - localStorage.setItem('current_state_hide_or_open_label', 1); + localStorage.setItem('current_state_hide_or_open_label', 0); } } diff --git a/Aida/ptz.js b/Aida/ptz.js index e4c46fd..60c4eb4 100644 --- a/Aida/ptz.js +++ b/Aida/ptz.js @@ -135,7 +135,7 @@ function insertTrafficLightRectangle(r_left, r_top, r_width, r_height, r_direct, if (r_name == "person") { color_type = '#FF8C00'; } - else { + else if (r_name == "car") { color_type = '#800080'; } } diff --git a/Aida/python.html b/Aida/python.html index 991b6bc..fe20a32 100644 --- a/Aida/python.html +++ b/Aida/python.html @@ -1,6 +1,5 @@  - @@ -9,9 +8,6 @@ - - - @@ -19,22 +15,20 @@ - + - + - - -
-
-
-
@@ -270,7 +262,6 @@
- - - + \ No newline at end of file diff --git a/Aida/python.min.js b/Aida/python.min.js index 0271d12..6a64e54 100644 --- a/Aida/python.min.js +++ b/Aida/python.min.js @@ -1,125 +1 @@ -(function (e) { - if (typeof exports === "object" && typeof module === "object") { - e(require("../../lib/codemirror")); - } else if (typeof define === "function" && define.amd) { - define(["../../lib/codemirror"], e); - } else { - e(CodeMirror); - } -})(function (x) { - "use strict"; - - function k(e) { - return new RegExp("^((" + e.join(")|(") + "))\\b"); - } - - var _ = k(["and", "or", "not", "is"]), - v = ["as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "finally", "for", "from", "global", "if", "import", "lambda", "pass", "raise", "return", "try", "while", "with", "yield", "in"], - z = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr", "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "filter", "float", "format", "frozenset", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "int", "isinstance", "issubclass", "iter", "len", "list", "locals", "map", "max", "memoryview", "min", "next", "object", "oct", "open", "ord", "pow", "property", "range", "repr", "reversed", "round", "set", "setattr", "slice", "sorted", "staticmethod", "str", "sum", "super", "tuple", "type", "vars", "zip", "__import__", "NotImplemented", "Ellipsis", "__debug__"]; - - function w(e) { - return e.scopes[e.scopes.length - 1]; - } - - x.registerHelper("hintWords", "python", v.concat(z)); - x.defineMode("python", function (t, l) { - var s = "error", - o = l.delimiters || l.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/, - a = [l.singleOperators, l.doubleOperators, l.doubleDelimiters, l.tripleDelimiters, l.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/]; - - for (var e = 0; e < a.length; e++) { - if (!a[e]) a.splice(e--, 1); - } - - var c, u, f = l.hangingIndent || t.indentUnit, n = v, r = z; - var p = (l.extra_keywords && (n = n.concat(l.extra_keywords)), - l.extra_builtins && (r = r.concat(l.extra_builtins)), - !(l.version && Number(l.version) < 3)); - var d = p ? ( - c = l.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/, - n = n.concat(["nonlocal", "False", "True", "None", "async", "await"]), - r = r.concat(["ascii", "bytes", "exec", "print"]), - new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i") - ) : ( - c = l.identifiers || /^[_A-Za-z][_A-Za-z0-9]*/, - n = n.concat(["exec", "print"]), - r = r.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile", "file", "intern", "long", "raw_input", "reduce", "reload", "unichr", "unicode", "xrange", "False", "True", "None"]), - new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i") - ); - var kRegExp = k(n), m = k(r); - - function i(e, t) { - var n, r = e.sol() && "\\" !== t.lastToken; - if (r) { - t.indent = e.indentation(); - } - if (r && "py" === w(t).type) { - r = w(t).offset; - return e.eatSpace() ? (r < (n = e.indentation()) ? b(t) : (n < r && y(e, t) && "#" !== e.peek() && (t.errorToken = true), null)) : (n = h(e, t), r > 0 && y(e, t) && (n += " " + s), n); - } - return h(e, t); - } - - function h(e, t, n) { - if (e.eatSpace()) return null; - if (!n && e.match(/^#.*/)) return "comment"; - if (e.match(/^[0-9\.]/, false)) { - var r = false; - if (e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i) && (r = true), e.match(/^[\d_]+\.\d*/)) { - return e.eat(/J/i), "number"; - } - } - if (e.match(u)) return s; - if (e.match(a)) return "operator"; - if (e.match(o)) return "punctuation"; - return e.match(c) ? ("def" === t.lastToken || "class" === t.lastToken ? "def" : "variable") : null; - } - - function b(e) { - while ("py" !== w(e).type) { - e.scopes.pop(); - } - e.scopes.push({ offset: w(e).offset + t.indentUnit, type: "py", align: null }); - } - - function y(e, t) { - for (var n = e.indentation(); 1 < t.scopes.length && w(t).offset > n;) { - if ("py" !== w(t).type) return true; - t.scopes.pop(); - } - return w(t).offset !== n; - } - - return { - startState: function (e) { - return { - tokenize: i, - scopes: [{ offset: e || 0, type: "py", align: null }], - indent: e || 0, - lastToken: null, - lambda: false, - dedent: 0 - }; - }, - token: function (e, t) { - var n = t.errorToken, r = g(e, t); - return n && (t.errorToken = false), r && "comment" !== r && (t.lastToken = "keyword" === r || "punctuation" === r ? e.current() : r), "punctuation" === r && (r = null), e.eol() && t.lambda && (t.lambda = false), n ? r + " " + s : r; - }, - indent: function (e, t) { - if (e.tokenize !== i) return e.tokenize.isString ? x.Pass : 0; - var n = w(e); - return n.type === t.charAt(0) || "py" === n.type && !e.dedent && /^(else:|elif |except |finally:)/.test(t) ? n.align - 1 : n.offset; - }, - electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/, - closeBrackets: { triples: "'\"" }, - lineComment: "#", - fold: "indent" - }; - }); - - x.defineMIME("text/x-python", "python"); - x.defineMIME("text/x-cython", { - name: "python", - extra_keywords: "by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE".split(" ") - }); -}); +!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(x){"use strict";function k(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var _=k(["and","or","not","is"]),v=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],z=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function w(e){return e.scopes[e.scopes.length-1]}x.registerHelper("hintWords","python",v.concat(z)),x.defineMode("python",function(t,l){for(var s="error",o=l.delimiters||l.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,a=[l.singleOperators,l.doubleOperators,l.doubleDelimiters,l.tripleDelimiters,l.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],e=0;en;){if("py"!=w(t).type)return 1;t.scopes.pop()}return w(t).offset!=n}function g(e,t){e.sol()&&(t.beginningOfLine=!0,t.dedent=!1);var n,r,i,o=t.tokenize(e,t),a=e.current();if(t.beginningOfLine&&"@"==a)return e.match(c,!1)?"meta":p?"operator":s;if(/\S/.test(a)&&(t.beginningOfLine=!1),"variable"!=o&&"builtin"!=o||"meta"!=t.lastToken||(o="meta"),"pass"!=a&&"return"!=a||(t.dedent=!0),"lambda"==a&&(t.lambda=!0),":"==a&&!t.lambda&&"py"==w(t).type&&e.match(/^\s*(?:#|$)/,!1)&&b(t),1==a.length&&!/string|comment/.test(o)){var l="[({".indexOf(a);if(-1!=l&&(n=e,r=t,i="])}".slice(l,l+1),n=n.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:n.column()+1,r.scopes.push({offset:r.indent+f,type:i,align:n})),-1!=(l="])}".indexOf(a))){if(w(t).type!=a)return s;t.indent=t.scopes.pop().offset-f}}return t.dedent&&e.eol()&&"py"==w(t).type&&1 + + +   + + + +   + + + + -->   @@ -233,25 +233,25 @@ + +   + + + +   + + + + + +   + + + +   + + + -->   @@ -454,70 +454,70 @@ + + +   + + + +   + + + + --> - + + +   + + + +   + + + + + +   + + + +   + + + + + +   + + + +   + + + + --> + @@ -1809,8 +1809,7 @@   - - + @@ -1977,13 +1976,13 @@ - +   - +   - + @@ -4819,10 +4818,9 @@ $('#enable_python').prop("checked", true); else $('#enable_python').prop("checked", false); - if (enable_python_file != null) // Ming 2024-10-01 - $('#enable_python_file').val(enable_python_file); - else - $('#enable_python_file').val("No python running."); + + $('#enable_python_file').val(enable_python_file); + if (enable_email_jpeg === 'Yes') $('#enable_email_jpeg').prop("checked", true); else @@ -5015,6 +5013,8 @@ else { enable_python = "No"; } + + enable_python_file = $('#enable_python_file').val(); if ($('#enable_email_jpeg').is(":checked")) { enable_email_jpeg = "Yes"; @@ -5102,12 +5102,6 @@ } ai_mirror_feature = $('#ai_mirror_feature').val(); - if ($('#enable_python').is(":checked")) { - enable_python = "Yes"; - } - else { - enable_python = "No"; - } if ($('#enable_post_only_if_both_detected').is(":checked")) { enable_post_only_if_both_detected = "Yes"; diff --git a/Aida/setting_on_nvr.html b/Aida/setting_on_nvr.html index 9a0ab59..8d0e3f1 100644 --- a/Aida/setting_on_nvr.html +++ b/Aida/setting_on_nvr.html @@ -212,17 +212,17 @@ + + +   + + + +   + + + + -->   @@ -257,25 +257,25 @@ + +   + + + +   + + + + + +   + + + +   + + + -->   @@ -338,10 +338,10 @@   @@ -398,7 +398,6 @@ -   @@ -479,70 +478,70 @@ - + + +   + + + +   + + + + --> + + +   + + + +   + + + + + +   + + + +   + + + + + +   + + + +   + + + + --> + @@ -2000,6 +1999,16 @@ + + +   + + + +   + + + @@ -2169,6 +2178,7 @@ document.getElementById("IDC_STATIC_ENABLE_SYSTEM_LOGS").innerHTML = IDC_STATIC_ENABLE_SYSTEM_LOGS; document.getElementById("IDC_STATIC_ENABLE_PYTHON").innerHTML = IDC_STATIC_ENABLE_PYTHON; + document.getElementById("IDC_STATIC_ENABLE_PYTHON_FILE").innerHTML = IDC_STATIC_ENABLE_PYTHON_FILE; document.getElementById("IDC_STATIC_RED_LIGHT_ZONE").innerHTML = IDC_STATIC_RED_LIGHT_ZONE; document.getElementById("IDC_STATIC_NO_GIVE_WAY_TOPIC").innerHTML = IDC_STATIC_NO_GIVE_WAY_TOPIC; @@ -2298,6 +2308,7 @@ var enable_email_notification = "No"; var enable_system_logs = "No"; var enable_python = "No"; + var enable_python_file = "No python running"; // Ming 2024-09-27 var enable_email_jpeg = "Yes"; var email_content = ""; var email_reset_time_interval = ""; @@ -4332,6 +4343,7 @@ enable_system_logs = jsonbuf["system_setting"]["enable_system_logs"]; enable_python = jsonbuf["system_setting"]["enable_python"]; + enable_python_file = jsonbuf["system_setting"]["enable_python_file"]; // Ming 2024-09-27 enable_email_jpeg = jsonbuf["system_setting"]["enable_email_jpeg"]; email_reset_time_interval = jsonbuf["system_setting"]["email_reset_time_interval"]; if (email_reset_time_interval.length == 0) { @@ -4635,6 +4647,7 @@ $('#nms_thres').slider('setValue', parseInt(nms_thres, 10)); $('#tracking_id_dwell').slider('setValue', parseInt(tracking_id_dwell, 10)); + $('#dwell_to_the_same_location').slider('setValue', parseInt(dwell_to_the_same_location, 10)); if (enable_cloud_v2 === 'Yes') @@ -4830,6 +4843,8 @@ else $('#enable_python').prop("checked", false); + $('#enable_python_file').val(enable_python_file); + if (enable_email_jpeg === 'Yes') $('#enable_email_jpeg').prop("checked", true); else @@ -4981,6 +4996,7 @@ nms_thres = $('#nms_thres').slider('getValue'); tracking_id_dwell = $('#tracking_id_dwell').slider('getValue'); + dwell_to_the_same_location = $('#dwell_to_the_same_location').slider('getValue'); if ($('#enable_cloud_v2').is(":checked")) { @@ -5021,6 +5037,8 @@ else { enable_python = "No"; } + + enable_python_file = $('#enable_python_file').val(); if ($('#enable_email_jpeg').is(":checked")) { enable_email_jpeg = "Yes"; diff --git a/Aida/speed_index.js b/Aida/speed_index.js index 0ff2570..fa57df3 100644 --- a/Aida/speed_index.js +++ b/Aida/speed_index.js @@ -145,7 +145,7 @@ function insertTrafficLightRectangle(r_left, r_top, r_width, r_height, r_direct, if (r_name == "person") { color_type = '#FF8C00'; } - else { + else if (r_name == "car") { color_type = '#800080'; } }