Add ability to ignore warnings

Replace issue's array of entities with array of entity IDs
Improve issue ID hashing
This commit is contained in:
Quincy Morgan
2019-04-29 17:52:32 -07:00
parent 4215db39a2
commit 375779882d
34 changed files with 179 additions and 143 deletions
+11 -7
View File
@@ -7,10 +7,10 @@ export function validationIssue(attrs) {
this.severity = attrs.severity; // required - 'warning' or 'error'
this.message = attrs.message; // required - localized string
this.reference = attrs.reference; // optional - function(selection) to render reference information
this.entities = attrs.entities; // optional - array of entities involved in the issue
this.entityIds = attrs.entityIds; // optional - array of IDs of entities involved in the issue
this.loc = attrs.loc; // optional - [lon, lat] to zoom in on to see the issue
this.data = attrs.data; // optional - object containing extra data for the fixes
this.fixes = attrs.fixes; // optional - array of validationIssueFix objects
this.fixes = attrs.fixes || []; // optional - array of validationIssueFix objects
this.hash = attrs.hash; // optional - string to further differentiate the issue
this.id = generateID.apply(this); // generated - see below
@@ -25,10 +25,14 @@ export function validationIssue(attrs) {
parts.push(this.hash);
}
if (this.subtype) {
parts.push(this.subtype);
}
// include entities this issue is for
// (sort them so the id is deterministic)
if (this.entities) {
var entityKeys = this.entities.map(osmEntity.key).sort();
if (this.entityIds) {
var entityKeys = this.entityIds.slice().sort();
parts.push.apply(parts, entityKeys);
}
@@ -48,9 +52,9 @@ export function validationIssue(attrs) {
if (this.loc) {
return _extent = geoExtent(this.loc);
}
if (this.entities && this.entities.length) {
return _extent = this.entities.reduce(function(extent, entity) {
return extent.extend(entity.extent(resolver));
if (this.entityIds && this.entityIds.length) {
return _extent = this.entityIds.reduce(function(extent, entityId) {
return extent.extend(resolver.entity(entityId).extent(resolver));
}, geoExtent());
}
return null;