public var nodecount:int=0;
public var waycount:int=0;
public var relationcount:int=0;
+ private var traces:Array = [];
protected function get nextNegative():Number {
return negativeID--;
public function createChangeset(tags:Object):void {}
public function closeChangeset():void {}
public function uploadChanges():void {}
+ public function fetchUserTraces():void {}
}
}
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onStatus);
loader.load(urlReq);
}
+
+ private function sendOAuthGet(url:String, onComplete:Function, onError:Function, onStatus:Function):void {
+ var sig:IOAuthSignatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
+ var oauthRequest:OAuthRequest = new OAuthRequest("GET", url, null, appID, authToken);
+ var urlStr:Object = oauthRequest.buildRequest(sig, OAuthRequest.RESULT_TYPE_URL_STRING);
+
+ var urlReq:URLRequest = new URLRequest(String(urlStr));
+ urlReq.method = "GET";
+ var loader:URLLoader = new URLLoader();
+ loader.addEventListener(Event.COMPLETE, onComplete);
+ loader.addEventListener(IOErrorEvent.IO_ERROR, onError);
+ loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onStatus);
+ loader.load(urlReq);
+ }
override public function uploadChanges():void {
var changeset:Changeset = getActiveChangeset();
}
}
+ override public function fetchUserTraces():void {
+ sendOAuthGet(Connection.apiBaseURL+"user/gpx_files",
+ tracesLoadComplete, errorOnMapLoad, mapLoadStatus); //needs error handlers
+ dispatchEvent(new Event(LOAD_STARTED)); //specific to map or reusable?
+ }
+
+ private function tracesLoadComplete(event:Event):void {
+ //for each result in XML file
+ // create a trace object
+ // store in connection.traces
+ //emit event
+ var traces:XML = new XML(URLLoader(event.target).data);
+ trace(traces);
+ }
}
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<mx:TitleWindow
+ xmlns:mx="http://www.adobe.com/2006/mxml"
+ layout="vertical" showCloseButton="true"
+ horizontalAlign="center" title="MyGpx Files"
+ width="600" height="400"
+ verticalGap="0">
+ <mx:Script><![CDATA[
+ import mx.managers.PopUpManager;
+ import mx.events.CloseEvent;
+ import mx.core.Application;
+
+ import net.systemeD.halcyon.connection.*;
+
+ public function init():void {
+ PopUpManager.addPopUp(this, Application(Application.application), true);
+ PopUpManager.centerPopUp(this);
+ this.addEventListener(CloseEvent.CLOSE, myGpxDialog_close);
+
+ // store whether the user has seen the help dialog before
+ var obj:SharedObject = SharedObject.getLocal("user_state");
+ obj.setProperty("help_shown","true");
+ }
+
+ private function myGpxDialog_close(evt:CloseEvent):void {
+ PopUpManager.removePopUp(this);
+ }
+
+ private function fetchList():void {
+ Connection.getConnectionInstance().fetchUserTraces();
+ results.text="yes";
+ }
+ ]]>
+ </mx:Script>
+
+ <mx:Text text="foo" id="results" />
+ <mx:Button label="fetch" click="fetchList()" />
+</mx:TitleWindow>
\ No newline at end of file
<mx:PopUpButton id="styleButton" label="Map Style" openAlways="true"
creationComplete="styleButton.popUp = new StyleSelector();"/>
<mx:Button label="GPS" click="trackLoader.load();"/>
+ <mx:Button label="MyGpx" click="new MyGpxDialog().init();" />
<mx:Spacer width="100%"/>
<mx:Button label="Undo" click="MainUndoStack.getGlobalStack().undo();"
enabled="{MainUndoStack.getGlobalStack().canUndo()}"/>
import net.systemeD.potlatch2.help.*;
import net.systemeD.potlatch2.options.*;
import net.systemeD.potlatch2.utils.*;
+ import net.systemeD.potlatch2.mygpx.*;
import mx.managers.PopUpManager;
import flash.system.Security;
import flash.net.*;