Changeset 354

Show
Ignore:
Timestamp:
10/24/07 09:54:03 (1 year ago)
Author:
tom
Message:

added methods for modifying MapExtent?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/as3/lib/com/modestmaps/core/MapExtent.as

    r292 r354  
    1717                public var west:Number; 
    1818                 
     19                /** Creates a new MapExtent from the given String. 
     20                 * @param str "north, south, east, west" 
     21                 * @return a new MapExtent from the given string */ 
    1922                public static function fromString(str:String):MapExtent 
    2023                { 
     
    2629                } 
    2730 
     31                /** @param n the most northerly latitude 
     32                 *  @param s the southern latitude 
     33                 *  @param e the eastern-most longitude 
     34                 *  @param w the westest longitude */ 
    2835                public function MapExtent(n:Number=0, s:Number=0, e:Number=0, w:Number=0) 
    2936                { 
     
    3239                        east = e; 
    3340                        west = w; 
     41                } 
     42                 
     43                /** enlarges this extent so that the given extent is inside it */ 
     44                public function encloseExtent(extent:MapExtent):void 
     45                { 
     46                    north = Math.max(extent.north, north); 
     47                    south = Math.min(extent.south, south); 
     48                    east = Math.max(extent.east, east); 
     49                    west = Math.min(extent.west, west);              
     50                } 
     51                 
     52                /** enlarges this extent so that the given location is inside it */ 
     53                public function enclose(location:Location):void 
     54                { 
     55                    north = Math.max(location.lat, north); 
     56                    south = Math.min(location.lat, south); 
     57                    east = Math.max(location.lon, east); 
     58                    west = Math.min(location.lon, west); 
    3459                } 
    3560                 
     
    78103                } 
    79104                 
     105                /** @return "north, south, east, west" */ 
    80106                public function toString():String 
    81107                {