add support for image-filters-inflate - refs mapnik/mapnik#2165
This commit is contained in:
parent
12a3d6cad2
commit
a5e5c045c9
@ -5,13 +5,16 @@ var _ = require('underscore');
|
|||||||
// return a stringified style for Mapnik
|
// return a stringified style for Mapnik
|
||||||
tree.StyleXML = function(name, attachment, definitions, env) {
|
tree.StyleXML = function(name, attachment, definitions, env) {
|
||||||
var existing = {};
|
var existing = {};
|
||||||
var image_filters = [], direct_image_filters = [], comp_op = [], opacity = [];
|
var image_filters = [], image_filters_inflate = [], direct_image_filters = [], comp_op = [], opacity = [];
|
||||||
|
|
||||||
for (var i = 0; i < definitions.length; i++) {
|
for (var i = 0; i < definitions.length; i++) {
|
||||||
for (var j = 0; j < definitions[i].rules.length; j++) {
|
for (var j = 0; j < definitions[i].rules.length; j++) {
|
||||||
if (definitions[i].rules[j].name === 'image-filters') {
|
if (definitions[i].rules[j].name === 'image-filters') {
|
||||||
image_filters.push(definitions[i].rules[j]);
|
image_filters.push(definitions[i].rules[j]);
|
||||||
}
|
}
|
||||||
|
if (definitions[i].rules[j].name === 'image-filters-inflate') {
|
||||||
|
image_filters_inflate.push(definitions[i].rules[j]);
|
||||||
|
}
|
||||||
if (definitions[i].rules[j].name === 'direct-image-filters') {
|
if (definitions[i].rules[j].name === 'direct-image-filters') {
|
||||||
direct_image_filters.push(definitions[i].rules[j]);
|
direct_image_filters.push(definitions[i].rules[j]);
|
||||||
}
|
}
|
||||||
@ -38,6 +41,10 @@ tree.StyleXML = function(name, attachment, definitions, env) {
|
|||||||
}).value().join(',') + '"';
|
}).value().join(',') + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (image_filters_inflate.length) {
|
||||||
|
attrs_xml += ' image-filters-inflate="' + image_filters_inflate[0].value.ev(env).toString() + '"';
|
||||||
|
}
|
||||||
|
|
||||||
if (direct_image_filters.length) {
|
if (direct_image_filters.length) {
|
||||||
attrs_xml += ' direct-image-filters="' + _.chain(direct_image_filters)
|
attrs_xml += ' direct-image-filters="' + _.chain(direct_image_filters)
|
||||||
// prevent identical filters from being duplicated in the style
|
// prevent identical filters from being duplicated in the style
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#layer {
|
#layer {
|
||||||
image-filters:invert();
|
image-filters:invert();
|
||||||
direct-image-filters:invert();
|
image-filters-inflate:true;
|
||||||
|
direct-image-filters:invert();
|
||||||
}
|
}
|
@ -1,2 +1,2 @@
|
|||||||
<Style name="style" filter-mode="first" image-filters="invert" direct-image-filters="invert">
|
<Style name="style" filter-mode="first" image-filters="invert" image-filters-inflate="true" direct-image-filters="invert">
|
||||||
</Style>
|
</Style>
|
Loading…
Reference in New Issue
Block a user