/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
- package com.google.maps.extras.utils
- {
- import com.google.maps.LatLng;
- import com.google.maps.LatLngBounds;
- import com.google.maps.interfaces.IMap;
-
- public class MapUtils
- {
- public function MapUtils()
- {
- }
-
- public static function autoCenterZoom(map:IMap, latlngs:Array):void{
-
- var bounds:LatLngBounds = new LatLngBounds();
- for each(var latlng:LatLng in latlngs){
- if(latlng == null) continue;
- bounds.extend(latlng);
- }
- map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
- }
- }
- }