Add support for variable transforms - refs #163, and improve test coverage
This commit is contained in:
parent
57ddf46813
commit
c570c2cd0e
@ -78,6 +78,7 @@ tree.Call.prototype = {
|
||||
};
|
||||
}
|
||||
if (fn !== args.length &&
|
||||
!(Array.isArray(fn) && _.include(fn, args.length)) &&
|
||||
// support variable-arg functions like `colorize-alpha`
|
||||
fn !== -1) {
|
||||
env.error({
|
||||
|
@ -12,6 +12,14 @@ ref.setData = function(data) {
|
||||
ref.data = data;
|
||||
ref.selector_cache = generateSelectorCache(data);
|
||||
ref.mapnikFunctions = generateMapnikFunctions(data);
|
||||
|
||||
ref.mapnikFunctions.matrix = [6];
|
||||
ref.mapnikFunctions.translate = [1, 2];
|
||||
ref.mapnikFunctions.scale = [1, 2];
|
||||
ref.mapnikFunctions.rotate = [1, 3];
|
||||
ref.mapnikFunctions.skewX = [1];
|
||||
ref.mapnikFunctions.skewY = [1];
|
||||
|
||||
ref.required_cache = generateRequiredProperties(data);
|
||||
};
|
||||
|
||||
|
15
test/errorhandling/bad_op.mml
Normal file
15
test/errorhandling/bad_op.mml
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Stylesheet": [
|
||||
"bad_op.mss"
|
||||
],
|
||||
"Layer": [{
|
||||
"id": "world",
|
||||
"name": "world",
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Datasource": {
|
||||
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||
"type": "shape"
|
||||
}
|
||||
}]
|
||||
}
|
3
test/errorhandling/bad_op.mss
Normal file
3
test/errorhandling/bad_op.mss
Normal file
@ -0,0 +1,3 @@
|
||||
#world {
|
||||
line-width: 20% + 2px;
|
||||
}
|
1
test/errorhandling/bad_op.result
Normal file
1
test/errorhandling/bad_op.result
Normal file
@ -0,0 +1 @@
|
||||
bad_op.mss:2:4 If two operands differ, the first must not be %
|
15
test/errorhandling/bad_op_2.mml
Normal file
15
test/errorhandling/bad_op_2.mml
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Stylesheet": [
|
||||
"bad_op_2.mss"
|
||||
],
|
||||
"Layer": [{
|
||||
"id": "world",
|
||||
"name": "world",
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Datasource": {
|
||||
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||
"type": "shape"
|
||||
}
|
||||
}]
|
||||
}
|
3
test/errorhandling/bad_op_2.mss
Normal file
3
test/errorhandling/bad_op_2.mss
Normal file
@ -0,0 +1,3 @@
|
||||
#world {
|
||||
line-width: 20px * 2%;
|
||||
}
|
1
test/errorhandling/bad_op_2.result
Normal file
1
test/errorhandling/bad_op_2.result
Normal file
@ -0,0 +1 @@
|
||||
bad_op_2.mss:2:4 Percent values can only be added or subtracted from other values
|
15
test/errorhandling/invaliddimension.mml
Normal file
15
test/errorhandling/invaliddimension.mml
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Stylesheet": [
|
||||
"invaliddimension.mss"
|
||||
],
|
||||
"Layer": [{
|
||||
"id": "world",
|
||||
"name": "world",
|
||||
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||
"Datasource": {
|
||||
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||
"type": "shape"
|
||||
}
|
||||
}]
|
||||
}
|
3
test/errorhandling/invaliddimension.mss
Normal file
3
test/errorhandling/invaliddimension.mss
Normal file
@ -0,0 +1,3 @@
|
||||
#world {
|
||||
line-width: 10wifflewaffles;
|
||||
}
|
1
test/errorhandling/invaliddimension.result
Normal file
1
test/errorhandling/invaliddimension.result
Normal file
@ -0,0 +1 @@
|
||||
invaliddimension.mss:2:4 Invalid unit: 'wifflewaffles'
|
@ -2,4 +2,6 @@
|
||||
#world {
|
||||
point-file: url(foo.png);
|
||||
point-transform: translate( @trans * 2, @trans);
|
||||
marker-width: 2;
|
||||
marker-transform: scale(2);
|
||||
}
|
||||
|
@ -3,9 +3,10 @@
|
||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
|
||||
|
||||
<Style name="world" filter-mode="first" >
|
||||
<Style name="world" filter-mode="first">
|
||||
<Rule>
|
||||
<PointSymbolizer file="[absolute path]" transform="translate(4,2)" />
|
||||
<MarkersSymbolizer width="2" transform="scale(2)" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="world"
|
||||
|
Loading…
Reference in New Issue
Block a user