Using a renderIntent lib function instead of this identifier

A 'this' identifier is quite useless with compressed JavaScript,
and in fact it turned out to fail in advanced mode when trying
to access a feature's renderIntent property with it. The added
renderIntent lib function as a Call expression does the job
well.
This commit is contained in:
ahocevar
2013-08-28 18:00:09 +02:00
parent 526dbebadc
commit 0fbf07fef1
7 changed files with 32 additions and 64 deletions
+12
View File
@@ -99,6 +99,7 @@ ol.expr.functions = {
EXTENT: 'extent',
FID: 'fid',
GEOMETRY_TYPE: 'geometryType',
RENDER_INTENT: 'renderIntent',
INTERSECTS: 'intersects',
CONTAINS: 'contains',
DWITHIN: 'dwithin',
@@ -252,6 +253,17 @@ ol.expr.lib[ol.expr.functions.GEOMETRY_TYPE] = function(type) {
};
/**
* Determine if a feature's renderIntent matches the given one.
* @param {string} renderIntent Render intent.
* @return {boolean} The feature's renderIntent matches the given one.
* @this {ol.Feature}
*/
ol.expr.lib[ol.expr.functions.RENDER_INTENT] = function(renderIntent) {
return this.renderIntent == renderIntent;
};
ol.expr.lib[ol.expr.functions.INTERSECTS] = function(geom, opt_projection,
opt_attribute) {
throw new Error('Spatial function not implemented: ' +