Changeset 135
- Timestamp:
- 02/27/07 00:17:33 (2 years ago)
- Files:
-
- trunk/as2/lib/com/modestmaps/core/MarkerSet.as (modified) (1 diff)
- trunk/as2/lib/com/modestmaps/core/TileGrid.as (modified) (4 diffs)
- trunk/as2/lib/com/modestmaps/geo/Map.as (modified) (7 diffs)
- trunk/as2/lib/SampleClient.as (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/as2/lib/com/modestmaps/core/MarkerSet.as
r124 r135 75 75 //grid.log('Marker '+markerId+' in '+tileKey); 76 76 } 77 78 /** 79 * Fetch a single marker by ID. 80 */ 81 public function getMarker(id:String):Marker 82 { 83 return markers[id]; 84 } 85 77 86 /** 78 87 * Fetch a list of markers within currently-visible tiles. trunk/as2/lib/com/modestmaps/core/TileGrid.as
r131 r135 1 import com.modestmaps.geo.Map; 1 2 import com.modestmaps.geo.Location; 2 3 import com.modestmaps.core.Coordinate; … … 13 14 class com.modestmaps.core.TileGrid extends MovieClip 14 15 { 16 private var map:Map; 17 15 18 private var width:Number; 16 19 private var height:Number; … … 936 939 for(var id:String in newOverlappingMarkers) { 937 940 if(newOverlappingMarkers[id] && !__overlappingMarkers[id]) { 938 /* 939 TODO: 940 Throw an event here indicating that newOverlappingMarkers[id] 941 now overlaps the tile grid, and should be tracked externally. 942 */ 941 map.onMarkerEnters(markers.getMarker(id)); 943 942 __overlappingMarkers[id] = true; 944 943 } … … 947 946 for(var id:String in __overlappingMarkers) { 948 947 if(!newOverlappingMarkers[id] && __overlappingMarkers[id]) { 949 /* 950 TODO: 951 Throw an event here indicating that newOverlappingMarkers[id] 952 no longer overlaps the tile grid, and should be ignored. 953 */ 948 map.onMarkerLeaves(markers.getMarker(id)); 954 949 delete __overlappingMarkers[id]; 955 950 } trunk/as2/lib/com/modestmaps/geo/Map.as
r132 r135 1 1 import mx.utils.Delegate; 2 import mx.events.EventDispatcher; 2 3 import com.stamen.twisted.Reactor; 3 4 import com.stamen.twisted.DelayedCall; … … 5 6 import com.modestmaps.geo.Location; 6 7 import com.modestmaps.core.Point; 8 import com.modestmaps.core.Marker; 7 9 import com.modestmaps.core.TileGrid; 8 10 import com.modestmaps.core.Coordinate; … … 30 32 public var mapProvider:IMapProvider; 31 33 34 // stubs for EventDispatcher 35 public var dispatchEvent:Function; 36 public var addEventListener:Function; 37 public var removeEventListener:Function; 38 39 public static var EVENT_MARKER_ENTERS:String = 'Marker enters'; 40 public static var EVENT_MARKER_LEAVES:String = 'Marker leaves'; 41 32 42 public static var symbolName:String = '__Packages.com.modestmaps.geo.Map'; 33 43 public static var symbolOwner:Function = Map; … … 36 46 public function Map() 37 47 { 48 EventDispatcher.initialize(this); 49 38 50 __zoomSteps = []; 39 51 … … 42 54 var initObj : Object = 43 55 { 56 map: this, 44 57 mapProvider: mapProvider, 45 58 _x: 0, … … 50 63 }; 51 64 52 grid = TileGrid(attachMovie(TileGrid.symbolName, 'grid', getNextHighestDepth(), initObj ));65 grid = TileGrid(attachMovie(TileGrid.symbolName, 'grid', getNextHighestDepth(), initObj)); 53 66 54 67 var extent:/*Location*/Array = [new Location(80, -180), … … 288 301 grid.putMarker(name, mapProvider.locationCoordinate(location), location); 289 302 } 303 304 public function onMarkerEnters(marker:Marker):Void 305 { 306 //grid.log('+ '+marker.toString()); 307 dispatchEvent({target: this, type: EVENT_MARKER_ENTERS, marker: marker}); 308 } 309 310 public function onMarkerLeaves(marker:Marker):Void 311 { 312 //grid.log('- '+marker.toString()); 313 dispatchEvent({target: this, type: EVENT_MARKER_LEAVES, marker: marker}); 314 } 290 315 } trunk/as2/lib/SampleClient.as
r132 r135 33 33 34 34 __map.setInitialExtent(extent); 35 36 __map.addEventListener(Map.EVENT_MARKER_ENTERS, onMarkerEnters); 37 __map.addEventListener(Map.EVENT_MARKER_LEAVES, onMarkerLeaves); 35 38 36 39 __map.putMarker('Rochdale', new Location(37.865571, -122.259679)); … … 149 152 } 150 153 154 private static function onMarkerEnters(event:Object):Void 155 { 156 __map.grid.log('+ '+event.marker.toString()+' =)'); 157 } 158 159 private static function onMarkerLeaves(event:Object):Void 160 { 161 __map.grid.log('- '+event.marker.toString()+' =('); 162 } 151 163 }
