diff --git a/data/core.yaml b/data/core.yaml index e02da4df8..8c7abe536 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -480,15 +480,15 @@ en: notes: tooltip: Note data from OpenStreetMap title: OpenStreetMap notes + keepRight: + tooltip: Quality Assurance data from keepright.at + title: KeepRight Issues custom: tooltip: "Drag and drop a data file onto the page, or click the button to setup" title: Custom Map Data zoom: Zoom to data fill_area: Fill Areas map_features: Map Features - QA: - title: Quality Assurance - keepRight: KeepRight autohidden: "These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them." osmhidden: "These features have been automatically hidden because the OpenStreetMap layer is hidden." feature: diff --git a/dist/locales/en.json b/dist/locales/en.json index fac72b207..818afff40 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -583,6 +583,10 @@ "tooltip": "Note data from OpenStreetMap", "title": "OpenStreetMap notes" }, + "keepRight": { + "tooltip": "Quality Assurance data from keepright.at", + "title": "KeepRight Issues" + }, "custom": { "tooltip": "Drag and drop a data file onto the page, or click the button to setup", "title": "Custom Map Data", @@ -591,10 +595,6 @@ }, "fill_area": "Fill Areas", "map_features": "Map Features", - "QA": { - "title": "Quality Assurance", - "keepRight": "KeepRight" - }, "autohidden": "These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them.", "osmhidden": "These features have been automatically hidden because the OpenStreetMap layer is hidden." }, @@ -1130,7 +1130,27 @@ }, "_360": { "description": "language unknown", - "tooltip": "It would be nice if this {var1} had an additional tag name:XX={var2} where XX shows the language of its name {var2}", + "tooltip": "It would be nice if this {var1} had an additional tag name:XX={var2} where XX shows the language of its name {var2}" + }, + "_390": { + "description": "missing tracktype", + "tooltip": "This track doesn't have a tracktype" + } + } + } + }, + "gpx": { + "local_layer": "Add a GPX", + "drag_drop": "Drag and drop a .gpx, .geojson or .kml file on the page, or click the button to the right to browse", + "zoom": "Zoom to layer", + "browse": "Browse for a file" + }, + "mvt": { + "local_layer": "Add a MVT", + "drag_drop": "Drag and drop a .mvt or .pbf file on the page, or click the button to the right to browse", + "zoom": "Zoom to layer", + "browse": "Browse for a file" + }, "QA": { "keepRight": { "tooltip": "automatically detected errors from keepright.at", @@ -8386,37 +8406,6 @@ "name": "basemap.at Orthofoto" }, "eufar-balaton": { -<<<<<<< HEAD - "attribution": { - "text": "EUFAR Balaton ortofotó 2010" - }, - "description": "1940 geo-tagged photography from Balaton Limnological Institute.", - "name": "EUFAR Balaton orthophotos" - }, - "finds.jp_KBN_2500": { - "attribution": { - "text": "GSI KIBAN 2500" - }, - "description": "GSI Kiban 2500 via finds.jp. Good for tracing, but a bit older.", - "name": "Japan GSI KIBAN 2500" - }, - "gsi.go.jp": { - "attribution": { - "text": "GSI Japan" - }, - "description": "Japan GSI ortho Imagery. Usually better than bing, but a bit older.", - "name": "Japan GSI ortho Imagery" - }, - "gsi.go.jp_std_map": { - "attribution": { - "text": "GSI Japan" - }, - "description": "Japan GSI Standard Map. Widely covered.", - "name": "Japan GSI Standard Map" - }, - "hike_n_bike": { -======= ->>>>>>> added: notes and todos for keepRight "attribution": { "text": "EUFAR Balaton ortofotó 2010" }, @@ -9538,4 +9527,4 @@ } } } -} +} \ No newline at end of file diff --git a/modules/modes/select_data.js b/modules/modes/select_data.js index de9b6513e..ad257b8e6 100644 --- a/modules/modes/select_data.js +++ b/modules/modes/select_data.js @@ -1,4 +1,3 @@ - import { geoBounds as d3_geoBounds } from 'd3-geo'; import { diff --git a/modules/modes/select_error.js b/modules/modes/select_error.js index 8af12b722..b66be72d6 100644 --- a/modules/modes/select_error.js +++ b/modules/modes/select_error.js @@ -3,8 +3,6 @@ import { select as d3_select } from 'd3-selection'; -import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js'; - import { behaviorBreathe, behaviorHover, @@ -13,8 +11,9 @@ import { } from '../behavior'; import { services } from '../services'; -import { modeBrowse } from './browse'; +import { modeBrowse, modeDragNode, modeDragNote } from '../modes'; import { uiKeepRightEditor } from '../ui'; +import { utilKeybinding } from '../util'; export function modeSelectError(context, selectedErrorID) { @@ -24,7 +23,7 @@ export function modeSelectError(context, selectedErrorID) { }; var keepRight = services.keepRight; - var keybinding = d3_keybinding('select-error'); + var keybinding = utilKeybinding('select-error'); var keepRightEditor = uiKeepRightEditor(context) .on('change', function() { context.map().pan([0,0]); // trigger a redraw @@ -39,6 +38,8 @@ export function modeSelectError(context, selectedErrorID) { behaviorHover(context), behaviorSelect(context), behaviorLasso(context), + modeDragNode(context).behavior, + modeDragNote(context).behavior ]; @@ -51,6 +52,7 @@ export function modeSelectError(context, selectedErrorID) { return error; } + mode.enter = function() { // class the error as selected, or return to browse mode if the error is gone @@ -76,48 +78,45 @@ export function modeSelectError(context, selectedErrorID) { } function esc() { + if (d3_select('.combobox').size()) return; context.enter(modeBrowse(context)); } var error = checkSelectedID(); if (!error) return; - behaviors.forEach(function(behavior) { - context.install(behavior); - }); - - keybinding - .on('⎋', esc, true); + behaviors.forEach(context.install); + keybinding.on('⎋', esc, true); d3_select(document) .call(keybinding); selectError(); - context.ui().sidebar - .show(keepRightEditor.error(error)); + var sidebar = context.ui().sidebar; + sidebar.show(keepRightEditor.error(error)); context.map() - .on('drawn.select', selectError); + .on('drawn.select-error', selectError); }; mode.exit = function() { - behaviors.forEach(function(behavior) { - context.uninstall(behavior); - }); + behaviors.forEach(context.uninstall); - keybinding.off(); + d3_select(document) + .call(keybinding.unbind); context.surface() .selectAll('.kr_error.selected') .classed('selected hover', false); context.map() - .on('drawn.select', null); + .on('drawn.select-error', null); context.ui().sidebar .hide(); + context.selectedErrorID(null); }; diff --git a/modules/renderer/map.js b/modules/renderer/map.js index 170d4a90e..ed6895871 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -355,7 +355,7 @@ export function rendererMap(context) { var mode = context.mode(); if (mode && mode.id !== 'save' && mode.id !== 'select-note' && - mode.id !== 'select-data' && && mode.id !== 'select-error') { + mode.id !== 'select-data' && mode.id !== 'select-error') { context.enter(modeBrowse(context)); } diff --git a/modules/svg/geolocate.js b/modules/svg/geolocate.js index f5ca10f97..9b025e586 100644 --- a/modules/svg/geolocate.js +++ b/modules/svg/geolocate.js @@ -2,9 +2,9 @@ import { select as d3_select } from 'd3-selection'; import { svgPointTransform } from './helpers'; import { geoMetersToLat } from '../geo'; -import _throttle from 'lodash-es/throttle'; -export function svgGeolocate(projection, context, dispatch) { + +export function svgGeolocate(projection) { var layer = d3_select(null); var _position; diff --git a/modules/ui/keepRight_comment.js b/modules/ui/keepRight_comment.js index 5893a039a..9a868f487 100644 --- a/modules/ui/keepRight_comment.js +++ b/modules/ui/keepRight_comment.js @@ -1,5 +1,3 @@ -import { select as d3_select } from 'd3-selection'; - import { t } from '../util/locale'; import { svgIcon } from '../svg'; import { services } from '../services'; @@ -28,9 +26,9 @@ export function uiKeepRightComment() { .text(_error.comment); } - keepRightComment.error = function(_) { + keepRightComment.error = function(val) { if (!arguments.length) return _error; - _error = _; + _error = val; return keepRightComment; }; diff --git a/modules/ui/keepRight_details.js b/modules/ui/keepRight_details.js index 2a330b688..0092c535d 100644 --- a/modules/ui/keepRight_details.js +++ b/modules/ui/keepRight_details.js @@ -1,6 +1,5 @@ import { t } from '../util/locale'; import { parseErrorDescriptions, errorTypes } from '../util'; -import { select as d3_selectAll } from 'd3-selection'; import { clickLink } from '../util/keepRight'; diff --git a/modules/ui/map_data.js b/modules/ui/map_data.js index 316369abd..a96b255cf 100644 --- a/modules/ui/map_data.js +++ b/modules/ui/map_data.js @@ -22,8 +22,6 @@ export function uiMapData(context) { var key = t('map_data.key'); var features = context.features().keys(); - var QAs = ['keepRight']; - // var errors = Object.keys(errorTypes.errors); // TODO: add warnings var layers = context.layers(); var fills = ['wireframe', 'partial', 'full']; @@ -36,7 +34,6 @@ export function uiMapData(context) { var _fillList = d3_select(null); var _featureList = d3_select(null); var _QAList = d3_select(null); - // var _KeepRightList = d3_select(null); function showsFeature(d) { @@ -57,7 +54,6 @@ export function uiMapData(context) { function showsQA(d) { - var QAKeys = [d]; var QALayers = layers.all().filter(function(obj) { return QAKeys.indexOf(obj.id) !== -1; }); var data = QALayers.filter(function(obj) { return obj.layer.supported(); }); @@ -70,18 +66,8 @@ export function uiMapData(context) { } return layerEnabled(data[0]); - } - // function clickError(d) { - - // } - - - // function showsError(d) { - - // } - function showsFill(d) { return _fillSelected === d; @@ -242,6 +228,58 @@ export function uiMapData(context) { } + function drawQAItems(selection) { + var qaKeys = ['keepRight']; + var qaLayers = layers.all().filter(function(obj) { return qaKeys.indexOf(obj.id) !== -1; }); + + var ul = selection + .selectAll('.layer-list-qa') + .data([0]); + + ul = ul.enter() + .append('ul') + .attr('class', 'layer-list layer-list-qa') + .merge(ul); + + var li = ul.selectAll('.list-item') + .data(qaLayers); + + li.exit() + .remove(); + + var liEnter = li.enter() + .append('li') + .attr('class', function(d) { return 'list-item list-item-' + d.id; }); + + var labelEnter = liEnter + .append('label') + .each(function(d) { + d3_select(this) + .call(tooltip() + .title(t('map_data.layers.' + d.id + '.tooltip')) + .placement('bottom') + ); + }); + + labelEnter + .append('input') + .attr('type', 'checkbox') + .on('change', function(d) { toggleLayer(d.id); }); + + labelEnter + .append('span') + .text(function(d) { return t('map_data.layers.' + d.id + '.title'); }); + + + // Update + li + .merge(liEnter) + .classed('active', function (d) { return d.layer.enabled(); }) + .selectAll('input') + .property('checked', function (d) { return d.layer.enabled(); }); + } + + // Beta feature - sample vector layers to support Detroit Mapping Challenge // https://github.com/osmus/detroit-mapping-challenge function drawVectorItems(selection) { @@ -451,9 +489,6 @@ export function uiMapData(context) { var QAButtons = d3_select('.layer-QA').selectAll('li').select('label').select('input'); var buttonSection = selection.selectAll('.QA-buttons') .data([0]); - // function drawQAButtons(selection) { - - // var QAButtons = d3_select('.layer-QA').selectAll('li').select('label').select('input'); // var buttonSection = selection.selectAll('.QA-buttons') // .data([0]); @@ -487,7 +522,7 @@ export function uiMapData(context) { // buttonSection = buttonSection // .merge(buttonEnter); - // } + } function drawListItems(selection, data, type, name, change, active) { @@ -578,30 +613,10 @@ export function uiMapData(context) { } - function renderQAList(selection) { - var container = selection.selectAll('layer-QA') - .data([0]); - - _QAList = container.enter() - .append('ul') - .attr('class', 'layer-list layer-QA') - .merge(container); - } - - // function renderKeepRightList(selection) { - // var container = selection.selectAll('layer-keepRight') - // .data([0]); - - // _KeepRightList = container.enter() - // .append('ul') - // .attr('class', 'layer-list layer-keepRight') - // .merge(container); - // } - - function update() { _dataLayerContainer .call(drawOsmItems) + .call(drawQAItems) .call(drawPhotoItems) .call(drawCustomDataItems) .call(drawVectorItems); // Beta - Detroit mapping challenge @@ -613,12 +628,7 @@ export function uiMapData(context) { .call(drawListItems, features, 'checkbox', 'feature', clickFeature, showsFeature); _QAList - .call(drawListItems, QAs, 'checkbox', 'QA', function(d) { toggleLayer(d); }, showsQA); - - // _KeepRightList - // .call(drawListItems, errors, 'checkbox', 'QA.keepRight.errorTypes.errors', clickError, showsError); - // d3_select('.disclosure-wrap-QA') - // .call(drawQAButtons); + .call(drawListItems, ['keep-right'], 'checkbox', 'QA', function(d) { toggleLayer(d); }, showsQA); } @@ -718,6 +728,7 @@ export function uiMapData(context) { .append('div') .attr('class', 'pane-content'); + // data layers content .append('div') @@ -745,31 +756,11 @@ export function uiMapData(context) { .content(renderFeatureList) ); - // Q/A tools - content - .append('div') - .attr('class', 'map-data-QA') - .call(uiDisclosure(context, 'QA', false) - .title(t('map_data.QA.title')) - .content(renderQAList) - ); - - // // adding keepRight sublayers - // QA_list - // .append('div') - // .attr('class', 'keepRight-errors') - // .call(uiDisclosure(context, 'keepRight', false) - // .title(t('map_data.QA.keepRight')) - // .content(renderKeepRightList) - // ); - // add listeners context.features() .on('change.map_data-update', update); - // context.errors() - // .on('change.map_data-update', update); // TODO: add errors list to context? update(); setFill(_fillSelected); diff --git a/modules/ui/sidebar.js b/modules/ui/sidebar.js index c0b6a9a98..576ea072c 100644 --- a/modules/ui/sidebar.js +++ b/modules/ui/sidebar.js @@ -125,14 +125,14 @@ export function uiSidebar(context) { selection.selectAll('.sidebar-component') .classed('inspector-hover', true); - } else if (what instanceof krError) { + } else if (datum instanceof krError) { _was_krError = true; var kr_errors = d3_selectAll('.kr_error'); kr_errors - .classed('hover', function(d) { return d === what; }); + .classed('hover', function(d) { return d === datum; }); sidebar - .show(keepRightEditor.error(what)); + .show(keepRightEditor.error(datum)); selection.selectAll('.sidebar-component') .classed('inspector-hover', true); diff --git a/modules/util/keepRight/keepRight_error.js b/modules/util/keepRight/keepRight_error.js index f74a49ae1..6e50728a4 100644 --- a/modules/util/keepRight/keepRight_error.js +++ b/modules/util/keepRight/keepRight_error.js @@ -6,50 +6,6 @@ import { krError } from '../../osm'; import { errorTypes } from './errorSchema.json'; import { parseError } from './parse_error'; -// TODO: for reference; remove -var keepRightSchema = { - 'schema': '', - 'id': 0, - 'error_type': 0, - 'error_name': 0, - 'object_type': [ - 'node', - 'way', - 'relation' - ], - 'object_id': 0, - 'state': [ - 'new', - 'reopened', - 'ignore_temporarily', - 'ignore' - ], - 'first_occurrence': new Date(), - 'last_checked': new Date(), - 'object_timestamp': new Date(), - 'user_name': '', - 'lat': 0, - 'lon': 0, - 'comment': '', - 'comment_timestamp': new Date(), - 'msgid': '', - 'txt1': '', - 'txt2': '', - 'txt3': '', - 'txt4': '', - 'txt5': '' - }; -// TODO: for reference; remove -var keepRightSchemaFromWeb = { - 'error_type': '192', - 'object_type': 'way', - 'object_id': '339948768', - 'comment': null, - 'error_id': '92854860', - 'schema': '58', - 'description': 'This waterway intersects the highway #450282565', - 'title': 'intersections without junctions, highway-waterway' -}; export function parseErrorDescriptions(entity) { var parsedDetails = {}; diff --git a/test/spec/svg/layers.js b/test/spec/svg/layers.js index 16aeed0ed..f2277229c 100644 --- a/test/spec/svg/layers.js +++ b/test/spec/svg/layers.js @@ -27,7 +27,6 @@ describe('iD.svgLayers', function () { container.call(iD.svgLayers(projection, context)); var nodes = container.selectAll('svg .data-layer').nodes(); expect(nodes.length).to.eql(10); -<<<<<<< HEAD expect(d3.select(nodes[0]).classed('osm')).to.be.true; expect(d3.select(nodes[1]).classed('notes')).to.be.true; expect(d3.select(nodes[2]).classed('data')).to.be.true; @@ -38,18 +37,6 @@ describe('iD.svgLayers', function () { expect(d3.select(nodes[7]).classed('debug')).to.be.true; expect(d3.select(nodes[8]).classed('geolocate')).to.be.true; expect(d3.select(nodes[9]).classed('touch')).to.be.true; -======= - expect(d3.select(nodes[0]).classed('data-layer-osm')).to.be.true; - expect(d3.select(nodes[1]).classed('data-layer-notes')).to.be.true; - expect(d3.select(nodes[2]).classed('data-layer-keepRight')).to.be.true; - expect(d3.select(nodes[3]).classed('data-layer-gpx')).to.be.true; - expect(d3.select(nodes[4]).classed('data-layer-mvt')).to.be.true; - expect(d3.select(nodes[5]).classed('data-layer-streetside')).to.be.true; - expect(d3.select(nodes[6]).classed('data-layer-mapillary-images')).to.be.true; - expect(d3.select(nodes[7]).classed('data-layer-mapillary-signs')).to.be.true; - expect(d3.select(nodes[8]).classed('data-layer-openstreetcam-images')).to.be.true; - expect(d3.select(nodes[9]).classed('data-layer-debug')).to.be.true; ->>>>>>> displaying keep right (currently as notes) }); });