[OpenLayers-Commits] r5136 - sandbox/ahocevar/sldRenderer/lib/OpenLayers

commits at openlayers.org commits at openlayers.org
Tue Nov 6 18:23:47 EST 2007


Author: ahocevar
Date: 2007-11-06 18:23:43 -0500 (Tue, 06 Nov 2007)
New Revision: 5136

Modified:
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Rule.js
   sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js
Log:
make text/propertyName combinations also work for min/maxScaleDenominator

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Rule.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Rule.js	2007-11-06 23:22:34 UTC (rev 5135)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Rule.js	2007-11-06 23:23:43 UTC (rev 5136)
@@ -25,13 +25,17 @@
     
     /**
      * APIProperty: minScaleDenominator
-     * {Number} minimum scale at which to draw the feature.
+     * {Number} or {String} minimum scale at which to draw the feature.
+     * In the case of a String, this can be a combination of text and
+     * propertyNames in the form "literal ${propertyName}"
      */
     minScaleDenominator: null,
 
     /**
      * APIProperty: maxScaleDenominator
-     * {Number} maximum scale at which to draw the feature.
+     * {Number} or {String} maximum scale at which to draw the feature.
+     * In the case of a String, this can be a combination of text and
+     * propertyNames in the form "literal ${propertyName}"
      */
     maxScaleDenominator: null,
 

Modified: sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js
===================================================================
--- sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js	2007-11-06 23:22:34 UTC (rev 5135)
+++ sandbox/ahocevar/sldRenderer/lib/OpenLayers/Style.js	2007-11-06 23:23:43 UTC (rev 5136)
@@ -124,10 +124,12 @@
                 // check if within minScale/maxScale bounds
                 var scale = feature.layer.map.getScale();
                 if (this.rules[i].minScaleDenominator) {
-                    draw = draw && scale > this.rules[i].minScaleDenominator;
+                    draw = scale > OpenLayers.Style.createLiteral(
+                            this.rules[i].minScaleDenominator, feature);
                 }
-                if (this.rules[i].maxScaleDenominator) {
-                    draw = draw && (scale < this.rules[i].maxScaleDenominator);
+                if (draw && this.rules[i].maxScaleDenominator) {
+                    draw = scale < OpenLayers.Style.createLiteral(
+                            this.rules[i].maxScaleDenominator, feature);
                 }
                 
                 // determine which symbolizer (Point, Line, Polygon) to use
@@ -203,6 +205,7 @@
         while (a = re.exec(value)) {
             value = value.replace(a[0], attributes[a[1]]);
         }
+        value = isNaN(value) ? value : parseFloat(value);
     }
     return value;
 }



More information about the Commits mailing list