1/** 2 * Googlemap 3 */ 4 5// ã¯ã©ã¹ 6var googlemap = function() { 7 8 // ãããã㣠9 this.map = null; 10 this.gmarker = new Array(); 11 this.infoWin = null; 12 this.dispId = dispId; 13 this.pCenter = pCenter; 14 this.zoomLv = zoomLv; 15 this.isOpenFuki = isOpenFuki; 16 this.isDispFuki = isDispFuki; 17 this.intDispFuki = intDispFuki; 18 this.isPolyline = isPolyline; 19 this.isScrollWheel = isScrollWheel; 20 this.isMapTypeControl = isMapTypeControl; 21 this.points = points; 22 this.htmls = htmls; 23 this.icons = icons; 24 this.lines = lines; 25 this.mapType = mapType; 26 this.isZoomControl = isZoomControl; 27 this.isStreetViewControl = isStreetViewControl; 28 this.isPanControl = isPanControl; 29 this.ctrlDispPosition = ctrlDispPosition; 30 this.isStyle = isStyle; 31 this.style = style; 32 33 // ããã表示 34 this.setMap = function() { 35 // ãã¿ã³è¡¨ç¤ºä½ç½® 36 ctrlPosition = {position:this.ctrlDispPosition}; 37 // ã¹ã¿ã¤ã« 38 mapStyles = []; 39 if( this.isStyle ) { 40 mapStyles = this.style; 41 var myOptions = { 42 zoom: this.zoomLv, 43 center: this.pCenter, 44 mapTypeId: this.mapType, 45 scrollwheel: this.isScrollWheel, 46 mapTypeControl: this.isMapTypeControl, 47 zoomControl: this.isZoomControl, 48 zoomControlOptions: ctrlPosition, 49 streetViewControl: this.isStreetViewControl, 50 streetViewControlOptions: ctrlPosition, 51 panControl: this.isPanControl, 52 panControlOptions: ctrlPosition, 53 styles: mapStyles 54 }; 55 } 56 else { 57 var myOptions = { 58 zoom: this.zoomLv, 59 center: this.pCenter, 60 mapTypeId: this.mapType, 61 scrollwheel: this.isScrollWheel, 62 mapTypeControl: this.isMapTypeControl, 63 zoomControl: this.isZoomControl, 64 zoomControlOptions: ctrlPosition, 65 streetViewControl: this.isStreetViewControl, 66 streetViewControlOptions: ctrlPosition, 67 panControl: this.isPanControl, 68 panControlOptions: ctrlPosition 69 }; 70 } 71 72 this.map = new google.maps.Map(document.getElementById(this.dispId), myOptions); 73 74 // ãã¼ã«ã¼è¡¨ç¤º 75 for(i = 0; i < points.length; i++) { 76 this.gmarker[i] = new google.maps.Marker({ 77 position: this.points[i], 78 map: this.map, 79 icon: this.icons[i] 80 }); 81 82 // ã¤ãã³ãè¨å® 83 if(this.isOpenFuki) { 84 this.setFukiClick(this.gmarker[i], this.htmls[i], this.points[i]); 85 } 86 } 87 88 // åæå¹ãåºã表示 89 if(this.isDispFuki) { 90 setFukiMsg(this.gmarker[this.intDispFuki], this.htmls[this.intDispFuki]); 91 } 92 93 // ããªã©ã¤ã³è¡¨ç¤º 94 if(this.isPolyline) { 95 for(i = 0; i < this.lines.length; i++) { 96 this.setPolyline(this.lines[i]); 97 } 98 } 99 } 100 101 // å¹ãåºãã¡ãã»ã¼ã¸è¨å® 102 var setFukiMsg = function(marker, html) { 103 if(this.infoWin) { 104 // å¹ãåºãéãã 105 this.infoWin.close(); 106 this.infoWin = null; 107 } 108 109 this.infoWin = new google.maps.InfoWindow({ 110 content: html 111 }); 112 113 // å¹ãåºã表示 114 this.infoWin.open(marker.getMap(), marker); 115 } 116 117 // ã¯ãªãã¯ã¤ãã³ãè¨å® 118 this.setFukiClick = function(marker, html, point) { 119 google.maps.event.addListener(marker, 'click', function(event){ 120 setFukiMsg(marker, html); 121 this.map.panTo(point); 122 }); 123 } 124 125 // ã¢ã¤ã³ã³ã¯ãªã㯠126 this.myclick = function(i) { 127 setFukiMsg(this.gmarker[i], this.htmls[i]); 128 this.map.panTo(this.points[i]); 129 } 130 131 // ããªã©ã¤ã³è¡¨ç¤º 132 this.setPolyline = function(line) { 133 var rendererOptions = { 134 draggable: false, 135 preserveViewport:true 136 }; 137 // ã©ã¤ã³ã®ãªãã·ã§ã³ 138 var polyLineOptions = { 139 strokeColor: line['color'] 140 }; 141 var directionsDisplay = new google.maps.DirectionsRenderer({ 142 polylineOptions: { 143 strokeColor: line['color'], 144 strokeWeight: 4, 145 strokeOpacity: 0.6 146 } 147 }); 148 directionsDisplay.setOptions({ 149 suppressMarkers :true, 150 suppressInfoWindows: true 151 }); 152 var directionsService = new google.maps.DirectionsService(); 153 154 // ä¸éå°ç¹ 155 arrWays = new Array(); 156 157 for(y = 0; y < line['ways'].length; y++) { 158 arrWays[y] = {location: line['ways'][y]}; 159 } 160 161 var request = { 162 origin: line['start'], 163 destination: line['end'], 164 waypoints: arrWays, 165 travelMode: google.maps.DirectionsTravelMode.DRIVING, //ãã©ã¤ãã³ã°ã¢ã¼ãæå®ï¼è»ï¼ 166 unitSystem: google.maps.DirectionsUnitSystem.METRIC, //åä½km表示 167 optimizeWaypoints: true, //æé©åãããæçè·é¢ã«ããã 168 avoidHighways: false, //trueã§é«ééè·¯ã使ç¨ããªã 169 avoidTolls: false //trueã§ææéè·¯ã使ç¨ããªã 170 }; 171 172 directionsService.route(request, function(response, status){ 173 if (status == google.maps.DirectionsStatus.OK){ 174 directionsDisplay.setDirections(response); 175 } 176 }); 177 178 directionsDisplay.setMap(this.map); 179 } 180
181 // ãºã¼ã ã¤ã³ 182 this.setZoomIn = function(){ 183 this.map.setZoom( this.map.getZoom()+1 ); 184 } 185 186 // ãºã¼ã ã¢ã¦ã 187 this.setZoomOut = function(){ 188 this.map.setZoom( this.map.getZoom()-1 ); 189 } 190}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.