Merge branch 'SilentSpike-unify'

This commit is contained in:
Bryan Housel
2019-02-05 11:18:19 -05:00
18 changed files with 261 additions and 277 deletions

View File

@@ -57,101 +57,102 @@
/* Keep Right Errors
------------------------------------------------------- */
.kr.error_type-20, /* multiple nodes on same spot */
.kr.error_type-40, /* impossible oneways */
.kr.error_type-210, /* self intersecting ways */
.kr.error_type-270, /* unusual motorway connection */
.kr.error_type-310, /* roundabout issues */
.kr.error_type-320, /* improper _link */
.kr.error_type-350 { /* improper bridge tag */
.keepRight.error_type-20, /* multiple nodes on same spot */
.keepRight.error_type-40, /* impossible oneways */
.keepRight.error_type-210, /* self intersecting ways */
.keepRight.error_type-270, /* unusual motorway connection */
.keepRight.error_type-310, /* roundabout issues */
.keepRight.error_type-320, /* improper _link */
.keepRight.error_type-350 { /* improper bridge tag */
color: #ff9;
}
.kr.error_type-50 { /* almost junctions */
.keepRight.error_type-50 { /* almost junctions */
color: #88f;
}
.kr.error_type-60, /* deprecated tags */
.kr.error_type-70, /* tagging issues */
.kr.error_type-90, /* motorway without ref */
.kr.error_type-100, /* place of worship without religion */
.kr.error_type-110, /* poi without name */
.kr.error_type-150, /* railway crossing without tag */
.kr.error_type-220, /* misspelled tag */
.kr.error_type-380 { /* non-physical sport tag */
.keepRight.error_type-60, /* deprecated tags */
.keepRight.error_type-70, /* tagging issues */
.keepRight.error_type-90, /* motorway without ref */
.keepRight.error_type-100, /* place of worship without religion */
.keepRight.error_type-110, /* poi without name */
.keepRight.error_type-150, /* railway crossing without tag */
.keepRight.error_type-220, /* misspelled tag */
.keepRight.error_type-380 { /* non-physical sport tag */
color: #5d0;
}
.kr.error_type-130 { /* disconnected ways */
.keepRight.error_type-130 { /* disconnected ways */
color: #fa3;
}
.kr.error_type-170 { /* FIXME tag */
.keepRight.error_type-170 { /* FIXME tag */
color: #ff0;
}
.kr.error_type-190 { /* intersection without junction */
.keepRight.error_type-190 { /* intersection without junction */
color: #f33;
}
.kr.error_type-200 { /* overlapping ways */
.keepRight.error_type-200 { /* overlapping ways */
color: #fdbf6f;
}
.kr.error_type-160, /* railway layer conflict */
.kr.error_type-230 { /* layer conflict */
.keepRight.error_type-160, /* railway layer conflict */
.keepRight.error_type-230 { /* layer conflict */
color: #b60;
}
.kr.error_type-280 { /* boundary issues */
.keepRight.error_type-280 { /* boundary issues */
color: #5f47a0;
}
.kr.error_type-180, /* relation without type */
.kr.error_type-290 { /* turn restriction issues */
.keepRight.error_type-180, /* relation without type */
.keepRight.error_type-290 { /* turn restriction issues */
color: #ace;
}
.kr.error_type-300, /* missing maxspeed */
.kr.error_type-390 { /* missing tracktype */
.keepRight.error_type-300, /* missing maxspeed */
.keepRight.error_type-390 { /* missing tracktype */
color: #090;
}
.kr.error_type-360, /* language unknown */
.kr.error_type-370, /* doubled places */
.kr.error_type-410 { /* website issues */
.keepRight.error_type-360, /* language unknown */
.keepRight.error_type-370, /* doubled places */
.keepRight.error_type-410 { /* website issues */
color: #f9b;
}
.kr.error_type-120, /* way without nodes */
.kr.error_type-400 { /* geometry / turn angles */
.keepRight.error_type-120, /* way without nodes */
.keepRight.error_type-400 { /* geometry / turn angles */
color: #c35;
}
/* ImproveOSM Errors
------------------------------------------------------- */
.iOSM.error_type-ow- { /* missing one way */
.improveOSM.error_type-ow { /* missing one way */
color: #1E90FF;
}
.iOSM.error_type-mr-road { /* missing road */
.improveOSM.error_type-mr-road { /* missing road */
color: #B452CD;
}
.iOSM.error_type-mr-path { /* missing path */
.improveOSM.error_type-mr-path { /* missing path */
color: #A0522D;
}
.iOSM.error_type-mr-parking { /* missing parking */
.improveOSM.error_type-mr-parking { /* missing parking */
color: #EEEE00;
}
.iOSM.error_type-mr-both { /* missing road+parking */
.improveOSM.error_type-mr-both { /* missing road+parking */
color: #FFA500;
}
.iOSM.error_type-tr- { /* missing turn restriction */
.improveOSM.error_type-tr { /* missing turn restriction */
color: #EC1C24;
}
/* Custom Map Data (geojson, gpx, kml, vector tile) */
.layer-mapdata {
pointer-events: none;
@@ -210,5 +211,4 @@
stroke: #000;
stroke-width: 5px;
stroke-miterlimit: 1;
}
}

37
data/qa_errors.json Normal file
View File

@@ -0,0 +1,37 @@
{
"services": {
"improveOSM": {
"errorTypes": {
"ow": {
"icon": "fas-long-arrow-alt-right",
"category": "routing"
},
"mr-both": {
"icon": "maki-car",
"category": "geometry"
},
"mr-parking": {
"icon": "maki-parking",
"category": "geometry"
},
"mr-path": {
"icon": "maki-shoe",
"category": "geometry"
},
"mr-road": {
"icon": "maki-car",
"category": "geometry"
},
"tr": {
"icon": "temaki-junction",
"category": "routing"
}
}
},
"keepRight": {
"errorTypes": {
}
}
}
}

View File

@@ -5,7 +5,7 @@ import {
select as d3_select
} from 'd3-selection';
import { osmEntity, osmNote, krError, iOsmError } from '../osm';
import { osmEntity, osmNote, qaError } from '../osm';
import { utilKeybinding, utilRebind } from '../util';
@@ -112,12 +112,9 @@ export function behaviorHover(context) {
entity = datum;
selector = '.data' + datum.__featurehash__;
} else if (
datum instanceof iOsmError ||
datum instanceof krError
) {
} else if (datum instanceof qaError) {
entity = datum;
selector = '.' + datum.source + '.error_id-' + datum.id;
selector = '.' + datum.service + '.error_id-' + datum.id;
} else if (datum instanceof osmNote) {
entity = datum;
@@ -187,4 +184,4 @@ export function behaviorHover(context) {
return utilRebind(behavior, dispatch, 'on');
}
}

View File

@@ -19,8 +19,7 @@ import {
import {
osmEntity,
osmNote,
iOsmError,
krError
qaError
} from '../osm';
@@ -171,14 +170,10 @@ export function behaviorSelect(context) {
context
.selectedNoteID(datum.id)
.enter(modeSelectNote(context, datum.id));
} else if (datum instanceof iOsmError & !isMultiselect) { // clicked an improveOSM error
} else if (datum instanceof qaError & !isMultiselect) { // clicked an external QA error
context
.selectedErrorID(datum.id)
.enter(modeSelectError(context, datum.id, datum.source));
} else if (datum instanceof krError & !isMultiselect) { // clicked a krError error
context
.selectedErrorID(datum.id)
.enter(modeSelectError(context, datum.id, datum.source));
.enter(modeSelectError(context, datum.id, datum.service));
} else { // clicked nothing..
context.selectedNoteID(null);
context.selectedErrorID(null);
@@ -241,4 +236,4 @@ export function behaviorSelect(context) {
return behavior;
}
}

View File

@@ -17,7 +17,7 @@ import { uiImproveOsmEditor, uiKeepRightEditor } from '../ui';
import { utilKeybinding } from '../util';
export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
export function modeSelectError(context, selectedErrorID, selectedErrorService) {
var mode = {
id: 'select-error',
button: 'browse'
@@ -25,10 +25,10 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
var keybinding = utilKeybinding('select-error');
var errorService, errorEditor;
switch (selectedErrorSource) {
case 'iOSM':
errorService = services.improveOSM;
var errorService = services[selectedErrorService];
var errorEditor;
switch (selectedErrorService) {
case 'improveOSM':
errorEditor = uiImproveOsmEditor(context)
.on('change', function() {
context.map().pan([0,0]); // trigger a redraw
@@ -38,8 +38,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
.show(errorEditor.error(error));
});
break;
case 'kr':
errorService = services.keepRight;
case 'keepRight':
errorEditor = uiKeepRightEditor(context)
.on('change', function() {
context.map().pan([0,0]); // trigger a redraw
@@ -107,7 +106,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
if (!checkSelectedID()) return;
var selection = context.surface()
.selectAll('.error_id-' + selectedErrorID + '.' + selectedErrorSource);
.selectAll('.error_id-' + selectedErrorID + '.' + selectedErrorService);
if (selection.empty()) {
// Return to browse mode if selected DOM elements have
@@ -153,4 +152,4 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
return mode;
}
}

View File

@@ -1,51 +0,0 @@
import _extend from 'lodash-es/extend';
export function iOsmError() {
if (!(this instanceof iOsmError)) {
return (new iOsmError()).initialize(arguments);
} else if (arguments.length) {
this.initialize(arguments);
}
}
// ImproveOSM has no error IDs unfortunately
// So no way to explicitly refer to each error in their DB
iOsmError.id = function() {
return iOsmError.id.next--;
};
iOsmError.id.next = -1;
_extend(iOsmError.prototype, {
type: 'iOsmError',
source: 'iOSM',
initialize: function(sources) {
for (var i = 0; i < sources.length; ++i) {
var source = sources[i];
for (var prop in source) {
if (Object.prototype.hasOwnProperty.call(source, prop)) {
if (source[prop] === undefined) {
delete this[prop];
} else {
this[prop] = source[prop];
}
}
}
}
if (!this.id) {
this.id = iOsmError.id() + ''; // as string
}
return this;
},
update: function(attrs) {
return iOsmError(this, attrs); // {v: 1 + (this.v || 0)}
}
});

View File

@@ -1,11 +1,10 @@
export { osmChangeset } from './changeset';
export { osmEntity } from './entity';
export { krError } from './keepRight';
export { iOsmError } from './improveOSM';
export { osmNode } from './node';
export { osmNote } from './note';
export { osmRelation } from './relation';
export { osmWay } from './way';
export { qaError } from './qa_error';
export {
osmIntersection,
@@ -27,4 +26,4 @@ export {
osmOneWayTags,
osmPavedTags,
osmIsInterestingTag
} from './tags';
} from './tags';

View File

@@ -1,50 +0,0 @@
import _extend from 'lodash-es/extend';
export function krError() {
if (!(this instanceof krError)) {
return (new krError()).initialize(arguments);
} else if (arguments.length) {
this.initialize(arguments);
}
}
krError.id = function() {
return krError.id.next--;
};
krError.id.next = -1;
_extend(krError.prototype, {
type: 'krError',
source: 'kr',
initialize: function(sources) {
for (var i = 0; i < sources.length; ++i) {
var source = sources[i];
for (var prop in source) {
if (Object.prototype.hasOwnProperty.call(source, prop)) {
if (source[prop] === undefined) {
delete this[prop];
} else {
this[prop] = source[prop];
}
}
}
}
if (!this.id) {
this.id = krError.id() + ''; // as string
}
return this;
},
update: function(attrs) {
return krError(this, attrs); // {v: 1 + (this.v || 0)}
}
});

68
modules/osm/qa_error.js Normal file
View File

@@ -0,0 +1,68 @@
import _extend from 'lodash-es/extend';
import { services } from '../../data/qa_errors.json';
export function qaError() {
if (!(this instanceof qaError)) {
return (new qaError()).initialize(arguments);
} else if (arguments.length) {
this.initialize(arguments);
}
}
// Generic handling for services without nice IDs
qaError.id = function() {
return qaError.id.next--;
};
qaError.id.next = -1;
_extend(qaError.prototype, {
type: 'qaError',
// All errors need a position
loc: [0, 0],
// These should be passed in, used to retrieve from qa_errors.json
service: '',
error_type: '',
initialize: function(sources) {
for (var i = 0; i < sources.length; ++i) {
var source = sources[i];
for (var prop in source) {
if (Object.prototype.hasOwnProperty.call(source, prop)) {
if (source[prop] === undefined) {
delete this[prop];
} else {
this[prop] = source[prop];
}
}
}
}
// Extract common error information from data
if (this.service && this.error_type) {
var serviceInfo = services[this.service];
if (serviceInfo) {
var errInfo = serviceInfo.errorTypes[this.error_type];
if (errInfo) {
this.icon = errInfo.icon;
this.category = errInfo.category;
}
}
}
// All errors must have an ID for selection
if (!this.id) {
this.id = qaError.id() + ''; // as string
}
return this;
},
update: function(attrs) {
return qaError(this, attrs); // {v: 1 + (this.v || 0)}
}
});

View File

@@ -9,7 +9,7 @@ import { json as d3_json } from 'd3-request';
import { request as d3_request } from 'd3-request';
import { geoExtent, geoVecAdd } from '../geo';
import { iOsmError } from '../osm';
import { qaError } from '../osm';
import { services } from './index';
import { t } from '../util/locale';
import { utilRebind, utilTiler, utilQsString } from '../util';
@@ -210,12 +210,13 @@ export default {
// One-ways can land on same segment in opposite direction
loc = preventCoincident(loc, false);
var d = new iOsmError({
var d = new qaError({
// Info required for every error
loc: loc,
comments: null,
error_subtype: '',
service: 'improveOSM',
error_type: k,
icon: 'fas-long-arrow-alt-right',
// Extra details needed for this service
error_key: k,
identifier: { // this is used to post changes to the error
wayId: feature.wayId,
fromNodeId: feature.fromNodeId,
@@ -243,27 +244,20 @@ export default {
// Tiles at high zoom == missing roads
if (data.tiles) {
data.tiles.forEach(function(feature) {
// Average of recorded points should land on the missing geometry
var loc = pointAverage(feature.points);
var geoType = feature.type.toLowerCase();
// Average of recorded points should land on the missing geometry
// Missing geometry could happen to land on another error
var loc = pointAverage(feature.points);
loc = preventCoincident(loc, false);
var geoType = feature.type.toLowerCase();
var geoIcons = {
road: 'maki-car',
parking: 'maki-parking',
both: 'maki-car',
path: 'maki-shoe'
};
var d = new iOsmError({
var d = new qaError({
// Info required for every error
loc: loc,
comments: null,
error_subtype: geoType,
error_type: k,
icon: geoIcons[geoType],
service: 'improveOSM',
error_type: k + '-' + geoType,
// Extra details needed for this service
error_key: k,
identifier: { x: feature.x, y: feature.y },
status: feature.status
});
@@ -281,10 +275,9 @@ export default {
// Entities at high zoom == turn restrictions
if (data.entities) {
data.entities.forEach(function(feature) {
var loc = feature.point;
// Turn restrictions could be missing at same junction
// We also want to bump the error up so node is accessible
var loc = feature.point;
loc = preventCoincident([loc.lon, loc.lat], true);
// Elements are presented in a strange way
@@ -293,24 +286,25 @@ export default {
var via_node = ids[3];
var to_way = ids[2].split(':')[1];
// Travel direction along from_way clarifies the turn restriction
var p1 = feature.segments[0].points[0];
var p2 = feature.segments[0].points[1];
var dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
var d = new iOsmError({
var d = new qaError({
// Info required for every error
loc: loc,
comments: null,
error_subtype: '',
service: 'improveOSM',
error_type: k,
icon: 'temaki-junction',
// Extra details needed for this service
error_key: k,
identifier: feature.id,
object_id: via_node,
object_type: 'node',
status: feature.status
});
// Travel direction along from_way clarifies the turn restriction
var p1 = feature.segments[0].points[0];
var p2 = feature.segments[0].points[1];
var dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
// Variables used in the description
d.replacements = {
num_passed: feature.numberOfPasses,
@@ -351,18 +345,18 @@ export default {
function sendPayload(err, user) {
if (err) { return callback(err, d); }
var type = d.error_type;
var url = _impOsmUrls[type] + '/comment';
var key = d.error_key;
var url = _impOsmUrls[key] + '/comment';
var payload = {
username: user.display_name
};
// Each error type has different data for identification
if (type === 'ow') {
if (key === 'ow') {
payload.roadSegments = [ d.identifier ];
} else if (type === 'mr') {
} else if (key === 'mr') {
payload.tiles = [ d.identifier ];
} else if (type === 'tr') {
} else if (key === 'tr') {
payload.targetIds = [ d.identifier ];
}
@@ -390,7 +384,7 @@ export default {
// No pretty identifier, so we just use coordinates
if (d.newStatus === 'SOLVED') {
var closedID = d.loc[1].toFixed(5) + '/' + d.loc[0].toFixed(5);
_erCache.closed[d.error_type + ':' + closedID] = true;
_erCache.closed[key + ':' + closedID] = true;
}
return callback(err, d);
@@ -417,7 +411,7 @@ export default {
// replace a single error in the cache
replaceError: function(error) {
if (!(error instanceof iOsmError) || !error.id) return;
if (!(error instanceof qaError) || !error.id) return;
_erCache.data[error.id] = error;
updateRtree(encodeErrorRtree(error), true); // true = replace
@@ -426,7 +420,7 @@ export default {
// remove a single error from the cache
removeError: function(error) {
if (!(error instanceof iOsmError) || !error.id) return;
if (!(error instanceof qaError) || !error.id) return;
delete _erCache.data[error.id];
updateRtree(encodeErrorRtree(error), false); // false = remove
@@ -436,4 +430,4 @@ export default {
getClosedIDs: function() {
return Object.keys(_erCache.closed).sort();
}
};
};

View File

@@ -9,7 +9,7 @@ import { json as d3_json } from 'd3-request';
import { request as d3_request } from 'd3-request';
import { geoExtent, geoVecAdd } from '../geo';
import { krError } from '../osm';
import { qaError } from '../osm';
import { t } from '../util/locale';
import { utilRebind, utilTiler, utilQsString } from '../util';
@@ -71,7 +71,7 @@ function updateRtree(item, replace) {
function tokenReplacements(d) {
if (!(d instanceof krError)) return;
if (!(d instanceof qaError)) return;
var htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/);
var replacements = {};
@@ -375,14 +375,17 @@ export default {
coincident = _krCache.rtree.search(bbox).length;
} while (coincident);
var d = new krError({
var d = new qaError({
// Required values
loc: loc,
service: 'keepRight',
error_type: errorType,
// Extra values for this service
id: props.error_id,
comment: props.comment || null,
description: props.description || '',
error_id: props.error_id,
which_type: whichType,
error_type: errorType,
parent_error_type: parentErrorType,
severity: whichTemplate.severity || 'error',
object_id: props.object_id,
@@ -468,7 +471,7 @@ export default {
// replace a single error in the cache
replaceError: function(error) {
if (!(error instanceof krError) || !error.id) return;
if (!(error instanceof qaError) || !error.id) return;
_krCache.data[error.id] = error;
updateRtree(encodeErrorRtree(error), true); // true = replace
@@ -478,7 +481,7 @@ export default {
// remove a single error from the cache
removeError: function(error) {
if (!(error instanceof krError) || !error.id) return;
if (!(error instanceof qaError) || !error.id) return;
delete _krCache.data[error.id];
updateRtree(encodeErrorRtree(error), false); // false = remove
@@ -496,4 +499,4 @@ export default {
return Object.keys(_krCache.closed).sort();
}
};
};

View File

@@ -53,9 +53,9 @@ export function svgImproveOSM(projection, context, dispatch) {
_improveOsmVisible = false;
drawLayer
.style('display', 'none');
drawLayer.selectAll('.qa_error.iOSM')
drawLayer.selectAll('.qa_error.improveOSM')
.remove();
touchLayer.selectAll('.qa_error.iOSM')
touchLayer.selectAll('.qa_error.improveOSM')
.remove();
}
}
@@ -80,7 +80,7 @@ export function svgImproveOSM(projection, context, dispatch) {
function layerOff() {
throttledRedraw.cancel();
drawLayer.interrupt();
touchLayer.selectAll('.qa_error.iOSM')
touchLayer.selectAll('.qa_error.improveOSM')
.remove();
drawLayer
@@ -104,7 +104,7 @@ export function svgImproveOSM(projection, context, dispatch) {
var getTransform = svgPointTransform(projection);
// Draw markers..
var markers = drawLayer.selectAll('.qa_error.iOSM')
var markers = drawLayer.selectAll('.qa_error.improveOSM')
.data(data, function(d) { return d.id; });
// exit
@@ -117,9 +117,10 @@ export function svgImproveOSM(projection, context, dispatch) {
.attr('class', function(d) {
return [
'qa_error',
d.source,
d.service,
'error_id-' + d.id,
'error_type-' + d.error_type + '-' + d.error_subtype
'error_type-' + d.error_type,
'category-' + d.category
].join(' ');
});
@@ -169,7 +170,7 @@ export function svgImproveOSM(projection, context, dispatch) {
if (touchLayer.empty()) return;
var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor ';
var targets = touchLayer.selectAll('.qa_error.iOSM')
var targets = touchLayer.selectAll('.qa_error.improveOSM')
.data(data, function(d) { return d.id; });
// exit
@@ -186,7 +187,7 @@ export function svgImproveOSM(projection, context, dispatch) {
.merge(targets)
.sort(sortY)
.attr('class', function(d) {
return 'qa_error ' + d.source + ' target error_id-' + d.id + ' ' + fillClass;
return 'qa_error ' + d.service + ' target error_id-' + d.id + ' ' + fillClass;
})
.attr('transform', getTransform);
@@ -257,4 +258,4 @@ export function svgImproveOSM(projection, context, dispatch) {
return drawImproveOSM;
}
}

View File

@@ -54,9 +54,9 @@ export function svgKeepRight(projection, context, dispatch) {
_keepRightVisible = false;
drawLayer
.style('display', 'none');
drawLayer.selectAll('.qa_error.kr')
drawLayer.selectAll('.qa_error.keepRight')
.remove();
touchLayer.selectAll('.qa_error.kr')
touchLayer.selectAll('.qa_error.keepRight')
.remove();
}
}
@@ -81,7 +81,7 @@ export function svgKeepRight(projection, context, dispatch) {
function layerOff() {
throttledRedraw.cancel();
drawLayer.interrupt();
touchLayer.selectAll('.qa_error.kr')
touchLayer.selectAll('.qa_error.keepRight')
.remove();
drawLayer
@@ -105,7 +105,7 @@ export function svgKeepRight(projection, context, dispatch) {
var getTransform = svgPointTransform(projection);
// Draw markers..
var markers = drawLayer.selectAll('.qa_error.kr')
var markers = drawLayer.selectAll('.qa_error.keepRight')
.data(data, function(d) { return d.id; });
// exit
@@ -118,7 +118,7 @@ export function svgKeepRight(projection, context, dispatch) {
.attr('class', function(d) {
return [
'qa_error',
d.source,
d.service,
'error_id-' + d.id,
'error_type-' + d.parent_error_type
].join(' ');
@@ -157,7 +157,7 @@ export function svgKeepRight(projection, context, dispatch) {
if (touchLayer.empty()) return;
var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor ';
var targets = touchLayer.selectAll('.qa_error.kr')
var targets = touchLayer.selectAll('.qa_error.keepRight')
.data(data, function(d) { return d.id; });
// exit
@@ -174,7 +174,7 @@ export function svgKeepRight(projection, context, dispatch) {
.merge(targets)
.sort(sortY)
.attr('class', function(d) {
return 'qa_error ' + d.source + ' target error_id-' + d.id + ' ' + fillClass;
return 'qa_error ' + d.service + ' target error_id-' + d.id + ' ' + fillClass;
})
.attr('transform', getTransform);
@@ -247,4 +247,4 @@ export function svgKeepRight(projection, context, dispatch) {
return drawKeepRight;
}
}

View File

@@ -17,7 +17,7 @@ export function uiImproveOsmDetails(context) {
var unknown = t('inspector.unknown');
if (!d) return unknown;
var errorType = d.error_type;
var errorType = d.error_key;
var et = dataEn.QA.improveOSM.error_types[errorType];
var detail;
@@ -124,4 +124,4 @@ export function uiImproveOsmDetails(context) {
return improveOsmDetails;
}
}

View File

@@ -10,7 +10,7 @@ export function uiImproveOsmHeader() {
var unknown = t('inspector.unknown');
if (!d) return unknown;
var errorType = d.error_type;
var errorType = d.error_key;
var et = dataEn.QA.improveOSM.error_types[errorType];
if (et && et.title) {
@@ -46,7 +46,14 @@ export function uiImproveOsmHeader() {
.attr('height', '30px')
.attr('viewbox', '0 0 20 30')
.attr('class', function(d) {
return 'preset-icon-28 qa_error ' + d.source + ' error_id-' + d.id + ' error_type-' + d.error_type + '-' + d.error_subtype;
return [
'preset-icon-28',
'qa_error',
d.service,
'error_id-' + d.id,
'error_type-' + d.error_type,
'category-' + d.category
].join(' ');
});
svgEnter
@@ -87,4 +94,4 @@ export function uiImproveOsmHeader() {
return improveOsmHeader;
}
}

View File

@@ -49,7 +49,7 @@ export function uiKeepRightHeader() {
iconEnter
.append('div')
.attr('class', function(d) {
return 'preset-icon-28 qa_error ' + d.source + ' error_id-' + d.id + ' error_type-' + d.parent_error_type;
return 'preset-icon-28 qa_error ' + d.service + ' error_id-' + d.id + ' error_type-' + d.parent_error_type;
})
.call(svgIcon('#iD-icon-bolt', 'qa_error-fill'));
@@ -68,4 +68,4 @@ export function uiKeepRightHeader() {
return keepRightHeader;
}
}

View File

@@ -9,7 +9,7 @@ import {
selectAll as d3_selectAll
} from 'd3-selection';
import { osmEntity, osmNote, iOsmError, krError } from '../osm';
import { osmEntity, osmNote, qaError } from '../osm';
import { services } from '../services';
import {
uiDataEditor,
@@ -31,8 +31,7 @@ export function uiSidebar(context) {
var _current;
var _wasData = false;
var _wasNote = false;
var _wasIOsmError = false;
var _wasKRError = false;
var _wasQAError = false;
function sidebar(selection) {
@@ -140,36 +139,23 @@ export function uiSidebar(context) {
selection.selectAll('.sidebar-component')
.classed('inspector-hover', true);
} else if (datum instanceof iOsmError) {
_wasIOsmError = true;
} else if (datum instanceof qaError) {
_wasQAError = true;
var improveOSM = services.improveOSM;
if (improveOSM) {
datum = improveOSM.getError(datum.id);
var errService = services[datum.service];
if (errService) {
// marker may contain stale data - get latest
datum = errService.getError(datum.id);
}
d3_selectAll('.iOSM.qa_error')
// Temporary solution while only two services
var errEditor = (datum.service === 'keepRight') ? keepRightEditor : improveOsmEditor;
d3_selectAll('.qa_error.' + datum.service)
.classed('hover', function(d) { return d.id === datum.id; });
sidebar
.show(improveOsmEditor.error(datum));
selection.selectAll('.sidebar-component')
.classed('inspector-hover', true);
} else if (datum instanceof krError) {
_wasKRError = true;
var keepRight = services.keepRight;
if (keepRight) {
datum = keepRight.getError(datum.id); // marker may contain stale data - get latest
}
d3_selectAll('.kr.qa_error')
.classed('hover', function(d) { return d.id === datum.id; });
sidebar
.show(keepRightEditor.error(datum));
.show(errEditor.error(datum));
selection.selectAll('.sidebar-component')
.classed('inspector-hover', true);
@@ -199,13 +185,12 @@ export function uiSidebar(context) {
inspector
.state('hide');
} else if (_wasData || _wasNote || _wasIOsmError || _wasKRError) {
} else if (_wasData || _wasNote || _wasQAError) {
_wasNote = false;
_wasData = false;
_wasIOsmError = false;
_wasKRError = false;
_wasQAError = false;
d3_selectAll('.note').classed('hover', false);
d3_selectAll('.kr_error').classed('hover', false);
d3_selectAll('.qa_error').classed('hover', false);
sidebar.hide();
}
}
@@ -366,4 +351,4 @@ export function uiSidebar(context) {
sidebar.toggle = function() {};
return sidebar;
}
}

View File

@@ -1,7 +1,7 @@
import { t } from '../util/locale';
import { services } from '../services';
import { svgIcon } from '../svg';
import { krError } from '../osm';
import { qaError } from '../osm';
export function uiViewOnKeepRight() {
@@ -10,7 +10,7 @@ export function uiViewOnKeepRight() {
function viewOnKeepRight(selection) {
var url;
if (services.keepRight && (_error instanceof krError)) {
if (services.keepRight && (_error instanceof qaError)) {
url = services.keepRight.errorURL(_error);
}
@@ -42,4 +42,4 @@ export function uiViewOnKeepRight() {
};
return viewOnKeepRight;
}
}