Skip to content
Snippets Groups Projects
Commit 6d342247 authored by zksx's avatar zksx
Browse files

fix bug when a default property is given, global map is now showing diffrent...

fix bug when a default property is given, global map is now showing diffrent styles for different features
parent 0feda6e1
Branches
No related tags found
No related merge requests found
...@@ -29,8 +29,8 @@ class LineSegment{ ...@@ -29,8 +29,8 @@ class LineSegment{
// default Path style applied if nothing matches // default Path style applied if nothing matches
var defaultStyle = { var defaultStyle = {
stroke: true, stroke: true,
color: "#03f", color: "#000",
weight: 5, weight: 1,
opacity: 1, opacity: 1,
fillOpacity: 1, fillOpacity: 1,
fillColor: '#03f', fillColor: '#03f',
...@@ -269,25 +269,30 @@ L.SLDStyler = L.Class.extend({ ...@@ -269,25 +269,30 @@ L.SLDStyler = L.Class.extend({
isFilterMatch: function(filter, properties) { isFilterMatch: function(filter, properties) {
if (filter) { if (filter) {
var operator = filter.operator == null || filter.operator == 'and' ? 'every' : 'some'; var operator = filter.operator == null || filter.operator == 'and' ? 'every' : 'some';
if(filter.comparisions.length <= 0){
return false;
}
return filter.comparisions[operator](function(comp) { return filter.comparisions[operator](function(comp) {
var property = properties[comp.property.toLowerCase()];
if (comp.operator == '==') { if (comp.operator == '==') {
return properties[comp.property] == comp.literal; return property == comp.literal;
} else if (comp.operator == '!=') { } else if (comp.operator == '!=') {
return properties[comp.property] != comp.literal; return property != comp.literal;
} else if (comp.operator == '<') { } else if (comp.operator == '<') {
return properties[comp.property] < comp.literal; return property < comp.literal;
} else if (comp.operator == '>') { } else if (comp.operator == '>') {
return properties[comp.property] > comp.literal; return property > comp.literal;
} else if (comp.operator == '<=') { } else if (comp.operator == '<=') {
return properties[comp.property] <= comp.literal; return property <= comp.literal;
} else if (comp.operator == '>=') { } else if (comp.operator == '>=') {
return properties[comp.property] >= comp.literal; return property >= comp.literal;
} else { } else {
console.error('Unknown comparision operator', comp.operator); console.error('Unknown comparision operator', comp.operator);
} }
}); });
} else } else{
return true; return true;
}
}, },
matchFn: function (featureTypeStyle, feature) { matchFn: function (featureTypeStyle, feature) {
var matchingRule = null; var matchingRule = null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment