From 781558e56be636b2602cb436bb2151aa8ee87820 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Mon, 4 Feb 2019 18:29:46 +0000 Subject: [PATCH] Remove redundant source property --- css/65_data.css | 76 ++++++++++++++++----------------- data/qa_errors.json | 2 - modules/behavior/hover.js | 2 +- modules/behavior/select.js | 2 +- modules/modes/select_error.js | 15 +++---- modules/osm/qa_error.js | 1 - modules/svg/improveOSM.js | 14 +++--- modules/svg/keepRight.js | 16 +++---- modules/ui/improveOSM_header.js | 2 +- modules/ui/keepRight_header.js | 4 +- modules/ui/sidebar.js | 4 +- 11 files changed, 67 insertions(+), 71 deletions(-) diff --git a/css/65_data.css b/css/65_data.css index 47d1c03a2..2b19ae553 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -57,98 +57,98 @@ /* 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; } diff --git a/data/qa_errors.json b/data/qa_errors.json index ae29b13bd..d14306dcd 100644 --- a/data/qa_errors.json +++ b/data/qa_errors.json @@ -1,7 +1,6 @@ { "services": { "improveOSM": { - "shortName": "iOSM", "errorTypes": { "ow": { "icon": "fas-long-arrow-alt-right", @@ -30,7 +29,6 @@ } }, "keepRight": { - "shortName": "kr", "errorTypes": { } diff --git a/modules/behavior/hover.js b/modules/behavior/hover.js index c62d2bdd1..40cd68be3 100644 --- a/modules/behavior/hover.js +++ b/modules/behavior/hover.js @@ -114,7 +114,7 @@ export function behaviorHover(context) { } 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; diff --git a/modules/behavior/select.js b/modules/behavior/select.js index 541535255..7942026db 100644 --- a/modules/behavior/select.js +++ b/modules/behavior/select.js @@ -173,7 +173,7 @@ export function behaviorSelect(context) { } else if (datum instanceof qaError & !isMultiselect) { // clicked an external QA 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); diff --git a/modules/modes/select_error.js b/modules/modes/select_error.js index 4f7645644..0293d79de 100644 --- a/modules/modes/select_error.js +++ b/modules/modes/select_error.js @@ -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 @@ -153,4 +152,4 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) { return mode; -} +} \ No newline at end of file diff --git a/modules/osm/qa_error.js b/modules/osm/qa_error.js index ad1b1858a..a5c9fd20d 100644 --- a/modules/osm/qa_error.js +++ b/modules/osm/qa_error.js @@ -47,7 +47,6 @@ _extend(qaError.prototype, { if (serviceInfo) { var errInfo = serviceInfo.errorTypes[this.error_type]; - this.source = serviceInfo.shortName; if (errInfo) { this.icon = errInfo.icon; this.category = errInfo.category; diff --git a/modules/svg/improveOSM.js b/modules/svg/improveOSM.js index f10be4823..33dd71dec 100644 --- a/modules/svg/improveOSM.js +++ b/modules/svg/improveOSM.js @@ -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,7 +117,7 @@ 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, 'category-' + d.category @@ -170,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 @@ -187,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); diff --git a/modules/svg/keepRight.js b/modules/svg/keepRight.js index 126ffd320..dffb7bddb 100644 --- a/modules/svg/keepRight.js +++ b/modules/svg/keepRight.js @@ -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; -} +} \ No newline at end of file diff --git a/modules/ui/improveOSM_header.js b/modules/ui/improveOSM_header.js index 381118a81..c1cd579c4 100644 --- a/modules/ui/improveOSM_header.js +++ b/modules/ui/improveOSM_header.js @@ -49,7 +49,7 @@ export function uiImproveOsmHeader() { return [ 'preset-icon-28', 'qa_error', - d.source, + d.service, 'error_id-' + d.id, 'error_type-' + d.error_type, 'category-' + d.category diff --git a/modules/ui/keepRight_header.js b/modules/ui/keepRight_header.js index 534ecaf73..0e611c74f 100644 --- a/modules/ui/keepRight_header.js +++ b/modules/ui/keepRight_header.js @@ -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; -} +} \ No newline at end of file diff --git a/modules/ui/sidebar.js b/modules/ui/sidebar.js index dfa71f4eb..a25df48d2 100644 --- a/modules/ui/sidebar.js +++ b/modules/ui/sidebar.js @@ -149,9 +149,9 @@ export function uiSidebar(context) { } // Temporary solution while only two services - var errEditor = (datum.source === 'kr') ? keepRightEditor : improveOsmEditor; + var errEditor = (datum.service === 'keepRight') ? keepRightEditor : improveOsmEditor; - d3_selectAll('.qa_error.' + datum.source) + d3_selectAll('.qa_error.' + datum.service) .classed('hover', function(d) { return d.id === datum.id; }); sidebar