Merge pull request #1093 from ahocevar/symbolizer-id
Adding counter expression function
This commit is contained in:
@@ -96,6 +96,7 @@ ol.expr.lib = {};
|
||||
*/
|
||||
ol.expr.functions = {
|
||||
CONCAT: 'concat',
|
||||
COUNTER: 'counter',
|
||||
EXTENT: 'extent',
|
||||
FID: 'fid',
|
||||
GEOMETRY_TYPE: 'geometryType',
|
||||
@@ -126,6 +127,23 @@ ol.expr.lib[ol.expr.functions.CONCAT] = function(var_args) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns a counter which increases every time this function is called.
|
||||
* @param {number=} opt_start Start. If not provided, the counter starts at 1.
|
||||
* @return {number} Counter.
|
||||
*/
|
||||
ol.expr.lib[ol.expr.functions.COUNTER] = (function() {
|
||||
var counter = 0;
|
||||
return function(opt_start) {
|
||||
var result = ++counter;
|
||||
if (goog.isDef(opt_start)) {
|
||||
result += opt_start;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
/**
|
||||
* Determine if a feature's extent intersects the provided extent.
|
||||
* @param {number} minX Minimum x-coordinate value.
|
||||
|
||||
Reference in New Issue
Block a user