|
@@ -60,6 +60,7 @@ $(()=>{
|
|
|
atrdMarkerResize();
|
|
|
}
|
|
|
getVertex();
|
|
|
+ console.log('level', _Map.getLevel());
|
|
|
});
|
|
|
|
|
|
kakao.maps.event.addListener(_Map, 'dragend', function() {
|
|
@@ -94,7 +95,7 @@ $(()=>{
|
|
|
_AtrdData = [];
|
|
|
let upHillArr = [];
|
|
|
let downHillArr = [];
|
|
|
- const $selectedLi = $(".left-list-area .list-content > li.click");
|
|
|
+ const $selectedLi = $(".left-list-area .list-content.list > li.click");
|
|
|
let id;
|
|
|
let idArr;
|
|
|
if ($selectedLi[0]) {
|
|
@@ -368,31 +369,155 @@ $(()=>{
|
|
|
// }
|
|
|
// });
|
|
|
// }, 10000)
|
|
|
+ let _MakerArr = [];
|
|
|
+ $('.tab-title > div').on('click', function(){
|
|
|
+ let searchType = $('.tab-title > div.active').text();
|
|
|
+ if (searchType === $(this).text()) return;
|
|
|
+ $('.tab-title > div').toggleClass("active");
|
|
|
+ searchType = $(this).text();
|
|
|
+ let list;
|
|
|
+ let spot;
|
|
|
+ if (searchType === '지점 검색') {
|
|
|
+ list = 'none';
|
|
|
+ spot = 'block';
|
|
|
+ $('.list-content.spot').html("");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ list = 'block';
|
|
|
+ spot = 'none';
|
|
|
+ $('.list-content.list > li').css('display', 'block');
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#search-box').val("");
|
|
|
+ $('.list-content.list').css('display', list);
|
|
|
+ $('.list-content.spot').css('display', spot);
|
|
|
+ if (_MakerArr.length > 0) {
|
|
|
+ _MakerArr.forEach((obj)=>{
|
|
|
+ obj.setMap(null);
|
|
|
+ });
|
|
|
+ _MakerArr = [];
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
|
|
|
$('#search-box').on('keyup', function () {
|
|
|
+ const searchType = $('.tab-title > div.active').text();
|
|
|
const searchText = $(this).val();
|
|
|
- if (!$('.list-content > li').length) return;
|
|
|
|
|
|
- for (let ii = 0; ii < $('.list-content > li').length; ii++) {
|
|
|
- const li = $('.list-content > li').eq(ii);
|
|
|
- if ($(this).val().length === 0) {
|
|
|
- li.css('display', 'block');
|
|
|
- }
|
|
|
- else {
|
|
|
- let text = $('.list-content > li').eq(ii).text().toLowerCase();
|
|
|
- if (text.includes(searchText.toLowerCase())) {
|
|
|
+ if (searchType === '리스트') {
|
|
|
+ if (!$('.list-content.list > li').length) return;
|
|
|
+
|
|
|
+ for (let ii = 0; ii < $('.list-content.list > li').length; ii++) {
|
|
|
+ const li = $('.list-content.list > li').eq(ii);
|
|
|
+ if ($(this).val().length === 0) {
|
|
|
li.css('display', 'block');
|
|
|
}
|
|
|
else {
|
|
|
- li.css('display', 'none');
|
|
|
+ let text = $('.list-content.list > li').eq(ii).text().toLowerCase();
|
|
|
+ if (text.includes(searchText.toLowerCase())) {
|
|
|
+ li.css('display', 'block');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ li.css('display', 'none');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ else {
|
|
|
+ if (_MakerArr.length > 0) {
|
|
|
+ _MakerArr.forEach((obj)=>{
|
|
|
+ obj.setMap(null);
|
|
|
+ });
|
|
|
+ _MakerArr = [];
|
|
|
+ }
|
|
|
+ $('.list-content.spot').html("");
|
|
|
+ $.ajax({
|
|
|
+ url: 'https://dapi.kakao.com/v2/local/search/address.json',
|
|
|
+ headers: { 'Authorization': 'KakaoAK 4896b94398b96949d349881d004835cf'},
|
|
|
+ data :{
|
|
|
+ query : searchText,
|
|
|
+ },
|
|
|
+ type: 'GET'
|
|
|
+ }).done(function(data) {
|
|
|
+ if (data && data.documents.length > 0) {
|
|
|
+ let str = "";
|
|
|
+ const setMap = new Map();
|
|
|
+
|
|
|
+ const bounds = new daum.maps.LatLngBounds();
|
|
|
+ let minX;
|
|
|
+ let minY;
|
|
|
+ let maxX;
|
|
|
+ let maxY;
|
|
|
+ let idx = 0;
|
|
|
+ data.documents.forEach((obj)=>{
|
|
|
+ if (!setMap.get(obj.address_name) && obj.address_name.includes("경북 포항시")) {
|
|
|
+ idx++;
|
|
|
+ let addr = obj.address_name;
|
|
|
+ if (obj.x && obj.y) {
|
|
|
+ const position = new kakao.maps.LatLng(obj.y, obj.x);
|
|
|
+ let marker = new kakao.maps.Marker({
|
|
|
+ position : position,
|
|
|
+ title : addr ,
|
|
|
+ content : addr
|
|
|
+ });
|
|
|
+
|
|
|
+ new kakao.maps.event.addListener(marker, 'click', function() {
|
|
|
+ moveLocation(obj.x, obj.y, idx);
|
|
|
+ })
|
|
|
+ if (!minX) {
|
|
|
+ minX = obj.x;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!maxX) {
|
|
|
+ maxX = obj.x;
|
|
|
+ }
|
|
|
+ if (!minY) {
|
|
|
+ minY = obj.y;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!maxY) {
|
|
|
+ maxY = obj.y;
|
|
|
+ }
|
|
|
+
|
|
|
+ minX = minX <= obj.x ? minX : obj.x;
|
|
|
+ maxX = maxX >= obj.x ? maxX : obj.x;
|
|
|
+ minY = minY <= obj.y ? minY : obj.y;
|
|
|
+ maxY = maxY >= obj.y ? maxY : obj.y;
|
|
|
+
|
|
|
+ marker.setMap(_Map);
|
|
|
+ _MakerArr.push(marker);
|
|
|
+ setMap.set(addr, obj);
|
|
|
+
|
|
|
+ str+= `<li id="spot-${idx}" onclick="moveLocation(${obj.x}, ${obj.y}, ${idx})">
|
|
|
+ ${obj.address_name}
|
|
|
+ </li>`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
+ if (minX && minY && maxX && maxY) {
|
|
|
+ bounds.extend(new daum.maps.LatLng(minY, minX));
|
|
|
+ bounds.extend(new daum.maps.LatLng(maxY, maxX));
|
|
|
+ _Map.setBounds(bounds);
|
|
|
+ $('.list-content.spot').html(str);
|
|
|
+ getVertex();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
+function moveLocation(xCoordinate, yCoordinate, listIndex) {
|
|
|
+ const position = new kakao.maps.LatLng(yCoordinate, xCoordinate);
|
|
|
+
|
|
|
+ _Map.setCenter(position);
|
|
|
+ _Map.setLevel(3);
|
|
|
+ $('.list-content.spot > li.click').removeClass('click');
|
|
|
+ $('#spot-' +listIndex).addClass('click');
|
|
|
+ getVertex();
|
|
|
+}
|
|
|
+
|
|
|
function getVertex() {
|
|
|
if (_TrafficArray.length > 0) {
|
|
|
_TrafficArray.forEach((obj) => {
|
|
@@ -535,7 +660,7 @@ function initFaicilityData() {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- const listSection = $('.left-list-area .list-content');
|
|
|
+ const listSection = $('.left-list-area .list-content.list');
|
|
|
listSection.empty();
|
|
|
listSection.html(listStr);
|
|
|
}
|
|
@@ -556,7 +681,7 @@ function atrdClickEvent(AupHillId, AdownHillId) {
|
|
|
_AtrdArray = [];
|
|
|
}
|
|
|
_AtrdData = [];
|
|
|
- const $selectedLi = $('.left-list-area .list-content > li.click');
|
|
|
+ const $selectedLi = $('.left-list-area .list-content.list > li.click');
|
|
|
if ($selectedLi) {
|
|
|
$selectedLi.removeClass('click');
|
|
|
}
|
|
@@ -879,7 +1004,7 @@ class TbCCtvObj {
|
|
|
this.infoWindow.draggable({containment : 'body'});
|
|
|
// this.infoWindow = new kakao.maps.CustomOverlay({position: coordinates, content: iwContent, zindex: 15, yAnchor: 1.1});
|
|
|
// this.infoWindow.setMap(_Map);
|
|
|
- const video = videojs("video-" + this.ID, {
|
|
|
+ let video = videojs("video-" + this.ID, {
|
|
|
sources: [
|
|
|
{
|
|
|
src: this.obj.strm_http_addr,
|
|
@@ -893,6 +1018,23 @@ class TbCCtvObj {
|
|
|
preload: "metadata",
|
|
|
});
|
|
|
|
|
|
+ video.on('error', ()=>{
|
|
|
+ if (video.error().code === 4) {
|
|
|
+ video.pause();
|
|
|
+ video.dispose();
|
|
|
+ if (this.timer) {
|
|
|
+ clearTimeout(this.timer);
|
|
|
+ }
|
|
|
+ $('.content > div:nth-child(1)').append($('<img src="/images/icon/error.png">'));
|
|
|
+ $('.content > div:nth-child(1)').css({
|
|
|
+ display : 'flex',
|
|
|
+ alignItems : 'center',
|
|
|
+ justifyContent : 'center',
|
|
|
+ });
|
|
|
+ video = null;
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
this.timer = setTimeout(()=>{
|
|
|
if (video) {
|
|
|
video.pause();
|
|
@@ -1048,6 +1190,7 @@ class TbVmsObj {
|
|
|
const headerH = $('header').height();
|
|
|
const wrapH = $('.trafficWrap').innerHeight();
|
|
|
let top = headerH + (wrapH/2) - this.infoWindow.innerHeight() + 10;
|
|
|
+
|
|
|
let left = (window.innerWidth / 2) - (this.infoWindow.width() / 2);
|
|
|
this.infoWindow.css({
|
|
|
top : top + 'px',
|
|
@@ -1168,7 +1311,8 @@ class TbIncdObj {
|
|
|
const headerH = $('header').height();
|
|
|
const wrapH = $('.trafficWrap').innerHeight();
|
|
|
let top = headerH + (wrapH/2) - this.infoWindow.innerHeight() + 10;
|
|
|
- let left = (window.innerWidth / 2) - (this.infoWindow.width() / 2);
|
|
|
+ let left = (window.innerWidth / 2) - (this.infoWindow.innerWidth() / 2);
|
|
|
+ console.log(this.infoWindow.width());
|
|
|
this.infoWindow.css({
|
|
|
top : top + 'px',
|
|
|
left : left + 'px',
|
|
@@ -1362,12 +1506,8 @@ class IntersectionCameraObj {
|
|
|
// yAnchor: 1.1
|
|
|
// });
|
|
|
// this.infoWindow.setMap(_Map);
|
|
|
- const videoEl = document.getElementById("video-" + this.ID);
|
|
|
- videoEl.addEventListener("error", function(event){
|
|
|
- console.log(event);
|
|
|
- })
|
|
|
|
|
|
- const video = videojs("video-" + this.ID, {
|
|
|
+ let video = videojs("video-" + this.ID, {
|
|
|
sources: [
|
|
|
{
|
|
|
src: this.obj.hmpg_cmra_url,
|
|
@@ -1381,6 +1521,20 @@ class IntersectionCameraObj {
|
|
|
preload: "metadata",
|
|
|
});
|
|
|
|
|
|
+ video.on('error', ()=>{
|
|
|
+ if (video.error().code === 4) {
|
|
|
+ video.pause();
|
|
|
+ video.dispose();
|
|
|
+ $('.content > div:nth-child(1)').append($('<img src="/images/icon/error.png">'));
|
|
|
+ $('.content > div:nth-child(1)').css({
|
|
|
+ display : 'flex',
|
|
|
+ alignItems : 'center',
|
|
|
+ justifyContent : 'center',
|
|
|
+ });
|
|
|
+ video = null;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
this.timer = setTimeout(() => {
|
|
|
if (video) {
|
|
@@ -1401,7 +1555,10 @@ class IntersectionCameraObj {
|
|
|
}
|
|
|
});
|
|
|
this.isClick = true;
|
|
|
- $('.close-window').on('click', ()=> this.close());
|
|
|
+ $('.close-window').on('click', (event)=> {
|
|
|
+ event.preventDefault();
|
|
|
+ this.close();
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
close() {
|
|
@@ -1429,6 +1586,7 @@ class IntersectionCameraObj {
|
|
|
* @param event 이벤트 종류 (click, close)
|
|
|
*/
|
|
|
function infoWindowEvent(type, id, event) {
|
|
|
+ window.event.preventDefault();
|
|
|
let array = [];
|
|
|
switch (type) {
|
|
|
case 'cctv':
|
|
@@ -1678,7 +1836,7 @@ function setMarkerImage(obj, type) {
|
|
|
function getScrollTop(selectIndex) {
|
|
|
let scrollTop = 0;
|
|
|
for (let ii=0; ii < selectIndex; ii++) {
|
|
|
- let height = $('.left-list-area .list-content').children().eq(ii).css('height');
|
|
|
+ let height = $('.left-list-area .list-content.list').children().eq(ii).css('height');
|
|
|
if (height) {
|
|
|
height = Number(height.replace('px', ''));
|
|
|
if (!isNaN(height)) {
|
|
@@ -1699,7 +1857,7 @@ function moveToScroll(flag, array, id) {
|
|
|
if (flag) {
|
|
|
let selectIndex = array.findIndex((obj)=> obj.ID == id);
|
|
|
let scrollTop = getScrollTop(selectIndex);
|
|
|
- $('.left-list-area .list-content').animate({
|
|
|
+ $('.left-list-area .list-content.list').animate({
|
|
|
scrollTop : scrollTop + 'px'
|
|
|
});
|
|
|
$('.mobile-select').val(id);
|
|
@@ -1750,7 +1908,7 @@ function receiveFacilityData(jsonData, array, facilityClass, listFlag, type) {
|
|
|
});
|
|
|
|
|
|
if (listFlag === true) {
|
|
|
- const listSection = $('.left-list-area .list-content');
|
|
|
+ const listSection = $('.left-list-area .list-content.list');
|
|
|
listSection.empty();
|
|
|
listSection.html(listStr);
|
|
|
const $mobileSelect = $('.mobile-select');
|