let lang = 'null';
var annotations = [];
var map;
var left_map;
var right_map;
var olLayer;
var olInteraction;
var xhr;
function IssuePage() {
window.open("https://www.krihs.re.kr/issue/issueReportView.do?&seq=640");
};
$(document).ready(function () {
/*------------------------ CONSTANT & VARIALBLE ------------------------*/
var MAP_TYPE = "vector";
var G_SIDO_CD = null;
var G_SIDO_NM = null;
var G_LEFT_SIDO_CD = null;
var G_LEFT_SIDO_NM = null;
var G_RIGHT_SIDO_CD = null;
var G_RIGHT_SIDO_NM = null;
var G_SIG_CD = null;
var G_SIG_NM = null;
var G_LEFT_SIG_CD = null;
var G_LEFT_SIG_NM = null;
var G_RIGHT_SIG_CD = null;
var G_RIGHT_SIG_NM = null;
var G_CURRENT_YEAR = '2019';
var G_CURRENT_DATE = '2019-12';
var G_LEFT_CURRENT_YEAR = '2019';
var G_LEFT_CURRENT_DATE = '2019-12';
var G_LEFT_CURRENT_MONTH = '10';
var G_RIGHT_CURRENT_YEAR = '2019';
var G_RIGHT_CURRENT_DATE = '2019-12';
var G_RIGHT_CURRENT_MONTH = '10';
var G_ISOPEN_TSERIES = false;
var L_BOUNDARY_SIDO = 'tl_scco_ctprvn_201904';
var L_BOUNDARY_SIG = 'tl_scco_sig_201904';
var CONVENIENCE_POI = 'convenience';
var CHICKEN_POI = 'chicken';
// var SELECT_POI = 'convenience';
var SELECT_POI = 'chicken';
var SELECT_POI_LAYER;
var SELECT_LEFT_POI_LAYER;
var SELECT_RIGHT_POI_LAYER;
var SELECT_HEATMAP_OPEN_POI_LAYER;
var SELECT_HEATMAP_CLOSE_POI_LAYER;
var D_START_DATE = new Date('2000-01-01T00:00:00');
var D_END_DATE = new Date('2019-12-01T01:00:00');
var G_YEARS = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019];
var G_MONTHS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
var D_ESTATE_POLICY = [];
var G_ISTIME_MAP = false;
var G_LEFT_TIME = false;
var G_RIGHT_TIME = false;
/*------------------------------ 버튼 이벤트 ------------------------------*/
/**
* 제목 버튼 클릭시 페이지 로딩
*/
$('.pg-btn-menuitem').on('click', function (e) {
$('.pg-btn-menuitem').removeClass('btn-success');
$('.pg-btn-analysis-tool').click();
//메인 맵 보여주기
$(".pg-map").show();
$(".pg-content").show();
//누적지도 버튼 초기화
$('#btnTimeMap').removeClass('btn-success');
$('#btnTimeMap').addClass('btn-secondary');
$('.pg-btn-timeseries').prop("disabled", false);
//맵에서 등록된 레이어 제거
map.removeLayer(SELECT_POI_LAYER);
left_map.removeLayer(SELECT_LEFT_POI_LAYER);
right_map.removeLayer(SELECT_RIGHT_POI_LAYER);
map.removeLayer(SELECT_HEATMAP_OPEN_POI_LAYER);
map.removeLayer(SELECT_HEATMAP_CLOSE_POI_LAYER);
G_LEFT_TIME = false;
G_RIGHT_TIME = false;
// if ($(this).data('id') == 'convenience') {
// $(this).addClass('btn-success');
// SELECT_POI = 'convenience';
// SELECT_POI_LAYER = olLayer.poi.storeRaster;
// SELECT_LEFT_POI_LAYER = olLayer.poi.leftStoreRaster;
// SELECT_RIGHT_POI_LAYER = olLayer.poi.rightStoreRaster;
// SELECT_HEATMAP_OPEN_POI_LAYER = olLayer.poi.storeOpenRaster;
// SELECT_HEATMAP_CLOSE_POI_LAYER = olLayer.poi.storeCloseRaster;
// map.addLayer(SELECT_POI_LAYER);
// // SELECT_POI_LAYER.setVisible(true);
// left_map.addLayer(SELECT_LEFT_POI_LAYER);
// SELECT_LEFT_POI_LAYER.setVisible(true);
// right_map.addLayer(SELECT_RIGHT_POI_LAYER);
// SELECT_RIGHT_POI_LAYER.setVisible(true);
// map.addLayer(SELECT_HEATMAP_OPEN_POI_LAYER);
// // SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
// map.addLayer(SELECT_HEATMAP_CLOSE_POI_LAYER);
// // SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
// if (MAP_TYPE == "vector") {
// SELECT_POI_LAYER.setVisible(true);
// } else if (MAP_TYPE == "heatmap") {
// SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
// SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
// }
// }
if ($(this).data('id') == 'chicken') {
$(this).addClass('btn-success');
SELECT_POI = 'chicken';
SELECT_POI_LAYER = olLayer.poi.chickenRaster;
SELECT_LEFT_POI_LAYER = olLayer.poi.leftChickenRaster;
SELECT_RIGHT_POI_LAYER = olLayer.poi.rightChickenRaster;
SELECT_HEATMAP_OPEN_POI_LAYER = olLayer.poi.chickenOpenRaster;
SELECT_HEATMAP_CLOSE_POI_LAYER = olLayer.poi.chickenCloseRaster;
map.addLayer(SELECT_POI_LAYER);
// SELECT_POI_LAYER.setVisible(true);
left_map.addLayer(SELECT_LEFT_POI_LAYER);
SELECT_LEFT_POI_LAYER.setVisible(true);
right_map.addLayer(SELECT_RIGHT_POI_LAYER);
SELECT_RIGHT_POI_LAYER.setVisible(true);
map.addLayer(SELECT_HEATMAP_OPEN_POI_LAYER);
// SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
map.addLayer(SELECT_HEATMAP_CLOSE_POI_LAYER);
// SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
if (MAP_TYPE == "vector") {
SELECT_POI_LAYER.setVisible(true);
} else if (MAP_TYPE == "heatmap") {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
}
}
//분할창 초기화
$(".splitter_map").show();
// 개업 폐업 Visible True로 초기화
$('#pg-left-open').prop('checked', true);
$('#pg-left-close').prop('checked', true);
$('#pg-right-open').prop('checked', true);
$('#pg-right-close').prop('checked', true);
$("#pg-btn-left-year-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-left-year-select').find("option:eq(" + idx + ")").prop("selected", true);
}
});
$("#pg-btn-left-month-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-left-month-select').find("option:eq(" + idx + ")").prop("selected", true);
}
});
$("#pg-btn-right-year-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-right-year-select').find("option:eq(" + idx + ")").prop("selected", true);
}
});
$("#pg-btn-right-month-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-right-month-select').find("option:eq(" + idx + ")").prop("selected", true);
}
});
//시도 선택 - 전국으로 초기화
$("#pg-btn-left-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-left-sido-select').find("option:eq(" + idx + ")").prop("selected", false);
$("#pg-btn-left-sido-select").change();
}
});
$("#pg-btn-right-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-right-sido-select').find("option:eq(" + idx + ")").prop("selected", false);
$("#pg-btn-right-sido-select").change();
}
});
$(".splitter_map").hide();
//시도 선택 - 전국으로 초기화
$("#pg-btn-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-sido-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-sido-select").change();
}
});
//그래프 숨기기
$('#pg-overlay-graph-item-opcl').prop('checked', false);
$('.pg-overlay-graph-item').change();
//개업 폐업 disable 초기화
$(".main-checkbox").find("input").prop("disabled", false);
// 개업 폐업 Visible True로 초기화
$('#pg-overlay-layer-item-open').prop('checked', true);
$('#pg-overlay-layer-item-close').prop('checked', true);
// 최근 데이터 기준 슬라이드바 초기화
var date = new Date(D_END_DATE);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
//슬라이드 끄기
$('#pg-timseries-btn').hide();
//시군구 랭킹 보여주기
$("#opclRankingSigStore").show();
$("#opclRankingSigStoreUD").hide();
// 측정도구 켜기
$('#openandcloseAnalysisTool').show();
// UI 기본 설정
$('.pg-timeseries-cover').hide();
$('.pg-btn-timeseries').html('날짜선택
슬라이드 보기');
$("#pg-slider-bar").slider('value', date.getTime());
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + G_CURRENT_DATE);
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? null : 'sgg_cd = ' + G_SIG_CD,
'STYLES': SELECT_POI,
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? 'state = 1 or state = 4' : 'sgg_cd = ' + G_SIG_CD
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? 'state = 2 or state = 3' : 'sgg_cd = ' + G_SIG_CD
});
getOpenCloseCount(SELECT_POI);
getSigRankingByStore(SELECT_POI);
getOpclTotalChart(SELECT_POI, 'notime', G_SIG_CD);
G_ISTIME_MAP = false;
G_ISOPEN_TSERIES = false;
});
/**
* 기획의도 모달창 - 하루동안보지않기
*/
$('#pg-readme-modal-1day').on('click', function (e) {
var date = new Date();
date.setTime(date.getTime() + 1 * 24 * 60 * 60 * 1000);
document.cookie = 'openandcloseopenReadmeOpen=false;expires=' + date.toUTCString() + ';path=/';
});
// 모달창 버튼 레이어 체인지 이벤트
$('.pg-btn-embed-modal-open').on('click', function (e) {
if ($(this).data('id') == 'convenience') {
$("#btnConvenience").click();
} else if ($(this).data('id') == 'chicken') {
$("#btnChicken").click();
}
$('#pg-readme-modal').modal('hide');
});
/**
* 배경지도 레이어 스위치
*/
$('.pg-basemap-item').on('click', function (e) {
var id = e.currentTarget.value;
var array = map.getLayerGroup().getLayers().getArray();
for (var i in array) {
if (array[i].get('id') == 'baseGroup') {
array = array[i].getLayers().getArray();
for (var j in array) {
if (array[j].get('id') == id) {
array[j].setVisible(true);
} else {
array[j].setVisible(false);
}
}
break;
}
}
});
/**
* 포인트 레이어 스위치
*/
$('.pg-overlay-layer-item').change(function (e) {
var cql_filter;
var open_cql_filter;
var close_cql_filter;
if (G_ISOPEN_TSERIES) {
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
// open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
// close_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
// open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')))';
// close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')))';
}
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
}
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
// open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
// close_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
// open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')))';
// close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')))';
}
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
// open_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
// close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
// open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')))';
// close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')))';
}
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
cql_filter = 'state = 5';
// open_cql_filter = 'state = 5';
// close_cql_filter = 'state = 5';
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
}
}
//olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': cql_filter,
'STYLES': null,
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE)
});
// SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
// 'CQL_FILTER': open_cql_filter
// });
//
// SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
// 'CQL_FILTER': close_cql_filter
// });
} else {
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = null;
// open_cql_filter = 'state = 1 or state = 4';
// close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD;
// open_cql_filter = 'sgg_cd =' + G_SIG_CD + ')';
// close_cql_filter = 'sgg_cd =' + G_SIG_CD + ')';
}
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
}
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
// open_cql_filter = '(state = 1 or state = 4)';
// close_cql_filter = 'state = 1 or state = 4)';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
// open_cql_filter = 'sgg_cd =' + G_SIG_CD + ')';
// close_cql_filter = 'sgg_cd =' + G_SIG_CD + ')';
}
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
// open_cql_filter = 'state = 2 or state = 3)';
// close_cql_filter = '(state = 2 or state = 3)';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
// open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3))';
// close_cql_filter = 'sgg_cd =' + G_SIG_CD + ')';
}
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
cql_filter = 'state = 5';
// open_cql_filter = 'state = 5';
// close_cql_filter = 'state = 5';
if (MAP_TYPE == 'heatmap') {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
}
}
//olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': cql_filter,
'STYLES': SELECT_POI
});
// SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
// 'CQL_FILTER': open_cql_filter
// });
//
// SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
// 'CQL_FILTER': close_cql_filter
// });
}
});
// $('#pg-legend-opcl .expand').on('click', function(e) {
// $('#pg-legend-opcl .card-body').toggle();
// });
//
// $('#pg-legend-left .expand').on('click', function(e) {
// $('#pg-legend-left .card-body').toggle();
// });
//
// $('#pg-legend-right .expand').on('click', function(e) {
// $('#pg-legend-right .card-body').toggle();
// });
function getLegend(layerType, style) {
}
/**
* 슬라이더 바 움직이기
*/
$('.pg-btn-pre').on('click', function (e) {
var sliderCurrentValue = $('#pg-slider-bar').slider('option', 'value');
var month = new Date(sliderCurrentValue).getMonth();
var preValue = new Date(sliderCurrentValue).setMonth(month - 1);
$('#pg-slider-bar').slider('value', preValue);
});
$('.pg-btn-next').on('click', function (e) {
var sliderCurrentValue = $('#pg-slider-bar').slider('option', 'value');
var month = new Date(sliderCurrentValue).getMonth();
var nextValue = new Date(sliderCurrentValue).setMonth(month + 1);
$('#pg-slider-bar').slider('value', nextValue);
});
/**
* 날짜선택 및 전체보기 활성화 버튼
*/
$('.pg-btn-timeseries').on('click', function (e) {
// 개업 폐업 Visible True로 초기화
$('#pg-overlay-layer-item-open').prop('checked', true);
$('#pg-overlay-layer-item-close').prop('checked', true);
// 최근 데이터 기준 슬라이드바 초기화
var date = new Date(D_END_DATE);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
if (G_ISOPEN_TSERIES) { // 슬라이더바 끄기, 누적년도 통계
// 슬라이더 바 조절 버튼 숨김
$('#pg-timseries-btn').hide();
// 측정도구
$('#openandcloseAnalysisTool').show();
// UI 기본 설정
$('.pg-timeseries-cover').hide();
$('.pg-btn-timeseries').html("날짜선택
슬라이드 보기");
$("#pg-slider-bar").slider('value', date.getTime());
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + G_CURRENT_DATE);
// 시계열 해제시 총 개폐점 수 다시 불러오기( 시도 선택확인)
if (G_SIG_CD == null) {
if (G_SIDO_CD == null) {
getOpenCloseCount(SELECT_POI);
} else {
getOpenCloseCountBySido("chiken", G_SIDO_CD);
};
getSigRankingByStore(SELECT_POI);
} else {
getOpenCloseCountBySig("chicken", G_SIG_CD);
getSigRankingBySig(SELECT_POI, G_SIG_CD);
};
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? null : 'sgg_cd = ' + G_SIG_CD,
'STYLES': 'pinogio:' + SELECT_POI,
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? 'state = 1 or state = 4' : 'sgg_cd = ' + G_SIG_CD
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? 'state = 2 or state = 3' : 'sgg_cd = ' + G_SIG_CD
});
//if ($('.pg-btn-menuitem[data-id=trading]').hasClass('btn-success')) {
//getLegend();
//} else {
//getLegend();
//}
G_ISOPEN_TSERIES = false;
} else { // 슬라이더바 켜기, 선택년도 통계
// 슬라이더 바 조절 버튼 보이기
$('#pg-timseries-btn').show();
// 측정도구
$('#openandcloseAnalysisTool').hide();
$('.pg-btn-analysis-tool').click();
// UI 기본 설정
$('.pg-timeseries-cover').show();
$('.pg-btn-timeseries').html('전체보기');
var sld_body = getPointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE);
// 시도 선택확인
if (G_SIG_CD == null) {
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByInit('vector'),
'STYLES': null,
'SLD_BODY': sld_body
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByInit('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByInit('closeheatmap')
});
if (G_SIDO_CD == null)
getOpenCloseCountByYear(SELECT_POI, G_CURRENT_DATE);
else
getOpenCloseCountBySidoYear(SELECT_POI, G_SIDO_CD, G_CURRENT_DATE);
} else {
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByInit('vector'),
'STYLES': null,
'SLD_BODY': sld_body
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByInit('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByInit('closeheatmap')
});
getOpenCloseCountBySigYear(SELECT_POI, G_SIG_CD, G_CURRENT_DATE);
}
G_ISOPEN_TSERIES = true;
}
});
/**
* 공간조회 툴 버튼 이벤트
*/
$('.pg-btn-analysis-tool').on('click', function (e) {
var drawType = e.currentTarget.value;
$('.analysisResultDiv').hide();
// 초기화 draw vector, interaction, analysisvector
olLayer.draw.analysisVector.getSource().clear();
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
if (drawType == 'Polygon' || drawType == 'Circle') {
olInteraction.draw.analysisDraw = new ol.interaction.Draw({
source: olLayer.draw.analysisVector.getSource(),
type: drawType
});
map.addInteraction(olInteraction.draw.analysisDraw);
olInteraction.draw.analysisDraw.on('drawend', function (e) {
var geometry = e.feature.getGeometry();
var area = null;
var radius = null;
if (drawType == 'Polygon') {
area = geometry.getArea();
if (geometry.getArea() > 50000000) {
olLayer.draw.analysisVector.getSource().clear();
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
alert('범위가 너무 넓습니다.');
return;
}
} else if (drawType == 'Circle') {
radius = geometry.getRadius();
if (radius > 5000) {
olLayer.draw.analysisVector.getSource().clear();
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
alert('범위가 너무 넓습니다.');
return;
}
}
var formatGML = new ol.format.GML({
featureNS: 'http://pngos.io/',
featureType: 'pinogio',
srsName: 'EPSG:3857'
});
var geometry = drawType == 'Circle' ? ol.geom.Polygon.fromCircle(e.feature.getGeometry()) : e.feature.getGeometry();
var getFeatureRequest = new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:3857',
featureNS: 'http://pngos.io/',
featurePrefix: 'pinogio',
featureTypes: [SELECT_POI],
outputFormat: 'json',
filter: ol.format.filter.intersects('geom', geometry, 'EPSG:3857')
});
var xmlStr = new XMLSerializer().serializeToString(getFeatureRequest);
$.ajax({
type: 'POST',
url: PROXY_URL + GISSERVER_URL,
contentType: 'text/xml',
data: xmlStr,
success: function (res) {
map.removeInteraction(olInteraction.draw.analysisDraw);
olLayer.highlight.analysisVector.getSource().clear();
olLayer.highlight.analysisVector.getSource().addFeatures((new ol.format.GeoJSON()).readFeatures(res));
var eCnt = 0;
var aCnt = 0;
var features = res.features;
for (var i in features) {
if (features[i].id.split('.')[0] == SELECT_POI) {
if (features[i].properties.state == 1 || features[i].properties.state == 4)
eCnt++;
else
aCnt++;
}
}
$('.analysisResultDiv .openCnt').html(eCnt + '개');
$('.analysisResultDiv .closeCnt').html(aCnt + '개');
$('.analysisResultDiv').show();
}
});
});
} else {
}
});
/*------------------------------ OL OBJECT -----------------------------*/
/**
* 공통 스타일
*/
var olStyle = {
whiteStroke: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [255, 255, 255, 1],
width: 1
})
}),
blackStroke: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [0, 0, 0, 1],
width: 1
})
}),
selectHover: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [255, 255, 255, 1],
width: 4
})
}),
selectClick: new ol.style.Style({
stroke: new ol.style.Stroke({
color: [0, 0, 0, 1],
width: 2
})
})
};
/**
* 레이어
*/
olLayer = {
overlay: {
identify: new ol.Overlay({
element: document.getElementById("pg-identify-popup"),
autoPan: true,
autoPanAnimation: {
duration: 250
}
})
},
highlight: {
analysisVector: new ol.layer.Vector({
visible: true,
renderMode: 'vector',
opacity: 1,
zIndex: 99,
style: function (feature) {
// 개업 포인트
if (feature.getId().split('.')[0] == SELECT_POI) {
if (feature.getProperties().state == 1 || feature.getProperties().state == 4) {
return [
new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: '#000',
width: 2
}),
fill: new ol.style.Fill({
color: '#ff0000'
})
})
})
]
} else {
return [
new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: '#000',
width: 2
}),
fill: new ol.style.Fill({
color: '#0634c9'
})
})
})
]
}
}
},
source: new ol.source.Vector({
format: new ol.format.GeoJSON()
})
})
},
draw: {
analysisVector: new ol.layer.Vector({
visible: true,
source: new ol.source.Vector({
wrapX: false
})
})
},
boundary: {
sidoRaster: new ol.layer.Tile({
title: '시도 경계',
visible: false,
opacity: .8,
zIndex: 99,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_ctprvn_201904',
tiled: 'true'
}
})
}),
leftSidoRaster: new ol.layer.Tile({
title: '시도 경계',
visible: false,
opacity: .8,
zIndex: 99,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_ctprvn_201904',
tiled: 'true'
}
})
}),
rightSidoRaster: new ol.layer.Tile({
title: '시도 경계',
visible: false,
opacity: .8,
zIndex: 99,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_ctprvn_201904',
tiled: 'true'
}
})
}),
sidoVector: new ol.layer.Vector({
title: '시도 영역',
renderMode: 'vector',
visible: false,
opacity: 0,
zIndex: 99,
source: new ol.source.Vector({
url: PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.1.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_ctprvn_201904_s',
format: new ol.format.GeoJSON()
}),
style: olStyle.blackStroke
}),
leftSidoVector: new ol.layer.Vector({
title: '시도 영역',
renderMode: 'vector',
visible: false,
opacity: 0,
zIndex: 99,
source: new ol.source.Vector({
url: PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.1.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_ctprvn_201904_s',
format: new ol.format.GeoJSON()
}),
style: olStyle.blackStroke
}),
rightSidoVector: new ol.layer.Vector({
title: '시도 영역',
renderMode: 'vector',
visible: false,
opacity: 0,
zIndex: 99,
source: new ol.source.Vector({
url: PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.1.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_ctprvn_201904_s',
format: new ol.format.GeoJSON()
}),
style: olStyle.blackStroke
}),
sigRaster: new ol.layer.Tile({
title: '시군구 경계',
visible: true,
opacity: .8,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_sig_201904',
tiled: 'true'
}
})
}),
leftSigRaster: new ol.layer.Tile({
title: '시군구 경계',
visible: true,
opacity: .8,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_sig_201904',
tiled: 'true'
}
})
}),
rightSigRaster: new ol.layer.Tile({
title: '시군구 경계',
visible: true,
opacity: .8,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:tl_scco_sig_201904',
tiled: 'true'
}
})
}),
sigVector: new ol.layer.Vector({
title: '시군구 영역',
renderMode: 'vector',
visible: true,
opacity: 0,
source: new ol.source.Vector({
url: PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.0.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_sig_201904_s',
format: new ol.format.GeoJSON()
}),
style: function (feature) {
if (feature.getProperties().sido_cd == G_SIDO_CD) {
return [
olStyle.whiteStroke
]
}
}
}),
leftSigVector: new ol.layer.Vector({
title: '시군구 영역',
renderMode: 'vector',
visible: true,
opacity: 0,
source: new ol.source.Vector({
url: PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.0.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_sig_201904_s',
format: new ol.format.GeoJSON()
}),
style: function (feature) {
if (feature.getProperties().sido_cd == G_SIDO_CD) {
return [
olStyle.whiteStroke
]
}
}
}),
rightSigVector: new ol.layer.Vector({
title: '시군구 영역',
renderMode: 'vector',
visible: true,
opacity: 0,
source: new ol.source.Vector({
url: PROXY_URL + GISSERVER_URL
+ '?service=WFS&version=1.0.0&request=GetFeature&outputFormat=application/json'
+ '&typeName=pinogio:tl_scco_sig_201904_s',
format: new ol.format.GeoJSON()
}),
style: function (feature) {
if (feature.getProperties().sido_cd == G_SIDO_CD) {
return [
olStyle.whiteStroke
]
}
}
})
},
poi: {
// storeRaster: new ol.layer.Tile({
// title: '편의점 POI',
// visible: false,
// opacity: 1,
// source: new ol.source.TileWMS({
// url: GISSERVER_URL,
// params: {
// VERSION: '1.3.0',
// FORMAT: 'image/png',
// TRANSPARENT: 'true',
// LAYERS: 'pinogio:' + CONVENIENCE_POI,
// TILED: true,
// STYLES: 'convenience'
// },
// serverType: 'geoserver'
// })
// }),
// storeOpenRaster: new ol.layer.Image({
// visible: false,
// title: '',
// source: new ol.source.ImageWMS({
// url: GISSERVER_URL,
// params: {
// 'VERSION': '1.3.0',
// 'STYLES': 'openheatmap',
// 'LAYERS': 'pinogio:' + CONVENIENCE_POI,
// 'FORMAT': 'image/png',
// 'TRANSPARENT': 'true',
// 'TILED': 'true',
// 'CQL_FILTER': 'state = 1 or state = 4'
// }
// })
// }),
// storeCloseRaster: new ol.layer.Image({
// visible: false,
// title: '',
// source: new ol.source.ImageWMS({
// url: GISSERVER_URL,
// params: {
// 'VERSION': '1.3.0',
// 'STYLES': 'closeheatmap',
// 'LAYERS': 'pinogio:' + CONVENIENCE_POI,
// 'FORMAT': 'image/png',
// 'TRANSPARENT': 'true',
// 'TILED': 'true',
// 'CQL_FILTER': 'state = 2 or state = 3'
// }
// })
// }),
// leftStoreRaster: new ol.layer.Tile({
// title: '편의점 POI',
// visible: false,
// opacity: 1,
// source: new ol.source.TileWMS({
// url: GISSERVER_URL,
// params: {
// VERSION: '1.3.0',
// FORMAT: 'image/png',
// TRANSPARENT: 'true',
// LAYERS: 'pinogio:' + CONVENIENCE_POI,
// TILED: true,
// STYLES: 'convenience'
// },
// serverType: 'geoserver'
// })
// }),
// rightStoreRaster: new ol.layer.Tile({
// title: '편의점 POI',
// visible: false,
// opacity: 1,
// source: new ol.source.TileWMS({
// url: GISSERVER_URL,
// params: {
// VERSION: '1.3.0',
// FORMAT: 'image/png',
// TRANSPARENT: 'true',
// LAYERS: 'pinogio:' + CONVENIENCE_POI,
// TILED: true,
// STYLES: 'convenience'
// },
// serverType: 'geoserver'
// })
// }),
chickenRaster: new ol.layer.Tile({
title: '치킨집 POI',
visible: false,
opacity: 1,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:' + CHICKEN_POI,
TILED: true,
STYLES: 'chicken'
},
serverType: 'geoserver'
})
}),
chickenOpenRaster: new ol.layer.Image({
visible: false,
title: '',
source: new ol.source.ImageWMS({
url: GISSERVER_URL,
params: {
'VERSION': '1.3.0',
'STYLES': 'openheatmap',
'LAYERS': 'pinogio:' + CHICKEN_POI,
'FORMAT': 'image/png',
'TRANSPARENT': 'true',
'TILED': 'true',
'CQL_FILTER': 'state = 1 or state = 4'
}
})
}),
chickenCloseRaster: new ol.layer.Image({
visible: false,
title: '',
source: new ol.source.ImageWMS({
url: GISSERVER_URL,
params: {
'VERSION': '1.3.0',
'STYLES': 'closeheatmap',
'LAYERS': 'pinogio:' + CHICKEN_POI,
'FORMAT': 'image/png',
'TRANSPARENT': 'true',
'TILED': 'true',
'CQL_FILTER': 'state = 2 or state = 3'
}
})
}),
leftChickenRaster: new ol.layer.Tile({
title: '치킨집 POI',
visible: false,
opacity: 1,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:' + CHICKEN_POI,
TILED: true,
STYLES: 'chicken'
},
serverType: 'geoserver'
})
}),
rightChickenRaster: new ol.layer.Tile({
title: '치킨집 POI',
visible: false,
opacity: 1,
source: new ol.source.TileWMS({
url: GISSERVER_URL,
params: {
VERSION: '1.3.0',
FORMAT: 'image/png',
TRANSPARENT: 'true',
LAYERS: 'pinogio:' + CHICKEN_POI,
TILED: true,
STYLES: 'chicken'
},
serverType: 'geoserver'
})
})
}
};
olInteraction = {
draw: {
analysisDraw: null
}
// ,
// sigStatsVectorHover: new ol.interaction.Select({
// condition: ol.events.condition.pointerMove,
// layers: [ olLayer.boundary.sigVector ],
// style: olStyle.selectHover
// }),
// sigStatsVectorClick: new ol.interaction.Select({
// condition: ol.events.condition.click,
// layers: [ olLayer.boundary.sigVector ],
// style: olStyle.selectClick
// }),
};
//
// olInteraction.sigStatsVectorClick.on('select', function(e) {
// var features = e.selected;
// if (features.length > 0) {
// var sigCd = features[0].getProperties().sig_cd;
// var sigNm = features[0].getProperties().sig_kor_nm;
// e.target.getFeatures().clear();
//
// var sidoNm = '';
// $('#pg-btn-sido-select option').each(function(){
// if (this.value == sigCd.toString().substr(0,2)) {
// sidoNm = this.text;
// }
// });
// $('#pg-trading-modal .modal-title').html(sidoNm + ' ' + sigNm);
// $('#pg-trading-modal .sidoAndSigNm').html(sidoNm + ' ' + sigNm);
//
// $('#pg-trading-modal').modal('show');
//
// $.ajax({
// url: CONTEXT_PATH + '/api/estate/sigEstateOpenAndTrading.json',
// dataType: 'json',
// data: {
// sigCd: sigCd
// },
// success:function(res) {
//
// }
// });
//
//
// }
// });
// var wmsLayer = new ol.layer.Image({
// visible: true,
// title : '',
// source: new ol.source.ImageWMS({
// url: GISSERVER_URL,
// params: {
// 'VERSION': '1.3.0',
// 'STYLES': 'heatmap',
// 'LAYERS': 'pinogio:convenience',
// 'FORMAT': 'image/png',
// 'TRANSPARENT': 'true',
// 'TILED': 'true'
// }
// })
// })
// var wmsSource = new ol.source.ImageWMS({
// url: PROXY_URL + GISSERVER_URL,
// params: {'LAYERS': 'pinogio:convenience'},
// serverType: 'geoserver',
// crossOrigin: 'anonymous'});
//
// var wmsLayer = new ol.layer.Image({
// source: wmsSource
// });
//wmsSource.updateParams({ENV:'radius:5000'});
SELECT_POI_LAYER = olLayer.poi.chickenRaster;
SELECT_HEATMAP_OPEN_POI_LAYER = olLayer.poi.chickenOpenRaster;
SELECT_HEATMAP_CLOSE_POI_LAYER = olLayer.poi.chickenCloseRaster;
map = new ol.Map({
target: 'pg-mapview',
layers: [
BASEMAP_GROUP,
olLayer.boundary.sidoRaster,
olLayer.boundary.sidoVector,
olLayer.boundary.sigRaster,
olLayer.boundary.sigVector,
//olLayer.poi.storeRaster,
SELECT_POI_LAYER,
SELECT_HEATMAP_OPEN_POI_LAYER,
SELECT_HEATMAP_CLOSE_POI_LAYER,
olLayer.draw.analysisVector,
olLayer.highlight.analysisVector
],
controls: ol.control.defaults({ attribution: false }).extend([
new ol.control.Attribution({
collapsible: false
})
]),
interactions: ol.interaction.defaults({
doubleClickZoom: false,
mouseWheelZoom: true,
dragPan: true,
pinchZoom: true
}).extend([
]),
view: new ol.View({
center: ol.proj.transform([128.0292, 36.6332], 'EPSG:4326', 'EPSG:3857'),
zoom: 7,
enableRotation: false
})
});
$('#pg-mapview').data('map', map);
map = $('#pg-mapview').data('map');
olLayer.boundary.sidoRaster.setVisible(false);
olLayer.boundary.sidoVector.setVisible(true);
olLayer.boundary.sigRaster.setVisible(false);
olLayer.boundary.sigVector.setVisible(true);
// olLayer.poi.storeRaster.setVisible(true);
SELECT_POI_LAYER.setVisible(true);
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
// 기초지자체별 추세
//map.addInteraction(olInteraction.sigStatsVectorHover);
//map.addInteraction(olInteraction.sigStatsVectorClick);
// olInteraction.sigStatsVectorHover.setActive(false);
// olInteraction.sigStatsVectorClick.setActive(false);
/*var identifyOverlay = new ol.Overlay({
element: document.getElementById("pg-identify-popup"),
autoPan: true,
autoPanAnimation: {
duration: 250
}
});*/
map.addOverlay(olLayer.overlay.identify);
map.on('click', handleIdentifyPOIInfo);
function handleIdentifyPOIInfo(evt) {
// var opclFeatureInfoURL = olLayer.poi.storeRaster.getSource().getGetFeatureInfoUrl(
var opclFeatureInfoURL = SELECT_POI_LAYER.getSource().getGetFeatureInfoUrl(
evt.coordinate,
map.getView().getResolution(),
map.getView().getProjection(),
{
'INFO_FORMAT': 'application/json',
'STYLES': '',
'LAYERS': SELECT_POI,
'QUERY_LAYERS': SELECT_POI
}
);
$.ajax({
url: PROXY_URL + opclFeatureInfoURL,
async: true
}).done(function (jsonData) {
if (jsonData.features.length > 0) {
GetFunctionLog('oac', '개폐업 데이터로 살펴보는 지역별 치킨집의 흥망성쇠', '지도에서 개/폐업 조회', '');
//var content = document.getElementById('pg-identify-popup-content');
var feature = new ol.format.GeoJSON().readFeature(jsonData.features[0]);
olLayer.highlight.analysisVector.getSource().clear();
if (feature != null) {
olLayer.highlight.analysisVector.getSource().addFeature(feature);
var element = olLayer.overlay.identify.getElement();
var coordinate = [feature.getGeometry().getExtent()[2], feature.getGeometry().getExtent()[3]];
getNearestDistance(feature, coordinate);
} else {
olLayer.highlight.analysisVector.getSource().clear();
$('#pg-identify-popup-closer').click();
}
} else {
olLayer.highlight.analysisVector.getSource().clear();
$('#pg-identify-popup-closer').click();
}
});
}
function getNearestDistance(feature, coordinate) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/nearestDistance.json',
method: 'get',
dataType: 'json',
data: {
type: SELECT_POI,
xCoordinate: feature.getGeometry().getCoordinates()[0],
yCoordinate: feature.getGeometry().getCoordinates()[1]
},
success: function (res) {
var content = document.getElementById('pg-identify-popup-content');
$('#pg-identify-popup-closer').click();
var prop = feature.getProperties();
var title;
if (SELECT_POI == 'convenience')
title = '편의점';
else
title = '치킨집';
var nearDistance;
if (numeral(res.data[0].distance).format(0, 0) == "NaN")
nearDistance = '0';
else
nearDistance = numeral(res.data[0].distance).format(0, 0);
var result = '' +
'
' +
'- ' +
'' + title + '' +
'
' +
'- ' +
'영업시작연월' +
'' + prop.startdate.toString().substring(0, 4) + '년 ' + prop.startdate.toString().substring(4, 6) + '월' + ' ' +
'
' +
'- ' +
'가장 가까운 ' + title + '' +
'' + nearDistance + 'm' + ' ' +
'
' +
'
';
content.innerHTML = result;
olLayer.overlay.identify.setPosition(coordinate);
}
});
}
/**
* 팝업창 닫기 이벤트
*/
$('#pg-identify-popup-closer').on('click', function (e) {
olLayer.overlay.identify.setPosition(undefined);
document.getElementById("pg-identify-popup-closer").blur();
$('#pg-identify-popup').css('left', '-50px');
$('#pg-identify-popup').css('top', 'unset');
return false;
});
var reqSidoList = function () {
$.ajax({
url: CONTEXT_PATH + '/api/ctprvnList.json',
success: function (res) {
try {
for (i = 0; i < res.data.length; i++) {
$('#pg-btn-sido-select').append(
''
);
$('#pg-btn-left-sido-select').append(
''
);
$('#pg-btn-right-sido-select').append(
''
);
}
} catch (e) {
alert('동기화되지 못한 데이터가 있습니다.')
}
}
});
}
reqSidoList();
/**
* 시도 선택박스 변경 이벤트
*/
$("#pg-btn-sido-select").on('change', function (e) { // 시도 선택박스 변경 이벤트
GetFunctionLog('oac', '개폐업 데이터로 살펴보는 지역별 치킨집의 흥망성쇠', '지자체별 개/폐업 및 분포특성 조회', '');
sidoCd = e.currentTarget.value;
sidoNm = $("#pg-btn-sido-select :selected").text();
G_SIDO_CD = (sidoCd == '' ? null : sidoCd);
G_SIDO_NM = sidoNm;
G_SIG_CD = null;
G_SIG_NM = null;
//시간누적지도가 아닐 때
if (!G_ISTIME_MAP) {
$("#opclRankingSigStore").show();
$("#opclRankingSigStoreUD").hide();
}
$("#opclTotal > p > span").text(G_SIDO_NM + "의 치킨집 현황");
//olLayer.poi.storeRaster.getSource().refresh();
SELECT_POI_LAYER.getSource().refresh();
//시간누적지도가 아닐 때
if (!G_ISTIME_MAP) {
// if(!G_ISOPEN_TSERIES){
if (G_ISOPEN_TSERIES) {
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('vector'),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE),
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('closeheatmap')
});
getSigRankingByStore(G_CURRENT_YEAR);
if (G_SIDO_CD == null)
getOpenCloseCountByYear(SELECT_POI, G_CURRENT_DATE);
else
getOpenCloseCountBySidoYear(SELECT_POI, G_SIDO_CD, G_CURRENT_DATE);
} else {
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('vector'),
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('openheatmap'),
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('closeheatmap'),
});
if (sigRankingClicked == false) {
getOpenCloseCountBySido("chicken", G_SIDO_CD);
}
}
// }
} else {
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'vector'),
'SLD_BODY': getTimePointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE),
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'openheatmap'),
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'closeheatmap'),
});
if (G_SIDO_CD == null) {
getTimeOpenCloseCount(SELECT_POI, G_CURRENT_DATE);
} else {
getTimeOpenCloseCountBySido(SELECT_POI, G_CURRENT_DATE, G_SIDO_CD);
};
// getOpclTotalChart(SELECT_POI, "time", G_SIG_CD);
};
if (G_SIDO_CD == null) {
olLayer.boundary.sidoRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.sigRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.sidoRaster.setVisible(false);
olLayer.boundary.sigRaster.setVisible(false);
map.getView().fit(olLayer.boundary.sidoVector.getSource().getExtent(), map.getSize());
$('#pg-btn-sig-select').empty();
$('#pg-btn-sig-select').append('');
//시간누적지도가 아닐 때
if (!G_ISTIME_MAP) {
getOpclTotalChart(SELECT_POI, "notime", G_SIG_CD);
if (!G_ISOPEN_TSERIES)
getOpenCloseCount(SELECT_POI);
} else {
getOpclTotalChart(SELECT_POI, "time", G_SIG_CD);
};
} else {
//getOpenCloseCountBySido('convenience', sidoCd);
// getOpenCloseCountBySido("chicken", G_SIDO_CD);
olLayer.boundary.sidoRaster.getSource().updateParams({
'CQL_FILTER': "ctprvn_cd = '" + sidoCd + "'"
});
olLayer.boundary.sidoRaster.setVisible(true);
olLayer.boundary.sigRaster.setVisible(false);
var features = olLayer.boundary.sidoVector.getSource().getFeatures();
for (i = 0; i < features.length; i++) {
if (features[i].getProperties().ctprvn_cd == sidoCd) {
map.getView().fit(features[i].getGeometry().getExtent(), map.getSize());
$.ajax({
url: CONTEXT_PATH + '/api/sigList.json',
method: 'get',
data: {
ctprvnCd: sidoCd
},
success: function (res) {
try {
$('#pg-btn-sig-select').empty();
$('#pg-btn-sig-select').append('');
for (i = 0; i < res.data.length; i++) {
$('#pg-btn-sig-select').append(
''
);
}
//시간누적지도가 아닐 때
if (!G_ISTIME_MAP) {
if (sigRankingClicked) {
var currIdx = 0;
$("#pg-btn-sig-select option").each(function (idx, item) {
if (sigRankingSigCd == item.value) {
currIdx = idx;
}
});
$('#pg-btn-sig-select').find("option:eq(" + currIdx + ")").prop("selected", true);
$("#pg-btn-sig-select").change();
sigRankingClicked = false;
sigRankingSigCd = null;
}
}
} catch (e) {
}
}
});
break;
}
}
}
});
/**
* 시군구 선택박스 변경 이벤트
*/
$("#pg-btn-sig-select").on('change', function (e) { // 시도 선택박스 변경 이벤트
GetFunctionLog('oac', '개폐업 데이터로 살펴보는 지역별 치킨집의 흥망성쇠', '지자체별 개/폐업 및 분포특성 조회', '');
sigCd = e.target.value;
G_SIG_CD = (sigCd == '' ? null : sigCd);
G_SIG_NM = $('#pg-btn-sig-select :selected').text();
// getOpenCloseCountBySig("chicken", G_SIG_CD);
if (G_SIG_NM == "세종특별자치시") {
$("#opclTotal > p > span").text(G_SIG_NM + "의 치킨집 현황");
} else {
$("#opclTotal > p > span").text(G_SIDO_NM + " " + G_SIG_NM + "의 치킨집 현황");
};
if (G_SIG_CD == null) {
$("#pg-btn-sido-select").change();
} else {
//시간누적지도
if (G_ISTIME_MAP) {
var sld_body = getTimePointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE);
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'vector'),
'STYLES': null,
'SLD_BODY': sld_body
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'closeheatmap')
});
getTimeOpenCloseCountBySig(SELECT_POI, G_CURRENT_DATE, G_SIG_CD);
getOpclTotalChart(SELECT_POI, "time", G_SIG_CD);
} else {
if (G_ISOPEN_TSERIES) {
var sld_body = getPointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE);
getOpenCloseCountBySigYear(SELECT_POI, G_SIG_CD, G_CURRENT_DATE);
getSigRankingBySig(SELECT_POI, G_SIG_CD);
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('vector'),
'SLD_BODY': sld_body,
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('closeheatmap')
});
// getOpclTotalChart(SELECT_POI, "notime", G_SIG_CD);
} else {
getSigRankingBySig(SELECT_POI, G_SIG_CD);
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('vector'),
'STYLES': SELECT_POI
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('closeheatmap')
});
getOpclTotalChart(SELECT_POI, "notime", G_SIG_CD);
getOpenCloseCountBySig("chicken", G_SIG_CD);
}
}
var features = olLayer.boundary.sigVector.getSource().getFeatures();
for (var i in features) {
if (features[i].getProperties().sig_cd == sigCd) {
map.getView().fit(features[i].getGeometry().getExtent(), map.getSize());
olLayer.boundary.sigRaster.getSource().updateParams({
'CQL_FILTER': "sig_cd = '" + sigCd + "'"
});
olLayer.boundary.sidoRaster.setVisible(true);
olLayer.boundary.sigRaster.setVisible(true);
}
}
}
});
/**
* 편의점, 치킨집 전체 개업수, 폐업수
*/
function getOpenCloseCount(storeType) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigOpenCloseCount.json',
method: 'get',
dataType: 'json',
data: {
type: storeType
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
thead.append(
'' +
' | ' +
'전체 | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].total).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'
' +
'영업 수 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
''
);
} catch (e) {
}
}
});
}
getOpenCloseCount(SELECT_POI);
/**
* 편의점, 치킨집 전체 개업수, 폐업수 - 시도 선택에 따른
*/
function getOpenCloseCountBySido(storeType, sidoCd) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigOpenCloseCountBySido.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
sidoCd: sidoCd
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
thead.append(
'' +
' | ' +
'전체 | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].total).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'
' +
'영업 수 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
''
);
} catch (e) {
}
}
});
}
/**
* 편의점, 치킨집 전체 개업수, 폐업수 - 시군구 선택에 따른
*/
function getOpenCloseCountBySig(storeType, sigCd) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigOpenCloseCountBySig.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
sigCd: sigCd
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
thead.append(
'' +
' | ' +
'전체 | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].total).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'
' +
'영업 수 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
''
);
} catch (e) {
}
}
});
}
/**
* 전체 편의점, 치킨집 전체 개업수, 폐업수 - 년도 선택에 따른
*/
function getOpenCloseCountByYear(storeType, date) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigOpenCloseCountByYear.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
date: date.replace('-', '')
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
thead.append(
'' +
' | ' +
'' + date + ' | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'
'
// +
// '영업 수 | ' +
// '' + numeral(datas[0].open).format('0,0') + ' | ' +
// ''
);
} catch (e) {
}
}
});
}
/**
* 시도 편의점, 치킨집 전체 개업수, 폐업수 - 년도 선택에 따른
*/
function getOpenCloseCountBySidoYear(storeType, sidoCd, date) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigOpenCloseCountBySidoYear.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
sidoCd: sidoCd,
date: date.replace('-', '')
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
thead.append(
'' +
' | ' +
'' + date + ' | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'
'
// +
// '영업 수 | ' +
// '' + numeral(datas[0].open).format('0,0') + ' | ' +
// ''
);
} catch (e) {
}
}
});
}
/**
* 시군구 편의점, 치킨집 전체 개업수, 폐업수 - 년도 선택에 따른
*/
function getOpenCloseCountBySigYear(storeType, sigCd, date) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigOpenCloseCountBySigYear.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
sigCd: sigCd,
date: date.replace('-', '')
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
thead.append(
'' +
' | ' +
'' + date + ' | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'
'
// +
// '영업 수 | ' +
// '' + numeral(datas[0].open).format('0,0') + ' | ' +
// ''
);
} catch (e) {
}
}
});
}
/**
* 전국 편의점, 치킨집 개업 순위
*/
function getSigRankingByStore(storeType) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigRankingByStore.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
limit: 10
},
success: function (res) {
try {
var datas = res.data;
var title;
if (SELECT_POI == 'convenience')
title = '편의점';
else
title = '치킨집';
var thead = $('#opclRankingSigStore > table thead');
thead.empty();
thead.append(
'' +
'| 순위 | ' +
'행정구역 | ' +
'개업 | ' +
'폐업 | ' +
'영업 수 | ' +
'업체 1개당 인구 수 | ' +
'유형 | ' +
'
'
);
var tbody = $('#opclRankingSigStore > table tbody');
tbody.empty();
for (var i in datas) {
tbody.append(
'' +
'| ' + datas[i].rank + ' | ' +
'' + datas[i].sgg_nm + ' | ' +
'' + numeral(datas[i].open).format('0,0') + ' | ' +
'' + numeral(datas[i].close).format('0,0') + ' | ' +
'' + numeral(datas[i].operating).format('0,0') + ' | ' +
'' + numeral(datas[i].pop4store).format('0,0.00') + ' | ' +
'' + datas[i].c_type + ' | ' +
'
'
);
}
$("#opclRankingSigStore").show();
$("#opclRankingSigStoreUD").hide();
} catch (e) {
}
}
});
}
getSigRankingByStore(SELECT_POI);
// 선택 시군구기준(상,하위) 편의점, 치킨집 전체 개업수, 폐업수 순위
function getSigRankingBySig(storeType, sigCd) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigRankingBySig.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
sigCd: sigCd,
limit: 5
},
success: function (res) {
try {
var datas = res.data;
var title;
if (SELECT_POI == 'convenience')
title = '편의점';
else
title = '치킨집';
var thead = $('#opclRankingSigStoreUD > table thead');
thead.empty();
thead.append(
'' +
'| 순위 | ' +
'행정구역 | ' +
'개업 | ' +
'폐업 | ' +
'영업 수 | ' +
'업체 1개당 인구 수'+
' | 유형 | ' +
'
'
);
var tbody = $('#opclRankingSigStoreUD > table tbody');
tbody.empty();
for (var i in datas) {
if (sigCd == datas[i].sgg_cd) {
tbody.append(
'' +
'| ' + datas[i].rank + ' | ' +
'' + datas[i].sgg_nm + ' | ' +
'' + numeral(datas[i].open).format('0,0') + ' | ' +
'' + numeral(datas[i].close).format('0,0') + ' | ' +
'' + numeral(datas[i].operating).format('0,0') + ' | ' +
'' + numeral(datas[i].pop4store).format('0,0.00') + ' | ' +
'' + datas[i].c_type + ' | ' +
'
'
);
} else {
tbody.append(
'' +
'| ' + datas[i].rank + ' | ' +
'' + datas[i].sgg_nm + ' | ' +
'' + numeral(datas[i].open).format('0,0') + ' | ' +
'' + numeral(datas[i].close).format('0,0') + ' | ' +
'' + numeral(datas[i].operating).format('0,0') + ' | ' +
'' + numeral(datas[i].pop4store).format('0,0.00') + ' | ' +
'' + datas[i].c_type + ' | ' +
'
'
);
}
}
$("#opclRankingSigStore").hide();
$("#opclRankingSigStoreUD").show();
} catch (e) {
}
}
});
}
var years = [];
var startYear = D_START_DATE.getFullYear();
var endYear = D_END_DATE.getFullYear();
while (endYear >= startYear) {
years.push(startYear);
startYear += 1;
}
/**
* 슬라이드바 설정 및 이벤트
*/
$("#pg-slider-bar").slider({
range: false,
min: D_START_DATE.getTime(),
max: D_END_DATE.getTime(),
step: 86400001,
value: D_END_DATE.getTime(),
slide: function (e, ui) {
var date = new Date(ui.value);
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + getYMFormat(date));
},
change: function (e, ui) {
$(this).slider('option', 'slide').call($(this), e, ui);
$(this).slider('option', 'stop').call($(this), e, ui);
},
stop: function (e, ui) {
var date = new Date(ui.value);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
//var filter;
if (G_ISTIME_MAP) {
if (G_SIG_CD == null) {
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'vector'),
'SLD_BODY': getTimePointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE),
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'closeheatmap')
});
if (G_SIDO_CD == null)
getTimeOpenCloseCount(SELECT_POI, G_CURRENT_DATE);
else
getTimeOpenCloseCountBySido(SELECT_POI, G_CURRENT_DATE, G_SIDO_CD);
} else {
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'vector'),
'SLD_BODY': getTimePointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE),
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'closeheatmap')
});
getTimeOpenCloseCountBySig(SELECT_POI, G_CURRENT_DATE, G_SIG_CD);
}
} else {
if (G_SIG_CD == null) {
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('vector'),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE),
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('closeheatmap')
});
if (G_SIDO_CD == null)
getOpenCloseCountByYear(SELECT_POI, G_CURRENT_DATE);
else
getOpenCloseCountBySidoYear(SELECT_POI, G_SIDO_CD, G_CURRENT_DATE);
} else {
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('vector'),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE),
'STYLES': null
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getCqlFilterByVisble('closeheatmap')
});
getOpenCloseCountBySigYear(SELECT_POI, G_SIG_CD, G_CURRENT_DATE);
}
}
}
})
.slider('pips', {
last: false,
rest: 'label',
// labels: years,
step: 366,
});
$('.ui-slider-label').each(function (index) {
$(this).text(years[index]);
//$(this).css('font-size', 3);
});
function getYMFormat(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = (m.toString().length > 1 ? m : '0' + m);
return y + '-' + m;
}
function getYMColFormat(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = (m.toString().length > 1 ? m : '0' + m);
return 'm' + y + m;
}
function getPointSld(storeType, date) {
var stDate = date.replace('-', '') + '01';
var enDate = date.replace('-', '') + '31';
var ppSldBody = '' +
'' +
'' +
'' + storeType + '' +
'' +
'OpenClose' +
'' +
'' +
'Open' +
'Open' +
'' +
'' +
'' +
'startdate' +
'' + stDate + '' +
'' +
'' +
'startdate' +
'' + enDate + '' +
'' +
'' +
'' +
'' +
'' +
'' +
'circle' +
'' +
'#2b8cbe' +
'' +
'' +
'6' +
'
' +
'' +
'' +
'' +
'Close' +
'Close' +
'' +
'' +
'' +
'enddate' +
'' + stDate + '' +
'' +
'' +
'enddate' +
'' + enDate + '' +
'' +
'' +
'' +
'' +
'' +
'' +
'circle' +
'' +
'#ff009d' +
'' +
'' +
'6' +
'
' +
'' +
'' +
'' +
'' +
'' +
'';
return ppSldBody;
}
function getCqlFilterByVisble(type) {
var cql_filter;
var open_cql_filter;
var close_cql_filter;
if (G_ISOPEN_TSERIES) {
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
cql_filter = 'state = 5';
open_cql_filter = 'state = 5';
close_cql_filter = 'state = 5';
}
} else {
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = null;
open_cql_filter = 'state = 1 or state = 4';
close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD;
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
open_cql_filter = 'state = 1 or state = 4';
close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
open_cql_filter = 'state = 1 or state = 4';
close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
cql_filter = 'state = 5';
open_cql_filter = 'state = 5';
close_cql_filter = 'state = 5';
}
}
var returnFilter;
if (type == 'vector')
returnFilter = cql_filter;
else if (type == 'openheatmap')
returnFilter = open_cql_filter;
else if (type == 'closeheatmap')
returnFilter = close_cql_filter;
return returnFilter;
}
function getCqlFilterByInit(type) {
var cql_filter;
var open_cql_filter;
var close_cql_filter;
if (!G_ISOPEN_TSERIES) {
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
open_cql_filter = '(startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
close_cql_filter = '(enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((startdate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and ((enddate >= ' + G_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
cql_filter = 'state = 5';
open_cql_filter = 'state = 5';
close_cql_filter = 'state = 5';
}
} else {
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = null;
open_cql_filter = 'state = 1 or state = 4';
close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD;
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
open_cql_filter = 'state = 1 or state = 4';
close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
if (G_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
open_cql_filter = 'state = 1 or state = 4';
close_cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
open_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 1 or state = 4)';
close_cql_filter = 'sgg_cd =' + G_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
cql_filter = 'state = 5';
open_cql_filter = 'state = 5';
close_cql_filter = 'state = 5';
}
}
var returnFilter;
if (type == 'vector')
returnFilter = cql_filter;
else if (type == 'openheatmap')
returnFilter = open_cql_filter;
else if (type == 'closeheatmap')
returnFilter = close_cql_filter;
return returnFilter;
}
/*----------------- 시간 누적 지도 -----------------------*/
/**
* 전체 편의점, 치킨집 전체 개업수, 폐업수 - 시간누적지도
*/
function getTimeOpenCloseCount(storeType, date) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigTimeOpenCloseCount.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
date: date.replace('-', '')
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
var dateTitle;
if (date == '2019-01')
dateTitle = date + '이전';
else
dateTitle = date;
thead.append(
'' +
' | ' +
'' + date + ' | ' +
'누적 | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
'' + numeral(datas[0].totalopen).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'' + numeral(datas[0].totalclose).format('0,0') + ' | ' +
'
'
);
} catch (e) {
}
}
});
}
/**
* 전체 편의점, 치킨집 전체 개업수, 폐업수 - 시도별 시간누적지도
*/
function getTimeOpenCloseCountBySido(storeType, date, sidoCd) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigTimeOpenCloseCountBySido.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
date: date.replace('-', ''),
sidoCd: sidoCd
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
var dateTitle;
if (date == '2019-01')
dateTitle = date + '이전';
else
dateTitle = date;
thead.append(
'' +
' | ' +
'' + date + ' | ' +
'누적 | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
'' + numeral(datas[0].totalopen).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'' + numeral(datas[0].totalclose).format('0,0') + ' | ' +
'
'
);
} catch (e) {
}
}
});
}
/**
* 전체 편의점, 치킨집 전체 개업수, 폐업수 - 시군구별 시간누적지도
*/
function getTimeOpenCloseCountBySig(storeType, date, sigCd) {
$.ajax({
url: CONTEXT_PATH + '/api/openandclose/sigTimeOpenCloseCountBySig.json',
method: 'get',
dataType: 'json',
data: {
type: storeType,
date: date.replace('-', ''),
sigCd: sigCd
},
success: function (res) {
try {
var datas = res.data;
var thead = $('#opclTotal > table thead');
thead.empty();
var dateTitle;
if (date == '2019-01')
dateTitle = date + '이전';
else
dateTitle = date;
thead.append(
'' +
' | ' +
'' + date + ' | ' +
'누적 | ' +
'
'
);
var tbody = $('#opclTotal > table tbody');
tbody.empty();
tbody.append(
'' +
'| 개업 | ' +
'' + numeral(datas[0].open).format('0,0') + ' | ' +
'' + numeral(datas[0].totalopen).format('0,0') + ' | ' +
'
' +
'' +
'| 폐업 | ' +
'' + numeral(datas[0].close).format('0,0') + ' | ' +
'' + numeral(datas[0].totalclose).format('0,0') + ' | ' +
'
'
);
} catch (e) {
}
}
});
}
$('#btnTimeMap').on('click', function (e) {
GetFunctionLog('oac', '개폐업 데이터로 살펴보는 지역별 치킨집의 흥망성쇠', '시간누적조회', '');
if (G_ISTIME_MAP) {
getOpclTotalChart(SELECT_POI, 'notime', G_SIG_CD);
G_ISOPEN_TSERIES = false;
$('#btnTimeMap').removeClass('btn-success');
$('#btnTimeMap').addClass('btn-secondary');
G_ISTIME_MAP = false;
$("#pg-btn-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-sido-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-sido-select").change();
}
});
//개폐업 Visble Checkbox
$(".main-checkbox").find("input").prop("disabled", false);
// G_ISTIME_MAP = false;
// 슬라이더 바 조절 버튼 숨김
$('#pg-timseries-btn').hide();
//시군구 랭킹 보여주기
$("#opclRankingSigStore").show();
// 측정도구
$('#openandcloseAnalysisTool').show();
// UI 기본 설정
$('.pg-timeseries-cover').hide();
$('.pg-btn-timeseries').html('날짜선택
슬라이드 보기');
var date = new Date(D_END_DATE);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
$("#pg-slider-bar").slider('value', date.getTime());
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + G_CURRENT_DATE);
$('.pg-btn-timeseries').prop("disabled", false);
//전체 갯수 가져오는걸로 수정..
getOpenCloseCount(SELECT_POI);
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? null : 'sgg_cd = ' + G_SIG_CD,
'STYLES': SELECT_POI
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? 'state = 1 or state = 4' : 'sgg_cd = ' + G_SIG_CD
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': G_SIG_CD == null ? 'state = 2 or state = 3' : 'sgg_cd = ' + G_SIG_CD
});
} else {
getOpclTotalChart(SELECT_POI, 'time', G_SIG_CD);
G_ISOPEN_TSERIES = true;
$('#btnTimeMap').removeClass('btn-secondary');
$('#btnTimeMap').addClass('btn-success');
G_ISTIME_MAP = true;
$("#pg-btn-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-sido-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-sido-select").change();
}
});
// 측정도구
$('#openandcloseAnalysisTool').hide();
// 순위 테이블
$("#opclRankingSigStore").hide();
$("#opclRankingSigStoreUD").hide();
//개폐업 Visble Checkbox
$(".main-checkbox").find("input").prop("disabled", true);
//G_ISTIME_MAP = true;
$('#pg-overlay-layer-item-open').prop('checked', true);
$('#pg-overlay-layer-item-close').prop('checked', true);
// 최근 데이터 기준 슬라이드바 초기화
var date = new Date(D_START_DATE);
G_CURRENT_YEAR = date.getFullYear();
G_CURRENT_DATE = getYMFormat(date);
// 슬라이더 바 조절 버튼 보이기
$('#pg-timseries-btn').show();
// UI 기본 설정
$('.pg-timeseries-cover').show();
$('.pg-btn-timeseries').html('시간 누적 지도');
$('.pg-btn-timeseries').prop("disabled", true);
$("#pg-slider-bar").slider('value', date.getTime());
$('.pg-timseries-now .card-body > h3').empty();
$('.pg-timseries-now .card-body > h3').html('현재 ' + G_CURRENT_DATE);
getTimeOpenCloseCount(SELECT_POI, G_CURRENT_DATE);
var sld_body = getTimePointSld('pinogio:' + SELECT_POI, G_CURRENT_DATE);
// olLayer.poi.storeRaster.getSource().refresh();
// olLayer.poi.storeRaster.getSource().updateParams({
SELECT_POI_LAYER.getSource().refresh();
SELECT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'vector'),
'STYLES': null,
'SLD_BODY': sld_body
});
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_OPEN_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'openheatmap')
});
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().refresh();
SELECT_HEATMAP_CLOSE_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeCqlFilterByVisble(G_SIG_CD, 'closeheatmap')
});
}
});
function getTimePointSld(storeType, date) {
var stDate = date.replace('-', '') + '01';
var enDate = date.replace('-', '') + '31';
var ppSldBody = '' +
'' +
'' +
'' + storeType + '' +
'' +
'OpenClose' +
'' +
'' +
'Open' +
'Open' +
'' +
'' +
'' +
'enddate' +
'' + enDate + '' +
'' +
'' +
'enddate' +
'' +
'' +
'' +
'' +
'' +
'' +
'circle' +
'' +
'#2b8cbe' +
'' +
'' +
'6' +
'
' +
'' +
'' +
'' +
'Close' +
'Close' +
'' +
'' +
'enddate' +
'' + enDate + '' +
'' +
'' +
'' +
'' +
'' +
'circle' +
'' +
'#ff009d' +
'' +
'' +
'6' +
'
' +
'' +
'' +
'' +
'' +
'' +
'';
return ppSldBody;
}
function getTimeCqlFilterByVisble(sggCd, type) {
var cql_filter;
var open_cql_filter;
var close_cql_filter;
if (sggCd == null) {
cql_filter = 'startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ' or enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31';
open_cql_filter = 'startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31';
close_cql_filter = 'enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31';
} else {
cql_filter = 'sgg_cd = ' + sggCd + ' and (startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31' + ' or enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31)';
open_cql_filter = 'sgg_cd = ' + sggCd + ' and (startdate <= ' + G_CURRENT_DATE.replace('-', '') + '31)';
close_cql_filter = 'sgg_cd = ' + sggCd + ' and (enddate <= ' + G_CURRENT_DATE.replace('-', '') + '31)';
}
var returnFilter;
if (type == 'vector')
returnFilter = cql_filter;
else if (type == 'openheatmap')
returnFilter = open_cql_filter;
else if (type == 'closeheatmap')
returnFilter = close_cql_filter;
return returnFilter;
}
/*----------------- 지도 비교 -----------------------*/
function setDates() {
for (i = 0; i < G_YEARS.length; i++) {
$('#pg-btn-left-year-select').append(
''
);
$('#pg-btn-right-year-select').append(
''
);
}
for (i = 0; i < G_MONTHS.length; i++) {
$('#pg-btn-left-month-select').append(
''
);
$('#pg-btn-right-month-select').append(
''
);
}
}
setDates();
var left_view = new ol.View({
center: ol.proj.transform([128.0292, 36.6332], 'EPSG:4326', 'EPSG:3857'),
zoom: 6,
enableRotation: false
});
SELECT_LEFT_POI_LAYER = olLayer.poi.leftChickenRaster;
left_map = new ol.Map({
target: 'pg-left-mapview',
layers: [
BASEMAP_GROUP,
olLayer.boundary.leftSidoRaster,
olLayer.boundary.leftSidoVector,
olLayer.boundary.leftSigRaster,
olLayer.boundary.leftSigVector,
SELECT_LEFT_POI_LAYER
//olLayer.poi.leftStoreRaster
],
controls: ol.control.defaults({ attribution: false }).extend([
new ol.control.Attribution({
collapsible: false
})
]),
interactions: ol.interaction.defaults({
doubleClickZoom: false,
mouseWheelZoom: true,
dragPan: true,
pinchZoom: true
}),
view: left_view
});
olLayer.boundary.leftSidoRaster.setVisible(false);
olLayer.boundary.leftSidoVector.setVisible(true);
olLayer.boundary.leftSigRaster.setVisible(false);
olLayer.boundary.leftSigVector.setVisible(true);
SELECT_LEFT_POI_LAYER.setVisible(true);
//olLayer.poi.leftStoreRaster.setVisible(true);
var right_view = new ol.View({
center: ol.proj.transform([128.0292, 36.6332], 'EPSG:4326', 'EPSG:3857'),
zoom: 6,
enableRotation: false
});
SELECT_RIGHT_POI_LAYER = olLayer.poi.rightChickenRaster;
right_map = new ol.Map({
target: 'pg-right-mapview',
layers: [
BASEMAP_GROUP,
olLayer.boundary.rightSidoRaster,
olLayer.boundary.rightSidoVector,
olLayer.boundary.rightSigRaster,
olLayer.boundary.rightSigVector,
SELECT_RIGHT_POI_LAYER
//olLayer.poi.rightStoreRaster
],
controls: ol.control.defaults({ attribution: false }).extend([
new ol.control.Attribution({
collapsible: false
})
]),
interactions: ol.interaction.defaults({
doubleClickZoom: false,
mouseWheelZoom: true,
dragPan: true,
pinchZoom: true
}),
view: right_view
});
olLayer.boundary.rightSidoRaster.setVisible(false);
olLayer.boundary.rightSidoVector.setVisible(true);
olLayer.boundary.rightSigRaster.setVisible(false);
olLayer.boundary.rightSigVector.setVisible(true);
SELECT_RIGHT_POI_LAYER.setVisible(true);
// olLayer.poi.rightStoreRaster.setVisible(true);
//초기에 2분할창 숨기기
$(".splitter_map").hide();
$('#btnCompareMap').on('click', function (e) {
GetFunctionLog('oac', '개폐업 데이터로 살펴보는 지역별 치킨집의 흥망성쇠', '지도비교', '');
$(".splitter_map").show();
$('.splitter_map').split({
orientation: 'vertical',
limit: 10,
onDrag: function (event) {
left_map.updateSize();
right_map.updateSize();
}
});
$(".pg-map").hide();
$(".pg-content").hide();
left_map.updateSize();
right_map.updateSize();
});
$("#pg-btn-left-year-select").on('change', function (e) {
var yearVal = e.currentTarget.value;
var monthVal = $('#pg-btn-left-month-select :selected').val();
if (yearVal == '' || monthVal == '')
G_LEFT_TIME = false;
else
G_LEFT_TIME = true;
if (!G_LEFT_TIME)
return;
else
G_LEFT_CURRENT_DATE = yearVal + '-' + pad(monthVal, 2);
G_LEFT_CURRENT_YEAR = yearVal;
G_LEFT_CURRENT_MONTH = monthVal;
// olLayer.poi.leftStoreRaster.getSource().refresh();
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().refresh();
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeLeftCqlFilterByVisble(),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_LEFT_CURRENT_DATE),
'STYLES': null
});
});
$("#pg-btn-left-month-select").on('change', function (e) {
var yearVal = $('#pg-btn-left-year-select :selected').val();
var monthVal = e.currentTarget.value;
if (yearVal == '' || monthVal == '')
G_LEFT_TIME = false;
else
G_LEFT_TIME = true;
if (!G_LEFT_TIME)
return;
else
G_LEFT_CURRENT_DATE = yearVal + '-' + pad(monthVal, 2);
G_LEFT_CURRENT_YEAR = yearVal;
G_LEFT_CURRENT_MONTH = monthVal;
// olLayer.poi.leftStoreRaster.getSource().refresh();
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().refresh();
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeLeftCqlFilterByVisble(),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_LEFT_CURRENT_DATE),
'STYLES': null
});
});
$("#pg-btn-right-year-select").on('change', function (e) {
var yearVal = e.currentTarget.value;
var monthVal = $('#pg-btn-right-month-select :selected').val();
if (yearVal == '' || monthVal == '')
G_RIGHT_TIME = false;
else
G_RIGHT_TIME = true;
if (!G_RIGHT_TIME)
return;
else
G_RIGHT_CURRENT_DATE = yearVal + '-' + pad(monthVal, 2);
G_RIGHT_CURRENT_YEAR = yearVal;
G_RIGHT_CURRENT_MONTH = monthVal;
// olLayer.poi.rightStoreRaster.getSource().refresh();
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().refresh();
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeRightCqlFilterByVisble(),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_RIGHT_CURRENT_DATE),
'STYLES': null
});
});
$("#pg-btn-right-month-select").on('change', function (e) {
var yearVal = $('#pg-btn-right-year-select :selected').val();
var monthVal = e.currentTarget.value;
if (yearVal == '' || monthVal == '')
G_RIGHT_TIME = false;
else
G_RIGHT_TIME = true;
if (!G_RIGHT_TIME)
return;
else
G_RIGHT_CURRENT_DATE = yearVal + '-' + pad(monthVal, 2);
G_RIGHT_CURRENT_YEAR = yearVal;
G_RIGHT_CURRENT_MONTH = monthVal;
// olLayer.poi.rightStoreRaster.getSource().refresh();
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().refresh();
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeRightCqlFilterByVisble(),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_RIGHT_CURRENT_DATE),
'STYLES': null
});
});
$('#btnCompareClose').on('click', function (e) {
$(".splitter_map").hide();
$(".pg-map").show();
$(".pg-content").show();
});
$('#pg-left-setting .expand').on('click', function (e) {
$('#pg-left-setting .card-body').toggle();
});
$('#pg-right-setting .expand').on('click', function (e) {
$('#pg-right-setting .card-body').toggle();
});
/**
* 분할맵 왼쪽 지도 시도 선택박스 변경 이벤트
*/
$("#pg-btn-left-sido-select").on('change', function (e) { // 시도 선택박스 변경 이벤트
var sidoCd = e.currentTarget.value;
var sidoNm = $("#pg-btn-left-sido-select :selected").text();
G_LEFT_SIDO_CD = (sidoCd == '' ? null : sidoCd);
G_LEFT_SIDO_NM = sidoNm;
G_LEFT_SIG_CD = null;
G_LEFT_SIG_NM = null;
// olLayer.poi.leftStoreRaster.getSource().refresh();
SELECT_LEFT_POI_LAYER.getSource().refresh();
//if(!G_LEFT_TIME){
if (G_LEFT_TIME) {
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeLeftCqlFilterByVisble(),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_LEFT_CURRENT_DATE),
'STYLES': null
});
} else {
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeLeftCqlFilterByVisble(),
'SLD_BODY': null,
'STYLES': SELECT_POI
});
}
//}
if (G_LEFT_SIDO_CD == null) {
olLayer.boundary.leftSidoRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.leftSigRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.leftSidoRaster.setVisible(false);
olLayer.boundary.leftSigRaster.setVisible(false);
left_map.getView().fit(olLayer.boundary.leftSidoVector.getSource().getExtent(), left_map.getSize());
$('#pg-btn-left-sig-select').empty();
$('#pg-btn-left-sig-select').append('');
} else {
olLayer.boundary.leftSidoRaster.getSource().updateParams({
'CQL_FILTER': "ctprvn_cd = '" + sidoCd + "'"
});
olLayer.boundary.leftSidoRaster.setVisible(true);
olLayer.boundary.leftSigRaster.setVisible(false);
var features = olLayer.boundary.leftSidoVector.getSource().getFeatures();
for (i = 0; i < features.length; i++) {
if (features[i].getProperties().ctprvn_cd == sidoCd) {
left_map.getView().fit(features[i].getGeometry().getExtent(), left_map.getSize());
$.ajax({
url: CONTEXT_PATH + '/api/sigList.json',
method: 'get',
data: {
ctprvnCd: sidoCd
},
success: function (res) {
try {
$('#pg-btn-left-sig-select').empty();
$('#pg-btn-left-sig-select').append('');
for (i = 0; i < res.data.length; i++) {
$('#pg-btn-left-sig-select').append(
''
);
}
} catch (e) {
}
}
});
break;
}
}
}
});
/**
* 분할맵 왼쪽 지도 시군구 선택박스 변경 이벤트
*/
$("#pg-btn-left-sig-select").on('change', function (e) {
var sigCd = e.target.value;
G_LEFT_SIG_CD = (sigCd == '' ? null : sigCd);
G_LEFT_SIG_NM = $('#pg-btn-left-sig-select :selected').text();
if (G_LEFT_SIG_CD == null) {
$("#pg-btn-left-sido-select").change();
} else {
if (G_LEFT_TIME) {
var sld_body = getPointSld('pinogio:' + SELECT_POI, G_LEFT_CURRENT_DATE);
// olLayer.poi.leftStoreRaster.getSource().refresh();
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().refresh();
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeLeftCqlFilterByVisble(),
'SLD_BODY': sld_body,
'STYLES': null
});
} else {
// olLayer.poi.leftStoreRaster.getSource().refresh();
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().refresh();
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeLeftCqlFilterByVisble(),
'SLD_BODY': null,
'STYLES': SELECT_POI
});
}
var features = olLayer.boundary.leftSigVector.getSource().getFeatures();
for (var i in features) {
if (features[i].getProperties().sig_cd == sigCd) {
left_map.getView().fit(features[i].getGeometry().getExtent(), left_map.getSize());
olLayer.boundary.leftSigRaster.getSource().updateParams({
'CQL_FILTER': "sig_cd = '" + sigCd + "'"
});
olLayer.boundary.leftSidoRaster.setVisible(true);
olLayer.boundary.leftSigRaster.setVisible(true);
}
}
}
});
/**
* 분할맵 오른쪽 지도 시도 선택박스 변경 이벤트
*/
$("#pg-btn-right-sido-select").on('change', function (e) { // 시도 선택박스 변경 이벤트
var sidoCd = e.currentTarget.value;
var sidoNm = $("#pg-btn-right-sido-select :selected").text();
G_RIGHT_SIDO_CD = (sidoCd == '' ? null : sidoCd);
G_RIGHT_SIDO_NM = sidoNm;
G_RIGHT_SIG_CD = null;
G_RIGHT_SIG_NM = null;
// olLayer.poi.rightStoreRaster.getSource().refresh();
SELECT_RIGHT_POI_LAYER.getSource().refresh();
if (G_RIGHT_TIME) {
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeRightCqlFilterByVisble(),
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_RIGHT_CURRENT_DATE),
'STYLES': null
});
} else {
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeRightCqlFilterByVisble(),
'SLD_BODY': null,
'STYLES': SELECT_POI
});
}
if (G_RIGHT_SIDO_CD == null) {
olLayer.boundary.rightSidoRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.rightSigRaster.getSource().updateParams({
'CQL_FILTER': null
});
olLayer.boundary.rightSidoRaster.setVisible(false);
olLayer.boundary.rightSigRaster.setVisible(false);
right_map.getView().fit(olLayer.boundary.leftSidoVector.getSource().getExtent(), right_map.getSize());
$('#pg-btn-right-sig-select').empty();
$('#pg-btn-right-sig-select').append('');
} else {
olLayer.boundary.rightSidoRaster.getSource().updateParams({
'CQL_FILTER': "ctprvn_cd = '" + sidoCd + "'"
});
olLayer.boundary.rightSidoRaster.setVisible(true);
olLayer.boundary.rightSigRaster.setVisible(false);
var features = olLayer.boundary.rightSidoVector.getSource().getFeatures();
for (i = 0; i < features.length; i++) {
if (features[i].getProperties().ctprvn_cd == sidoCd) {
right_map.getView().fit(features[i].getGeometry().getExtent(), right_map.getSize());
$.ajax({
url: CONTEXT_PATH + '/api/sigList.json',
method: 'get',
data: {
ctprvnCd: sidoCd
},
success: function (res) {
try {
$('#pg-btn-right-sig-select').empty();
$('#pg-btn-right-sig-select').append('');
for (i = 0; i < res.data.length; i++) {
$('#pg-btn-right-sig-select').append(
''
);
}
} catch (e) {
}
}
});
break;
}
}
}
});
/**
* 분할맵 오른쪽 지도 시군구 선택박스 변경 이벤트
*/
$("#pg-btn-right-sig-select").on('change', function (e) {
var sigCd = e.target.value;
G_RIGHT_SIG_CD = (sigCd == '' ? null : sigCd);
G_RIGHT_SIG_NM = $('#pg-btn-right-sig-select :selected').text();
if (G_RIGHT_SIG_CD == null) {
$("#pg-btn-right-sido-select").change();
} else {
if (G_RIGHT_TIME) {
var sld_body = getPointSld('pinogio:' + SELECT_POI, G_RIGHT_CURRENT_DATE);
// olLayer.poi.rightStoreRaster.getSource().refresh();
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().refresh();
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeRightCqlFilterByVisble(),
'SLD_BODY': sld_body,
'STYLES': null
});
} else {
// olLayer.poi.rightStoreRaster.getSource().refresh();
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().refresh();
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': getTimeRightCqlFilterByVisble(),
'SLD_BODY': null,
'STYLES': SELECT_POI
});
}
var features = olLayer.boundary.rightSigVector.getSource().getFeatures();
for (var i in features) {
if (features[i].getProperties().sig_cd == sigCd) {
right_map.getView().fit(features[i].getGeometry().getExtent(), right_map.getSize());
olLayer.boundary.rightSigRaster.getSource().updateParams({
'CQL_FILTER': "sig_cd = '" + sigCd + "'"
});
olLayer.boundary.rightSidoRaster.setVisible(true);
olLayer.boundary.rightSigRaster.setVisible(true);
}
}
}
});
/**
* 포인트 레이어 스위치
*/
$('.pg-left-overlay-layer-item').change(function (e) {
var cql_filter;
if (G_LEFT_TIME) {
if ($('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and ((startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if ($('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and ((startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and ((enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
cql_filter = 'state = 5';
}
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': cql_filter,
'STYLES': null,
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_LEFT_CURRENT_DATE)
});
} else {
if ($('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = null;
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD;
}
} else if ($('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and (state = 1 or state = 4)';
}
} else if (!$('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
cql_filter = 'state = 5';
}
// olLayer.poi.leftStoreRaster.getSource().updateParams({
SELECT_LEFT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': cql_filter,
'STYLES': SELECT_POI
});
}
});
/**
* 포인트 레이어 스위치
*/
$('.pg-right-overlay-layer-item').change(function (e) {
var cql_filter;
if (G_RIGHT_TIME) {
if ($('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and ((startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if ($('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and ((startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and ((enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
cql_filter = 'state = 5';
}
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': cql_filter,
'STYLES': null,
'SLD_BODY': getPointSld('pinogio:' + SELECT_POI, G_RIGHT_CURRENT_DATE)
});
} else {
if ($('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = null;
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD;
}
} else if ($('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and (state = 1 or state = 4)';
}
} else if (!$('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
cql_filter = 'state = 5';
}
// olLayer.poi.rightStoreRaster.getSource().updateParams({
SELECT_RIGHT_POI_LAYER.getSource().updateParams({
'CQL_FILTER': cql_filter,
'STYLES': SELECT_POI
});
}
});
function getTimeLeftCqlFilterByVisble() {
var cql_filter;
if (G_LEFT_TIME) {
if ($('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and ((startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if ($('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and ((startdate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and ((enddate >= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_LEFT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
cql_filter = 'state = 5';
}
} else {
if ($('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = null;
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD;
}
} else if ($('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and (state = 1 or state = 4)';
}
} else if (!$('#pg-left-open').is(":checked") && $('#pg-left-close').is(":checked")) {
if (G_LEFT_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_LEFT_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-left-open').is(":checked") && !$('#pg-left-close').is(":checked")) {
cql_filter = 'state = 5';
}
}
return cql_filter;
}
function getTimeRightCqlFilterByVisble() {
var cql_filter;
if (G_RIGHT_TIME) {
if ($('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and ((startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ') or (enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if ($('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = '(startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and ((startdate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and startdate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = '(enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + ')';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and ((enddate >= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '01' + ' and enddate <= ' + G_RIGHT_CURRENT_DATE.replace('-', '') + '31' + '))';
}
} else if (!$('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
cql_filter = 'state = 5';
}
} else {
if ($('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = null;
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD;
}
} else if ($('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = 'state = 1 or state = 4';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and (state = 1 or state = 4)';
}
} else if (!$('#pg-right-open').is(":checked") && $('#pg-right-close').is(":checked")) {
if (G_RIGHT_SIG_CD == null) {
cql_filter = 'state = 2 or state = 3';
} else {
cql_filter = 'sgg_cd =' + G_RIGHT_SIG_CD + ' and (state = 2 or state = 3)';
}
} else if (!$('#pg-right-open').is(":checked") && !$('#pg-right-close').is(":checked")) {
cql_filter = 'state = 5';
}
}
return cql_filter;
}
function pad(n, width) {
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
}
var timeGraphDialog = $("#opclStatus").dialog({
uiLibrary: 'bootstrap',
resizable: true,
// minWidth: 200,
// maxWidth: 600,
// minHeight: 200,
// maxHeight: 450,
height: 600,
width: 1024,
modal: false,
open: function () {
var closeBtn = $('.ui-dialog-titlebar-close');
closeBtn.append('');
},
close: function () {
var closeBtn = $('.ui-dialog-titlebar-close');
closeBtn.html('');
$('#pg-overlay-graph-item-opcl').prop('checked', false);
}
});
$("#opclStatus").dialog("close");
/*------------------chart------------------------*/
$('.pg-overlay-graph-item').change(function (e) {
if ($('#pg-overlay-graph-item-opcl').is(":checked")) {
//$('.chart-cover').show();
$("#opclStatus").dialog("open");
}
else {
//$('.chart-cover').hide();
$("#opclStatus").dialog("close");
}
});
function getOpclTotalChart(storeType, graphType, sigCd) {
var ctx, ctx2;
if (window.myMixedChart != undefined) {
window.myMixedChart.destroy();
}
if (window.myMixedChart1 != undefined) {
window.myMixedChart1.destroy();
}
if (window.myMixedChart2 != undefined) {
window.myMixedChart2.destroy();
}
$("#reset_zoom").hide();
$("#oneChart").hide();
$("#twoChart").hide();
if (xhr !== undefined) {
xhr.abort();
};
if (sigCd == null) {
xhr = $.ajax({
url: CONTEXT_PATH + '/api/openandclose/opclCountByDate.json',
dataType: 'json',
data: {
type: storeType,
graphType: graphType, //time: 누적지도 그래프, notime: 일반 그래프
},
success: function (res) {
try {
var labels = res.data.LABEL;
for (var i in labels) {
labels[i] = labels[i].substring(0, 4) + '년 ' + labels[i].substring(4, 6) + '월';
}
var chartData = {
labels: labels,
datasets: [{
label: '개업',
backgroundColor: '#2b8cbe',
borderColor: '#2b8cbe',
borderWidth: 1,
fill: false,
yAxisID: 'y-axis-1',
data: res.data.OPENS,
pointRadius: 1,
}, {
label: '폐업',
backgroundColor: '#ff009d',
borderColor: '#ff009d',
borderWidth: 1,
fill: false,
yAxisID: 'y-axis-1',
data: res.data.CLOSES,
pointRadius: 1,
}]
};
$("#oneChart").show();
$("#reset_zoom").show();
$("#ui-id-1").text("전국의 치킨집 개폐업 변화");
ctx = document.getElementById('opclStatus.chart').getContext('2d');
window.myMixedChart = new Chart(ctx, {
type: 'line',
data: chartData,
options: {
responsive: true,
maintainAspectRatio: false,
// title: {
// display: false,
// position: 'top',
// text: '개폐업 그래프'
// },
tooltips: {
mode: 'index',
intersect: true
},
legend: {
display: true,
position: 'top'
},
scales: {
xAxes: [{
display: true,
ticks: {
autoSkip: true,
maxTicksLimit: 17,
minRotation: 70
}
}],
yAxes: [{
type: 'linear',
display: true,
position: 'left',
label: '',
id: 'y-axis-1',
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '개업/폐업'
},
ticks: {
beginAtZero: true,
min: 0,
stepSize: 200
}
// }, {
// type: 'linear',
// display: true,
// position: 'right',
// id: 'y-axis-2',
// gridLines: {
// drawOnChartArea: false
// },
// scaleLabel: {
// display: true,
// labelString: '폐업'
// },
// ticks: {
// beginAtZero: true,
// min: 0,
// stepSize: 200
// }
// }
}],
annotation: {
events: ['mouseenter', 'mouseleave'],
annotations: annotations
},
},
plugins: {
zoom: {
// Container for pan options
pan: {
// Boolean to enable panning
enabled: true,
// Panning directions. Remove the appropriate direction to disable
// Eg. 'y' would only allow panning in the y direction
mode: 'x'
},
// Container for zoom options
zoom: {
// Boolean to enable zooming
enabled: true,
// Zooming directions. Remove the appropriate direction to disable
// Eg. 'y' would only allow zooming in the y direction
mode: 'x',
}
}
}
}
});
} catch (e) { }
}
})
} else { // 시군구
xhr = $.ajax(
{
url: CONTEXT_PATH + '/api/openandclose/opclCountByDateSig.json',
dataType: 'json',
data: {
type: storeType,
graphType: graphType, //time: 누적지도 그래프, notime: 일반 그래프
sigCd: sigCd
},
success: function (res) {
try {
var chartData1 = {
labels: res.data.LABEL,
datasets: [
{
label: "전체 영업 업체 수",
backgroundColor: "#1B9E77",
borderColor: "#1B9E77",
borderWidth: 1,
fill: false,
yAxisID: "y-axis-1",
data: res.data.TOTAL,
pointRadius: 1
},
{
label: "업체
1개당
인구 수",
backgroundColor: "#606060",
borderColor: "#606060",
borderWidth: 1,
fill: false,
yAxisID: "y-axis-2",
data: res.data.PSRATE,
pointRadius: 1
}
]
}
var chartData2;
if (graphType == "notime") { // 시간 누적 지도가 아닐 때
chartData2 = {
labels: res.data.LABEL,
datasets: [
{
label: "개업",
backgroundColor: "#E31315",
borderColor: "#E31315",
borderWidth: 1,
fill: false,
yAxisID: "y-axis-1",
data: res.data.OPENS,
pointRadius: 1
},
{
label: "폐업",
backgroundColor: "#377EB8",
borderColor: "#377EB8",
borderWidth: 1,
fill: false,
yAxisID: "y-axis-1",
data: res.data.CLOSES,
pointRadius: 1
}
]
}
} else { // 시간 누적 지도일 때
chartData2 = {
labels: res.data.LABEL,
datasets: [
{
label: "개업",
backgroundColor: "#E31315",
borderColor: "#E31315",
borderWidth: 1,
fill: false,
yAxisID: "y-axis-1",
data: res.data.OPENSUM,
pointRadius: 1
},
{
label: "폐업",
backgroundColor: "#377EB8",
borderColor: "#377EB8",
borderWidth: 1,
fill: false,
yAxisID: "y-axis-1",
data: res.data.CLOSESUM,
pointRadius: 1
}
]
}
}
$("#twoChart").show();
if (G_SIDO_NM == "세종특별자치시") {
$("#ui-id-1").text(G_SIG_NM + "의 치킨집 개폐업 변화");
} else {
$("#ui-id-1").text(G_SIDO_NM + " " + G_SIG_NM + "의 치킨집 개폐업 변화");
};
ctx = document.getElementById('opclStatus.chart1').getContext('2d');
ctx2 = document.getElementById('opclStatus.chart2').getContext('2d');
window.myMixedChart1 = new Chart(ctx, {
type: 'line',
data: chartData1,
options: {
responsive: true,
maintainAspectRatio: false,
tooltips: {
mode: 'index',
intersect: true
},
legend: {
display: true,
position: 'top'
},
scales: {
xAxes: [{
display: true,
ticks: {
autoSkip: false,
maxTicksLimit: 17,
minRotation: 70,
stepSize: 1
}
}],
yAxes: [{
type: 'linear',
display: true,
position: 'left',
label: '',
id: 'y-axis-1',
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '영업 업체 수'
},
ticks: {
stepSize: 100
}
}, {
type: 'linear',
display: true,
position: 'right',
id: 'y-axis-2',
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '업체
1개당
인구 수'
},
ticks: {
stepSize: 100
}
}],
annotation: {
events: ['mouseenter', 'mouseleave'],
annotations: annotations
}
}
}
});
window.myMixedChart2 = new Chart(ctx2, {
type: 'line',
data: chartData2,
options: {
responsive: true,
maintainAspectRatio: false,
tooltips: {
mode: 'index',
intersect: true
},
legend: {
display: true,
position: 'top'
},
scales: {
xAxes: [{
display: true,
ticks: {
autoSkip: false,
maxTicksLimit: 17,
minRotation: 70,
stepSize: 1
}
}],
yAxes: [{
type: 'linear',
display: true,
position: 'left',
label: '',
id: 'y-axis-1',
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '영업 업체 수'
},
ticks: {
beginAtZero: true,
min: 0,
stepSize: 100
}
}],
annotation: {
events: ['mouseenter', 'mouseleave'],
annotations: annotations
}
}
}
});
} catch (e) {
console.log(e);
};
}
}
)
}
}
getOpclTotalChart(SELECT_POI, 'notime', G_SIG_CD);
$('#reset_zoom').click(function () {
myMixedChart.resetZoom();
});
$('#disable_zoom').click(function () {
myMixedChart.ctx.canvas.removeEventListener('wheel', myMixedChart._wheelHandler);
});
$('#enable_zoom').click(function () {
myMixedChart.ctx.canvas.addEventListener('wheel', myMixedChart._wheelHandler);
});
$('#btnLeftInit').click(function () {
$("#pg-btn-left-month-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-left-month-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-left-month-select").change();
}
});
$("#pg-btn-left-year-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-left-year-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-left-year-select").change();
}
});
$('#pg-left-open').prop('checked', true);
$('#pg-left-close').prop('checked', true);
$("#pg-btn-left-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-left-sido-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-left-sido-select").change();
}
});
});
$('#btnRightInit').click(function () {
$("#pg-btn-right-month-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-right-month-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-right-month-select").change();
}
});
$("#pg-btn-right-year-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-right-year-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-right-year-select").change();
}
});
$('#pg-right-open').prop('checked', true);
$('#pg-right-close').prop('checked', true);
$("#pg-btn-right-sido-select option").each(function (idx, item) {
if (item.value == '') {
$('#pg-btn-right-sido-select').find("option:eq(" + idx + ")").prop("selected", true);
$("#pg-btn-right-sido-select").change();
}
});
});
function pixelToMeter(evt) {
var view = map.getView();
var coords = view.getCenter();
var resolution = view.getResolution();
var projection = view.getProjection();
//ol3
//var resolutionAtCoords = projection.getPointResolution(resolution, coords);
//ol5
//var resolutionAtCoords = projection.getPointResolutionFunc_(resolution, coords);
var heatRadius = 50;
// var radiusMeters = (heatRadius / resolutionAtCoords);
var radiusMeters = (heatRadius / resolution);
// console.log(heatRadius+','+resolution+','+radiusMeters);
olLayer.poi.chickenOpenRaster.getSource().updateParams({
"env": "radius:" + radiusMeters
});
olLayer.poi.chickenCloseRaster.getSource().updateParams({
"env": "radius:" + radiusMeters
});
}
$('.pg-btn-maptype').on('click', function (e) {
if (MAP_TYPE == $(this).data('id'))
return;
if ($(this).data('id') == 'vector') {
MAP_TYPE = "vector";
SELECT_POI_LAYER.setVisible(true);
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
map.getView().un('change:resolution', pixelToMeter);
$('#viewHeatmap').removeClass('btn-primary');
$('#viewHeatmap').removeClass('active');
$('#viewVector').addClass('btn-primary');
$('#viewVector').addClass('active');
} else if ($(this).data('id') == 'heatmap') {
MAP_TYPE = "heatmap";
SELECT_POI_LAYER.setVisible(false);
if ($('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && $('#pg-overlay-layer-item-close').is(":checked")) {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(true);
} else if ($('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(true);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
} else if (!$('#pg-overlay-layer-item-open').is(":checked") && !$('#pg-overlay-layer-item-close').is(":checked")) {
SELECT_HEATMAP_OPEN_POI_LAYER.setVisible(false);
SELECT_HEATMAP_CLOSE_POI_LAYER.setVisible(false);
}
map.getView().on('change:resolution', pixelToMeter);
$('#viewVector').removeClass('btn-primary');
$('#viewVector').removeClass('active');
$('#viewHeatmap').addClass('btn-primary');
$('#viewHeatmap').addClass('active');
}
});
$('.dualLegend').append(
'
'
)
});