Changeset 99
- Timestamp:
- 02/07/07 02:17:31 (2 years ago)
- Files:
-
- trunk/as2/lib/com/modestmaps/core/MarkerSet.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/core/TilePaintCall.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/geo/IProjection.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/io/MapProviderPaintThrottledRequest.as (added)
- trunk/as2/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as (modified) (3 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/google/AbstractGoogleMapProvider.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/mapproviders/google/GoogleAerialMapProvider.as (modified) (3 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/google/GoogleRoadMapProvider.as (modified) (3 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/microsoft/AbstractMicrosoftMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/microsoft/MicrosoftAerialMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/microsoft/MicrosoftHybridMapProvider.as (modified) (2 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/microsoft/MicrosoftRoadMapProvider.as (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/as2/lib/com/modestmaps/core/MarkerSet.as
r96 r99 70 70 */ 71 71 72 grid.log('Marker '+markerName+' in '+tileKey);72 //grid.log('Marker '+markerName+' in '+tileKey); 73 73 } 74 74 … … 85 85 } 86 86 87 grid.log('Touched markers: '+names.toString());87 //grid.log('Touched markers: '+names.toString()); 88 88 return touched; 89 89 } trunk/as2/lib/com/modestmaps/core/TilePaintCall.as
r87 r99 22 22 public function toString():String 23 23 { 24 return __mapProvider.toString() + ', ' + __tileCoord.toString(); 24 return __mapProvider.toString() + ', ' + __tileCoord.toString(); 25 25 } 26 26 trunk/as2/lib/com/modestmaps/geo/IProjection.as
r59 r99 24 24 */ 25 25 public function coordinateLocation(coordinate:Coordinate):Location; 26 27 public function toString():String; 26 28 } trunk/as2/lib/com/modestmaps/mapproviders/AbstractImageBasedMapProvider.as
r97 r99 3 3 import com.modestmaps.io.LoadMovieThrottledRequest; 4 4 import mx.utils.Delegate; 5 import com.modestmaps.io.MapProviderPaintThrottledRequest; 5 6 6 7 /** … … 19 20 super.paint( clip, coord ); 20 21 21 var request : LoadMovieThrottledRequest = new LoadMovieThrottledRequest( clip.image, getTileUrl( coord ));22 request.addEventListener( LoadMovieThrottledRequest.EVENT_REQUEST_ERROR, Delegate.create( this, this.onRequestError ));23 request.addEventListener( LoadMovieThrottledRequest.EVENT_RESPONSE_COMPLETE, Delegate.create( this, this.onResponseComplete ));24 request.addEventListener( LoadMovieThrottledRequest.EVENT_RESPONSE_ERROR, Delegate.create( this, this.onResponseError ));22 var request : MapProviderPaintThrottledRequest = new MapProviderPaintThrottledRequest( clip.image, getTileUrl( coord ), coord ); 23 request.addEventListener( MapProviderPaintThrottledRequest.EVENT_REQUEST_ERROR, Delegate.create( this, this.onRequestError )); 24 request.addEventListener( MapProviderPaintThrottledRequest.EVENT_RESPONSE_COMPLETE, Delegate.create( this, this.onResponseComplete )); 25 request.addEventListener( MapProviderPaintThrottledRequest.EVENT_RESPONSE_ERROR, Delegate.create( this, this.onResponseError )); 25 26 request.send(); 26 27 … … 73 74 private function onResponseComplete( eventObj : Object ) : Void 74 75 { 75 var clip : MovieClip = MovieClip( eventObj.clip ); 76 var url : String = String( eventObj.url ); 77 78 raisePaintComplete( clip, getCoordinateFromURL( url ) ); 76 raisePaintComplete( eventObj.clip, eventObj.coord ); 79 77 } 80 78 trunk/as2/lib/com/modestmaps/mapproviders/google/AbstractGoogleMapProvider.as
r97 r99 29 29 __bottomRightInLimit = (new Coordinate(1, Number.POSITIVE_INFINITY, 0)).zoomTo(Coordinate.MAX_ZOOM); 30 30 } 31 32 33 34 31 } trunk/as2/lib/com/modestmaps/mapproviders/google/GoogleAerialMapProvider.as
r98 r99 13 13 implements IMapProvider, IDispatchable 14 14 { 15 private static var BASE_URL : String = "http://kh0.google.com/kh?n=404&v=14&t=";16 private static var ASSET_EXTENSION : String = "";17 18 15 public function toString() : String 19 16 { … … 21 18 } 22 19 23 public function get baseUrl() : String24 {25 return BASE_URL;26 }27 28 public function get assetExtension() : String29 {30 return ASSET_EXTENSION;31 }32 33 20 private function getTileUrl( coord : Coordinate ) : String 34 21 { 35 var url:String = BASE_URL + getZoomString(coord); 36 37 _level0.map.grid.log(this + ": Mapped " + coord.toString() + " to URL: " + url); 38 39 return url; 22 return "http://kh0.google.com/kh?n=404&v=14&t=" + getZoomString(coord); 40 23 } 41 24 … … 62 45 return zoomString; 63 46 } 64 65 /*66 * Given a URL, returns the coordinates that the URL refers to.67 */68 private function getCoordinateFromURL( url : String ) : Coordinate69 {70 var row, col, zoom : Number;71 72 // first locate the meaty bits (i.e. the zoomString).73 var zoombits : Array = url.split( "&" );74 75 col = parseInt( zoombits[2].split( '=' )[1] );76 row = parseInt( zoombits[3].split( '=' )[1] );77 zoom = parseInt( zoombits[4].split( '=' )[1] );78 79 var coord : Coordinate = new Coordinate( row, col, zoom );80 return coord;81 }82 47 } trunk/as2/lib/com/modestmaps/mapproviders/google/GoogleRoadMapProvider.as
r97 r99 12 12 implements IMapProvider, IDispatchable 13 13 { 14 private static var BASE_URL : String = "http://mt1.google.com/mt?n=404&v=w2.38";15 private static var ASSET_EXTENSION : String = "";16 17 14 public function toString() : String 18 15 { … … 32 29 private function getTileUrl( coord : Coordinate ) : String 33 30 { 34 var url : String = BASE_URL+ getZoomString( coord );31 var url : String = "http://mt1.google.com/mt?n=404&v=w2.38" + getZoomString( coord ); 35 32 return url; 36 33 } … … 41 38 return zoomString; 42 39 } 43 44 45 /*46 * Given a URL, returns the coordinates that the URL refers to.47 */48 private function getCoordinateFromURL( url : String ) : Coordinate49 {50 var row, col, zoom : Number;51 52 var zoombits : Array = url.split( "&" );53 54 col = parseInt( zoombits[2].split( '=' )[1] );55 row = parseInt( zoombits[3].split( '=' )[1] );56 zoom = parseInt( zoombits[4].split( '=' )[1] );57 58 var coord : Coordinate = new Coordinate( row, col, ( 17 - zoom ) );59 return coord;60 }61 40 } trunk/as2/lib/com/modestmaps/mapproviders/microsoft/AbstractMicrosoftMapProvider.as
r97 r99 11 11 extends AbstractImageBasedMapProvider 12 12 { 13 public static var BASE_URL : String;14 public static var ASSET_EXTENSION : String;15 16 13 function AbstractMicrosoftMapProvider() 17 14 { … … 46 43 return zoomString; 47 44 } 48 49 /*50 * Given a URL, returns the coordinates that the URL refers to.51 */52 private function getCoordinateFromURL( url : String ) : Coordinate53 {54 var row, col, zoom : Number;55 56 // first locate the meaty bits (i.e. the zoomString).57 var zoomString : String = url.substring( baseUrl.length );58 zoomString = zoomString.substring( 0, zoomString.indexOf( assetExtension ) );59 60 // now work backwards to determine row and col61 zoom = zoomString.length;62 63 var rowStr : String = "";64 var colStr : String = "";65 var tempStr : String = "";66 67 for ( var i : Number = 0; i < zoom; i++ )68 {69 tempStr = BinaryUtil.convertToBinary( parseInt( zoomString.charAt( i ) ) );70 colStr += tempStr.charAt( tempStr.length-1 );71 rowStr += tempStr.charAt( tempStr.length-2 );72 }73 74 row = BinaryUtil.convertToDecimal( rowStr );75 col = BinaryUtil.convertToDecimal( colStr );76 77 var coord : Coordinate = new Coordinate( row, col, zoom );78 return coord;79 }80 45 } trunk/as2/lib/com/modestmaps/mapproviders/microsoft/MicrosoftAerialMapProvider.as
r71 r99 13 13 implements IMapProvider, IDispatchable 14 14 { 15 private static var BASE_URL : String = "http://a0.ortho.tiles.virtualearth.net/tiles/a";16 private static var ASSET_EXTENSION : String = ".jpeg";17 18 15 public function toString() : String 19 16 { … … 21 18 } 22 19 23 public function get baseUrl() : String24 {25 return BASE_URL;26 }27 28 public function get assetExtension() : String29 {30 return ASSET_EXTENSION;31 }32 33 20 private function getTileUrl( coord : Coordinate ) : String 34 21 { 35 var url : String = BASE_URL + getZoomString( coord ) + ASSET_EXTENSION + "?g=45"; 36 37 //trace (this + ": Mapped " + coord.toString() + " to URL: " + url); 22 var url : String = "http://a0.ortho.tiles.virtualearth.net/tiles/a" + 23 getZoomString( coord ) + ".jpeg?g=45"; 38 24 39 25 return url; trunk/as2/lib/com/modestmaps/mapproviders/microsoft/MicrosoftHybridMapProvider.as
r71 r99 13 13 implements IMapProvider, IDispatchable 14 14 { 15 private static var BASE_URL : String = "http://h1.ortho.tiles.virtualearth.net/tiles/h";16 private static var ASSET_EXTENSION : String = ".jpeg";17 18 15 public function toString() : String 19 16 { … … 21 18 } 22 19 23 public function get baseUrl() : String24 {25 return BASE_URL;26 }27 28 public function get assetExtension() : String29 {30 return ASSET_EXTENSION;31 }32 33 20 private function getTileUrl( coord : Coordinate ) : String 34 21 { 35 var url : String = BASE_URL + getZoomString( coord ) + ASSET_EXTENSION + "?g=45"; 22 var url : String = "http://h1.ortho.tiles.virtualearth.net/tiles/h" + 23 getZoomString( coord ) + ".jpeg?g=45"; 24 36 25 return url; 37 26 } trunk/as2/lib/com/modestmaps/mapproviders/microsoft/MicrosoftRoadMapProvider.as
r71 r99 13 13 implements IMapProvider, IDispatchable 14 14 { 15 private static var BASE_URL : String = "http://r3.ortho.tiles.virtualearth.net/tiles/r";16 private static var ASSET_EXTENSION : String = ".png";17 18 15 public function toString() : String 19 16 { … … 21 18 } 22 19 23 public function get baseUrl() : String24 {25 return BASE_URL;26 }27 28 public function get assetExtension() : String29 {30 return ASSET_EXTENSION;31 }32 33 20 private function getTileUrl( coord : Coordinate ) : String 34 21 { 35 var url : String = BASE_URL + getZoomString( coord ) + ASSET_EXTENSION + "?g=45"; 36 37 //trace (this + ": Mapped " + tile.toString() + " to URL: " + url); 22 var url : String = "http://r3.ortho.tiles.virtualearth.net/tiles/r" + 23 getZoomString( coord ) + ".png?g=45"; 38 24 39 25 return url;
