** Potlatch 1-style "floaty warnings"
** Should remember which background imagery layer you had previously selected
-** Dialog for adding custom imagery url
+* Custom imagery dialog fixes
* Ctrl-clicking two areas (one inside the other) should create a multipolygon
* B keypress for background source tag
* Bbox-sensitive menu for background imagery
--- /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="Background imagery"
+ width="500" height="300" verticalGap="0">
+
+ <mx:DataGrid editable="true" width="100%" height="100%" id="imageryGrid">
+ <mx:columns>
+ <mx:DataGridColumn editable="true" dataField="label" headerText="Name"/>
+ <mx:DataGridColumn editable="true" dataField="data" headerText="URL"/>
+ </mx:columns>
+ </mx:DataGrid>
+
+ <mx:HBox horizontalAlign="right" width="100%">
+ <mx:LinkButton label="Delete" click="removeSource()" enabled="{imageryGrid.selectedItem != null? true : false}"/>
+ <mx:LinkButton label="Add" click="addNewSource()"/>
+ </mx:HBox>
+
+ <mx:Script><![CDATA[
+
+ /*
+ Still to do:
+ - editable hotkeys for each layer
+ - editable source tag for each layer
+ - editable bbox for each layer
+ - ability to use this dialogue to select as well as edit
+ - automatically select imagery once you've edited it (i.e. itemEditEnd)
+ - save/load imagery sets into OSM preferences
+ */
+
+ import mx.managers.PopUpManager;
+ import mx.events.CloseEvent;
+ import mx.core.Application;
+ import mx.collections.ArrayCollection;
+ import mx.controls.List;
+
+ public var imageryCollection:ArrayCollection = new ArrayCollection(Application.application.theController.imagery);
+ private var menu:List;
+
+ public function init(menu:List):void {
+ this.menu=menu;
+ PopUpManager.addPopUp(this, Application(Application.application), true);
+ PopUpManager.centerPopUp(this);
+ this.addEventListener(CloseEvent.CLOSE, backgroundDialog_close);
+ imageryGrid.dataProvider=imageryCollection;
+ }
+
+ private function backgroundDialog_close(evt:CloseEvent):void {
+ PopUpManager.removePopUp(this);
+ if (menu) { menu.invalidateList(); }
+ }
+
+ private function addNewSource():void {
+ imageryCollection.addItemAt( {label:'(new name)',data:'(new URL)'} , imageryCollection.length);
+ imageryGrid.validateNow();
+ imageryGrid.verticalScrollPosition=imageryGrid.maxVerticalScrollPosition;
+ imageryGrid.editedItemPosition = {rowIndex: imageryCollection.length-1, columnIndex: 0};
+ }
+ private function removeSource():void {
+ imageryCollection.removeItemAt(imageryGrid.selectedIndex);
+ }
+
+ ]]>
+ </mx:Script>
+
+</mx:TitleWindow>
horizontalAlign="left" backgroundColor="white" borderStyle="inset">
<mx:List width="100%" height="100%" id="background" change="updateBackground();" verticalScrollPolicy="on"
- dataProvider="{_layers}" />
+ dataProvider="{Application.application.theController.imagery}" />
<mx:CheckBox width="100%" label="Dim background" selected="true" id="dim"
change="Globals.vars.root.tileset.setDimming(dim.selected); Globals.vars.yahoo.alpha = dim.selected ? 0.5 : 1" />
- <mx:Button label="Load vector file..." click="new VectorSourceDialog().init();"/>
+ <mx:HBox>
+ <mx:Button label="Edit..." click="new BackgroundDialog().init(background);" />
+ <mx:Button label="Vector file" click="new VectorSourceDialog().init();" />
+ </mx:HBox>
<mx:Script><![CDATA[
import net.systemeD.halcyon.*;
import mx.managers.PopUpManager;
import net.systemeD.halcyon.Globals;
- [Bindable] private var _layers:Array=new Array(
- { label: "None", data: "" },
- { label: "Yahoo", data: "yahoo" } );
-
- public function populate(xml:XML):void {
- for each(var set:XML in xml.set) {
- _layers.push({ label:set.child("name"), data:set.child("url") });
- }
- }
-
private function updateBackground():void {
var theMap:Map = Globals.vars.root;
var bg:String=background.selectedItem.data;
private var keys:Object={};
public var clipboards:Object={};
+ public var imagery:Array=[];
[Embed(source="../../../embedded/pen.png")] public var pen:Class;
[Embed(source="../../../embedded/pen_x.png")] public var pen_x:Class;
}
private function onImageryLoad(event:Event):void {
- var imagery:XML = new XML(URLLoader(event.target).data);
- BackgroundSelector(bgButton.popUp).populate(imagery);
+ var xml:XML = new XML(URLLoader(event.target).data);
+ theController.imagery=new Array(
+ { label: "None", data: "" },
+ { label: "Yahoo", data: "yahoo" } );
+ for each(var set:XML in xml.set) {
+ theController.imagery.push({ label:set.child("name"), data:set.child("url") });
+ }
}
-
private function dragEnterHandler(event:DragEvent):void {
// Get the drop target component from the event object.