mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
@@ -459,6 +459,8 @@ en:
|
||||
on_wiki: "{tag} on wiki.osm.org"
|
||||
used_with: "used with {type}"
|
||||
validations:
|
||||
disconnected_highway: Disconnected highway
|
||||
disconnected_highway_tooltip: "Highways, such as roads and paths, should be connected to other highways."
|
||||
untagged_point: Untagged point
|
||||
untagged_line: Untagged line
|
||||
untagged_area: Untagged area
|
||||
|
||||
Vendored
+2
@@ -566,6 +566,8 @@
|
||||
"used_with": "used with {type}"
|
||||
},
|
||||
"validations": {
|
||||
"disconnected_highway": "Disconnected highway",
|
||||
"disconnected_highway_tooltip": "Highways, such as roads and paths, should be connected to other highways.",
|
||||
"untagged_point": "Untagged point",
|
||||
"untagged_line": "Untagged line",
|
||||
"untagged_area": "Untagged area",
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { t } from '../util/locale';
|
||||
|
||||
|
||||
export function validationDisconnectedHighway() {
|
||||
|
||||
|
||||
function isDisconnectedHighway(entity, graph) {
|
||||
if (!entity.tags.highway) return false;
|
||||
if (entity.geometry(graph) !== 'line') return false;
|
||||
|
||||
return graph.childNodes(entity)
|
||||
.every(function(vertex) {
|
||||
return graph.parentWays(vertex)
|
||||
.filter(function(parent) {
|
||||
return parent.tags.highway && parent !== entity;
|
||||
})
|
||||
.length === 0;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var validation = function(changes, graph) {
|
||||
var warnings = [];
|
||||
for (var i = 0; i < changes.created.length; i++) {
|
||||
var entity = changes.created[i];
|
||||
|
||||
if (isDisconnectedHighway(entity, graph)) {
|
||||
warnings.push({
|
||||
id: 'missing_tag',
|
||||
message: t('validations.disconnected_highway'),
|
||||
tooltip: t('validations.disconnected_highway_tooltip'),
|
||||
entity: entity
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
};
|
||||
|
||||
|
||||
return validation;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export { validationDeprecatedTag } from './deprecated_tag';
|
||||
export { validationDisconnectedHighway } from './disconnected_highway';
|
||||
export { validationManyDeletions } from './many_deletions';
|
||||
export { validationMissingTag } from './missing_tag';
|
||||
export { validationTagSuggestsArea } from './tag_suggests_area';
|
||||
|
||||
Reference in New Issue
Block a user