Merge pull request #16 from gravitystorm/documentation
authorRichard Fairhurst <richard@systemeD.net>
Fri, 30 Sep 2011 20:44:16 +0000 (13:44 -0700)
committerRichard Fairhurst <richard@systemeD.net>
Fri, 30 Sep 2011 20:44:16 +0000 (13:44 -0700)
Documentation

99 files changed:
.gitignore
CODING.txt
README.txt
build.xml
embedded/Arrow.fxg [new file with mode: 0644]
embedded/CollapsiblePanelAssets.swf [new file with mode: 0755]
embedded/tab_address.png [new file with mode: 0644]
embedded/tab_basic.png [new file with mode: 0644]
embedded/tab_cycle.png [new file with mode: 0644]
embedded/tab_details.png [new file with mode: 0644]
embedded/tab_restrictions.png [new file with mode: 0644]
embedded/tab_transport.png [new file with mode: 0644]
embedded/tab_walk.png [new file with mode: 0644]
lib/flexlib.swc
lib/zip.swc [new file with mode: 0644]
net/systemeD/controls/AutoComplete.as
net/systemeD/controls/CollapsiblePanel.as [new file with mode: 0644]
net/systemeD/controls/DataGridWarningField.as
net/systemeD/halcyon/ImageBank.as [new file with mode: 0755]
net/systemeD/halcyon/Map.as
net/systemeD/halcyon/MarkerUI.as
net/systemeD/halcyon/NodeUI.as
net/systemeD/halcyon/WayBitmapFiller.as [deleted file]
net/systemeD/halcyon/WayUI.as
net/systemeD/halcyon/connection/Connection.as
net/systemeD/halcyon/connection/Trace.as
net/systemeD/halcyon/connection/XMLBaseConnection.as
net/systemeD/halcyon/connection/XMLConnection.as
net/systemeD/halcyon/connection/actions/SetTagAction.as
net/systemeD/halcyon/styleparser/RuleSet.as
net/systemeD/halcyon/styleparser/StyleChooser.as
net/systemeD/potlatch2/BackgroundDialog.mxml
net/systemeD/potlatch2/BackgroundSelector.mxml
net/systemeD/potlatch2/CategorySelector.mxml
net/systemeD/potlatch2/Preloader.as
net/systemeD/potlatch2/RelationEditorPanel.mxml
net/systemeD/potlatch2/RelationLoaderPanel.mxml
net/systemeD/potlatch2/RelationSelectPanel.mxml
net/systemeD/potlatch2/StyleSelector.mxml
net/systemeD/potlatch2/TagGrid.mxml
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/Toolbox.mxml
net/systemeD/potlatch2/VectorSourceDialog.mxml
net/systemeD/potlatch2/collections/Imagery.as
net/systemeD/potlatch2/controller/ControllerState.as
net/systemeD/potlatch2/find/FindDialog.mxml
net/systemeD/potlatch2/help/HelpDialog.mxml
net/systemeD/potlatch2/help/VideoPlayer.mxml
net/systemeD/potlatch2/mapfeatures/EditorFactory.as
net/systemeD/potlatch2/mapfeatures/Feature.as
net/systemeD/potlatch2/mapfeatures/editors/CheckboxEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/ChoiceComboBox.as
net/systemeD/potlatch2/mapfeatures/editors/ChoiceEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/ChoiceEditorFactory.as
net/systemeD/potlatch2/mapfeatures/editors/FreeTextEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/FreeTextEditorFactory.as
net/systemeD/potlatch2/mapfeatures/editors/NumberEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/RestrictionRenderer.mxml
net/systemeD/potlatch2/mapfeatures/editors/RouteEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/RouteIcon.mxml
net/systemeD/potlatch2/mapfeatures/editors/SingleTagEditorFactory.as
net/systemeD/potlatch2/mapfeatures/editors/SliderEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/SpeedEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/TurnRestrictionEditor.mxml
net/systemeD/potlatch2/mapfeatures/editors/TurnRestrictionIcon.mxml
net/systemeD/potlatch2/mapfeatures/editors/TurnRestrictionRenderer.mxml
net/systemeD/potlatch2/mygpx/MyGpxDialog.mxml
net/systemeD/potlatch2/options/OptionsDialog.mxml
net/systemeD/potlatch2/panels/BackgroundPanel.mxml
net/systemeD/potlatch2/panels/BugPanel.mxml
net/systemeD/potlatch2/panels/MarkerPanel.mxml
net/systemeD/potlatch2/save/OAuthPanel.mxml
net/systemeD/potlatch2/save/SaveDialog.mxml
net/systemeD/potlatch2/save/SaveManager.as
potlatch2-config.xml
potlatch2.mxml
resources/assets/features_pois.zip [new file with mode: 0644]
resources/assets/icons.zip [new file with mode: 0644]
resources/features/route__mtb.png [new file with mode: 0644]
resources/imagery.xml
resources/map_features.xml
resources/map_features/amenities.xml
resources/map_features/barriers.xml
resources/map_features/buildings.xml
resources/map_features/landuse.xml
resources/map_features/man_made.xml
resources/map_features/paths.xml
resources/map_features/places.xml
resources/map_features/power.xml
resources/map_features/shopping.xml
resources/map_features/tourism.xml
resources/map_features/transport.xml
resources/potlatch2.html
resources/server.rb [changed mode: 0644->0755]
resources/stylesheets/core_interactive.css
resources/stylesheets/core_relations.css
resources_src/route__mtb.ai [new file with mode: 0644]
styles/Application.css
version.as.template

index b07f606..a70a75a 100644 (file)
@@ -9,6 +9,7 @@ resources/*.swf
 resources/*.cache
 resources/docs
 resources/mapquest
+resources/generated
 
 /tests/bin/
 /tests/report/
index 4cb2fb2..d9c6e3e 100644 (file)
@@ -5,7 +5,7 @@
 
 == Dependencies and targets ==
 
-* We target Flash Player 9 at present. Please don't add FP10-specific code yet.
+* We target Flash Player 10.
 * Potlatch 2 requires Flex; the Halcyon rendering component doesn't. Don't add Flex stuff (import mx.*) to anything in net.systemeD.halcyon.
 * Both Potlatch 2 and Halcyon can be deployed locally (i.e. not on openstreetmap.org), and indeed can talk to databases other than the main OSM instance. So don't be too OSM-specific
 
index b905b9f..dabfc42 100644 (file)
@@ -10,18 +10,14 @@ Many icons used in halcyon/potlatch2 are based on the awesome CC0-licensed SJJB
 
 === What you'll need ===
 
-* Flex SDK 3.4 or 3.5 
+* Flex SDK 4.5
 ** Product page: http://www.adobe.com/products/flex/ 
-** Flex 3 Download page: http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3 (free, OS X/Windows/Linux)
+** Flex 4 Download page: http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4 (free, OS X/Windows/Linux)
 * AS3 docs - http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/
 * Flash debug player - http://www.adobe.com/support/flashplayer/downloads.html
 * Basically you might as well just sell your soul to Adobe
 * Ant
 
-***Do not use FlexSDK <= 3.3 or > 4***. There are compatibility errors with version 4, and 3.3
-and earlier have this bug: http://bugs.adobe.com/jira/browse/SDK-16705 which is a major issue for the
-tag editors.
-
 If you happen to have Adobe Flex Builder 3/Flash Builder 4, you can create a project and import files into it. 
 See http://wiki.openstreetmap.org/wiki/Potlatch_2/Developer_Documentation for details.
 
@@ -38,7 +34,7 @@ Compiling Potlatch 2:
   cp build.properties.template build.properties
   
 2) Edit the FLEX_HOME variable in build.properties  
- eg, FLEX_HOME=c:/flex_sdk/3.5.0.12683
+ eg, FLEX_HOME=c:/flex_sdk/4.5.0.20967
  
 3) ant
 
index eabba08..07e43f6 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,4 +1,4 @@
-<project name="Potlatch2 ├╝ber compile system" default="debug">
+<project name="Potlatch 2" default="debug">
 
   <!-- load properties from the environment -->
   <property environment="env" />
@@ -45,7 +45,7 @@
   </target>
 
   <!-- Build and output potlatch2.swf in release mode -->
-  <target name="release" depends="init">
+  <target name="release" depends="init"> <!-- FIXME convention is dist not release -->
     <mxmlc file="potlatch2.mxml">
       <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
       <source-path path-element="${FLEX_HOME}/frameworks"/>
@@ -63,6 +63,7 @@
       <arg line="-source-path ."/>
       <arg line="-doc-sources net/systemeD/"/>
       <arg line="-external-library-path=lib/"/>
+      <arg line="-target-player 10.0.0"/>
       <arg line="-exclude-classes ${org_classes} ${it_classes} ${hxasm_classes} ${com_classes}"/>
       <arg line="-output resources/docs/"/>
       <arg line="-window-title 'Halcyon and Potlatch2 Developer documentation'" />
        
       <!-- Sets java.awt.headless=true so font compilation works in headless environments -->
       <compiler.headless-server>true</compiler.headless-server>
+      <target-player>10.0.0</target-player>
      </mxmlc>
      
      <echo message="The ${test.application.name}.swf test runner has been created in ${test.bin.dir}" />
     <deployLocale locale="pl_PL" />
   </target>
 
+
+  <target name="clean"
+    description="clean up" >
+    <!-- Delete the ${build} and ${dist} directory trees -->
+    <!--
+
+    FIXME what is supposed to be cleaned?
+
+    <delete dir="${build}"/>
+    <delete dir="${dist}"/>
+
+    -->
+  </target>
+
+
 </project>
diff --git a/embedded/Arrow.fxg b/embedded/Arrow.fxg
new file mode 100644 (file)
index 0000000..7e1c73b
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Graphic xmlns="http://ns.adobe.com/fxg/2008" xmlns:fxg="http://ns.adobe.com/fxg/2008" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd" version="2.0" viewWidth="22" viewHeight="22"><mask><Group><Rect width="22" height="22"><fill><SolidColor color="#ffffff" alpha="1"/></fill></Rect></Group></mask><!--Unknown tag: sodipodi:namedview--><!--Unknown tag: defs--><!--Unknown tag: metadata--><Group x="0" y="-10"><Group id="layer1"><Group x="0" y="10"><Path data="M 11 0 6 13 c 1.1726216 -0.841614 2.5689509 -1.343529 4 -1.5 l 0 10.65625 2 0 L 12 11.5 c 1.440526 0.162502 2.839256 0.677108 4 1.53125 L 11 0 z" winding="nonZero" id="path2993"><fill><SolidColor color="#000000" alpha="1"/></fill></Path></Group></Group></Group></Graphic>
diff --git a/embedded/CollapsiblePanelAssets.swf b/embedded/CollapsiblePanelAssets.swf
new file mode 100755 (executable)
index 0000000..fd049dd
Binary files /dev/null and b/embedded/CollapsiblePanelAssets.swf differ
diff --git a/embedded/tab_address.png b/embedded/tab_address.png
new file mode 100644 (file)
index 0000000..b968f75
Binary files /dev/null and b/embedded/tab_address.png differ
diff --git a/embedded/tab_basic.png b/embedded/tab_basic.png
new file mode 100644 (file)
index 0000000..850b630
Binary files /dev/null and b/embedded/tab_basic.png differ
diff --git a/embedded/tab_cycle.png b/embedded/tab_cycle.png
new file mode 100644 (file)
index 0000000..67229f5
Binary files /dev/null and b/embedded/tab_cycle.png differ
diff --git a/embedded/tab_details.png b/embedded/tab_details.png
new file mode 100644 (file)
index 0000000..07812e5
Binary files /dev/null and b/embedded/tab_details.png differ
diff --git a/embedded/tab_restrictions.png b/embedded/tab_restrictions.png
new file mode 100644 (file)
index 0000000..424bbf7
Binary files /dev/null and b/embedded/tab_restrictions.png differ
diff --git a/embedded/tab_transport.png b/embedded/tab_transport.png
new file mode 100644 (file)
index 0000000..5cb7d91
Binary files /dev/null and b/embedded/tab_transport.png differ
diff --git a/embedded/tab_walk.png b/embedded/tab_walk.png
new file mode 100644 (file)
index 0000000..2663c93
Binary files /dev/null and b/embedded/tab_walk.png differ
index ca5a355..d2e37b4 100644 (file)
Binary files a/lib/flexlib.swc and b/lib/flexlib.swc differ
diff --git a/lib/zip.swc b/lib/zip.swc
new file mode 100644 (file)
index 0000000..2a6eeac
Binary files /dev/null and b/lib/zip.swc differ
index 833e627..0f9461a 100644 (file)
@@ -20,6 +20,7 @@ package net.systemeD.controls {
        import mx.core.UIComponent;
        import mx.controls.ComboBox;
        import mx.controls.DataGrid;
+       import mx.controls.TextInput;
        import mx.controls.listClasses.ListBase;
        import mx.collections.ArrayCollection;
        import mx.collections.ListCollectionView;
@@ -179,7 +180,7 @@ package net.systemeD.controls {
 
                        if (dropdown) {
                                if (typedTextChanged) {
-                                       cursorPosition = textInput.selectionBeginIndex;
+                                       cursorPosition = TextInput(textInput).selectionBeginIndex;
                                        updateDataProvider();
 
                                        if( collection.length==0 || typedText=="" || typedText==null ) {
@@ -208,25 +209,25 @@ package net.systemeD.controls {
                                // not in menu
                                // trace("not in menu"); trace("- restoring to "+typedText);
                                textInput.text = typedText;
-                               textInput.setSelection(cursorPosition, cursorPosition);
+                               textInput.selectRange(cursorPosition, cursorPosition);
                        } else if (dropdown && typedTextChanged && textInput.text!=typedText) {
                                // in menu, but user has typed
                                // trace("in menu, but user has typed"); trace("- restoring to "+typedText);
                                textInput.text = typedText;
-                               textInput.setSelection(cursorPosition, cursorPosition);
+                               textInput.selectRange(cursorPosition, cursorPosition);
                        } else if (showingDropdown && textInput.text==selectedLabel) {
                                // force update if Flex has fucked up again
                                // trace("should force update");
-                               textInput.htmlText=selectedLabel;
+                               TextInput(textInput).htmlText=selectedLabel;
                                textInput.validateNow();
-                               if (typedTextChanged) textInput.setSelection(cursorPosition, cursorPosition);
+                               if (typedTextChanged) textInput.selectRange(cursorPosition, cursorPosition);
                        } else if (showingDropdown && textInput.text!=selectedLabel && !typedTextChanged) {
                                // in menu, user has navigated with cursor keys/mouse
                                // trace("in menu, user has navigated with cursor keys/mouse");
                                textInput.text = selectedLabel;
-                               textInput.setSelection(0, textInput.text.length);
+                               textInput.selectRange(0, textInput.text.length);
                        } else if (textInput.text!="") {
-                               textInput.setSelection(cursorPosition, cursorPosition);
+                               textInput.selectRange(cursorPosition, cursorPosition);
                        }
 
                        if (showDropdown && !dropdown.visible) {
@@ -248,7 +249,7 @@ package net.systemeD.controls {
                        if (event.keyCode==Keyboard.ESCAPE && showingDropdown) {
                                // ESCAPE cancels dropdown
                                textInput.text = typedText;
-                               textInput.setSelection(textInput.text.length, textInput.text.length);
+                               textInput.selectRange(textInput.text.length, textInput.text.length);
                                showingDropdown = false;
                                dropdownClosed=true;
 
diff --git a/net/systemeD/controls/CollapsiblePanel.as b/net/systemeD/controls/CollapsiblePanel.as
new file mode 100644 (file)
index 0000000..4222107
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+
+The MIT License
+
+Copyright (c) 2007-2008 Ali Rantakari of hasseg.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+package net.systemeD.controls {
+       
+       import flash.events.*;
+       import mx.effects.AnimateProperty;
+       import mx.events.*;
+       import mx.containers.Panel;
+       import mx.core.ScrollPolicy;
+       
+       /**
+       * The icon designating a "closed" state
+       */
+       [Style(name="closedIcon", property="closedIcon", type="Object")]
+       
+       /**
+       * The icon designating an "open" state
+       */
+       [Style(name="openIcon", property="openIcon", type="Object")]
+       
+       /**
+       * This is a Panel that can be collapsed and expanded by clicking on the header.
+       * 
+       * @author Ali Rantakari
+       */
+       public class CollapsiblePanel extends Panel {
+               
+
+
+               private var _creationComplete:Boolean = false;
+               private var _open:Boolean = true;
+               private var _openAnim:AnimateProperty;
+               
+               
+               
+               /**
+               * Constructor
+               * 
+               */
+               public function CollapsiblePanel(aOpen:Boolean = true):void
+               {
+                       super();
+                       open = aOpen;
+                       this.addEventListener(FlexEvent.CREATION_COMPLETE, creationCompleteHandler);
+               }
+               
+               
+               
+               
+               
+               
+               
+               
+               // BEGIN: event handlers                                ------------------------------------------------------------
+               
+               private function creationCompleteHandler(event:FlexEvent):void
+               {
+                       this.horizontalScrollPolicy = ScrollPolicy.OFF;
+                       this.verticalScrollPolicy = ScrollPolicy.OFF;
+                       
+                       _openAnim = new AnimateProperty(this);
+                       _openAnim.duration = 300;
+                       _openAnim.property = "height";
+                       
+                       titleBar.addEventListener(MouseEvent.CLICK, headerClickHandler);
+                       
+                       _creationComplete = true;
+               }
+               
+               private function headerClickHandler(event:MouseEvent):void { toggleOpen(); }
+               
+               private function callUpdateOpenOnCreationComplete(event:FlexEvent):void { updateOpen(); }
+               
+               // --end--: event handlers                      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+               
+               
+               
+               
+               
+               
+               
+               
+               // BEGIN: private methods                               ------------------------------------------------------------
+               
+               // sets the height of the component without animation, based
+               // on the _open variable
+               private function updateOpen():void
+               {
+                       if (!_open) height = closedHeight;
+                       else height = openHeight;
+                       setTitleIcon();
+               }
+               
+               // the height that the component should be when open
+               private function get openHeight():Number {
+                       return measuredHeight;
+               }
+               
+               // the height that the component should be when closed
+               private function get closedHeight():Number {
+                       var hh:Number = getStyle("headerHeight");
+                       if (hh <= 0 || isNaN(hh)) hh = titleBar.height;
+                       return hh;
+               }
+               
+               // sets the correct title icon
+               private function setTitleIcon():void
+               {
+                       if (!_open) this.titleIcon = getStyle("closedIcon");
+                       else this.titleIcon = getStyle("openIcon");
+               }
+               
+               // --end--: private methods                     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+               
+               
+               
+               
+               
+               
+               
+               
+               // BEGIN: public methods                                ------------------------------------------------------------
+               
+               
+               
+               /**
+               * Collapses / expands this block (with animation)
+               */
+               public function toggleOpen():void 
+               {
+                       if (_creationComplete && !_openAnim.isPlaying) {
+                               
+                               _openAnim.fromValue = _openAnim.target.height;
+                               if (!_open) {
+                                       _openAnim.toValue = openHeight;
+                                       _open = true;
+                                       dispatchEvent(new Event(Event.OPEN));
+                               }else{
+                                       _openAnim.toValue = _openAnim.target.closedHeight;
+                                       _open = false;
+                                       dispatchEvent(new Event(Event.CLOSE));
+                               }
+                               setTitleIcon();
+                               _openAnim.play();
+                               
+                       }
+                       
+               }
+               
+               
+               /**
+               * Whether the block is in a expanded (open) state or not
+               */
+               public function get open():Boolean {
+                       return _open;
+               }
+               /**
+               * @private
+               */
+               public function set open(aValue:Boolean):void {
+                       _open = aValue;
+                       if (_creationComplete) updateOpen();
+                       else this.addEventListener(FlexEvent.CREATION_COMPLETE, callUpdateOpenOnCreationComplete, false, 0, true);
+               }
+               
+               
+               /**
+               * @private
+               */
+               override public function invalidateSize():void {
+                       super.invalidateSize();
+                       if (_creationComplete)
+                               if (_open && !_openAnim.isPlaying) this.height = openHeight;
+               }
+               
+               
+               // --end--: public methods                      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+               
+               
+       }
+
+}
+
index a337cc4..caa1423 100644 (file)
@@ -16,6 +16,7 @@ package net.systemeD.controls {
 
                private var _image:Image;
                [Embed(source="../../../embedded/warning.png")] private var warningIcon:Class;
+               private var _whiteList:Array = ["source","collection_times","service_times","smoking_hours","opening_hours"];
 
                function DataGridWarningField():void {
                        super();
@@ -33,8 +34,8 @@ package net.systemeD.controls {
 
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                        super.updateDisplayList(unscaledWidth, unscaledHeight);
-                       if (data.value && data.value.indexOf(';')>-1) {
+
+                       if (data.value && (_whiteList.indexOf(data.key)==-1) && (data.value.indexOf(';')>-1)) { 
                                setStyle('color',0xFF0000);
                                _image.visible=true;
                                _image.x = width -_image.width -5;
diff --git a/net/systemeD/halcyon/ImageBank.as b/net/systemeD/halcyon/ImageBank.as
new file mode 100755 (executable)
index 0000000..eca8547
--- /dev/null
@@ -0,0 +1,146 @@
+package net.systemeD.halcyon {
+    import flash.events.*;
+       import flash.display.*;
+       import flash.net.*;
+       import flash.utils.ByteArray;
+       import nochump.util.zip.*;
+
+       /*
+               ImageBank stores and retrieves bitmap images.
+               All images are internally stored as Loader.
+
+               See blog.yoz.sk/2009/10/bitmap-bitmapdata-bytearray/ for a really useful conversion guide!
+       */
+
+    public class ImageBank extends EventDispatcher{
+               private var images:Object={};
+               private var imagesRequested:uint=0;
+               private var imagesReceived:uint=0;
+               
+               public static const IMAGES_LOADED:String="imagesLoaded";
+               public static const ZIP_LOADED:String="zipLoaded";
+               
+               private static const GLOBAL_INSTANCE:ImageBank = new ImageBank();
+               public static function getInstance():ImageBank { return GLOBAL_INSTANCE; }
+
+               public function hasImage(name:String):Boolean {
+                       if (images[name]) return true;
+                       return false;
+               }
+
+               /* ==========================================================================================
+                  Populate with images 
+                  ========================================================================================== */
+
+               public function loadImage(filename:String):void {
+                       if (images[filename]) return;
+                       imagesRequested++;
+
+                       var loader:Loader=new Loader();
+                       images[filename]=loader;
+                       var request:URLRequest=new URLRequest(filename);
+                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE,                                               loadedImage);
+                       loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS,                  httpStatusHandler);
+                       loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR,    securityErrorHandler);
+                       loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,                                ioErrorHandler);
+                       loader.load(request);
+               }
+
+               private function loadedImage(event:Event):void {
+                       imageReceived();
+               }
+               private function httpStatusHandler(event:HTTPStatusEvent):void { }
+               private function securityErrorHandler(event:SecurityErrorEvent):void { 
+                       trace("securityErrorEvent: "+event.target.url);
+                       imageReceived();
+               }
+               private function ioErrorHandler(event:IOErrorEvent):void { 
+                       trace("ioErrorEvent: "+event.target.url); 
+                       imageReceived();
+               }
+               private function imageReceived():void {
+                       imagesReceived++;
+                       if (imagesReceived==imagesRequested) { dispatchEvent(new Event(IMAGES_LOADED)); }
+               }
+
+               /* ==========================================================================================
+                  Load from .zip file
+                  ========================================================================================== */
+               
+               public function loadFromZip(filename:String, prefix:String=""):void {
+                       var loader:URLLoader = new URLLoader();
+                       loader.dataFormat="binary";
+                       loader.addEventListener(Event.COMPLETE, function(e:Event):void { zipReady(e,prefix); } );
+                       loader.load(new URLRequest(filename));
+               }
+               private function zipReady(event:Event, prefix:String):void {
+                       var zip:ZipFile = new ZipFile(event.target.data);
+                       for (var i:uint=0; i<zip.entries.length; i++) {
+                               var fileref:ZipEntry = zip.entries[i];
+                               var data:ByteArray = zip.getInput(fileref);
+                               var loader:Loader=new Loader();
+                               images[prefix+fileref.name]=loader;
+                               loader.loadBytes(data);
+                       }
+                       dispatchEvent(new Event(ZIP_LOADED));
+               }
+
+
+               /* ==========================================================================================
+                  Get images 
+                  getAsDisplayObject(filename)
+                  getAsBitmapData(filename)
+                  getAsByteArray(filename)
+                  ========================================================================================== */
+
+               public function getAsDisplayObject(name:String):DisplayObject {
+                       /* If the image hasn't loaded yet, then add an EventListener for when it does. */
+                       if (getWidth(name)==0) {
+                               var loader:Loader = new Loader();
+                               images[name].contentLoaderInfo.addEventListener(Event.COMPLETE,
+                                       function(e:Event):void { loaderReady(e, loader) });
+                               return loader;
+                       }
+                       /* Otherwise, create a new Bitmap, because just returning the raw Loader
+                          (i.e. images[name]) would only allow it to be added to one parent. (The other 
+                          way to do this would be by copying the bytes as loaderReady does.). */
+                       return new Bitmap(getAsBitmapData(name));
+               }
+               
+               public function getOriginalDisplayObject(name:String):DisplayObject {
+                       /* But if we're going to clone it later, this'll work fine. */
+                       return images[name];
+               }
+
+               private function loaderReady(event:Event, loader:Loader):void {
+                       /* The file has loaded, so we can copy the data from there into our new Loader */
+                       var info:LoaderInfo = event.target as LoaderInfo;
+                       loader.loadBytes(info.bytes);
+               }
+
+               public function getAsBitmapData(name:String):BitmapData {
+                       var bitmapData:BitmapData=new BitmapData(getWidth(name), getHeight(name), true, 0xFFFFFF);
+                       bitmapData.draw(images[name]);
+                       return bitmapData;
+               }
+               
+               public function getAsByteArray(name:String):ByteArray {
+                       return images[name].contentLoaderInfo.bytes;
+               }
+
+               /* ==========================================================================================
+                  Get file information
+                  ========================================================================================== */
+
+               public function getWidth(name:String):int { 
+                       try { return images[name].contentLoaderInfo.width; }
+                       catch (error:Error) { } return 0;
+               }
+
+               public function getHeight(name:String):int { 
+                       try { return images[name].contentLoaderInfo.height; }
+                       catch (error:Error) { } return 0;
+               }
+
+       }
+}
\ No newline at end of file
index 8a45b07..1962177 100644 (file)
@@ -120,7 +120,7 @@ package net.systemeD.halcyon {
                // ------------------------------------------------------------------------------------------
                /** Recalculate co-ordinates from new Flash origin */
 
-               public function updateCoords(tx:Number,ty:Number):void {
+               private function updateCoords(tx:Number,ty:Number):void {
                        setScrollRectXY(tx,ty);
 
                        edge_t=coord2lat(-ty          );
@@ -133,7 +133,7 @@ package net.systemeD.halcyon {
                }
                
                /** Move the map to centre on a given latitude/longitude. */
-               public function updateCoordsFromLatLon(lat:Number,lon:Number):void {
+               private function updateCoordsFromLatLon(lat:Number,lon:Number):void {
                        var cy:Number=-(lat2coord(lat)-mapheight/2);
                        var cx:Number=-(lon2coord(lon)-mapwidth/2);
                        updateCoords(cx,cy);
index 536a208..14801bc 100644 (file)
@@ -10,6 +10,7 @@ package net.systemeD.halcyon {
     import flash.geom.Point;
     import net.systemeD.halcyon.styleparser.*;
     import net.systemeD.halcyon.connection.*;
+    import net.systemeD.halcyon.ImageBank;
 
     public class MarkerUI extends EntityUI {
 
@@ -84,32 +85,28 @@ package net.systemeD.halcyon {
                     r=true;
                     if (s.rotation) { rotation=s.rotation; }
                     if (s.icon_image!=iconnames[subpart]) {
+                                               icon=new Sprite();
+                                               iconnames[subpart]=s.icon_image;
+                                               addToLayer(icon,STROKESPRITE,s.sublayer);
                         if (s.icon_image=='square') {
                             // draw square
-                            icon=new Sprite();
-                            addToLayer(icon,STROKESPRITE,s.sublayer);
                             w=styleIcon(icon,subpart);
                             icon.graphics.drawRect(0,0,w,w);
                             if (s.interactive) { maxwidth=Math.max(w,maxwidth); }
-                            iconnames[subpart]='_square';
 
                         } else if (s.icon_image=='circle') {
                             // draw circle
-                            icon=new Sprite();
-                            addToLayer(icon,STROKESPRITE,s.sublayer);
                             w=styleIcon(icon,subpart);
                             icon.graphics.drawCircle(w,w,w);
                             if (s.interactive) { maxwidth=Math.max(w,maxwidth); }
-                            iconnames[subpart]='_circle';
-
-                        } else if (paint.ruleset.images[s.icon_image]) {
-                            // 'load' icon (actually just from library)
-                            var loader:ExtendedLoader = new ExtendedLoader();
-                            loader.info['sublayer']=s.sublayer;
-                            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedIcon, false, 0, true);
-                            loader.loadBytes(paint.ruleset.images[s.icon_image]);
-                            iconnames[subpart]=s.icon_image;
-                        }
+
+                                               } else if (ImageBank.getInstance().hasImage(s.icon_image)) {
+                                                       // load icon from library
+                                                       icon.addChild(ImageBank.getInstance().getAsDisplayObject(s.icon_image));
+//                                                     addHitSprite(icon.width);                       // ** check this - we're doing it below too
+//                                                     loaded=true; updatePosition();          // ** check this
+                                                       if (s.interactive) { maxwidth=Math.max(icon.width,maxwidth); }
+                                               }
                     }
                 }
 
@@ -163,16 +160,6 @@ package net.systemeD.halcyon {
             setListenSprite();
         }
 
-        private function loadedIcon(event:Event):void {
-            var icon:Sprite=new Sprite();
-            var sublayer:Number=event.target.loader.info['sublayer'];
-            addToLayer(icon,STROKESPRITE,sublayer);
-            icon.addChild(Bitmap(event.target.content));
-            addHitSprite(icon.width);
-            loaded=true;
-            updatePosition();
-        }
-
         private function updatePosition():void {
             if (!loaded) { return; }
 
index cf58a14..4ad2c59 100644 (file)
@@ -10,6 +10,7 @@ package net.systemeD.halcyon {
        import flash.geom.Point;
        import net.systemeD.halcyon.styleparser.*;
     import net.systemeD.halcyon.connection.*;
+    import net.systemeD.halcyon.ImageBank;
        
        /** The graphical representation of a Node (including POIs and nodes that are part of Ways). */
        public class NodeUI extends EntityUI {
@@ -104,31 +105,27 @@ package net.systemeD.halcyon {
                                        r=true;
                                        if (s.rotation) { rotation=s.rotation; }
                                        if (s.icon_image!=iconnames[subpart]) {
+                                               icon=new Sprite();
+                                               iconnames[subpart]=s.icon_image;
+                                               addToLayer(icon,STROKESPRITE,s.sublayer);
                                                if (s.icon_image=='square') {
                                                        // draw square
-                                                       icon=new Sprite();
-                                                       addToLayer(icon,STROKESPRITE,s.sublayer);
                                                        w=styleIcon(icon,subpart);
                                                        icon.graphics.drawRect(0,0,w,w);
                                                        if (s.interactive) { maxwidth=Math.max(w,maxwidth); }
-                                                       iconnames[subpart]='_square';
 
                                                } else if (s.icon_image=='circle') {
                                                        // draw circle
-                                                       icon=new Sprite();
-                                                       addToLayer(icon,STROKESPRITE,s.sublayer);
                                                        w=styleIcon(icon,subpart);
                                                        icon.graphics.drawCircle(w,w,w);
                                                        if (s.interactive) { maxwidth=Math.max(w,maxwidth); }
-                                                       iconnames[subpart]='_circle';
-
-                                               } else if (paint.ruleset.images[s.icon_image]) {
-                                                       // 'load' icon (actually just from library)
-                                                       var loader:ExtendedLoader = new ExtendedLoader();
-                                                       loader.info['sublayer']=s.sublayer;
-                                                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedIcon, false, 0, true);
-                                                       loader.loadBytes(paint.ruleset.images[s.icon_image]);
-                                                       iconnames[subpart]=s.icon_image;
+
+                                               } else if (ImageBank.getInstance().hasImage(s.icon_image)) {
+                                                       // load icon from library
+                                                       icon.addChild(ImageBank.getInstance().getAsDisplayObject(s.icon_image));
+//                                                     addHitSprite(icon.width);                       // ** check this - we're doing it below too
+                                                       loaded=true; updatePosition();          // ** check this
+                                                       if (s.interactive) { maxwidth=Math.max(icon.width,maxwidth); }
                                                }
                                        }
                                }
@@ -183,16 +180,6 @@ package net.systemeD.halcyon {
                        setListenSprite();
                }
 
-               private function loadedIcon(event:Event):void {
-                       var icon:Sprite=new Sprite();
-                       var sublayer:Number=event.target.loader.info['sublayer'];
-                       addToLayer(icon,STROKESPRITE,sublayer);
-                       icon.addChild(Bitmap(event.target.content));
-                       addHitSprite(icon.width);
-                       loaded=true;
-                       updatePosition();
-               }
-
                private function updatePosition(xDelta:Number=0,yDelta:Number=0):void {
                        if (!loaded) { return; }
 
diff --git a/net/systemeD/halcyon/WayBitmapFiller.as b/net/systemeD/halcyon/WayBitmapFiller.as
deleted file mode 100644 (file)
index 6140d37..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.systemeD.halcyon {
-
-       import net.systemeD.halcyon.styleparser.*;
-    import net.systemeD.halcyon.connection.*;
-       import flash.display.*;
-       import flash.events.*;
-
-       public class WayBitmapFiller {
-               private var wayui:WayUI;
-               private var style:ShapeStyle;
-               private var graphics:Graphics;
-               private var loader:Loader = new Loader();
-
-               public function WayBitmapFiller(wayui:WayUI,graphics:Graphics,style:ShapeStyle) {
-                       this.wayui=wayui;
-                       this.graphics=graphics;
-                       this.style=style;
-                       
-                       if (wayui.paint.ruleset.images[style.fill_image]) {
-                               loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedFill);
-                               loader.loadBytes(wayui.paint.ruleset.images[style.fill_image]);
-                       }
-               }
-               
-               private function loadedFill(event:Event):void {
-                       var image:BitmapData = new BitmapData(loader.width, loader.height, false);
-                       image.draw(loader);
-                       graphics.beginBitmapFill(image);
-                       wayui.solidLines(graphics,[]);
-                       graphics.endFill();
-               }
-       }
-}
\ No newline at end of file
index 787385f..f278972 100644 (file)
@@ -9,6 +9,7 @@ package net.systemeD.halcyon {
        
        import net.systemeD.halcyon.connection.*;
        import net.systemeD.halcyon.styleparser.*;
+    import net.systemeD.halcyon.ImageBank;
 
        /** The graphical representation of a Way. */ 
        public class WayUI extends EntityUI {
@@ -293,8 +294,11 @@ package net.systemeD.halcyon {
                                        if ((!isNaN(s.fill_color) || s.fill_image) && entity.findParentRelationsOfType('multipolygon','inner').length==0 && isNaN(drawExcept)) {
                                                fill=new Shape(); addToLayer(fill,FILLSPRITE,s.sublayer);
                                                fill.graphics.moveTo(x0,y0);
-                                               if (s.fill_image) { new WayBitmapFiller(this,fill.graphics,s); }
-                                                                        else { s.applyFill(fill.graphics); }
+                                               if (s.fill_image) {
+                                                       fill.graphics.beginBitmapFill(ImageBank.getInstance().getAsBitmapData(s.fill_image));
+                                               } else {
+                                                       s.applyFill(fill.graphics);
+                                               }
                                                solidLines(fill.graphics,inners);
                                                fill.graphics.endFill();
                                                drawn=true;
index 3e762ff..07a43b7 100644 (file)
@@ -90,7 +90,7 @@ package net.systemeD.halcyon.connection {
                public var nodecount:int=0;
                public var waycount:int=0;
                public var relationcount:int=0;
-        private var traces:Array = [];
+        private var traces:Vector.<Trace> = new Vector.<Trace>();
         private var nodePositions:Object = {};
         protected var traces_loaded:Boolean = false;
                private var loadedBboxes:Array = [];
@@ -439,15 +439,22 @@ package net.systemeD.halcyon.connection {
             return changeset;
         }
 
-        protected function addTrace(t:Object):void {
+        public function addTrace(t:Trace):void {
             traces.push(t);
         }
 
         protected function clearTraces():void {
-            traces = [];
+            traces = new Vector.<Trace>();
         }
 
-        public function getTraces():Array {
+               public function findTrace(id:int):Trace {
+                       for each (var t:Trace in traces) {
+                               if (t.id == id) return t;
+                       }
+                       return null;
+               }
+
+        public function getTraces():Vector.<Trace> {
             return traces;
         }
 
index 22a0b64..8a4199e 100644 (file)
@@ -24,7 +24,7 @@ package net.systemeD.halcyon.connection {
         private var _traceData:String; // the trace data, saved as a string
         private var map:Map;
         private var _layer:MapPaint;
-        private var masterConnection:XMLConnection; // The authenticated connection
+        private var masterConnection:Connection; // The authenticated connection
         private var _connection:Connection; // The one we store our fake nodes/ways in.
         private var simplify:Boolean = false;
 
@@ -33,9 +33,10 @@ package net.systemeD.halcyon.connection {
         /** Create a new trace.
         * @param masterConnection The authenticated connection to communicate with the server
         */
-        public function Trace(masterConnection:XMLConnection) {
+        public function Trace(masterConnection:Connection, id:int=0) {
             this.masterConnection = masterConnection;
             map = Globals.vars.root; // REFACTOR this prevents traces being added to arbitrary maps
+                       if (id!=0) _id=id;
         }
 
         /** Create a new trace, from the XML description given by the user/traces call.
@@ -112,6 +113,7 @@ package net.systemeD.halcyon.connection {
 
         private function processEvent(e:Event):void {
             removeEventListener("loaded_data", processEvent);
+            _isLoaded=true;
             process();
         }
 
index c94a857..1fce363 100644 (file)
@@ -22,7 +22,7 @@ package net.systemeD.halcyon.connection {
                protected function loadedMap(event:Event):void {
                        var map:XML = new XML(URLLoader(event.target).data);
                        
-                       if (map.localName=="osmError") {
+                       if (map.name().localName=="osmError") {
                                dispatchEvent(new MapEvent(MapEvent.ERROR, { message: "Couldn't load the map: " + map.message } ));
                        } else {
                                var id:Number;
index 3a4c5ef..97f1e76 100644 (file)
@@ -439,17 +439,17 @@ package net.systemeD.halcyon.connection {
             }
         }
 
-        private function tracesLoadComplete(event:Event):void {
-            clearTraces();
-            var files:XML = new XML(URLLoader(event.target).data);
-            for each(var traceData:XML in files.gpx_file) {
-              var t:Trace = new Trace(this).fromXML(traceData);
-              addTrace(t);
-            }
-            traces_loaded = true;
-            dispatchEvent(new Event(LOAD_COMPLETED));
-            dispatchEvent(new Event(TRACES_LOADED));
-        }
+               private function tracesLoadComplete(event:Event):void {
+                       var files:XML = new XML(URLLoader(event.target).data);
+                       for each(var traceData:XML in files.gpx_file) {
+                               var t:Trace = findTrace(traceData.@id);
+                               if (!t) { t=new Trace(this); addTrace(t); }
+                               t.fromXML(traceData);
+                       }
+                       traces_loaded = true;
+                       dispatchEvent(new Event(LOAD_COMPLETED));
+                       dispatchEvent(new Event(TRACES_LOADED));
+               }
 
         override public function fetchTrace(id:Number, callback:Function):void {
             sendOAuthGet(apiBaseURL+"gpx/"+id+"/data.xml", 
index c8b3bc6..2117f4b 100644 (file)
@@ -17,7 +17,9 @@ package net.systemeD.halcyon.connection.actions {
         public override function doAction():uint {
             var tags:Object = entity.getTagsHash();
             oldValue = tags[key];
-            if ( value == null || key == '' || oldValue != value ) {
+
+            if ( !( ( entity.getTag(key) == null ) && ( value == null && oldValue == null ) ) &&
+                ( value == null || key == '' || oldValue != value ) ) {
                 if ( value == null || key == '' || value == '' )
                     delete tags[key];
                 else
index 1c9f6be..de8d3dd 100644 (file)
@@ -6,6 +6,7 @@ package net.systemeD.halcyon.styleparser {
        import net.systemeD.halcyon.ExtendedURLLoader;
        import net.systemeD.halcyon.DebugURLRequest;
     import net.systemeD.halcyon.connection.Entity;
+    import net.systemeD.halcyon.ImageBank;
 
     import net.systemeD.halcyon.connection.*;
        
@@ -18,12 +19,7 @@ package net.systemeD.halcyon.styleparser {
 
        public class RuleSet {
 
-               /** Is the RuleSet fully loaded and available for use? */
-               public var loaded:Boolean=false; 
-               /** Hash of loaded images. Hash key is filename, value is BitmapData for the image. */
-               public var images:Object=new Object();
-               /** Hash of image widths. Hash key is filename, value is pixel width. */
-               public var imageWidths:Object=new Object();     
+               public var loaded:Boolean=false;                        // is the RuleSet fully loaded and available for use?
                private var redrawCallback:Function=null;       // function to call when CSS loaded
                private var iconCallback:Function=null;         // function to call when all icons loaded
                private var iconsToLoad:uint=0;                         // number of icons left to load (fire iconCallback when ==0)
@@ -244,7 +240,7 @@ package net.systemeD.halcyon.styleparser {
                public function getStyles(obj:Entity, tags:Object, zoom:uint):StyleList {
                        var sl:StyleList=new StyleList();
                        for each (var sc:StyleChooser in choosers) {
-                               sc.updateStyles(obj,tags,sl,imageWidths,zoom);
+                               sc.updateStyles(obj,tags,sl,zoom);
                        }
                        return sl;
                }
@@ -277,10 +273,10 @@ package net.systemeD.halcyon.styleparser {
 
 
                /// ------------------------------------------------------------------------------------------------
-               /** Load all images referenced in the RuleSet (for example, icons or bitmap fills).
-                       FIXME: if an image is referenced twice, it'll be requested twice. */
+               /** Load all images referenced in the RuleSet (for example, icons or bitmap fills). */
                
                private function loadImages():void {
+                       ImageBank.getInstance().addEventListener(ImageBank.IMAGES_LOADED,doIconCallback);
                        var filename:String;
                        for each (var chooser:StyleChooser in choosers) {
                                for each (var style:Style in chooser.styles) {
@@ -288,59 +284,17 @@ package net.systemeD.halcyon.styleparser {
                                        else if (style is ShapeStyle  && ShapeStyle(style).fill_image   ) { filename=ShapeStyle(style).fill_image; }
                                        else if (style is ShieldStyle && ShieldStyle(style).shield_image) { filename=ShieldStyle(style).shield_image; }
                                        else { continue; }
-                                       if (filename=='square' || filename=='circle') { continue; }
-                       
-                                       iconsToLoad++;
-                                       var request:DebugURLRequest=new DebugURLRequest(filename);
-                                       var loader:ExtendedURLLoader=new ExtendedURLLoader();
-                                       loader.dataFormat=URLLoaderDataFormat.BINARY;
-                                       loader.info['filename']=filename;
-                                       loader.addEventListener(Event.COMPLETE,                                         loadedImage,                            false, 0, true);
-                                       loader.addEventListener(HTTPStatusEvent.HTTP_STATUS,            httpStatusHandler,                      false, 0, true);
-                                       loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,      onImageLoadSecurityError,       false, 0, true);
-                                       loader.addEventListener(IOErrorEvent.IO_ERROR,                          onImageLoadioError,                     false, 0, true);
-                                       loader.load(request.request);
+
+                                       if (filename!='square' && filename!='circle')
+                                               ImageBank.getInstance().loadImage(filename);
                                }
                        }
                }
-
-               private function loadedImage(event:Event):void {
-                       var fn:String=event.target.info['filename'];
-                       images[fn]=event.target.data; if (images[fn].length==0) return;
-
-                       var loader:ExtendedLoader = new ExtendedLoader();
-                       loader.info['filename']=fn;
-                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, measureWidth);
-                       loader.loadBytes(images[fn]);
-               }
                
-               private function measureWidth(event:Event):void {
-                       var fn:String=event.target.loader.info['filename'];
-                       imageWidths[fn]=event.target.width;
-                       // ** do we need to explicitly remove the loader object now?
-
-                       oneLessImageToLoad();
+               private function doIconCallback(e:Event):void {
+                       iconCallback();
                }
-
-        private function oneLessImageToLoad():void {
-            iconsToLoad--;
-            if (iconsToLoad<=0 && iconCallback!=null) { iconCallback(); }
-        }
-
-        private function onImageLoadioError ( event:IOErrorEvent ):void {
-            trace("ioerrorevent: "+event.target.info['filename']);
-            oneLessImageToLoad();
-        }
-
-        private function onImageLoadSecurityError ( event:SecurityErrorEvent ):void {
-            trace("securityerrorevent: "+event.target.info['filename']);
-            oneLessImageToLoad();
-        }
-
-               private function httpStatusHandler( event:HTTPStatusEvent ):void { }
-               private function securityErrorHandler( event:SecurityErrorEvent ):void { trace("securityerrorevent"); }
-               private function ioErrorHandler( event:IOErrorEvent ):void { trace("ioerrorevent"); }
-
+               
                // ------------------------------------------------------------------------------------------------
                // Parse CSS
 
index c2d2980..fdefa23 100644 (file)
@@ -1,6 +1,7 @@
 package net.systemeD.halcyon.styleparser {
 
        import net.systemeD.halcyon.connection.Entity;
+    import net.systemeD.halcyon.ImageBank;
 
        public class StyleChooser {
 
@@ -41,7 +42,7 @@ package net.systemeD.halcyon.styleparser {
                
                // Update the current StyleList from this StyleChooser
 
-               public function updateStyles(obj:Entity, tags:Object, sl:StyleList, imageWidths:Object, zoom:uint):void {
+               public function updateStyles(obj:Entity, tags:Object, sl:StyleList, zoom:uint):void {
                        if (zoomSpecific) { sl.validAt=zoom; }
 
                        // Are any of the ruleChains fulfilled?
@@ -64,9 +65,10 @@ package net.systemeD.halcyon.styleparser {
                                                        a=sl.pointStyles;
                                                        w=0;
                                                        if (PointStyle(r).icon_width && !PointStyle(r).evals['icon_width']) {
+                                                               // ** FIXME: we should check this is the bit being used for 'square', 'circle' etc.
                                                                w=PointStyle(r).icon_width;
-                                                       } else if (PointStyle(r).icon_image && imageWidths[PointStyle(r).icon_image]) {
-                                                               w=imageWidths[PointStyle(r).icon_image];
+                                                       } else if (PointStyle(r).icon_image && ImageBank.getInstance().hasImage(PointStyle(r).icon_image)) {
+                                                               w=ImageBank.getInstance().getWidth(PointStyle(r).icon_image);
                                                        }
                                                        if (w>sl.maxwidth) { sl.maxwidth=w; }
                                                } else if (r is InstructionStyle) {
index 580a090..4c21149 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-        xmlns:mx="http://www.adobe.com/2006/mxml" 
+        xmlns:fx="http://ns.adobe.com/mxml/2009"
+        xmlns:mx="library://ns.adobe.com/flex/mx"
         layout="vertical" showCloseButton="true"
         horizontalAlign="center" 
         width="500" height="300" verticalGap="0">
         <mx:DataGridColumn editable="true"  dataField="url" headerText="URL"/>
         <mx:DataGridColumn editable="false" headerText="Key" width="70">
                        <mx:itemRenderer>
-                               <mx:Component>
+                               <fx:Component>
                                <mx:ComboBox
                                        selectedItem="{FunctionKeyManager.instance().getKeyFor(outerDocument.title,data.name)}"
                                    dataProvider="{FunctionKeyManager.fkeysCollection}"
                                        change="FunctionKeyManager.instance().setKeyFromFString(selectedItem as String,outerDocument.title,data.name)" />
-                               </mx:Component>
+                               </fx:Component>
                        </mx:itemRenderer>
                </mx:DataGridColumn>
     </mx:columns>
@@ -27,7 +28,7 @@
     <mx:LinkButton label="Add" click="addNewSource()"/>
   </mx:HBox>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
        /*
                Still to do:
@@ -41,6 +42,7 @@
     import mx.managers.PopUpManager;
     import mx.events.CloseEvent;
     import mx.core.Application;
+    import mx.core.FlexGlobals;
        import mx.collections.ArrayCollection;
        import mx.controls.List;
        import net.systemeD.potlatch2.FunctionKeyManager;
@@ -54,7 +56,7 @@
                this.menu=menu;
                collection=source;
                dataCollection=new ArrayCollection(source.collection);
-        PopUpManager.addPopUp(this, Application(Application.application), true);
+        PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, backgroundDialog_close);
                dataGrid.dataProvider=dataCollection;
@@ -79,6 +81,6 @@
        }
 
   ]]>
-  </mx:Script>
+  </fx:Script>
 
 </mx:TitleWindow>
index 2c48339..78d4b91 100644 (file)
@@ -1,27 +1,28 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:VBox
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
        <mx:List width="100%" height="100%" id="background"
                        labelField="name"
-                       change="Application.application.bgButton.close(); Imagery.instance().setBackground(background.selectedItem);"
+                       change="FlexGlobals.topLevelApplication.bgButton.close(); Imagery.instance().setBackground(background.selectedItem);"
                dataProvider="{Imagery.instance().getAvailableImagery()}"
                rowCount="{Imagery.instance().getAvailableImagery().length}"/>
        <mx:HBox>
-       <mx:CheckBox width="100%" label="Dim" selected="{Application.application.theMap.getDimming()}" id="dim"
+       <mx:CheckBox width="100%" label="Dim" selected="{application.theMap.getDimming()}" id="dim"
            change="setDimming(dim.selected)" />
-       <mx:CheckBox width="100%" label="Sharpen" selected="{Application.application.theMap.getSharpen()}" id="sharpen"
+       <mx:CheckBox width="100%" label="Sharpen" selected="{application.theMap.getSharpen()}" id="sharpen"
            change="setSharpen(sharpen.selected)" />
        </mx:HBox>
 
        <mx:HBox>
-       <mx:Button label="Edit..." click="Application.application.bgButton.close(); new BackgroundDialog().init('Background imagery',background,Imagery.instance());" />
-       <mx:Button label="Vector file..." click="Application.application.bgButton.close(); new VectorSourceDialog().init();" />
+       <mx:Button label="Edit..." click="FlexGlobals.topLevelApplication.bgButton.close(); new BackgroundDialog().init('Background imagery',background,Imagery.instance());" />
+       <mx:Button label="Vector file..." click="FlexGlobals.topLevelApplication.bgButton.close(); new VectorSourceDialog().init();" />
        </mx:HBox>
 
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
 
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import mx.collections.ArrayCollection;
                import mx.managers.PopUpManager;
 
+               [Bindable] private var application:Object = FlexGlobals.topLevelApplication;
+
                public function setDimming(v:Boolean):void {
-                       Application.application.theMap.setDimming(dim.selected);
-                       Application.application.yahoo.alpha = dim.selected ? 0.5 : 1;
+                       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();
                }
                public function setSharpen(v:Boolean):void {
-                       Application.application.theMap.setSharpen(sharpen.selected);
+                       FlexGlobals.topLevelApplication.theMap.setSharpen(sharpen.selected);
                        var obj:SharedObject=SharedObject.getLocal("user_state");
                        obj.setProperty('background_sharpen',v);
                        obj.flush();
                }
-    ]]></mx:Script>    
+    ]]></fx:Script>
 </mx:VBox>
 
index fbee981..893b5a8 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:VBox
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:halcyon="net.systemeD.halcyon.*"
        backgroundColor="white" borderStyle="inset">
 
                        width="420" height="100%" change="itemSelected(event);" styleName="catToggleTiles"
                        creationComplete="ensureSelection();">
               <mx:itemRenderer>
-                  <mx:Component>
+                  <fx:Component>
                       <mx:VBox width="100" height="75"
                           horizontalScrollPolicy="off" verticalScrollPolicy="off"
                           horizontalAlign="center" verticalGap="0" toolTip="{data.description}">
                           <mx:Image source="{data.image}" height="100%" verticalAlign="middle"/>
                           <mx:Text text="{data.name}"/>
                       </mx:VBox>
-                  </mx:Component>
+                  </fx:Component>
               </mx:itemRenderer>
           </mx:TileList>
           </mx:VBox>
@@ -31,7 +32,7 @@
   </mx:HBox>
 
   <!-- mx:Label id="hoverInfo" text="Hover Info goes here"/>-->
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
 
       import net.systemeD.halcyon.connection.*;
           settingSelection = false;
       }
 
-  ]]></mx:Script>
+  ]]></fx:Script>
 </mx:VBox>
 
index 1014c0a..583e610 100644 (file)
@@ -6,6 +6,7 @@ package net.systemeD.potlatch2 {
     import flash.geom.Matrix;
     import flash.text.TextField;
     import flash.text.TextFormat;
+    import net.systemeD.halcyon.ImageBank;
 
 
     public class Preloader extends net.systemeD.potlatch2.PreloaderDisplayBase {
@@ -20,6 +21,9 @@ package net.systemeD.potlatch2 {
         private var barFrame:Sprite;
         private var mainColor:uint=0x045966;
 
+               private var assetscount:uint=0;
+               private var queuedEvents:Array=[];
+
         public function Preloader()
         {
             super();
@@ -38,7 +42,35 @@ package net.systemeD.potlatch2 {
 
             //creates all visual elements
             createAssets();
+
+                       // request .zip files
+                       if (loaderInfo.parameters['assets']) {
+                               ImageBank.getInstance().addEventListener(ImageBank.ZIP_LOADED, zipLoaded);
+                               for each (var file:String in loaderInfo.parameters['assets'].split(';')) {
+                                       var asset:Array=file.split('=');
+                                       assetscount++;
+                                       ImageBank.getInstance().loadFromZip(asset[0],asset[1]);
+                               }
+                       }
         }
+
+               override protected function initProgressHandler(e:Event):void {
+                       // We don't let anything happen until the .zips are loaded
+                       // see http://stackoverflow.com/questions/2773617/how-to-preload-a-file-in-flex-before-the-application-initializes
+                       if (assetscount>0) {
+                               queuedEvents.push(e);
+                               e.stopImmediatePropagation();
+                       }
+                       draw();
+               }
+               
+               private function zipLoaded(e:Event):void {
+                       assetscount--; if (assetscount>0) return;
+                       for each (var q:Event in queuedEvents) {
+                               dispatchEvent(q);
+                       }
+               }
+               
         //this is our "animation" bit
         override protected function draw():void
         {
index 1f33cfe..1fd6b53 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
        title="Edit Relation" width="350" height="400"
        showCloseButton="true" close="PopUpManager.removePopUp(this);">
@@ -8,7 +9,7 @@
        <potlatch2:TagViewer width="100%" height="100%" id="tagViewer"
            creationComplete="checkRelation()"/>
        
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
@@ -26,6 +27,6 @@
             if ( _relation != null )
                 tagViewer.setEntity([_relation]);
         }
-    ]]></mx:Script>    
+    ]]></fx:Script>
 </mx:TitleWindow>
 
index 2a617a1..a0c6236 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
        title="Load Relation" width="350" height="160"
        creationComplete="requestedID.setFocus()"
@@ -14,7 +15,7 @@
       <mx:Spacer width="100%"/>
       <mx:Button label="Load" click="loadRelation();" styleName="titleWindowButton" />
     </mx:ControlBar>
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
@@ -60,6 +61,6 @@
                        MainUndoStack.getGlobalStack().addAction(undo);
                }
                
-    ]]></mx:Script>    
+    ]]></fx:Script>
 </mx:TitleWindow>
 
index f10440d..00b0bd1 100644 (file)
@@ -1,16 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-    xmlns:mx="http://www.adobe.com/2006/mxml"
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+    xmlns:mx="library://ns.adobe.com/flex/mx"
     xmlns:potlatch2="net.systemeD.potlatch2.*"
     title="Select Relation" width="350" height="400"
     showCloseButton="true" close="PopUpManager.removePopUp(this);">
 
-    <mx:Script><![CDATA[
+    <fx:Script><![CDATA[
         import net.systemeD.halcyon.*;
         import net.systemeD.halcyon.connection.*;
         import net.systemeD.potlatch2.*;
         import mx.managers.PopUpManager;
         import mx.core.Application;
+        import mx.core.FlexGlobals;
 
         private var conn:Connection;
         private var relationList:Array;
@@ -29,7 +31,7 @@
             //tagmatches[k]=t[k];// deep copy match pattern tags
             defaulttags[k]=t[k][0];  // route=[hiking,foot] -> route=hiking
           }    
-          PopUpManager.addPopUp(this, Application(Application.application), true);
+          PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
           PopUpManager.centerPopUp(this);
     
           var titles:Array = [];
@@ -76,7 +78,7 @@
 
                        PopUpManager.removePopUp(this);
                        var panel:RelationEditorPanel = RelationEditorPanel(
-                           PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
+                           PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), RelationEditorPanel, true));
                        panel.setRelation(relation);
                        PopUpManager.centerPopUp(panel);
         }
                public function closeAndLoadRelation():void {
                        PopUpManager.removePopUp(this);
                        var panel:RelationLoaderPanel = RelationLoaderPanel(
-                           PopUpManager.createPopUp(Application(Application.application), RelationLoaderPanel, true));
+                           PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), RelationLoaderPanel, true));
                        panel.setEntity(entity);
                        PopUpManager.centerPopUp(panel);
                }
+               
+               public function updateSelectButton():void {
+                       selectButton.enabled=relationSelector.selectedItems.length>0;
+               }
         
-    ]]></mx:Script> 
+    ]]></fx:Script>
     <mx:Text id="warning" text="" />
-    <mx:List width="100%" height="100%" id="relationSelector" verticalScrollPolicy="on" allowMultipleSelection="true" > 
+    <mx:List width="100%" height="100%" id="relationSelector" change="updateSelectButton();" 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:Button label="Select" id="selectButton" click="updateEntityAndClose();" enabled="false" styleName="titleWindowButton" />
     </mx:ControlBar>
 </mx:TitleWindow>
index d839ad7..7ac5c6b 100644 (file)
@@ -1,23 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:VBox
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10"
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
        <mx:List width="100%" height="100%" id="mapStyle" 
                labelField="name"
-               change="Application.application.styleButton.close(); Stylesheets.instance().setStylesheet(mapStyle.selectedItem.name, mapStyle.selectedItem.url);"
+               change="FlexGlobals.topLevelApplication.styleButton.close(); Stylesheets.instance().setStylesheet(mapStyle.selectedItem.name, mapStyle.selectedItem.url);"
                dataProvider="{Stylesheets.instance().getCollection()}"
                rowCount="{Stylesheets.instance().getCollection().length}" />
 
-       <mx:Button label="Edit..." click="Application.application.styleButton.close(); new BackgroundDialog().init('Map style',mapStyle,Stylesheets.instance());" />
+       <mx:Button label="Edit..." click="FlexGlobals.topLevelApplication.styleButton.close(); new BackgroundDialog().init('Map style',mapStyle,Stylesheets.instance());" />
 
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
                import net.systemeD.potlatch2.collections.Stylesheets;
                import mx.core.*;
-    ]]></mx:Script>    
+    ]]></fx:Script>
 </mx:VBox>
 
index 17b8615..0f6614d 100644 (file)
@@ -5,15 +5,16 @@
 -->
 
 <mx:DataGrid editable="true" doubleClickEnabled="true" doubleClick="addNewTag()"
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:controls="net.systemeD.controls.*"
-       xmlns:mx="http://www.adobe.com/2006/mxml">
+       xmlns:mx="library://ns.adobe.com/flex/mx">
        <mx:columns>
 
                <!-- Key -->
 
                <mx:DataGridColumn editable="true" dataField="key" headerText="Key">
                        <mx:itemEditor>
-                               <mx:Component>
+                               <fx:Component>
                                        <controls:AutoComplete
                                                dataProvider="{MapFeatures.getInstance().getAutoCompleteKeys(outerDocument.getEntityType())}"
                                                labelField="name"
@@ -21,9 +22,9 @@
                                                restrict="&#x0020;-&#x10FFFF;"
                                                maxChars="255" 
                                                typedText="{outerDocument.selectedItem.key}">
-                                       <mx:Script><![CDATA[ import net.systemeD.potlatch2.mapfeatures.*; ]]></mx:Script>
+                                       <fx:Script><![CDATA[ import net.systemeD.potlatch2.mapfeatures.*; ]]></fx:Script>
                                        </controls:AutoComplete>
-                               </mx:Component>
+                               </fx:Component>
                        </mx:itemEditor>
                </mx:DataGridColumn>
 
@@ -31,7 +32,7 @@
 
                <mx:DataGridColumn editable="true" dataField="value" headerText="Value" itemRenderer="net.systemeD.controls.DataGridWarningField" >
                        <mx:itemEditor>
-                               <mx:Component>
+                               <fx:Component>
                                        <controls:AutoComplete
                                                dataProvider="{MapFeatures.getInstance().getAutoCompleteValues(outerDocument.getEntityType(),outerDocument.selectedItem.key)}"
                                                labelField="name"
@@ -39,9 +40,9 @@
                                                restrict="&#x0020;-&#x10FFFF;"
                                                maxChars="255" 
                                                typedText="{outerDocument.selectedItem.value}">
-                                       <mx:Script><![CDATA[ import net.systemeD.potlatch2.mapfeatures.*; ]]></mx:Script>
+                                       <fx:Script><![CDATA[ import net.systemeD.potlatch2.mapfeatures.*; ]]></fx:Script>
                                        </controls:AutoComplete>
-                               </mx:Component>
+                               </fx:Component>
                        </mx:itemEditor>
                </mx:DataGridColumn>
 
 
                <mx:DataGridColumn width="20" editable="false">
                        <mx:itemRenderer>
-                               <mx:Component>
+                               <fx:Component>
                     <mx:HBox horizontalAlign="center" verticalAlign="middle">
                       <mx:Image source="@Embed('../../../embedded/delete_small.svg')"
                           click='event.stopPropagation();outerDocument.removeTag();'
                           buttonMode="true" useHandCursor="true" width="12" height="12">
                       </mx:Image>
                                        </mx:HBox>
-                               </mx:Component>
+                               </fx:Component>
                        </mx:itemRenderer>
                </mx:DataGridColumn>
        </mx:columns>
 
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
 
                import net.systemeD.halcyon.connection.*;
                import mx.collections.*;
                        return selectedEntity.getType();
                }
 
-       ]]></mx:Script>
+       ]]></fx:Script>
 </mx:DataGrid>
index f33c39c..b2b62fd 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:VBox
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:flexlib="flexlib.containers.*"
        xmlns:controls="net.systemeD.controls.*"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
@@ -23,9 +24,9 @@
                <mx:TileList dataProvider="{dndRep.currentItem.getFeaturesForType('point', true)}" width="100%" height="1"
                                     rowHeight="32" columnWidth="32" updateComplete="resizePOIGrid(event)" styleName="dndPanelTileList">
                        <mx:itemRenderer>
-                               <mx:Component>
+                               <fx:Component>
                                        <mx:VBox toolTip="{data.name}">
-                                               <mx:Script><![CDATA[
+                                               <fx:Script><![CDATA[
                                                        import mx.events.DragEvent;
                                                        import mx.managers.DragManager;
                                                        import mx.core.DragSource;
                                                                dragProxy.height = dragInitiator.height; // for non-embedded images
                                                                DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
                                                        }
-                                               ]]></mx:Script>
+                                               ]]></fx:Script>
                                                <mx:Image id="foo" source="{data.dndimage}" height="24" width="24" mouseMove="dragPOI(event, data.tags)" toolTip="{data.name}" />
                                        </mx:VBox>
-                               </mx:Component>
+                               </fx:Component>
                        </mx:itemRenderer>
                </mx:TileList>
        </mx:Repeater>
                 <mx:DataGridColumn editable="false" dataField="description" headerText="Relation"/>
                 <mx:DataGridColumn editable="false" dataField="id_idx" headerText="ID"/>
                 <mx:DataGridColumn editable="true" dataField="role" headerText="Role">
-                    <mx:itemEditor><mx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></mx:Component></mx:itemEditor>
+                    <mx:itemEditor><fx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></fx:Component></mx:itemEditor>
                 </mx:DataGridColumn>
                                <mx:DataGridColumn width="20" editable="false">
                                        <mx:itemRenderer>
-                                               <mx:Component>
+                                               <fx:Component>
                                    <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                                                <mx:PopUpButton arrowButtonWidth="12" paddingLeft="0" paddingRight="0" width="12" height="12" 
                                                                                open="{outerDocument.updateRelationMenu(event);}" 
                                                                                creationComplete="{outerDocument.createRelationMenu(PopUpButton(event.target));}"/>
                                                        </mx:HBox>
-                                               </mx:Component>
+                                               </fx:Component>
                                        </mx:itemRenderer>
                                </mx:DataGridColumn>
             </mx:columns>
             <mx:DataGridColumn editable="false" dataField="type" headerText="Type"/>
             <mx:DataGridColumn editable="false" dataField="id" headerText="ID"/>
             <mx:DataGridColumn editable="true" dataField="role" headerText="Role">
-                               <mx:itemEditor><mx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></mx:Component></mx:itemEditor>
+                               <mx:itemEditor><fx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></fx:Component></mx:itemEditor>
                        </mx:DataGridColumn>
           </mx:columns>
         </mx:DataGrid>
                        disabledIcon="@Embed('../../../embedded/view_accordion_disabled.png')"
                        click="setEditorStackUI(false)" id="accordionLabel" paddingTop="6"
                        toolTip="Show in sliding windows"
-                       enabled="{editorStack is SuperTabNavigator &amp;&amp; stack.selectedIndex==0}" />
+                       enabled="{editorStack is TabNavigator &amp;&amp; stack.selectedIndex==0}" />
          </mx:HBox>
   </mx:VBox>
 
             <mx:DataGridColumn editable="false" dataField="description" headerText="Relation"/>
             <mx:DataGridColumn editable="false" dataField="id_idx" headerText="ID"/>
             <mx:DataGridColumn editable="true" dataField="role" headerText="Role">
-                <mx:itemEditor><mx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></mx:Component></mx:itemEditor>
+                <mx:itemEditor><fx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></fx:Component></mx:itemEditor>
             </mx:DataGridColumn>
                        <mx:DataGridColumn width="20" editable="false">
                                <mx:itemRenderer>
-                                       <mx:Component>
+                                       <fx:Component>
                            <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                                        <mx:PopUpButton arrowButtonWidth="12" paddingLeft="0" paddingRight="0" width="12" height="12" 
                                                                        open="{outerDocument.updateRelationMenu(event);}" 
                                                                        creationComplete="{outerDocument.createRelationMenu(PopUpButton(event.target));}"/>
                                                </mx:HBox>
-                                       </mx:Component>
+                                       </fx:Component>
                                </mx:itemRenderer>
                        </mx:DataGridColumn>
         </mx:columns>
 
 </mx:ViewStack>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
       import net.systemeD.halcyon.connection.*;
       import net.systemeD.halcyon.MapPaint;
       import net.systemeD.potlatch2.mapfeatures.*;
       import net.systemeD.potlatch2.utils.*;
+      import net.systemeD.controls.CollapsiblePanel;
 
       import mx.collections.*;
       import mx.containers.*;
       import mx.managers.DragManager;
       import mx.core.DragSource;
       import mx.controls.TabBar;
-      import flexlib.containers.SuperTabNavigator;
+//    import flexlib.containers.SuperTabNavigator;
+
+      [Bindable] [Embed(source="../../../embedded/tab_basic.png"       )] private var tabIconBasic:Class;
+      [Bindable] [Embed(source="../../../embedded/tab_address.png"     )] private var tabIconAddress:Class;
+      [Bindable] [Embed(source="../../../embedded/tab_cycle.png"       )] private var tabIconCycle:Class;
+      [Bindable] [Embed(source="../../../embedded/tab_details.png"     )] private var tabIconDetails:Class;
+      [Bindable] [Embed(source="../../../embedded/tab_restrictions.png")] private var tabIconRestrictions:Class;
+      [Bindable] [Embed(source="../../../embedded/tab_transport.png"   )] private var tabIconTransport:Class;
+      [Bindable] [Embed(source="../../../embedded/tab_walk.png"        )] private var tabIconWalk:Class;
+      private var tabIcons:Object= { Basic:tabIconBasic, Details:tabIconDetails, Address:tabIconAddress, Walk:tabIconWalk, Cycle:tabIconCycle, 
+                                        Transport:tabIconTransport, Restrictions:tabIconRestrictions};
 
       [Bindable]
       public var dndPrompt:String="Add new points by dragging them onto the map";
 
-      private var editorStackTabNavigator:SuperTabNavigator;
+      private var editorStackTabNavigator:TabNavigator;
       private var editorStackAccordion:Accordion;
       [Bindable] private var editorStack:Container;
 
       }
 
       private var tabComponents:Object = {};
+      private var subpanelComponents:Object = {};
 
       private function initialiseEditors():void {
-          // reset tab to 0 to work around TabNavigator bug (#3444)
-          if (editorStack is TabNavigator) {
-              try {
-                  var tabBar:TabBar=TabBar(TabNavigator(editorStack).getTabAt(0).parent);
-                  tabBar.selectedIndex=0;
-                  tabBar.validateNow();
-              } catch(errObject:Error) {}
-          }
+               editorStack.removeAllChildren();
+               if ( selectedEntity == null || feature == null )
+                       return;
+
+               var basicEditorBox:VBox = createEditorBox();
+               basicEditorBox.label = "Basic";
+               basicEditorBox.icon=tabIconBasic;
+               editorStack.addChild(basicEditorBox);
+
+               var tabs:Object = {};
+               var tabList:Array = [];
+               tabComponents = {};
+               var subpanels:Object = {};
+               subpanelComponents = {};
+
+               // First create the tabs
+               for each (var factory:EditorFactory in feature.editors) {
+                       var category:String = factory.category;
+                       if (category!='') {
+                               var tab:VBox = tabs[category];
+                               if ( tab == null) {
+                                       tab = createEditorBox();
+                                       tab.label = category;
+                                       if (tabIcons[category]) tab.icon=tabIcons[category];
+                                       tabs[category] = tab;
+                                       tabList.push(tab);      
+                               }
+                       }
+               }
 
-          editorStack.removeAllChildren();
-          if ( selectedEntity == null || feature == null )
-              return;
+               // Put the tabs on-screen in order
+               tabList.sort(sortCategories,16);
+               for each (tab in tabList) {
+                       editorStack.addChild(tab);
+                       tabComponents[tab] = [];
+               }
 
-          var editorBox:VBox = createEditorBox();
-          editorBox.label = "Basic";
-          editorStack.addChild(editorBox);
+               // Then add the individual editors to them
+               for each (factory in feature.editors) {
 
-          var tabs:Object = {};
-          tabComponents = {};
+                       // Add to basic editor box first
+                       if ( factory.presence.isEditorPresent(factory, selectedEntity, null) ) {
+                               var editor:DisplayObject = factory.createEditorInstance(selectedEntity);
+                               if (editor) basicEditorBox.addChild(editor);
+                       }
 
-          for each (var factory:EditorFactory in feature.editors) {
-              if ( factory.presence.isEditorPresent(factory, selectedEntity, null) ) {
-                  var editor:DisplayObject = factory.createEditorInstance(selectedEntity);
-                  if ( editor != null )
-                      editorBox.addChild(editor);
-              }
-              var category:String = factory.category;
-              if (category!='') {
-                     var tab:VBox = tabs[category];
-                     if ( tab == null) {
-                         tab = createEditorBox();
-                         tab.label = category;
-                         editorStack.addChild(tab);
-                         tabs[category] = tab;
-                         tabComponents[tab] = [];
-                     }
-                     var catEditor:DisplayObject = factory.createEditorInstance(selectedEntity);
-                     if ( catEditor != null )
-                         tabComponents[tab].push(catEditor);
-                     //    tab.addChild(catEditor);
-              }
-          }
+                       // Then prepare to add to category panel
+                       category=factory.category;
+                       if (factory.category=='') continue;
+                       var catEditor:DisplayObject = factory.createEditorInstance(selectedEntity);
+                       if (!catEditor) continue;
+                       tab=tabs[category];
+                       
+                       // Create subcategory panel if needed
+                       if (factory.subcategory) {
+                               var subcategory:String = factory.subcategory;
+                               if (!subpanels[category]) { subpanels[category]={}; }
+                               var subpanel:CollapsiblePanel = subpanels[category][subcategory];
+                               if (!subpanel) {
+                                       subpanel=new CollapsiblePanel(false);
+                                       subpanel.percentWidth=100;
+                                       subpanel.styleName="subcategoryPanel";
+                                       subpanel.title=subcategory;
+                                       subpanels[category][subcategory]=subpanel;
+                                       tabComponents[tab].push(subpanel);
+                               }
+                               subpanel.addChild(catEditor);
+                       } else {
+                               tabComponents[tab].push(catEditor);
+                       }
+               }
       }
 
+       // ** FIXME: Order probably shouldn't be hard-coded, but configurable
+       private static var categoryOrder:Array=["Restrictions","Transport","Cycle","Walk","Address","Details"]; // reverse order
+       private function sortCategories(a:VBox,b:VBox):int {
+               var a1:int=categoryOrder.indexOf(a.label);
+               var a2:int=categoryOrder.indexOf(b.label);
+               if (a1<a2) { return 1; }
+               else if (a1>a2) { return -1; }
+               return 0;
+       }
+       
       private function createEditorBox():VBox {
           var box:VBox = new VBox();
           box.percentWidth = 100;
       }
 
        private function initEditorStackUIs():void {
-               editorStackTabNavigator = new SuperTabNavigator();
-               editorStackTabNavigator.allowTabSqueezing=false;
-               editorStackTabNavigator.minTabWidth=10;
-               editorStackTabNavigator.closePolicy="close_never";
-               editorStackTabNavigator.scrollSpeed=20;
+               editorStackTabNavigator = new TabNavigator();
+//             editorStackTabNavigator.allowTabSqueezing=false;
+//             editorStackTabNavigator.minTabWidth=10;
+//             editorStackTabNavigator.closePolicy="close_never";
+//             editorStackTabNavigator.scrollSpeed=20;
                editorStackTabNavigator.creationPolicy="auto";
                editorStackTabNavigator.percentWidth=100;
                editorStackTabNavigator.percentHeight=100;
                editorStackTabNavigator.styleName="dndStackTab";
-               editorStackTabNavigator.popUpButtonPolicy="off"
+//             editorStackTabNavigator.popUpButtonPolicy="off"
 
 
                editorStackAccordion = new Accordion();
                editorStackAccordion.percentHeight=100;
                editorStackAccordion.creationPolicy="auto";
                editorStackAccordion.styleName="dndStackAccordion";
+               /* FIXME: the accordion icons should be right-aligned. See:
+               http://www.kristoferjoseph.com/blog/2008/11/06/positioning-the-flex-accordion-header-icon
+               http://blog.flexexamples.com/2007/09/13/changing-text-alignment-in-an-flex-accordion-header/
+               */
 
                setEditorStackUI(true);
        }
        }
 
        private function editorStackUIUpdate(event:Event):void {
-               if (editorStack is SuperTabNavigator) {
-                       var e:SuperTabNavigator = editorStack as SuperTabNavigator;
+               if (editorStack is TabNavigator) {
+                       var e:TabNavigator = editorStack as TabNavigator;
                        if (e.selectedIndex<0) { return; }
                        for (var i:uint=0; i<e.numChildren; i++) {
                                e.getTabAt(i).selected=(i==e.selectedIndex);
 
       private function editRelation(id:Number):void {
           var panel:RelationEditorPanel = RelationEditorPanel(
-              PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
+              PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), RelationEditorPanel, true));
           panel.setRelation(connection.getRelation(id));
           PopUpManager.centerPopUp(panel);
       }
        public function selectRelationMenu(event:MenuEvent):void {
                var rel:Relation=rowData.relation;
                var entities:Array;
-               var controller:EditController=Application.application.theController;
+               var controller:EditController=FlexGlobals.topLevelApplication.theController;
                switch (event.index) {
                        case 0: // Select all members
                                entities=selectedEntity.entities.concat(rel.memberEntities);
                if (rows!=Math.floor(rows)) { rows=Math.floor(rows+1); }
                event.target.height=rows*(event.target.rowHeight+1);
        }
-  ]]></mx:Script>
+  ]]></fx:Script>
 </mx:VBox>
 
index dcb05c3..0657976 100644 (file)
 <?xml version="1.0" encoding="utf-8"?>
 <mx:Panel
-       xmlns:mx="http://www.adobe.com/2006/mxml"
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
+       xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
        height="76" width="129" layout="absolute"
        styleName="theToolBox">
 
-        <!-- the animation effect that controls the rotation of the reverse arrow.
-              We could get more fancy by using previous angle in angleFrom, and a longer duration, to give a nice animated effect -->
-        <mx:Rotate id="rotate" angleFrom="{angle-1}" angleTo="{angle}" target="{arrowBox}" originX="{arrowBox.width/2}" originY="{arrowBox.height/2}" duration="4"/>
-
-
                <mx:Image data="@Embed('../../../embedded/close_small.png')"
                        includeInLayout="false" id="toolboxClose" click="toggle();" 
                        y="-6" x="115" />
 
                <!-- Top row -->
 
-               <mx:Button icon="@Embed('../../../embedded/delete.svg')"
+               <s:Button icon="@Embed('../../../embedded/delete.svg')"
                        click='doDelete();' 
                        enabled="{canDo('delete')}" 
                        alpha="{getAlpha('delete')}" 
                        toolTip="{deleteToolTipText()}" 
-                       width="28" height="28" textAlign="left" y="4" x="6" paddingLeft="6" paddingRight="0" />
+                       width="28" height="28" y="4" x="6" />
 
-        <mx:HBox id="reverseButton" width="28" height="28" y="4" x="36" borderStyle="solid" cornerRadius="4"
-                  click="reverseClicked();" horizontalAlign="center" verticalAlign="middle" toolTip="Reverse direction (V)">
+               <mx:HBox id="reverseButton" width="28" height="28" y="4" x="36" borderStyle="none"
+                          horizontalAlign="center" verticalAlign="middle" toolTip="Reverse direction (V)">
             <mx:ViewStack id="rotateButtonStack" creationPolicy="all">
-                <mx:HBox id="arrowBoxWrapper"><!-- changing the viewstack back onto a rotated hbox causes positioning glitches, hence this wrapper -->
-                    <!-- I can totally recommend adding borderStyle="solid" to arrowBox when debugging -->
-                    <mx:HBox id="arrowBox" horizontalAlign="center" verticalAlign="middle" width="24" height="24">
-                        <mx:Image id="arrow" source="@Embed('../../../embedded/arrow.svg')"
-                            alpha="{getAlpha('reverseDirection')}"
-                            width="22" height="22"/>
-                    </mx:HBox>
+                <mx:HBox id="arrowBoxWrapper">
+                                       <s:NavigatorContent width="28" height="28">
+                                               <s:Button id="arrow" icon="{Arrow}" width="28" height="28" alpha="{getAlpha('reverseDirection')}" click="reverseClicked();"/>
+                                       </s:NavigatorContent>
                 </mx:HBox>
                 <mx:HBox id="clockwiseBox" horizontalAlign="center" verticalAlign="middle">
-                    <mx:Image id="clockwise" source="@Embed('../../../embedded/clockwise.svg')"
+                    <s:Button id="clockwise" icon="@Embed('../../../embedded/clockwise.svg')"
                         alpha="{getAlpha('reverseDirection')}"
-                        width="22" height="22" x="2" y="2"/>
+                        width="28" height="28" click="reverseClicked();" />
                 </mx:HBox>
                 <mx:HBox id="antiClockwiseBox" horizontalAlign="center" verticalAlign="middle">
-                    <mx:Image id="anticlockwise" source="@Embed('../../../embedded/anti-clockwise.svg')"
-                        click='doReverseDirection();'
+                    <s:Button id="anticlockwise" icon="@Embed('../../../embedded/anti-clockwise.svg')"
                         enabled="{canDo('reverseDirection')}"
                         alpha="{getAlpha('reverseDirection')}"
-                        width="22" height="22" x="2" y="2"/>
+                        width="28" height="28" click="reverseClicked();" />
                 </mx:HBox>
             </mx:ViewStack>
         </mx:HBox>
-               <mx:Button icon="@Embed('../../../embedded/cut.svg')" 
+               <s:Button icon="@Embed('../../../embedded/cut.svg')"
                        id="splitButton"
                        click='doSplit();'
                        enabled="{canDo('split')}" 
                        alpha="{getAlpha('split')}" 
                        toolTip="Split way (X)" 
-                       width="28" height="28" textAlign="left" y="4" x="66" paddingLeft="8" paddingRight="0" />
-               <mx:Button icon="@Embed('../../../embedded/merge.svg')" 
+                       width="28" height="28" y="4" x="66" />
+               <s:Button icon="@Embed('../../../embedded/merge.svg')"
                        id="mergeButton"
                        click='doMerge();'
                        enabled="{canDo('merge')}" 
                        alpha="{getAlpha('merge')}" 
                        toolTip="Merge ways" 
-                       width="28" height="28" textAlign="left" y="4" x="96" paddingLeft="3" paddingRight="0" />
+                       width="28" height="28" y="4" x="96" />
 
                <!-- Second row -->
 
-               <mx:Button icon="@Embed('../../../embedded/straighten.svg')" 
+               <s:Button icon="@Embed('../../../embedded/straighten.svg')"
                        id="straightenButton"
                        click='doStraighten();' 
                        enabled="{canDo('straighten')}" 
                        alpha="{getAlpha('straighten')}" 
                        toolTip="Straighten way" 
-                       width="28" height="28" textAlign="left" y="34" x="6" paddingLeft="5" paddingRight="0" />
-               <mx:Button icon="@Embed('../../../embedded/circle.svg')" 
+                       width="28" height="28" y="34" x="6" />
+               <s:Button icon="@Embed('../../../embedded/circle.svg')"
                        id="circulariseButton"
                        click='doCircularise();' 
                        enabled="{canDo('circularise')}" 
                        alpha="{getAlpha('circularise')}" 
                        toolTip="Make circular" 
-                       width="28" height="28" textAlign="left" y="34" x="36" paddingLeft="4" paddingRight="0" />
-               <mx:Button icon="@Embed('../../../embedded/quadrilateralise.svg')" 
+                       width="28" height="28" y="34" x="36" />
+               <s:Button icon="@Embed('../../../embedded/quadrilateralise.svg')"
                        id="quadrilateraliseButton"
                        click='doQuadrilateralise();' 
                        enabled="{canDo('quadrilateralise')}" 
                        alpha="{getAlpha('quadrilateralise')}" 
                        toolTip="Make right-angled (Q)"
-                       width="28" height="28" textAlign="left" y="34" x="66" paddingLeft="6" paddingRight="0" />
-               <mx:Button icon="@Embed('../../../embedded/parallel.svg')" 
+                       width="28" height="28" y="34" x="66" />
+               <s:Button icon="@Embed('../../../embedded/parallel.svg')"
                        id="parralleliseButton"
                        click='doParallelise();' 
                        enabled="{canDo('parallelise')}" 
                        alpha="{getAlpha('parallelise')}" 
                        toolTip="Create parallel way (P)" 
-                       width="28" height="28" textAlign="left" y="34" x="96" paddingLeft="8" paddingRight="0" />
+                       width="28" height="28" y="34" x="96" />
 
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
 
                import flash.events.Event;
                import flash.events.MouseEvent;
                import net.systemeD.halcyon.connection.actions.*;
                import net.systemeD.potlatch2.controller.*;
                import net.systemeD.potlatch2.tools.*;
+               import embedded.*;      // for FXG icons
 
                private var controller:EditController;
 
                         w.clockwise? rotateButtonStack.selectedChild = antiClockwiseBox : rotateButtonStack.selectedChild = clockwiseBox;
                     } else {
                         rotateButtonStack.selectedChild = arrowBoxWrapper;
-                        // reset and reposition back to the starting point relative to its parent
-                        rotate.end();
-                        angle = 0;
-                        rotate.play();
-                        arrowBox.x = 0;
-                        arrowBox.y = 0;
-
-                        // move
-                        rotate.end();
-                        angle = w.angle;
-                        rotate.play();
+                        arrow.iconDisplay.rotation=w.angle;
+                                               arrow.iconDisplay.smooth=true;
                     }
                 }
             }
 
 
        ]]>
-</mx:Script>   
+</fx:Script>
 </mx:Panel>
index e17c883..9013310 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-        xmlns:mx="http://www.adobe.com/2006/mxml" 
+        xmlns:fx="http://ns.adobe.com/mxml/2009"
+        xmlns:mx="library://ns.adobe.com/flex/mx"
         layout="vertical" showCloseButton="true"
         horizontalAlign="center" title="Load vector file"
         width="500" height="350" verticalGap="0">
            <mx:columns>
                <mx:DataGridColumn editable="false" dataField="visible" headerText="Show?" width="45">
                                <mx:itemRenderer>
-                                       <mx:Component>
+                                       <fx:Component>
                                                <mx:CheckBox selectedField="isSelected"
                                                                         click="data.isSelected=!data.isSelected; this.parent.parent.dispatchEvent(new Event('visibility_changed'));" 
                                                                         paddingLeft="5"/>
-                                       </mx:Component>
+                                       </fx:Component>
                                </mx:itemRenderer>
                        </mx:DataGridColumn>
                <mx:DataGridColumn editable="false" dataField="interactive" headerText="Select?" width="45">
                                        <!-- There should really be a way to hide this for the editable layer. See
                                             http://stackoverflow.com/questions/6329895/how-do-i-change-the-style-of-one-individual-cell-in-a-flex-datagrid 
                                             Leave it as a FIXME until we move to Flex 4 -->
-                                       <mx:Component>
+                                       <fx:Component>
                                                <mx:CheckBox selectedField="isInteractive"
                                                                         click="data.isInteractive=!data.isInteractive; this.parent.parent.dispatchEvent(new Event('interactive_changed'));" 
                                                             paddingLeft="5"/>
-                                       </mx:Component>
+                                       </fx:Component>
                                </mx:itemRenderer>
                        </mx:DataGridColumn>
                <mx:DataGridColumn editable="true"  dataField="name"  headerText="Name"/>
                <mx:DataGridColumn editable="false" dataField="url"   headerText="URL"/>
                <mx:DataGridColumn editable="false" dataField="style" headerText="Style">
                                <mx:itemRenderer>
-                                       <mx:Component>
+                                       <fx:Component>
                                        <mx:ComboBox
                                                        selectedItem="{outerDocument.whichStyle(data)}"
                                                change="outerDocument.styleEdited(data.name,selectedItem.url)"
                                                dataProvider="{outerDocument.styles}" 
                                                        labelField="name" />
-                                       </mx:Component>
+                                       </fx:Component>
                                </mx:itemRenderer>
                        </mx:DataGridColumn>
            </mx:columns>
@@ -61,9 +62,9 @@
                        <mx:Label text="Shapefile projection:" />
                        <mx:ComboBox id="projection"> 
                                <mx:ArrayCollection>
-                                       <mx:Object label="Lat/long" data="" />
-                                       <mx:Object label="Ordnance Survey GB" data="EPSG:27700" />
-                                       <mx:Object label="NAD83" data="EPSG:4269" />
+                                       <fx:Object label="Lat/long" data="" />
+                                       <fx:Object label="Ordnance Survey GB" data="EPSG:27700" />
+                                       <fx:Object label="NAD83" data="EPSG:4269" />
                                </mx:ArrayCollection>
                        </mx:ComboBox>
                        <mx:CheckBox width="100%" label="Simplify paths" selected="true" id="simplify" />
@@ -75,7 +76,7 @@
                </mx:HBox>
        </mx:VBox>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
        import net.systemeD.halcyon.Map;
        import net.systemeD.halcyon.MapPaint;
@@ -91,6 +92,7 @@
     import mx.events.DataGridEvent;
     import mx.events.CloseEvent;
     import mx.core.Application;
+    import mx.core.FlexGlobals;
        import mx.collections.ArrayCollection;
        import mx.controls.Alert;
 
 
 
     public function init():void {
-        PopUpManager.addPopUp(this, Application(Application.application), true);
+        PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, vectorDialog_close);
                dataGrid.addEventListener("visibility_changed", toggleVisibility);
        }
 
               ]]>
-  </mx:Script>
+  </fx:Script>
 </mx:TitleWindow>
index b9a42aa..f8abb7c 100644 (file)
@@ -95,12 +95,11 @@ package net.systemeD.potlatch2.collections {
             }
 
                        // Get any attribution and logo details
-                       for each (bg in collection) {
+                       collection.forEach(function(bg:Object, index:int, array:Array):void {
                                if (bg.logo) {
                                        // load the logo
                                        var loader:Loader = new Loader();
-                                       var thisbg1:Object = bg;                        // scope it for the closure
-                                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void { onLogoLoad(e,thisbg1); });
+                                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void { onLogoLoad(e,bg); });
                                        loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                        loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
                                        loader.load(new URLRequest(bg.logo));
@@ -108,13 +107,12 @@ package net.systemeD.potlatch2.collections {
                                if (bg.attribution_url) {
                                        // load the attribution
                                var urlloader:URLLoader = new URLLoader();
-                                       var thisbg2:Object = bg;                        // scope it for the closure
-                                       urlloader.addEventListener(Event.COMPLETE, function(e:Event):void { onAttributionLoad(e,thisbg2); });
+                                       urlloader.addEventListener(Event.COMPLETE, function(e:Event):void { onAttributionLoad(e,bg); });
                                        urlloader.addEventListener(IOErrorEvent.IO_ERROR, onError);
                                        urlloader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
                                urlloader.load(new URLRequest(bg.attribution_url));
                                }
-                       }
+                       });
 
                        // Tell the function key manager that we'd like to receive function key calls
                        FunctionKeyManager.instance().registerListener('Background imagery',
index 87ff4cb..8c7b32c 100644 (file)
@@ -131,17 +131,14 @@ package net.systemeD.potlatch2.controller {
                        } else if ( event.type == MouseEvent.MOUSE_DOWN ) {
                                if ( entity is Node && selectedWay && entity.hasParent(selectedWay) ) {
                                        // select node within this way
-                       return new DragWayNode(selectedWay,  getNodeIndex(selectedWay,entity as Node),  event, false);
-                               } else if ( entity is Node && focus is Way ) {
-                                       // select way node
-                                       return new DragWayNode(focus as Way, getNodeIndex(focus as Way,entity as Node), event, false);
+                                       return new DragWayNode(selectedWay,  getNodeIndex(selectedWay,entity as Node),  event, false);
                                } else if ( controller.keyDown(Keyboard.SPACE) ) {
                                        // drag the background imagery to compensate for poor alignment
                                        return new DragBackground(event);
                                } else if (entity && selection.indexOf(entity)>-1) {
                                        return new DragSelection(selection, event);
                                } else if (entity) {
-                                       return new DragSelection([entity], event);
+                                       return controller.findStateForSelection([entity]);
                                } else if (event.ctrlKey && !layer.isBackground) {
                                        return new SelectArea(event.localX,event.localY,selection);
                                }
index a64c90e..887aa99 100644 (file)
@@ -1,12 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        layout="vertical" showCloseButton="true"
        horizontalAlign="center" title="Search"
        width="458" height="350" verticalGap="0" creationComplete="txtFind.setFocus()">
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
         import flash.events.Event;
                import mx.core.Application;
+               import mx.core.FlexGlobals;
                import mx.events.CloseEvent;
                import mx.events.FlexEvent;
                import mx.managers.PopUpManager;
@@ -27,7 +29,7 @@
                                
                
                public function init():void {
-                       PopUpManager.addPopUp(this, Application(Application.application), true);
+                       PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
                        PopUpManager.centerPopUp(this);
                        this.addEventListener(CloseEvent.CLOSE, findDialog_close);
                        
         }
         
         private function goToSelected():void {
-            Application.application.theMap.updateCoordsFromLatLon(selectedResult.lat, selectedResult.lon);
-            Application.application.theMap.download();
-            //Application.application.theMap.redraw();            
+            FlexGlobals.topLevelApplication.theMap.moveMapFromLatLon(selectedResult.lat, selectedResult.lon);
+            //FlexGlobals.topLevelApplication.theMap.redraw();
             PopUpManager.removePopUp(this);
         }
         
         
        ]]>
-       </mx:Script>
+       </fx:Script>
 
        <mx:HBox horizontalAlign="left" width="100%">
                <mx:Label text="Enter place name: " />
index 30daaea..0c64b4d 100644 (file)
@@ -1,19 +1,23 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-        xmlns:mx="http://www.adobe.com/2006/mxml"
+        xmlns:fx="http://ns.adobe.com/mxml/2009"
+        xmlns:mx="library://ns.adobe.com/flex/mx"
         xmlns:help="net.systemeD.potlatch2.help.*"
         layout="vertical" showCloseButton="true"
         horizontalAlign="center" title="{getTitleText()}"
         width="660" height="500"
         verticalGap="0">
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
     import mx.managers.PopUpManager;
     import mx.events.CloseEvent;
     import mx.core.Application;
+    import mx.core.FlexGlobals;
+
+       [Bindable] private var application:Object = FlexGlobals.topLevelApplication;
 
     /** Pops up a multi-tabbed help window in the middle of the screen, then remembers that the user has seen it. */
     public function init():void {
-        PopUpManager.addPopUp(this, Application(Application.application), true);
+        PopUpManager.addPopUp(this, Application(application), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, helpDialog_close);
 
                           ["/", "Cycle through overlapping ways"],
                           ];
         var text2:Array =  [["+", "Add new tag"],
+                            [", .", "Cycle through nodes in way"],
                             ["D", "Dim features"],
                             ["F", "Follow existing way"],
-                            ["R", "Repeat tags"],
-                            ["T", "Toggle between simple and advanced tags"],
+                            ["M", "Maximise editor"],
                             ["P", "Create parallel way"],
-                            ["V", "Reverse direction of way"]
+                            ["Q", "Make area right-angled"],
+                            ["R", "Repeat tags"],
                             ];
-        var text3:Array =  [["Q", "Make area right-angled"],
-                            ["S", "Save"],
+        var text3:Array =  [["S", "Save"],
+                            ["T", "Toggle between simple and advanced tags"],
+                            ["V", "Reverse direction of way"],
                             ["X", "Cut way at node"],
                             ["Z", "Undo"],
                             ["Esc", "Cancel edit"],
-                            ["Space", "Hold to realign background image"]
+                            ["Space", "Hold/drag to realign background image"]
                             ];
         shortcuts1.addChild(buildGrid(text));
         shortcuts2a.addChild(buildGrid(text2));
     }
 
               ]]>
-  </mx:Script>
+  </fx:Script>
   <mx:TabNavigator id="helpTN" width="100%" height="100%" styleName="helpTN" creationPolicy="all">
     <mx:VBox label="Welcome" id="welcome" width="100%" height="100%">
       <mx:Grid width="100%"><!-- prepare for a column of icons, at some point -->
   </mx:TabNavigator>
 
   <mx:ControlBar>
-    <mx:Label text="Version: {Application.application.version} Build: {Application.application.build_number}" />
+    <mx:Label text="Version: {application.version} Build: {application.build_number}" />
     <mx:Spacer width="100%"/>
     <mx:Button label="Ok" click="PopUpManager.removePopUp(this);" styleName="titleWindowButton" />
   </mx:ControlBar>
index fdb6f89..33c7208 100644 (file)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
-<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="0">
+<mx:VBox
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+    xmlns:mx="library://ns.adobe.com/flex/mx"
+    verticalGap="0">
        <mx:ViewStack id="videoStack" width="100%" height="100%">
                <mx:Box id="previewContainer">
                        <mx:Image id="preview" width="100%" height="100%" source="{previewImage}" 
@@ -22,7 +25,7 @@
                        thumbRelease="progressThumbRelease(event);" />
        </mx:HBox> 
 
-       <mx:Script> 
+       <fx:Script>
                <![CDATA[ 
 
                        /** VideoPlayer component for P2 help dialog.
@@ -38,8 +41,6 @@
                                the user actually wants it.)
                        */
 
-                       import mx.events.VideoEvent;
-
                        [Bindable] public var file:String;
                        [Bindable] public var previewImage:String; 
                        private var wasPlaying:Boolean;
@@ -74,8 +75,8 @@
                                video.playheadTime = event.currentTarget.value; 
                                if (wasPlaying) playVideo();
                        } 
-                       public function advanceProgress(event:VideoEvent):void {
-                               progressBar.value = event.playheadTime;
+                       public function advanceProgress(event:Event):void {
+                               progressBar.value = mx.events.VideoEvent(event).playheadTime;
                        }
                        public function stopPlaying():void {
                                if (!video.playing) return;
@@ -84,5 +85,5 @@
                        }
 
                ]]> 
-       </mx:Script>
+       </fx:Script>
 </mx:VBox>
index af09546..0774925 100644 (file)
@@ -34,14 +34,15 @@ package net.systemeD.potlatch2.mapfeatures {
         }
 
         /** Translates a priority string ("highest") to a const (PRIORITY_HIGHEST). */
-        public static function getPriority(priority:String):uint {
+        public function getPriority(priority:String):uint {
+                       var base:uint=subcategory ? 0 : 11;
             switch ( priority ) {
-            case "highest": return PRIORITY_HIGHEST;
-            case "high": return PRIORITY_HIGHEST;
-            case "normal": return PRIORITY_NORMAL;
-            case "low": return PRIORITY_LOW;
-            case "lowest": return PRIORITY_LOWEST;
-            default: return PRIORITY_NORMAL;
+            case "highest": return PRIORITY_HIGHEST+base;
+            case "high": return PRIORITY_HIGH+base;
+            case "normal": return PRIORITY_NORMAL+base;
+            case "low": return PRIORITY_LOW+base;
+            case "lowest": return PRIORITY_LOWEST+base;
+            default: return PRIORITY_NORMAL+base;
             }
         }
 
@@ -54,6 +55,9 @@ package net.systemeD.potlatch2.mapfeatures {
         /** Default category: "Standard" */
         public var category:String = "Standard";
 
+        /** Optional subcategory (rendered as a collapsible panel) */
+        public var subcategory:String;
+
         private var _name:String;
         private var _description:String;
 
@@ -62,6 +66,7 @@ package net.systemeD.potlatch2.mapfeatures {
             _name = String(inputXML.@name);
             _description = String(inputXML.@description);
             category = String(inputXML.@category);
+            subcategory = String(inputXML.@subcategory);
         }
 
         /** Whether the tags on an entity correspond to those for the edit control. By default, returns true - must be overriden by more useful behaviour. */
index beb69ff..d02c119 100644 (file)
@@ -8,6 +8,7 @@ package net.systemeD.potlatch2.mapfeatures {
     import mx.core.BitmapAsset;
     import mx.graphics.codec.PNGEncoder;
     
+    import net.systemeD.halcyon.ImageBank;
     import net.systemeD.halcyon.connection.Entity;
     import net.systemeD.potlatch2.utils.CachedDataLoader;
 
@@ -67,8 +68,12 @@ package net.systemeD.potlatch2.mapfeatures {
 
             for each(var inputSetRef:XML in xml.inputSet) {
                 var setName:String = String(inputSetRef.@ref);
-                for each (inputXML in mapFeatures.definition.inputSet.(@id==setName)) {
-                    addEditors(inputXML);
+                // Go on then, someone tell me why this stopped working. Namespaces?:
+                //for each (inputXML in mapFeatures.definition.inputSet.(@id == setName)) {
+                for each (inputXML in mapFeatures.definition.inputSet) {
+                    if (inputXML.@id == setName) {
+                        addEditors(inputXML);
+                    }
                 }
             }
 
@@ -84,7 +89,7 @@ package net.systemeD.potlatch2.mapfeatures {
             var editor:EditorFactory = EditorFactory.createFactory(inputType, inputXML);
             if ( editor != null ) {
                 editor.presence = Presence.getPresence(presenceStr);
-                editor.sortOrder = EditorFactory.getPriority(sortOrderStr);
+                editor.sortOrder = editor.getPriority(sortOrderStr);
                 _editors.push(editor);
             }
         }
@@ -134,8 +139,7 @@ package net.systemeD.potlatch2.mapfeatures {
         * @param dnd if true, overrides the normal image and returns the one defined by the dnd property instead. */
         private function getImage(dnd:Boolean = false):ByteArray {
             var icon:XMLList = _xml.icon;
-            var imageURL:String = null;
-            var img:ByteArray;
+            var imageURL:String;
 
             if ( dnd && icon.length() > 0 && icon[0].hasOwnProperty("@dnd") ) {
                 imageURL = icon[0].@dnd;
@@ -143,11 +147,12 @@ package net.systemeD.potlatch2.mapfeatures {
                 imageURL = icon[0].@image;
             }
 
-            if ( imageURL != null ) {
-                img = CachedDataLoader.loadData(imageURL, imageLoaded);
-            }
-            if (img) {
-              return img;
+            if ( imageURL ) {
+                               if (ImageBank.getInstance().hasImage(imageURL)) {
+                                       return ImageBank.getInstance().getAsByteArray(imageURL)
+                               } else {
+                       return CachedDataLoader.loadData(imageURL, imageLoaded);
+                               }
             }
             var bitmap:BitmapAsset = new missingIconCls() as BitmapAsset;
             return new PNGEncoder().encode(bitmap.bitmapData);
index 007f634..66b997b 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:SingleTagEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        verticalGap="0"
@@ -13,7 +14,7 @@
                                 labelPlacement="right" label=""
                                 change="value=toYesNo()" />
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
   
        protected function initCheckbox():void {
                // ** FIXME - these should really be bindings (selected="{...}"). 
@@ -44,6 +45,6 @@
                return inputBox.selected ? 'yes':'no';
        }
        
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:SingleTagEditor>
 
index ed1a372..9798a70 100644 (file)
@@ -18,7 +18,7 @@ package net.systemeD.potlatch2.mapfeatures.editors {
                 if ( !textInputReplacement ) {
                         if ( itemRenderer != null ) {
                                 //remove the default textInput
-                                removeChild(textInput);
+                                removeChild(TextInput(textInput));
 
                                 //create a new itemRenderer to use in place of the text input
                                 textInputReplacement = itemRenderer.newInstance();
@@ -36,16 +36,16 @@ package net.systemeD.potlatch2.mapfeatures.editors {
             if ( textInputReplacement ) {
                 IDataRenderer(textInputReplacement).data = selectedItem;
 
-                var arrowWidth:Number = getStyle("arrowButtonWidth");\r
-                var itemHeight:Number = textInputReplacement.getExplicitOrMeasuredHeight();\r
-                var itemWidth:Number = textInputReplacement.getExplicitOrMeasuredWidth();\r
-\r
-                if (isNaN(arrowWidth))\r
-                    arrowWidth = 0;\r
+                var arrowWidth:Number = getStyle("arrowButtonWidth");
+                var itemHeight:Number = textInputReplacement.getExplicitOrMeasuredHeight();
+                var itemWidth:Number = textInputReplacement.getExplicitOrMeasuredWidth();
+
+                if (isNaN(arrowWidth))
+                    arrowWidth = 0;
 
                 var bm:EdgeMetrics = borderMetrics;
 
-                textInputReplacement.setActualSize(unscaledWidth - arrowWidth, itemHeight);\r
+                textInputReplacement.setActualSize(unscaledWidth - arrowWidth, itemHeight);
                 textInputReplacement.move(bm.left, bm.top);
             }
         }
@@ -57,21 +57,21 @@ package net.systemeD.potlatch2.mapfeatures.editors {
                 IDataRenderer(textInputReplacement).data = selectedItem;
                 var prefSize:Object = calculatePreferredSizeFromData(collection.length);
 
-                var arrowWidth:Number = getStyle("arrowButtonWidth");\r
-                var itemHeight:Number = textInputReplacement.getExplicitOrMeasuredHeight();\r
-                var itemWidth:Number = textInputReplacement.getExplicitOrMeasuredWidth();\r
-\r
-                if (isNaN(arrowWidth))\r
-                    arrowWidth = 0;\r
+                var arrowWidth:Number = getStyle("arrowButtonWidth");
+                var itemHeight:Number = textInputReplacement.getExplicitOrMeasuredHeight();
+                var itemWidth:Number = textInputReplacement.getExplicitOrMeasuredWidth();
+
+                if (isNaN(arrowWidth))
+                    arrowWidth = 0;
 
                 var bm:EdgeMetrics = borderMetrics;
-                itemHeight += bm.top + bm.bottom;\r
+                itemHeight += bm.top + bm.bottom;
                 itemWidth += bm.left + bm.right + arrowWidth + 8;
                 prefSize.height += bm.top + bm.bottom;
-                prefSize.width += bm.left + bm.right + arrowWidth + 8;\r
+                prefSize.width += bm.left + bm.right + arrowWidth + 8;
 
-                measuredMinHeight = measuredHeight = Math.max(prefSize.height, itemHeight);\r
-                measuredMinWidth = measuredWidth = Math.max(prefSize.width, itemWidth);\r
+                measuredMinHeight = measuredHeight = Math.max(prefSize.height, itemHeight);
+                measuredMinWidth = measuredWidth = Math.max(prefSize.width, itemWidth);
             }
         }
 
@@ -87,8 +87,8 @@ package net.systemeD.potlatch2.mapfeatures.editors {
                 IDataRenderer(test).data = collection[i];
                 test.validateDisplayList();
                 test.validateSize(true);
-                maxWidth = Math.max(maxWidth, test.getExplicitOrMeasuredWidth());\r
-                maxHeight = Math.max(maxHeight, test.getExplicitOrMeasuredHeight());\r
+                maxWidth = Math.max(maxWidth, test.getExplicitOrMeasuredWidth());
+                maxHeight = Math.max(maxHeight, test.getExplicitOrMeasuredHeight());
             }
             removeChild(test);
             return {width: maxWidth, height: maxHeight};
index e75eb5e..cd7489d 100644 (file)
@@ -1,25 +1,32 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:SingleTagEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
+       xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        toolTip="{fieldDescription}"
     direction="{fieldDirection}" styleName="titledEditor">
 
   <mx:Label text="{fieldName}:"/>
-  <edit:ChoiceComboBox id="inputBox" dataProvider="{choices}" selectedItem="{selectFromTag}" rowCount="15"
-      change="value = inputBox.selectedItem.value"
-      open="inputBox.dropdown.variableRowHeight = true">
-      <edit:itemRenderer>
-        <mx:Component>
+  <s:DropDownList id="inputBox" dataProvider="{choices}" selectedItem="{selectFromTag}"
+      change="value = inputBox.selectedItem.value" labelField="label">
+      <s:itemRenderer>
+        <fx:Component>
         <mx:HBox toolTip="{data.description}" horizontalScrollPolicy="off">
           <mx:Image source="{Choice(data).icon}"/>
-          <mx:Label htmlText="{data.label}"/>
+          <mx:Label htmlText="{getStyledLabel(Choice(data))}"/>
+                       <fx:Script><![CDATA[
+                             public function getStyledLabel(choice:Choice):String {
+                                 if (choice.value==null) return "<font color='#a0a0a0'><i>"+choice.label+"</i></font>";
+                                 return choice.label;
+                                 }
+                       ]]></fx:Script>
         </mx:HBox>
-        </mx:Component>
-      </edit:itemRenderer>
-  </edit:ChoiceComboBox>
+        </fx:Component>
+      </s:itemRenderer>
+  </s:DropDownList>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
       import mx.collections.*;
       import mx.utils.*;
       import net.systemeD.potlatch2.mapfeatures.Feature;
 
       [Bindable(event="factory_set")]
       protected function get choices():ArrayCollection {
+          var dummy:String=_factory.key;               // otherwise _factory is null, for some not yet discovered reason.
           if ( _choices == null ) {
               _choices = new ArrayCollection();
-              for each ( var choice:Choice in ChoiceEditorFactory(_factory).choices )
+              for each ( var choice:Choice in ChoiceEditorFactory(_factory).choices ) {
                   _choices.addItem(choice);
+              }
               _choices.addItem(createUnsetChoice());
           }
           return _choices;
           
           return _unknownChoice;
       }
-      
+
       private function createUnsetChoice():Choice {
           var choice:Choice = new Choice();
           choice.icon = null;
           choice.description = "Field not set";
-          choice.label = "<font color='#a0a0a0'><i>Unset</i></font>";
+          choice.label = "Unset";
           choice.value = null;
           return choice;
       }
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:SingleTagEditor>
 
index 3b221ce..6beaa3d 100644 (file)
@@ -9,7 +9,7 @@ package net.systemeD.potlatch2.mapfeatures.editors {
            public var choices:Array;
         
         public function ChoiceEditorFactory(inputXML:XML) {
-            super(inputXML);
+            super(inputXML,"horizontal");
             
             choices = [];
             for each( var choiceXML:XML in inputXML.choice ) {
index a7b142e..08ed76e 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:SingleTagEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        xmlns:controls="net.systemeD.controls.*"
       focusOut="value = inputBox.text" enter="value = inputBox.text"
       restrict="&#x0020;-&#x10FFFF;" />
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
   
       [Bindable(event="factory_set")]
       protected function get prompt():String {
           return _factory == null ? null : FreeTextEditorFactory(_factory).notPresentText;
       }
       
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:SingleTagEditor>
 
index dc1c3b9..80b7209 100644 (file)
@@ -8,7 +8,7 @@ package net.systemeD.potlatch2.mapfeatures.editors {
            private var _notPresentText:String;
         
         public function FreeTextEditorFactory(inputXML:XML) {
-            super(inputXML);
+            super(inputXML,"horizontal");
             _notPresentText = inputXML.hasOwnProperty("@absenceText") ? String(inputXML.@absenceText) : "Unset";
         }
         
index e35e419..ecf8761 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:SingleTagEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        verticalGap="0"
@@ -22,7 +23,7 @@
         <mx:Label text="{warning}" visible="{!isValueValid}" includeInLayout="{!isValueValid}" styleName="warningText" />
     </mx:HBox>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
     [Bindable(event="factory_set")]
     protected function get prompt():String {
         return _factory == null ? null : NumberEditorFactory(_factory).notPresentText;
@@ -81,6 +82,6 @@
         value = null;
     }
        
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:SingleTagEditor>
 
index b075186..868e5ac 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:Canvas
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        width="50" height="50" maxWidth="50" maxHeight="50" minWidth="50" minHeight="50"
        toolTip="{data.description}" enabled="{data.value != null}"
index 53e9ad6..cfd4a9c 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:RelationMemberEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        verticalGap="0"
@@ -12,7 +13,7 @@
   <mx:VBox verticalGap="0" width="100%" id="routeIcons"/>
   <mx:LinkButton label="Add to a route" click="addToRelation()" />
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.potlatch2.*;
     import mx.managers.PopUpManager;
@@ -33,7 +34,7 @@
     public function routeClicked(event:Event):void {
         var relation:Object = RouteIcon(event.currentTarget).route;
         var panel:RelationEditorPanel = RelationEditorPanel(
-            PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
+            PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), RelationEditorPanel, true));
         panel.setRelation(relation["relation"]);
         PopUpManager.centerPopUp(panel);
     }
@@ -42,6 +43,6 @@
                new RelationSelectPanel().init(_entity, _factory.relationTagPatterns);        
        }
     
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:RelationMemberEditor>
 
index 7ab0003..1c07c09 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:HBox
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        borderStyle="inset" verticalAlign="middle" width="100%" paddingLeft="3"
@@ -14,7 +15,7 @@
        <mx:Image source="@Embed('../../../../../embedded/delete.svg')" click='event.stopPropagation();removeFromRelation()'
         buttonMode="true" useHandCursor="true" />
     
-    <mx:Script><![CDATA[
+    <fx:Script><![CDATA[
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.halcyon.styleparser.RuleSet;
     import net.systemeD.potlatch2.mapfeatures.*;
@@ -97,6 +98,6 @@
                Relation(_route["relation"]).removeMember(_route["entity"], MainUndoStack.getGlobalStack().addAction);
        }
     
-    ]]></mx:Script>
+    ]]></fx:Script>
 </mx:HBox>
 
index 05df6c9..2638b11 100644 (file)
@@ -8,10 +8,11 @@ package net.systemeD.potlatch2.mapfeatures.editors {
            private var tagKey:String;
                private var boxDirection:String;
         
-        public function SingleTagEditorFactory(inputXML:XML) {
+        public function SingleTagEditorFactory(inputXML:XML, defaultLayout:String="vertical") {
             super(inputXML);
             tagKey = inputXML.@key;
-                       boxDirection = inputXML.@layout=='horizontal' ? 'horizontal' : 'vertical';
+                       boxDirection = inputXML.@layout;
+                       if (!boxDirection) { boxDirection=defaultLayout; }
         }
         
         override public function areTagsMatching(entity:Entity):Boolean {
index 7b06ea4..e878850 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:SingleTagEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        verticalGap="0"
@@ -18,7 +19,7 @@
                  liveDragging="true"
                                 change="setTagValueFromSlider()" />
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
     private function setTagValueFromSlider():void {
         // unset the tag if being set to the default
@@ -79,6 +80,6 @@
         return parsed;
     }
        
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:SingleTagEditor>
 
index 4471672..de78016 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:SingleTagEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        toolTip="{fieldDescription}"
        direction="horizontal" styleName="titledEditor">
@@ -14,7 +15,7 @@
       fontWeight="normal">
   </edit:ChoiceComboBox>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
       import mx.collections.*;
       import mx.utils.*;
       import net.systemeD.potlatch2.mapfeatures.Feature;
@@ -65,6 +66,6 @@
           choice.value = null;
           return choice;
       }
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:SingleTagEditor>
 
index 69b9702..27c7f2f 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <edit:RelationMemberEditor
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        verticalGap="0"
@@ -12,7 +13,7 @@
   <mx:VBox verticalGap="0" width="100%" id="turnRestrictionIcons"/>
   <mx:LinkButton label="Add new turn restriction" click="addNewTurnRestriction()" />
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
        import net.systemeD.halcyon.connection.*;
        import net.systemeD.potlatch2.*;
        import mx.core.*;
@@ -37,6 +38,6 @@
                addTurnRestrictions();
        }
        
-  ]]></mx:Script>
+  ]]></fx:Script>
 </edit:RelationMemberEditor>
 
index 11465a4..fd63252 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:HBox
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        xmlns:flexlib="flexlib.controls.*"
        horizontalScrollPolicy="off"
                                            dropdownWidth="162" rowCount="2"
                                            fontWeight="normal">
                                        <mx:ArrayCollection id="restrictionTypes">
-                                               <mx:Object label="No left turn" data='no_left_turn' />
-                                               <mx:Object label="No right turn" data='no_right_turn' />
-                                               <mx:Object label="No U turns" data='no_u_turn' />
-                                               <mx:Object label="No straight on" data='no_straight_on' />
-                                               <mx:Object label="Left turn only" data='only_left_turn' />
-                                               <mx:Object label="Right turn only" data='only_right_turn' />
-                                               <mx:Object label="Straight on only" data='only_straight_on' />
+                                               <fx:Object label="No left turn" data='no_left_turn' />
+                                               <fx:Object label="No right turn" data='no_right_turn' />
+                                               <fx:Object label="No U turns" data='no_u_turn' />
+                                               <fx:Object label="No straight on" data='no_straight_on' />
+                                               <fx:Object label="Left turn only" data='only_left_turn' />
+                                               <fx:Object label="Right turn only" data='only_right_turn' />
+                                               <fx:Object label="Straight on only" data='only_straight_on' />
                                        </mx:ArrayCollection>
                                </edit:ChoiceComboBox>
                                </mx:GridItem>
@@ -57,7 +58,7 @@
        </mx:HBox>
        </mx:VBox>
 
-    <mx:Script><![CDATA[
+    <fx:Script><![CDATA[
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.halcyon.styleparser.RuleSet;
     import net.systemeD.potlatch2.RelationEditorPanel;
@@ -69,6 +70,7 @@
     import mx.collections.ArrayCollection;
        import mx.utils.ObjectProxy;
        import mx.core.Application;
+       import mx.core.FlexGlobals;
        import mx.managers.PopUpManager;
 
     private var _turn:Object;
        public function openAdvanced():void {
                var rel:Relation=Relation(_turn.relation);
                var panel:RelationEditorPanel = RelationEditorPanel(
-                       PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
+                       PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), RelationEditorPanel, true));
                panel.setRelation(rel);
                PopUpManager.centerPopUp(panel);
        }
                var to:Object  =findSelected('to'  ); if (to  ) { paint.setHighlight(to.data  , { restrictto: bool   } ); }
        }
     
-    ]]></mx:Script>
+    ]]></fx:Script>
 </mx:HBox>
 
index 50bf477..7687a26 100644 (file)
@@ -1,13 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:Canvas
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        xmlns:edit="net.systemeD.potlatch2.mapfeatures.editors.*"
        width="40" height="40" maxWidth="40" maxHeight="40" minWidth="40" minHeight="40"
        mouseEnabled="false" mouseChildren="false">
 
        <mx:Image x="0" y="0" id="sign" left="4" top="4" source="{dataProxied.data ? 'features/restriction__'+dataProxied.data+'.png' : ''}" toolTip="{dataProxied.label}" />
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
        import mx.utils.ObjectProxy;
 
@@ -15,7 +16,7 @@
                return new ObjectProxy(data);
        }
 
-  ]]></mx:Script>
+  ]]></fx:Script>
        
 </mx:Canvas>
 
index f7120de..ec57b37 100644 (file)
@@ -1,14 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-        xmlns:mx="http://www.adobe.com/2006/mxml"
+        xmlns:fx="http://ns.adobe.com/mxml/2009"
+        xmlns:mx="library://ns.adobe.com/flex/mx"
         layout="vertical" showCloseButton="true"
         horizontalAlign="center" title="MyGpx Files"
         width="600" height="400"
         verticalGap="0">
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
     import mx.managers.PopUpManager;
     import mx.events.CloseEvent;
     import mx.core.Application;
+    import mx.core.FlexGlobals;
 
     import net.systemeD.halcyon.connection.*;
     import net.systemeD.potlatch2.save.*;
@@ -22,7 +24,7 @@
     private var conn:Connection;
 
     public function init():void {
-        PopUpManager.addPopUp(this, Application(Application.application), true);
+        PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, myGpxDialog_close);
 
@@ -50,7 +52,7 @@
     }
 
     [Bindable(event="traces_loaded")]
-    private function get traces():Array {
+    private function get traces():Vector.<Trace> {
         return conn.getTraces();
     }
 
@@ -66,7 +68,7 @@
         }
     }
               ]]>
-  </mx:Script>
+  </fx:Script>
 
   <mx:Text text="Traces" id="results" />
   <mx:DataGrid dataProvider="{traces}" width="100%" height="100%" id="traceGrid">
             <mx:DataGridColumn editable="false" dataField="tagsText" headerText="tags"/>
             <mx:DataGridColumn editable="false">
               <mx:itemRenderer>
-                <mx:Component>
+                <fx:Component>
                   <mx:VBox>
                     <mx:Button label="Load"
                       click="parentDocument.loadFile(data)"/>
                   </mx:VBox>
-                </mx:Component>
+                </fx:Component>
               </mx:itemRenderer>
             </mx:DataGridColumn>
     </mx:columns>
index c98cab8..28a092c 100644 (file)
@@ -1,29 +1,31 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-        xmlns:mx="http://www.adobe.com/2006/mxml" 
+        xmlns:fx="http://ns.adobe.com/mxml/2009"
+        xmlns:mx="library://ns.adobe.com/flex/mx"
         layout="vertical" showCloseButton="true"
         horizontalAlign="center" title="Options"
         width="350" height="250" verticalGap="0">
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
     import mx.managers.PopUpManager;
     import mx.events.CloseEvent;
     import mx.core.Application;
+    import mx.core.FlexGlobals;
     import net.systemeD.halcyon.Globals;
     import net.systemeD.halcyon.Map;
     import net.systemeD.halcyon.connection.Connection;
     import net.systemeD.halcyon.connection.StatusFetcher;
     
     public function init():void {
-        PopUpManager.addPopUp(this, Application(Application.application), true);
+        PopUpManager.addPopUp(this, Application(FlexGlobals.topLevelApplication), true);
         PopUpManager.centerPopUp(this);
         this.addEventListener(CloseEvent.CLOSE, optionsDialog_close);
 
         var obj:SharedObject = SharedObject.getLocal("user_state");
 
-        tbcheck.selected = Application.application.toolbox.visible;
-        cursorcheck.selected = Application.application.theController.cursorsEnabled;
+        tbcheck.selected = FlexGlobals.topLevelApplication.toolbox.visible;
+        cursorcheck.selected = FlexGlobals.topLevelApplication.theController.cursorsEnabled;
         tigercheck.selected = obj.data['tiger_highlighted'];
-        latlongcheck.selected = Application.application.coordsbox.visible;
+        latlongcheck.selected = FlexGlobals.topLevelApplication.coordsbox.visible;
                licencecheck.selected = Map(Globals.vars.root).editableLayer.connection.statusFetcher!=null;
     }
     
@@ -33,7 +35,7 @@
 
     private function tigerToggle():void {
         Globals.vars.highlightTiger = tigercheck.selected;
-        Application.application.theMap.redraw();
+        FlexGlobals.topLevelApplication.theMap.redraw();
 
         var obj:SharedObject = SharedObject.getLocal("user_state");
         obj.setProperty("tiger_highlighted",tigercheck.selected);
        }
 
               ]]>
-  </mx:Script>
+  </fx:Script>
        <mx:CheckBox width="100%" label="Show toolbox" selected="true" id="tbcheck"
-           change="Application.application.toolbox.toggle()" />
+           change="FlexGlobals.topLevelApplication.toolbox.toggle()" />
 
        <mx:CheckBox width="100%" label="Use custom cursors" selected="true" id="cursorcheck"
-           change="Application.application.theController.cursorsEnabled=cursorcheck.selected" />
+           change="FlexGlobals.topLevelApplication.theController.cursorsEnabled=cursorcheck.selected" />
 
     <mx:CheckBox width="100%" label="Highlight unedited TIGER (US roads)" selected="false" id="tigercheck"
         change="tigerToggle()" />
 
        <mx:CheckBox width="100%" label="Show mouse latitude/longitude" selected="false" id="latlongcheck" 
-               change="Application.application.coordsbox.visible=latlongcheck.selected" />
+               change="FlexGlobals.topLevelApplication.coordsbox.visible=latlongcheck.selected" />
 
     <mx:CheckBox width="100%" label="Show licence status" selected="false" id="licencecheck"
         change="licenceToggle()" />
index 982feb2..9030a8b 100644 (file)
@@ -4,7 +4,10 @@
     Background Panel
 -->
 
-<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%">
+<mx:VBox
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+    xmlns:mx="library://ns.adobe.com/flex/mx"
+    height="100%">
   <mx:Text id="backgroundPanelText" text="You have selected a Background Feature." width="100%" styleName="helpInfo" />
   <mx:DataGrid editable="false" id="backgroundPanelDG" width="100%" height="50%">
     <mx:columns>
@@ -14,7 +17,7 @@
   </mx:DataGrid>
   <mx:Text text="All the data copied to the main layer? Click 'complete'!" />
   <mx:Button label="Complete" click="markComplete()"/>
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
       import net.systemeD.halcyon.connection.*;
       import net.systemeD.halcyon.MapPaint;
@@ -50,5 +53,5 @@
             }
       }
       ]]>
-  </mx:Script>
+  </fx:Script>
 </mx:VBox>
\ No newline at end of file
index 0f606d2..c13b496 100644 (file)
@@ -4,7 +4,11 @@
     Bug Panel
 -->
 
-<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" paddingTop="10">
+<mx:VBox
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+    xmlns:mx="library://ns.adobe.com/flex/mx"
+    height="100%"
+    paddingTop="10">
   <mx:HBox>
     <mx:Image source="{bugImage}" width="32" height="32" />
     <mx:Text text="{bugTitle}" fontWeight="bold" fontSize="18" />
@@ -56,7 +60,7 @@
     </mx:VBox>
   </mx:ViewStack>
 
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
       import net.systemeD.halcyon.connection.*;
       import net.systemeD.potlatch2.BugConnection;
       }
 
       ]]>
-  </mx:Script>
+  </fx:Script>
 </mx:VBox>
\ No newline at end of file
index 2ab42b3..3a42b75 100644 (file)
@@ -4,7 +4,10 @@
     Marker Panel
 -->
 
-<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" height="100%">
+<mx:VBox
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+    xmlns:mx="library://ns.adobe.com/flex/mx"
+    height="100%">
   <mx:Text id="markerPanelText" text="You have selected a marker." width="100%" styleName="helpInfo" />
   <mx:DataGrid editable="false" id="markerPanelDG" width="100%" height="50%">
     <mx:columns>
@@ -12,7 +15,7 @@
       <mx:DataGridColumn editable="false" dataField="value" headerText="value" />
     </mx:columns>
   </mx:DataGrid>
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
 
       import net.systemeD.halcyon.connection.*;
       import net.systemeD.halcyon.MapPaint;
@@ -41,5 +44,5 @@
             for each(var tag:Tag in tags) { tagDataProvider.addItem(tag); }
       }
       ]]>
-  </mx:Script>
+  </fx:Script>
 </mx:VBox>
\ No newline at end of file
index f972f92..cf5f663 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        layout="vertical"
        horizontalAlign="center" title="Authorisation Required"
        creationComplete="getRequestToken()"
@@ -66,7 +67,7 @@
            <mx:Button id="tryAccessButton" label="Try Access" click="getAccessToken()" enabled="false" styleName="titleWindowButton" />
        </mx:ControlBar>
        
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
                import flash.display.InteractiveObject;
         import flash.events.Event;
         import flash.net.*;
                        getAccessToken();
                }
         
-       ]]></mx:Script>
+       ]]></fx:Script>
 </mx:TitleWindow>
 
index 676c446..510d01f 100644 (file)
@@ -1,15 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:TitleWindow
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
        layout="vertical"
        horizontalAlign="center" title="Save Changes"
        width="350" height="330" verticalGap="0">
 
+  <fx:Declarations>
   <mx:ArrayCollection id="changesetTags">
-    <mx:Object k="created_by" v="Potlatch 2"/>
-    <mx:Object k="version" v="{Application.application.version}"/>
-    <mx:Object k="build" v="{Application.application.build_number}"/>
+    <fx:Object k="created_by" v="Potlatch 2"/>
+    <fx:Object k="version" v="{application.version}"/>
+    <fx:Object k="build" v="{application.build_number}"/>
   </mx:ArrayCollection>
+  </fx:Declarations>
   
   <mx:ViewStack id="processSequence" width="100%" height="100%" 
       creationPolicy="all" creationComplete="if (doSkip) skipInput() else comment.setFocus()">
               itemEditEnd="verifyInput(event)">
             <mx:columns>
                 <mx:DataGridColumn editable="true" dataField="k" headerText="Key">
-                    <mx:itemEditor><mx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></mx:Component></mx:itemEditor>
+                    <mx:itemEditor><fx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></fx:Component></mx:itemEditor>
                 </mx:DataGridColumn>
                 <mx:DataGridColumn editable="true" dataField="v" headerText="Value">
-                    <mx:itemEditor><mx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></mx:Component></mx:itemEditor>
+                    <mx:itemEditor><fx:Component><mx:TextInput restrict="&#x0020;-&#x10FFFF;" /></fx:Component></mx:itemEditor>
                 </mx:DataGridColumn>
             </mx:columns>
           </mx:DataGrid>        
     <mx:Button id="saveButton" label="Save >" click="startSave();" styleName="titleWindowButton" />
   </mx:ControlBar>
   
-  <mx:Script><![CDATA[
+  <fx:Script><![CDATA[
   
     import mx.controls.*;
     import mx.managers.PopUpManager;
        import mx.core.Application;
+       import mx.core.FlexGlobals;
     import mx.events.DataGridEvent;
     import mx.events.DataGridEventReason;
     
@@ -91,8 +95,8 @@
     private var _connection:Connection;
        private var doSkip:Boolean = false;
     
-    [Bindable]
-    private var failureText:String = "";
+    [Bindable] private var failureText:String = "";
+       [Bindable] private var application:Object = FlexGlobals.topLevelApplication;
 
        public function setConnection(connection:Connection):void {
                _connection=connection;
         _connection.removeEventListener(Connection.SAVE_COMPLETED, saveCompleted);
         PopUpManager.removePopUp(this);
     }
-  ]]></mx:Script>
+  ]]></fx:Script>
 </mx:TitleWindow>
 
index c2b9568..9ea879d 100644 (file)
@@ -4,6 +4,7 @@ package net.systemeD.potlatch2.save {
     import flash.net.*;
     import mx.managers.PopUpManager;
     import mx.core.Application;
+    import mx.core.FlexGlobals;
     import net.systemeD.halcyon.connection.*;
     import org.iotashan.oauth.*;
 
@@ -31,7 +32,7 @@ package net.systemeD.potlatch2.save {
 
         private function getNewToken(onCompletion:Function):void {
             var oauthPanel:OAuthPanel = OAuthPanel(
-                PopUpManager.createPopUp(Application(Application.application), OAuthPanel, true));
+                PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), OAuthPanel, true));
             PopUpManager.centerPopUp(oauthPanel);
                        oauthPanel.setConnection(_connection);
             
@@ -50,7 +51,7 @@ package net.systemeD.potlatch2.save {
         
         private function saveData():void {
             var saveDialog:SaveDialog = SaveDialog(
-                PopUpManager.createPopUp(Application(Application.application), SaveDialog, true));
+                PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), SaveDialog, true));
                        saveDialog.setConnection(_connection);
             PopUpManager.centerPopUp(saveDialog);
 
index c264cd4..dc11f28 100644 (file)
@@ -1,22 +1,28 @@
-<?xml version="1.0"?>\r
-\r
-<flex-config>\r
-   <compiler>\r
+<?xml version="1.0"?>
+
+<flex-config>
+   <compiler>
       <fonts>
-          <managers>\r
-              <manager-class>flash.fonts.AFEFontManager</manager-class>\r
-          </managers>\r
+          <managers>
+              <manager-class>flash.fonts.AFEFontManager</manager-class>
+          </managers>
       </fonts>
       
       <library-path append="true">
           <path-element>lib</path-element>
-      </library-path>\r
-   </compiler>\r
+      </library-path>
+
+      <theme>
+        <filename>${flexlib}/themes/Halo/halo.swc</filename>
+      </theme>
+   </compiler>
+
+   <metadata>
+      <title>Potlatch 2</title>
+      <description>http://wiki.openstreetmap.org/wiki/Potlatch2</description>
+   </metadata>
+
 
-   <metadata>\r
-      <title>Potlatch 2</title>\r
-      <description>http://wiki.openstreetmap.org/wiki/Potlatch2</description>\r
-   </metadata>\r
 
-   <output>resources/potlatch2.swf</output>\r
-</flex-config>\r
+   <output>resources/potlatch2.swf</output>
+</flex-config>
index 0c3e996..edf3a33 100644 (file)
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
-<mx:Application 
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+<mx:Application
+    xmlns:fx="http://ns.adobe.com/mxml/2009"
+       xmlns:mx="library://ns.adobe.com/flex/mx"
+    xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:halcyon="net.systemeD.halcyon.*"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
        layout="vertical"
        addedToStage="startInit()"
        preloader="net.systemeD.potlatch2.Preloader">
 
-    <map:LocalizationMap xmlns:map="l10n.map.*" />
 
-       <mx:Style source="styles/Application.css"/>
 
-    <mx:Glow id="glowImage" duration="100" 
-        alphaFrom="0.3" alphaTo="1.0" 
-        blurXFrom="0.0" blurXTo="5.0" 
-        blurYFrom="0.0" blurYTo="5.0" 
-        color="0xFF8000"/>
-    <mx:Glow id="unglowImage" duration="100" 
-        alphaFrom="1.0" alphaTo="0.3" 
-        blurXFrom="5.0" blurXTo="0.0" 
-        blurYFrom="5.0" blurYTo="0.0" 
-        color="0xFF8000"/>
-    <mx:WipeLeft id="wipeOut" duration="250"/>
-    <mx:WipeRight id="wipeIn" duration="250"/>
+       <fx:Style source="styles/Application.css"/>
 
-    <mx:ApplicationControlBar dock="true">
+    <fx:Declarations>
+        <map:LocalizationMap xmlns:map="l10n.map.*" />
+        <mx:Glow id="glowImage" duration="100"
+            alphaFrom="0.3" alphaTo="1.0"
+            blurXFrom="0.0" blurXTo="5.0"
+            blurYFrom="0.0" blurYTo="5.0"
+            color="0xFF8000"/>
+        <mx:Glow id="unglowImage" duration="100"
+            alphaFrom="1.0" alphaTo="0.3"
+            blurXFrom="5.0" blurXTo="0.0"
+            blurYFrom="5.0" blurYTo="0.0"
+            color="0xFF8000"/>
+        <mx:WipeLeft id="wipeOut" duration="250"/>
+        <mx:WipeRight id="wipeIn" duration="250"/>
+    </fx:Declarations>
+
+    <mx:ApplicationControlBar id="controlbar" dock="true">
+        <mx:Button label="Save" icon="@Embed('embedded/upload.svg')" disabledIcon="@Embed('embedded/upload_disabled.svg')" styleName="appBarButton"
+                       click="SaveManager.saveChanges(theMap.editableLayer.connection);" id="saveButton" enabled="false"/>
+        <mx:Button id="helpButton" label="Help" click="new HelpDialog().init();" styleName="appBarButton" />
+        <mx:Spacer width="40"/>
+        <mx:Button id="undo" label="Undo" click="MainUndoStack.getGlobalStack().undo();" styleName="appBarButton"
+            enabled="{MainUndoStack.getGlobalStack().canUndo()}"
+            toolTip="{MainUndoStack.getGlobalStack().getUndoDescription() ? 'Undo '+MainUndoStack.getGlobalStack().getUndoDescription() : 'Undo last action'}" />
+        <mx:Button id="redo" label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
+            enabled="{MainUndoStack.getGlobalStack().canRedo()}"
+            toolTip="{MainUndoStack.getGlobalStack().getRedoDescription() ? 'Redo '+MainUndoStack.getGlobalStack().getRedoDescription() : 'Redo last action'}" />
+        <mx:Spacer width="100%"/>
         <mx:PopUpButton id="bgButton" label="Background" openAlways="true" styleName="appBarButton"
             creationComplete="bgButton.popUp = new BackgroundSelector();"/>
         <mx:PopUpButton id="styleButton" label="Map Style" openAlways="true" styleName="appBarButton"
                                                     mx.controls.Menu(gpsButton.popUp).selectedIndex=0; /* Yes, we do need to call it twice */
                                                     theMap.removeLayerByName('GPS tracks'); }">
                        <mx:dataProvider>
-                               <mx:Array>
-                                       <mx:Object label="GPS data" id="gpsData" />
-                                       <mx:Object label="My tracks" id="myTracks" />
-                                       <mx:Object label="Clear" id="clearGps" />
-                               </mx:Array>
+                               <fx:Array>
+                                       <fx:Object label="GPS data" id="gpsData" />
+                                       <fx:Object label="My tracks" id="myTracks" />
+                                       <fx:Object label="Clear" id="clearGps" />
+                               </fx:Array>
                        </mx:dataProvider>
                </mx:PopUpMenuButton>
-        <mx:Spacer width="100%"/>
-        <mx:Button id="undo" label="Undo" click="MainUndoStack.getGlobalStack().undo();" styleName="appBarButton"
-            enabled="{MainUndoStack.getGlobalStack().canUndo()}"
-            toolTip="{MainUndoStack.getGlobalStack().getUndoDescription() ? 'Undo '+MainUndoStack.getGlobalStack().getUndoDescription() : 'Undo last action'}" />
-        <mx:Button id="redo" label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
-            enabled="{MainUndoStack.getGlobalStack().canRedo()}"
-            toolTip="{MainUndoStack.getGlobalStack().getRedoDescription() ? 'Redo '+MainUndoStack.getGlobalStack().getRedoDescription() : 'Redo last action'}" />
-        <mx:Spacer width="100%"/>
-        <mx:Button id="helpButton" label="Help" click="new HelpDialog().init();" styleName="appBarButton" />
         <mx:Button id="optionsButton" label="Options" click="new OptionsDialog().init();" styleName="appBarButton" />
-        <mx:Button label="Save" icon="@Embed('embedded/upload.svg')" disabledIcon="@Embed('embedded/upload_disabled.svg')" styleName="appBarButton"
-                       click="SaveManager.saveChanges(theMap.editableLayer.connection);" id="saveButton" enabled="false"/>
     </mx:ApplicationControlBar>
     
     <mx:HDividedBox width="100%" height="100%">
@@ -85,7 +90,7 @@
 
     </mx:HDividedBox>
 
-       <mx:Script><![CDATA[
+       <fx:Script><![CDATA[
                import net.systemeD.halcyon.*;
                import net.systemeD.halcyon.connection.*;
                import net.systemeD.potlatch2.*;
                import mx.core.IChildList;
         import mx.containers.Canvas;
                import mx.core.Application;
+               import mx.core.FlexGlobals;
         import mx.events.DragEvent;
         import mx.events.CloseEvent;
         import mx.managers.DragManager;
             if (loaderInfo.parameters['locale']) {
               dispatchEvent(new LocaleEvent(LocaleEvent.LOAD_LOCALE,loaderInfo.parameters['locale']));
             }
-
-                       // Load font and don't do anything until that's done
                        var loader:Loader = new Loader();
-                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, continueInit);
+                       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, startApp);
                        loader.load(new URLRequest("FontLibrary.swf"));
                }
                
-               private function continueInit(r:Event):void {
+               private function startApp(event:Event):void {
+                       controlbar.setStyle('dropShadowEnabled',"false");       // Flex 4 doesn't permit this in Application.css
+
                        // Set font
-                       var FontLibrary:Class = r.target.applicationDomain.getDefinition("FontLibrary") as Class;
+                       var FontLibrary:Class = event.target.applicationDomain.getDefinition("FontLibrary") as Class;
                        Font.registerFont(FontLibrary.DejaVu);
 
                        Globals.vars.map_area = map_area;
                        if (entity is Relation) {
                                // If it's a relation, just bring up the editor panel
                                var panel:RelationEditorPanel = RelationEditorPanel(
-                                       PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
+                                       PopUpManager.createPopUp(Application(FlexGlobals.topLevelApplication), RelationEditorPanel, true));
                                panel.setRelation(entity as Relation);
                                PopUpManager.centerPopUp(panel);
                                return;
         }
 
         private function loadTrace(id:Number):void {
-            var conn:Connection = theMap.editableLayer.connection;
-            conn.addEventListener(Connection.TRACES_LOADED, function (e:Event):void {
-                for each (var trace:Trace in conn.getTraces()) {
-                    if (trace.id == id) { trace.addToMap(); }
-                }
-            });
-            conn.fetchUserTraces();
+                       var conn:Connection = theMap.editableLayer.connection;
+                       conn.addEventListener(Connection.TRACES_LOADED, function (e:Event):void {
+                               var t:Trace = conn.findTrace(id);
+                               if (!t) { t=new Trace(conn,id); conn.addTrace(t); }
+                               t.addToMap();
+                               conn.removeEventListener(Connection.TRACES_LOADED, arguments.callee);
+                       });
+                       conn.fetchUserTraces();
         }
 
-       ]]></mx:Script>
+       ]]></fx:Script>
 
 </mx:Application>
 
diff --git a/resources/assets/features_pois.zip b/resources/assets/features_pois.zip
new file mode 100644 (file)
index 0000000..7d98cad
Binary files /dev/null and b/resources/assets/features_pois.zip differ
diff --git a/resources/assets/icons.zip b/resources/assets/icons.zip
new file mode 100644 (file)
index 0000000..f3e5a5d
Binary files /dev/null and b/resources/assets/icons.zip differ
diff --git a/resources/features/route__mtb.png b/resources/features/route__mtb.png
new file mode 100644 (file)
index 0000000..8243607
Binary files /dev/null and b/resources/features/route__mtb.png differ
index eaf416a..b6722e5 100644 (file)
                <url>http://cube.telascience.org/tilecache/tilecache.py/1.0.0/NAIP_ALL/$z/$x/$y.png</url>
                <sourcetag>NAIP</sourcetag>
        </set>
-    <set minlat="54.44" minlon="7.81" maxlat="57.86" maxlon="15.49">
-        <name>Denmark - Fugro Aerial Imagery</name>
-        <url>http://fugro.findvej.dk/fugro2005/$z/$x/$y.jpg</url>
-        <sourcetag>Fugro (2005)</sourcetag>
+       <set minlat="54.44" minlon="7.81" maxlat="57.86" maxlon="15.49">
+               <name>Denmark - Fugro Aerial Imagery</name>
+               <url>http://tile.openstreetmap.dk/fugro2005/$z/$x/$y.jpg</url>
+               <sourcetag>Fugro (2005)</sourcetag>
+       </set>
+       <set minlat="55.23403" minlon="12.09144" maxlat="55.43647" maxlon="12.47712">
+               <name>Denmark - Stevns Kommune</name>
+               <url>http://tile.openstreetmap.dk/stevns/2009/$z/$x/$y.jpg</url>
+               <sourcetag>Stevns Kommune (2009)</sourcetag>
     </set>
+       <set minlat="46.33" minlon="9.36" maxlat="49.09" maxlon="17.28">
+               <name>Austria - geoimage.at</name>
+               <url>http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/$z/$x/$y.jpg</url>
+               <sourcetag>geoimage.at</sourcetag>
+       </set>
+       <set minlon="19.02" minlat="40.96" maxlon="77.34" maxlat="70.48">
+               <name>Russia - Kosmosnimki.ru IRS Satellite</name>
+               <url>http://irs.gis-lab.info/?layers=irs&request=GetTile&z=$z&x=$x&y=$y</url>
+               <sourcetag>Kosmosnimki.ru IRS</sourcetag>
+       </set>
+       <set minlon="23.16" minlat="51.25" maxlon="32.83" maxlat="56.19">
+               <name>Belarus - Kosmosnimki.ru SPOT4 Satellite</name>
+               <url>http://irs.gis-lab.info/?layers=spot&request=GetTile&z=$z&x=$x&y=$y</url>
+               <sourcetag>Kosmosnimki.ru SPOT4</sourcetag>
+       </set>
 </imagery>
index 93d7209..f095821 100644 (file)
@@ -1,53 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-Quick documentation:
-
-<category> the categories that features belong to. This includes both nodes (icons on left) and ways/areas (drop-down list that appears when a way/area is selected)
-  name: Shown in GUI
-  id: internal reference (a feature refers to this with category=xxx)
-
-<feature> a pre-defined group of tags that make up a feature
-  category: [ctext] corresponding to category id
-  icon
-    @image: path to .png file
-    @dnd: path to optional dnd-specific-override .png file
-    @background: colour spec
-    @foreground: colour spec
-    (general html goes here?) Variables substituted with ${ref}
-  help: [ctext] URL, shown as a linked ? icon. Should (?) usually be an OSM wiki page.
-  description: Not currently used?
-  line/point/area: any or all of these are allowed. Determines whether this feature is shown in the corresponding situations. None is equivalent to all three.
-  tag - one or more of these required, defines the tags that make up the feature.
-    @k - key
-    @v - value
-  input
-    @ref=xxx
-  inputSet
-    @ref=xxx
-</feature>
-
-<inputSet>: a reusable group of properties for a feature.
-  @id="internal id"
-  input...
-</inputSet>
-
-<input>
-  @type: choice/freetext/turn/checkbox/slider/route/speed/number - the different types of supported input dialogs.
-  @presence: always/onTagMatch/withCategory - Whether it always appears on the basic page, appears only when the tag is already set, or only ever show on the category page.
-  @category: which tab it appears on
-  @description: mouse-over text
-  @name: The text shown as the label of the property
-  @key: The actual OSM key (tag) that will be saved
-  @priority: highest/high/normal/low/lowest (default=>normal) - controls the order that different features show up in a panel.
-  match: for turn|route inputs, the tags to be considered on the relation as indicating a match.
-    @k: key
-    @v: value
-  icon: see above
-</input>
-
-<include
-  @file="map_features/roads.xml": external file to drop into place here. Include files behave exactly as if written out in full.
-/>
+       See http://wiki.openstreetmap.org/wiki/Potlatch_2/Developer_Documentation/Map_Features for documentation.
+       Files can be included like this: <include file="map_features/roads.xml">
 -->
 
 <mapFeatures>
@@ -85,13 +39,20 @@ Quick documentation:
     <input type="freetext" presence="always" name="Reference number" key="ref" description="A reference number or code used to identify this thing." />
   </inputSet>
 
+   <inputSet id="simpleBrand"> 
+     <input type="freetext" category="Naming" presence="always" name="Brand" key="brand" description="Brand, i.e. Acme"/> 
+   </inputSet> 
+  
+   <inputSet id="simpleOperator"> 
+     <input type="freetext" category="Naming" presence="always" name="Operator" key="operator" description="Operator, i.e. Acme Springfield Ltd"/> 
+   </inputSet> 
 
   <inputSet id="source">
-    <input type="freetext" category="Misc" presence="onTagMatch" name="Source" key="source" description="The primary source of information for this object (GPS, survey, Yahoo, ...)" priority="lowest"/>
+    <input type="freetext" category="Details" presence="onTagMatch" name="Source" key="source" description="The primary source of information for this object (GPS, survey, Yahoo, ...)" priority="lowest"/>
   </inputSet>
 
   <inputSet id="designation">
-    <input type="freetext" category="Misc" presence="onTagMatch" description="Official designation or classification" name="Designation" key="designation"/>
+    <input type="freetext" category="Details" presence="onTagMatch" description="Official designation or classification" name="Designation" key="designation" priority="lowest" />
   </inputSet>
 
   <inputSet id="common">
@@ -101,21 +62,21 @@ Quick documentation:
 
   <inputSet id="names">
     <input type="freetext" presence="always"
-        name="Name" category="Naming" priority="highest"
+        name="Name" category="Details" priority="highest"
         key="name" description="The most common name"/>
     <input type="freetext" presence="onTagMatch"
-        name="International Name" category="Naming"
+        name="International Name" category="Details" subcategory="Additional names"
         key="int_name" description="The internationally recognised name"/>
     <input type="freetext" presence="onTagMatch"
-        name="Historical Name" category="Naming" priority="low"
+        name="Historical Name" category="Details" subcategory="Additional names" priority="low"
         key="old_name" description="The historic or previous name"/>
     <input type="freetext" presence="onTagMatch"
-        name="Alternative Name" category="Naming" priority="low"
+        name="Alternative Name" category="Details" subcategory="Additional names" priority="low"
         key="alt_name" description="An alternative, currently used, name"/>
   </inputSet>
 
   <inputSet id="wifi">
-    <input type="choice" presence="onTagMatch" category="Eating" name="Wifi" key="wifi">
+    <input type="choice" presence="onTagMatch" category="Details" name="Wifi" key="wifi">
       <choice value="free" text="Free"/>
       <choice value="yes" text="Yes"/>
       <choice value="no" text="No"/>
@@ -130,11 +91,11 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="web">
-    <input type="freetext" presence="onTagMatch" category="Web" description="The URL of the website" name="Website" key="website"/>
+    <input type="freetext" presence="onTagMatch" category="Address" description="The URL of the website" name="Website" key="website"/>
   </inputSet>
 
   <inputSet id="cuisine">
-    <input type="choice" presence="always" name="Cuisine" category="Eating" description="The type of food that they serve" key="cuisine">
+    <input type="choice" presence="always" name="Cuisine" category="Details" description="The type of food that they serve" key="cuisine">
       <!-- The 30 most popular values according to taginfo 23/12/2010 -->
       <choice value="burger" text="Burger"/>
       <choice value="chicken" text="Chicken"/>
@@ -216,22 +177,22 @@ Quick documentation:
 
   <inputSet id="roadRefs">
     <input type="freetext" presence="always"
-        name="Reference" category="Naming" priority="high"
+        name="Reference" category="Details" priority="high"
         key="ref" description="The official reference number"/>
     <input type="freetext" presence="onTagMatch"
-        name="International Reference" category="Naming"
+        name="International Reference" category="Details" subcategory="Additional names" 
         key="int_ref" description="The official international reference number"/>
     <input type="freetext" presence="onTagMatch"
-        name="Old Reference" category="Naming" priority="low"
+        name="Old Reference" category="Details" subcategory="Additional names" priority="low"
         key="old_ref" description="The historic or previous reference number"/>
   </inputSet>
 
   <inputSet id="roadPhysical">
     <input type="freetext" presence="onTagMatch"
-        name="Width" category="Physical"
+        name="Width" category="Details" subcategory="Physical" 
         key="width" description="Width of the road" layout="horizontal"/>
     <input type="choice" presence="onTagMatch"
-        name="Surface" category="Physical" description="Type of road surface"
+        name="Surface" category="Details" description="Type of road surface"
         key="surface" layout="horizontal">
       <choice value="unpaved" text="Unpaved" description="Road surface is unsealed"/>
       <choice value="paved" text="Paved" description="Road surface is sealed"/>
@@ -248,31 +209,31 @@ Quick documentation:
     <inputSet ref="tunnel"/>
     <inputSet ref="embankment-cutting"/>
     <!-- not sure which category best suits put area=yes -->
-    <input type="checkbox" presence="onTagMatch" category="Restrictions" key="area" name="Open area" description="The way is a large open space, like at a dock, where vehicles can move anywhere within the space, rather than just along the edge." />
+    <input type="checkbox" presence="onTagMatch" category="Details" subcategory="Physical" key="area" name="Open area" description="The way is a large open space, like at a dock, where vehicles can move anywhere within the space, rather than just along the edge." />
   </inputSet>
 
   <inputSet id="roadLanes">
-    <input presence="onTagMatch" type="number" name="Lanes" category="Physical" description="Total number of lanes, counting both directions"
+    <input presence="onTagMatch" type="number" name="Lanes" category="Details" description="Total number of lanes, counting both directions"
            key="lanes" minimum="1" maximum="10" layout="horizontal"/>
   </inputSet>
 
   <inputSet id="bridge">
     <input type="choice" presence="onTagMatch"
-        name="Bridge" category="Physical" description="Road goes over a bridge"
+        name="Bridge" category="Details" description="Road goes over a bridge"
         key="bridge" layout="horizontal">
       <choice value="yes" text="Generic Bridge" description="Generic bridge -- type unknown"/>
       <choice value="viaduct" text="Viaduct" description="Viaduct"/>
       <choice value="suspension" text="Suspension bridge"/>
     </input>
     <input type="slider" presence="onTagMatch"
-        name="Layer" category="Physical" description="Relative vertical positions (-5 lowest, +5 highest)"
+        name="Layer" category="Details" description="Relative vertical positions (-5 lowest, +5 highest)"
         key="layer" minimum="-5" maximum="5" default="0" snapInterval="1" labels="Lowest,Ground,Highest"
         defaultName="Ground"/>
   </inputSet>
   <inputSet id="tunnel">
     <!-- Not ideal, used for non-roads too. -->  
     <input type="choice" presence="onTagMatch"
-        name="Tunnel" category="Physical" description="Road goes into a tunnel"
+        name="Tunnel" category="Details" subcategory="Physical" description="Road goes into a tunnel"
         key="tunnel" layout="horizontal">
       <choice value="yes" text="Tunnel" description="Generic tunnel"/>
     </input>
@@ -280,12 +241,12 @@ Quick documentation:
 
   <inputSet id="embankment-cutting">
     <input type="choice"
-           name="Embankment" category="Physical" description="Road supported on a raised bed of earth and rock."
+           name="Embankment" category="Details" subcategory="Physical" description="Road supported on a raised bed of earth and rock."
            key="embankment" layout="horizontal">
       <choice value="yes" text="Embankment"/>
     </input>
     <input type="choice"
-           name="Cutting" category="Physical" description="Road carved out of hill on one or both sides."
+           name="Cutting" category="Details" subcategory="Physical" description="Road carved out of hill on one or both sides."
            key="cutting" layout="horizontal">
       <choice value="yes" text="Cutting"/>
     </input>
@@ -293,12 +254,14 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="rail-electrification">
-    <input type="choice" name="Electrified" category="Electrification" description="Is the track electrified (whether by 3rd rail, overhead wires, etc)?"
+    <input type="choice" name="Electrified" category="Details" subcategory="Electrification" description="Is the track electrified (whether by 3rd rail, overhead wires, etc)?"
            key="electrified">
       <choice value="yes" text="Yes"/>
+      <choice value="contact_line" text="Overhead line"/>
+      <choice value="rail" text="Third rail"/>
       <choice value="no" text="No"/>
     </input>
-    <input type="choice" name="Voltage" category="Electrification" description="Nominal voltage of electric wires"
+    <input type="choice" name="Voltage" category="Details" subcategory="Electrification" description="Nominal voltage of electric wires"
            key="voltage" presence="withCategory">
       <choice value="600" text="600V"/>
       <choice value="750" text="750V"/>
@@ -307,7 +270,7 @@ Quick documentation:
       <choice value="15000" text="15kV"/>
       <choice value="25000" text="25kV"/>
     </input>
-    <input type="choice" name="Frequency" category="Electrification" description="Frequency in Hertz of alternating current power supply"
+    <input type="choice" name="Frequency" category="Details" subcategory="Electrification" description="Frequency in Hertz of alternating current power supply"
            key="frequency" presence="withCategory">
       <choice value="0" text="DC"/>
       <choice value="16.67" text="16.67 Hz"/>
@@ -318,16 +281,6 @@ Quick documentation:
     </input>
   </inputSet>
 
-  <inputSet id="rail-usage">
-    <input type="choice" name="Usage" category="Usage" description="Main use of the line" key="usage">
-      <choice value="main" text="Main line" description="The principal artery of a rail system."/>
-      <choice value="branch" text="Branch line" description="A secondary line, branching off a main line."/>
-      <choice value="industrial" text="Industrial"/>
-      <choice value="tourism" text="Tourism" />
-      <choice value="military" text="Military"/>
-    </input>
-  </inputSet>
-
   <inputSet id="fee">
     <input type="freetext" presence="onTagMatch" category="Restrictions" description="The charge/cost of using this amenity" name="Fee" key="fee"/>
   </inputSet>
@@ -364,7 +317,7 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="pedestrians">
-    <input type="choice" name="Pedestrians" description="Can pedestrians use this road, including footpaths if any?" category="Walking" key="foot">
+    <input type="choice" name="Pedestrians" description="Can pedestrians use this road, including footpaths if any?" category="Walk" key="foot">
       <choice value="yes" text="Allowed"/>
       <choice value="no" text="Prohibited"/>
       <choice value="designated" text="Designated"/>
@@ -372,8 +325,8 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="naptan">
-    <input type="freetext" presence="onTagMatch" category="Naptan" description="12 character internal Naptan ID" name="Atco Code" key="naptan:AtcoCode"/>
-    <input type="choice" presence="onTagMatch" category="Naptan" description="The eight-point compass bearning" name="Naptan Bearing" key="naptan:Bearing" >
+    <input type="freetext" presence="onTagMatch" category="Transport" description="12 character internal Naptan ID" name="Atco Code" key="naptan:AtcoCode"/>
+    <input type="choice" presence="onTagMatch" category="Transport" description="The eight-point compass bearning" name="Naptan Bearing" key="naptan:Bearing" >
       <choice value="N"  match="N"  text="N"  description=""/>
       <choice value="NE" match="NE" text="NE" description=""/>
       <choice value="E"  match="E"  text="E"  description=""/>
@@ -383,15 +336,15 @@ Quick documentation:
       <choice value="W"  match="W"  text="W"  description=""/>
       <choice value="NW" match="NW" text="NW" description=""/>
     </input>
-    <input type="freetext" presence="onTagMatch" category="Naptan" description="The naptan common name" name="Naptan Common Name (read-only)" key="naptan:CommonName"/>
-    <input type="freetext" presence="onTagMatch" category="Naptan" description="" name="Naptan Indicator (read-only)" key="naptan:Indicator"/>
-    <input type="freetext" presence="onTagMatch" category="Naptan" description="" name="Naptan Street (read-only)" key="naptan:Street"/>
-    <input type="freetext" presence="onTagMatch" category="Naptan" description="Delete this when the details have been verified on-the-ground" name="Naptan Verified?" key="naptan:verified"/>
+    <input type="freetext" presence="onTagMatch" category="Transport" description="The naptan common name" name="Naptan Common Name (read-only)" key="naptan:CommonName"/>
+    <input type="freetext" presence="onTagMatch" category="Transport" description="" name="Naptan Indicator (read-only)" key="naptan:Indicator"/>
+    <input type="freetext" presence="onTagMatch" category="Transport" description="" name="Naptan Street (read-only)" key="naptan:Street"/>
+    <input type="freetext" presence="onTagMatch" category="Transport" description="Delete this when the details have been verified on-the-ground" name="Naptan Verified?" key="naptan:verified"/>
   </inputSet>
 
   <inputSet id="buses">
-    <input type="freetext" presence="always" category="Bus Stop" name="Stop Name" key="name" description="The name of the bus stop"/>
-    <input type="freetext" presence="always" category="Bus Stop" name="Local Ref" key="local_ref" description="The local reference of the stop, usually one or two letters above the main flag, used at bus interchanges, e.g. L, BX"/>
+    <input type="freetext" presence="always" category="Transport" name="Stop Name" key="name" description="The name of the bus stop"/>
+    <input type="freetext" presence="always" category="Transport" name="Local Ref" key="local_ref" description="The local reference of the stop, usually one or two letters above the main flag, used at bus interchanges, e.g. L, BX"/>
     <inputSet ref="naptan"/>
   </inputSet>
 
@@ -444,6 +397,14 @@ Quick documentation:
         <font size="12pt">${name}</font>
       </icon>
     </input>
+    <input type="route" name="Mountain bike route" description="A signposted route for mountain biking." category="Cycle" priority="lowest">
+      <match k="type" v="route"/>
+      <match k="route" v="mtb"/>
+      <icon image="features/route__mtb.png" background="#9f4404" foreground="white">
+        <font size="14pt"><b>${ref}</b></font><br/>
+        <font size="12pt">${name}</font>
+      </icon>
+    </input>
   </inputSet>
 
   <inputSet id="bicycle-permission">
@@ -474,7 +435,7 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="ldp">
-    <input type="route" name="National Walking Route" description="National walking route" category="Walking" priority="normal">
+    <input type="route" name="National Walking Route" description="National walking route" category="Walk" priority="normal">
       <match k="type" v="route"/>
       <match k="route" v="hiking|foot"/>
       <match k="network" v="nwn"/>
@@ -483,7 +444,7 @@ Quick documentation:
         <font size="12pt">${name}</font>
       </icon>
     </input>
-    <input type="route" name="Regional Walking Route" description="Regional walking route" category="Walking" priority="low">
+    <input type="route" name="Regional Walking Route" description="Regional walking route" category="Walk" priority="low">
       <match k="type" v="route"/>
       <match k="route" v="hiking|foot"/>
       <match k="network" v="rwn"/>
@@ -492,7 +453,7 @@ Quick documentation:
         <font size="12pt">${name}</font>
       </icon>
     </input>
-    <input type="route" name="Local Walking Route" description="Local walking route" category="Walking" priority="lowest">
+    <input type="route" name="Local Walking Route" description="Local walking route" category="Walk" priority="lowest">
       <match k="type" v="route"/>
       <match k="route" v="hiking|foot"/>
       <match k="network" v="lwn"/>
@@ -516,7 +477,7 @@ Quick documentation:
 <!-- Would be good to have a dedicated 'access' type of input -->
   <!-- all the description fields are identical at the moment for ease of maintenance, should be tailored in future. -->
   <inputSet id="boatPermissions">
-    <input type="choice" name="Boat permission" category="Permission" key="boat" description="Are boats allowed to use this waterway?">
+    <input type="choice" name="Boat permission" category="Restrictions" key="boat" description="Are boats allowed to use this waterway?">
       <choice value="yes" text="Allowed" description="General right of way."/>
       <choice value="no" text="Prohibited" description="No access to the public."/>
       <choice value="permissive" text="Permissive" description="Access permitted through private land."/>
@@ -526,7 +487,7 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="permissions">
-    <input type="choice" name="General access" category="Permission" key="access" description="Is there a general right of access, regardless of mode of transport?">
+    <input type="choice" name="General access" category="Restrictions" key="access" description="Is there a general right of access, regardless of mode of transport?">
       <choice value="yes" text="Allowed" description="General right of way."/>
       <choice value="no" text="Prohibited" description="No access to the public."/>
       <choice value="permissive" text="Permissive" description="Access permitted through private land."/>
@@ -534,7 +495,7 @@ Quick documentation:
       <choice value="designated" text="Designated" description="Permitted, according to signs or specific local laws."/>
     </input>
 
-    <input type="choice" name="Motor vehicles" category="Permission" key="motor_vehicle" description="Are cars and other private vehicles allowed?">
+    <input type="choice" name="Motor vehicles" category="Restrictions" key="motor_vehicle" description="Are cars and other private vehicles allowed?">
       <choice value="yes" text="Allowed" description="General right of way."/>
       <choice value="no" text="Prohibited" description="No access to the public."/>
       <choice value="permissive" text="Permissive" description="Access permitted through private land."/>
@@ -542,7 +503,7 @@ Quick documentation:
       <choice value="designated" text="Designated" description="Permitted, according to signs or specific local laws."/>
     </input>
 
-    <input type="choice" name="Horses" category="Permission" key="horse" description="Are cars and other private vehicles allowed?">
+    <input type="choice" name="Horses" category="Restrictions" key="horse" description="Are cars and other private vehicles allowed?">
       <choice value="yes" text="Allowed" description="General right of way."/>
       <choice value="no" text="Prohibited" description="No access to the public."/>
       <choice value="permissive" text="Permissive" description="Access permitted through private land."/>
@@ -571,11 +532,11 @@ Quick documentation:
   </inputSet>
 
   <inputSet id="isBuilding">
-    <input type="checkbox" presence="onTagMatch" category="Misc" description="Does this thing also represent one, solid building?" name="Building" key="building"/>
+    <input type="checkbox" presence="onTagMatch" category="Details" description="Does this thing also represent one, solid building?" name="Building" key="building"/>
   </inputSet>
 
   <inputSet id="powerCables">
-    <input type="choice" name="Cables" key="cables" presence="always" category="Power">
+    <input type="choice" name="Cables" key="cables" presence="always" category="Details">
       <choice value="2" text="2"/>
       <choice value="3" text="3"/>
       <choice value="4" text="4"/>
@@ -584,7 +545,7 @@ Quick documentation:
       <choice value="10" text="10"/>
       <choice value="12" text="12"/>
     </input>
-    <input type="choice" name="Voltage" key="voltage" presence="always" category="Power">
+    <input type="choice" name="Voltage" key="voltage" presence="always" category="Details">
       <!-- choices based on http://osmdoc.com/en/tag/voltage/#values-->
       <choice value="400" text="400 V"/>
       <choice value="600" text="600 V"/>
@@ -602,6 +563,81 @@ Quick documentation:
     </input>
   </inputSet>
 
+  <inputSet id="pitchSport">
+    <input name="Sport" presence="always" category="Sport" key="sport" type="choice" description="The sport that is predominantly played here.">
+      <choice value="9pin" text="9 pin bowling"/>
+      <choice value="10pin" text="10 pin bowling"/>
+      <choice value="american_football" text="American football"/>
+      <choice value="archery" text="Archery"/>
+      <choice value="athletics" text="Athletics"/>
+      <choice value="australian_football" text="Australian Rules Football"/>
+      <choice value="baseball" text="Baseball"/>
+      <choice value="basketball" text="Basketball"/>
+      <choice value="beachvolleyball" text="Beach volleyball"/>
+      <choice value="boules" text="Boules/petanque/bocci"/>
+      <choice value="bowls" text="Lawn bowls"/>
+      <choice value="canadian_football" text="Canadian football"/>
+      <choice value="chess" text="Chess"/>
+      <choice value="cricket" text="Cricket"/>
+      <choice value="cricket_nets" text="Cricket nets"/>
+      <choice value="croquet" text="Croquet"/>
+      <choice value="equestrian" text="Equestrian"/>
+      <choice value="gaelic_football" text="Gaelic football"/>
+      <choice value="gymnastics" text="Gymnastics"/>
+      <choice value="team_handball" text="(Team) handball"/>
+      <choice value="hockey" text="(Field) hockey"/>
+      <choice value="korfball" text="Korfball"/>
+      <choice value="pelota" text="Pelota"/>
+      <choice value="rugby_league" text="Rugby league"/>
+      <choice value="rugby_union" text="Rugby union"/>
+      <choice value="shooting" text="Shooting"/>
+      <choice value="skating" text="Ice skating"/>
+      <choice value="skateboard" text="Skateboarding"/>
+      <choice value="soccer" text="Soccer/football"/>
+      <choice value="swimming" text="Swimming"/>
+      <choice value="table_tennis" text="Table tennis"/>
+      <choice value="tennis" text="Tennis"/>
+      <choice value="volleyball" text="Volleyball"/>
+    </input>
+  </inputSet>
+
+  <inputSet id="pitchSport">
+    <input name="Sport" presence="always" category="Details" key="sport" type="choice" description="The sport that is predominantly played here.">
+      <choice value="9pin" text="9 pin bowling"/>
+      <choice value="10pin" text="10 pin bowling"/>
+      <choice value="american_football" text="American football"/>
+      <choice value="archery" text="Archery"/>
+      <choice value="athletics" text="Athletics"/>
+      <choice value="australian_football" text="Australian Rules Football"/>
+      <choice value="baseball" text="Baseball"/>
+      <choice value="basketball" text="Basketball"/>
+      <choice value="beachvolleyball" text="Beach volleyball"/>
+      <choice value="boules" text="Boules/petanque/bocci"/>
+      <choice value="bowls" text="Lawn bowls"/>
+      <choice value="canadian_football" text="Canadian football"/>
+      <choice value="chess" text="Chess"/>
+      <choice value="cricket" text="Cricket"/>
+      <choice value="cricket_nets" text="Cricket nets"/>
+      <choice value="croquet" text="Croquet"/>
+      <choice value="equestrian" text="Equestrian"/>
+      <choice value="gaelic_football" text="Gaelic football"/>
+      <choice value="gymnastics" text="Gymnastics"/>
+      <choice value="team_handball" text="(Team) handball"/>
+      <choice value="hockey" text="(Field) hockey"/>
+      <choice value="korfball" text="Korball"/>
+      <choice value="pelota" text="Pelota"/>
+      <choice value="rugby_league" text="Rugby league"/>
+      <choice value="rugby_union" text="Rugby union"/>
+      <choice value="shooting" text="Shooting"/>
+      <choice value="skating" text="Ice skating"/>
+      <choice value="skateboard" text="Skateboarding"/>
+      <choice value="soccer" text="Soccer/football"/>
+      <choice value="swimming" text="Swimming"/>
+      <choice value="table_tennis" text="Table tennis"/>
+      <choice value="tennis" text="Tennis"/>
+      <choice value="volleyball" text="Volleyball"/>
+    </input>
+  </inputSet>
 
 <!-- Features -->
 
index 1ca1ddd..0f249f5 100644 (file)
-<featureGroup>\r
-  <!-- =========== Amenity ============ -->\r
-\r
-  <feature name="Fire station">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_firestation2.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dfire_station</help>\r
-    <point/>\r
-    <tag k="amenity" v="fire_station"/>\r
-    <inputSet ref="simpleName" />\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Police Station">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_police2.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dpolice</help>\r
-    <point/>\r
-    <area/>\r
-    <tag k="amenity" v="police"/>\r
-    <inputSet ref="simpleName"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Library">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_library.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dlibrary</help>\r
-    <point/>\r
-    <area/>\r
-    <tag k="amenity" v="library"/>\r
-    <inputSet ref="simpleName"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Hospital">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/health_hospital.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dhospital</help>\r
-    <point/>\r
-    <area/>\r
-    <tag k="amenity" v="hospital"/>\r
-    <inputSet ref="simpleName"/>\r
-    <input type="choice" presence="always" category="Hospital" name="Emergency treatment available" key="emergency" description="Are there accident and emergency facilities at this hospital?">\r
-      <choice value="yes" text="Yes"/>\r
-      <choice value="no" text="No"/>\r
-    </input>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Place of Worship">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/place_of_worship_unknown.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dplace_of_worship</help>\r
-    <point/>\r
-    <tag k="amenity" v="place_of_worship"/>\r
-    <inputSet ref="simpleName" />\r
-    <input type="choice" presence="always" category="" name="Religion" key="religion" description="The religion worshipped here.">\r
-      <choice value="christian" text="Christianity (church)"/>\r
-      <choice value="jewish" text="Judaism (synagogue)"/>\r
-      <choice value="muslim" text="Islam (mosque)"/>\r
-      <choice value="hindu" text="Hinduism (temple)"/>\r
-      <choice value="buddhist" text="Buddhism (temple)"/>\r
-      <choice value="sikh" text="Sikhism (gurdwara)"/>\r
-      <choice value="shinto" text="Shinto (shrine)"/>\r
-    </input>\r
-\r
-    <input type="freetext" presence="always" category="" name="denomination" key="denomination" description="The denomination of the religion worshiped here." priority="low"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="ATM">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/money_atm.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Atm</help>\r
-    <point/>\r
-    <tag k="amenity" v="atm"/>\r
-    <input type="freetext" presence="always" category="Banking" name="Operator" key="operator" description="The organisation that provides this ATM" priority="low"/>\r
-    <input type="freetext" presence="always" category="Banking" name="Fee" key="fee" description="Is there a charge for using this ATM? If so how much?"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Bank">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/money_bank2.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dbank</help>\r
-    <point/>\r
-    <tag k="amenity" v="bank"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <input type="choice" presence="always" category="Bank" name="Public ATM available" key="atm" description="Is there a public ATM available?">\r
-      <choice value="yes" text="Yes"/>\r
-      <choice value="no" text="No"/>\r
-    </input>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Recycling">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_recycling.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Drecycling</help>\r
-    <point/>\r
-    <tag k="amenity" v="recycling"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="School">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/education_school.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dschool</help>\r
-    <point/>\r
-    <tag k="amenity" v="school"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Kindergarten">\r
-    <category>amenity</category>\r
-    <category>buildings</category>\r
-    <icon image="features/pois/education_nursery3.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dkindergarten</help>\r
-    <point/>\r
-    <tag k="amenity" v="kindergarten"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Town hall">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_town_hall.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dtownhall</help>\r
-    <point/>\r
-    <tag k="amenity" v="townhall"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Post Box">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_post_box.n.24.png">\r
-      ${ref}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Post_box</help>\r
-    <point/>\r
-    <tag k="amenity" v="post_box"/>\r
-    <input type="freetext" presence="always" category="Naming" name="Ref" key="ref" description="Reference number of the post box"/>\r
-    <input type="freetext" presence="always" category="Naming" name="Operator" key="operator" description="The provider of the postal service" priority="low"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Post Office">\r
-    <category>amenity</category>\r
-    <category>buildings</category>\r
-    <icon image="features/pois/amenity_post_office.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity=post_office</help>\r
-    <point/>\r
-    <area/>\r
-    <tag k="amenity" v="post_office"/>\r
-    <input type="freetext" presence="always" category="Naming" name="Ref" key="ref" description="Reference number of the post office"/>\r
-    <input type="freetext" presence="always" category="Naming" name="Operator" key="operator" description="The provider of the postal service" priority="low"/>\r
-    <inputSet ref="common"/>\r
-    <inputset ref="simpleName"/>\r
-  </feature>\r
-\r
-  <feature name="Trash/rubbish bin">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_waste_bin.n.24.png">\r
-      ${ref}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity=waste_basket</help>\r
-    <point/>\r
-    <tag k="amenity" v="waste_basket"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Toilets">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_toilets.n.24.png">\r
-      ${ref}\r
-    </icon>\r
-    <point/>\r
-    <tag k="amenity" v="toilets"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Water fountain">\r
-    <category>amenity</category>\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/food_drinkingtap.n.24.png">\r
-      ${ref}\r
-    </icon>\r
-    <point/>\r
-    <tag k="amenity" v="drinking_water"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Shelter">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/accommodation_shelter2.n.24.png">\r
-      ${name}\r
-    </icon>    \r
-    <point/>\r
-    <area/>\r
-    <tag k="amenity" v="shelter"/>\r
-    <inputset ref="names"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Barbecue">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/tourist_picnic.n.24.png"/>\r
-    <!-- specific icon needed -->\r
-    <point/>\r
-    <tag k="amenity" v="bbq"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Hunting stand">\r
-    <category>sport</category>\r
-    <icon image="features/pois/sport_shooting.n.24.png"/>\r
-    <point/>\r
-    <tag k="amenity" v="hunting_stand"/>\r
-    <inputSet ref="common"/>\r
-    <inputSet ref="names"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Park bench">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_bench.n.24.png" />\r
-    <point/>\r
-    <tag k="amenity" v="bench"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Public telephone">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_telephone.n.24.png" />\r
-    <point/>\r
-    <tag k="amenity" v="telephone"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Emergency phone">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/emergency-telephone-24.png" />\r
-    <!-- icon from http://www.clker.com/clipart-emergency-telephone-blue.html, feel free to (re)move this notice -->\r
-    <point/>\r
-    <tag k="amenity" v="emergency_phone"/>\r
-    <inputSet ref="common"/>\r
-    <input type="freetext" presence="always" category="Naming" name="Ref" key="ref" description="Reference number of emergency phone."/>    \r
-  </feature>\r
-\r
-\r
-  <feature name="Swimming pool">\r
-    <category>amenity</category>\r
-    <category>sport</category>\r
-    <icon image="features/pois/sport_swimming_outdoor.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <point/>\r
-    <area/>\r
-    <tag k="amenity" v="swimming_pool"/>\r
-    <inputSet ref="simpleName"/>    \r
-    <inputSet ref="common"/>\r
-\r
-  </feature>\r
-\r
-  <feature name="Fountain">\r
-    <category>amenity</category>\r
-    <icon image="features/pois/amenity_fountain2.n.24.png">\r
-    ${name}\r
-    </icon>\r
-    <point/>\r
-    <tag k="amenity" v="fountain"/>\r
-    <inputSet ref="common"/>\r
-    <inputSet ref="simpleName"/>\r
-  </feature>\r
-\r
-  <feature name="Vending machine">\r
-    <category>amenity</category>\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/shopping_vending_machine.n.24.png">A vending machine.</icon>\r
-\r
-    <point/>\r
-    <tag k="amenity" v="vending_machine"/>\r
-    <inputSet ref="common"/>\r
-    <inputSet ref="simpleName"/>\r
-    <input type="freetext" presence="always" name="Product" key="vending" description="What is being sold: tickets, food, maps..."/>\r
-    <input type="operator" presence="always" name="Operator" key="operator" description="Which company provides the service" />\r
-  </feature>\r
-\r
-  <!-- ========= Entertainment ========= -->\r
-\r
-  <feature name="Pub">\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/food_pub.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dpub</help>\r
-    <point/>\r
-    <tag k="amenity" v="pub"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="web"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="wifi"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Bar">\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/food_bar.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <point/>\r
-    <tag k="amenity" v="bar"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="web"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="wifi"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Restaurant">\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/food_restaurant.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <point/>\r
-    <tag k="amenity" v="restaurant"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="web"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="cuisine"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Cafe">\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/food_cafe.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dcafe</help>\r
-    <point/>\r
-    <tag k="amenity" v="cafe"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="web"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="cuisine"/>\r
-    <inputSet ref="wifi"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Fast Food">\r
-    <category>foodanddrink</category>\r
-    <icon image="features/pois/food_fastfood.n.24.png">\r
-      ${name}\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dfast_food</help>\r
-    <point/>\r
-    <tag k="amenity" v="fast_food"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="web"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="cuisine"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
+<featureGroup>
+  <!-- =========== Amenity ============ -->
+
+  <feature name="Fire station">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_firestation2.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dfire_station</help>
+    <point/>
+    <tag k="amenity" v="fire_station"/>
+    <inputSet ref="simpleName" />
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Police Station">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_police2.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dpolice</help>
+    <point/>
+    <area/>
+    <tag k="amenity" v="police"/>
+    <inputSet ref="simpleName"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Library">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_library.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dlibrary</help>
+    <point/>
+    <area/>
+    <tag k="amenity" v="library"/>
+    <inputSet ref="simpleName"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Hospital">
+    <category>amenity</category>
+    <icon image="features/pois/health_hospital.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dhospital</help>
+    <point/>
+    <area/>
+    <tag k="amenity" v="hospital"/>
+    <inputSet ref="simpleName"/>
+    <input type="choice" presence="always" category="Details" name="Emergency treatment available" key="emergency" description="Are there accident and emergency facilities at this hospital?">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Place of Worship">
+    <category>amenity</category>
+    <icon image="features/pois/place_of_worship_unknown.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dplace_of_worship</help>
+    <point/>
+    <tag k="amenity" v="place_of_worship"/>
+    <inputSet ref="simpleName" />
+    <input type="choice" presence="always" category="Details" name="Religion" key="religion" description="The religion worshipped here.">
+      <choice value="christian" text="Christianity (church)"/>
+      <choice value="jewish" text="Judaism (synagogue)"/>
+      <choice value="muslim" text="Islam (mosque)"/>
+      <choice value="hindu" text="Hinduism (temple)"/>
+      <choice value="buddhist" text="Buddhism (temple)"/>
+      <choice value="sikh" text="Sikhism (gurdwara)"/>
+      <choice value="shinto" text="Shinto (shrine)"/>
+    </input>
+
+    <input type="freetext" presence="always" category="Details" name="denomination" key="denomination" description="The denomination of the religion worshiped here." priority="low"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="ATM">
+    <category>amenity</category>
+    <icon image="features/pois/money_atm.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Atm</help>
+    <point/>
+    <tag k="amenity" v="atm"/>
+    <input type="freetext" presence="always" category="Details" name="Operator" key="operator" description="The organisation that provides this ATM" priority="low"/>
+    <input type="freetext" presence="always" category="Details" name="Fee" key="fee" description="Is there a charge for using this ATM? If so how much?"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Bank">
+    <category>amenity</category>
+    <icon image="features/pois/money_bank2.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dbank</help>
+    <point/>
+    <tag k="amenity" v="bank"/>
+    <inputSet ref="names"/>
+    <inputSet ref="buildingAddress"/>
+    <input type="choice" presence="always" category="Details" name="Public ATM available" key="atm" description="Is there a public ATM available?">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Recycling">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_recycling.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Drecycling</help>
+    <point/>
+    <area/>
+    <tag k="amenity" v="recycling"/>
+    <inputSet ref="simpleName"/>
+    <input type="choice" presence="always" category="Details" name="Type of facility" key="recycling_type" description="Is this containers in a rural area or at an manned facility?" priority="high">
+      <choice value="container" text="Container"/>
+      <choice value="centre" text="Recycling centre"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Batteries" key="recycling:batteries" description="Small batteries for household appliances" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Books" key="recycling:books" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Cans" key="recycling:cans" description="Metal cans and other small metal packaging" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Cardboard" key="recycling:cardboard" description="I.e. large pieces of packaging" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Cartons" key="recycling:cartons" description="Packaging for groceries, i.e. milk cartons" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Clothes" key="recycling:clothes" description="Clothes, including shoes" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Electrical appliances" key="recycling:electrical_appliances" description="Larger electrical items, i.e. refrigerators, freezers, dishwashers" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Glass" key="recycling:glass" description="I.e glass sheets" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Glass bottles" key="recycling:glass_bottles" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Green waste" key="recycling:green_waste" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Magazines" key="recycling:magazines" description="Magazines (glossy pages)" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Newspaper" key="recycling:newspaper" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Paper" key="recycling:paper" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Paper packaging" key="recycling:paper_packaging" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Plastic" key="recycling:plastic" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Plastic bottles" key="recycling:plastic_bottles" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Plastic packaging" key="recycling:plastic_packaging" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Scrap metal" key="recycling:scrap_metal" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Small appliances" key="recycling:small_appliances" description="Small electrical appliances, i.e. walkman, power adapter, remote control" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Waste" key="recycling:waste" description="General waste (black bags)" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <input type="choice" presence="onTagMatch" category="Details" name="Wood" key="recycling:wood" description="" priority="low">
+      <choice value="yes" text="Yes"/>
+      <choice value="no" text="No"/>
+    </input>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="School">
+    <category>amenity</category>
+    <icon image="features/pois/education_school.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dschool</help>
+    <point/>
+    <tag k="amenity" v="school"/>
+    <inputSet ref="names"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Kindergarten">
+    <category>amenity</category>
+    <category>buildings</category>
+    <icon image="features/pois/education_nursery3.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dkindergarten</help>
+    <point/>
+    <tag k="amenity" v="kindergarten"/>
+    <inputSet ref="names"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Town hall">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_town_hall.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dtownhall</help>
+    <point/>
+    <tag k="amenity" v="townhall"/>
+    <inputSet ref="names"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Post Box">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_post_box.n.24.png">
+      ${ref}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Post_box</help>
+    <point/>
+    <tag k="amenity" v="post_box"/>
+    <input type="freetext" presence="always" category="Details" name="Ref" key="ref" description="Reference number of the post box"/>
+    <input type="freetext" presence="always" category="Details" name="Operator" key="operator" description="The provider of the postal service" priority="low"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Post Office">
+    <category>amenity</category>
+    <category>buildings</category>
+    <icon image="features/pois/amenity_post_office.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity=post_office</help>
+    <point/>
+    <area/>
+    <tag k="amenity" v="post_office"/>
+    <input type="freetext" presence="always" category="Details" name="Ref" key="ref" description="Reference number of the post office"/>
+    <input type="freetext" presence="always" category="Details" name="Operator" key="operator" description="The provider of the postal service" priority="low"/>
+    <inputSet ref="common"/>
+    <inputSet ref="simpleName"/>
+  </feature>
+
+  <feature name="Trash/rubbish bin">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_waste_bin.n.24.png">
+      ${ref}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity=waste_basket</help>
+    <point/>
+    <tag k="amenity" v="waste_basket"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Toilets">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_toilets.n.24.png">
+      ${ref}
+    </icon>
+    <point/>
+    <tag k="amenity" v="toilets"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Water fountain">
+    <category>amenity</category>
+    <category>foodanddrink</category>
+    <icon image="features/pois/food_drinkingtap.n.24.png">
+      ${ref}
+    </icon>
+    <point/>
+    <tag k="amenity" v="drinking_water"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Shelter">
+    <category>amenity</category>
+    <icon image="features/pois/accommodation_shelter2.n.24.png">
+      ${name}
+    </icon>    
+    <point/>
+    <area/>
+    <tag k="amenity" v="shelter"/>
+      <input type="choice" presence="always" name="Type of shelter" key="shelter_type" description="The intended use of the shelter.">
+        <choice value="picnic_shelter" text="Picnic shelter"/>
+        <choice value="public_transport" text="Public transport"/>
+        <choice value="weather_shelter" text="Weather shelter"/>
+        <choice value="wildlife_hide" text="Wildlife hide"/>
+      </input>
+    <inputset ref="names"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Barbecue">
+    <category>amenity</category>
+    <icon image="features/pois/tourist_picnic.n.24.png"/>
+    <!-- specific icon needed -->
+    <point/>
+    <tag k="amenity" v="bbq"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Hunting stand">
+    <category>sport</category>
+    <icon image="features/pois/sport_shooting.n.24.png"/>
+    <point/>
+    <tag k="amenity" v="hunting_stand"/>
+    <inputSet ref="common"/>
+    <inputSet ref="names"/>
+  </feature>
+
+
+  <feature name="Park bench">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_bench.n.24.png" />
+    <point/>
+    <tag k="amenity" v="bench"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Public telephone">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_telephone.n.24.png" />
+    <point/>
+    <tag k="amenity" v="telephone"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Emergency phone">
+    <category>amenity</category>
+    <icon image="features/pois/emergency-telephone-24.png" />
+    <!-- icon from http://www.clker.com/clipart-emergency-telephone-blue.html, feel free to (re)move this notice -->
+    <point/>
+    <tag k="amenity" v="emergency_phone"/>
+    <inputSet ref="common"/>
+    <input type="freetext" presence="always" category="Details" name="Ref" key="ref" description="Reference number of emergency phone."/>    
+  </feature>
+
+
+  <feature name="Swimming pool">
+    <category>amenity</category>
+    <category>sport</category>
+    <icon image="features/pois/sport_swimming_outdoor.n.24.png">
+      ${name}
+    </icon>
+    <point/>
+    <area/>
+    <tag k="amenity" v="swimming_pool"/>
+    <inputSet ref="simpleName"/>    
+    <inputSet ref="common"/>
+
+  </feature>
+
+  <feature name="Fountain">
+    <category>amenity</category>
+    <icon image="features/pois/amenity_fountain2.n.24.png">
+    ${name}
+    </icon>
+    <point/>
+    <tag k="amenity" v="fountain"/>
+    <inputSet ref="common"/>
+    <inputSet ref="simpleName"/>
+  </feature>
+
+  <feature name="Vending machine">
+    <category>amenity</category>
+    <category>foodanddrink</category>
+    <icon image="features/pois/shopping_vending_machine.n.24.png">A vending machine.</icon>
+
+    <point/>
+    <tag k="amenity" v="vending_machine"/>
+    <inputSet ref="common"/>
+    <inputSet ref="simpleName"/>
+    <input type="freetext" presence="always" name="Product" key="vending" description="What is being sold: tickets, food, maps..."/>
+    <inputSet ref="simpleOperator" />
+  </feature>
+
+  <!-- ========= Entertainment ========= -->
+
+  <feature name="Pub">
+    <category>foodanddrink</category>
+    <icon image="features/pois/food_pub.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dpub</help>
+    <point/>
+    <tag k="amenity" v="pub"/>
+    <inputSet ref="names"/>
+    <inputSet ref="web"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="wifi"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Bar">
+    <category>foodanddrink</category>
+    <icon image="features/pois/food_bar.n.24.png">
+      ${name}
+    </icon>
+    <point/>
+    <tag k="amenity" v="bar"/>
+    <inputSet ref="names"/>
+    <inputSet ref="web"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="wifi"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Restaurant">
+    <category>foodanddrink</category>
+    <icon image="features/pois/food_restaurant.n.24.png">
+      ${name}
+    </icon>
+    <point/>
+    <tag k="amenity" v="restaurant"/>
+    <inputSet ref="names"/>
+    <inputSet ref="web"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="cuisine"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Cafe">
+    <category>foodanddrink</category>
+    <icon image="features/pois/food_cafe.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dcafe</help>
+    <point/>
+    <tag k="amenity" v="cafe"/>
+    <inputSet ref="names"/>
+    <inputSet ref="web"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="cuisine"/>
+    <inputSet ref="wifi"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Fast Food">
+    <category>foodanddrink</category>
+    <icon image="features/pois/food_fastfood.n.24.png">
+      ${name}
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:amenity%3Dfast_food</help>
+    <point/>
+    <tag k="amenity" v="fast_food"/>
+    <inputSet ref="names"/>
+    <inputSet ref="web"/>
+    <inputSet ref="buildingAddress"/>
+    <inputSet ref="cuisine"/>
+    <inputSet ref="common"/>
+  </feature>
+
 </featureGroup>
\ No newline at end of file
index fc3dbff..916de11 100644 (file)
-<featureGroup>\r
-  <feature name="Wall">\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-    <icon>\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dwall</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="wall"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Ditch">\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-    <icon>\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dditch</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="ditch"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Retaining wall">\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-    <icon>\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dretaining_wall</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="retaining_wall"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="City wall">\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-    <icon>\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dcity_wall</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="city_wall"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Fence">\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-    <icon>\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dfence</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="fence"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Hedge">\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-    <icon>\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dhedge</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="hedge"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Bollard">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_bollard.n.24.png">\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dbollard</help>\r
-\r
-    <point/>\r
-    <tag k="barrier" v="bollard"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Gate">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_gate.n.24.png">\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dgate</help>\r
-\r
-    <point/>\r
-    <tag k="barrier" v="gate"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Lift Gate">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_lift_gate.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dlift_gate</help>\r
-    <point/>\r
-    <tag k="barrier" v="lift_gate"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Kissing Gate">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_kissing_gate.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dkissing_gate</help>\r
-    <point/>\r
-    <tag k="barrier" v="kissing_gate"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-\r
-  <feature name="Cycle Barrier">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_cycle_barrier.24.png">\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dcycle_barrier</help>\r
-\r
-    <point/>\r
-    <tag k="barrier" v="cycle_barrier"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Big Concrete Blocks">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_blocks.24.png">\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dblock</help>\r
-\r
-    <point/>\r
-    <tag k="barrier" v="block"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Cattle Grid">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_cattle_grid.24.png">\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dcattle_grid</help>\r
-\r
-    <point/>\r
-    <tag k="barrier" v="cattle_grid"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Toll Booth">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_toll_booth.n.24.png">\r
-    </icon>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dtoll_booth</help>\r
-\r
-    <point/>\r
-    <tag k="barrier" v="toll_booth"/>\r
-    <tagSet ref="fee"/>\r
-    <input type="freetext" presence="onTagMatch" category="Naming" name="Operator" key="operator" description="The provider of the toll" priority="low"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Stile">\r
-    <category>barrier</category>\r
-    <icon image="features/pois/barrier_stile.n.24.png"/>\r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dstile</help>\r
-    <point/>\r
-    <tag k="barrier" v="stile"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="Wire fence">\r
-    <!-- no idea, but taginfo says 2700 uses -->\r
-    <category>barrier</category>\r
-    <icon image="features/barrier_generic.png"/>\r
-   \r
-    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dwire_fence</help>\r
-\r
-    <line/>\r
-    <tag k="barrier" v="wire_fence"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
+<featureGroup>
+  <feature name="Wall">
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+    <icon>
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dwall</help>
+
+    <line/>
+    <tag k="barrier" v="wall"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Ditch">
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+    <icon>
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dditch</help>
+
+    <line/>
+    <tag k="barrier" v="ditch"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Retaining wall">
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+    <icon>
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dretaining_wall</help>
+
+    <line/>
+    <tag k="barrier" v="retaining_wall"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="City wall">
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+    <icon>
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dcity_wall</help>
+
+    <line/>
+    <tag k="barrier" v="city_wall"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Fence">
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+    <icon>
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dfence</help>
+
+    <line/>
+    <tag k="barrier" v="fence"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Hedge">
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+    <icon>
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dhedge</help>
+
+    <line/>
+    <tag k="barrier" v="hedge"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Bollard">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_bollard.n.24.png">
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dbollard</help>
+
+    <point/>
+    <tag k="barrier" v="bollard"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Gate">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_gate.n.24.png">
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dgate</help>
+
+    <point/>
+    <tag k="barrier" v="gate"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Lift Gate">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_lift_gate.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dlift_gate</help>
+    <point/>
+    <tag k="barrier" v="lift_gate"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Kissing Gate">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_kissing_gate.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dkissing_gate</help>
+    <point/>
+    <tag k="barrier" v="kissing_gate"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+
+  <feature name="Cycle Barrier">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_cycle_barrier.24.png">
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dcycle_barrier</help>
+
+    <point/>
+    <tag k="barrier" v="cycle_barrier"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Big Concrete Blocks">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_blocks.24.png">
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dblock</help>
+
+    <point/>
+    <tag k="barrier" v="block"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Cattle Grid">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_cattle_grid.24.png">
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dcattle_grid</help>
+
+    <point/>
+    <tag k="barrier" v="cattle_grid"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Toll Booth">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_toll_booth.n.24.png">
+    </icon>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dtoll_booth</help>
+
+    <point/>
+    <tag k="barrier" v="toll_booth"/>
+    <inputSet ref="fee"/>
+    <input type="freetext" presence="onTagMatch" category="Details" name="Operator" key="operator" description="The provider of the toll" priority="low"/>
+    <inputSet ref="common"/>
+  </feature>
+
+
+  <feature name="Stile">
+    <category>barrier</category>
+    <icon image="features/pois/barrier_stile.n.24.png"/>
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dstile</help>
+    <point/>
+    <tag k="barrier" v="stile"/>
+    <inputSet ref="common"/>
+  </feature>
+
+  <feature name="Wire fence">
+    <!-- no idea, but taginfo says 2700 uses -->
+    <category>barrier</category>
+    <icon image="features/barrier_generic.png"/>
+   
+    <help>http://wiki.openstreetmap.org/wiki/Tag:barrier%3Dwire_fence</help>
+
+    <line/>
+    <tag k="barrier" v="wire_fence"/>
+    <inputSet ref="common"/>
+  </feature>
 </featureGroup>
\ No newline at end of file
index d05720c..28775a9 100644 (file)
-<featureGroup>\r
-  <feature name="School">\r
-    <category>buildings</category>\r
-    <icon image="features/pois/education_school.n.24.png">\r
-      <b>${name} ${addr:housename}</b><br/>\r
-      ${addr:housenumber} ${addr:street} ${addr:postcode}\r
-    </icon>\r
-\r
-    <area/>\r
-    <tag k="amenity" v="school"/>\r
-    <inputSet ref="isBuilding"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="College">\r
-    <category>buildings</category>\r
-    <icon image="features/pois/education_university.n.24.png">\r
-      <b>${name} ${addr:housename}</b><br/>\r
-      ${addr:housenumber} ${addr:street} ${addr:postcode}\r
-    </icon>\r
-\r
-    <area/>\r
-    <tag k="amenity" v="college"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="isBuilding"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-  <feature name="University">\r
-    <category>buildings</category>\r
-    <icon image="features/pois/education_university.n.24.png">\r
-      <b>${name} ${addr:housename}</b><br/>\r
-      ${addr:housenumber} ${addr:street} ${addr:postcode}\r
-    </icon>\r
-\r
-    <area/>\r
-    <tag k="amenity" v="university"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="isBuilding"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Supermarket">\r
-    <category>buildings</category>\r
-    <icon image="features/pois/shopping_supermarket.n.24.png">\r
-      <b>${name} ${addr:housename}</b><br/>\r
-      ${addr:housenumber} ${addr:street} ${addr:postcode}\r
-    </icon>\r
-\r
-    <area/>\r
-    <tag k="shop" v="supermarket"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <inputSet ref="isBuilding"/>\r
-    <inputSet ref="common"/>\r
-  </feature>\r
-\r
-\r
-  <feature name="Place of worship">\r
-    <category>buildings</category>\r
-    <icon image="icons/place_of_worship.png">\r
-      <b>${name} ${addr:housename}</b><br/>\r
-      ${addr:housenumber} ${addr:street} ${addr:postcode}\r
-    </icon>\r
-\r
-    <area/>\r
-    <tag k="amenity" v="place_of_worship"/>\r
-    <inputSet ref="names"/>\r
-    <inputSet ref="buildingAddress"/>\r
-    <!-- sorted in reverse order of popularity in taginfo. -->\r
-    <input type="choice" category="Religion" name="Religion" key="religion" description="The religion to which this place of worship belongs." presence="always">\r
-      <choice value="christian" text="Christianity (church)"/>\r
-      <choice value="muslim" text="Islam (mosque)"/>\r
-      <choice value="buddhist" text="Buddhist (temple)"/>\r
-      <choice value="jewish" text="Judaism (synagogue)"/>\r
-      <choice value="hindu" text="Hindu (temple)"/>\r
-      <choice value="sikh" text="Sikh (gurdwara)"/>\r
-      <choice value="spiritualist" text="Spiritualism"/>\r
-      <choice value="unitarian" text="Unitarianism"/>\r
-      <choice value="taoist" text="Taoism"/>\r
-      <choice value="multifaith" text="Multi-faith"/>\r
-      <choice value="scientologist" text="Scientology"/>\r
-      <choice value="bahai" text="Bahai"/>\r
-    </input>\r
-    <!-- sorted in reverse order of popularity in taginfo. -->\r
-    <input type="choice" category="Religion" name="Denomination" key="denomination" description="The denomination, or sub-branch of the main religion." presence="always">\r
-      <choice value="catholic" text="Catholic"/>\r
-      <choice value="baptist" text="Baptist"/>\r
-      <choice value="methodist" text="Methodist"/>\r
-      <choice value="lutheran" text="Lutheran"/>\r
-      <choice value="protestant" text="Prostant"/>\r
-      <choice value="orthodox" text="Orthodox"/>\r
-      <choice value="presbyterian" text="Presbyterian"/>\r
-      <choice value="anglican" text="Anglican"/>\r
-      <choice value="roman_catholic" text="Roman Catholic"/>\r
-      <choice value="evangelical" text="Evangelical"/>\r
-      <choice value="pentecostal" text="Pentecostal"/>\r
-      <choice value="mormon" text="Mormon"/>\r
-      <choice value="sunni" text="Sunni"/>\r
-      <choice value="jehovahs_witness" text="Jehovah's Witness"/>\r
-      <!-- duplicate of Anglican? -->\r
-      <choice value="church_of_england" text="Church of England"/>\r
-      <choice value="greek_orthodox" text="Greek Orthodox"/>\r
-      <choice value="new_apostolic" text="New Apostolic"/>\r
-      <choice value="episcopal" text="Episcopal"/>\r
-      <choice value="russian_orthodox" text="Russian Orthodox"/>\r
-      <choice value="adventist" text="Adventist"/>\r
-      <choice value="seventh_day_adventist" text="Seventh Day Adventist"/>\r
-      <choice value="united_reformed" text="United Reformed"/>\r
-      <choice value="reformed" text="Reformed"/>\r
-      <choice value="iglesia_ni_cristo" text="Iglesia Ni Cristo"/>\r
-      <choice value="uniting" text="Uniting"/>\r
-      <choice value="salvation_army" text="Salvation Army"/>\r
-      <choice value="church_of_scotland" text="Church of Scotland"/>\r
-      <choice value="quaker" text="Quaker"/>\r
-      <choice value="scientist" text="Scientist"/>\r
-      <choice value="shia" text="Shia"/>\r
-      <choice value="congregational" text="Congregational"/>\r
-      <choice value="assembly_of_god" text="Assembly of God"/>\r
-      <choice value="united" text="United"/>\r
-      <choice value="mennonite" text="Mennonite"/>\r
-      <choice value="nazarene" text="Nazarene"/>\r
-      <!-- duplicate of Mormon? -->\r
-      <choice value="latter_day_saints" text="Latter Day Saints"/>\r
-      <choice value="dutch_reformed" text="Dutch Reformed"/>\r
-      <choice value="tibetan" text="Tibetan"/>\r
-      <choice value="shingon" text="Shingon"/>\r
-      <choice value="georgian_orthodox" text="Georgian Orthodox"/>\r
-      <choice value="unitarian" text="Unitarian"/>\r
-      <choice value="brethren" text="Brethren"/>\r
-      <choice&nb