//------------------------ // 스트리트 뷰 관련 변수 //------------------------ var sv_debug = false; var sv_client = null; var sv_marker = null; var sv_overlay = null; var sv_panorama = null; var sv_infowin_help = '' +arr_lang['1063'] // 스트리트 뷰 아이콘을 파란색 부분으로 이동시켜 주세요. +'
'+arr_lang['1062'] // 지도 위에 파란색으로 표시된 부분만 스트리트 뷰가 지원됩니다. +'

' +''+arr_lang['825']+' - ' // 지도 확대 +''+arr_lang['826']+'' // 지도 축소 ''; //-------------------------- // 스트리트 뷰 버튼 컨트롤 //-------------------------- function StreetviewControl() {} StreetviewControl.prototype = new GControl(); StreetviewControl.prototype.initialize = function(map) { var me = this; this.container = document.createElement("div"); this.container.style.border = "1px solid #000"; this.div = document.createElement("div"); this.div.className = 'gbutton'; this.container.appendChild(this.div); this.div.appendChild(document.createTextNode(arr_lang['1043'])); // 스트리트 뷰 GEvent.addDomListener(this.div, "click", function() { me.div.style.fontWeight = (me.div.style.fontWeight == 'bold') ? 'normal' : 'bold'; streetview_control_click(); }); map.getContainer().appendChild(this.container); if(!sv_client) sv_client = new GStreetviewClient(); return this.container; } StreetviewControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(258,7)); } //--------------------------- // 스트리트 뷰 버튼 클릭 시 //--------------------------- function streetview_control_click() { if(sv_overlay) { map.removeOverlay(sv_overlay); // 오버레이 제거 sv_overlay = null; } else { sv_overlay = new GStreetviewOverlay(); // 오버레이 등록 map.addOverlay(sv_overlay); } if(sv_marker) { map.removeOverlay(sv_marker); // 마커 제거 sv_marker = null; } else { var guyIcon = new GIcon(G_DEFAULT_ICON); guyIcon.image = 'http://maps.gstatic.com/mapfiles/cb/man_arrow-0.png'; guyIcon.transparent = 'http://maps.gstatic.com/mapfiles/cb/man-pick.png'; guyIcon.imageMap = [26,13,30,14,32,28,27,28,28,36,18,35,18,27,16,26,16,20,16,14,19,13,22,8]; guyIcon.iconSize = new GSize(49,52); guyIcon.iconAnchor = new GPoint(25,35); // near base of guy's feet guyIcon.infoWindowAnchor = new GPoint(25,5); // top of guy's head /* var p = map.fromLatLngToDivPixel(map.getBounds().getNorthEast()); p.x -= 100; p.y += 100; var ll = map.fromDivPixelToLatLng(p); */ var ll = map.getCenter(); sv_marker = new GMarker(ll, {icon:guyIcon,draggable:true,bouncy:false,zIndexProcess:orderOfCreation}); map.addOverlay(sv_marker); GEvent.addListener(sv_marker, 'dragstart', function() { if(sv_panorama) { sv_panorama.remove(); sv_panorama = null; if(sv_debug) GLog.write('sv_panorama.remove();'); } map.closeInfoWindow(); }); GEvent.addListener(sv_marker, 'dragend', sv_marker_dragend); sv_marker.openInfoWindowHtml(sv_infowin_help); // 스트리트 뷰 도움말 } } function orderOfCreation(marker,b) { // http://econym.org.uk/gmap/zindex.htm return 1; } //----------------------------------- // 스트리트 뷰 마커 드래그엔드 처리 //----------------------------------- function sv_marker_dragend() { sv_client.getNearestPanorama(sv_marker.getLatLng(), function(response) { if(response.code == 200) { var ll = new GLatLng(response.Location.lat, response.Location.lng); sv_marker.setLatLng(ll); open_streetview_infowin(); } else { sv_marker.openInfoWindowHtml(sv_infowin_help); // 스트리트 뷰 도움말 } }); } //-------------------------------------------------- // 스트리트 뷰 마커 인포윈도우에 스트리트 뷰 출력 //-------------------------------------------------- function open_streetview_infowin() { sv_marker.openInfoWindowHtml('
'); var node = document.getElementById('infowin_pano'); if(sv_panorama == null) { if(sv_debug) GLog.write('new GStreetviewPanorama();'); sv_panorama = new GStreetviewPanorama(node); GEvent.addListener(sv_panorama, 'error', function(errorCode) { if (errorCode == 603) { //------------------------------ // 플래쉬 플러그인 미설치 에러 //------------------------------ var s = arr_lang['1069']; // 아래 링크를 클릭해서 플래쉬 플러그인을 설치해 주세요. s += '

» Download'; node.innerHTML = s; } }); GEvent.addListener(sv_panorama, "yawchanged", function(newYaw) { var GUY_NUM_ICONS = 16; var GUY_ANGULAR_RES = 360/GUY_NUM_ICONS; if (newYaw < 0) newYaw += 360; guyImageNum = Math.round(newYaw/GUY_ANGULAR_RES) % GUY_NUM_ICONS; guyImageUrl = "http://maps.gstatic.com/mapfiles/cb/man_arrow-" + guyImageNum + ".png"; sv_marker.setImage(guyImageUrl); }); } sv_panorama.setLocationAndPOV(sv_marker.getLatLng()); /* var latlng = sv_marker.getLatLng(); var lat = latlng.lat(); var lng = latlng.lng(); var html = ''; html += ''; sv_marker.openInfoWindowHtml(html); */ }