Show
Ignore:
Timestamp:
12/05/07 01:39:18 (13 months ago)
Author:
gyuque
Message:

lang/actionscript/swfgmap

Location:
lang/actionscript/swfgmap/trunk/gyuque/gmap
Files:
2 added
2 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/swfgmap/trunk/gyuque/gmap/GMapCalc.as

    r2421 r2452  
    7272                        throw "illegal layer index"; 
    7373                } 
     74                 
     75                public static function calcMapsZoomIndex(z:int):int 
     76                { 
     77                        return 17-z; 
     78                } 
    7479        } 
    7580} 
  • lang/actionscript/swfgmap/trunk/gyuque/gmap/googlemaps/GMapMapLayer.as

    r2429 r2452  
    77        import gyuque.gmap.*; 
    88         
    9         public class GMapMapLayer extends Layer 
     9        public class GMapMapLayer extends Layer implements IMeshMap 
    1010        { 
     11                protected var mVPobs:ViewportUpdater; 
     12                 
    1113                public function GMapMapLayer(eventSrc:EventDispatcher) 
    1214                { 
    1315                        super(eventSrc); 
     16                        mVPobs = new ViewportUpdater(this); 
    1417                         
    1518                        var g:Graphics = graphics; 
     
    2831                { 
    2932                        var v:GMapViewport = mViewport; 
    30                         if (refreshAll && v) 
    31                         { 
    32                                 var tiledata:Object = GMapCalc.calcTileData(v.centerNX, v.centerNY, v.zoom, 0); 
     33                        mVPobs.currentViewport = mViewport; 
     34                } 
     35                 
     36                public function setTileOffset(ox:int, oy:int):void 
     37                { 
     38                        var c:int = GMapCalc.TILE_SIZE/2; 
     39                        x = -(ox-c); 
     40                        y = -(oy-c); 
     41                } 
     42                 
     43                public function loadTile(tx:int, ty:int):void 
     44                { 
     45                        var tile:GMapMapTile = new GMapMapTile(tx, ty, GMapCalc.calcMapsZoomIndex(mViewport.zoom)); 
     46                         
     47                        addChild(tile.loadTile()); 
    3348                                 
    34                                 var tile:GMapMapTile = new GMapMapTile(tiledata.tile_index.x, tiledata.tile_index.y, tiledata.tile_zoom); 
    35                                 addChild(tile.loadTile()); 
    36                                  
    37                                 tile.x = -128; 
    38                                 tile.y = -128; 
    39                                  
    40                                 x = -(tiledata.offset.x-128); 
    41                                 y = -(tiledata.offset.y-128); 
    42                                  
    43                                 GMapView(stage.getChildAt(0)).puts(tiledata.offset.x+", "+tiledata.offset.y); 
    44                         } 
     49                        var c:int = GMapCalc.TILE_SIZE/2; 
     50                        tile.x = -c; 
     51                        tile.y = -c; 
     52                } 
     53                 
     54                public function unloadTile(tx:int, ty:int):void 
     55                { 
    4556                } 
    4657        }