Remove the vestigial Yahoo code and library.
authorAndy Allan <andy@gravitystorm.co.uk>
Sun, 25 Mar 2012 14:58:53 +0000 (15:58 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Sun, 25 Mar 2012 15:01:58 +0000 (16:01 +0100)
lib/YahooMap-0.9.4.swc [deleted file]
net/systemeD/potlatch2/BackgroundSelector.mxml
net/systemeD/potlatch2/Yahoo.as [deleted file]
net/systemeD/potlatch2/collections/Imagery.as
net/systemeD/potlatch2/collections/Stylesheets.as
potlatch2.mxml

diff --git a/lib/YahooMap-0.9.4.swc b/lib/YahooMap-0.9.4.swc
deleted file mode 100644 (file)
index ccecc5f..0000000
Binary files a/lib/YahooMap-0.9.4.swc and /dev/null differ
index 4b339d0..f7915e0 100644 (file)
@@ -36,7 +36,6 @@
 
                public function setDimming(v:Boolean):void {
                        FlexGlobals.topLevelApplication.theMap.setDimming(dim.selected);
-                       FlexGlobals.topLevelApplication.yahoo.alpha = dim.selected ? 0.5 : 1;
                        var obj:SharedObject=SharedObject.getLocal("user_state");
                        obj.setProperty('background_dim',v);
                        obj.flush();
diff --git a/net/systemeD/potlatch2/Yahoo.as b/net/systemeD/potlatch2/Yahoo.as
deleted file mode 100644 (file)
index 7530324..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-package net.systemeD.potlatch2 {
-
-       import flash.display.*;
-       import net.systemeD.halcyon.Map;
-       import net.systemeD.halcyon.MapEvent;
-       import com.yahoo.maps.api.YahooMap;
-       import com.yahoo.maps.api.YahooMapEvent;
-       import com.yahoo.maps.api.core.location.LatLon;
-       
-    public class Yahoo extends YahooMap {
-
-               private var map:Map;
-               private static const token:String="f0a.sejV34HnhgIbNSmVHmndXFpijgGeun0fSIMG9428hW_ifF3pYKwbV6r9iaXojl1lU_dakekR";
-               private static const MAXZOOM:int=17;
-
-               private static const UNINITIALISED:uint=0;
-               private static const INITIALISING:uint=1;
-               private static const HIDDEN:uint=2;
-               private static const SHOWING:uint=3;
-               private var currentState:uint=UNINITIALISED;
-
-               private var _lat:Number;
-               private var _lon:Number;
-               private var _scale:Number;
-               private var offset_lat:Number=0;
-               private var offset_lon:Number=0;
-
-               public function Yahoo(map:Map) {
-                       super();
-                       currentState=UNINITIALISED;
-                       this.map=map;
-                       visible=false;
-               }
-               
-               public function show():void {
-                       visible=true;
-                       if (currentState==UNINITIALISED) {
-                               currentState=INITIALISING;
-                               this.addEventListener(YahooMapEvent.MAP_INITIALIZE, initHandler);
-                               this.init(token, map.mapwidth, map.mapheight);
-                               this.mapType="satellite";
-                               this.alpha=0.5;                         // ** FIXME - should take the value the user has chosen
-                               activateListeners();
-                       } else if (currentState==HIDDEN) { 
-                               currentState=SHOWING;
-                               moveto(map.centre_lat, map.centre_lon, map.scale);
-                               this.setSize(map.mapwidth,map.mapheight);
-                               activateListeners();
-                       }
-               }
-
-               public function hide():void {
-                       deactivateListeners();
-                       visible=false;
-                       if (currentState==SHOWING) currentState=HIDDEN;
-               }
-
-               private function activateListeners():void {
-                       map.addEventListener(MapEvent.MOVE, moveHandler);
-                       map.addEventListener(MapEvent.RESIZE, resizeHandler);
-                       map.addEventListener(MapEvent.NUDGE_BACKGROUND, nudgeHandler);
-               }
-               
-               private function deactivateListeners():void {
-                       map.removeEventListener(MapEvent.MOVE, moveHandler);
-                       map.removeEventListener(MapEvent.RESIZE, resizeHandler);
-                       map.removeEventListener(MapEvent.NUDGE_BACKGROUND, nudgeHandler);
-               }
-               
-               private function initHandler(event:YahooMapEvent):void {
-                       currentState=visible ? SHOWING : HIDDEN;
-                       if (map.centre_lat) { moveto(map.centre_lat, map.centre_lon, map.scale); }
-                       this.removeEventListener(YahooMapEvent.MAP_INITIALIZE, initHandler);
-               }
-
-               private function moveHandler(event:MapEvent):void {
-                       if (currentState!=SHOWING) { return; }
-                       moveto(event.params.lat, event.params.lon, event.params.scale);
-               }
-
-               private function moveto(lat:Number,lon:Number,scale:uint):void {
-                       if (scale>MAXZOOM) { visible=false; return; }
-                       _lat=lat; _lon=lon; _scale=scale;
-                       
-                       visible=true;
-                       this.zoomLevel=18-scale;
-                       this.centerLatLon=new LatLon(lat+offset_lat, lon+offset_lon);
-               }
-               
-               private function resizeHandler(event:MapEvent):void {
-                       moveto(map.centre_lat, map.centre_lon, map.scale);
-                       this.setSize(event.params.width, event.params.height);
-               }
-               
-               private function nudgeHandler(event:MapEvent):void {
-                       var cx:Number=map.lon2coord(map.centre_lon);
-                       var cy:Number=map.lat2coord(map.centre_lat);
-                       offset_lon+=map.coord2lon(cx-event.params.x)-map.centre_lon;
-                       offset_lat+=map.coord2lat(cy-event.params.y)-map.centre_lat;
-                       moveto(_lat,_lon,_scale);
-               }
-       }
-}
index 069ae67..6fbdb8a 100644 (file)
@@ -8,12 +8,10 @@ package net.systemeD.potlatch2.collections {
        import net.systemeD.halcyon.Map;
        import net.systemeD.halcyon.MapEvent;
        import net.systemeD.potlatch2.FunctionKeyManager;
-       import net.systemeD.potlatch2.Yahoo;
        import mx.collections.ArrayCollection;
 
        /*
                There's lots of further tidying we can do:
-               - remove all the horrid Yahoo stuff
                - remove the backreferences to _map and send events instead
                but this will do for now and help remove the clutter from potlatch2.mxml.
        */
@@ -28,14 +26,12 @@ package net.systemeD.potlatch2.collections {
 
                private var _map:Map;
                private var _overlay:Sprite;
-               private var _yahoo:Yahoo;
 
                /* Load catalogue file */
 
-               public function init(map:Map, overlay:Sprite, yahoo:Yahoo):void {
+               public function init(map:Map, overlay:Sprite):void {
                        _map = map;
                        _overlay = overlay;
-                       _yahoo = yahoo;
 
                        // load imagery file
             FileBank.getInstance().addFromFile("imagery.xml", onImageryLoad);
@@ -147,8 +143,7 @@ package net.systemeD.potlatch2.collections {
                public function setBackground(bg:Object):void {
                        // set background
                        _selected=bg;
-                       if (bg.url=='yahoo') { dispatchEvent(new CollectionEvent(CollectionEvent.SELECT, {url:''})); _yahoo.show(); }
-                                       else { dispatchEvent(new CollectionEvent(CollectionEvent.SELECT, bg      )); _yahoo.hide(); }
+                       dispatchEvent(new CollectionEvent(CollectionEvent.SELECT, bg));
                        // update attribution and logo
                        _overlay.visible=bg.attribution || bg.logo || bg.terms_url;
                        setLogo(); setAttribution(); setTerms();
index 3ffc669..209eac5 100644 (file)
@@ -6,7 +6,6 @@ package net.systemeD.potlatch2.collections {
        import net.systemeD.halcyon.FileBank;
        import net.systemeD.halcyon.Map;
        import net.systemeD.potlatch2.FunctionKeyManager;
-       import net.systemeD.potlatch2.Yahoo;
        import mx.collections.ArrayCollection;
 
        public class Stylesheets extends EventDispatcher {
index 32bc8d8..88ad039 100644 (file)
 
         public var theMap:Map;
         public var theController:EditController;
-               public var yahoo:Yahoo;
                public var trackLoader:TrackLoader;
                public var toolbox:Toolbox;
         public var bugLoader:BugLoader;
                        theMap.backdrop=b;
             theMap.updateSize(w,h);
                        theMap.addEventListener(MapEvent.SCALE, scaleHandler);
-
-                       yahoo=new Yahoo(theMap);
-                       yahoo.hide();
-                       _root.addChild(yahoo);
                        _root.addChild(theMap);
 
                        // Initialise stylesheets
                        theMap.tileset.blocks=[/google\./i];    // hard-coded block on Google tiles
                        theMap.tileset.setDimming(params['background_dim']    ==null ? true  : params['background_dim']);
                        theMap.tileset.setSharpen(params['background_sharpen']==null ? false : params['background_sharpen']);
-                       Imagery.instance().init(theMap, overlay, yahoo);
+                       Imagery.instance().init(theMap, overlay);
                        Imagery.instance().addEventListener(MapEvent.BUMP, bumpHandler);
                        Imagery.instance().addEventListener(CollectionEvent.SELECT,
                                function(e:CollectionEvent):void { theMap.tileset.init(e.data, e.data!=''); }