/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

  1. package com.google.maps.extras.utils
  2. {
  3. import com.google.maps.LatLng;
  4. import com.google.maps.LatLngBounds;
  5. import com.google.maps.interfaces.IMap;
  6. public class MapUtils
  7. {
  8. public function MapUtils()
  9. {
  10. }
  11. public static function autoCenterZoom(map:IMap, latlngs:Array):void{
  12. var bounds:LatLngBounds = new LatLngBounds();
  13. for each(var latlng:LatLng in latlngs){
  14. if(latlng == null) continue;
  15. bounds.extend(latlng);
  16. }
  17. map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
  18. }
  19. }
  20. }