Changeset 2477 for lang/actionscript/swfgmap
- Timestamp:
- 12/05/07 15:55:38 (13 months ago)
- Location:
- lang/actionscript/swfgmap/trunk/gyuque/gmap
- Files:
-
- 3 modified
-
IMeshMap.as (modified) (1 diff)
-
ViewportUpdater.as (modified) (9 diffs)
-
googlemaps/GMapMapLayer.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/swfgmap/trunk/gyuque/gmap/IMeshMap.as
r2456 r2477 1 1 package gyuque.gmap 2 2 { 3 import flash.geom.Point; 4 3 5 public interface IMeshMap 4 6 { 5 function resetPanning(tx:int, ty:int) :void; 7 function getCurrentPanning(out:Point) :void; 8 function resetPanning(tx:int, ty:int) :void; 6 9 function setTileOffset(ox:int, oy:int) :void; 7 10 function loadTile(tx:int, ty:int) :void; -
lang/actionscript/swfgmap/trunk/gyuque/gmap/ViewportUpdater.as
r2456 r2477 1 1 package gyuque.gmap 2 2 { 3 import flash.events.*; 4 import flash.utils.Timer; 5 import flash.geom.Point; 6 3 7 public class ViewportUpdater 4 8 { … … 8 12 9 13 private var mReqQueue:XYQueue; 14 private var mUpdateTimer:Timer; 10 15 11 16 public function ViewportUpdater(listener:IMeshMap) … … 13 18 mListener = listener; 14 19 mGHash = new GridHash(); 20 mReqQueue = new XYQueue(); 21 22 mUpdateTimer = new Timer(100); 23 mUpdateTimer.addEventListener(TimerEvent.TIMER, onTimer); 24 mUpdateTimer.start(); 15 25 } 16 26 … … 19 29 var prev:GMapViewport = mCurViewport; 20 30 mCurViewport = v; 21 22 31 if (mCurViewport) 23 32 { 24 33 if (prev == null) 25 34 refresh(); 35 } 36 } 37 38 private function onTimer(e:Event):void 39 { 40 if (mReqQueue.empty) 41 return; 42 43 var j:Object = {}; 44 mReqQueue.consume(j); 45 switch(j.v) 46 { 47 case 1: // load 48 checkAndLoad(j.x, j.y); 49 break; 26 50 } 27 51 } … … 34 58 private function spread(tx:int, ty:int):void 35 59 { 36 checkAndLoad(tx , ty - 1);37 checkAndLoad(tx + 1, ty );38 checkAndLoad(tx , ty + 1);39 checkAndLoad(tx - 1, ty );60 addLoadJob(tx , ty - 1); 61 addLoadJob(tx + 1, ty ); 62 addLoadJob(tx , ty + 1); 63 addLoadJob(tx - 1, ty ); 40 64 } 41 65 … … 47 71 mListener.loadTile(tx, ty); 48 72 } 73 } 74 75 private function addLoadJob(tx:int, ty:int):void 76 { 77 mReqQueue.push(tx, ty, 1); 49 78 } 50 79 … … 65 94 class XYQueue 66 95 { 67 private var Xs:Array; 68 private var Ys:Array; 96 private var Xs:Array = new Array(); 97 private var Ys:Array = new Array(); 98 private var Vs:Array = new Array(); 69 99 70 100 public function consume(out:Object):Boolean … … 74 104 out.x = Xs.shift(); 75 105 out.y = Ys.shift(); 106 out.v = Vs.shift(); 76 107 return true; 77 108 } … … 82 113 } 83 114 84 public function push(x:int, y:int ):void115 public function push(x:int, y:int, v:int):void 85 116 { 86 117 Xs.push(x); 87 118 Ys.push(y); 119 Vs.push(v); 88 120 } 89 121 } -
lang/actionscript/swfgmap/trunk/gyuque/gmap/googlemaps/GMapMapLayer.as
r2456 r2477 66 66 mCenterTY = ty; 67 67 } 68 69 public function getCurrentPanning(out:Point):void 70 { 71 out.x = x; 72 out.x = y; 73 } 68 74 } 69 75 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)