Lower match score of generic presets (fixes #1933)

This commit is contained in:
John Firebaugh
2013-10-29 10:46:41 -07:00
parent 38c208f821
commit 5525702909
6 changed files with 42 additions and 8 deletions
+8 -4
View File
@@ -1255,7 +1255,8 @@
},
"geometry": [
"area"
]
],
"matchScore": 0.1
},
"barrier": {
"geometry": [
@@ -2918,7 +2919,8 @@
"tags": {},
"geometry": [
"line"
]
],
"matchScore": 0.1
},
"man_made": {
"fields": [
@@ -3472,7 +3474,8 @@
"tags": {},
"geometry": [
"point"
]
],
"matchScore": 0.1
},
"power": {
"geometry": [
@@ -5290,7 +5293,8 @@
"tags": {},
"geometry": [
"vertex"
]
],
"matchScore": 0.1
},
"waterway": {
"fields": [
+2 -1
View File
@@ -3,5 +3,6 @@
"tags": {
"area": "yes"
},
"geometry": ["area"]
"geometry": ["area"],
"matchScore": 0.1
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"name": "Line",
"tags": {},
"geometry": ["line"]
"geometry": ["line"],
"matchScore": 0.1
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"name": "Point",
"tags": {},
"geometry": ["point"]
"geometry": ["point"],
"matchScore": 0.1
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"name": "Other",
"tags": {},
"geometry": ["vertex"]
"geometry": ["vertex"],
"matchScore": 0.1
}
+26
View File
@@ -39,4 +39,30 @@ describe("iD.presets", function() {
expect(c.match(line, graph).id).to.eql('line');
});
});
describe("expected matches", function() {
var presets;
before(function() {
presets = iD.presets().load(iD.data.presets);
});
it("prefers building to multipolygon", function() {
var relation = iD.Relation({tags: {type: 'multipolygon', building: 'yes'}}),
graph = iD.Graph([relation]);
expect(presets.match(relation, graph).id).to.eql('building');
});
it("prefers building to address", function() {
var way = iD.Way({tags: {area: 'yes', building: 'yes', 'addr:housenumber': '1234'}}),
graph = iD.Graph([way]);
expect(presets.match(way, graph).id).to.eql('building');
});
it("prefers pedestrian to area", function() {
var way = iD.Way({tags: {area: 'yes', highway: 'pedestrian'}}),
graph = iD.Graph([way]);
expect(presets.match(way, graph).id).to.eql('highway/pedestrian');
});
});
});