Permalink
Browse files

Remove the vestigial Yahoo code and library.

  • Loading branch information...
1 parent a845f94 commit 37d7d21bf8f2f8d586073eb8a7bbdd6af3311a58 @gravitystorm gravitystorm committed Mar 25, 2012
View
Binary file not shown.
@@ -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();
@@ -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);
- }
- }
-}
@@ -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();
@@ -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 {
View
@@ -124,7 +124,6 @@
public var theMap:Map;
public var theController:EditController;
- public var yahoo:Yahoo;
public var trackLoader:TrackLoader;
public var toolbox:Toolbox;
public var bugLoader:BugLoader;
@@ -208,10 +207,6 @@
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
@@ -273,7 +268,7 @@
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!=''); }

0 comments on commit 37d7d21

Please sign in to comment.