Add validation issue flagging ways with highway=road (close #5998)

This commit is contained in:
Quincy Morgan
2019-03-17 11:57:28 -04:00
parent d0eaa958be
commit 374cae5a7d
6 changed files with 63 additions and 4 deletions
+6
View File
@@ -1298,6 +1298,10 @@ en:
title: Lines Tagged as Areas
message: '{feature} should be a closed area based on the tag "{tag}"'
tip: "Areas must have connected endpoints."
unknown_road:
title: Unknown Roads
message: "{feature} has no classification"
tip: "Roads without a specific type may not appear in maps or routing."
fix:
connect_almost_junction:
annotation: Connected very close features.
@@ -1331,6 +1335,8 @@ en:
title: Reposition the features
select_preset:
title: Select a feature type
select_road_type:
title: Select a road type
set_as_inner:
title: Set as inner
set_as_outer:
+1 -2
View File
@@ -152,8 +152,7 @@
"highway/residential",
"highway/living_street",
"highway/service",
"highway/track",
"highway/road"
"highway/track"
]
},
"category-road_service": {
+1 -2
View File
@@ -6,7 +6,6 @@
"highway/residential",
"highway/living_street",
"highway/service",
"highway/track",
"highway/road"
"highway/track"
]
}
+8
View File
@@ -1598,6 +1598,11 @@
"message": "{feature} should be a closed area based on the tag \"{tag}\"",
"tip": "Areas must have connected endpoints."
},
"unknown_road": {
"title": "Unknown Roads",
"message": "{feature} has no classification",
"tip": "Roads without a specific type may not appear in maps or routing."
},
"fix": {
"connect_almost_junction": {
"annotation": "Connected very close features."
@@ -1645,6 +1650,9 @@
"select_preset": {
"title": "Select a feature type"
},
"select_road_type": {
"title": "Select a road type"
},
"set_as_inner": {
"title": "Set as inner"
},
+1
View File
@@ -9,3 +9,4 @@ export { validationMissingTag } from './missing_tag';
export { validationOldMultipolygon } from './old_multipolygon';
export { validationOutdatedTags } from './outdated_tags';
export { validationTagSuggestsArea } from './tag_suggests_area';
export { validationUnknownRoad } from './unknown_road';
+46
View File
@@ -0,0 +1,46 @@
import { operationDelete } from '../operations/index';
import { t } from '../util/locale';
import { utilDisplayLabel } from '../util';
import { validationIssue, validationIssueFix } from '../core/validator';
export function validationUnknownRoad() {
var type = 'unknown_road';
var validation = function(entity, context) {
if (entity.type !== 'way' || entity.tags.highway !== 'road') return [];
return [new validationIssue({
type: type,
severity: 'warning',
message: t('issues.unknown_road.message', {
feature: utilDisplayLabel(entity, context),
}),
tooltip: t('issues.unknown_road.tip'),
entities: [entity],
fixes: [
new validationIssueFix({
icon: 'iD-icon-search',
title: t('issues.fix.select_road_type.title'),
onClick: function() {
context.ui().sidebar.showPresetList();
}
}),
new validationIssueFix({
icon: 'iD-operation-delete',
title: t('issues.fix.delete_feature.title'),
onClick: function() {
var id = this.issue.entities[0].id;
operationDelete([id], context)();
}
})
]
})];
};
validation.type = type;
return validation;
}