Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
systemed committed May 21, 2011
2 parents a08e20c + 93ad41d commit 24822a7
Show file tree
Hide file tree
Showing 21 changed files with 488 additions and 68 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ build.properties
l10n/locale/bundles
version.as
halcyon.tmproj
Potlatch2.as3proj

resources/locales
resources/*.swf
resources/*.cache
resources/docs
resources/mapquest

/tests/bin/
/tests/report/

/generated

bin/
obj/
35 changes: 35 additions & 0 deletions embedded/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion net/systemeD/halcyon/connection/Connection.as
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ package net.systemeD.halcyon.connection {
public function loadBbox(left:Number, right:Number,
top:Number, bottom:Number):void {
}
public function loadEntity(entity:Entity):void {}
public function loadEntityByID(type:String, id:Number):void {}
public function setAuthToken(id:Object):void {}
public function setAccessToken(key:String, secret:String):void {}
public function createChangeset(tags:Object):void {}
Expand All @@ -553,6 +553,11 @@ package net.systemeD.halcyon.connection {
public function fetchUserTraces(refresh:Boolean=false):void {}
public function fetchTrace(id:Number, callback:Function):void {}
public function hasAccessToken():Boolean { return false; }

public function loadEntity(entity:Entity):void {
loadEntityByID(entity.getType(),entity.id);
}

}

}
Expand Down
6 changes: 3 additions & 3 deletions net/systemeD/halcyon/connection/XMLConnection.as
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ package net.systemeD.halcyon.connection {
sendLoadRequest(mapRequest);
}

override public function loadEntity(entity:Entity):void {
var url:String=Connection.apiBaseURL + entity.getType() + "/" + entity.id;
if (entity is Relation || entity is Way) url+="/full";
override public function loadEntityByID(type:String, id:Number):void {
var url:String=Connection.apiBaseURL + type + "/" + id;
if (type=='way') url+="/full";
sendLoadRequest(new URLRequest(url));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package net.systemeD.halcyon.connection.actions {
for each (var member:RelationMember in memberList) {
member.entity.removeParent(relation);
}
memberList.splice(0, memberList.length);
memberList=[];
effects.doAction();
setDeleted(true);

Expand All @@ -52,6 +52,7 @@ package net.systemeD.halcyon.connection.actions {
effects.undoAction();
for each(var member:RelationMember in oldMemberList) {
memberList.push(member);
member.entity.addParent(relation);
relation.dispatchEvent(new RelationMemberEvent(
Connection.RELATION_MEMBER_ADDED, member.entity, relation, 0));
}
Expand Down
2 changes: 1 addition & 1 deletion net/systemeD/halcyon/styleparser/RuleSet.as
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ package net.systemeD.halcyon.styleparser {

private function loadedImage(event:Event):void {
var fn:String=event.target.info['filename'];
images[fn]=event.target.data;
images[fn]=event.target.data; if (images[fn].length==0) return;

var loader:ExtendedLoader = new ExtendedLoader();
loader.info['filename']=fn;
Expand Down
65 changes: 65 additions & 0 deletions net/systemeD/potlatch2/RelationLoaderPanel.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:potlatch2="net.systemeD.potlatch2.*"
title="Load Relation" width="350" height="160"
creationComplete="requestedID.setFocus()"
showCloseButton="true" close="PopUpManager.removePopUp(this);">

<mx:HBox paddingLeft="3" paddingTop="4">
<mx:Label text="Relation ID: " />
<mx:TextInput id="requestedID" restrict="0-9" />
</mx:HBox>
<mx:ControlBar>
<mx:Spacer width="100%"/>
<mx:Button label="Load" click="loadRelation();" styleName="titleWindowButton" />
</mx:ControlBar>
<mx:Script><![CDATA[
import net.systemeD.halcyon.*;
import net.systemeD.halcyon.connection.*;
import net.systemeD.potlatch2.*;
import mx.managers.PopUpManager;
private var entity:Entity;
private var relid:Number;
public function setEntity(e:Entity):void {
entity=e;
}
private function loadRelation():void {
relid = Number(requestedID.text);
PopUpManager.removePopUp(this);
var conn:Connection = Connection.getConnectionInstance();
if (!relid) return;
if (conn.getRelation(relid)) {
relationLoaded(null);
} else {
conn.loadEntityByID("relation",relid);
conn.addEventListener(Connection.LOAD_COMPLETED, relationLoaded);
}
}
private function relationLoaded(event:Event):void {
var conn:Connection = Connection.getConnectionInstance();
var relation:Relation = conn.getRelation(relid);
conn.removeEventListener(Connection.LOAD_COMPLETED, relationLoaded);
if (!relation) return;
var undo:CompositeUndoableAction = new CompositeUndoableAction("Add to relation");
if (entity is EntityCollection) {
for each (var e:Entity in EntityCollection(entity).entities) {
if (relation.findEntityMemberIndex(e)==-1) {
relation.appendMember(new RelationMember(e, ''), undo.push);
}
}
} else {
relation.appendMember(new RelationMember(entity, ''), undo.push);
}
MainUndoStack.getGlobalStack().addAction(undo);
}
]]></mx:Script>
</mx:TitleWindow>

9 changes: 9 additions & 0 deletions net/systemeD/potlatch2/RelationSelectPanel.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,22 @@
panel.setRelation(relation);
PopUpManager.centerPopUp(panel);
}
public function closeAndLoadRelation():void {
PopUpManager.removePopUp(this);
var panel:RelationLoaderPanel = RelationLoaderPanel(
PopUpManager.createPopUp(Application(Application.application), RelationLoaderPanel, true));
panel.setEntity(entity);
PopUpManager.centerPopUp(panel);
}
]]></mx:Script>
<mx:Text id="warning" text="" />
<mx:List width="100%" height="100%" id="relationSelector" verticalScrollPolicy="on" allowMultipleSelection="true" >
</mx:List>
<mx:ControlBar>
<mx:Button label="New Relation..." click="closeAndNewRelation();" styleName="titleWindowButton" />
<mx:Button label="Load Relation..." click="closeAndLoadRelation();" styleName="titleWindowButton" />
<mx:Spacer width="100%"/>
<mx:Button label="Select" click="updateEntityAndClose();" enabled="{relationSelector.selectedItems.length>0}" styleName="titleWindowButton" />
</mx:ControlBar>
Expand Down
12 changes: 11 additions & 1 deletion net/systemeD/potlatch2/TagViewer.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
import mx.core.*;
import mx.managers.PopUpManager;
import mx.controls.Menu;
import mx.controls.Alert;
import flash.geom.Point;
import flash.net.*;
import mx.events.DragEvent;
Expand Down Expand Up @@ -659,7 +660,8 @@
var menu:Menu = new Menu();
var dp:Object = [ {label: "Select all members"},
{label: "Deselect all members"},
{label: "Add selection to this relation", enabled: false} ];
{label: "Add selection to this relation", enabled: false},
{label: "Delete relation"} ];
menu.dataProvider = dp;
menu.addEventListener("itemClick", selectRelationMenu);
button.popUp = menu;
Expand Down Expand Up @@ -710,6 +712,14 @@
}
MainUndoStack.getGlobalStack().addAction(undo);
break;
case 3: // Delete relation
Alert.show("Do you really want to delete the relation?","Are you sure?",Alert.YES | Alert.CANCEL,null,
function(event:CloseEvent):void {
if (event.detail==Alert.CANCEL) return;
rel.remove(MainUndoStack.getGlobalStack().addAction);
} );
break;
}
}
Expand Down
50 changes: 32 additions & 18 deletions net/systemeD/potlatch2/Yahoo.as
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,68 @@ package net.systemeD.potlatch2 {
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;
private var inited:Boolean;
private var enabled:Boolean;

public function Yahoo(w:Number, h:Number, map:Map) {
public function Yahoo(map:Map) {
super();
this.init(token, w, h);
this.mapType="satellite";
this.alpha=0.5;
currentState=UNINITIALISED;
this.map=map;
inited=false;
visible=enabled=false;
this.addEventListener(YahooMapEvent.MAP_INITIALIZE, initHandler);
visible=false;
}

public function show():void {
visible=enabled=true;
if (inited) {
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);
}

public function hide():void {
visible=enabled=false;


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 {
inited=true;
currentState=visible ? SHOWING : HIDDEN;
if (map.centre_lat) { moveto(map.centre_lat, map.centre_lon, map.scale); }
this.removeEventListener(YahooMapEvent.MAP_INITIALIZE, initHandler);
visible=enabled;
}

private function moveHandler(event:MapEvent):void {
if (!inited) { return; }
if (currentState!=SHOWING) { return; }
moveto(event.params.lat, event.params.lon, event.params.scale);
}

Expand Down
6 changes: 2 additions & 4 deletions net/systemeD/potlatch2/collections/Imagery.as
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ package net.systemeD.potlatch2.collections {
var backgroundSet:Boolean = false;

// Read all values from XML file
collection=new Array(
{ name: "None", url: "" },
{ name: "Yahoo", url: "yahoo", sourcetag: "Yahoo" } );
collection=new Array({ name: "None", url: "" });
for each(var set:XML in xml.set) {
var obj:Object={};
var a:XML;
Expand All @@ -75,7 +73,7 @@ package net.systemeD.potlatch2.collections {
}

// Add user's previous preference (from SharedObject) if we didn't find it in the XML file
if (!isSet && saved.name && saved.url && saved.url!='' && saved.url!='yahoo') {
if (!isSet && saved.name && saved.url && saved.url!='') {
collection.push(saved);
isSet=true;
}
Expand Down
Loading

0 comments on commit 24822a7

Please sign in to comment.