First cut at styling TIGER data via an option. Needs lots of propagation of uid and...
authorAndy Allan <gravitystorm@gmail.com>
Wed, 27 Oct 2010 14:29:47 +0000 (14:29 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Wed, 27 Oct 2010 14:29:47 +0000 (14:29 +0000)
net/systemeD/halcyon/WayUI.as
net/systemeD/halcyon/connection/Entity.as
net/systemeD/halcyon/connection/Node.as
net/systemeD/halcyon/connection/Way.as
net/systemeD/halcyon/connection/XMLBaseConnection.as
net/systemeD/potlatch2/options/OptionsDialog.mxml
resources/potlatch.css

index b9e3d4d..6dc1b4c 100755 (executable)
@@ -188,6 +188,7 @@ package net.systemeD.halcyon {
             var tags:Object = entity.getTagsCopy();
                        tags=applyStateClasses(tags);
                        if (Way(entity).isArea()) { tags[':area']='yes'; }
+            if (entity.isUneditedTiger() && Globals.vars.highlightTiger) { tags[':tiger']='yes'; }
 
                        // Which layer?
                        layer=0;
index 3f1dcda..b5f4c44 100644 (file)
@@ -8,6 +8,8 @@ package net.systemeD.halcyon.connection {
     public class Entity extends EventDispatcher {
         private var _id:Number;
         private var _version:uint;
+        private var _uid:Number;
+        private var _timestamp:String;
         private var tags:Object = {};
         private var modified:Boolean = false;
                private var _loaded:Boolean = true;
@@ -15,9 +17,11 @@ package net.systemeD.halcyon.connection {
                private var locked:Boolean = false;
                public var deleted:Boolean = false;
 
-        public function Entity(id:Number, version:uint, tags:Object, loaded:Boolean) {
+        public function Entity(id:Number, version:uint, tags:Object, loaded:Boolean, uid:Number = NaN, timestamp:String = null) {
             this._id = id;
             this._version = version;
+            this._uid = uid;
+            this._timestamp = timestamp;
             this.tags = tags;
                        this._loaded = loaded;
             modified = id < 0;
@@ -31,12 +35,16 @@ package net.systemeD.halcyon.connection {
             return _version;
         }
 
+        public function get uid():Number {
+            return _uid;
+        }
+
         public function get loaded():Boolean {
             return _loaded;
         }
 
-               public function updateEntityProperties(version:uint, tags:Object, loaded:Boolean):void {
-                       _version=version; this.tags=tags; _loaded=loaded;
+               public function updateEntityProperties(version:uint, tags:Object, loaded:Boolean, uid:Number = NaN, timestamp:String = null):void {
+                       _version=version; this.tags=tags; _loaded=loaded; _uid = uid; _timestamp = timestamp;
                }
 
                // Tag-handling methods
@@ -57,6 +65,13 @@ package net.systemeD.halcyon.connection {
             return false;
         }
 
+        public function isUneditedTiger():Boolean {
+            if (this is Way && (uid == 110 || uid == 17)) {//todo fixme etc
+              return true;
+            }
+            return false;
+        }
+
         public function getTag(key:String):String {
             return tags[key];
         }
index ab86a8c..db899cb 100644 (file)
@@ -7,15 +7,15 @@ package net.systemeD.halcyon.connection {
         private var _latproj:Number;
         private var _lon:Number;
 
-        public function Node(id:Number, version:uint, tags:Object, loaded:Boolean, lat:Number, lon:Number) {
-            super(id, version, tags, loaded);
+        public function Node(id:Number, version:uint, tags:Object, loaded:Boolean, lat:Number, lon:Number, uid:Number = NaN, timestamp:String = null) {
+            super(id, version, tags, loaded, uid, timestamp);
             this._lat = lat;
             this._latproj = lat2latp(lat);
             this._lon = lon;
         }
 
-               public function update(version:uint, tags:Object, loaded:Boolean, lat:Number, lon:Number):void {
-                       updateEntityProperties(version,tags,loaded); setLatLonImmediate(lat,lon);
+               public function update(version:uint, tags:Object, loaded:Boolean, lat:Number, lon:Number, uid:Number = NaN, timestamp:String = null):void {
+                       updateEntityProperties(version,tags,loaded,uid,timestamp); setLatLonImmediate(lat,lon);
                }
 
         public function get lat():Number {
index 7341b74..413ad15 100644 (file)
@@ -11,17 +11,17 @@ package net.systemeD.halcyon.connection {
                private var edge_b:Number;
                public static var entity_type:String = 'way';
 
-        public function Way(id:Number, version:uint, tags:Object, loaded:Boolean, nodes:Array) {
-            super(id, version, tags, loaded);
+        public function Way(id:Number, version:uint, tags:Object, loaded:Boolean, nodes:Array, uid:Number = NaN, timestamp:String = null) {
+            super(id, version, tags, loaded, uid, timestamp);
             this.nodes = nodes;
                        for each (var node:Node in nodes) { node.addParent(this); }
                        calculateBbox();
         }
 
-               public function update(version:uint, tags:Object, loaded:Boolean, nodes:Array):void {
+               public function update(version:uint, tags:Object, loaded:Boolean, nodes:Array, uid:Number = NaN, timestamp:String = null):void {
                        var node:Node;
                        for each (node in this.nodes) { node.removeParent(this); }
-                       updateEntityProperties(version,tags,loaded); this.nodes=nodes;
+                       updateEntityProperties(version,tags,loaded,uid,timestamp); this.nodes=nodes;
                        for each (node in nodes) { node.addParent(this); }
                        calculateBbox();
                }
index dc5ae5b..c65d6d8 100644 (file)
@@ -24,6 +24,8 @@ package net.systemeD.halcyon.connection {
             var map:XML = new XML(URLLoader(event.target).data);
             var id:Number;
             var version:uint;
+            var uid:Number;
+            var timestamp:String;
             var tags:Object;
 
             for each(var relData:XML in map.relation) {
@@ -75,6 +77,8 @@ package net.systemeD.halcyon.connection {
             for each(var nodeData:XML in map.node) {
                 id = Number(nodeData.@id);
                 version = uint(nodeData.@version);
+                uid = Number(nodeData.@uid);
+                timestamp = nodeData.@timestamp;
 
                 var node:Node = getNode(id);
                 if ( node == null || !node.loaded ) {
@@ -82,9 +86,9 @@ package net.systemeD.halcyon.connection {
                     var lon:Number = Number(nodeData.@lon);
                     tags = parseTags(nodeData.tag);
                     if ( node == null )
-                        setNode(new Node(id, version, tags, true, lat, lon),false);
+                        setNode(new Node(id, version, tags, true, lat, lon, uid, timestamp),false);
                     else {
-                        node.update(version, tags, true, lat, lon);
+                        node.update(version, tags, true, lat, lon, uid, timestamp);
                         sendEvent(new EntityEvent(NEW_NODE, node), false);
                     }
                 }
@@ -93,6 +97,8 @@ package net.systemeD.halcyon.connection {
             for each(var data:XML in map.way) {
                 id = Number(data.@id);
                 version = uint(data.@version);
+                uid = Number(data.@uid);
+                timestamp = data.@timestamp;
 
                 var way:Way = getWay(id);
                 if ( way == null || !way.loaded ) {
@@ -101,9 +107,9 @@ package net.systemeD.halcyon.connection {
                         nodes.push(getNode(Number(nd.@ref)));
                     tags = parseTags(data.tag);
                     if ( way == null )
-                        setWay(new Way(id, version, tags, true, nodes),false);
+                        setWay(new Way(id, version, tags, true, nodes, uid, timestamp),false);
                     else {
-                        way.update(version, tags, true, nodes);
+                        way.update(version, tags, true, nodes, uid, timestamp);
                         sendEvent(new EntityEvent(NEW_WAY, way), false);
                     }
                 }
index d7367b9..d0674c4 100644 (file)
@@ -8,6 +8,7 @@
     import mx.managers.PopUpManager;
     import mx.events.CloseEvent;
     import mx.core.Application;
+    import net.systemeD.halcyon.Globals;
     
     public function init():void {
         PopUpManager.addPopUp(this, Application(Application.application), true);
         PopUpManager.removePopUp(this);
     }
 
+    private function tigerToggle():void {
+        Globals.vars.highlightTiger = tigercheck.selected;
+        Application.application.theMap.redraw();
+    }
+
               ]]>
   </mx:Script>
        <mx:CheckBox width="100%" label="Show toolbox" selected="true" id="tbcheck"
@@ -29,6 +35,9 @@
        <mx:CheckBox width="100%" label="Use custom cursors" selected="true" id="cursorcheck"
            change="Application.application.theController.cursorsEnabled=cursorcheck.selected" />
 
+    <mx:CheckBox width="100%" label="Highlight Unedited TIGER" selected="false" id="tigercheck"
+        change="tigerToggle()" />
+
   <mx:ControlBar>
     <mx:Spacer width="100%"/>
     <mx:Button label="Ok" click="PopUpManager.removePopUp(this);"/>
index c6288d5..75430bf 100644 (file)
@@ -257,6 +257,7 @@ way :restrictto { z-index: -1; width: eval('_width+10'); color: blue; opacity: 0
 way !:drawn { z-index:9; width: 2; color: black; dashes: 4,0;} { z-index:10; width: 2; color: #ffff00; dashes: 0, 4, 4, 0;}
  /*IMHO (Steve Bennett), in early testing we want to highlight ways that aren't triggering rules */
 /* way !:drawn { z-index:10; width: 0.5; color: gray; } was like this */
+way :tiger { width: eval('_width+2'); color: #ff00ff;}
 
 
 relation[type=restriction] node { z-index:11; icon-image: icons/restriction.png; }