standardise on 'name' and 'url' elements for stylesheet and imagery objects
authorRichard Fairhurst <richard@systemed.net>
Sun, 14 Nov 2010 14:17:35 +0000 (14:17 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sun, 14 Nov 2010 14:17:35 +0000 (14:17 +0000)
TODO.txt
net/systemeD/potlatch2/BackgroundDialog.mxml
net/systemeD/potlatch2/BackgroundSelector.mxml
net/systemeD/potlatch2/StyleSelector.mxml
potlatch2.mxml
resources/imagery.xml

index 65132c0..2b8f481 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -4,6 +4,7 @@ Potlatch 2: main outstanding issues
 == Core geometry ==
 
 * P1-style J (join) / shift-J (unjoin)
+* Doing a '-' to remove a point from a junction doesn't redraw the point on other ways
 
 == Vector background layers ==
 
@@ -32,6 +33,7 @@ Potlatch 2: main outstanding issues
 * Failing to parse map_features should be an error state
 * Escape should rewind the entity to how it was before the current ControllerState. (Record a position in the undo stack when exiting a ControllerState, and escape would rewind to that)
 * Potlatch 1-style "floaty warnings"
+* Repeat tags (R) doesn't update the advanced tag panel
 * Custom imagery dialog fixes
 * Ctrl-clicking two areas (one inside the other) should create a multipolygon
 * B keypress for background source tag
@@ -59,6 +61,8 @@ Potlatch 2: main outstanding issues
 * Have a remove button for removing loaded traces
 * Have a check button for simplifying traces
 * Figure out how to call P2/Simplify for halcyon-based code
+* When a GPX is loaded, it's not actually drawn until you pan the map
+
 
 Requested enhancements
 ----------------------
index c8efd81..7522c66 100644 (file)
@@ -7,10 +7,10 @@
 
   <mx:DataGrid editable="true" width="100%" height="100%" id="dataGrid">
     <mx:columns>
-        <mx:DataGridColumn editable="true" dataField="label" headerText="Name"/>
-        <mx:DataGridColumn editable="true" dataField="data" headerText="URL"/>
+        <mx:DataGridColumn editable="true" dataField="name" headerText="Name"/>
+        <mx:DataGridColumn editable="true" dataField="url" headerText="URL"/>
     </mx:columns>
-  </mx:DataGrid>        
+  </mx:DataGrid>
 
   <mx:HBox horizontalAlign="right" width="100%">
     <mx:LinkButton label="Delete" click="removeSource()" enabled="{dataGrid.selectedItem != null? true : false}"/>
@@ -54,7 +54,7 @@
     }
 
        private function addNewSource():void {
-               dataCollection.addItemAt( {label:'(new name)',data:'(new URL)'} , dataCollection.length);
+               dataCollection.addItemAt( {name:'(new name)',url:'(new URL)'} , dataCollection.length);
                dataGrid.validateNow();
                dataGrid.verticalScrollPosition=dataGrid.maxVerticalScrollPosition;
                dataGrid.editedItemPosition = {rowIndex: dataCollection.length-1, columnIndex: 0};
index d041601..cac03f7 100644 (file)
@@ -5,7 +5,8 @@
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
        <mx:List width="100%" height="100%" id="background" verticalScrollPolicy="on" 
-                       change="Application.application.setBackground(background.selectedItem.label, background.selectedItem.data);"                    
+                       labelField="name"
+                       change="Application.application.setBackground(background.selectedItem.name, background.selectedItem.url);"                      
                dataProvider="{Application.application.theController.imagery}" />
        <mx:CheckBox width="100%" label="Dim background" selected="true" id="dim"
            change="Application.application.theMap.setDimming(dim.selected); Application.application.yahoo.alpha = dim.selected ? 0.5 : 1" />
index 89e4f39..9e6ff10 100644 (file)
@@ -5,7 +5,8 @@
        horizontalAlign="left" backgroundColor="white" borderStyle="inset">
        
        <mx:List width="100%" height="100%" id="mapStyle" 
-               change="Application.application.setStylesheet(mapStyle.selectedItem.label, mapStyle.selectedItem.data);"
+               labelField="name"
+               change="Application.application.setStylesheet(mapStyle.selectedItem.name, mapStyle.selectedItem.url);"
                dataProvider="{Application.application.theController.stylesheets}" />
 
        <mx:Button label="Edit..." click="new BackgroundDialog().init('Map style',mapStyle,Application.application.theController.stylesheets);" />
index 22475c8..8376124 100755 (executable)
                        var xml:XML = new XML(URLLoader(event.target).data);
                        var saved_url:String = SharedObject.getLocal("user_state").data['background_url'];
                        var saved_name:String= SharedObject.getLocal("user_state").data['background_name'];
-                       var xml_url:String, xml_name:String, isSet:Boolean=false;
+                       var isSet:Boolean=false;
             var backgroundSet:Boolean = false;
 
             theController.imagery=new Array(
-                               { label: "None", data: "" },
-                               { label: "Yahoo", data: "yahoo" } );
+                               { name: "None", url: "" },
+                               { name: "Yahoo", url: "yahoo" } );
                        for each(var set:XML in xml.set) {
-                               xml_url= set.child("url");
-                               xml_name=set.child("name");
-                theController.imagery.push({ label:xml_name, data:xml_url });
-                               if (xml_url==saved_url || (xml_name==saved_name && xml_name!='Custom')) { isSet=true; }
+                               var obj:Object={};
+                               for (var a:String in set.children()) {
+                                       obj[set.child(a).name()]=set.child(a);
+                               }
+                theController.imagery.push(obj);
+                               if (obj['url']==saved_url || (obj['name']==saved_name && obj['name']!='Custom')) { isSet=true; }
                        }
 
             if (!isSet && saved_name != null && saved_url != null && saved_url != '' && saved_url != 'yahoo') {
-                theController.imagery.push({ label:saved_name, data:saved_url });
+                theController.imagery.push({ name:saved_name, url:saved_url });
                 isSet=true;
             }
 
                        for each (var bg:Object in theController.imagery) {
-                               if (bg['label']==saved_name || bg['data']==saved_url) {
-                                       setBackground(bg['label'], bg['data']);
+                               if (bg['name']==saved_name || bg['url']==saved_url) {
+                                       setBackground(bg['name'], bg['url']);
                     backgroundSet = true;
                                }
                        }
                        var xml:XML = new XML(URLLoader(event.target).data);
                        var saved_url:String = SharedObject.getLocal("user_state").data['stylesheet_url'];
                        var saved_name:String= SharedObject.getLocal("user_state").data['stylesheet_name'];
-                       var xml_url:String, xml_name:String, isInMenu:Boolean=false, isSet:Boolean=false;
+                       var isInMenu:Boolean=false, isSet:Boolean=false;
 
             // first, build the menu from the stylesheet list.
             // Also ensure the saved_url is in the menu (might be either saved from before, or supplied via loaderInfo)
             theController.stylesheets=new Array();
                        for each(var set:XML in xml.stylesheet) {
-                               xml_url= set.child("url");
-                               xml_name=set.child("name");
-                theController.stylesheets.push({ label:xml_name, data:xml_url });
-                               if (xml_url==saved_url || (xml_name==saved_name && xml_name!='Custom')) { isInMenu=true; }
+                               var obj:Object={};
+                               for (var a:String in set.children()) {
+                                       obj[set.child(a).name()]=set.child(a);
+                               }
+                theController.stylesheets.push(obj);
+                               if (obj['url']==saved_url || (obj['name']==saved_name && obj['name']!='Custom')) { isInMenu=true; }
                        }
-                       if (saved_url && !isInMenu) { theController.stylesheets.push({ label:saved_name, data:saved_url }); }
+                       if (saved_url && !isInMenu) { theController.stylesheets.push({ name:saved_name, url:saved_url }); }
 
             // pick a stylesheet to be set. It should be the saved one, if it is in the menu
             // or alternatively the first one on the menu,
             // or finally try 'potlatch.css'
                        for each (var ss:Object in theController.stylesheets) {
-                               if (ss['label']==saved_name || ss['data']==saved_url) {
-                                       setStylesheet(ss['label'], ss['data']);
+                               if (ss['name']==saved_name || ss['url']==saved_url) {
+                                       setStylesheet(ss['name'], ss['url']);
                     isSet = true;
                     break;
                                }
             if (!isSet) {
               if(theController.stylesheets.length > 0) {
                 var s:Object = theController.stylesheets[0];
-                setStylesheet(s['label'], s['data']);
+                setStylesheet(s['name'], s['url']);
               } else {
                 //hit and hope. FIXME should this be an error state?
-                theController.stylesheets.push({ label:'Potlatch', data:'potlatch.css'});
+                theController.stylesheets.push({ name:'Potlatch', url:'potlatch.css'});
                 setStylesheet('Potlatch','potlatch.css');
               }
             }
index eb62ff1..24c3f47 100644 (file)
@@ -3,83 +3,69 @@
 <imagery>
        <set>
                <name>OSM - Mapnik</name>
-               <type>900913</type>
                <url>http://tile.openstreetmap.org/$z/$x/$y.png</url>
        </set>
        <set>
                <name>OSM - Osmarender</name>
-               <type>900913</type>
                <url>http://tah.openstreetmap.org/Tiles/tile/$z/$x/$y.png</url>
        </set>
        <set>
                <name>OS OpenData Streetview</name>
-               <type>900913</type>
                <url>http://os.openstreetmap.org/sv/$z/$x/$y.png</url>
                <sourcetag>OS OpenData StreetView</sourcetag>
        </set>
        <set>
                <name>OS OpenData Locator</name>
-               <type>900913</type>
                <url>http://tiles.itoworld.com/os_locator/$z/$x/$y.png</url>
                <sourcetag>OS OpenData Locator</sourcetag>
        </set>
        <set>
                <name>OS 1:25k historic</name>
-               <type>900913</type>
                <url>http://ooc.openstreetmap.org/os1/$z/$x/$y.png</url>
                <sourcetag>OS 1:25k</sourcetag>
        </set>
        <set>
                <name>OS 7th Series historic</name>
-               <type>900913</type>
                <url>http://ooc.openstreetmap.org/os7/$z/$x/$y.png</url>
                <sourcetag>OS7</sourcetag>
        </set>
        <set>
                <name>OS New Popular Edition historic</name>
-               <type>900913</type>
                <url>http://ooc.openstreetmap.org/npe/$z/$x/$y.png</url>
                <sourcetag>NPE</sourcetag>
        </set>
        <set>
                <name>OS Scottish Popular historic</name>
-               <type>900913</type>
                <url>http://gibin.geog.ucl.ac.uk/~ollie/scotland/tiles/$z/$x/$y.jpg</url>
                <sourcetag>NPE</sourcetag>
        </set>
        <set>
                <name>Surrey aerial</name>
-               <type>900913</type>
                <url>http://gravitystorm.dev.openstreetmap.org/surrey/$z/$x/$y.png</url>
                <sourcetag>Surrey aerial</sourcetag>
        </set>
        <set>
                <name>NearMap aerial</name>
-               <type>900913</type>
                <url>http://www.nearmap.com/maps/nml=Vert&amp;zxy=$z,$x,$y</url>
                <sourcetag>NearMap</sourcetag>
        </set>
        <set>
                <name>Haiti - GeoEye Jan 13</name>
-               <type>900913</type>
                <url>http://gravitystorm.dev.openstreetmap.org/imagery/haiti/$z/$x/$y.jpg</url>
                <sourcetag>Haiti GeoEye</sourcetag>
        </set>
        <set>
                <name>Haiti - GeoEye Jan 13+</name>
-               <type>900913</type>
                <url>http://maps.nypl.org/tilecache/1/geoeye/$z/$x/$y.jpg</url>
                <sourcetag>Haiti GeoEye</sourcetag>
        </set>
        <set>
                <name>Haiti - DigitalGlobe</name>
-               <type>900913</type>
                <url>http://maps.nypl.org/tilecache/1/dg_crisis/$z/$x/$y.jpg</url>
                <sourcetag>Haiti DigitalGlobe</sourcetag>
        </set>
        <set>
                <name>Haiti - Street names</name>
-               <type>900913</type>
                <url>http://hypercube.telascience.org/tiles/1.0.0/haiti-city/$z/$x/$y.jpg</url>
                <sourcetag>Haiti streetnames</sourcetag>
        </set>