Changeset 286
- Timestamp:
- 05/22/07 12:49:59 (1 year ago)
- Files:
-
- branches/AS3 (deleted)
- tags/branch-AS3 (deleted)
- tags/merge-trunk:205-to-AS3-branch (deleted)
- trunk/as2/lib/com/modestmaps/core/Bounds.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/core/ImageContainer.as (deleted)
- trunk/as2/lib/com/modestmaps/core/MapExtent.as (copied) (copied from branches/AS3/as2/lib/com/modestmaps/core/MapExtent.as)
- trunk/as2/lib/com/modestmaps/core/MapPosition.as (copied) (copied from branches/AS3/as2/lib/com/modestmaps/core/MapPosition.as)
- trunk/as2/lib/com/modestmaps/core/Marker.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/core/MarkerClip.as (copied) (copied from branches/AS3/as2/lib/com/modestmaps/core/MarkerClip.as)
- trunk/as2/lib/com/modestmaps/core/Point.as (deleted)
- trunk/as2/lib/com/modestmaps/core/Tile.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/core/TileGrid.as (modified) (3 diffs)
- trunk/as2/lib/com/modestmaps/geo/AbstractProjection.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/geo/IProjection.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/geo/LinearProjection.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/geo/MercatorProjection.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/geo/Transformation.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/Map.as (modified) (15 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/AbstractMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/google/GoogleHybridMapProvider.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/mapproviders/MapProviderFactory.as (deleted)
- trunk/as2/lib/com/modestmaps/mapproviders/MapProviders.as (deleted)
- trunk/as2/lib/com/modestmaps/mapproviders/VanillaMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/yahoo/YahooAerialMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/yahoo/YahooHybridMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/yahoo/YahooRoadMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/SampleClient1.as (modified) (6 diffs)
- trunk/as2/lib/SampleMarker.as (copied) (copied from branches/AS3/as2/lib/SampleMarker.as)
- trunk/as3 (copied) (copied from branches/AS3/as3)
- trunk/as3/google_version.xml (copied) (copied from branches/AS3/as3/google_version.xml)
- trunk/as3/lib (copied) (copied from branches/AS3/as3/lib)
- trunk/as3/lib/com (copied) (copied from branches/AS3/as3/lib/com)
- trunk/as3/lib/com/bigspaceship (copied) (copied from branches/AS3/as3/lib/com/bigspaceship)
- trunk/as3/lib/com/bigspaceship/utils (copied) (copied from branches/AS3/as3/lib/com/bigspaceship/utils)
- trunk/as3/lib/com/bigspaceship/utils/Delegate.as (copied) (copied from branches/AS3/as3/lib/com/bigspaceship/utils/Delegate.as)
- trunk/as3/lib/com/modestmaps (copied) (copied from branches/AS3/as3/lib/com/modestmaps)
- trunk/as3/lib/com/modestmaps/core (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core)
- trunk/as3/lib/com/modestmaps/core/Bounds.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/Bounds.as)
- trunk/as3/lib/com/modestmaps/core/Coordinate.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/Coordinate.as)
- trunk/as3/lib/com/modestmaps/core/MapExtent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/MapExtent.as)
- trunk/as3/lib/com/modestmaps/core/MapPosition.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/MapPosition.as)
- trunk/as3/lib/com/modestmaps/core/Marker.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/Marker.as)
- trunk/as3/lib/com/modestmaps/core/MarkerSet.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/MarkerSet.as)
- trunk/as3/lib/com/modestmaps/core/Tile.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/Tile.as)
- trunk/as3/lib/com/modestmaps/core/TileGrid.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/TileGrid.as)
- trunk/as3/lib/com/modestmaps/core/TilePaintCall.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/core/TilePaintCall.as)
- trunk/as3/lib/com/modestmaps/events (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events)
- trunk/as3/lib/com/modestmaps/events/MapEvent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events/MapEvent.as)
- trunk/as3/lib/com/modestmaps/events/MapProviderEvent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events/MapProviderEvent.as)
- trunk/as3/lib/com/modestmaps/events/MarkerEvent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events/MarkerEvent.as)
- trunk/as3/lib/com/modestmaps/events/ThrottledRequestErrorEvent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events/ThrottledRequestErrorEvent.as)
- trunk/as3/lib/com/modestmaps/events/ThrottledRequestEvent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events/ThrottledRequestEvent.as)
- trunk/as3/lib/com/modestmaps/events/TilePaintEvent.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/events/TilePaintEvent.as)
- trunk/as3/lib/com/modestmaps/flex (copied) (copied from branches/AS3/as3/lib/com/modestmaps/flex)
- trunk/as3/lib/com/modestmaps/flex/Map.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/flex/Map.as)
- trunk/as3/lib/com/modestmaps/geo (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo)
- trunk/as3/lib/com/modestmaps/geo/AbstractProjection.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo/AbstractProjection.as)
- trunk/as3/lib/com/modestmaps/geo/IProjection.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo/IProjection.as)
- trunk/as3/lib/com/modestmaps/geo/LinearProjection.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo/LinearProjection.as)
- trunk/as3/lib/com/modestmaps/geo/Location.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo/Location.as)
- trunk/as3/lib/com/modestmaps/geo/MercatorProjection.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo/MercatorProjection.as)
- trunk/as3/lib/com/modestmaps/geo/Transformation.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/geo/Transformation.as)
- trunk/as3/lib/com/modestmaps/io (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io)
- trunk/as3/lib/com/modestmaps/io/IRequest.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io/IRequest.as)
- trunk/as3/lib/com/modestmaps/io/LoadMovieThrottledRequest.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io/LoadMovieThrottledRequest.as)
- trunk/as3/lib/com/modestmaps/io/MapProviderPaintThrottledRequest.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io/MapProviderPaintThrottledRequest.as)
- trunk/as3/lib/com/modestmaps/io/RequestThrottler.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io/RequestThrottler.as)
- trunk/as3/lib/com/modestmaps/io/ThrottledRequest.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io/ThrottledRequest.as)
- trunk/as3/lib/com/modestmaps/io/XmlThrottledRequest.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/io/XmlThrottledRequest.as)
- trunk/as3/lib/com/modestmaps/Map.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/Map.as)
- trunk/as3/lib/com/modestmaps/mapproviders (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders)
- trunk/as3/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/AbstractMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/AbstractMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/BlueMarbleMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/BlueMarbleMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/google (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/google)
- trunk/as3/lib/com/modestmaps/mapproviders/google/AbstractGoogleMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/google/AbstractGoogleMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/google/GoogleAerialMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/google/GoogleAerialMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/google/GoogleHybridMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/google/GoogleHybridMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/google/GoogleRoadMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/google/GoogleRoadMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/IMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/IMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/microsoft (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/microsoft)
- trunk/as3/lib/com/modestmaps/mapproviders/microsoft/AbstractMicrosoftMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/microsoft/AbstractMicrosoftMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/microsoft/MicrosoftAerialMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/microsoft/MicrosoftAerialMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/microsoft/MicrosoftHybridMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/microsoft/MicrosoftHybridMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/microsoft/MicrosoftRoadMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/microsoft/MicrosoftRoadMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/OpenStreetMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/OpenStreetMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/VanillaMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/VanillaMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/yahoo (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/yahoo)
- trunk/as3/lib/com/modestmaps/mapproviders/yahoo/AbstractYahooMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/yahoo/AbstractYahooMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/yahoo/YahooAerialMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/yahoo/YahooAerialMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/yahoo/YahooHybridMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/yahoo/YahooHybridMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/yahoo/YahooOverlayMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/yahoo/YahooOverlayMapProvider.as)
- trunk/as3/lib/com/modestmaps/mapproviders/yahoo/YahooRoadMapProvider.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/mapproviders/yahoo/YahooRoadMapProvider.as)
- trunk/as3/lib/com/modestmaps/util (copied) (copied from branches/AS3/as3/lib/com/modestmaps/util)
- trunk/as3/lib/com/modestmaps/util/BinaryUtil.as (copied) (copied from branches/AS3/as3/lib/com/modestmaps/util/BinaryUtil.as)
- trunk/as3/lib/com/stamen (copied) (copied from branches/AS3/as3/lib/com/stamen)
- trunk/as3/lib/com/stamen/twisted (copied) (copied from branches/AS3/as3/lib/com/stamen/twisted)
- trunk/as3/lib/com/stamen/twisted/Deferred.as (copied) (copied from branches/AS3/as3/lib/com/stamen/twisted/Deferred.as)
- trunk/as3/lib/com/stamen/twisted/DelayedCall.as (copied) (copied from branches/AS3/as3/lib/com/stamen/twisted/DelayedCall.as)
- trunk/as3/lib/com/stamen/twisted/Reactor.as (copied) (copied from branches/AS3/as3/lib/com/stamen/twisted/Reactor.as)
- trunk/as3/lib/ModestMapsSample.as (copied) (copied from branches/AS3/as3/lib/ModestMapsSample.as)
- trunk/as3/SampleClient.as (copied) (copied from branches/AS3/as3/SampleClient.as)
- trunk/as3/SampleFlexClient.mxml (copied) (copied from branches/AS3/as3/SampleFlexClient.mxml)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/as2/lib/com/modestmaps/core/Bounds.as
r15 r286 1 import com.modestmaps.core.Point;1 import flash.geom.Point; 2 2 3 3 class com.modestmaps.core.Bounds trunk/as2/lib/com/modestmaps/core/Marker.as
r125 r286 1 //import com.modestmaps.core.Point;1 //import flash.geom.Point; 2 2 import com.modestmaps.core.Coordinate; 3 3 import com.modestmaps.geo.Location; trunk/as2/lib/com/modestmaps/core/Tile.as
r225 r286 4 4 import com.bigspaceship.utils.Delegate; 5 5 import com.modestmaps.core.Coordinate; 6 import com.modestmaps.core.Point;7 6 import com.modestmaps.core.TileGrid; 8 7 import com.modestmaps.core.TilePaintCall; … … 10 9 import com.modestmaps.mapproviders.IMapProvider; 11 10 import com.stamen.twisted.Reactor; 11 import flash.geom.Point; 12 12 13 13 class com.modestmaps.core.Tile trunk/as2/lib/com/modestmaps/core/TileGrid.as
r258 r286 3 3 * $Id$ 4 4 */ 5 6 import flash.geom.Point; 5 7 6 8 import com.bigspaceship.utils.Delegate; … … 9 11 import com.modestmaps.core.Marker; 10 12 import com.modestmaps.core.MarkerSet; 11 import com.modestmaps.core.Point;12 13 import com.modestmaps.core.Tile; 13 14 import com.modestmaps.geo.Location; … … 475 476 __map.onStartPan(); 476 477 __well.startDrag(false, xMin, yMin, xMax, yMax); 477 onWellDrag( __startingWellPosition.copy());478 onWellDrag(new Point(__startingWellPosition.x, __startingWellPosition.y)); 478 479 } 479 480 trunk/as2/lib/com/modestmaps/geo/AbstractProjection.as
r166 r286 1 1 import Math; 2 import com.modestmaps.core.Point;2 import flash.geom.Point; 3 3 import com.modestmaps.core.Coordinate; 4 4 import com.modestmaps.geo.Location; trunk/as2/lib/com/modestmaps/geo/IProjection.as
r99 r286 1 import com.modestmaps.core.Point;1 import flash.geom.Point; 2 2 import com.modestmaps.core.Coordinate; 3 3 import com.modestmaps.geo.Location; trunk/as2/lib/com/modestmaps/geo/LinearProjection.as
r166 r286 1 import com.modestmaps.core.Point;1 import flash.geom.Point; 2 2 import com.modestmaps.geo.Transformation; 3 3 import com.modestmaps.geo.AbstractProjection; trunk/as2/lib/com/modestmaps/geo/MercatorProjection.as
r73 r286 1 1 import Math; 2 import com.modestmaps.core.Point;2 import flash.geom.Point; 3 3 import com.modestmaps.core.Coordinate; 4 4 import com.modestmaps.geo.Transformation; trunk/as2/lib/com/modestmaps/geo/Transformation.as
r123 r286 1 import com.modestmaps.core.Point;1 import flash.geom.Point; 2 2 3 3 class com.modestmaps.geo.Transformation trunk/as2/lib/com/modestmaps/Map.as
r258 r286 26 26 27 27 import com.bigspaceship.utils.Delegate; 28 29 28 import org.casaframework.movieclip.DispatchableMovieClip; 30 29 import flash.geom.Point; 30 31 import com.modestmaps.core.MapExtent; 32 import com.modestmaps.core.MapPosition; 31 33 import com.modestmaps.core.Coordinate; 32 import com.modestmaps.core.Point;33 34 import com.modestmaps.core.TileGrid; 35 import com.modestmaps.core.MarkerClip; 34 36 import com.modestmaps.geo.Location; 35 37 import com.modestmaps.mapproviders.IMapProvider; … … 64 66 public var grid:TileGrid; 65 67 68 // markers are attached here 69 private var __markers:MarkerClip; 70 private var __mask:MovieClip; 71 66 72 // Who do we get our Map graphics from? 67 73 private var __mapProvider:IMapProvider; … … 71 77 public static var EVENT_MARKER_LEAVES:String = 'Marker leaves'; 72 78 public static var EVENT_START_ZOOMING:String = 'Start zooming'; 73 public static var EVENT_STOP_ZOOMING:String = 'Stop Zooming';79 public static var EVENT_STOP_ZOOMING:String = 'Stop zooming'; 74 80 public static var EVENT_ZOOMED_BY:String = 'Zoomed by...'; 75 81 public static var EVENT_START_PANNING:String = 'Start panning'; … … 77 83 public static var EVENT_PANNED_BY:String = 'Panned by...'; 78 84 public static var EVENT_RESIZED_TO:String = 'Resized to...'; 85 public static var EVENT_EXTENT_CHANGED:String = 'Extent changed'; 79 86 80 87 public static var symbolName:String = '__Packages.com.modestmaps.Map'; … … 110 117 grid = TileGrid(attachMovie(TileGrid.symbolName, 'grid', getNextHighestDepth())); 111 118 grid.init(width, height, draggable, provider, this); 119 120 __markers = MarkerClip(attachMovie(MarkerClip.symbolName, '__markers', getNextHighestDepth(), {_x: __width/2, _y: __height/2})); 121 __mask = createEmptyMovieClip('__mask', getNextHighestDepth()); 122 __markers.setMask(__mask); 123 __markers.setMap(this); 124 125 redraw(); 112 126 } 113 127 114 128 /* 115 * Based on a n array of locations, determine appropriate map116 * bounds using calculateMapExtent(), and inform the grid of129 * Based on a MapExtent, determine appropriate map 130 * bounds using extentPosition(), and inform the grid of 117 131 * tile coordinate and point by calling grid.resetTiles(). 118 132 * Resulting map extent will ensure that all passed locations 119 133 * are visible. 120 134 * 121 * @param Array of locations.122 * 123 * @see com.modestmaps.Map# calculateMapExtent135 * @param MapExtent. 136 * 137 * @see com.modestmaps.Map#extentPosition 124 138 * @see com.modestmaps.core.TileGrid#resetTiles 125 139 */ 126 public function setExtent(locations:/*Location*/Array):Void 127 { 128 if(!locations.length) 129 return; 130 131 var extent:Object = calculateMapExtent(locations); 140 public function setExtent(extent:MapExtent):Void 141 { 142 // what to do if a bad extent is passed? 143 var position:MapPosition = extentPosition(extent); 132 144 133 145 // tell grid what the rock is cooking 134 grid.resetTiles(Coordinate(extent['coord']), Point(extent['point'])); 146 grid.resetTiles(position.coord, position.point); 147 onExtentChanged(getExtent()); 148 Reactor.callNextFrame(Delegate.create(this, this.callCopyright)); 135 149 Reactor.callNextFrame(Delegate.create(this, this.callCopyright)); 136 150 } … … 138 152 /* 139 153 * Based on a location and zoom level, determine appropriate initial 140 * tile coordinate and point using c alculateMapCenter(), and inform154 * tile coordinate and point using coordinatePosition(), and inform 141 155 * the grid of tile coordinate and point by calling grid.resetTiles(). 142 156 * … … 144 158 * @param Desired zoom level. 145 159 * 146 * @see com.modestmaps.Map# calculateMapExtent160 * @see com.modestmaps.Map#extentPosition 147 161 * @see com.modestmaps.core.TileGrid#resetTiles 148 162 */ 149 163 public function setCenterZoom(location:Location, zoom:Number):Void 150 164 { 151 var center: Object = calculateMapCenter(__mapProvider.locationCoordinate(location).zoomTo(zoom));165 var center:MapPosition = coordinatePosition(__mapProvider.locationCoordinate(location).zoomTo(zoom)); 152 166 153 167 // tell grid what the rock is cooking 154 grid.resetTiles(Coordinate(center['coord']), Point(center['point'])); 168 grid.resetTiles(center.coord, center.point); 169 onExtentChanged(getExtent()); 170 Reactor.callNextFrame(Delegate.create(this, this.callCopyright)); 155 171 Reactor.callNextFrame(Delegate.create(this, this.callCopyright)); 156 172 } … … 158 174 /* 159 175 * Based on a coordinate, determine appropriate starting tile and position, 160 * and return a two-element object with a coord and a point.161 */ 162 private function c alculateMapCenter(centerCoord:Coordinate):Object176 * and return a MapPosition. 177 */ 178 private function coordinatePosition(centerCoord:Coordinate):MapPosition 163 179 { 164 180 // initial tile coordinate … … 170 186 var initPoint:Point = new Point(Math.round(initX), Math.round(initY)); 171 187 172 return {coord: initTileCoord, point: initPoint};188 return new MapPosition(initTileCoord, initPoint); 173 189 } 174 190 175 191 /* 176 192 * Based on an array of locations, determine appropriate map bounds 177 * in terms of tile grid, and return a two-element object with a coord 178 * and a point from calculateMapCenter(). 179 */ 180 private function calculateMapExtent(locations:/*Location*/Array):Object 193 * in terms of tile grid, and return a MapPosition from coordinatePosition(). 194 */ 195 private function locationsPosition(locations:/*Location*/Array):MapPosition 181 196 { 182 197 // my kingdom for a decent map() function in AS2 … … 226 241 var centerCoord:Coordinate = (new Coordinate(centerRow, centerColumn, centerZoom)).zoomTo(initZoom); 227 242 228 return c alculateMapCenter(centerCoord);229 } 230 243 return coordinatePosition(centerCoord); 244 } 245 231 246 /* 232 * Return the current coverage area of the map, as four locations. 233 * 234 * @return Array of four locations: [top-left, top-right, bottom-left, bottom-right]. 235 */ 236 public function getExtent():/*Location*/Array 237 { 238 var corners:/*Location*/Array = []; 239 247 * Based on a MapExtent, determine appropriate map bounds 248 * in terms of tile grid, and return a MapPosition from calculateMapCenter(). 249 */ 250 private function extentPosition(extent:MapExtent):MapPosition 251 { 252 var locations:/*Location*/Array = [extent.northWest, extent.southEast]; 253 return locationsPosition(locations); 254 } 255 256 /* 257 * Return the current coverage area of the map, as MapExtent. 258 * 259 * @return MapExtent. 260 */ 261 public function getExtent():MapExtent 262 { 240 263 if(!__mapProvider) 241 return corners; 242 243 var TL:Coordinate = grid.topLeftCoordinate(); 244 var BR:Coordinate = grid.bottomRightCoordinate(); 245 var TR:Coordinate = new Coordinate(TL.row, BR.column, TL.zoom); 246 var BL:Coordinate = new Coordinate(BR.row, TL.column, BR.zoom); 247 248 corners.push(__mapProvider.coordinateLocation(TL)); 249 corners.push(__mapProvider.coordinateLocation(TR)); 250 corners.push(__mapProvider.coordinateLocation(BL)); 251 corners.push(__mapProvider.coordinateLocation(BR)); 252 253 /* 254 trace('top left: '+corners[0].toString()); 255 trace('top right: '+corners[1].toString()); 256 trace('bottom left: '+corners[2].toString()); 257 trace('bottom right: '+corners[3].toString()); 258 */ 259 260 return corners; 264 return new MapExtent(); 265 266 var coordTL:Coordinate = grid.topLeftCoordinate(); 267 var coordBR:Coordinate = grid.bottomRightCoordinate(); 268 var coordTR:Coordinate = new Coordinate(coordTL.row, coordBR.column, coordTL.zoom); 269 var coordBL:Coordinate = new Coordinate(coordBR.row, coordTL.column, coordBR.zoom); 270 271 var TL:Location = __mapProvider.coordinateLocation(coordTL); 272 var BR:Location = __mapProvider.coordinateLocation(coordBR); 273 var TR:Location = __mapProvider.coordinateLocation(coordTR); 274 var BL:Location = __mapProvider.coordinateLocation(coordBL); 275 276 return new MapExtent(Math.max(Math.max(TL.lat, TR.lat), Math.max(BL.lat, BR.lat)), 277 Math.min(Math.min(TL.lat, TR.lat), Math.min(BL.lat, BR.lat)), 278 Math.max(Math.max(TL.lon, TR.lon), Math.max(BL.lon, BR.lon)), 279 Math.min(Math.min(TL.lon, TR.lon), Math.min(BL.lon, BR.lon))); 261 280 } 262 281 … … 283 302 __width = width; 284 303 __height = height; 304 redraw(); 305 285 306 grid.resizeTo(new Point(__width, __height)); 286 307 onResized(); … … 320 341 { 321 342 var previousGeometry:String = __mapProvider.geometry(); 322 var extent: /*Location*/Array= getExtent();343 var extent:MapExtent = getExtent(); 323 344 324 345 __mapProvider = newProvider; … … 506 527 * @param ID of marker, opaque string. 507 528 * @param Location of marker. 508 */ 509 public function putMarker(id:String, location:Location):Void 529 * @param Optional symbol name if a clip is to be attached. 530 * @return Optional attached movie clip, if a valid symbol was provided. 531 */ 532 public function putMarker(id:String, location:Location, symbol:String):MovieClip 510 533 { 511 534 //trace('Marker '+id+': '+location.toString()); 512 535 grid.putMarker(id, __mapProvider.locationCoordinate(location), location); 536 537 if(symbol) 538 return __markers.attachMarker(id, location, symbol); 539 540 return undefined; 541 } 542 543 /** 544 * Get a marker clip with the given id if one was created. 545 * 546 * @param ID of marker, opaque string. 547 * @return Optional attached movie clip, if a valid symbol was provided. 548 */ 549 public function getMarker(id:String):MovieClip 550 { 551 return __markers.getMarker(id); 513 552 } 514 553 … … 521 560 { 522 561 grid.removeMarker(id); 562 __markers.removeMarker(id); 523 563 } 524 564 … … 665 705 dispatchEvent( EVENT_RESIZED_TO, __width, __height ); 666 706 } 707 708 /** 709 * Dispatches EVENT_EXTENT_CHANGED when the map extent changes. 710 * Callback arguments include extent:MapExtent. 711 * 712 * @see com.modestmaps.Map#EVENT_EXTENT_CHANGED 713 */ 714 public function onExtentChanged(extent:MapExtent):Void 715 { 716 dispatchEvent( EVENT_RESIZED_TO, extent ); 717 } 718 719 private function redraw() 720 { 721 clear(); 722 723 __mask.clear(); 724 __mask.moveTo(0, 0); 725 __mask.lineStyle(); 726 __mask.beginFill(0xFF00FF, 0); 727 __mask.lineTo(0, __height); 728 __mask.lineTo(__width, __height); 729 __mask.lineTo(__width, 0); 730 __mask.lineTo(0, 0); 731 __mask.endFill(); 732 } 667 733 } trunk/as2/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as
r260 r286 6 6 * @author migurski 7 7 * 8 * AbstractImageBasedMapProvider is the base class for all MapProviders9 * that use externally loaded images to paint Tiles.8 * AbstractImageBasedMapProvider is the base class for all map 9 * providers that use externally loaded images to paint Tiles. 10 10 * 11 11 * @see com.modestmaps.mapproviders.AbstractMapProvider … … 51 51 request.addEventObserver( this, MapProviderPaintThrottledRequest.EVENT_RESPONSE_ERROR, "onResponseError"); 52 52 request.send(); 53 54 //createLabel( clip, coord.toString() );55 53 } 56 54 trunk/as2/lib/com/modestmaps/mapproviders/AbstractMapProvider.as
r191 r286 6 6 * @author migurski 7 7 * 8 * AbstractMapProvider is the base class for all MapProviders.8 * AbstractMapProvider is the base class for all map providers. 9 9 * 10 * @description AbstractMapProvider is the base class for all 11 * MapProviders. MapProviders are primarily responsible 12 * for "painting" map Tiles with the correct 13 * graphic imagery. 10 * @description AbstractMapProvider is the base class for all map providers. 11 * Map providers are primarily responsible for "painting" map 12 * tiles with the correct graphic imagery. 14 13 */ 15 14 … … 95 94 } 96 95 97 /**98 * Creates a text label for debugging purposes.99 *100 * @param clip The MovieClip to contain the label.101 * @param label The text the label.102 */103 public function createLabel( clip : MovieClip, label : String ) : Void104 {105 clip["labelTF"].removeTextField();106 107 clip.createTextField('labelTF', 1, 0, 0, 1, 1);108 var tf : TextField = clip["labelTF"];109 tf.autoSize = true;110 tf.selectable = false;111 tf.textColor = 0xFF0000;112 tf.text = label;113 }114 115 96 /* 116 97 * Return projected and transformed coordinate for a location. trunk/as2/lib/com/modestmaps/mapproviders/google/GoogleHybridMapProvider.as
r260 r286 48 48 enqueuePaintRequest( clip, coord ); 49 49 } 50 51 //createLabel( clip, coord.toString() );52 50 } 53 51 trunk/as2/lib/com/modestmaps/mapproviders/VanillaMapProvider.as
r191 r286 6 6 7 7 import org.casaframework.event.DispatchableInterface; 8 import com.modestmaps.geo.MercatorProjection; 9 import com.modestmaps.geo.Transformation; 8 10 9 11 import com.modestmaps.core.Coordinate; … … 15 17 implements IMapProvider, DispatchableInterface 16 18 { 17 public function paintTile( clip : MovieClip, coord : Coordinate ) : Void 19 public function VanillaMapProvider() 20 { 21 super(); 22 23 // see: http://modestmaps.mapstraction.com/trac/wiki/TileCoordinateComparisons#TileGeolocations 24 var t:Transformation = new Transformation(1.068070779e7, 0, 3.355443185e7, 25 0, -1.068070890e7, 3.355443057e7); 26 27 __projection = new MercatorProjection(26, t); 28 29 __topLeftOutLimit = new Coordinate(0, Number.NEGATIVE_INFINITY, 0); 30 __bottomRightInLimit = (new Coordinate(1, Number.POSITIVE_INFINITY, 0)).zoomTo(20); 31 } 32 33 public function paint(clip:MovieClip, coord:Coordinate):Void 18 34 { 19 super.paint( clip, coord ); 20 21 with ( clip ) 22 { 23 clear(); 24 moveTo(0, 0); 25 lineStyle(0, 0x0099FF, 100); 26 beginFill(0x000000, 20); 27 lineTo(0, clip._height); 28 lineTo(clip._width, clip._height); 29 lineTo(clip._width, 0); 30 lineTo(0, 0); 31 endFill(); 32 } 33 34 createLabel( clip, coord.toString() ); 35 36 raisePaintComplete(); 35 super.paint(clip, coord); 36 37 clip.createTextField('label', clip.getNextHighestDepth(), 0, 0, 100, 100); 38 clip['label'].selectable = false; 39 clip['label'].textColor = 0xFFFFFF; 40 clip['label'].text = coord.toString(); 41 clip['label']._width = clip['label'].textWidth + 4; 42 clip['label']._height = clip['label'].textHeight + 2; 43 44 raisePaintComplete(); 37 45 } 38 46 } trunk/as2/lib/com/modestmaps/mapproviders/yahoo/YahooAerialMapProvider.as
r215 r286 19 19 private function getTileUrl(coord:Coordinate):String 20 20 { 21 return "http://us.maps3.yimg.com/aerial.maps.yimg.com/ img?md=200605101500" + getZoomString(sourceCoordinate(coord));21 return "http://us.maps3.yimg.com/aerial.maps.yimg.com/tile?v=1.7&t=a" + getZoomString(sourceCoordinate(coord)); 22 22 } 23 23 … … 25 25 { 26 26 var row : Number = ( Math.pow( 2, coord.zoom ) /2 ) - coord.row - 1; 27 28 var zoomString : String = "&x=" + coord.column + 29 "&y=" + row + 30 "&z=" + ( 18 - coord.zoom ) + 31 "&v=1.5&t=a"; 32 return zoomString; 27 return "&x=" + coord.column + "&y=" + row + "&z=" + (18 - coord.zoom); 33 28 } 34 29 } trunk/as2/lib/com/modestmaps/mapproviders/yahoo/YahooHybridMapProvider.as
r260 r286 43 43 private function getBGTileUrl(coord:Coordinate):String 44 44 { 45 return "http://us.maps3.yimg.com/aerial.maps.yimg.com/img?md=200605101500" + getZoomString(sourceCoordinate(coord)) + "&v=1.5&t=a";45 return "http://us.maps3.yimg.com/aerial.maps.yimg.com/tile?v=1.7&t=a" + getZoomString(sourceCoordinate(coord)); 46 46 } 47 47 48 48 private function getOverlayTileUrl(coord:Coordinate):String 49 49 { 50 return "http://us.maps3.yimg.com/aerial.maps.yimg.com/ img?md=200608221700&v=2.0&t=h" + getZoomString(sourceCoordinate(coord));50 return "http://us.maps3.yimg.com/aerial.maps.yimg.com/png?v=2.2&t=h" + getZoomString(sourceCoordinate(coord)); 51 51 } 52 52 … … 55 55 { 56 56 var row : Number = ( Math.pow( 2, coord.zoom ) /2 ) - coord.row - 1; 57 58 var zoomString : String = "&x=" + coord.column + 59 "&y=" + row + 60 "&z=" + ( 18 - coord.zoom ); 61 return zoomString; 57 return "&x=" + coord.column + "&y=" + row + "&z=" + (18 - coord.zoom); 62 58 } 63 59
