var intern_line_limit = 3;//인턴노선 운행가능 인원수 var regular_line_limit = 8;//정규노선 운행가능 인원수 //openroute api url var OSM_API_URL = 'https://api.openrouteservice.org/directions'; //openroute api key var OSM_API_KEY = "58d904a497c67e00015b45fc3e2a296cd6af41ef929dfe923626dcc5";// "58d904a497c67e00015b45fc3e2a296cd6af41ef929dfe923626dcc5"; //kakao rest api key var kakao_rest_api_key = "66e3f108b152f01a53739cfb0dca43cb"; // "56e933c6c58f88d9045ba9c60e86229f"; var _VIEW_TYPE = "detail"; var _VIEW_LINE_NO = "218"; //검색어 var _SEARCH_S_TEXT = ""; var _SEARCH_S_LAT = 0; var _SEARCH_S_LNG = 0; var _SEARCH_E_TEXT = ""; var _SEARCH_E_LAT = 0; var _SEARCH_E_LNG = 0; //----js파일호출시 get방식으로 넘어온 파라미터 파싱 : END------// //---(IE호환성 유지 코드)-Dictionary 의 사이즈 체크를 위하여 Object.keys(DIC).length 적용 코드------// // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys if (!Object.keys) { Object.keys = (function () { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ], dontEnumsLength = dontEnums.length; return function (obj) { if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasOwnProperty.call(obj, prop)) { result.push(prop); } } if (hasDontEnumBug) { for (i = 0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj, dontEnums[i])) { result.push(dontEnums[i]); } } } return result; }; }()); } //---(IE호환성 유지 코드)-Dictionary 의 사이즈 체크를 위하여 Object.keys(DIC).length 적용 코드 END ------// //구글에서 사용하는 position(좌표)의 오브젝트를 설정 function setPositionProperty(_lat, _lng) { return { lat: parseFloat(_lat), lng: parseFloat(_lng) }; } /* //poi 키 입력 타이머 var typingTimer; //poi 검색 키 입력 완료 체크 타임 var doneTypingInterval = 200; //time in ms (0.2 seconds) */ //구글 맵 변수 var G_MAP; //초기 줌 레벨 var INIT_ZOOM_LEVEL = 14; //마커 정거장 상세 infowindow var STOP_INFO_WINDOW = null; //광화문 좌표 (검색 결과가 없을 때 보여줄 위치) var DEFAULT_POSITION = setPositionProperty('37.576063', '126.976796'); //길찾기용 샘플 초기 위치 데이터 var TMP_LAT = DEFAULT_POSITION.lat; var TMP_LNG = DEFAULT_POSITION.lng; //autocomplete 자동완성 초기 데이터 var default_start_autocomplete = ["출발지를 입력하세요."]; var default_end_autocomplete = ["도착지를 입력하세요."]; //노선 아이콘 목록 var LINE_STAT_ICON = { D: "/statics/img/rdr/ctn/ic_way_icon_run.png", R: "/statics/img/rdr/ctn/ic_way_11.png", B: "/statics/img/rdr/ctn/ic_way_12.png", Q: "/statics/img/rdr/ctn/ic_way_12.png", C: "/statics/img/rdr/ctn/ic_way_icon_none.png" , E: "/statics/img/rdr/ctn/ic_way_icon_none.png" }; //노선의 상태 var LINE_STAT_TEXT = { D: "운행중", R: "운행예정", B: "모집중", Q: "신설신청" , C: "운행취소", E: "운행종료" }; //노선의 상태 라벨 컬러 var LINE_STAT_LABEL_CLASS = { D: "way_label label_run", R: "way_label label_plan", B: "way_label label_recruit", Q: "way_label label_request2", C: "way_label label_end", E: "way_label label_end" }; var LINE_TAG_INTERN = ' [인턴]'; //길찾기 선 색상 var LINE_COLORS = [ "#1a35bd", "#db4337", "#13b5c7", "#5c50e6", "#166586", "#59c52f", "#147b10", "#302c81", "#9c2fc5", "#6c853b" ]; var LINE_COLOR_COUNT = LINE_COLORS.length; //정거장 아이콘 /* var STOP_ICONS = [ "/statics/img/rdr/ctn/stop_0.png", "/statics/img/rdr/ctn/stop_1.png", "/statics/img/rdr/ctn/stop_2.png", "/statics/img/rdr/ctn/stop_3.png", "/statics/img/rdr/ctn/stop_4.png", "/statics/img/rdr/ctn/stop_5.png", "/statics/img/rdr/ctn/stop_6.png", "/statics/img/rdr/ctn/stop_7.png", "/statics/img/rdr/ctn/stop_8.png", "/statics/img/rdr/ctn/stop_9.png", ]; */ var STOP_ICONS = []; var STOP_START_ICONS = [];// = "/statics/img/rdr/ctn/stop_start.png"; var STOP_END_ICONS = [];// = "/statics/img/rdr/ctn/stop_end.png"; //모집중,준비중 정거장 아이콘 var STOP_DISABLE_ICON = "/statics/img/rdr/ctn/stop_disable.png"; var STOP_DISABLE_START_ICON = "/statics/img/rdr/ctn/stop_disable_start.png"; var STOP_DISABLE_END_ICON = "/statics/img/rdr/ctn/stop_disable_end.png"; var STOP_REQ_ICON = "/statics/img/rdr/ctn/stop_req.png"; var STOP_REQ_START_ICON = "/statics/img/rdr/ctn/stop_req_start.png"; var STOP_REQ_END_ICON = "/statics/img/rdr/ctn/stop_req_end.png"; //미운행/모집중 색상 var LINE_COLOR_GRAY = '#777777'; //모집중 //var LINE_COLOR_REC = '#75c318'; var LINE_COLOR_REC = '#777777'; //운행예정 //var LINE_COLOR_PLAN = '#ffc000'; var LINE_COLOR_PLAN = '#777777'; //길찾기 출발/도착 좌표를 배열로 저장 var SEARCHROAD_START_POS = []; var SEARCHROAD_DEST_POS = []; //길찾기 polyline데이터를 배열로 저장(노선 개수 만큼 증가 함) var SEARCHROAD_POLYLINES = []; //길찾기 결과 데이터를 배열로 저장.(노선 하나의 결과 값을 임시 저장 함) var SEARCHROAD_TMP_DATAS = []; //전체 노선 var LINES_TOTAL = {}; //전체 정거장 정보 var STOPS_TOTAL = []; //노선 mouseover popup infowindow var POPUP_LINE_INFOWINDOW = null; //노선 속성 function line_property() { return { stops: null, //노선에 속한 정거장 데이터(stop_property를 배열로 저장함) idx: null, //배열순번 line_no: null, //노선 line_no line_name: null, //노선 이름 line_type: null, //노선 타입(ex. 출근, 퇴근) 출근 "W", 퇴근 "H" line_staus: null, //노선 상태 - B : 모집중, R : 운행예정, D : 운행중, Q: 신설신청, C: "운행취소", E: "운행종료" line_req_status: null, //회원 노선 신청상태 -> N : 신청안함, M : 모집신청중, D : 노선탑승대기신청중, R : 노선이용중 line_link_code: null, //노선 공유 코드 departure_time: null, //운행 시작 시간 arrive_time: null, //운행 종료 시간 departure_stopName: null, //출발 정거장명 arrive_stopName: null, //도착 정거장명 run_state: null, //운행 상태 run_distance: null, //운행 거리 run_time: null, //운행 시간 route_path: null, //운행 경로 getRoutePath : function() { if(this.route_path==null || this.route_path=="") { return null; } var coordinates = [] if(this.line_status == "Q") { //this.route_path; coordinates = JSON.parse(this.route_path); } else { coordinates = polyline.decode(this.route_path); } cnt = coordinates.length; var arrayLatLng = []; for (var i = 0; i < cnt; i++) { arrayLatLng.push(setPositionProperty(coordinates[i][0], coordinates[i][1])); } return arrayLatLng; }, route_polyline : null, max_seat: null, //최대 탑승인원 수 leave_seat: null, //남은 인원 수 next_month_seat_bal: null, //다음달 남은 좌석수 line_direction: null, //길찾기 경로 line_direction_polyline: null, //지도에 출력할 polyline object line_img: null, //노선 대표 이미지 fee: null, //노선 금액 line_pay_status: null, //노선 결제 상태 line_start_date: null, //노선 운행시작일(yyyyMMdd) fee_regular: null, //노선 금액(정기결제) fee_support: null, //노선 금액(셔틀콕지원금액) current_users: null, //현재 탑승자 수 current_waiting: null, //현재 대기자 수 working_days_whole_month: null, //이달 전체 영업일 working_days_from_today: null, //오늘부터 이후 영업일 car_type: null, //차종-소형버스(25인승) current_month: null, //몇월인지 fee_type: null, //요금 구문(월정액, 일할요금) line_class: null, //노선 등급 req_name: null, //신설신청자 이름 intern_line_limit: 0, //인턴노선 운행가능 수 regular_line_limit: 0 //정규노선 운행가능 수 }; } //정거장 속성 function stop_property() { return { idx: null, //정거장 index(순서) line_no: null, //속한 노선 line_no stop_no: null, //정거장 stop_no stop_headORtail_type: null, //시작,출발,일반 정거장 구분(S: 시작정거장, E: 종료정거장, N: 일반정거장) stop_type: null, //승하차 구분 stop_name: null, //정거장 이름 //inout_type: null, //승하차 구분 position: null, //정거장 위치(위도, 경도) arrive_times: null, //정거장 도착 시간(일,월,화,수,목,금,토) departure_times: null, //정거장 출발 시간(일,월,화,수,목,금,토) stop_img: null, //정거장 대표 이미지(이미지 없는 경우 로드뷰로 호출) marker: null, line_status:null, stop_name_poi:null }; } //지도 초기화 function initMap() { G_MAP = new google.maps.Map(document.getElementById('map'), { center: setPositionProperty(TMP_LAT, TMP_LNG), gestureHandling: 'greedy', zoom: INIT_ZOOM_LEVEL }); for(var i=0; i < 10; i++) { var icon = { url: "/statics/img/rdr/ctn/stop_"+i+".png", // url scaledSize: new google.maps.Size(20, 20), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: null//new google.maps.Point(0, 0) // anchor }; STOP_ICONS.push(icon); STOP_START_ICONS.push({ url: "/statics/img/rdr/ctn/stop_"+i+"_start.png", // url "/statics/img/rdr/ctn/stop_disable.png" scaledSize: new google.maps.Size(20, 20), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: null //new google.maps.Point(0, 0) // anchor }); STOP_END_ICONS.push({ url: "/statics/img/rdr/ctn/stop_"+i+"_end.png", // url "/statics/img/rdr/ctn/stop_disable.png" scaledSize: new google.maps.Size(20, 20), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: null //new google.maps.Point(0, 0) // anchor }); } STOP_DISABLE_ICON = { url: "/statics/img/rdr/ctn/stop_disable.png", scaledSize: new google.maps.Size(20, 20), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: null //new google.maps.Point(0, 0) // anchor }; STOP_DISABLE_START_ICON = { url: "/statics/img/rdr/ctn/stop_disable_start.png", scaledSize: new google.maps.Size(20, 20), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: null //new google.maps.Point(0, 0) // anchor }; STOP_DISABLE_END_ICON = { url: "/statics/img/rdr/ctn/stop_disable_end.png", scaledSize: new google.maps.Size(20, 20), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: null //new google.maps.Point(0, 0) // anchor }; STOP_REQ_ICON = { url: "/statics/img/rdr/ctn/stop_req.png", scaledSize: new google.maps.Size(20, 35), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: new google.maps.Point(10, 35) // anchor }; STOP_REQ_START_ICON = { url: "/statics/img/rdr/ctn/stop_req_start.png", scaledSize: new google.maps.Size(20, 35), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: new google.maps.Point(10, 35) // anchor }; STOP_REQ_END_ICON = { url: "/statics/img/rdr/ctn/stop_req_end.png", scaledSize: new google.maps.Size(20, 35), // scaled size origin: null,//new google.maps.Point(0,0), // origin anchor: new google.maps.Point(10, 35) // anchor }; } //노선 정보 초기화 function initLine(_lineInfo, idx) { var ret_line = new line_property(); ret_line.stop_datas = null; ret_line.idx = idx; ret_line.line_no = _lineInfo.line_no; ret_line.line_name = _lineInfo.line_name; ret_line.line_type = _lineInfo.line_type; ret_line.line_status = _lineInfo.line_status; ret_line.line_req_status = _lineInfo.line_req_status; ret_line.line_link_code = _lineInfo.line_link_code; ret_line.departure_time = _lineInfo.depart_time; ret_line.arrive_time = _lineInfo.arr_time; ret_line.departure_stopName = _lineInfo.depart_name; ret_line.arrive_stopName = _lineInfo.arr_name; ret_line.run_state = _lineInfo.line_status; ret_line.run_distance = _lineInfo.distance; ret_line.run_time = _lineInfo.runtime; ret_line.route_path = _lineInfo.routes; ret_line.route_polyline = null; ret_line.max_seat = _lineInfo.seat; //정원 ret_line.leave_seat = _lineInfo.seat_bal; ret_line.next_month_seat_bal = _lineInfo.next_month_seat_bal; ret_line.line_img = _lineInfo.line_img; ret_line.fee = _lineInfo.fee; ret_line.line_start_date = _lineInfo.line_start_date; ret_line.line_pay_status = _lineInfo.line_pay_status; ret_line.fee_regular = _lineInfo.fee_regular; //노선 금액(정기결제) ret_line.fee_support = _lineInfo.fee_support; //노선 금액(셔틀콕지원금액) ret_line.current_users = _lineInfo.current_users; //현재 탑승자 수 ret_line.current_waiting = _lineInfo.current_waiting; //현재 대기자 수 ret_line.working_days_whole_month = _lineInfo.working_days_whole_month; //이달 전체 영업일 ret_line.working_days_from_today = _lineInfo.working_days_from_today; //오늘부터 이후 영업일 ret_line.car_type = _lineInfo.car_type; //차종-소형버스(25인승) ret_line.current_month = _lineInfo.current_month; ret_line.fee_type = _lineInfo.fee_type; ret_line.line_class = _lineInfo.line_class; ret_line.req_name = _lineInfo.req_name; ret_line.intern_line_limit = _lineInfo.intern_line_limit; ret_line.regular_line_limit = _lineInfo.regular_line_limit; return ret_line; } //정거장 정보 초기화 function initStop(_line, _line_status, _idx, _stop_headORtail_type, _stop_no, _stop_name, _stop_type, _positions, _arrive_time, _departure_time, _stop_img, _enter_schedule,_stop_name_poi) { var ret_stop = new stop_property(); _stop_name_poi = _stop_name_poi.replace("'", "\'").replace('"', '\"') _stop_name = _stop_name.replace("'", "\'").replace('"', '\"'); ret_stop.idx = _idx; ret_stop.line_no = _line.line_no; ret_stop.line_status = _line.line_status; ret_stop.stop_no = _stop_no; ret_stop.stop_headORtail_type = _stop_headORtail_type; ret_stop.stop_type = _stop_type; ret_stop.stop_name = _stop_name; //ret_stop.inout_type = _inout_type; ret_stop.position = _positions; ret_stop.arrive_times = _arrive_time; ret_stop.departure_times = _departure_time; ret_stop.stop_img = _stop_img; ret_stop.enter_schedule = _enter_schedule; ret_stop.marker = initStopMarker(_line, false, _line_status, _stop_type, _positions, _stop_no, _stop_name, _stop_type, _arrive_time, _departure_time,_stop_headORtail_type,_stop_name_poi); //마커 생성 ret_stop.stop_name_poi = _stop_name_poi; return ret_stop; } //infowindow 팝업 디자인 function popup_stopRoadViewInfo(_stop_name, _inout_type, _arrive_time, _departure_time, _lat, _lng) { var _roadView = $("#roadview").load("/rdr/route/daum_roadView.aspx?lat=" + String(_lat) + "&lng=" + String(_lng)); var stopType = ""; if (_inout_type == "0") { stopType = "(하차)"; } else if (_inout_type == "1") { stopType = "(승차)"; } var tmp_title = ""; tmp_title += "
" + _stop_name + " " + stopType + "
"; tmp_title += "
도착 예정시간
"; tmp_title += ""; tmp_title += ""; var t = ""; for (var i = 0; i < _arrive_time.length; i++) { if (_arrive_time[i] == "0000:") { t = "미운행"; } else { t = _arrive_time[i]; } tmp_title += ""; } tmp_title += "
" + t + "
"; tmp_title += "
"; tmp_title += "

"; tmp_title += "
정거장 보기

"; return tmp_title; } //정거장 마커 초기화 //function initStopMarker(arrLINES, bVisible, _line_status, _line.idx, _stop_type, _positions, _stop_no, _stop_name, _inout_type, _arrive_time, _departure_time) { function initStopMarker(_line, bVisible, _line_status, _stop_type, _positions, _stop_no, _stop_name, _inout_type, _arrive_time, _departure_time,_stop_headORtail_type,_stop_name_poi) { var tmp_line_status = ""; if (_line != null) { if (_line.line_status == "R") { tmp_line_status = "[운행예정]"; } else if (_line.line_status == "B") { tmp_line_status = "[모집중]"; } else if (_line.line_status == "D") { tmp_line_status = "";//"[운행중]"; } else if (_line.line_status == "Q") { tmp_line_status = "[신설신청]"; } else if (_line.line_status == "C") { tmp_line_status = "[운행취소]"; }else if (_line.line_status == "E") { tmp_line_status = "[운행종료]"; } } var tmp_title = tmp_line_status; if (_line != null) { tmp_title += _line.line_name + " : "; if( _line_status == "Q") { tmp_title += _stop_name_poi + (_inout_type == 1 ? "(승차지)" : "(하차지)"); } else { tmp_title += _stop_name + (_inout_type == 1 ? "(승차지)" : "(하차지)"); } } else { tmp_title = _stop_name; } //검색한 출발 도착지임 if (_line_status == "") { tmp_title = _stop_name; } //운행중 아닌 노선 정거장 var stop_icon; if (_line != null && _line_status == "D") { //출발/도착 정류장 마커 if(_stop_headORtail_type=="S") { stop_icon = STOP_START_ICONS[_line.idx % STOP_ICONS.length]; } else if(_stop_headORtail_type=="E") { stop_icon = STOP_END_ICONS[_line.idx % STOP_ICONS.length]; } else { stop_icon = STOP_ICONS[_line.idx % STOP_ICONS.length]; } } else if(_line != null && _line_status == "Q") { if(_stop_headORtail_type=="S") { stop_icon = STOP_REQ_START_ICON } else if(_stop_headORtail_type=="E") { stop_icon = STOP_REQ_END_ICON } else { stop_icon = STOP_REQ_ICON; } } else { if(_stop_headORtail_type=="S") { stop_icon = STOP_DISABLE_START_ICON } else if(_stop_headORtail_type=="E") { stop_icon = STOP_DISABLE_END_ICON } else { stop_icon = STOP_DISABLE_ICON; } } //정거장 아이콘을 설정함(시작/종료/일반) //검색시 시작 정거장, 검색시 종료 정거장 if (_stop_type == 3 || _stop_type == 4) { stop_icon = ""; } //마커 선언 var tmp_marker; if (bVisible) { tmp_marker = new google.maps.Marker({ stop_no: _stop_no, position: _positions, map: G_MAP, title: tmp_title, icon: stop_icon }); } else { tmp_marker = new google.maps.Marker({ stop_no: _stop_no, position: _positions, map: null, title: tmp_title, icon: stop_icon }); } //마커 클릭 리스너 if (_line != null && _line.idx >= 0 && _line.line_status!="Q") { //검색한 마커는 이벤트 없음 tmp_marker.addListener('click', function (event) { if (STOP_INFO_WINDOW != null) { STOP_INFO_WINDOW.setMap(null); STOP_INFO_WINDOW = null; $("#roadview").hide(); } var this_lat = this.getPosition().lat(); var this_lng = this.getPosition().lng(); STOP_INFO_WINDOW = new google.maps.InfoWindow({ content: popup_stopRoadViewInfo(_stop_name, _inout_type, _arrive_time, _departure_time, this_lat, this_lng) }); STOP_INFO_WINDOW.open(G_MAP, this); setPositionCenter_for_marker(this_lat, this_lng); }); } return tmp_marker; } //길찾기 선 그리기 옵션 function getSearchRoadPathPolyLineOption(_line) { var _color = LINE_COLOR_GRAY; if (_line.line_status == "D") _color = LINE_COLORS[_line.idx % LINE_COLOR_COUNT]; var ret_polyline = null; if (_line.line_status == "D") { ret_polyline = new google.maps.Polyline({ path: _line.getRoutePath(), geodesic: true, strokeColor: _color, strokeOpacity: 1.0, strokeWeight: 3, clickable: true }); } else if (_line.line_status == "R") { //운행 예정 /* var lineSymbol = { path: 'M 0,-1 0,1', strokeOpacity: 1.0, scale: 5 }; */ ret_polyline = new google.maps.Polyline({ path: _line.getRoutePath(), geodesic: true, strokeColor: LINE_COLOR_PLAN, strokeOpacity: 1.0, strokeWeight: 3, clickable: true /*, icons: [{ icon: lineSymbol, offset: '0', repeat: '20px' }] */ }); } else { var lineSymbol = { path: 'M 0,-1 0,1', strokeOpacity: 1.0, strokeWeight: 3, scale: 4 }; ret_polyline = new google.maps.Polyline({ path: _line.getRoutePath(), geodesic: true, strokeColor: LINE_COLOR_REC, strokeOpacity: 0, clickable: true, icons: [{ icon: lineSymbol, offset: '0', repeat: '20px' }] }); } var infoWinCon = _line.line_name; if (_line.line_status == "R") { infoWinCon = "[운행예정] " + infoWinCon; } else if (_line.line_status == "B") { infoWinCon = "[모집중] " + infoWinCon; } else if (_line.line_status == "D") { infoWinCon = _line.line_name;//"[운행중] " + infoWinCon; } else if (_line.line_status == "Q") { infoWinCon = "[신설신청] " + infoWinCon; } else if (_line.line_status == "C") { infoWinCon = "[운행취소] " + infoWinCon; } else if (_line.line_status == "E") { infoWinCon = "[운행종료] " + infoWinCon; } ret_polyline.addListener('mouseover', function (event) { if (POPUP_LINE_INFOWINDOW == null) { POPUP_LINE_INFOWINDOW = new google.maps.InfoWindow({ content: infoWinCon }); POPUP_LINE_INFOWINDOW.open(G_MAP); POPUP_LINE_INFOWINDOW.setPosition(event.latLng); } }); ret_polyline.addListener('mouseout', function () { POPUP_LINE_INFOWINDOW.close(); POPUP_LINE_INFOWINDOW = null; }); ret_polyline.addListener('click', function (event) { view_lineTotalStateDetail(_line.line_no); }); return ret_polyline; } //해당 위도/경도 기준으로 화면의 중심을 맞춤 function setPositionCenter_for_marker(_lat, _lng) { G_MAP.panTo(setPositionProperty(_lat, _lng)); G_MAP.setZoom(INIT_ZOOM_LEVEL); } function setPositionCeterForTotalStopWithLineNo(line_status,line_no, stopIdx) { if(line_status=="Q") { G_MAP.setCenter(LINES_TOTAL[line_no].stops[stopIdx].marker.position ); } else { google.maps.event.trigger(LINES_TOTAL[line_no].stops[stopIdx].marker, 'click'); } } //전체 노선중 특정 정거장만 그리기 /* function renderStopsMarker(line_no) { var start_lat = 0; var start_lng = 0; var end_lat = 999999; var end_lng = 999999; var stopLen = LINES_TOTAL[line_no].stops.length; for (var j = 0; j < stopLen; j++) { if (start_lat <= LINES_TOTAL[line_no].stops[j].position.lat) { start_lat = LINES_TOTAL[line_no].stops[j].position.lat } if (start_lng <= LINES_TOTAL[line_no].stops[j].position.lng) { start_lng = LINES_TOTAL[line_no].stops[j].position.lng } if (end_lat >= LINES_TOTAL[line_no].stops[j].position.lat) { end_lat = LINES_TOTAL[line_no].stops[j].position.lat } if (end_lng >= LINES_TOTAL[line_no].stops[j].position.lng) { end_lng = LINES_TOTAL[line_no].stops[j].position.lng } LINES_TOTAL[line_no].stops[j].marker.setMap(G_MAP); } if (start_lat != 0 && start_lng != 0 && end_lat != 999999 && end_lng != 999999) { setFitMap_fromAllPositions(start_lat, start_lng, end_lat, end_lng); } } //전체 노선 중 특정 노선 경로 그리기 function renderRoutePolyLineWithIndex(line_no) { if (LINES_TOTAL[line_no].getRoutePath() != null ) { var lineColor = LINE_COLOR_GRAY; if (LINES_TOTAL[line_no].line_status == "D") lineColor = LINE_COLORS[LINES_TOTAL[line_no].idx % LINE_COLOR_COUNT]; if (LINES_TOTAL[line_no].route_polyline == null || LINES_TOTAL[line_no].route_polyline == "") LINES_TOTAL[line_no].route_polyline = getSearchRoadPathPolyLineOption(false, lineColor, LINES_TOTAL[line_no].getRoutePath(), LINES_TOTAL[line_no].line_no, LINES_TOTAL[line_no].line_name, LINES_TOTAL[line_no].line_status); LINES_TOTAL[line_no].route_polyline.setMap(G_MAP); } else { //console.log("index : " + LINES_TOTAL[i].line_no + "(" + LINES_TOTAL[i].line_name + ") 라인에 번째 경로를 찾지 못하였습니다. (전체 노선)"); } }*/ //전체 노선 목록의 노선 경로 그리기 function renderAllRoutePolyLines() { for (var key in LINES_TOTAL) { var _line = LINES_TOTAL[key]; if (_line != null && _line.getRoutePath() != null) { if (_line.route_polyline == null || _line.route_polyline == "") _line.route_polyline = getSearchRoadPathPolyLineOption(_line); if(_line.line_status=="Q") continue; //신설신청 노선을 표시 안함 _line.route_polyline.setMap(G_MAP); } else { //console.log("index : " + LINES_TOTAL[i].line_no + "(" + LINES_TOTAL[i].line_name + ") 라인에 번째 경로를 찾지 못하였습니다. (전체 노선)"); } } } //전체 정거장 그리기 function renderAllStopMarkers(isFitBound) { var start_lat = 0; var start_lng = 0; var end_lat = 999999; var end_lng = 999999; var len = STOPS_TOTAL.length; for (var i = 0; i < len; i++) { if(STOPS_TOTAL[i].line_status=="Q") continue; //신설신청 노선을 표시 안함 STOPS_TOTAL[i].marker.setMap(G_MAP); if (start_lat <= STOPS_TOTAL[i].position.lat) { start_lat = STOPS_TOTAL[i].position.lat } if (start_lng <= STOPS_TOTAL[i].position.lng) { start_lng = STOPS_TOTAL[i].position.lng } if (end_lat >= STOPS_TOTAL[i].position.lat) { end_lat = STOPS_TOTAL[i].position.lat } if (end_lng >= STOPS_TOTAL[i].position.lng) { end_lng = STOPS_TOTAL[i].position.lng } } if (isFitBound && (start_lat != 0 && start_lng != 0 && end_lat != 999999 && end_lng != 999999)) { setFitMap_fromAllPositions(start_lat, start_lng, end_lat, end_lng); } } function removeAllStopMarkers() { var len = STOPS_TOTAL.length; for (var i = 0; i < len; i++) { STOPS_TOTAL[i].marker.setMap(null); if (STOPS_TOTAL[i].route_polyline != null && STOPS_TOTAL[i].route_polyline != "") { STOPS_TOTAL[i].route_polyline.setMap(null); } } } //주어진 좌표를 모두 보이게 지도의 중점과 크기를 조정함 function setFitMap_fromAllPositions(startLat, startLng, endLat, endLng) { var bounds = new google.maps.LatLngBounds(); if (startLat != "" && startLng != "" && endLat != "" && endLng != "") { bounds.extend(setPositionProperty(startLat, startLng)); bounds.extend(setPositionProperty(endLat, endLng)); G_MAP.fitBounds(bounds); } } //전체 노선을 모두 보이게 지도의 중점과 크기를 조정 function setFitMapForAllRoutes() { var start_lat = 0; var start_lng = 0; var end_lat = 999999; var end_lng = 999999; var len = STOPS_TOTAL.length; if (len > 0) { for (var i = 0; i < len; i++) { if (start_lat <= STOPS_TOTAL[i].position.lat) { start_lat = STOPS_TOTAL[i].position.lat } if (start_lng <= STOPS_TOTAL[i].position.lng) { start_lng = STOPS_TOTAL[i].position.lng } if (end_lat >= STOPS_TOTAL[i].position.lat) { end_lat = STOPS_TOTAL[i].position.lat } if (end_lng >= STOPS_TOTAL[i].position.lng) { end_lng = STOPS_TOTAL[i].position.lng } } } if (start_lat != 0 && start_lng != 0 && end_lat != 999999 && end_lng != 999999) { setFitMap_fromAllPositions(start_lat, start_lng, end_lat, end_lng); } } //전체노선보기 목록 초기화 function LeftGridBinding(_list_obj, _line) { //var background_color = " style='background-color:" + LINE_COLORS[_i % LINE_COLOR_COUNT] + ";'"; var line_icon = LINE_STAT_ICON[String(_line.line_status)]; var line_text = LINE_STAT_TEXT[String(_line.line_status)]; var line_color = LINE_STAT_LABEL_CLASS[String(_line.line_status)]; //노선의 상태가 운행중이 아닌경우에는 회색으로 처리 //if (_line.run_state == "D") { // background_color = " style='background-color:" + LINE_COLOR_GRAY + ";'"; //} var line_tag = ""; /* if (_line.current_users < _line.regular_line_limit) { //인턴노선 line_tag = LINE_TAG_INTERN; }*/ if (_line.line_class=="intern")// || _line.line_class=="ready") { line_tag = LINE_TAG_INTERN; } var intern_tag = ""; /* if (String(_line.line_status) == "B" && _line.current_users < _line.intern_line_limit) { //모집중...인턴노선 운행가능 인원수 intern_tag = " 운행시작 " + (_line.intern_line_limit - _line.current_users) + "명 전!"; }*/ if ( _line.line_class=="ready") { if((_line.intern_line_limit - _line.current_users) <= 0) { intern_tag = " 신청:" + _line.current_users + "명"; } else { intern_tag = " 운행시작 " + (_line.intern_line_limit - _line.current_users) + "명 전!"; } } if ( _line.line_class=="req") { intern_tag = " 함께하기 " + (_line.current_users) + "명"; } if (_line.line_status == "E" || _line.line_status == "C") { intern_tag = ""; } var tmp_html = ""; tmp_html += "
  • "; tmp_html += "

    " + _line.line_name + line_tag + "" + line_text + "

    "; //tmp_html += "

    " + _line.line_name + "" + line_text + "

    "; tmp_html += "
    "; tmp_html += "
    "; tmp_html += "
    "; tmp_html += "

    " + _line.departure_stopName +(_line.departure_time > 0 ? "(" + Time_Format(_line.departure_time) + ")" : "")+ intern_tag + "

    "; tmp_html += "

    " + _line.arrive_stopName + (_line.arrive_time > 0 ? "(" + Time_Format(_line.arrive_time) + ")" : "") + "

    "; tmp_html += " "; tmp_html += "
    "; tmp_html += "
    "; tmp_html += "
  • "; _list_obj.append(tmp_html); //$(".ways_wrap.total_list ul").append(tmp_html); } //모든 노선궤적 삭제 function removeAllStopsAndRoutePolyLine() { for (var key in LINES_TOTAL) { if (LINES_TOTAL[key].route_polyline != null && LINES_TOTAL[key].route_polyline != "") { LINES_TOTAL[key].route_polyline.setMap(null); } var stopLen = LINES_TOTAL[key].stops.length; for (var j = 0; j < stopLen; j++) { LINES_TOTAL[key].stops[j].marker.setMap(null); } } } //로드뷰 객체 생성 function setRoadview(_lat, _lng) { $("#roadview_render_at_popup").load("/rdr/route/daum_roadView.aspx?lat=" + _lat + "&lng=" + _lng); setPositionCenter_for_marker(parseFloat(_lat + 0.015), _lng); } /////////////////////////////////////////// // /////////////////////////////////////////// function view_lineTotalStateDetail(line_no) { viewLineDetail(true, LINES_TOTAL[line_no],false); } /* function view_lineTotalStateDetailFromLink(line_no) { viewLineDetail(false, LINES_TOTAL[line_no],false); }*/ //노선 정보 가지고 와서 상세 정보 표시 function viewLineDetailFromAjax(bViewBack,line_no) { $('#loading').show(); var params = { "r_line_no": line_no}; $.ajax({ url: "/api/getlinelist.aspx", type: "POST", contentType: "application/x-www-form-urlencoded", data: params, /*async: false,로딩이 안보임..*/ error: function (error) { }, success: function (data) { if(data.lines.length == 0) return; //결과 없음 tmp_stops = data.lines[0].stops; tmp_stop_cnt = tmp_stops.length; var tmp_line = data.lines[0]; /* if(tmp_line.line_status=="Q") //신설신청인 경우... { var tmp_routes = []; if (tmp_line.routes != "") { var t_p_arr = JSON.parse(tmp_line.routes); var tmp_p_cnt = t_p_arr.length; for (var p = 0; p < tmp_p_cnt; p++) { tmp_routes.push(setPositionProperty(t_p_arr[p][1], t_p_arr[p][0])); } } tmp_line.routes = tmp_routes; }*/ //노선정보생성 var lineInfo = initLine(tmp_line, 0); if (lineInfo.getRoutePath() != null) lineInfo.route_polyline = getSearchRoadPathPolyLineOption(lineInfo); for (var j = 0; j < tmp_stop_cnt; j++) { var tmp_headORtail_type = null; //첫 정거장 및 마지막 정거장 판별 if (j == 0) { tmp_headORtail_type = "S"; } else if (j == tmp_stop_cnt - 1) { tmp_headORtail_type = "E"; } else { tmp_headORtail_type = "N"; } tmp_stops[j].stop_headORtail_type = tmp_headORtail_type; tmp_stops[j] = initStop(lineInfo, tmp_line.line_status, j, tmp_headORtail_type, tmp_stops[j].stop_no, tmp_stops[j].stop_name, tmp_stops[j].stop_type, setPositionProperty(tmp_stops[j].y, tmp_stops[j].x), tmp_stops[j].enter_times, tmp_stops[j].left_times, tmp_stops[j].stop_img, tmp_stops[j].enter_schedule,tmp_stops[j].stop_name_poi); } lineInfo.stops = tmp_stops; viewLineDetail(true, lineInfo,true); }, complete: function () { $('#loading').hide(); } }); } //노선상세보기 공통 function viewLineDetail(bViewBack, _LINE, is_not_preload_line) { if (_LINE == null) return; //var background_color = " style='background-color:" + LINE_COLORS[_i % LINE_COLOR_COUNT] + ";'"; var line_icon = LINE_STAT_ICON[String(_LINE.line_status)]; var line_text = LINE_STAT_TEXT[String(_LINE.line_status)]; var line_color = LINE_STAT_LABEL_CLASS[String(_LINE.line_status)]; $("#search_road_area").hide(); $("#search_road_area_result").hide(); $("#search_road_area_noResult").hide(); $("#all_ways_list").hide(); var tmp_html = ''; /**뒤로가기 할때 '_LINE'의 정류장정보(지도표시)를 삭제할 필요 있음**/ if (bViewBack) { tmp_html += '
    '; tmp_html += ' Back'; tmp_html += '
    '; } var fee_whole_month = Number(_LINE.fee);// * Number(_LINE.working_days_whole_month); //당월 탑승금액 var fee_support_whole_month = Number(_LINE.fee_support);// * Number(_LINE.working_days_whole_month); //당월 셔틀콕 지원금액 var fee_from_today = (Number(_LINE.fee) / Number(_LINE.working_days_whole_month)) * Number(_LINE.working_days_from_today); //당월 탑승금액 오늘부터 잔여일만큼 var line_tag = ""; //-----부가세 제외------// fee_whole_month = Math.floor((fee_whole_month / 1.1).toFixed(1)); fee_support_whole_month = Math.floor((fee_support_whole_month / 1.1).toFixed(1)); fee_from_today = Math.floor((fee_from_today / 1.1).toFixed(1)); /* if (_LINE.current_users < _line.regular_line_limit) { //인턴노선 line_tag = LINE_TAG_INTERN; }*/ if (_LINE.line_class=="intern" || _LINE.line_class=="ready") { line_tag = LINE_TAG_INTERN; } tmp_html += '
    '; tmp_html += '

    ' + _LINE.line_name + line_tag + '' + line_text + '

    '; tmp_html += '
    '; tmp_html += '
    '; tmp_html += '
    '; tmp_html += '

    ' + _LINE.departure_stopName +(_LINE.departure_time > 0 ? "(" + Time_Format(_LINE.departure_time) + ")" : "")+ '

    '; tmp_html += '

    ' + _LINE.arrive_stopName +(_LINE.arrive_time > 0 ? "(" + Time_Format(_LINE.arrive_time) + ")" : "")+ '

    '; //tmp_html += '

    출발:' + Time_Format(_LINE.departure_time) + "-도착:" + Time_Format(_LINE.arrive_time) + '

    '; var prefix_fee = (_LINE.fee_type == "MONTH" ? "월" : "일"); if(_LINE.line_status!="Q") //신설신청 이외 { if (Number(_LINE.fee_support) > 0) { //지원금 있는 경 var support_per = Math.ceil((fee_support_whole_month / (fee_whole_month + fee_support_whole_month)) * 100); //지원금 비율 tmp_html += '

    ' + prefix_fee + ' 편도 탑승금액(VAT별도) : ' + Number_Format(fee_whole_month + fee_support_whole_month) + '원

    '; tmp_html += '

    노선 지원금액 : -' + Number_Format(fee_support_whole_month) + '원(' + support_per + '% 지원)

    '; tmp_html += '

    실 결제금액(VAT별도) : ' + Number_Format(fee_whole_month) + '원
    '; } else { tmp_html += '

    ' + prefix_fee + ' 편도 탑승금액(VAT별도) : ' + (fee_whole_month > 0 ? Number_Format(fee_whole_month) + '원' : '무료') + '
    '; } if(_LINE.line_no <=30 && fee_whole_month > 0) //무료노선의 경우 표시 내용 최소화 { // tmp_html += ' 탑승요금 기준

    '; //tmp_html += '

    *' + Number(_LINE.current_month) + '월 총운행 일수(주말/휴일 제외) : ' + Number(_LINE.working_days_whole_month) + '일

    '; //tmp_html += '

    '+prefix_fee+' 편도 탑승금액 : ' + _LINE.fee + '원

    '; //tmp_html += '

    잔여좌석 : ' + _LINE.leave_seat + '

    '; tmp_html += '

    '; if (_LINE.current_users >= _LINE.max_seat) { //정원초과인 경우 대기신청 tmp_html += '*잔여좌석이 없으므로 탑승대기 신청만 가능하며,익월 잔여좌석 발생 시 탑승가능 합니다.
    *탑승요금은 월 단위 결제 후 이용가능합니다.'; } else { tmp_html += '*탑승요금은 월 단위 결제 후 이용가능합니다.'; } if (_LINE.line_class=="intern" || _LINE.line_class=="ready") { tmp_html += '
    *인턴노선은 운행시작 후 1개월 내 정규노선(탑승자 '+_LINE.regular_line_limit+'명)으로 승진하지 못하는 경우 운행이 종료됩니다.'; } tmp_html += '

    '; } } else { tmp_html += '

    '; tmp_html += '*예상탑승요금:1회 5,400원(VAT별도)
    '; // [이용요금 자세히 보기]
    '; tmp_html += '*탑승요금은 월 단위 결제 후 이용가능합니다.

    '; } tmp_html += '
    '; tmp_html += '
    '; tmp_html += '
    '; tmp_html += '
    '; tmp_html += '
    '; if(_LINE.line_status=="Q") //신설신청 { tmp_html += ' '; } else { tmp_html += ' '; /* tmp_html += ' '; */ } tmp_html += '
    '; //if (String(_LINE.line_status) == "B" && _LINE.current_users < _LINE.intern_line_limit) { //인턴노선 운행가능 인원수 if (_LINE.line_class=="ready") { tmp_html += '
    '; tmp_html += '

    셔틀콕은 단 ' + _LINE.intern_line_limit + '명만 모여도 출발합니다.'; tmp_html += '

    앞으로 ' + (_LINE.intern_line_limit - _LINE.current_users) + '명 더 신청하면 운행이 시작됩니다.

    '; tmp_html += '
    '; } //else if (_LINE.current_users >= _LINE.intern_line_limit && _LINE.current_users < _LINE.regular_line_limit) { //정규노선 전환가능 인원수 else if (_LINE.line_class=="intern") { //정규노선 전환가능 인원수 tmp_html += '
    '; tmp_html += '

    앞으로 ' + (_LINE.regular_line_limit - _LINE.current_users) + '명 더 신청 시 정규노선으로 승진합니다

    '; tmp_html += '

    주변분들에게 나의 노선을 공유해주세요!

    '; tmp_html += '
    '; } else if (_LINE.line_class=="req"){ //신설신청 tmp_html += '
    '; tmp_html += '

    ""함께하기"에 참가하신분들이 많아 지면
    보다 빨리 노선이 생성됩니다."

    '; tmp_html += '

    주변분들에게 나의 노선을 공유해주세요!

    '; tmp_html += '
    '; } else { tmp_html += '
    '; tmp_html += '

    탑승자수가 많아 지면 탑승요금은 내려갑니다

    '; tmp_html += '

    주변분들에게 나의 노선을 공유해주세요!

    '; tmp_html += '
    '; } tmp_html += '
    '; tmp_html += ' '; tmp_html += ' '; tmp_html += ' '; tmp_html += ' '; tmp_html += ' '; tmp_html += '
    '; //----탑승신청 버튼 ---// if(_LINE.line_status=="Q") //신설신청 { tmp_html += ' '; } else if (_LINE.line_status == "E") { tmp_html += ' '; } else if (_LINE.line_status == "C") { tmp_html += ' '; } else { // D: "운행중", R: "운행예정", B: "모집중" , C: "운행취소" , E: "운행종료" if (_LINE.current_users < _LINE.max_seat) { tmp_html += ' '; } else { //정원초과인 경우 대기신청 tmp_html += ' '; } } //----탑승신청 버튼 END---// tmp_html += '
    '; //tmp_html += ''; //tmp_html += ''; var tmp_stops_cnt = _LINE.stops.length; if (tmp_stops_cnt > 0) { if(_LINE.line_status=="Q") //신설신청 { tmp_html += '

    함께 신청한 정거장

    '; } else { tmp_html += '

    전체 정거장

    '; } tmp_html += '
    '; if (_LINE.line_status == "D") { tmp_html += '

    현재 정거장은 변경될 수 있습니다.

    '; } else if(_LINE.line_status=="Q") //신설신청 { tmp_html += '

    신청하신 위치는 노선 생성 시 참고됩니다.

    '; } else { tmp_html += '

    현재 정거장은 운행 확정 시 변경이 될 수 있습니다.

    '; } tmp_html += ' '; } tmp_html += '
    '; //tmp_html += ''; //if (bViewBack) { if(is_not_preload_line) //미리 로딩되지 않은 노선을 표시하는 경우... { //모두 지우고 지정된 노선정보의 노선만 따로 그림 removeAllStopsAndRoutePolyLine(); ShowLineAndStopJustOneLineInDetail(_LINE); } else { //지정된 노선이외의 노선은 안보임 ShowHideLineAndStop(false,_LINE.line_no); } //} $("#line_detail").html(tmp_html); $("#line_detail").show(); } /////////////////////////////////////////// // /////////////////////////////////////////// //노선 전체 목록 중에 첫 번째 노선의 첫 정거장으로 이동 하도록 함. function setCenterPositionRendered() { if (Object.keys(LINES_TOTAL).length > 0 && LINES_TOTAL[0].stops.length > 0) { DEFAULT_POSITION = LINES_TOTAL[0].stops[0].position; } G_MAP.setCenter(DEFAULT_POSITION); } //특정 노선의 첫번째 정거장으로 이동 function setPositionRenderedWithIndex(line_no) { if (Object.keys(LINES_TOTAL).length > 0 && LINES_TOTAL[line_no].stops.length > 0) { DEFAULT_POSITION = LINES_TOTAL[line_no].stops[0].position; } G_MAP.setCenter(DEFAULT_POSITION); } //전체 노선 목록 초기화 function initLineTotal() { //전역변수 초기화 LINES_TOTAL = null; STOPS_TOTAL = null; LINES_TOTAL = {}; STOPS_TOTAL = []; $('#loading').show(); $.ajax({ url: "/api/getlinelist.aspx", type: "POST", contentType: "application/x-www-form-urlencoded", error: function (error) { }, success: function (data) { //노선정보 및 정거장 정보 배열 초기화 var test_line_no_count = data.line_cnt; var tmp_stop_cnt = null; var tmp_stops = new Array(); for (var i = 0; i < test_line_no_count; i++) { tmp_stops = data.lines[i].stops; tmp_stop_cnt = tmp_stops.length; var tmp_line = data.lines[i]; /* var tmp_routes = []; if (tmp_line.routes != "") { var t_p_arr = JSON.parse(tmp_line.routes); var tmp_p_cnt = t_p_arr.length; for (var p = 0; p < tmp_p_cnt; p++) { tmp_routes.push(setPositionProperty(t_p_arr[p][1], t_p_arr[p][0])); } } tmp_line.routes = tmp_routes; */ //노선정보생성 var lineInfo = initLine(tmp_line, i); LINES_TOTAL[tmp_line.line_no] = lineInfo; for (var j = 0; j < tmp_stop_cnt; j++) { var tmp_headORtail_type = null; //첫 정거장 및 마지막 정거장 판별 if (j == 0) { tmp_headORtail_type = "S"; } else if (j == tmp_stop_cnt - 1) { tmp_headORtail_type = "E"; } else { tmp_headORtail_type = "N"; } tmp_stops[j].stop_headORtail_type = tmp_headORtail_type; tmp_stops[j] = initStop(lineInfo, tmp_line.line_status, j, tmp_headORtail_type, tmp_stops[j].stop_no, tmp_stops[j].stop_name, tmp_stops[j].stop_type, setPositionProperty(tmp_stops[j].y, tmp_stops[j].x), tmp_stops[j].enter_times, tmp_stops[j].left_times, tmp_stops[j].stop_img, tmp_stops[j].enter_schedule,tmp_stops[j].stop_name_poi); STOPS_TOTAL.push(tmp_stops[j]); } lineInfo.stops = tmp_stops; //LINES_TOTAL[i].stops = save_stop_arr; //좌측 목록에 html표시 LeftGridBinding($(".ways_wrap.total_list ul"), lineInfo); tmp_stops = null; tmp_stops = new Array(); } }, complete: function () { //검색결과가 없는경우 if (Object.keys(LINES_TOTAL).length <= 0) { G_MAP.setCenter(DEFAULT_POSITION); //alert("운행 중인 노선이 없습니다."); $('#loading').hide(); return; } //노선 궤적 렌더링.. renderAllRoutePolyLines(); //전체 정류장 표시 renderAllStopMarkers(true); //전체 노선을 전체 화면에 맞춰 보여주도록 함. //사용안함(정류장표시에서 처리) setFitMapForAllRoutes(); if (_VIEW_TYPE == "detail" && _VIEW_LINE_NO!="" && _VIEW_LINE_NO!="0" && _VIEW_LINE_NO != 0){//_VIEW_LINE_NO > 0) { //노선상세 정보 화면 출력 if( LINES_TOTAL[_VIEW_LINE_NO]) { viewLineDetail(true, LINES_TOTAL[_VIEW_LINE_NO],false); } else { viewLineDetailFromAjax(true,_VIEW_LINE_NO); } //한번만 실행 후 초기화 _VIEW_TYPE = ""; _VIEW_LINE_NO = "0"; } else if (_VIEW_TYPE == "all") { $(".slide_open#all_tog").trigger("click"); _VIEW_TYPE = ""; } else if (_VIEW_TYPE == "search") { //검색지점 마커표시 var start_stop = $("#start").val(); var end_stop = $("#end").val(); var s_position = {lat: Number($("#start_lat").val()), lng: Number($("#start_lng").val())}; var e_position = {lat: Number($("#end_lat").val()), lng: Number($("#end_lng").val())}; if (start_lat == 0 && start_lng == 0 && end_lat == 0 && end_lng == 0) { $('#loading').hide(); return; } setPoiMarker(true,start_stop,s_position); setPoiMarker(false,end_stop,e_position); search_route_btn(); _VIEW_TYPE = ""; } $('#loading').hide(); } }); } //----------------------POI 검색----------------------// /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// //////////////////////// 노선신청 (poi 관련) ////////////////////// /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// var INPUT_KEYWORD_TYPE = null; //출발지/목적지 를 검색 했는지 구분함. var START_AUTOCOMPLETE_DATAS = []; var END_AUTOCOMPLETE_DATAS = []; var POI_START_STOP_MARKER = null; //선택한 출발지 marker(저장/검색 할 대상) var POI_END_STOP_MARKER = null; //선택한 목적지 marker(저장/검색 할 대상) //두 점을 기준으로 카메라 중점 맞추기 function setFitMap_fromPositions() { var start_lat = Number($(".start_lat#start_lat").val()); var start_lng = Number($(".start_lng#start_lng").val()); var end_lat = Number($(".end_lat#end_lat").val()); var end_lng = Number($(".end_lng#end_lng").val()); var bounds = new google.maps.LatLngBounds(); if (start_lat != 0 && start_lng != 0) { bounds.extend(setPositionProperty(start_lat, start_lng)); } if (end_lat !=0 && end_lng != 0) { bounds.extend(setPositionProperty(end_lat, end_lng)); } if((start_lat != 0 && start_lng != 0) && (end_lat !=0 && end_lng != 0) ){ G_MAP.fitBounds(bounds); } } //POI검색을 위한 이벤트 등록 function initPOISearchService() { var keyword; //출발지 검색에서 keyup 이벤트 발생 실행 $("#start").keyup(function (event) { //if (event.which == 37 || event.which == 38 || event.which == 39 || event.which == 40) { if (event.which == 38 || event.which == 40) { //$("#start").trigger(jQuery.Event('keydown', { which: $.ui.keyCode.RIGHT })); } else { INPUT_KEYWORD_TYPE = "start"; keyword = $("#start").val(); if (keyword.replace(/^\s+|\s+$/g, '')) { poi_search(keyword); } else //공백인 경우 검색결과 지움 { initSearchValuesAndMarker(true); } } }); //출발지 검색에서 keyup 이벤트 발생 실행 $("#end").keyup(function (event) { if (event.which == 37 || event.which == 38 || event.which == 39 || event.which == 40) { //$("#start").trigger(jQuery.Event('keydown', { which: $.ui.keyCode.RIGHT })); } else { INPUT_KEYWORD_TYPE = "end"; keyword = $("#end").val(); if (keyword.replace(/^\s+|\s+$/g, '')) { poi_search(keyword); } else { initSearchValuesAndMarker(false); } } }); } function setPoiMarker(is_start,name,position) { if(is_start) { //출발지 if (POI_START_STOP_MARKER != null) { POI_START_STOP_MARKER.setMap(null); POI_START_STOP_MARKER = null; } //검색위치(출발지) 마커 표시 POI_START_STOP_MARKER = initStopMarker(null, true, "S", 3, position, "-999", name, "", "", "",null,name); } else //도착지 { if (POI_END_STOP_MARKER != null) { POI_END_STOP_MARKER.setMap(null); POI_END_STOP_MARKER = null; } //검색위치(도착지) 마커 표시 POI_END_STOP_MARKER = initStopMarker(null, true, "E", 4, position, "-999", name, "", "", "",null,name); } } //목적지 검색 autocomplete항목 초기화 function init_searchAutocomplete() { $("#start").autocomplete({ source: default_start_autocomplete, autoFocus: true, focus: function (event, ui) { event.preventDefault(); if (G_MAP != undefined) { setPoiMarker(true,ui.item.label, ui.item.position); G_MAP.setCenter(ui.item.position); G_MAP.setZoom(INIT_ZOOM_LEVEL + 2) } $("#start_lat").val(ui.item.position.lat); $("#start_lng").val(ui.item.position.lng); $("#sAddr").val(ui.item.address); }, select: function (event, ui) { //console.log("select 여러번됨..."); $("#start").autocomplete('option', 'source', default_start_autocomplete); $("#start").autocomplete("close"); $("#end").focus(); }, close: function (event, ui) { } }); $(".end#end").autocomplete({ source: default_end_autocomplete, autoFocus: true, focus: function (event, ui) { event.preventDefault(); if (G_MAP != undefined) { setPoiMarker(false,ui.item.label, ui.item.position); G_MAP.setCenter(ui.item.position); G_MAP.setZoom(INIT_ZOOM_LEVEL + 2) } $("#end_lat").val(ui.item.position.lat); $("#end_lng").val(ui.item.position.lng); $("#eAddr").val(ui.item.address); }, select: function (event, ui) { //console.log("select 여러번됨..."); $(".end#end").autocomplete('option', 'source', default_end_autocomplete); $(".end#end").autocomplete("close"); }, close: function (event, ui) { } }); } // 장소 검색 객체를 생성합니다 function poi_search(keyword) { $.ajax({ url: "https://dapi.kakao.com/v2/local/search/keyword.json?query=" + encodeURI(keyword), type: "POST", contentType: "application/x-www-form-urlencoded", /*async: false,로딩이 안보임..*/ beforeSend: function (request) { request.setRequestHeader("Authorization", "KakaoAK " + kakao_rest_api_key); }, error: function (error) { }, success: function (data, status) { console.log(data); placesSearchCB(data, status, keyword); }, complete: function () { //alert("complete!"); } }); } //검색결과 목록 출력 및 마커 출력을 합니다. function displayPlacesList(places, keyword) { places = places.documents; START_AUTOCOMPLETE_DATAS = []; END_AUTOCOMPLETE_DATAS = []; var tmp_place_cnt = places.length; for (var i = 0; i < tmp_place_cnt; i++) { var tmp_stop_type = null; //명칭에 키워드와 동일한 항목이 없으면 등록하지 않음. //카테고리 분류 코드가 존재 하지 않을 경우에도 등록하지 않음. //if (places[i].place_name.includes(keyword) == true && places[i].category_group_code != "") { var place_name = places[i].place_name + " (" + places[i].address_name + ")"; var short_addr = makeShortAddr(places[i].address_name); place_name = place_name.cut(40); if (INPUT_KEYWORD_TYPE == "start") { tmp_stop_type = "S"; START_AUTOCOMPLETE_DATAS.push({ label: place_name, value: places[i].place_name, address: short_addr, position: setPositionProperty(places[i].y, places[i].x) }); } else { tmp_stop_type = "E"; END_AUTOCOMPLETE_DATAS.push({ label: place_name, value: places[i].place_name, address: short_addr, position: setPositionProperty(places[i].y, places[i].x) }); } } } function makeShortAddr(addr) { //"address_name": "서울 강남구 삼성동 159", var arrAddr = addr.split(" "); if(arrAddr[0].indexOf("서울")==0) //서울-구/동 (서초구 방배동) { /* var ReN = /구|동$/; if (arrAddr[1].match(ReN)) { arrAddr[1] = arrAddr[1].replace(ReN, ""); } if (arrAddr[2].match(ReN)) { arrAddr[2] = arrAddr[2].replace(ReN, ""); }*/ return arrAddr[1] + " " + arrAddr[2]; }//광역시(부산, 대구, 인천, 광주, 대전, 울산) - 시/구(인천 남동구) else if(arrAddr[0].indexOf("인천")==0 || arrAddr[0].indexOf("부산")==0 || arrAddr[0].indexOf("대구")==0 || arrAddr[0].indexOf("대전")==0 || arrAddr[0].indexOf("광주")==0 || arrAddr[0].indexOf("울산")==0) { return arrAddr[0] + " " + arrAddr[1]; } else //도 단위 - 경기 화성시 안영동 { return arrAddr[1] + " " + arrAddr[2]; } } // 장소검색이 완료됐을 때 호출되는 콜백함수 입니다 function placesSearchCB(data, status, keyword) { if (status === "success") { // 정상적으로 검색이 완료됐으면 검색 목록데이터를 생성합니다. displayPlacesList(data, keyword); if (INPUT_KEYWORD_TYPE == "start") { //자동완성 데이터 추가 $(".start#start").autocomplete('option', 'source', START_AUTOCOMPLETE_DATAS); $(".start#start").autocomplete({ source: function (request, response) { response(START_AUTOCOMPLETE_DATAS); //키보드 위/아래 변경시 목록이 갱신되는 현상 수정 } }); } else { //자동완성 데이터 추가 $(".end#end").autocomplete('option', 'source', END_AUTOCOMPLETE_DATAS); $(".end#end").autocomplete({ source: function (request, response) { response(END_AUTOCOMPLETE_DATAS); //키보드 위/아래 변경시 목록이 갱신되는 현상 수정 } }); } } } var _SEARCH_RESULT_LINES = {}; var STR_SEARCH_LINES = ""; //출근노선찾기 버튼 눌렀을 때 function search_route_btn() { var start_stop = $("#start").val(); var start_lat = $("#start_lat").val(); var start_lng = $("#start_lng").val(); var end_stop = $("#end").val(); var end_lat = $("#end_lat").val(); var end_lng = $("#end_lng").val(); //var end_time = $("#select_arrive_time.sel").val(); //도착 시간 var radius = 5; //디폴트 5킬로$("#select_search_radius").val(); //검색 반경 if (start_lat == 0 && start_lng == 0 && end_lat == 0 && end_lng == 0) { alert("출발지 혹은 목적지를 검색해 주세요."); return; } if($("#btn-way").hasClass('btn-way-loading')){ //동작중... return; } $('#btn-way').addClass('btn-way-loading'); $('#btn-way').val(" "); $('#null_msg').hide();//초기 안내 메시지 안보이게. _SEARCH_RESULT_LINES = {}; STR_SEARCH_LINES = ""; var params = { "start_x": start_lng, "start_y": start_lat, "end_x": end_lng, "end_y": end_lat, "arrTime": 2359, "radius": radius, "type": "search" }; $.ajax({ url: "/api/getlinelist_latlng.aspx", type: "POST", contentType: "application/x-www-form-urlencoded", data: params, /*async: false,로딩이 안보임..*/ error: function (error) { $('#btn-way').removeClass('btn-way-loading'); $('#btn-way').val("노선검색"); }, success: function (data) { _SEARCH_RESULT_LINES = data.lines; STR_SEARCH_LINES = BindSearchResult(_SEARCH_RESULT_LINES, $(".ways_wrap.search_result ul"), Number($("#search_result_exists_searchTime_select").val())); //정류장과 노선 궤적 표시-검색결과가 없으면 모든 노선 지움 ShowHideLineAndStop(false,null); }, complete: function () { //출발/도착지에 맞춰 지도 크기 맞춤 if (G_MAP != undefined) { setFitMap_fromPositions(); } //검색결과가 없는경우 if (_SEARCH_RESULT_LINES==null || Object.keys(_SEARCH_RESULT_LINES).length <= 0) { //$(".ways_wrap.search_result ul").hide(); $("#search_road_area_result").hide(); $("#search_road_area_noResult.search_road_area_noResult").show(); } else { $("#search_road_area_noResult.search_road_area_noResult").hide(); //$(".ways_wrap.search_result ul").show(); $("#search_road_area_result").show(); } $('#btn-way').removeClass('btn-way-loading'); $('#btn-way').val("노선검색"); } }); } function BindSearchResult(m_result_lines, listObj, selTime) { var m_str_result_lines = "|"; //var listObj = $(".ways_wrap.search_result ul"); //var selTime = Number($("#search_result_exists_searchTime_select").val()); var selTime_s; var selTime_e; var selTime_s_num = 0; var selTime_e_num = 0; if(selTime > 0) { selTime_s = addMinutes(ParseTime(selTime), -30); //선택시간부터 30분 이전 selTime_e = addMinutes(ParseTime(selTime), 30); //선택시간부터 30분 이후 selTime_s_num = ParseTimeToNumber(selTime_s.getHours(),selTime_s.getMinutes()); selTime_e_num = ParseTimeToNumber(selTime_e.getHours(),selTime_e.getMinutes()); } //왼쪽 리스트 내용 지움 //listObj.empty(); listObj.children().remove(); //검색결과가 없으면 아무목록도 표시 하지 않음 if(m_result_lines==null || Object.keys(m_result_lines).length <= 0) { return ""; } for (var key in m_result_lines) { //왼쪽 리스트 검색결과로 채움 if(LINES_TOTAL[key]!=undefined) { if(selTime == 0 || (LINES_TOTAL[key].arrive_time >= selTime_s_num && LINES_TOTAL[key].arrive_time <= selTime_e_num)) { LeftGridBinding(listObj, LINES_TOTAL[key]); m_str_result_lines += key + "|"; } } } return m_str_result_lines; } //검색결과 초기화 function initSearchResult() { //결과창 지움 //$(".ways_wrap.search_result ul").hide(); $("#search_road_area_result").hide(); //결과 삭제 _SEARCH_RESULT_LINES = {}; STR_SEARCH_LINES = ""; //검색창 초기화 var searchTime = document.getElementById('search_result_exists_searchTime_select'); searchTime.selectedIndex = 0; initSearchValuesAndMarker(true); initSearchValuesAndMarker(false); } function initSearchValuesAndMarker(isStart) { if(isStart) { $("#start").val(""); $("#start_lat").val(0); $("#start_lng").val(0); //출발 도착 마커 삭제 if (POI_START_STOP_MARKER != null) { POI_START_STOP_MARKER.setMap(null); POI_START_STOP_MARKER = null; } } else { $("#end").val(""); $("#end_lat").val(0); $("#end_lng").val(0); if (POI_END_STOP_MARKER != null) { POI_END_STOP_MARKER.setMap(null); POI_END_STOP_MARKER = null; } } } //----------------------POI 검색 :END----------------------// //---------------------- 공통 ----------------------// //문자열 자르기 String.prototype.cut = function (len) { var str = this; var l = 0; for (var i = 0; i < str.length; i++) { l += (str.charCodeAt(i) > 128) ? 2 : 1; if (l > len) return str.substring(0, i) + ".."; } return str; } function toggleAllLineWindow() { var newHeight = $('.mapWrap .lnb_src').height() - 70; if ($('#all_ways_list').css('top') == '0px') { //전체보기 창 닫기 $('#all_ways_list').removeAttr("style"); //$('#all_ways_list').animate({top:newHeight}, 400); //$('#all_ways_list').animate({bottom:0, height:"70px"}, 400); $('.slide_open').removeClass('slide_close'); //검색창 보임 $("#search_road_area").show(); if(Object.keys(_SEARCH_RESULT_LINES).length <= 0) $("#null_msg").show(); else $("#null_msg").hide(); } else { //전체보기창 열기 $('#all_ways_list').animate({ top: 0, height: "100%" }, 400); $('.slide_open').addClass('slide_close'); //검색창 숨김 //$("#search_road_area").hide(); } //검색결과 초기화 initSearchResult(); //필터결과 초기화 initFilterResult(); //모든 노선/정류장 표시 ShowHideLineAndStop(true,null); } //노선 상세보기 전체노선으로 (뒤로가기 버튼) function back_lineTotalList() { $("#line_detail").hide(); //노선찾기에서 상세보기로 진입한경우 if (_SEARCH_RESULT_LINES!=null && Object.keys(_SEARCH_RESULT_LINES).length > 0) { $("#search_road_area").show(); $("#search_road_area_result").show(); ShowHideLineAndStop(false,null); } //전체노선 필터에서 진입한 경우 else if (_FILTER_RESULT_LINES!=null && Object.keys(_FILTER_RESULT_LINES).length > 0) { ShowHideLineAndStop(false,null); } else { if(!$('.slide_open').hasClass('slide_close')) //전체보기 상태 { $("#search_road_area").show(); } ShowHideLineAndStop(true,null); } $("#all_ways_list").show(); } function ShowLineAndStopJustOneLineInDetail(_line) { var start_lat = 0; var start_lng = 0; var end_lat = 999999; var end_lng = 999999; var objMap = G_MAP; if (_line.route_polyline != null && _line.route_polyline != "") { _line.route_polyline.setMap(objMap); } var sLen = _line.stops.length; for (var j = 0; j < sLen; j++) { _line.stops[j].marker.setMap(objMap); if(objMap!=null) { if (start_lat <= _line.stops[j].position.lat) { start_lat = _line.stops[j].position.lat } if (start_lng <= _line.stops[j].position.lng) { start_lng = _line.stops[j].position.lng } if (end_lat >= _line.stops[j].position.lat) { end_lat = _line.stops[j].position.lat } if (end_lng >= _line.stops[j].position.lng) { end_lng = _line.stops[j].position.lng } } } if ( (start_lat != 0 && start_lng != 0 && end_lat != 999999 && end_lng != 999999)) { setFitMap_fromAllPositions(start_lat, start_lng, end_lat, end_lng); } } //노선과 정류장을 표시/숨김 function ShowHideLineAndStop(showAllLine,line_no) { var start_lat = 0; var start_lng = 0; var end_lat = 999999; var end_lng = 999999; for (var key in LINES_TOTAL) { var _line = LINES_TOTAL[key]; var objMap = null; //검색결과 노선인 경우 if (showAllLine) ///전체 노선보기 { if(_line.line_status!="Q") objMap = G_MAP; //신설신청 노선을 표시 안함 } else if(line_no!=null && line_no!="" && line_no!="0" && line_no != 0) //노선상세 보기... { if(key==line_no) objMap = G_MAP; } else if((STR_SEARCH_LINES!=null && STR_SEARCH_LINES.indexOf("|" + key + "|") >= 0) || (STR_FILTER_LINES!=null && STR_FILTER_LINES.indexOf("|" + key + "|") >= 0)) //검색 혹은 필터 { objMap = G_MAP; } /* else if( (line_no!=null && line_no!="" && line_no!="0" && line_no != 0 && key==line_no) || (STR_SEARCH_LINES!=null && STR_SEARCH_LINES.indexOf("|" + key + "|") >= 0) || (STR_FILTER_LINES!=null && STR_FILTER_LINES.indexOf("|" + key + "|") >= 0)){ objMap = G_MAP; } else { objMap = null; } */ if (_line.route_polyline != null && _line.route_polyline != "") { _line.route_polyline.setMap(objMap); } var sLen = _line.stops.length; for (var j = 0; j < sLen; j++) { if( !(line_no!=null && line_no!="" && line_no!="0" && line_no != 0) ) //노선상세 보기 이외의 경우 { if(_line.line_status=="Q") //신설신청 노선이면,.. { if(j > 0 && j < sLen - 1) //처음과 마지막 정류장(첫 신청자 정류장)만 표시 { _line.stops[j].marker.setMap(null); continue; } } } _line.stops[j].marker.setMap(objMap); if(objMap!=null) { if (start_lat <= _line.stops[j].position.lat) { start_lat = _line.stops[j].position.lat } if (start_lng <= _line.stops[j].position.lng) { start_lng = _line.stops[j].position.lng } if (end_lat >= _line.stops[j].position.lat) { end_lat = _line.stops[j].position.lat } if (end_lng >= _line.stops[j].position.lng) { end_lng = _line.stops[j].position.lng } } } } if ( (start_lat != 0 && start_lng != 0 && end_lat != 999999 && end_lng != 999999)) { setFitMap_fromAllPositions(start_lat, start_lng, end_lat, end_lng); } } //---------------------- 공통 :END----------------------// //----------------------전체 노선 필터 기능 모음----------------------// var FILTER_AUTOCOMPLETE_DATAS = []; var FILTER_STOP_MARKER = null; //필터 marker(저장/검색 할 대상) var FILTER_STOP_CIRCLE = null; //POI검색을 위한 이벤트 등록 function initFilterService() { var keyword; //출발지 검색에서 keyup 이벤트 발생 실행 $("#line_filter").keyup(function (event) { //if (event.which == 37 || event.which == 38 || event.which == 39 || event.which == 40) { if (event.which == 38 || event.which == 40) { //$("#start").trigger(jQuery.Event('keydown', { which: $.ui.keyCode.RIGHT })); } else { keyword = $("#line_filter").val(); if (keyword.replace(/^\s+|\s+$/g, '')) { filterPOIsearch(keyword); } else //공백인 경우 검색결과 지움 { initFilterValuesAndMarker(true); } } }); $("#line_filter_distance").change(function (event) { setFilterMarkerCircle(); }); } function setFilterMarker(name,position) { if (FILTER_STOP_MARKER != null) { FILTER_STOP_MARKER.setMap(null); FILTER_STOP_MARKER = null; } //검색위치(출발지) 마커 표시 FILTER_STOP_MARKER = initStopMarker(null, true, "S", 3, position, "-999", name, "", "", "",null,name); setFilterMarkerCircle(); } function setFilterMarkerCircle() { if (FILTER_STOP_MARKER == null) { return; } if (FILTER_STOP_CIRCLE != null) { FILTER_STOP_CIRCLE.setMap(null); FILTER_STOP_CIRCLE = null; } var radius = Number($("#line_filter_distance").val()); FILTER_STOP_CIRCLE = new google.maps.Circle({ strokeColor: '#FF0000', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#FF0000', fillOpacity: 0.35, map: G_MAP, center: FILTER_STOP_MARKER.position, radius: radius * 1000 }); } //목적지 검색 autocomplete항목 초기화 function initFilterAutocomplete() { $("#line_filter").autocomplete({ source: default_start_autocomplete, autoFocus: true, focus: function (event, ui) { event.preventDefault(); if (G_MAP != undefined) { setFilterMarker(ui.item.label, ui.item.position); G_MAP.setCenter(ui.item.position); //G_MAP.setZoom(INIT_ZOOM_LEVEL + 2) } $("#line_filter_lat").val(ui.item.position.lat); $("#line_filter_lng").val(ui.item.position.lng); }, select: function (event, ui) { //console.log("select 여러번됨..."); $("#line_filter").autocomplete('option', 'source', default_start_autocomplete); $("#line_filter").autocomplete("close"); }, close: function (event, ui) { } }); } // 장소 검색 객체를 생성합니다 function filterPOIsearch(keyword) { $.ajax({ url: "https://dapi.kakao.com/v2/local/search/keyword.json?query=" + encodeURI(keyword), type: "POST", contentType: "application/x-www-form-urlencoded", /*async: false,로딩이 안보임..*/ beforeSend: function (request) { request.setRequestHeader("Authorization", "KakaoAK " + kakao_rest_api_key); }, error: function (error) { }, success: function (data, status) { console.log(data); FILTER_AUTOCOMPLETE_DATAS = []; places = data.documents; var tmp_place_cnt = places.length; for (var i = 0; i < tmp_place_cnt; i++) { var place_name = places[i].place_name + " (" + places[i].address_name + ")"; var short_addr = makeShortAddr(places[i].address_name); place_name = place_name.cut(40); FILTER_AUTOCOMPLETE_DATAS.push({ label: place_name, value: places[i].place_name, address : short_addr, position: setPositionProperty(places[i].y, places[i].x) }); } //자동완성 데이터 추가 $("#line_filter").autocomplete('option', 'source', FILTER_AUTOCOMPLETE_DATAS); $("#line_filter").autocomplete({ source: function (request, response) { response(FILTER_AUTOCOMPLETE_DATAS); //키보드 위/아래 변경시 목록이 갱신되는 현상 수정 } }); }, complete: function () { //alert("complete!"); } }); } var _FILTER_RESULT_LINES = {}; var STR_FILTER_LINES = ""; function SetLinesFilter() { if ($('#btn-way-filter').val() =="초기화") { $('#btn-way-filter').val("필터"); //필터결과 초기화 initFilterResult(); //모든 노선/정류장 표시 ShowHideLineAndStop(true,null); return; } var start_stop = $("#line_filter").val(); var start_lat = $("#line_filter_lat").val(); var start_lng = $("#line_filter_lng").val(); var radius = Number($("#line_filter_distance").val()); //검색 반경 if (start_lat == 0 && start_lng == 0) { alert("장소명, 주소 등을 입력하세요."); return; } if($("#btn-way-filter").hasClass('btn-way-loading')){ //동작중... return; } $('#btn-way-filter').addClass('btn-way-loading'); $('#btn-way-filter').val(" "); _FILTER_RESULT_LINES = {}; STR_FILTER_LINES = ""; var params = { "start_x": start_lng, "start_y": start_lat, "radius": radius, "type": "filter" }; $.ajax({ url: "/api/getlinelist_latlng.aspx", type: "POST", contentType: "application/x-www-form-urlencoded", data: params, /*async: false,로딩이 안보임..*/ error: function (error) { $('#btn-way-filter').removeClass('btn-way-loading'); $('#btn-way-filter').val("필터"); }, success: function (data) { _FILTER_RESULT_LINES = data.lines; STR_FILTER_LINES = BindSearchResult(_FILTER_RESULT_LINES, $(".ways_wrap.total_list ul"), Number($("#line_filter_time_select").val())); //정류장과 노선 궤적 표시-검색결과가 없으면 모든 노선 지움 ShowHideLineAndStop(false,null); }, complete: function () { $('#btn-way-filter').removeClass('btn-way-loading'); $('#btn-way-filter').val("초기화"); } }); } //검색결과 초기화 function initFilterResult() { //결과 삭제 _FILTER_RESULT_LINES = {}; STR_FILTER_LINES = ""; //검색창 초기화 var searchTime = document.getElementById('line_filter_time_select'); searchTime.selectedIndex = 0; //왼쪽 리스트 새로 채움 채움 var listObj = $(".ways_wrap.total_list ul"); listObj.children().remove(); for (var key in LINES_TOTAL) { if(LINES_TOTAL[key]!=undefined) { LeftGridBinding(listObj, LINES_TOTAL[key]); } } initFilterValuesAndMarker(); } function initFilterValuesAndMarker() { //값 지움 $("#line_filter").val(""); $("#line_filter_lat").val(0); $("#line_filter_lng").val(0); //마커 삭제 if (FILTER_STOP_MARKER != null) { FILTER_STOP_MARKER.setMap(null); FILTER_STOP_MARKER = null; } if (FILTER_STOP_CIRCLE != null) { FILTER_STOP_CIRCLE.setMap(null); FILTER_STOP_CIRCLE = null; } } //----------------------전체 노선 필터 기능 모음 END----------------------//