From 6be72709d544b02d2c6aee8dd4d0e93b1738e0f0 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 2 Feb 2019 11:51:37 -0500 Subject: [PATCH 1/6] Adjust tag_classes perimeter overrides to style barriers as lines (closes #5761) --- css/25_areas.css | 1 - css/50_misc.css | 6 +++++- modules/svg/tag_classes.js | 18 +++++++++++++----- test/spec/svg/tag_classes.js | 19 +++++++++++++++++++ 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/css/25_areas.css b/css/25_areas.css index ca964e54e..7e6d9f41a 100644 --- a/css/25_areas.css +++ b/css/25_areas.css @@ -31,7 +31,6 @@ path.stroke.tag-leisure-track, path.stroke.tag-leisure-golf_course, path.stroke.tag-leisure-garden, path.stroke.tag-leisure-park, -path.stroke.tag-barrier-hedge, path.stroke.tag-landuse-forest, path.stroke.tag-landuse-wood, path.stroke.tag-landuse-grass { diff --git a/css/50_misc.css b/css/50_misc.css index 0e3e726e2..a8dcd4c95 100644 --- a/css/50_misc.css +++ b/css/50_misc.css @@ -95,9 +95,13 @@ path.line.stroke.tag-natural-tree_row { /* barriers and similar */ -path.line.stroke.tag-barrier:not(.tag-barrier-hedge) { +path.line.stroke.tag-barrier { stroke: #ddd; } +path.line.stroke.tag-barrier-hedge { + stroke: rgb(140, 208, 95); +} + path.line.stroke.tag-barrier, path.line.stroke.tag-man_made-groyne, path.line.stroke.tag-man_made-breakwater { diff --git a/modules/svg/tag_classes.js b/modules/svg/tag_classes.js index 588fad521..8d4a195cd 100644 --- a/modules/svg/tag_classes.js +++ b/modules/svg/tag_classes.js @@ -30,21 +30,29 @@ export function svgTagClasses() { } var t = _tags(entity); - var isMultiPolygon = (t.type === 'multipolygon'); - var shouldRenderLineAsArea = isMultiPolygon && !entity.hasInterestingTags(); - var i, k, v; + // in some situations we want to render perimeter strokes a certain way + var overrideGeometry; + if (/\bstroke\b/.test(value)) { + if (!!t.barrier && t.barrier !== 'no') { + overrideGeometry = 'line'; + } else if (t.type === 'multipolygon' && !entity.hasInterestingTags()) { + overrideGeometry = 'area'; + } + } + // preserve base classes (nothing with `tag-`) var classes = value.trim().split(/\s+/) .filter(function(klass) { return klass.length && !/^tag-/.test(klass); }) - .map(function(klass) { // style multipolygon inner/outers as areas not lines - return (klass === 'line' && shouldRenderLineAsArea) ? 'area' : klass; + .map(function(klass) { // special overrides for some perimeter strokes + return (klass === 'line' || klass === 'area') ? (overrideGeometry || klass) : klass; }); + // pick at most one primary classification tag.. for (i = 0; i < primaries.length; i++) { k = primaries[i]; diff --git a/test/spec/svg/tag_classes.js b/test/spec/svg/tag_classes.js index 8baa177dd..2df7caeb1 100644 --- a/test/spec/svg/tag_classes.js +++ b/test/spec/svg/tag_classes.js @@ -209,6 +209,25 @@ describe('iD.svgTagClasses', function () { expect(selection.attr('class')).to.equal('selected'); }); + it('stroke overrides: renders areas with barriers as lines', function() { + selection + .attr('class', 'way area stroke') + .datum(iD.osmEntity({tags: {landuse: 'residential', barrier: 'hedge'}})) + .call(iD.svgTagClasses()); + expect(selection.classed('area')).to.be.false; + expect(selection.classed('line')).to.be.true; + }); + + it('stroke overrides: renders simple multipolygon lines as areas', function() { + var multipolygon = function () { return { type: 'multipolygon' }; }; + selection + .attr('class', 'way line stroke') + .datum(iD.osmEntity({tags: {}})) + .call(iD.svgTagClasses().tags(multipolygon)); + expect(selection.classed('area')).to.be.true; + expect(selection.classed('line')).to.be.false; + }); + it('works on SVG elements', function() { selection = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'g')); selection From 96a15934cac472a95380b969820130f5efb74d81 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 2 Feb 2019 12:05:19 -0500 Subject: [PATCH 2/6] Don't snake_case values for `destination` and `destination:ref` fields (closes #5842) But continue to snake_case the values for `destination:symbol` --- data/presets/fields.json | 4 ++-- data/presets/fields/destination/ref_oneway.json | 3 ++- data/presets/fields/destination_oneway.json | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/data/presets/fields.json b/data/presets/fields.json index 4080e533d..c578d98a1 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -84,8 +84,8 @@ "denotation": {"key": "denotation", "type": "combo", "label": "Denotation"}, "description": {"key": "description", "type": "textarea", "label": "Description", "universal": true}, "design": {"key": "design", "type": "combo", "label": "Design"}, - "destination_oneway": {"key": "destination", "type": "semiCombo", "label": "Destinations", "prerequisiteTag": {"key": "oneway", "value": "yes"}}, - "destination/ref_oneway": {"key": "destination:ref", "type": "semiCombo", "label": "Destination Road Numbers", "prerequisiteTag": {"key": "oneway", "value": "yes"}}, + "destination_oneway": {"key": "destination", "type": "semiCombo", "label": "Destinations", "prerequisiteTag": {"key": "oneway", "value": "yes"}, "snake_case": false}, + "destination/ref_oneway": {"key": "destination:ref", "type": "semiCombo", "label": "Destination Road Numbers", "prerequisiteTag": {"key": "oneway", "value": "yes"}, "snake_case": false}, "destination/symbol_oneway": {"key": "destination:symbol", "type": "semiCombo", "label": "Destination Symbols", "prerequisiteTag": {"key": "oneway", "value": "yes"}}, "devices": {"key": "devices", "type": "number", "minValue": 0, "label": "Devices", "placeholder": "1, 2, 3..."}, "diaper": {"key": "diaper", "type": "combo", "label": "Diaper Changing Available", "options": ["yes", "no", "room", "1", "2", "3", "4", "5"]}, diff --git a/data/presets/fields/destination/ref_oneway.json b/data/presets/fields/destination/ref_oneway.json index fc360f211..71fe8dec1 100644 --- a/data/presets/fields/destination/ref_oneway.json +++ b/data/presets/fields/destination/ref_oneway.json @@ -5,5 +5,6 @@ "prerequisiteTag": { "key": "oneway", "value": "yes" - } + }, + "snake_case": false } diff --git a/data/presets/fields/destination_oneway.json b/data/presets/fields/destination_oneway.json index 2f71c079b..1d5bc9db8 100644 --- a/data/presets/fields/destination_oneway.json +++ b/data/presets/fields/destination_oneway.json @@ -5,5 +5,6 @@ "prerequisiteTag": { "key": "oneway", "value": "yes" - } + }, + "snake_case": false } From f1b5efc81a77701475a1a620d18318bbc4e22612 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 2 Feb 2019 15:30:42 -0500 Subject: [PATCH 3/6] Revise the list of oneway aerialways (notably, drop `yes`) (re: #5843) --- modules/osm/tags.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/osm/tags.js b/modules/osm/tags.js index 3b7824ec4..0e08dfa19 100644 --- a/modules/osm/tags.js +++ b/modules/osm/tags.js @@ -10,13 +10,14 @@ export function osmIsInterestingTag(key) { export var osmOneWayTags = { 'aerialway': { 'chair_lift': true, - 'mixed_lift': true, - 't-bar': true, + 'drag_lift': true, 'j-bar': true, + 'magic_carpet': true, + 'mixed_lift': true, 'platter': true, 'rope_tow': true, - 'magic_carpet': true, - 'yes': true + 't-bar': true, + 'zipline': true }, 'highway': { 'motorway': true From ebdf6431f73f159759886cf1cf58441c7b04abc7 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 2 Feb 2019 15:32:36 -0500 Subject: [PATCH 4/6] Support classing of aerialway and piste, and adjust line widths (closes #5843) --- css/50_misc.css | 118 ++++++++++++++++++++++--------------- modules/svg/tag_classes.js | 8 ++- 2 files changed, 77 insertions(+), 49 deletions(-) diff --git a/css/50_misc.css b/css/50_misc.css index a8dcd4c95..265d641bb 100644 --- a/css/50_misc.css +++ b/css/50_misc.css @@ -1,4 +1,56 @@ +/* narrow width miscellanous things */ +path.line.shadow.tag-aerialway, +path.line.shadow.tag-attraction-summer_toboggan, +path.line.shadow.tag-attraction-water_slide, +path.line.shadow.tag-man_made-pipeline, +path.line.shadow.tag-natural-tree_row, +path.line.shadow.tag-piste { + stroke-width: 16; +} +path.line.casing.tag-aerialway, +path.line.casing.tag-attraction-summer_toboggan, +path.line.casing.tag-attraction-water_slide, +path.line.casing.tag-man_made-pipeline, +path.line.casing.tag-natural-tree_row, +path.line.casing.tag-piste { + stroke-width: 7; +} +path.line.stroke.tag-aerialway, +path.line.stroke.tag-attraction-summer_toboggan, +path.line.stroke.tag-attraction-water_slide, +path.line.stroke.tag-man_made-pipeline, +path.line.stroke.tag-natural-tree_row, +path.line.stroke.tag-piste { + stroke-width: 5; +} + +.low-zoom path.line.shadow.tag-aerialway, +.low-zoom path.line.shadow.tag-attraction-summer_toboggan, +.low-zoom path.line.shadow.tag-attraction-water_slide, +.low-zoom path.line.shadow.tag-man_made-pipeline, +.low-zoom path.line.shadow.tag-natural-tree_row, +.low-zoom path.line.shadow.tag-piste { + stroke-width: 12; +} +.low-zoom path.line.casing.tag-aerialway, +.low-zoom path.line.casing.tag-attraction-summer_toboggan, +.low-zoom path.line.casing.tag-attraction-water_slide, +.low-zoom path.line.casing.tag-man_made-pipeline, +.low-zoom path.line.casing.tag-natural-tree_row, +.low-zoom path.line.casing.tag-piste { + stroke-width: 5; +} +.low-zoom path.line.stroke.tag-aerialway, +.low-zoom path.line.stroke.tag-attraction-summer_toboggan, +.low-zoom path.line.stroke.tag-attraction-water_slide, +.low-zoom path.line.stroke.tag-man_made-pipeline, +.low-zoom path.line.stroke.tag-natural-tree_row, +.low-zoom path.line.stroke.tag-piste { + stroke-width: 3; +} + + /* ferry routes */ .preset-icon .icon.tag-route-ferry { color: #58a9ed; @@ -24,6 +76,22 @@ path.line.stroke.tag-route-ferry { } +/* aerialways */ +path.line.stroke.tag-aerialway { + stroke: #c55; +} +path.line.casing.tag-aerialway { + stroke: #444; +} + +/* pistes */ +path.line.stroke.tag-piste { + stroke: #9ac; +} +path.line.casing.tag-piste { + stroke: #444; +} + /* power and pipeline */ .preset-icon .icon.tag-man_made-pipeline, .preset-icon .icon.tag-power { @@ -31,6 +99,7 @@ path.line.stroke.tag-route-ferry { fill: #939393; } + /* power */ path.line.stroke.tag-power { stroke: #939393; @@ -40,21 +109,21 @@ path.line.casing.tag-power { stroke: none; } + /* pipeline */ path.line.stroke.tag-man_made-pipeline { stroke: #cbd0d8; stroke-linecap: butt; - stroke-width: 3; stroke-dasharray: 80, 1.25; } path.line.casing.tag-man_made-pipeline { stroke: #666; - stroke-width: 4.5; } .low-zoom path.line.stroke.tag-man_made-pipeline { stroke-dasharray: 40, 1; } + /* boundaries */ path.line.stroke.tag-boundary { stroke: #fff; @@ -73,27 +142,6 @@ path.line.casing.tag-boundary-national_park { } -/* Tree Rows */ -path.line.shadow.tag-natural-tree_row { - stroke-width: 16; -} -path.line.casing.tag-natural-tree_row { - stroke-width: 7; -} -path.line.stroke.tag-natural-tree_row { - stroke-width: 5; -} -.low-zoom path.line.shadow.tag-natural-tree_row { - stroke-width: 12; -} -.low-zoom path.line.casing.tag-natural-tree_row { - stroke-width: 5; -} -.low-zoom path.line.stroke.tag-natural-tree_row { - stroke-width: 3; -} - - /* barriers and similar */ path.line.stroke.tag-barrier { stroke: #ddd; @@ -416,30 +464,6 @@ path.line.stroke.tag-crossing.tag-crossing-zebra { } /* Attractions */ -path.line.shadow.tag-attraction-summer_toboggan, -path.line.shadow.tag-attraction-water_slide { - stroke-width: 16; -} -path.line.casing.tag-attraction-summer_toboggan, -path.line.casing.tag-attraction-water_slide { - stroke-width: 7; -} -path.line.stroke.tag-attraction-summer_toboggan, -path.line.stroke.tag-attraction-water_slide { - stroke-width: 5; -} -.low-zoom path.line.shadow.tag-attraction-summer_toboggan, -.low-zoom path.line.shadow.tag-attraction-water_slide { - stroke-width: 12; -} -.low-zoom path.line.casing.tag-attraction-summer_toboggan, -.low-zoom path.line.casing.tag-attraction-water_slide { - stroke-width: 5; -} -.low-zoom path.line.stroke.tag-attraction-summer_toboggan, -.low-zoom path.line.stroke.tag-attraction-water_slide { - stroke-width: 3; -} path.line.stroke.tag-attraction-summer_toboggan { stroke: #9e9e9e; } diff --git a/modules/svg/tag_classes.js b/modules/svg/tag_classes.js index 8d4a195cd..0e0a08479 100644 --- a/modules/svg/tag_classes.js +++ b/modules/svg/tag_classes.js @@ -4,8 +4,8 @@ import { osmPavedTags } from '../osm/tags'; export function svgTagClasses() { var primaries = [ - 'building', 'highway', 'railway', 'waterway', 'aeroway', - 'motorway', 'boundary', 'power', 'amenity', 'natural', 'landuse', + 'building', 'highway', 'railway', 'waterway', 'aeroway', 'aerialway', + 'piste:type', 'boundary', 'power', 'amenity', 'natural', 'landuse', 'leisure', 'military', 'place', 'man_made', 'route', 'attraction' ]; var statuses = [ @@ -59,6 +59,10 @@ export function svgTagClasses() { v = t[k]; if (!v || v === 'no') continue; + if (k === 'piste:type') { // avoid a ':' in the class name + k = 'piste'; + } + primary = k; if (statuses.indexOf(v) !== -1) { // e.g. `railway=abandoned` status = v; From e4e0d9d13ad0e4ea2349098a55188c87851c5e0d Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 3 Feb 2019 23:55:16 -0500 Subject: [PATCH 5/6] Add oneway icon for ImproveOSM oneway markers --- build_data.js | 4 +++- modules/services/improveOSM.js | 4 ++-- svg/fontawesome/fas-long-arrow-alt-right.svg | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 svg/fontawesome/fas-long-arrow-alt-right.svg diff --git a/build_data.js b/build_data.js index deb949b89..2d72591d8 100644 --- a/build_data.js +++ b/build_data.js @@ -59,7 +59,9 @@ module.exports = function buildData() { }; // Font Awesome icons used - var faIcons = {}; + var faIcons = { + 'fas-long-arrow-alt-right': {} + }; // Start clean shell.rm('-f', [ diff --git a/modules/services/improveOSM.js b/modules/services/improveOSM.js index e170f930d..2031c4720 100644 --- a/modules/services/improveOSM.js +++ b/modules/services/improveOSM.js @@ -215,7 +215,7 @@ export default { comments: null, error_subtype: '', error_type: k, - icon: '', //TODO: Find suitable icon + icon: 'fas-long-arrow-alt-right', identifier: { // this is used to post changes to the error wayId: feature.wayId, fromNodeId: feature.fromNodeId, @@ -436,4 +436,4 @@ export default { getClosedIDs: function() { return Object.keys(_erCache.closed).sort(); } -}; \ No newline at end of file +}; diff --git a/svg/fontawesome/fas-long-arrow-alt-right.svg b/svg/fontawesome/fas-long-arrow-alt-right.svg new file mode 100644 index 000000000..a2b44d34b --- /dev/null +++ b/svg/fontawesome/fas-long-arrow-alt-right.svg @@ -0,0 +1 @@ + \ No newline at end of file From 82ea58d94399e3d2870e6964ed977a24e558b984 Mon Sep 17 00:00:00 2001 From: Andreas Haessler Date: Mon, 4 Feb 2019 15:59:08 +0100 Subject: [PATCH 6/6] Add default value to number field --- modules/ui/fields/input.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ui/fields/input.js b/modules/ui/fields/input.js index 89b6039b3..f0c6d02ae 100644 --- a/modules/ui/fields/input.js +++ b/modules/ui/fields/input.js @@ -98,7 +98,8 @@ export function uiFieldText(field, context) { .merge(buttons) .on('click', function(d) { d3_event.preventDefault(); - var vals = input.node().value.split(';'); + var raw_vals = input.node().value || '0'; + var vals = raw_vals.split(';'); vals = vals.map(function(v) { var num = parseFloat(v.trim(), 10); return isFinite(num) ? clamped(num + d) : v.trim();