mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-29 11:21:40 +02:00
Allow Osmose errors to use category for UI strings
Some error types don't require unique strings and can share common strings among the category. This makes that possible as well as adding support for some other types of error for demonstrative purposes.
This commit is contained in:
+10
-4
@@ -155,12 +155,18 @@
|
||||
|
||||
/* Osmose Errors
|
||||
------------------------------------------------------- */
|
||||
.osmose {
|
||||
color: #FFFFFF;
|
||||
|
||||
.osmose.category-0 {
|
||||
color: #BDBDBD;
|
||||
}
|
||||
|
||||
.osmose.category-structure {
|
||||
color: #F9C700;
|
||||
.osmose.category-1040,
|
||||
.osmose.category-1050,
|
||||
.osmose.category-1070,
|
||||
.osmose.category-1080,
|
||||
.osmose.category-1150,
|
||||
.osmose.category-1280 {
|
||||
color: #DCB000;
|
||||
}
|
||||
|
||||
/* Custom Map Data (geojson, gpx, kml, vector tile) */
|
||||
|
||||
+34
-1
@@ -830,9 +830,42 @@ en:
|
||||
osmose:
|
||||
title: Osmose
|
||||
error_types:
|
||||
0:
|
||||
title: 'Building Intersection'
|
||||
description: '{0} and {1} intersect.'
|
||||
0-3:
|
||||
title: 'Suspiciously Small Building'
|
||||
description: '{0} is a suspisciously small building.'
|
||||
0-4:
|
||||
title: 'Gap Between Buildings'
|
||||
description: 'A gap exists between {0} and {1} which looks suspiciously small.'
|
||||
1040-1:
|
||||
title: 'Invalid Polygon'
|
||||
description: '{0} intersects itself.'
|
||||
1050-1:
|
||||
title: 'Reversed Roundabout'
|
||||
description: '{0} looks like a roundabout mapped in the wrong direction for this location.'
|
||||
1050-1050:
|
||||
title: 'Reversed Mini-Roundabout'
|
||||
description: '{0} looks like a mini-roundabout with the incorrect "direction" tag for this location.'
|
||||
1070:
|
||||
title: 'Highway intersecting water'
|
||||
description: '{1} intersects with {0}, but there is no junction node, bridge, or tunnel.'
|
||||
1070-1:
|
||||
title: 'Highway intersecting building'
|
||||
description: '{1} intersects with {0}.'
|
||||
1070-8:
|
||||
title: 'Highway intersecting highway'
|
||||
1070-10:
|
||||
title: 'Waterway intersecting waterway'
|
||||
1080-1:
|
||||
title: 'Orphan Nodes Cluster'
|
||||
description: 'A culster of nodes with no tags is present.'
|
||||
1150:
|
||||
title: 'Overlapping Similar Areas'
|
||||
description: '{0} and {1} overlap.'
|
||||
1280-1:
|
||||
title: 'Incorrect Speed Camera'
|
||||
description: 'Speed camera should be on the highway or part of an "enforcement" relation.'
|
||||
improveOSM:
|
||||
title: ImproveOSM Detection
|
||||
geometry_types:
|
||||
|
||||
+41
-2
@@ -34,10 +34,49 @@
|
||||
}
|
||||
},
|
||||
"osmose": {
|
||||
"items": ["0", "1040", "1050", "1070", "1080", "1150", "1280"],
|
||||
"errorTypes": {
|
||||
"0-1": {
|
||||
"icon": "maki-home"
|
||||
},
|
||||
"0-2": {
|
||||
"icon": "maki-home"
|
||||
},
|
||||
"1040-1": {
|
||||
"icon": "maki-square-stroked"
|
||||
},
|
||||
"1050-1": {
|
||||
"icon": "maki-circle-stroked"
|
||||
},
|
||||
"1050-1050": {
|
||||
"icon": "maki-circle-stroked"
|
||||
},
|
||||
"1150-1": {
|
||||
"icon": "far-clone"
|
||||
},
|
||||
"1150-2": {
|
||||
"icon": "far-clone"
|
||||
},
|
||||
"1150-3": {
|
||||
"icon": "far-clone"
|
||||
},
|
||||
"1070-1": {
|
||||
"icon": "maki-home",
|
||||
"category": "structure"
|
||||
"icon": "maki-home"
|
||||
},
|
||||
"1070-4": {
|
||||
"icon": "maki-dam"
|
||||
},
|
||||
"1070-5": {
|
||||
"icon": "maki-dam"
|
||||
},
|
||||
"1070-8": {
|
||||
"icon": "maki-cross"
|
||||
},
|
||||
"1070-10": {
|
||||
"icon": "maki-cross"
|
||||
},
|
||||
"1280-1": {
|
||||
"icon": "maki-attraction"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+47
-2
@@ -1034,9 +1034,54 @@
|
||||
"osmose": {
|
||||
"title": "Osmose",
|
||||
"error_types": {
|
||||
"0": {
|
||||
"title": "Building Intersection",
|
||||
"description": "{0} and {1} intersect."
|
||||
},
|
||||
"1070": {
|
||||
"title": "Highway intersecting water",
|
||||
"description": "{1} intersects with {0}, but there is no junction node, bridge, or tunnel."
|
||||
},
|
||||
"1150": {
|
||||
"title": "Overlapping Similar Areas",
|
||||
"description": "{0} and {1} overlap."
|
||||
},
|
||||
"0-3": {
|
||||
"title": "Suspiciously Small Building",
|
||||
"description": "{0} is a suspisciously small building."
|
||||
},
|
||||
"0-4": {
|
||||
"title": "Gap Between Buildings",
|
||||
"description": "A gap exists between {0} and {1} which looks suspiciously small."
|
||||
},
|
||||
"1040-1": {
|
||||
"title": "Invalid Polygon",
|
||||
"description": "{0} intersects itself."
|
||||
},
|
||||
"1050-1": {
|
||||
"title": "Reversed Roundabout",
|
||||
"description": "{0} looks like a roundabout mapped in the wrong direction for this location."
|
||||
},
|
||||
"1050-1050": {
|
||||
"title": "Reversed Mini-Roundabout",
|
||||
"description": "{0} looks like a mini-roundabout with the incorrect \"direction\" tag for this location."
|
||||
},
|
||||
"1070-1": {
|
||||
"title": "Highway intersecting building",
|
||||
"description": "{1} intersects with {0}."
|
||||
"title": "Highway intersecting building"
|
||||
},
|
||||
"1070-8": {
|
||||
"title": "Highway intersecting highway"
|
||||
},
|
||||
"1070-10": {
|
||||
"title": "Waterway intersecting waterway"
|
||||
},
|
||||
"1080-1": {
|
||||
"title": "Orphan Nodes Cluster",
|
||||
"description": "A culster of nodes with no tags is present."
|
||||
},
|
||||
"1280-1": {
|
||||
"title": "Incorrect Speed Camera",
|
||||
"description": "Speed camera should be on the highway or part of an \"enforcement\" relation."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -94,7 +94,8 @@ export default {
|
||||
var options = {
|
||||
full: 'true', // Returns element IDs
|
||||
level: '1,2,3',
|
||||
zoom: '19'
|
||||
zoom: '19',
|
||||
item: services.osmose.items.join() // only interested in certain errors
|
||||
};
|
||||
|
||||
// determine the needed tiles to cover the view
|
||||
@@ -110,7 +111,7 @@ export default {
|
||||
if (_erCache.loadedTile[tile.id] || _erCache.inflightTile[tile.id]) return;
|
||||
|
||||
var rect = tile.extent.rectangle(); // E, N, W, S
|
||||
var params = Object.assign({}, options, { bbox: [rect[0], rect[1], rect[2], rect[3]].join() });
|
||||
var params = Object.assign({}, options, { bbox: rect.join() });
|
||||
|
||||
var url = _osmoseUrlRoot + 'issues?' + utilQsString(params);
|
||||
|
||||
@@ -133,7 +134,7 @@ export default {
|
||||
var type = [issue.item, issue.classs].join('-');
|
||||
|
||||
// Filter out unsupported error types (some are too specific or advanced)
|
||||
if (services.osmose.errorTypes[type]) {
|
||||
if (type in services.osmose.errorTypes) {
|
||||
loc = preventCoincident(loc, true);
|
||||
|
||||
var d = new qaError({
|
||||
@@ -144,8 +145,7 @@ export default {
|
||||
// Extra details needed for this service
|
||||
identifier: issue.id, // this is used to post changes to the error
|
||||
elems: elems,
|
||||
object_id: elems.length ? elems[0].substring(1) : '',
|
||||
object_type: elems.length ? elems[0].substring(0,1) : ''
|
||||
item: issue.item // category of the issue for styling
|
||||
});
|
||||
|
||||
// Variables used in the description
|
||||
|
||||
@@ -120,7 +120,7 @@ export function svgOsmose(projection, context, dispatch) {
|
||||
d.service,
|
||||
'error_id-' + d.id,
|
||||
'error_type-' + d.error_type,
|
||||
'category-' + d.category
|
||||
'category-' + d.item
|
||||
].join(' ');
|
||||
});
|
||||
|
||||
|
||||
@@ -18,19 +18,18 @@ export function uiOsmoseDetails(context) {
|
||||
|
||||
if (!d) return unknown;
|
||||
|
||||
if (d.desc) return d.desc;
|
||||
// Some errors fall back to their category for strings
|
||||
var i, et;
|
||||
var keys = [d.error_type, d.item];
|
||||
for (i = 0; i < 2; i++) {
|
||||
et = dataEn.QA.osmose.error_types[keys[i]];
|
||||
|
||||
var errorType = d.error_type;
|
||||
var et = dataEn.QA.osmose.error_types[errorType];
|
||||
|
||||
var detail;
|
||||
if (et && et.description) {
|
||||
detail = t('QA.osmose.error_types.' + errorType + '.description', d.replacements);
|
||||
} else {
|
||||
detail = unknown;
|
||||
if (et && et.description) {
|
||||
return t('QA.osmose.error_types.' + keys[i] + '.description', d.replacements);
|
||||
}
|
||||
}
|
||||
|
||||
return detail;
|
||||
return unknown;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,14 +63,10 @@ export function uiOsmoseDetails(context) {
|
||||
.html(errorDetail);
|
||||
|
||||
// If there are entity links in the error message..
|
||||
var relatedEntities = _error.elems;
|
||||
descriptionEnter.selectAll('.error_entity_link, .error_object_link')
|
||||
.each(function() {
|
||||
var link = d3_select(this);
|
||||
var isObjectLink = link.classed('error_object_link');
|
||||
var entityID = isObjectLink ?
|
||||
(_error.object_type + _error.object_id)
|
||||
: this.textContent;
|
||||
var entityID = this.textContent;
|
||||
var entity = context.hasEntity(entityID);
|
||||
|
||||
// Add click handler
|
||||
@@ -107,7 +102,7 @@ export function uiOsmoseDetails(context) {
|
||||
if (entity) {
|
||||
var name = utilDisplayName(entity); // try to use common name
|
||||
|
||||
if (!name && !isObjectLink) {
|
||||
if (!name) {
|
||||
var preset = context.presets().match(entity, context.graph());
|
||||
name = preset && !preset.isFallback() && preset.name(); // fallback to preset name
|
||||
}
|
||||
@@ -119,7 +114,7 @@ export function uiOsmoseDetails(context) {
|
||||
});
|
||||
|
||||
// Don't hide entities related to this error - #5880
|
||||
context.features().forceVisible(relatedEntities);
|
||||
context.features().forceVisible(_error.elems);
|
||||
context.map().pan([0,0]); // trigger a redraw
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,19 @@ export function uiOsmoseHeader() {
|
||||
var unknown = t('inspector.unknown');
|
||||
|
||||
if (!d) return unknown;
|
||||
var errorType = d.error_type;
|
||||
var et = dataEn.QA.osmose.error_types[errorType];
|
||||
|
||||
if (et && et.title) {
|
||||
return t('QA.osmose.error_types.' + errorType + '.title');
|
||||
} else {
|
||||
return unknown;
|
||||
// Some errors fall back to their category for strings
|
||||
var i, et;
|
||||
var keys = [d.error_type, d.item];
|
||||
for (i = 0; i < 2; i++) {
|
||||
et = dataEn.QA.osmose.error_types[keys[i]];
|
||||
|
||||
if (et && et.title) {
|
||||
return t('QA.osmose.error_types.' + keys[i] + '.title');
|
||||
}
|
||||
}
|
||||
|
||||
return unknown;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +57,7 @@ export function uiOsmoseHeader() {
|
||||
d.service,
|
||||
'error_id-' + d.id,
|
||||
'error_type-' + d.error_type,
|
||||
'category-' + d.category
|
||||
'category-' + d.item
|
||||
].join(' ');
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +69,8 @@ function buildData() {
|
||||
'fas-lock': {},
|
||||
'fas-long-arrow-alt-right': {},
|
||||
'fas-th-list': {},
|
||||
'fas-user-cog': {}
|
||||
'fas-user-cog': {},
|
||||
'far-clone': {}
|
||||
};
|
||||
|
||||
// The Noun Project icons used
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="clone" class="svg-inline--fa fa-clone fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 0H144c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h320c26.51 0 48-21.49 48-48v-48h48c26.51 0 48-21.49 48-48V48c0-26.51-21.49-48-48-48zM362 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h42v224c0 26.51 21.49 48 48 48h224v42a6 6 0 0 1-6 6zm96-96H150a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h308a6 6 0 0 1 6 6v308a6 6 0 0 1-6 6z"></path></svg>
|
||||
|
After Width: | Height: | Size: 578 B |
Reference in New Issue
Block a user