Support variables and expressions as the arguments to functions.

This commit is contained in:
Tom MacWright 2012-06-22 12:32:36 -04:00
parent 593092fedd
commit e27ce12ea0
3 changed files with 9 additions and 4 deletions

View File

@ -62,13 +62,17 @@ tree.Call.prototype = {
toString: function(env, format) {
if (format === 'image-filter') {
if (this.args.length) {
return this.name + ':' + this.args.join(',');
return this.name + ':' + this.args.map(function(a) {
return a.eval(env);
}).join(',');
} else {
return this.name;
}
} else {
if (this.args.length) {
return this.name + '(' + this.args.join(',') + ')';
return this.name + '(' + this.args.map(function(a) {
return a.eval(env);
}).join(',') + ')';
} else {
return this.name;
}

View File

@ -1,4 +1,5 @@
@trans: 2;
#world {
point-file: url(foo.png);
point-transform: translate(2, 2);
point-transform: translate(@trans * 2, @trans);
}

View File

@ -5,7 +5,7 @@
<Style name="world" filter-mode="first" >
<Rule>
<PointSymbolizer file="foo.png" transform="translate(2,2)" />
<PointSymbolizer file="foo.png" transform="translate(4,2)" />
</Rule>
</Style>
<Layer name="world"