Changeset 541
- Timestamp:
- 04/05/08 20:39:38 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/tom-tweenlite/lib/com/modestmaps/core/TileGrid.as
r536 r541 245 245 246 246 // find the extents of the ur-tile: 247 // (where would the top left and bottom right corners of the 248 // world be now if we only had one tile at zoom level 0?) 247 249 var worldMin:Point = worldMatrix.transformPoint(new Point(0,0)); 248 250 var worldMax:Point = worldMatrix.transformPoint(new Point(TILE_WIDTH,TILE_HEIGHT)); 249 251 250 // 0 when scale == 1, 1 when scale == 2, 2 when scale == 4, etc. 252 // what zoom level of tiles should we be loading, taking into account min/max zoom? 253 // (0 when scale == 1, 1 when scale == 2, 2 when scale == 4, etc.) 251 254 var newZoom:int = Math.min(maxZoom, Math.max(minZoom, Math.round(zoomLevel))); 252 255 256 // see if the newZoom is different to currentZoom 253 257 // so we know which way we're zooming, if any: 254 258 if (currentZoom != newZoom) { … … 264 268 var numRows:int = numCols; // TODO deal with what happens with non-square projections! 265 269 266 // map size: 267 var screenMin:Point = new Point(0,0); 268 var screenMax:Point = new Point(mapWidth, mapHeight); 269 270 // find start and end columns for the visible tiles: 270 271 var realMinCol:Number = numCols * (-worldMin.x) / (worldMax.x-worldMin.x); 271 272 var realMaxCol:Number = numCols * (mapWidth-worldMin.x) / (worldMax.x-worldMin.x); … … 273 274 var realMaxRow:Number = numRows * (mapHeight-worldMin.y) / (worldMax.y-worldMin.y); 274 275 275 // find start and end columns276 // round these up or down to pad things out a bit 276 277 var minCol:int = Math.floor(realMinCol); 277 278 var maxCol:int = Math.ceil(realMaxCol); … … 279 280 var maxRow:int = Math.ceil(realMaxRow); 280 281 281 // pad it out a little bit282 // optionally pad it out a little bit more 282 283 // TODO: investigate giving a directional bias to TILE_BUFFER when panning quickly 283 284 minCol -= TILE_BUFFER; … … 292 293 var tile:Tile; 293 294 var key:String; 295 var coord:Coordinate = new Coordinate(0,0,0); 294 296 295 297 // loop over currently visible tiles … … 308 310 if (!tile) { 309 311 tile = map.createTile(col, row, currentZoom); 310 childrenNeeded[tile] = provider.getTileUrls(new Coordinate(tile.row, tile.column, tile.zoom)).length; 312 coord.row = tile.row; 313 coord.column = tile.column; 314 coord.zoom = tile.zoom; 315 // TODO keep a local copy of the URLs so we don't have to call this twice? 316 childrenNeeded[tile] = provider.getTileUrls(coord).length; 311 317 queue.push(tile); 312 318 } … … 483 489 484 490 // process the queue 491 var coord:Coordinate = new Coordinate(0,0,0); 485 492 while (openRequests.length < MAX_OPEN_REQUESTS && queue.length > 0) { 486 493 var tile:Tile = queue.shift() as Tile; 494 coord.row = tile.row; 495 coord.column = tile.column; 496 coord.zoom = tile.zoom; 487 497 // if it's still on the stage: 488 498 if (tile.parent) { 489 499 // TODO: add urls to Tile? 490 var urls:Array = provider.getTileUrls( new Coordinate(tile.row, tile.column, tile.zoom));500 var urls:Array = provider.getTileUrls(coord); 491 501 var url:String = urls.shift() as String; 492 502 var tileLoader:Loader = new Loader(); branches/tom-tweenlite/lib/com/modestmaps/geo/Location.as
r540 r541 11 11 public var lon:Number; 12 12 13 public static function fromString(str:String, lonlat:Boolean= true):Location13 public static function fromString(str:String, lonlat:Boolean=false):Location 14 14 { 15 15 var parts:Array = str.split(/\s*,\s*/, 2);
