Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
fix issue #370
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer authored and nebulon42 committed Feb 27, 2016
1 parent 2c911fe commit ad39e0b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
8 changes: 0 additions & 8 deletions lib/carto/tree/filterset.js
Expand Up @@ -209,14 +209,6 @@ tree.Filterset.prototype.add = function(filter, env) {
} else if (op === '=~') {
this.filters[key + '=~' + filter.val] = filter;
} else if (op === '>') {
// If there are other filters that are also >
// but are less than this one, they don't matter, so
// remove them.
for (var j in this.filters) {
if (this.filters[j].key == key && this.filters[j].val <= filter.val) {
delete this.filters[j];
}
}
this.filters[key + '>'] = filter;
} else if (op === '>=') {
for (var k in this.filters) {
Expand Down
4 changes: 2 additions & 2 deletions test/filterset.test.js
Expand Up @@ -225,12 +225,12 @@ describe('Filtersets', function() {
f = new tree.Filterset();
f.add({ key: 'TOTAL', op: '!=', val: '11' });
f.add({ key: 'TOTAL', op: '>', val: 11 });
assert.deepEqual(f.filters, { 'TOTAL>': { key: 'TOTAL', op: '>', val: 11 }});
assert.deepEqual(f.filters, {"TOTAL!=11":{"key":"TOTAL","op":"!=","val":"11"},"TOTAL>":{"key":"TOTAL","op":">","val":11}});

f = new tree.Filterset();
f.add({ key: 'TOTAL', op: '!=', val: '11' });
f.add({ key: 'TOTAL', op: '>', val: 90 });
assert.deepEqual(f.filters, { 'TOTAL>': { key: 'TOTAL', op: '>', val: 90 }});
assert.deepEqual(f.filters, {"TOTAL!=11":{"key":"TOTAL","op":"!=","val":"11"},"TOTAL>":{"key":"TOTAL","op":">","val":90}});

f = new tree.Filterset();
f.add({ key: 'TOTAL', op: '!=', val: '11' });
Expand Down
3 changes: 3 additions & 0 deletions test/rendering-mss/issue_370.mss
@@ -0,0 +1,3 @@
[way_pixels < 192000][way_pixels > 3000] {
line-width: 1;
}
6 changes: 6 additions & 0 deletions test/rendering-mss/issue_370.xml
@@ -0,0 +1,6 @@
<Style name="style" filter-mode="first">
<Rule>
<Filter>([way_pixels] &lt; 192000) and ([way_pixels] &gt; 3000)</Filter>
<LineSymbolizer stroke-width="1" />
</Rule>
</Style>
3 changes: 3 additions & 0 deletions test/rendering-mss/issue_370_b.mss
@@ -0,0 +1,3 @@
[way_pixels <= 192000][way_pixels >= 3000] {
line-width: 1;
}
6 changes: 6 additions & 0 deletions test/rendering-mss/issue_370_b.xml
@@ -0,0 +1,6 @@
<Style name="style" filter-mode="first">
<Rule>
<Filter>([way_pixels] &lt;= 192000) and ([way_pixels] &gt;= 3000)</Filter>
<LineSymbolizer stroke-width="1" />
</Rule>
</Style>

0 comments on commit ad39e0b

Please sign in to comment.