allow layers to be overridden in MapCSS; this means we can bring selected nodes to...
authorRichard Fairhurst <richard@systemed.net>
Sun, 7 Nov 2010 15:05:21 +0000 (15:05 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sun, 7 Nov 2010 15:05:21 +0000 (15:05 +0000)
net/systemeD/halcyon/NodeUI.as
net/systemeD/halcyon/WayUI.as
net/systemeD/halcyon/styleparser/ShapeStyle.as
net/systemeD/halcyon/styleparser/StyleList.as
resources/potlatch.css

index 5ea002a..bf4f631 100644 (file)
@@ -56,6 +56,9 @@ package net.systemeD.halcyon {
                                styleList=paint.ruleset.getStyles(entity,tags,paint.map.scale); 
                        }
 
+                       var suggestedLayer:Number=styleList.layerOverride();
+                       if (!isNaN(suggestedLayer)) { layer=suggestedLayer; }
+
                        var inWay:Boolean=entity.hasParentWays;
                        var hasStyles:Boolean=styleList.hasStyles();
                        
index 6930e42..c4f853e 100755 (executable)
@@ -196,10 +196,6 @@ package net.systemeD.halcyon {
                        if (Way(entity).isArea()) { tags[':area']='yes'; }
             if (entity.isUneditedTiger() && Globals.vars.highlightTiger) { tags[':tiger']='yes'; }
 
-                       // Which layer?
-                       layer=0;
-                       if (tags['layer']) { layer=Math.min(Math.max(tags['layer'],paint.minlayer),paint.maxlayer); }
-
                        // Keep track of maximum stroke width for hitzone
                        var maxwidth:Number=4;
 
@@ -208,6 +204,13 @@ package net.systemeD.halcyon {
                                styleList=paint.ruleset.getStyles(entity, tags, paint.map.scale);
                        }
 
+                       // Which layer?
+                       layer=styleList.layerOverride();
+                       if (isNaN(layer)) {
+                               layer=0;
+                               if (tags['layer']) { layer=Math.min(Math.max(tags['layer'],paint.minlayer),paint.maxlayer); }
+                       }
+
                        // Iterate through each sublayer, drawing any styles on that layer
                        var drawn:Boolean;
                        var multis:Array=entity.findParentRelationsOfType('multipolygon','outer');
index 72711dd..03411fc 100644 (file)
@@ -21,11 +21,13 @@ package net.systemeD.halcyon.styleparser {
                public var casing_opacity:Number;
                public var casing_dashes:Array=[];
                
+               public var layer:Number;                                // optional layer override (usually set by OSM tag)
+               
                override public function get properties():Array {
                        return [
                                'width','color','opacity','dashes','linecap','linejoin','line_style',
                                'fill_color','fill_opacity','fill_image',
-                               'casing_width','casing_color','casing_opacity','casing_dashes'
+                               'casing_width','casing_color','casing_opacity','casing_dashes','layer'
                        ];
                }
                
index a5ac01c..86a0501 100755 (executable)
@@ -22,6 +22,13 @@ package net.systemeD.halcyon.styleparser {
                public function hasStyles():Boolean {
                        return ( hasShapeStyles() || hasTextStyles() || hasPointStyles() || hasShieldStyles() );
                }
+
+               public function layerOverride():Number {
+                       for each (var ss:ShapeStyle in shapeStyles) {
+                               if (ss['layer']) return ss['layer'];
+                       }
+                       return NaN;
+               }
                
                public function addSublayer(s:Number):void {
                        if (sublayers.indexOf(s)==-1) { sublayers.push(s); }
index 3d3d9a2..d8d2c61 100644 (file)
@@ -263,13 +263,13 @@ way :tiger { casing-color: #ff00ff;}
 relation[type=restriction] node { z-index:11; icon-image: icons/restriction.png; }
 
 node :dupe { z-index: 9; icon-image: circle; icon-width:8; color: white; opacity: 0.4; casing-opacity: 0.4; casing-color: red; casing-width: 3; }
-node :hoverway { z-index: 9; icon-image: square; icon-width: 7; color: blue; }
+node :hoverway { z-index: 9; icon-image: square; icon-width: 7; color: blue; layer: 5; }
 node !:drawn :poi { z-index: 2; icon-image: circle; icon-width: 4; color: green; casing-color: black; casing-width: 1; }
 node !:drawn :hasTags { z-index: 9; icon-image: circle; icon-width: 4; color: black; }
-node :hasTags :selectedway { z-index: 9; icon-image: square; icon-width: 8; color: black; }
-node !:drawn :selectedway { z-index: 9; icon-image: square; icon-width: 8; color: red; casing-color: #cc0000; casing-width: 1;}
-node :selected { z-index: 1; icon-image: square; icon-width: eval('_width+10'); color: yellow; interactive: no; }
-node :junction :selectedway { z-index: 8; icon-image: square; icon-width: 12; casing-color: black; casing-width: 1; }
+node :hasTags :selectedway { z-index: 9; icon-image: square; icon-width: 8; color: black; layer: 5; }
+node !:drawn :selectedway { z-index: 9; icon-image: square; icon-width: 8; color: red; casing-color: #cc0000; casing-width: 1; layer: 5; }
+node :selected { z-index: 1; icon-image: square; icon-width: eval('_width+10'); color: yellow; interactive: no; layer: 5; }
+node :junction :selectedway { z-index: 8; icon-image: square; icon-width: 12; casing-color: black; casing-width: 1; layer: 5; }
 
 /* Descendant selectors provide an easy way to style relations: this example means "any way
    which is part of a relation whose type=route". */