PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/com/google/maps/extras/utils/MapUtils.as

http://gmaps-utility-library-flash.googlecode.com/
ActionScript | 23 lines | 20 code | 3 blank | 0 comment | 3 complexity | fc56664b0ab2df13233e990ec4450b0a MD5 | raw file
 1package com.google.maps.extras.utils
 2{
 3import com.google.maps.LatLng;
 4import com.google.maps.LatLngBounds;
 5import com.google.maps.interfaces.IMap;
 6
 7public class MapUtils
 8{
 9	public function MapUtils()
10	{
11	}
12
13	public static function autoCenterZoom(map:IMap, latlngs:Array):void{
14		
15		var bounds:LatLngBounds = new LatLngBounds();
16		for each(var latlng:LatLng in latlngs){
17			if(latlng == null) continue;
18			bounds.extend(latlng);
19		}
20		map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
21	}
22}
23}