Changeset 75
- Timestamp:
- 01/23/07 23:42:24 (2 years ago)
- Files:
-
- trunk/as2/lib/com/modestmaps/core/TileGrid.as (modified) (13 diffs)
- trunk/as2/lib/com/modestmaps/geo/Map.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/mapproviders/AbstractMapProvider.as (modified) (3 diffs)
- trunk/as2/lib/com/modestmaps/mapproviders/IMapProvider.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/mapproviders/microsoft/AbstractMicrosoftMapProvider.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/as2/lib/com/modestmaps/core/TileGrid.as
r69 r75 66 66 buildWell(); 67 67 buildMask(); 68 68 redraw(); 69 70 Reactor.callNextFrame(Delegate.create(this, this.initializeTiles)); 71 } 72 73 /** 74 * Create the first tiles. 75 */ 76 private function initializeTiles():Void 77 { 69 78 // impose some limits 70 79 zoomLevel = 11; 71 topLeftOutLimit = new Coordinate(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, 0);72 bottomRightInLimit = new Coordinate(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Coordinate.MAX_ZOOM);80 topLeftOutLimit = mapProvider.outerLimits()[0]; 81 bottomRightInLimit = mapProvider.outerLimits()[1]; 73 82 74 83 // initial tile centers the map on the SF Bay Area … … 90 99 tileBuffer = Math.max(0, tileBuffer); 91 100 101 centerWell(false); 92 102 allocateTiles(); 93 redraw();103 positionTiles(); 94 104 95 105 labelContainer.swapDepths( getNextHighestDepth() ); … … 352 362 public function zoomIn(amount:Number):Void 353 363 { 364 if(!tiles) 365 return; 366 354 367 if(zoomLevel >= bottomRightInLimit.zoom && Math.round(well._xscale) >= 100) 355 368 return; … … 367 380 public function zoomOut(amount:Number):Void 368 381 { 382 if(!tiles) 383 return; 384 369 385 if(zoomLevel <= topLeftOutLimit.zoom && Math.round(well._xscale) <= 100) 370 386 return; … … 382 398 public function resizeTo(bottomLeft:Point):Void 383 399 { 400 if(!tiles) 401 return; 402 384 403 width = bottomLeft.x; 385 404 height = bottomLeft.y; … … 393 412 public function panRight(pixels:Number):Void 394 413 { 414 if(!tiles) 415 return; 416 395 417 well._x -= pixels; 396 418 positionTiles(); … … 400 422 public function panLeft(pixels:Number):Void 401 423 { 424 if(!tiles) 425 return; 426 402 427 well._x += pixels; 403 428 positionTiles(); … … 407 432 public function panUp(pixels:Number):Void 408 433 { 434 if(!tiles) 435 return; 436 409 437 well._y += pixels; 410 438 positionTiles(); … … 414 442 public function panDown(pixels:Number):Void 415 443 { 444 if(!tiles) 445 return; 446 416 447 well._y -= pixels; 417 448 positionTiles(); … … 433 464 private function allocateTiles():Void 434 465 { 466 if(!tiles) 467 return; 468 435 469 // internal pixel dimensions of well, compensating for scale 436 470 var wellWidth:Number = (100 / well._xscale) * width; … … 474 508 private function centerWell(adjustTiles:Boolean):Void 475 509 { 510 if(!tiles) 511 return; 512 476 513 var center:Point = new Point((width/2), (height/2)); 477 514 … … 497 534 private function normalizeWell():Void 498 535 { 536 if(!tiles) 537 return; 538 499 539 var zoomAdjust:Number, scaleAdjust:Number; 500 540 … … 662 702 private function positionTiles():Void 663 703 { 704 if(!tiles) 705 return; 706 664 707 var tile:Tile; 665 708 var point:Point; trunk/as2/lib/com/modestmaps/geo/Map.as
r69 r75 81 81 public function zoomIn():Void 82 82 { 83 grid.zoomIn( 0.25);83 grid.zoomIn(1); 84 84 } 85 85 86 86 public function zoomOut():Void 87 87 { 88 grid.zoomOut( 0.25);88 grid.zoomOut(1); 89 89 } 90 90 } trunk/as2/lib/com/modestmaps/mapproviders/AbstractMapProvider.as
r74 r75 21 21 private var __requestThrottler : RequestThrottler; 22 22 private var __projection:IProjection; 23 24 // boundaries for the current provider 25 private var __topLeftOutLimit:Coordinate; 26 private var __bottomRightInLimit:Coordinate; 23 27 24 28 // tracks if we're set up to broadcast events … … 41 45 var t:Transformation = new Transformation(1, 0, 0, 0, 1, 0); 42 46 __projection = new LinearProjection(Coordinate.MAX_ZOOM, t); 47 48 __topLeftOutLimit = new Coordinate(0, 0, 0); 49 __bottomRightInLimit = (new Coordinate(1, 1, 0)).zoomTo(Coordinate.MAX_ZOOM); 43 50 } 44 51 … … 55 62 return __projection.toString(); 56 63 } 64 65 /* 66 * Get top left outer-zoom limit and bottom right inner-zoom limits, 67 * as Coordinates in a two element array. 68 */ 69 public function outerLimits():/*Coordinate*/Array 70 { 71 var limits:/*Coordinate*/Array = []; 72 73 limits[0] = __topLeftOutLimit.copy(); 74 limits[1] = __bottomRightInLimit.copy(); 75 76 return limits; 77 } 57 78 58 79 public function createLabel( clip : MovieClip, label : String ) : Void trunk/as2/lib/com/modestmaps/mapproviders/IMapProvider.as
r69 r75 18 18 */ 19 19 public function coordinateLocation(coordinate:Coordinate):Location; 20 21 /* 22 * Get top left outer-zoom limit and bottom right inner-zoom limits, 23 * as Coordinates in a two element array. 24 */ 25 public function outerLimits():/*Coordinate*/Array; 20 26 } trunk/as2/lib/com/modestmaps/mapproviders/microsoft/AbstractMicrosoftMapProvider.as
r70 r75 25 25 26 26 __projection = new MercatorProjection(26, t); 27 28 __topLeftOutLimit = new Coordinate(0, Number.NEGATIVE_INFINITY, 0); 29 __bottomRightInLimit = (new Coordinate(1, Number.POSITIVE_INFINITY, 0)).zoomTo(Coordinate.MAX_ZOOM); 27 30 } 28 31
