최지우

경로검색 알고리즘 추가

...@@ -4,10 +4,10 @@ var path = require('path'); ...@@ -4,10 +4,10 @@ var path = require('path');
4 var cookieParser = require('cookie-parser'); 4 var cookieParser = require('cookie-parser');
5 var logger = require('morgan'); 5 var logger = require('morgan');
6 6
7 -var mainRouter = require('./routes/main') 7 +var mainRouter = require('./routes/main');
8 var passRouter = require('./routes/pass'); 8 var passRouter = require('./routes/pass');
9 -var searchRouter = require('./routes/search') 9 +var searchRouter = require('./routes/search');
10 -var nearRouter = require('./routes/near') 10 +var nearRouter = require('./routes/near');
11 var app = express(); 11 var app = express();
12 12
13 // view engine setup 13 // view engine setup
......
...@@ -41,49 +41,6 @@ lightbox.options.albumLabel = "%1 / %2"; ...@@ -41,49 +41,6 @@ lightbox.options.albumLabel = "%1 / %2";
41 41
42 <link rel="stylesheet" type="text/css" href="https://t1.daumcdn.net/tistory_admin/assets/blog/tistory-4143aead47fb3d3c83016433af84643a03241408/blogs/plugins/TistoryProfileLayer/style.css?_version_=tistory-4143aead47fb3d3c83016433af84643a03241408" /> 42 <link rel="stylesheet" type="text/css" href="https://t1.daumcdn.net/tistory_admin/assets/blog/tistory-4143aead47fb3d3c83016433af84643a03241408/blogs/plugins/TistoryProfileLayer/style.css?_version_=tistory-4143aead47fb3d3c83016433af84643a03241408" />
43 <script type="text/javascript" src="https://t1.daumcdn.net/tistory_admin/assets/blog/tistory-4143aead47fb3d3c83016433af84643a03241408/blogs/plugins/TistoryProfileLayer/profile.js?_version_=tistory-4143aead47fb3d3c83016433af84643a03241408"></script> 43 <script type="text/javascript" src="https://t1.daumcdn.net/tistory_admin/assets/blog/tistory-4143aead47fb3d3c83016433af84643a03241408/blogs/plugins/TistoryProfileLayer/profile.js?_version_=tistory-4143aead47fb3d3c83016433af84643a03241408"></script>
44 - <style type="text/css">
45 - .another_category { border: 1px solid #E5E5E5; padding: 10px 10px 5px; margin:10px 0; clear: both; }
46 - .another_category h4 { font-size: 12px !important; margin: 0 !important; border-bottom: 1px solid #E5E5E5 !important; padding: 2px 0 6px !important; }
47 - .another_category h4 a { font-weight: bold !important; }
48 - .another_category table { table-layout: fixed; border-collapse: collapse; width: 100% !important; margin-top: 10px !important; }
49 - * html .another_category table { width: auto !important; }
50 - *:first-child+html .another_category table { width: auto !important; }
51 - .another_category th, .another_category td { padding: 0 0 4px !important; }
52 - .another_category th { text-align: left; font-size: 12px !important; font-weight: normal; word-break: break-all; overflow: hidden; line-height: 1.5; }
53 - .another_category td { text-align: right; width: 80px; font-size: 11px; }
54 - .another_category th a { font-weight: normal; text-decoration: none; border: none !important; }
55 - .another_category th a.current{ font-weight: bold; text-decoration: none !important; border-bottom: 1px solid !important; }
56 - .another_category th span { font-weight: normal; text-decoration: none; font: 10px Tahoma, Sans-serif; border: none !important; }
57 -
58 - .another_category_color_gray, .another_category_color_gray h4 { border-color: #E5E5E5 !important; }
59 - .another_category_color_gray * { color: #909090 !important; }
60 - .another_category_color_gray th a.current{border-color:#909090 !important;}
61 - .another_category_color_gray h4, .another_category_color_gray h4 a { color: #737373 !important; }
62 -
63 -
64 - .another_category_color_red, .another_category_color_red h4 { border-color: #F6D4D3 !important; }
65 - .another_category_color_red * { color: #E86869 !important; }
66 - .another_category_color_red th a.current{border-color:#E86869 !important;}
67 - .another_category_color_red h4, .another_category_color_red h4 a { color: #ED0908 !important; }
68 -
69 -
70 - .another_category_color_green, .another_category_color_green h4 { border-color: #CCE7C8 !important; }
71 - .another_category_color_green * { color: #64C05B !important; }
72 - .another_category_color_green th a.current{border-color:#64C05B !important;}
73 - .another_category_color_green h4, .another_category_color_green h4 a { color: #3EA731 !important; }
74 -
75 -
76 - .another_category_color_blue, .another_category_color_blue h4 { border-color: #C8DAF2 !important; }
77 - .another_category_color_blue * { color: #477FD6 !important; }
78 - .another_category_color_blue th a.current{border-color:#477FD6 !important;}
79 - .another_category_color_blue h4, .another_category_color_blue h4 a { color: #1960CA !important; }
80 -
81 -
82 - .another_category_color_violet, .another_category_color_violet h4 { border-color: #E1CEEC !important; }
83 - .another_category_color_violet * { color:#9D64C5 !important; }
84 - .another_category_color_violet th a.current{border-color:#9D64C5 !important;}
85 - .another_category_color_violet h4, .another_category_color_violet h4 a { color: #7E2CB5 !important; }
86 - </style>
87 </head> 44 </head>
88 45
89 <body id="tt-body-index" class="theme_blue"> 46 <body id="tt-body-index" class="theme_blue">
...@@ -116,12 +73,12 @@ lightbox.options.albumLabel = "%1 / %2"; ...@@ -116,12 +73,12 @@ lightbox.options.albumLabel = "%1 / %2";
116 <div class="slide_item"> 73 <div class="slide_item">
117 <div class="link_slide item-thumbnail" style="background-image:url('https://tistory4.daumcdn.net/tistory/1978677/skinCover/fcb080e7767a4941964dfee78420025e');"> 74 <div class="link_slide item-thumbnail" style="background-image:url('https://tistory4.daumcdn.net/tistory/1978677/skinCover/fcb080e7767a4941964dfee78420025e');">
118 <div class="text_slide thema_apply"> 75 <div class="text_slide thema_apply">
119 - <strong>PASS-PATH</strong> 76 + <strong>Pass-Path</strong>
120 <p class="text">여행지와 가고 싶은 장소만 선택하면<br> 77 <p class="text">여행지와 가고 싶은 장소만 선택하면<br>
121 경로가 자동으로 완성되는<br> 78 경로가 자동으로 완성되는<br>
122 쉽고 간편한 여행 경로 리커맨더</p> 79 쉽고 간편한 여행 경로 리커맨더</p>
123 - <a href="/pass" class="link_detail">경유지</a><br> 80 + <a href="/pass" class="link_detail">들를 곳 찾기</a><br>
124 - <a href="/near" class="link_detail">현재지</a> 81 + <a href="/near" class="link_detail">내 주변 장소</a>
125 </div> 82 </div>
126 </div> 83 </div>
127 </div> 84 </div>
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
6 <style> 6 <style>
7 body, html {height: 100%;} 7 body, html {height: 100%;}
8 .map_wrap, .map_wrap * {margin:0; padding:0;font-family:'Malgun Gothic',dotum,'돋움',sans-serif;font-size:12px;} 8 .map_wrap, .map_wrap * {margin:0; padding:0;font-family:'Malgun Gothic',dotum,'돋움',sans-serif;font-size:12px;}
9 -.map_wrap {position:relative;width:100%;height:100%;} 9 +.map_wrap {position:relative;width:100%;height:95%;}
10 -#category {position:absolute;top:10px;left:10px;border-radius: 5px; border:1px solid #909090;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);background: #fff;overflow: hidden;z-index: 2;} 10 +#category {position:absolute;top:30px;left:10px;border-radius: 5px; border:1px solid #909090;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);background: #fff;overflow: hidden;z-index: 2;}
11 -#category li {float:left;list-style: none;width:50px;px;border-right:1px solid #acacac;padding:6px 0;text-align: center; cursor: pointer;} 11 +#category li {float:left;list-style: none;width:50px;border-right:1px solid #acacac;padding:6px 0;text-align: center; cursor: pointer;}
12 #category li.on {background: #eee;} 12 #category li.on {background: #eee;}
13 #category li:hover {background: #ffe6e6;border-left:1px solid #acacac;margin-left: -1px;} 13 #category li:hover {background: #ffe6e6;border-left:1px solid #acacac;margin-left: -1px;}
14 #category li:last-child{margin-right:0;border-right:0;} 14 #category li:last-child{margin-right:0;border-right:0;}
...@@ -33,12 +33,20 @@ body, html {height: 100%;} ...@@ -33,12 +33,20 @@ body, html {height: 100%;}
33 .placeinfo .jibun {color:#999;font-size:11px;margin-top:0;} 33 .placeinfo .jibun {color:#999;font-size:11px;margin-top:0;}
34 </style> 34 </style>
35 </head> 35 </head>
36 -<body> 36 +<body style="background-color:#cccccc;">
37 -<p style="margin-top:-12px"> 37 + <header class="box_header" style="float:left; color: white;">
38 + <div style="font-size:22px;">
39 + <a href="/" title="Pass-Path" style="text-decoration:none; color:black; font-family: monospace;">
40 +
41 + Pass-Path
42 +
43 + </a>
44 + </div>
45 + </header>
46 +<p>&nbsp;&nbsp;깃발을 드래그하여 현재 위치를 설정한 후 카테고리를 설정해주세요.</p>
38 47
39 -</p>
40 <div class="map_wrap"> 48 <div class="map_wrap">
41 - <div id="map" style="width:100%;height:100%;position:relative;overflow:hidden;"></div> 49 + <div id="map" style="width:100%;height:95%;position:relative;overflow:hidden;"></div>
42 <ul id="category"> 50 <ul id="category">
43 <li id="BK9" data-order="0"> 51 <li id="BK9" data-order="0">
44 <span class="category_bg bank"></span> 52 <span class="category_bg bank"></span>
...@@ -67,7 +75,7 @@ body, html {height: 100%;} ...@@ -67,7 +75,7 @@ body, html {height: 100%;}
67 </ul> 75 </ul>
68 </div> 76 </div>
69 77
70 -<script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=비밀&libraries=services"></script> 78 +<script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=발급받은 APP KEY 입력&libraries=services"></script>
71 <script> 79 <script>
72 // 마커를 클릭했을 때 해당 장소의 상세정보를 보여줄 커스텀오버레이입니다 80 // 마커를 클릭했을 때 해당 장소의 상세정보를 보여줄 커스텀오버레이입니다
73 var placeOverlay = new kakao.maps.CustomOverlay({zIndex:1}), 81 var placeOverlay = new kakao.maps.CustomOverlay({zIndex:1}),
......
...@@ -3,13 +3,24 @@ ...@@ -3,13 +3,24 @@
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <title>Pass-Path</title> 5 <title>Pass-Path</title>
6 - <style>body, html {height: 100%;}</style> 6 + <style>
7 + body, html {height: 100%;}
8 + </style>
7 9
8 </head> 10 </head>
9 -<body> 11 +<body style="background-color:#cccccc;">
10 -<p>출발지와 도착지를 설정해주세요!</p> 12 + <header class="box_header" style="float:left; color: white;">
11 - 13 + <h1 class="title_logo">
12 -<button type="button" onclick="Search();">검색</button> 14 + <a href="/" title="Pass-Path" class="link_logo" style="text-decoration:none; color:black; font-family: monospace;">
15 +
16 + Pass-Path
17 +
18 + </a>
19 + </h1>
20 + </header>
21 +<p>&nbsp;&nbsp;출발지와 도착지 깃발을 드래그하여 설정</p>
22 +<div>&nbsp;&nbsp;
23 +<button type="button" onclick="Search();" style="background-color:#B5B5FF; font-family:Open Sans;">경로 주변 검색</button>
13 <script> 24 <script>
14 function Search(){ 25 function Search(){
15 var startx = startMarker.getPosition().getLat(); 26 var startx = startMarker.getPosition().getLat();
...@@ -18,12 +29,12 @@ ...@@ -18,12 +29,12 @@
18 var endy = arriveMarker.getPosition().getLng(); 29 var endy = arriveMarker.getPosition().getLng();
19 location.href ='/search?startx='+ startx +'&starty='+ starty +'&endx=' + endx + '&endy=' + endy; 30 location.href ='/search?startx='+ startx +'&starty='+ starty +'&endx=' + endx + '&endy=' + endy;
20 } 31 }
21 -</script> 32 +</script></div>
22 <div id="map" style="width:100%;height:90%;"></div> 33 <div id="map" style="width:100%;height:90%;"></div>
23 34
24 35
25 36
26 -<script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=비밀"></script> 37 +<script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=발급받은 APP KEY 입력"></script>
27 <script> 38 <script>
28 var mapContainer = document.getElementById('map'), // 지도를 표시할 div 39 var mapContainer = document.getElementById('map'), // 지도를 표시할 div
29 mapOption = { 40 mapOption = {
......
...@@ -3,12 +3,35 @@ ...@@ -3,12 +3,35 @@
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <title>검색 결과</title> 5 <title>검색 결과</title>
6 +
7 + <script type="text/javascript">
8 + var Request = function() {
9 + this.getParameter = function(name) {
10 + var rtnval = '';
11 + var nowAddress = unescape(location.href);
12 + var parameters = (nowAddress.slice(nowAddress.indexOf('?') + 1, nowAddress.length)).split('&');
13 + for (var i = 0; i < parameters.length; i++) {
14 + var varName = parameters[i].split('=')[0];
15 + if (varName.toUpperCase() == name.toUpperCase()) {
16 + rtnval = parameters[i].split('=')[1];
17 + break;
18 + }
19 + }
20 + return rtnval;
21 + }
22 + }
23 + var request = new Request();
24 + var startx = request.getParameter('startx');
25 + var starty = request.getParameter('starty');
26 + var endx = request.getParameter('endx');
27 + var endy = request.getParameter('endy');
28 + </script>
6 <style> 29 <style>
7 body, html {height: 100%;} 30 body, html {height: 100%;}
8 .map_wrap, .map_wrap * {margin:0; padding:0;font-family:'Malgun Gothic',dotum,'돋움',sans-serif;font-size:12px;} 31 .map_wrap, .map_wrap * {margin:0; padding:0;font-family:'Malgun Gothic',dotum,'돋움',sans-serif;font-size:12px;}
9 .map_wrap {position:relative;width:100%;height:100%;} 32 .map_wrap {position:relative;width:100%;height:100%;}
10 -#category {position:absolute;top:10px;left:10px;border-radius: 5px; border:1px solid #909090;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);background: #fff;overflow: hidden;z-index: 2;} 33 +#category {position:absolute;top:25px;left:10px;border-radius: 5px; border:1px solid #909090;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);background: #fff;overflow: hidden;z-index: 2;}
11 -#category li {float:left;list-style: none;width:50px;px;border-right:1px solid #acacac;padding:6px 0;text-align: center; cursor: pointer;} 34 +#category li {float:left;list-style: none;width:50px;border-right:1px solid #acacac;padding:6px 0;text-align: center; cursor: pointer;}
12 #category li.on {background: #eee;} 35 #category li.on {background: #eee;}
13 #category li:hover {background: #ffe6e6;border-left:1px solid #acacac;margin-left: -1px;} 36 #category li:hover {background: #ffe6e6;border-left:1px solid #acacac;margin-left: -1px;}
14 #category li:last-child{margin-right:0;border-right:0;} 37 #category li:last-child{margin-right:0;border-right:0;}
...@@ -34,7 +57,7 @@ body, html {height: 100%;} ...@@ -34,7 +57,7 @@ body, html {height: 100%;}
34 57
35 58
36 .map_wrap a, .map_wrap a:hover, .map_wrap a:active{color:#000;text-decoration: none;} 59 .map_wrap a, .map_wrap a:hover, .map_wrap a:active{color:#000;text-decoration: none;}
37 -#menu_wrap {position:absolute;top:0;left:1600px;bottom:0;width:250px;margin:10px 0 30px 10px;padding:5px;overflow-y:auto;background:rgba(255, 255, 255, 0.7);z-index: 1;font-size:12px;border-radius: 10px;} 60 +#menu_wrap {position:absolute;top:10px;left:1500px;bottom:70px;width:300px;margin:10px 0 30px 10px;padding:5px;overflow-y:auto;background:rgba(255, 255, 255, 0.7);z-index: 1;font-size:12px;border-radius: 10px;}
38 .bg_white {background:#fff;} 61 .bg_white {background:#fff;}
39 #placesList li {list-style: none;} 62 #placesList li {list-style: none;}
40 #placesList .item {position:relative;border-bottom:1px solid #888;overflow: hidden;cursor: pointer;min-height: 65px;} 63 #placesList .item {position:relative;border-bottom:1px solid #888;overflow: hidden;cursor: pointer;min-height: 65px;}
...@@ -65,10 +88,68 @@ body, html {height: 100%;} ...@@ -65,10 +88,68 @@ body, html {height: 100%;}
65 #pagination .on {font-weight: bold; cursor: default;color:#777;} 88 #pagination .on {font-weight: bold; cursor: default;color:#777;}
66 </style> 89 </style>
67 </head> 90 </head>
68 -<body> 91 +<body style="background-color:#cccccc;">
92 + <header class="box_header" style="float:left">
93 + <h1 class="title_logo">
94 + <a href="/" title="Pass-Path" class="link_logo" style="text-decoration:none; color:black; font-family: monospace;">
95 +
96 + Pass-Path
97 +
98 + </a>
99 + </h1>
100 + </header>
101 + <script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=발급받은 APP KEY 입력&libraries=services"></script>
102 + <div style="float:left">&nbsp;&nbsp;출발지 :&nbsp;</div><div id="start"></div>
103 + <script>
104 + var geocoder = new kakao.maps.services.Geocoder();
105 + var startcallback = function(result, status) {
106 + if (status === kakao.maps.services.Status.OK) {
107 + document.getElementById("start").innerHTML = result[0].address.address_name;
108 + }
109 + };
110 + geocoder.coord2Address(starty, startx, startcallback);
111 + </script>
112 +
113 + <div style="float:left">&nbsp;&nbsp;도착지 :&nbsp;</div><div id="end"></div>
114 + <script>
115 + var endcallback = function(result, status) {
116 + if (status === kakao.maps.services.Status.OK) {
117 + document.getElementById("end").innerHTML = result[0].address.address_name;
118 + }
119 + };
120 + geocoder.coord2Address(endy, endx, endcallback);
121 + </script>
122 +
123 + <div style="float:left">&nbsp;&nbsp;경유지 :&nbsp;</div><div id="pass1" style="float:left">경유지를 선택해주세요.(최대 5개) 선택하지 않아도 경로찾기는 가능합니다.</div><div id="pass2" style="float:left"></div><div id="pass3" style="float:left"></div>
124 + <div id="pass4" style="float:left"></div><div id="pass5" style="float:left"></div>
69 125
126 +
127 + <br>&nbsp;&nbsp;<button type="button" onclick="Search();" style="background-color:#B5B5FF;">경로 탐색</button>
128 + <script>
129 + function Search(){
130 + location.href = 'http://map.naver.com/v5/directions/'+starty+','+startx+'/'+endy+','+endx+'/'+ passcount() +'/car?c';
131 + }
132 + function passcount(){
133 + var passstr0 = '-';
134 + var passstr = '';
135 + for (var i = 0; i < passx.length; i++) {
136 + if (i == 0) {
137 + passstr = passy[i] + ',' + passx[i];
138 + }
139 + else{
140 + passstr = passstr + ':' + passy[i] + ',' + passx[i];
141 + }
142 + }
143 + if (passx.length == 0){
144 + return passstr0;
145 + }
146 + else{
147 + return passstr;
148 + }
149 + }
150 + </script>
70 <div class="map_wrap"> 151 <div class="map_wrap">
71 - <div id="map" style="width:100%;height:100%;position:relative;overflow:hidden;"></div> 152 + <div id="map" style="width:100%;height:90%;position:relative;overflow:hidden;"></div>
72 <ul id="category"> 153 <ul id="category">
73 <li id="AT4" data-order="0"> 154 <li id="AT4" data-order="0">
74 <span class="category_bg oil"></span> 155 <span class="category_bg oil"></span>
...@@ -93,28 +174,11 @@ body, html {height: 100%;} ...@@ -93,28 +174,11 @@ body, html {height: 100%;}
93 <div id="pagination"></div> 174 <div id="pagination"></div>
94 </div> 175 </div>
95 </div> 176 </div>
96 -<script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=비밀&libraries=services"></script> 177 +
97 <script> 178 <script>
98 -var Request = function() { 179 +
99 - this.getParameter = function(name) { 180 +var passx = [];
100 - var rtnval = ''; 181 +var passy = [];
101 - var nowAddress = unescape(location.href);
102 - var parameters = (nowAddress.slice(nowAddress.indexOf('?') + 1, nowAddress.length)).split('&');
103 - for (var i = 0; i < parameters.length; i++) {
104 - var varName = parameters[i].split('=')[0];
105 - if (varName.toUpperCase() == name.toUpperCase()) {
106 - rtnval = parameters[i].split('=')[1];
107 - break;
108 - }
109 - }
110 - return rtnval;
111 - }
112 - }
113 -var request = new Request();
114 -var startx = request.getParameter('startx');
115 -var starty = request.getParameter('starty');
116 -var endx = request.getParameter('endx');
117 -var endy = request.getParameter('endy');
118 182
119 var sw = new kakao.maps.LatLng(startx, endy), 183 var sw = new kakao.maps.LatLng(startx, endy),
120 ne = new kakao.maps.LatLng(endx, starty); 184 ne = new kakao.maps.LatLng(endx, starty);
...@@ -138,6 +202,7 @@ var map = new kakao.maps.Map(mapContainer, mapOption); ...@@ -138,6 +202,7 @@ var map = new kakao.maps.Map(mapContainer, mapOption);
138 // 장소 검색 객체를 생성합니다 202 // 장소 검색 객체를 생성합니다
139 var ps = new kakao.maps.services.Places(); 203 var ps = new kakao.maps.services.Places();
140 204
205 +
141 // 지도에 idle 이벤트를 등록합니다 206 // 지도에 idle 이벤트를 등록합니다
142 kakao.maps.event.addListener(map, 'idle', searchPlaces); 207 kakao.maps.event.addListener(map, 'idle', searchPlaces);
143 208
...@@ -215,7 +280,7 @@ function displayPlaces(places) { ...@@ -215,7 +280,7 @@ function displayPlaces(places) {
215 var placePosition = new kakao.maps.LatLng(places[i].y, places[i].x); 280 var placePosition = new kakao.maps.LatLng(places[i].y, places[i].x);
216 281
217 // 마커를 생성하고 지도에 표시합니다 282 // 마커를 생성하고 지도에 표시합니다
218 - var marker = addMarker(placePosition, order); 283 + var marker = addMarker(placePosition, i);
219 var itemEl = getListItem(i, places[i]); 284 var itemEl = getListItem(i, places[i]);
220 // 마커와 검색결과 항목을 클릭 했을 때 285 // 마커와 검색결과 항목을 클릭 했을 때
221 // 장소정보를 표출하도록 클릭 이벤트를 등록합니다 286 // 장소정보를 표출하도록 클릭 이벤트를 등록합니다
...@@ -233,9 +298,7 @@ function displayPlaces(places) { ...@@ -233,9 +298,7 @@ function displayPlaces(places) {
233 function getListItem(index, places) { 298 function getListItem(index, places) {
234 299
235 var el = document.createElement('li'), 300 var el = document.createElement('li'),
236 - itemStr = '<span class="markerbg marker_' + (index+1) + '"></span>' + 301 + itemStr = '<span class="markerbg marker_' + (index+1) + '"></span>' + '<div class="info">' + ' <h5>' + places.place_name + '</h5>';
237 - '<div class="info">' +
238 - ' <h5>' + places.place_name + '</h5>';
239 302
240 if (places.road_address_name) { 303 if (places.road_address_name) {
241 itemStr += ' <span>' + places.road_address_name + '</span>' + 304 itemStr += ' <span>' + places.road_address_name + '</span>' +
...@@ -245,8 +308,7 @@ function getListItem(index, places) { ...@@ -245,8 +308,7 @@ function getListItem(index, places) {
245 itemStr += ' <span>' + places.address_name + '</span>'; 308 itemStr += ' <span>' + places.address_name + '</span>';
246 } 309 }
247 310
248 - itemStr += ' <span class="tel">' + places.phone + '</span>' + 311 + itemStr += ' <span class="tel">' + places.phone + '</span>' + '<button type="button" onclick="passclick(' + places.x +',' + places.y + '); ">경유지로 추가</button>' + '</div>';
249 - '</div>';
250 312
251 el.innerHTML = itemStr; 313 el.innerHTML = itemStr;
252 el.className = 'item'; 314 el.className = 'item';
...@@ -254,14 +316,28 @@ function getListItem(index, places) { ...@@ -254,14 +316,28 @@ function getListItem(index, places) {
254 return el; 316 return el;
255 } 317 }
256 318
319 +function passclick(x, y) {
320 + passx.push(y);
321 + passy.push(x);
322 + var passcallback = function(result, status) {
323 + if (status === kakao.maps.services.Status.OK) {
324 + document.getElementById("pass"+i).innerHTML = result[0].address.address_name + ',&nbsp;';
325 + }
326 + };
327 + for ( var i = 0; i < passx.length; i++ ){
328 + geocoder.coord2Address(passy[i], passx[i], passcallback);
329 + }
330 +
331 + }
332 +
257 // 마커를 생성하고 지도 위에 마커를 표시하는 함수입니다 333 // 마커를 생성하고 지도 위에 마커를 표시하는 함수입니다
258 -function addMarker(position, order) { 334 +function addMarker(position, idx, title) {
259 - var imageSrc = 'https://t1.daumcdn.net/localimg/localimages/07/mapapidoc/places_category.png', // 마커 이미지 url, 스프라이트 이미지를 씁니다 335 + var imageSrc = 'https://t1.daumcdn.net/localimg/localimages/07/mapapidoc/marker_number_blue.png', // 마커 이미지 url, 스프라이트 이미지를 씁니다
260 - imageSize = new kakao.maps.Size(27, 28), // 마커 이미지의 크기 336 + imageSize = new kakao.maps.Size(36, 37), // 마커 이미지의 크기
261 imgOptions = { 337 imgOptions = {
262 - spriteSize : new kakao.maps.Size(72, 208), // 스프라이트 이미지의 크기 338 + spriteSize : new kakao.maps.Size(36, 694), // 스프라이트 이미지의 크기
263 - spriteOrigin : new kakao.maps.Point(46, (order*36)), // 스프라이트 이미지 중 사용할 영역의 좌상단 좌표 339 + spriteOrigin : new kakao.maps.Point(0, (idx*46)+10), // 스프라이트 이미지 중 사용할 영역의 좌상단 좌표
264 - offset: new kakao.maps.Point(11, 28) // 마커 좌표에 일치시킬 이미지 내에서의 좌표 340 + offset: new kakao.maps.Point(13,37) // 마커 좌표에 일치시킬 이미지 내에서의 좌표
265 }, 341 },
266 markerImage = new kakao.maps.MarkerImage(imageSrc, imageSize, imgOptions), 342 markerImage = new kakao.maps.MarkerImage(imageSrc, imageSize, imgOptions),
267 marker = new kakao.maps.Marker({ 343 marker = new kakao.maps.Marker({
...@@ -394,5 +470,6 @@ function changeCategoryClass(el) { ...@@ -394,5 +470,6 @@ function changeCategoryClass(el) {
394 } 470 }
395 } 471 }
396 </script> 472 </script>
473 +<script>AT4.click();</script>
397 </body> 474 </body>
398 </html> 475 </html>
...\ No newline at end of file ...\ No newline at end of file
......