최현영

Highway travel time of IC-to-IC adding...

This diff could not be displayed because it is too large.
...@@ -16,11 +16,16 @@ const TOKEN = 'sqNjA99TptppqvcoVFAnU7Kawsl+s7l+JgnZ7r2is97qrFQraIn0sLQ6mTsIPvXLG ...@@ -16,11 +16,16 @@ const TOKEN = 'sqNjA99TptppqvcoVFAnU7Kawsl+s7l+JgnZ7r2is97qrFQraIn0sLQ6mTsIPvXLG
16 const domain = "www.chyoss.tk" 16 const domain = "www.chyoss.tk"
17 const sslport = 23023; 17 const sslport = 23023;
18 18
19 -const buffer = fs.readFileSync('./whereur/Expressfee.json'); 19 +const feebuffer = fs.readFileSync('./whereur/Expressfee.json');
20 -const datafeejson = buffer.toString(); 20 +const datafeejson = feebuffer.toString();
21 const feedata = JSON.parse(datafeejson); 21 const feedata = JSON.parse(datafeejson);
22 console.log("Expressfee.json 파일 읽기"); 22 console.log("Expressfee.json 파일 읽기");
23 23
24 +const namebuffer = fs.roadFileSync('./whereur/ExpressIC.json');
25 +const datanamejson = namebuffer.toString();
26 +const namedata = JSON.parse(datanamejson);
27 +console.log("Expressname.json 파일 열기");
28 +
24 29
25 30
26 31
...@@ -51,11 +56,6 @@ router.route('/process/maprealtime').get(function(req, res){ ...@@ -51,11 +56,6 @@ router.route('/process/maprealtime').get(function(req, res){
51 }); 56 });
52 57
53 58
54 -router.route('/process/maprealtime').get(function(req, res){
55 - console.log('process/mapreatime 호출됨');
56 - res.end();
57 -});
58 -
59 router.route('/process/construction').get(function(req, res){ 59 router.route('/process/construction').get(function(req, res){
60 console.log('process/maprealconstruction 호출됨'); 60 console.log('process/maprealconstruction 호출됨');
61 res.end(); 61 res.end();
...@@ -184,6 +184,16 @@ function isroadnumber(typetext){ ...@@ -184,6 +184,16 @@ function isroadnumber(typetext){
184 } 184 }
185 } 185 }
186 186
187 +function isroadname(typetext){
188 + if(typetext == '나들목정보'){
189 + return true;
190 + }
191 + else{
192 + return false;
193 + }
194 +}
195 +
196 +
187 function inputroadnumber(typetext){ 197 function inputroadnumber(typetext){
188 if(typetext.indexOf("번") >= 0){ 198 if(typetext.indexOf("번") >= 0){
189 return true; 199 return true;
...@@ -192,6 +202,15 @@ function inputroadnumber(typetext){ ...@@ -192,6 +202,15 @@ function inputroadnumber(typetext){
192 return false; 202 return false;
193 } 203 }
194 } 204 }
205 +function israodnameExist(typetext){
206 + if(typetext.indexOf('검색') >= 0){
207 + return true;
208 + }
209 + else{
210 + return false;
211 + }
212 +}
213 +
195 214
196 function pushmsg(eventObj){ 215 function pushmsg(eventObj){
197 console.log(eventObj.source.userId); 216 console.log(eventObj.source.userId);
...@@ -235,7 +254,7 @@ function pushmsg(eventObj){ ...@@ -235,7 +254,7 @@ function pushmsg(eventObj){
235 usercount[eventObj.source.userId] = (usercount[eventObj.source.userId] + 5); 254 usercount[eventObj.source.userId] = (usercount[eventObj.source.userId] + 5);
236 } 255 }
237 } 256 }
238 -function wanttokownfee(typetext){ 257 +function wanttoknowfee(typetext){
239 if(typetext.indexOf("-") >= 0){ 258 if(typetext.indexOf("-") >= 0){
240 return true; 259 return true;
241 } 260 }
...@@ -255,13 +274,19 @@ app.post('/hook', function (req, res) { ...@@ -255,13 +274,19 @@ app.post('/hook', function (req, res) {
255 var isforecast; 274 var isforecast;
256 var isselecttypeforecast; 275 var isselecttypeforecast;
257 var isfindroad; 276 var isfindroad;
277 + var isroadname;
258 var istypeforecast; 278 var istypeforecast;
259 var isinputnumber; 279 var isinputnumber;
280 + var isinputroadname;
260 var eventObj = req.body.events[0]; 281 var eventObj = req.body.events[0];
261 var source = eventObj.source; 282 var source = eventObj.source;
262 var message = eventObj.message; 283 var message = eventObj.message;
263 var isnext; 284 var isnext;
264 var isfee; 285 var isfee;
286 + var istime;
287 +
288 +
289 +
265 // request log 290 // request log
266 console.log('======================', new Date() ,'======================'); 291 console.log('======================', new Date() ,'======================');
267 console.log('[request]', req.body); 292 console.log('[request]', req.body);
...@@ -284,6 +309,13 @@ app.post('/hook', function (req, res) { ...@@ -284,6 +309,13 @@ app.post('/hook', function (req, res) {
284 roadnumber(eventObj); 309 roadnumber(eventObj);
285 } 310 }
286 311
312 + isroadname = isroadname(message.text);
313 + if(isroadname == true){
314 + console.log("나들목 이름을 궁금해 합니다.");
315 + roadname(eventObj);
316 + }
317 +
318 +
287 isforecast = firstforecast(message.text); 319 isforecast = firstforecast(message.text);
288 if(isforecast){ 320 if(isforecast){
289 if(message.text == '1'){ 321 if(message.text == '1'){
...@@ -348,11 +380,22 @@ app.post('/hook', function (req, res) { ...@@ -348,11 +380,22 @@ app.post('/hook', function (req, res) {
348 //console.log(roadnumberstringLength); 380 //console.log(roadnumberstringLength);
349 } 381 }
350 382
351 - isfee = wanttokownfee(message.text); 383 + isfee = wanttoknowfee(message.text);
352 if(isfee == true){ 384 if(isfee == true){
353 feelead(eventObj, message.text); 385 feelead(eventObj, message.text);
354 } 386 }
355 387
388 + istime = wanttoknowtime(message.text);
389 + if(istime == true){
390 + timelead(eventObj, message.text);
391 + }
392 +
393 + isinputroadname = israodnameExist(message.text);
394 + if(isinputroadname == true ){
395 + isinputroadname(eventObj, message.text);
396 +
397 + }
398 +
356 res.sendStatus(200); 399 res.sendStatus(200);
357 }); 400 });
358 401
...@@ -376,11 +419,11 @@ function helloworld(eventObj){ ...@@ -376,11 +419,11 @@ function helloworld(eventObj){
376 }, 419 },
377 { 420 {
378 "type":"text", 421 "type":"text",
379 - "text":"현재 교통 예보가 궁금하시다면 1번을, 실시간 교통혼잡 상황을 보실려면 2번을, 실시간 정체상황을 알고 싶다면 3번을, 교통요금이 궁금하시다면 4번을 눌러주세요." 422 + "text":"현재 교통 예보가 궁금하시다면 1번을, 실시간 교통혼잡 상황을 보실려면 2번을, 실시간 정체상황을 알고 싶다면 3번을, 교통요금이 궁금하시다면 4번을, 나들목간 평균시간"
380 }, 423 },
381 { 424 {
382 "type":"text", 425 "type":"text",
383 - "text": "노선정보는 '노선정보'를 입력해주세요." 426 + "text": "노선정보는 '노선정보'를 입력해주세요., 나들목정보는 '나들목정보' "
384 } 427 }
385 ] 428 ]
386 } 429 }
...@@ -757,7 +800,7 @@ function roadnumber(eventObj){ ...@@ -757,7 +800,7 @@ function roadnumber(eventObj){
757 }, 800 },
758 { 801 {
759 "type":"text", 802 "type":"text",
760 - "text":"동서 구간 : 10-남해, 12-무안광주 및 광주대구선, 16-울산선, 20-새만금포항선, 30-당진영덕선, 32-아산청주선, 40-평택제천선, 50-영동선, 52-광주원주선, 60-서울양양선" 803 + "text":"동서 구간 : 10-남해, 12-무안광주 및 광주대구선, 16-울산선, 20-새만금포항선, 30-당진영덕선, 32-아산청주선, 40-평택제천선, 50-영동선, 52-광주원주선, 60-서울양양선"
761 }, 804 },
762 { 805 {
763 "type":"text", 806 "type":"text",
...@@ -774,6 +817,37 @@ function roadnumber(eventObj){ ...@@ -774,6 +817,37 @@ function roadnumber(eventObj){
774 }); 817 });
775 } 818 }
776 819
820 +function roadname(eventObj){
821 + request.post(
822 + {
823 + url: TARGET_URL,
824 + headers: {
825 + 'Authorization': `Bearer ${TOKEN}`
826 + },
827 + json: {
828 + "replyToken":eventObj.replyToken,
829 + "messages":[
830 + {
831 + "type":"text",
832 + "text":"나들목 이름이 궁금하시다면 <검색:이름>을 입력해 주세요."
833 + },
834 + {
835 + "type":"text",
836 + "text":"예) 검색:서안동"
837 + },
838 + {
839 + "type":"text",
840 + "test":"예) 검색:안동"
841 + }
842 + ]
843 + }
844 + },(error, response, body) => {
845 + console.log(body)
846 + });
847 +}
848 +
849 +
850 +
777 function tieupselect(eventObj){ 851 function tieupselect(eventObj){
778 request.post( 852 request.post(
779 { 853 {
...@@ -807,6 +881,46 @@ function tieupselect(eventObj){ ...@@ -807,6 +881,46 @@ function tieupselect(eventObj){
807 }); 881 });
808 } 882 }
809 883
884 +function isinputroadname(eventObj, msg){
885 + var icnamelist = new Array();
886 + var iclist = "";
887 + var ExpressICnameLength = namedata.length;
888 + var icnamelist = msg.split(':');
889 + var isthat = false;
890 + var iscout = 0;
891 + for(var i = 0; i < ExpressICnameLength; i++){
892 + if(namedata.unitLists[i].unitName.indexOf(icnamelist[1]) >= 0 ){
893 + isthat = true;
894 + iclist = "#" + str(iscount) + " " + namedata.unitLists[i].unitName + " ";
895 + }
896 + }
897 +
898 + request.post(
899 + {
900 + url: TARGET_URL,
901 + headers: {
902 + 'Authorization': `Bearer ${TOKEN}`
903 + },
904 + json: {
905 + "replyToken":eventObj.replyToken,
906 + "messages":[
907 + {
908 + "type":"text",
909 + "text":"검색결과입니다. : " + msg
910 + }
911 +
912 + ]
913 + }
914 + },(error, response, body) => {
915 + console.log(body)
916 + });
917 +
918 +
919 +}
920 +
921 +
922 +
923 +
810 function roadcongest(eventObj, msg, userid){ 924 function roadcongest(eventObj, msg, userid){
811 //jsoncongest의 routeNo는 앞의 세자리가 노선 번호, 마지막 숫자가 제1 중부내륙, 제2 중부내륙 처럼 노선번호는 같으나 노선의 경로가 다른 경우를 나타내며, 혹은 구간구간 개통된 고속도로를 구분지을 때도 구별용으로 사용됨으로 필요가 없음. 925 //jsoncongest의 routeNo는 앞의 세자리가 노선 번호, 마지막 숫자가 제1 중부내륙, 제2 중부내륙 처럼 노선번호는 같으나 노선의 경로가 다른 경우를 나타내며, 혹은 구간구간 개통된 고속도로를 구분지을 때도 구별용으로 사용됨으로 필요가 없음.
812 jsoncongest(function(object){ 926 jsoncongest(function(object){
...@@ -850,6 +964,37 @@ function roadcongest(eventObj, msg, userid){ ...@@ -850,6 +964,37 @@ function roadcongest(eventObj, msg, userid){
850 userroadcongest[userid] = roadnumberstring; 964 userroadcongest[userid] = roadnumberstring;
851 userroadcongestlength[userid] = roadnumberstringLength; 965 userroadcongestlength[userid] = roadnumberstringLength;
852 usercount[userid] = 0; 966 usercount[userid] = 0;
967 +
968 +
969 +
970 + request.post(
971 + {
972 + url: TARGET_URL,
973 + headers: {
974 + 'Authorization': `Bearer ${TOKEN}`
975 + },
976 + json: {
977 + "replyToken":eventObj.replyToken,
978 + "messages":[
979 + {
980 + "type":"text",
981 + "text":"검색하신 노선에서 발견된 정체량은 총 " + str(userroadcongestlength[userid]) + "입니다."
982 + },
983 + {
984 + "type":"text",
985 + "text":"계속해서 보실려면 '다음'을 입력해 주세요."
986 + },
987 + {
988 + "type":"text",
989 + "text":"마지막 항목이 나올때까지 계속해서 '다음'을 입력해 주세요."
990 + }
991 +
992 + ]
993 + }
994 + },(error, response, body) => {
995 + console.log(body)
996 + });
997 +
853 } 998 }
854 999
855 if(roadnumberstringLength == 0){ 1000 if(roadnumberstringLength == 0){
...@@ -948,57 +1093,6 @@ function feelead(eventObj, msg){ ...@@ -948,57 +1093,6 @@ function feelead(eventObj, msg){
948 } 1093 }
949 } 1094 }
950 1095
951 -// var url3 = 'http://data.ex.co.kr/openapi/trafficapi/trafficAll';
952 -// var queryParams3 = '?' + encodeURIComponent('key') + '=4365330273'; /* Service Key*/
953 -// queryParams3 += '&' + encodeURIComponent('type') + '=' + encodeURIComponent('json'); /* */
954 -
955 -// request({
956 -// url: url3 + queryParams3,
957 -// method: 'GET'
958 -
959 -// }, function (error, response, body) {
960 -// console.log('Status', response.statusCode);
961 -// console.log('Headers', JSON.stringify(response.headers));
962 -// console.log('Reponse received', body);
963 -// var obj = JSON.parse(body);
964 -// console.log(obj);
965 -// console.log(obj.trafficAll[0]);
966 -// });
967 -
968 -
969 -// var url4 = 'http://data.ex.co.kr/openapi/trafficapi/trafficRegion';
970 -// var queryParams4 = '?' + encodeURIComponent('key') + '=4365330273'; /* Service Key*/
971 -// queryParams4 += '&' + encodeURIComponent('type') + '=' + encodeURIComponent('json'); /* */
972 -
973 -// request({
974 -// url: url4 + queryParams4,
975 -// method: 'GET'
976 -
977 -// }, function (error, response, body) {
978 -// console.log('Status', response.statusCode);
979 -// console.log('Headers', JSON.stringify(response.headers));
980 -// console.log('Reponse received', body);
981 -// var obj = JSON.parse(body);
982 -// console.log(obj);
983 -// console.log(obj.trafficRegion[0]);
984 -// });
985 -
986 -// var url5 = 'http://data.ex.co.kr/openapi/business/conveniServiceArea';
987 -// var queryParams5 = '?' + encodeURIComponent('key') + '=4365330273'; /* Service Key*/
988 -// queryParams5 += '&' + encodeURIComponent('type') + '=' + encodeURIComponent('json'); /* */
989 -
990 -// request({
991 -// url: url5 + queryParams5,
992 -// method: 'GET'
993 -
994 -// }, function (error, response, body) {
995 -// console.log('Status', response.statusCode);
996 -// console.log('Headers', JSON.stringify(response.headers));
997 -// console.log('Reponse received', body);
998 -// var obj = JSON.parse(body);
999 -// console.log(obj);
1000 -// console.log(obj.list[0]);
1001 -// });
1002 1096
1003 1097
1004 1098
......
1 -<!doctype html>
2 -<html lang="ko">
3 -<head>
4 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 -<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
6 -<title>실시간 공사정보</title>
7 -<style type="text/css">
8 - * {
9 - font-family:Arial, Verdana, sans-serif, Dotum, Gulim;
10 - }
11 - html, body { width:100%; height:100%; }
12 - body { margin:0; padding:0; }
13 -</style>
14 -</head>
15 -<body>
16 - <form method="get" action="/process/construction"></form>
17 - <div id="map" style="width:100%; height:100%;"></div>
18 -<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
19 -<script type="text/javascript" src="http://openapi.its.go.kr/javascript/jquery.xml2json.js"></script>
20 -<script type="text/javascript" src="http://openlayers.org/api/2.13.1/OpenLayers.js"></script>
21 -<script type="text/javascript" src="http://openapi.its.go.kr/javascript/OpenLayers.Layer.Vworld.js"></script>
22 -<script type="text/javascript">
23 - var API_DOMAIN = 'http://openapi.its.go.kr';
24 - var key = '1590913608992';
25 - var NOPOP_LAYERS = [];
26 - var POPUP_LAYERS = [];
27 - var EPSG_4326 = new OpenLayers.Projection('EPSG:4326');
28 - var EPSG_900913 = new OpenLayers.Projection('EPSG:900913');
29 - function getCORSURL(uri, type) {
30 - var yqlUri = 'http://query.yahooapis.com/v1/public/yql?q=' +
31 - encodeURIComponent('SELECT * FROM ' + type + ' where url="' + uri + '"');
32 - if (type == 'html') {
33 - yqlUri += encodeURIComponent(' and xpath="/*"');
34 - } else if (type == 'json') {
35 - yqlUri += "&callback=&format=json";
36 - } else if (type == 'xml') {
37 - yqlUri += "&format=xml";
38 - }
39 - return yqlUri;
40 - }
41 -</script>
42 -<script type="text/javascript" src="http://openapi.its.go.kr/javascript/openapi.construction.js"></script>
43 -<script type="text/javascript">
44 - window.onload = init;
45 - var map;
46 - function init() {
47 - // 지도 생성
48 - map = new OpenLayers.Map({
49 - div: "map",
50 - projection: EPSG_900913,
51 - displayProjection: EPSG_4326,
52 - units: "m",
53 - maxExtent: new OpenLayers.Bounds(13489539, 3828608, 14943678, 4881604),
54 - restrictedExtent: new OpenLayers.Bounds(13489539, 3828608, 14943678, 4881604),
55 - layers: [
56 - new OpenLayers.Layer.Vworld_Base('Vworld', {numZoomLevels:17, transitionEffect:''})
57 - ],
58 - controls: [
59 - new OpenLayers.Control.Navigation()
60 - ,new OpenLayers.Control.MousePosition()
61 - ,new OpenLayers.Control.ScaleLine()
62 - ,new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true})
63 - ,new OpenLayers.Control.LayerSwitcher()
64 - ,new OpenLayers.Control.OverviewMap({layers:[new OpenLayers.Layer.OSM()], mapOptions:{projection:'EPSG:900913'}, autoPan:true, maximized:true})
65 - ]
66 - });
67 - // 지도 레벨 제한
68 - map.events.on({
69 - "zoomend": function(event) {
70 - if (map.getZoom() < 7) map.setCenter(map.getCenter(), 7);
71 - if (map.getZoom() > 14) map.setCenter(map.getCenter(), 14);
72 - }
73 - });
74 - // 지도 초기 위치 설정
75 - map.setCenter(new OpenLayers.LonLat(14217832, 4353272), 7);
76 - // 공사정보 시작
77 - var construction = new Construction('constructionLayer');
78 - construction.getList();
79 - POPUP_LAYERS.push(construction.getLayer());
80 - // 공사정보 종료
81 - map.addLayers(NOPOP_LAYERS);
82 - map.addLayers(POPUP_LAYERS);
83 - // 아이콘 클릭시 팝업 설정 시작
84 - var controlSelect = new OpenLayers.Control.SelectFeature(POPUP_LAYERS, {
85 - clickout:true, toggle:false, multiple:false,
86 - onSelect:function(feature){
87 - var data = feature.data;
88 - var message ='';
89 - switch(feature.layer.id) {
90 - case 'weatherLayer':
91 - message += weather.getMessage(data);
92 - break;
93 - case 'constructionLayer':
94 - message += construction.getMessage(data);
95 - break;
96 - case 'accidentLayer':
97 - message += accident.getMessage(data);
98 - break;
99 - case 'cctvLayer':
100 - message += cctv.getMessage(data);
101 - break;
102 - case 'warningLayer':
103 - message += warning.getMessage(data);
104 - break;
105 - case 'tourLayer':
106 - message += tour.getMessage(data);
107 - break;
108 - default:
109 - return false;
110 - }
111 - var selectedFeature = feature;
112 - var popup = new OpenLayers.Popup.FramedCloud("popup",
113 - feature.geometry.getBounds().getCenterLonLat(), null,
114 - message, null, true, function(e){controlSelect.unselect(selectedFeature);});
115 - popup.minSize = new OpenLayers.Size(200,200);
116 - popup.maxSize = new OpenLayers.Size(400,400);
117 - feature.popup = popup;
118 - map.addPopup(popup);
119 - },
120 - onUnselect:function(feature){
121 - map.removePopup(feature.popup);
122 - feature.popup.destroy();
123 - feature.popup = null;
124 - }
125 - });
126 - map.addControls([controlSelect]);
127 - controlSelect.activate();
128 - // 아이콘 클릭시 팝업 설정 종료
129 - }
130 -</script>
131 -</body>
132 -</html>
...\ No newline at end of file ...\ No newline at end of file
1 -
2 -<!doctype html>
3 -<html lang="ko">
4 -<head>
5 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 -<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
7 -<title>교통정보 OPEN API</title>
8 -<style type="text/css">
9 - * {
10 - font-family:Arial, Verdana, sans-serif, Dotum, Gulim;
11 - }
12 - html, body { width:100%; height:100%; }
13 - body { margin:0; padding:0; }
14 -</style>
15 -</head>
16 -<body>
17 - <form method="get" action="/process/mapcctv"></form>
18 - <div id="map" style="width:100%; height:100%;"></div>
19 -<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
20 -<script type="text/javascript" src="http://openapi.its.go.kr/javascript/jquery.xml2json.js"></script>
21 -<script type="text/javascript" src="http://openlayers.org/api/2.13.1/OpenLayers.js"></script>
22 -<script type="text/javascript" src="http://openapi.its.go.kr/javascript/OpenLayers.Layer.Vworld.js"></script>
23 -<script type="text/javascript">
24 - var API_DOMAIN = 'http://openapi.its.go.kr';
25 - var key = '1590913608992';
26 - var NOPOP_LAYERS = [];
27 - var POPUP_LAYERS = [];
28 - var EPSG_4326 = new OpenLayers.Projection('EPSG:4326');
29 - var EPSG_900913 = new OpenLayers.Projection('EPSG:900913');
30 - function getCORSURL(uri, type) {
31 - var yqlUri = 'http://query.yahooapis.com/v1/public/yql?q=' +
32 - encodeURIComponent('SELECT * FROM ' + type + ' where url="' + uri + '"');
33 - if (type == 'html') {
34 - yqlUri += encodeURIComponent(' and xpath="/*"');
35 - } else if (type == 'json') {
36 - yqlUri += "&callback=&format=json";
37 - } else if (type == 'xml') {
38 - yqlUri += "&format=xml";
39 - }
40 - return yqlUri;
41 - }
42 -</script>
43 -<script type="text/javascript" src="http://openapi.its.go.kr/javascript/openapi.cctv.js"></script>
44 -<script type="text/javascript">
45 - window.onload = init;
46 - var map;
47 - function init() {
48 - // 지도 생성
49 - map = new OpenLayers.Map({
50 - div: "map",
51 - projection: EPSG_900913,
52 - displayProjection: EPSG_4326,
53 - units: "m",
54 - maxExtent: new OpenLayers.Bounds(13489539, 3828608, 14943678, 4881604),
55 - restrictedExtent: new OpenLayers.Bounds(13489539, 3828608, 14943678, 4881604),
56 - layers: [
57 - new OpenLayers.Layer.Vworld_Base('Vworld', {numZoomLevels:17, transitionEffect:''})
58 - ],
59 - controls: [
60 - new OpenLayers.Control.Navigation()
61 - ,new OpenLayers.Control.MousePosition()
62 - ,new OpenLayers.Control.ScaleLine()
63 - ,new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true})
64 - ,new OpenLayers.Control.LayerSwitcher()
65 - ,new OpenLayers.Control.OverviewMap({layers:[new OpenLayers.Layer.OSM()], mapOptions:{projection:'EPSG:900913'}, autoPan:true, maximized:true})
66 - ]
67 - });
68 - // 지도 레벨 제한
69 - map.events.on({
70 - "zoomend": function(event) {
71 - if (map.getZoom() < 7) map.setCenter(map.getCenter(), 7);
72 - if (map.getZoom() > 14) map.setCenter(map.getCenter(), 14);
73 - }
74 - });
75 - // 지도 초기 위치 설정
76 - map.setCenter(new OpenLayers.LonLat(14217832, 4353272), 7);
77 - // CCTV 시작
78 - var cctv = new CCTV('cctvLayer');
79 - cctv.getList();
80 - POPUP_LAYERS.push(cctv.getLayer());
81 - // CCTV 종료
82 - map.addLayers(NOPOP_LAYERS);
83 - map.addLayers(POPUP_LAYERS);
84 - // 아이콘 클릭시 팝업 설정 시작
85 - var controlSelect = new OpenLayers.Control.SelectFeature(POPUP_LAYERS, {
86 - clickout:true, toggle:false, multiple:false,
87 - onSelect:function(feature){
88 - var data = feature.data;
89 - var message ='';
90 - switch(feature.layer.id) {
91 - case 'weatherLayer':
92 - message += weather.getMessage(data);
93 - break;
94 - case 'constructionLayer':
95 - message += construction.getMessage(data);
96 - break;
97 - case 'accidentLayer':
98 - message += accident.getMessage(data);
99 - break;
100 - case 'cctvLayer':
101 - message += cctv.getMessage(data);
102 - break;
103 - case 'warningLayer':
104 - message += warning.getMessage(data);
105 - break;
106 - case 'tourLayer':
107 - message += tour.getMessage(data);
108 - break;
109 - default:
110 - return false;
111 - }
112 - var selectedFeature = feature;
113 - var popup = new OpenLayers.Popup.FramedCloud("popup",
114 - feature.geometry.getBounds().getCenterLonLat(), null,
115 - message, null, true, function(e){controlSelect.unselect(selectedFeature);});
116 - popup.minSize = new OpenLayers.Size(200,200);
117 - popup.maxSize = new OpenLayers.Size(400,400);
118 - feature.popup = popup;
119 - map.addPopup(popup);
120 - },
121 - onUnselect:function(feature){
122 - map.removePopup(feature.popup);
123 - feature.popup.destroy();
124 - feature.popup = null;
125 - }
126 - });
127 - map.addControls([controlSelect]);
128 - controlSelect.activate();
129 - // 아이콘 클릭시 팝업 설정 종료
130 - }
131 -</script>
132 -</body>
133 -</html>
...\ No newline at end of file ...\ No newline at end of file