|
@@ -139,12 +139,19 @@ function onFcltDragEndFunc(ALyrIdx, ALyrName, ANmbr, ACoordX, ACoordY) {
|
|
|
console.log(`${currDt()}: onFcltDragEndFunc, ${ALyrIdx}, ${ALyrName}, ${ANmbr}, ${ACoordX}, ${ACoordY}`);
|
|
|
}
|
|
|
|
|
|
+let _timerFetchWeatherStts = null;
|
|
|
+const requestFetchWeatherStts = () => {
|
|
|
+ if (_timerFetchWeatherStts) window.clearTimeout(_timerFetchWeatherStts);
|
|
|
+ _timerFetchWeatherStts = window.setTimeout(() => fetchWeatherStts(), 5 * 60 * 1000)
|
|
|
+}
|
|
|
+
|
|
|
function loadingData() {
|
|
|
fetchBaseData(); //vertex, traffic(clock)
|
|
|
fetchFcltData();
|
|
|
fetchIncdData(); // 돌발정보 요청
|
|
|
fetchUnitStts();
|
|
|
fetchDbmsStts();
|
|
|
+ fetchWeatherStts();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -177,6 +184,65 @@ async function fetchBaseData() {
|
|
|
();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+const gradMap = new Map();
|
|
|
+gradMap.set("1", {
|
|
|
+ text : '좋음',
|
|
|
+ color : '#03a9f4',
|
|
|
+});
|
|
|
+gradMap.set("2", {
|
|
|
+ text : '보통',
|
|
|
+ color : '#15B337',
|
|
|
+});
|
|
|
+gradMap.set("3", {
|
|
|
+ text : '보통',
|
|
|
+ color : '#FFAA00',
|
|
|
+});
|
|
|
+gradMap.set("4", {
|
|
|
+ text : '매우나쁨',
|
|
|
+ color : '#ff0000',
|
|
|
+});
|
|
|
+
|
|
|
+function atmpInterval(jsonData){
|
|
|
+ const data = jsonData;
|
|
|
+ if (!data) {
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ $('.atmpsttnnm').text(data.atmpsttnnm);
|
|
|
+ const pm10Color = gradMap.get(data.pm10_1hh_grad).color
|
|
|
+ const pm25Color = gradMap.get(data.pm25_1hh_grad).color
|
|
|
+ const pm10Val = $('.pm10_val');
|
|
|
+ const pm10Grad = $('.pm10_grad');
|
|
|
+ const pm25Val = $('.pm25_val');
|
|
|
+ const pm25Grad = $('.pm25_grad') ;
|
|
|
+
|
|
|
+ const pm10Arr = [
|
|
|
+ pm10Val,
|
|
|
+ pm10Grad,
|
|
|
+ ]
|
|
|
+ const pm25Arr = [
|
|
|
+ pm25Val,
|
|
|
+ pm25Grad,
|
|
|
+ ]
|
|
|
+
|
|
|
+ for(let obj of pm10Arr) {
|
|
|
+ obj.css('color', pm10Color);
|
|
|
+ }
|
|
|
+ for(let obj of pm25Arr) {
|
|
|
+ obj.css('color', pm25Color);
|
|
|
+ }
|
|
|
+ $('.pm10_title').html('미세먼지 : ');
|
|
|
+ pm10Val.html(data.pm10_val + ' ㎍/㎥ ');
|
|
|
+ pm10Grad.html(gradMap.get(data.pm10_1hh_grad).text);
|
|
|
+ $('.pm25_title').text('초미세먼지 : ');
|
|
|
+ pm25Val.text(data.pm10_val + ' ㎍/㎥');
|
|
|
+ pm25Grad.text(gradMap.get(data.pm25_1hh_grad).text)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
async function fetchTraffic() {
|
|
|
//console.time("***** fetchTraffic: ");
|
|
|
const ifsc = apiGet("/api/manage/main/traffic/ifsc"); // 링크소통정보 요청
|
|
@@ -197,7 +263,39 @@ async function fetchTraffic() {
|
|
|
();
|
|
|
|
|
|
requestGet("/api/its/common/congest-traffic", recvCongestTraffic);
|
|
|
- requestGet("/api/its/common/weather/frcs/status", recvWeatherInfo);
|
|
|
+ //requestGet("/api/its/common/weather/frcs/status", recvWeatherInfo);
|
|
|
+ //requestGet("/api/its/common/weather/atmp/status", recvAtmpInfo);
|
|
|
+}
|
|
|
+
|
|
|
+async function fetchWeatherStts() {
|
|
|
+ const frcs = apiGet("/api/its/common/weather/frcs/status"); // 링크소통정보 요청
|
|
|
+ const atmp = apiGet("/api/its/common/weather/atmp/status"); // 도로소통정보 요청
|
|
|
+ Promise.all([frcs, atmp])
|
|
|
+ .then((results) => Promise.all(results.map((r) => r.json())))
|
|
|
+ .then((values) => {
|
|
|
+ recvWeatherInfo(values[0]);
|
|
|
+ recvAtmpInfo(values[1]);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(`Error in fetchTraffic ${err}`);
|
|
|
+ })
|
|
|
+ requestFetchWeatherStts();
|
|
|
+}
|
|
|
+
|
|
|
+let atmpTimer = null;
|
|
|
+function recvAtmpInfo(jsonData) {
|
|
|
+ if (atmpTimer) {
|
|
|
+ window.clearInterval(atmpTimer);
|
|
|
+ }
|
|
|
+ let cnt = 0;
|
|
|
+ atmpInterval(jsonData[cnt++]);
|
|
|
+ atmpTimer = setInterval(() => {
|
|
|
+ const data = jsonData[cnt++];
|
|
|
+ atmpInterval(data);
|
|
|
+ if (cnt === jsonData.length) {
|
|
|
+ cnt = 0;
|
|
|
+ }
|
|
|
+ }, 6000);
|
|
|
}
|
|
|
|
|
|
let _rollingCongestTimer = null;
|
|
@@ -261,66 +359,131 @@ function trafficRolling() {
|
|
|
//setInterval(visualTime, 3 * 1000);
|
|
|
}
|
|
|
|
|
|
+// function recvWeatherInfo(jsonData) {
|
|
|
+// let imgUrl = null;
|
|
|
+// let str = "";
|
|
|
+// let cnt = 0;
|
|
|
+// if (jsonData.length == 0) {
|
|
|
+// imgUrl = "정보없음";
|
|
|
+// str += "<span style='font-size: 20px;'> " + imgUrl + "</span>";
|
|
|
+// setHtml(".weather", str);
|
|
|
+// }
|
|
|
+// const data = jsonData[cnt++];
|
|
|
+// if (data) {
|
|
|
+// if (data.wtcd_kor_cd == "DB01") imgUrl = "맑음";
|
|
|
+// else if (data.wtcd_kor_cd == "DB02") imgUrl = "구름조금";
|
|
|
+// else if (data.wtcd_kor_cd == "DB03") imgUrl = "구름많음";
|
|
|
+// else if (data.wtcd_kor_cd == "DB04") imgUrl = "흐림";
|
|
|
+// else if (data.wtcd_kor_cd == "DB05") imgUrl = "비";
|
|
|
+// else if (data.wtcd_kor_cd == "DB06") imgUrl = "비/눈";
|
|
|
+// else if (data.wtcd_kor_cd == "DB07") imgUrl = "눈";
|
|
|
+// else imgUrl = "정보없음";
|
|
|
+// str += "<li style='height:100%;''>";
|
|
|
+// str += "<span style='font-size: 20px;'>" + data.vilg_frcs_zone_nm + "</span> ";
|
|
|
+// str += "<span style='font-size: 21px;'>" + data.prst_tmpr + "℃ </span>";
|
|
|
+// //str += "<span style='font-size: 20px;'> , " + imgUrl + "</span>";
|
|
|
+// str += '<img src="/images/application_wall/weather/' + data.wtcd_kor_cd + '.png" style="padding-left:2px;padding-top:3px" alt="날씨이미지" />';
|
|
|
+// str += "</li>";
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// str += "<span> 0℃ </span>";
|
|
|
+// str += '<img src="/images/application_wall/weather/DB99.png" style="padding-left:10px;padding-top:5px" alt="날씨이미지" />';
|
|
|
+// }
|
|
|
+
|
|
|
+// jsonData.forEach((el) => {
|
|
|
+// if (el.length != 0) {
|
|
|
+// if (el.wtcd_kor_cd == "DB01") imgUrl = "맑음";
|
|
|
+// else if (el.wtcd_kor_cd == "DB02") imgUrl = "구름조금";
|
|
|
+// else if (el.wtcd_kor_cd == "DB03") imgUrl = "구름많음";
|
|
|
+// else if (el.wtcd_kor_cd == "DB04") imgUrl = "흐림";
|
|
|
+// else if (el.wtcd_kor_cd == "DB05") imgUrl = "비";
|
|
|
+// else if (el.wtcd_kor_cd == "DB06") imgUrl = "비/눈";
|
|
|
+// else if (el.wtcd_kor_cd == "DB07") imgUrl = "눈";
|
|
|
+// else imgUrl = "정보없음";
|
|
|
+
|
|
|
+// str += "<li style='height:100%;''>";
|
|
|
+// str += "<span style='font-size: 20px;'>" + el.vilg_frcs_zone_nm + "</span> ";
|
|
|
+// str += "<span style='font-size: 21px;'>" + el.prst_tmpr + "℃ </span>";
|
|
|
+// //str += "<span style='font-size: 20px;'> , " + imgUrl + "</span>";
|
|
|
+// str += '<img src="/images/application_wall/weather/' + el.wtcd_kor_cd + '.png" style="padding-left:2px;padding-top:3px" alt="날씨이미지" />';
|
|
|
+// str += "</li>";
|
|
|
+// } else {
|
|
|
+// str += "<span> 0℃ </span>";
|
|
|
+// str += '<img src="/images/application_wall/weather/DB99.png" style="padding-left:10px;padding-top:5px" alt="날씨이미지" />';
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
+// setHtml(".weather", str);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+let _weatherTimer = null;
|
|
|
function recvWeatherInfo(jsonData) {
|
|
|
- let imgUrl = null;
|
|
|
- let str = "";
|
|
|
- if (jsonData.length == 0) {
|
|
|
- imgUrl = "정보없음";
|
|
|
- str += "<span style='font-size: 20px;'> " + imgUrl + "</span>";
|
|
|
- setHtml(".weather", str);
|
|
|
+ if (_weatherTimer) {
|
|
|
+ window.clearInterval(_weatherTimer);
|
|
|
}
|
|
|
-
|
|
|
- jsonData.forEach((el) => {
|
|
|
- if (el.length != 0) {
|
|
|
- if (el.wtcd_kor_cd == "DB01") imgUrl = "맑음";
|
|
|
- else if (el.wtcd_kor_cd == "DB02") imgUrl = "구름조금";
|
|
|
- else if (el.wtcd_kor_cd == "DB03") imgUrl = "구름많음";
|
|
|
- else if (el.wtcd_kor_cd == "DB04") imgUrl = "흐림";
|
|
|
- else if (el.wtcd_kor_cd == "DB05") imgUrl = "비";
|
|
|
- else if (el.wtcd_kor_cd == "DB06") imgUrl = "비/눈";
|
|
|
- else if (el.wtcd_kor_cd == "DB07") imgUrl = "눈";
|
|
|
- else imgUrl = "정보없음";
|
|
|
-
|
|
|
- str += "<li style='height:100%;''>";
|
|
|
- str += "<span style='font-size: 20px;'>" + el.vilg_frcs_zone_nm + "</span> ";
|
|
|
- str += "<span style='font-size: 21px;'>" + el.prst_tmpr + "℃ </span>";
|
|
|
- //str += "<span style='font-size: 20px;'> , " + imgUrl + "</span>";
|
|
|
- str += '<img src="/images/application_wall/weather/' + el.wtcd_kor_cd + '.png" style="padding-left:2px;padding-top:3px" alt="날씨이미지" />';
|
|
|
- str += "</li>";
|
|
|
- } else {
|
|
|
- str += "<span> 0℃ </span>";
|
|
|
- str += '<img src="/images/application_wall/weather/DB99.png" style="padding-left:10px;padding-top:5px" alt="날씨이미지" />';
|
|
|
+ let cnt = 0;
|
|
|
+ const empty = $('.weather-empty');
|
|
|
+ const stts = $('.weather-status');
|
|
|
+ stts.css('display', 'flex');
|
|
|
+ empty.css('display', 'none');
|
|
|
+ console.log(jsonData);
|
|
|
+ const data = jsonData[cnt++];
|
|
|
+ weatherInterval(data);
|
|
|
+
|
|
|
+ _weatherTimer = setInterval(() => {
|
|
|
+ weatherInterval(jsonData[cnt++]);
|
|
|
+ if (cnt === jsonData.length) {
|
|
|
+ cnt = 0;
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
- setHtml(".weather", str);
|
|
|
-}
|
|
|
-
|
|
|
-// .weather에 li값이 없을경우 weatherRolling()을 호출하면 값이 없어서 무의미. 그래서 settime 걸어줌
|
|
|
-let wetherLiNum = $(".weather").children("li").length;
|
|
|
-if (wetherLiNum == 0) {
|
|
|
- setTimeout(weatherRolling, 1 * 1000);
|
|
|
-} else {
|
|
|
- weatherRolling();
|
|
|
+ }, 6000);
|
|
|
}
|
|
|
-function weatherRolling() {
|
|
|
- let liNum; // li태그 size의 수
|
|
|
- let visualNum = 0; //화면에 보여지는 li 갯수 (1묶음 1개)
|
|
|
- liNum = $(".weather").children("li").length;
|
|
|
|
|
|
- function visualTime() {
|
|
|
- if (visualNum < liNum - 1) {
|
|
|
- visualNum++;
|
|
|
- } else if (visualNum == liNum - 1) {
|
|
|
- visualNum = 0;
|
|
|
+function weatherInterval(data) {
|
|
|
+ if (data) {
|
|
|
+ if (data.vilg_frcs_zone_nm) {
|
|
|
+ $('.weather-text').text(data.vilg_frcs_zone_nm + ' ' + data.prst_tmpr + "℃" );
|
|
|
+ $('.weather-img').prop('src',"/images/application_wall/weather/" + data.wtcd_kor_cd + ".png");
|
|
|
}
|
|
|
-
|
|
|
- $(".weather").animate({ top: -32 * visualNum + "px" }, 600, "swing");
|
|
|
+ else {
|
|
|
+ $('.weather-text').text(" 0℃ " );
|
|
|
+ $('.weather-img').prop('src',"/images/application_wall/weather/DB99.png");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ empty.css('display', 'felx');
|
|
|
+ stts.css('display', 'none');
|
|
|
}
|
|
|
-
|
|
|
- setInterval(visualTime, 6 * 1000);
|
|
|
}
|
|
|
|
|
|
+// .weather에 li값이 없을경우 weatherRolling()을 호출하면 값이 없어서 무의미. 그래서 settime 걸어줌
|
|
|
+// let wetherLiNum = $(".weather").children("li").length;
|
|
|
+// if (wetherLiNum == 0) {
|
|
|
+// setTimeout(weatherRolling, 1 * 1000);
|
|
|
+// } else {
|
|
|
+// weatherRolling();
|
|
|
+// }
|
|
|
+// function weatherRolling() {
|
|
|
+// let liNum; // li태그 size의 수
|
|
|
+// let visualNum = 0; //화면에 보여지는 li 갯수 (1묶음 1개)
|
|
|
+// liNum = $(".weather").children("li").length;
|
|
|
+
|
|
|
+// function visualTime() {
|
|
|
+// // weather.animate({ opacity: 0 }, 500);
|
|
|
+// if (visualNum < liNum - 1) {
|
|
|
+// visualNum++;
|
|
|
+// } else if (visualNum == liNum - 1) {
|
|
|
+// visualNum = 0;
|
|
|
+// }
|
|
|
+// // weather.css({top: - 32 * visualNum + "px"});
|
|
|
+
|
|
|
+// // weather.animate({ opacity: 1 }, 500);
|
|
|
+// $(".weather").animate({ top: -32 * visualNum + "px" }, 600, "swing");
|
|
|
+// }
|
|
|
+
|
|
|
+// setInterval(visualTime, 6 * 1000);
|
|
|
+// }
|
|
|
+
|
|
|
async function fetchBaseVrtx() {
|
|
|
//console.time("***** fetchBaseVrtx: ");
|
|
|
|
|
@@ -383,6 +546,7 @@ async function fetchFcltData() {
|
|
|
//() => console.timeEnd("***** fetchFcltData: ")
|
|
|
();
|
|
|
}
|
|
|
+
|
|
|
// 시설물현황 상태정보 요청(타이머 또는 웹소켓에 의해 실행됨)
|
|
|
async function fetchFcltStts() {
|
|
|
//console.time("***** fetchFcltStts: ");
|
|
@@ -661,6 +825,7 @@ let _vmsDsplMsgArr = [];
|
|
|
let _vmsDsplMsgPhase = 0;
|
|
|
const _vmsWidthReserved = 10;
|
|
|
function initVmsMsgDsplMsg(name, x, y) {
|
|
|
+ console.log(name);
|
|
|
if (_timerVmsMsgDslp) window.clearTimeout(_timerVmsMsgDslp);
|
|
|
_timerVmsMsgDslp = null;
|
|
|
_vmsDsplMsgArr = [];
|
|
@@ -699,6 +864,7 @@ function initVmsMsgDsplMsg(name, x, y) {
|
|
|
});
|
|
|
}
|
|
|
function recvVmsDsplMsg(jsonData) {
|
|
|
+ console.log(jsonData);
|
|
|
if (jsonData.length == 0) {
|
|
|
return;
|
|
|
}
|
|
@@ -722,10 +888,10 @@ function recvVmsDsplMsg(jsonData) {
|
|
|
'<p style="float:right;color:#000"><a href="#" id="vmsImg"><img src="/images/application_wall/xbtn.png"/></a></p>' +
|
|
|
"</dt>" +
|
|
|
"<dd>";
|
|
|
- iwContent += '<p><img id="vmsPhaseImg" src="data:image/png;base64,' + jsonData[0].vms_dspl_msg_imag + '" height="' + imgHeight + '" class="vmsPic"/></p>';
|
|
|
+ iwContent += '<p><img id="vmsPhaseImg" src="data:image/png;base64,' + _vmsDsplMsgArr[0].vms_dspl_msg_imag + '" height="' + imgHeight + '" class="vmsPic"/></p>';
|
|
|
iwContent += "</dd>" + "</dl>" + "</div>";
|
|
|
$("#vmsOverlay").html(iwContent);
|
|
|
-
|
|
|
+
|
|
|
$("#vmsImg").on("click", function () {
|
|
|
if (_timerVmsMsgDslp) window.clearTimeout(_timerVmsMsgDslp);
|
|
|
_timerVmsMsgDslp = null;
|
|
@@ -782,7 +948,6 @@ function cctvPopupInfoBox(ISTL_LCTN_NM, STRM_RTMP_ADDR, x, y) {
|
|
|
|
|
|
$("#cctvOverlay").html(coordHtml);
|
|
|
BIS._cctvOverlay.setPosition([x, y]);
|
|
|
-
|
|
|
openCCTV(STRM_RTMP_ADDR);
|
|
|
|
|
|
$("#cctvImg").on("click", function () {
|