From 1685e4c2b46a979fa215e527d5621f7617b21e73 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 00:56:44 -0500 Subject: [PATCH 01/59] Support transitioned reflect actions --- modules/actions/reflect.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/actions/reflect.js b/modules/actions/reflect.js index 6382f83c8..a28ea7d2d 100644 --- a/modules/actions/reflect.js +++ b/modules/actions/reflect.js @@ -6,6 +6,7 @@ import { import { geoEuclideanDistance, geoExtent, + geoInterp, geoRotate } from '../geo'; @@ -52,7 +53,10 @@ export function actionReflect(reflectIds, projection) { } - var action = function(graph) { + var action = function(graph, t) { + if (t === null || !isFinite(t)) t = 1; + t = Math.min(Math.max(+t, 0), 1); + var nodes = utilGetAllNodes(reflectIds, graph), ssr = getSmallestSurroundingRectangle(graph, nodes); @@ -87,7 +91,8 @@ export function actionReflect(reflectIds, projection) { a * (c[0] - p[0]) + b * (c[1] - p[1]) + p[0], b * (c[0] - p[0]) - a * (c[1] - p[1]) + p[1] ]; - node = node.move(projection.invert(c2)); + var loc2 = projection.invert(c2); + node = node.move(geoInterp(node.loc, loc2, t)); graph = graph.replace(node); } @@ -102,5 +107,8 @@ export function actionReflect(reflectIds, projection) { }; + action.transitionable = true; + + return action; } From d917424fc45b31b624ae22ee85c1de48c032241e Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 00:57:05 -0500 Subject: [PATCH 02/59] Support for performing transitionable actions --- modules/core/history.js | 59 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/modules/core/history.js b/modules/core/history.js index 212f3349e..3e858956a 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -17,7 +17,7 @@ export function coreHistory(context) { lock = utilSessionMutex('lock'); - function perform(actions) { + function perform(actions, t) { actions = Array.prototype.slice.call(actions); var annotation; @@ -31,7 +31,7 @@ export function coreHistory(context) { var graph = stack[index].graph; for (var i = 0; i < actions.length; i++) { - graph = actions[i](graph); + graph = actions[i](graph, t); } return { @@ -76,13 +76,58 @@ export function coreHistory(context) { perform: function() { - var previous = stack[index].graph; + // complete any transition already in progress + d3.select(document) + .interrupt('history.perform'); - stack = stack.slice(0, index + 1); - stack.push(perform(arguments)); - index++; + var transitionable = false; + if (arguments.length === 1 || + arguments.length === 2 && !_.isFunction(arguments[1])) { + transitionable = !!arguments[0].transitionable; + } - return change(previous); + if (transitionable) { + var origArguments = arguments; + d3.select(document) + .transition('history.perform') + .duration(150) + .ease(d3.easeLinear) + .tween('history.tween', function() { + return function(t) { + if (t < 1) _doOverwrite([origArguments[0]], t); + }; + }) + .on('start', function() { + _doPerform([origArguments[0]], 0); + }) + .on('end interrupt', function() { + _doOverwrite(origArguments, 1); + }); + + } else { + return _doPerform(arguments); + } + + + function _doPerform(args, t) { + var previous = stack[index].graph; + stack = stack.slice(0, index + 1); + stack.push(perform(args, t)); + index++; + return change(previous); + } + + function _doOverwrite(args, t) { + var previous = stack[index].graph; + if (index > 0) { + index--; + stack.pop(); + } + stack = stack.slice(0, index + 1); + stack.push(perform(args, t)); + index++; + return change(previous); + } }, From fdc37287ec410da68f83690c2de5f13a4eb7ee99 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 10:52:00 -0500 Subject: [PATCH 03/59] Support transitioned circularize action --- modules/actions/circularize.js | 63 ++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/modules/actions/circularize.js b/modules/actions/circularize.js index 283cd829e..f57c10f68 100644 --- a/modules/actions/circularize.js +++ b/modules/actions/circularize.js @@ -14,8 +14,16 @@ export function actionCircularize(wayId, projection, maxAngle) { maxAngle = (maxAngle || 20) * Math.PI / 180; - var action = function(graph) { - var way = graph.entity(wayId); + var action = function(graph, t) { + if (t === null || !isFinite(t)) t = 1; + t = Math.min(Math.max(+t, 0), 1); + + var way = graph.entity(wayId), + origNodes = {}; + + graph.childNodes(way).forEach(function(node) { + if (!origNodes[node.id]) origNodes[node.id] = node; + }); if (!way.isConvex(graph)) { graph = action.makeConvex(graph); @@ -56,21 +64,27 @@ export function actionCircularize(wayId, projection, maxAngle) { endNodeIndex = nodes.indexOf(endNode), numberNewPoints = -1, indexRange = endNodeIndex - startNodeIndex, - distance, totalAngle, eachAngle, startAngle, endAngle, - angle, loc, node, j, - inBetweenNodes = []; + nearNodes = {}, + inBetweenNodes = [], + startAngle, endAngle, totalAngle, eachAngle, + angle, loc, node, origNode, j, k; if (indexRange < 0) { indexRange += nodes.length; } // position this key node - distance = geoEuclideanDistance(centroid, keyPoints[i]); + var distance = geoEuclideanDistance(centroid, keyPoints[i]); if (distance === 0) { distance = 1e-4; } keyPoints[i] = [ centroid[0] + (keyPoints[i][0] - centroid[0]) / distance * radius, - centroid[1] + (keyPoints[i][1] - centroid[1]) / distance * radius]; - graph = graph.replace(keyNodes[i].move(projection.invert(keyPoints[i]))); + centroid[1] + (keyPoints[i][1] - centroid[1]) / distance * radius + ]; + loc = projection.invert(keyPoints[i]); + node = keyNodes[i]; + origNode = origNodes[node.id]; + node = node.move(geoInterp(origNode.loc, loc, t)); + graph = graph.replace(node); // figure out the between delta angle we want to match to startAngle = Math.atan2(keyPoints[i][1] - centroid[1], keyPoints[i][0] - centroid[0]); @@ -87,14 +101,20 @@ export function actionCircularize(wayId, projection, maxAngle) { eachAngle = totalAngle / (indexRange + numberNewPoints); } while (Math.abs(eachAngle) > maxAngle); - // move existing points + + // move existing nodes for (j = 1; j < indexRange; j++) { angle = startAngle + j * eachAngle; loc = projection.invert([ - centroid[0] + Math.cos(angle)*radius, - centroid[1] + Math.sin(angle)*radius]); + centroid[0] + Math.cos(angle) * radius, + centroid[1] + Math.sin(angle) * radius + ]); - node = nodes[(j + startNodeIndex) % nodes.length].move(loc); + node = nodes[(j + startNodeIndex) % nodes.length]; + origNode = origNodes[node.id]; + nearNodes[node.id] = angle; + + node = node.move(geoInterp(origNode.loc, loc, t)); graph = graph.replace(node); } @@ -103,9 +123,21 @@ export function actionCircularize(wayId, projection, maxAngle) { angle = startAngle + (indexRange + j) * eachAngle; loc = projection.invert([ centroid[0] + Math.cos(angle) * radius, - centroid[1] + Math.sin(angle) * radius]); + centroid[1] + Math.sin(angle) * radius + ]); - node = osmNode({loc: loc}); + // choose a nearnode to use as the original + var min = Infinity; + for (var nodeId in nearNodes) { + var nearAngle = nearNodes[nodeId], + dist = Math.abs(nearAngle - angle); + if (dist < min) { + dist = min; + origNode = origNodes[nodeId]; + } + } + + node = osmNode({ loc: geoInterp(origNode.loc, loc, t) }); graph = graph.replace(node); nodes.splice(endNodeIndex + j, 0, node); @@ -195,5 +227,8 @@ export function actionCircularize(wayId, projection, maxAngle) { }; + action.transitionable = true; + + return action; } From 3e82a7352c59d4e7f3f933546d9c0a0a7262e6a8 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 11:09:17 -0500 Subject: [PATCH 04/59] Support transitioned straighten action --- modules/actions/straighten.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/actions/straighten.js b/modules/actions/straighten.js index 60a49416e..43765865f 100644 --- a/modules/actions/straighten.js +++ b/modules/actions/straighten.js @@ -1,5 +1,5 @@ import { actionDeleteNode } from './delete_node'; -import { geoEuclideanDistance } from '../geo/index'; +import { geoEuclideanDistance, geoInterp } from '../geo/index'; /* @@ -8,12 +8,15 @@ import { geoEuclideanDistance } from '../geo/index'; export function actionStraighten(wayId, projection) { function positionAlongWay(n, s, e) { - return ((n[0] - s[0]) * (e[0] - s[0]) + (n[1] - s[1]) * (e[1] - s[1]))/ + return ((n[0] - s[0]) * (e[0] - s[0]) + (n[1] - s[1]) * (e[1] - s[1])) / (Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2)); } - var action = function(graph) { + var action = function(graph, t) { + if (t === null || !isFinite(t)) t = 1; + t = Math.min(Math.max(+t, 0), 1); + var way = graph.entity(wayId), nodes = graph.childNodes(way), points = nodes.map(function(n) { return projection(n.loc); }), @@ -26,17 +29,18 @@ export function actionStraighten(wayId, projection) { var node = nodes[i], point = points[i]; - if (graph.parentWays(node).length > 1 || + if (t < 1 || graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags()) { var u = positionAlongWay(point, startPoint, endPoint), - p0 = startPoint[0] + u * (endPoint[0] - startPoint[0]), - p1 = startPoint[1] + u * (endPoint[1] - startPoint[1]); + p = [ + startPoint[0] + u * (endPoint[0] - startPoint[0]), + startPoint[1] + u * (endPoint[1] - startPoint[1]) + ], + loc2 = projection.invert(p); - graph = graph - .replace(graph.entity(node.id) - .move(projection.invert([p0, p1]))); + graph = graph.replace(node.move(geoInterp(node.loc, loc2, t))); } else { // safe to delete @@ -83,5 +87,8 @@ export function actionStraighten(wayId, projection) { }; + action.transitionable = true; + + return action; } From cc5f23804211cd58b9e4d589f2e789483d90a04c Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 12:04:53 -0500 Subject: [PATCH 05/59] Support transitioned orthogonalize action --- modules/actions/orthogonalize.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/modules/actions/orthogonalize.js b/modules/actions/orthogonalize.js index b3c311b33..5426e04bd 100644 --- a/modules/actions/orthogonalize.js +++ b/modules/actions/orthogonalize.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import { actionDeleteNode } from './delete_node'; -import { geoEuclideanDistance } from '../geo/index'; +import { geoEuclideanDistance, geoInterp } from '../geo/index'; /* * Based on https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/potlatch2/tools/Quadrilateralise.as @@ -11,26 +11,30 @@ export function actionOrthogonalize(wayId, projection) { upperThreshold = Math.cos(threshold * Math.PI / 180); - var action = function(graph) { + var action = function(graph, t) { + if (t === null || !isFinite(t)) t = 1; + t = Math.min(Math.max(+t, 0), 1); + var way = graph.entity(wayId), nodes = graph.childNodes(way), points = _.uniq(nodes).map(function(n) { return projection(n.loc); }), corner = {i: 0, dotp: 1}, epsilon = 1e-4, - i, j, score, motions; + node, loc, score, motions, i, j; if (nodes.length === 4) { for (i = 0; i < 1000; i++) { motions = points.map(calcMotion); - points[corner.i] = addPoints(points[corner.i],motions[corner.i]); + points[corner.i] = addPoints(points[corner.i], motions[corner.i]); score = corner.dotp; if (score < epsilon) { break; } } - graph = graph.replace(graph.entity(nodes[corner.i].id) - .move(projection.invert(points[corner.i]))); + node = graph.entity(nodes[corner.i].id); + loc = projection.invert(points[corner.i]); + graph = graph.replace(node.move(geoInterp(node.loc, loc, t))); } else { var best, @@ -57,25 +61,25 @@ export function actionOrthogonalize(wayId, projection) { for (i = 0; i < points.length; i++) { // only move the points that actually moved if (originalPoints[i][0] !== points[i][0] || originalPoints[i][1] !== points[i][1]) { - graph = graph.replace(graph.entity(nodes[i].id) - .move(projection.invert(points[i]))); + loc = projection.invert(points[i]); + node = graph.entity(nodes[i].id); + graph = graph.replace(node.move(geoInterp(node.loc, loc, t))); } } // remove empty nodes on straight sections - for (i = 0; i < points.length; i++) { - var node = nodes[i]; + for (i = 0; t === 1 && i < points.length; i++) { + node = graph.entity(nodes[i].id); if (graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags()) { - continue; } var dotp = normalizedDotProduct(i, points); if (dotp < -1 + epsilon) { - graph = actionDeleteNode(nodes[i].id)(graph); + graph = actionDeleteNode(node.id)(graph); } } } @@ -182,5 +186,8 @@ export function actionOrthogonalize(wayId, projection) { }; + action.transitionable = true; + + return action; } From c48cdc7c70dbeb509b1c85d5d6b84f69e5f7a43a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 12:22:48 -0500 Subject: [PATCH 06/59] Clearer intent for right triangle code --- modules/actions/orthogonalize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/actions/orthogonalize.js b/modules/actions/orthogonalize.js index 5426e04bd..31c532d00 100644 --- a/modules/actions/orthogonalize.js +++ b/modules/actions/orthogonalize.js @@ -22,7 +22,7 @@ export function actionOrthogonalize(wayId, projection) { epsilon = 1e-4, node, loc, score, motions, i, j; - if (nodes.length === 4) { + if (points.length === 3) { // move only one vertex for right triangle for (i = 0; i < 1000; i++) { motions = points.map(calcMotion); points[corner.i] = addPoints(points[corner.i], motions[corner.i]); From cb70b8028f19903ea1063f0cc8f3adc3d28d1a29 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 12:26:00 -0500 Subject: [PATCH 07/59] Pacify eslint --- modules/actions/circularize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/actions/circularize.js b/modules/actions/circularize.js index f57c10f68..6a14124fc 100644 --- a/modules/actions/circularize.js +++ b/modules/actions/circularize.js @@ -67,7 +67,7 @@ export function actionCircularize(wayId, projection, maxAngle) { nearNodes = {}, inBetweenNodes = [], startAngle, endAngle, totalAngle, eachAngle, - angle, loc, node, origNode, j, k; + angle, loc, node, origNode, j; if (indexRange < 0) { indexRange += nodes.length; From 723f0ca43a0ee1891ced6a641449c1d8dc47025a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 14:58:18 -0500 Subject: [PATCH 08/59] Add tests for transitioned straighten action --- test/spec/actions/straighten.js | 89 +++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 16 deletions(-) diff --git a/test/spec/actions/straighten.js b/test/spec/actions/straighten.js index 93097f44d..e9c63ed4f 100644 --- a/test/spec/actions/straighten.js +++ b/test/spec/actions/straighten.js @@ -5,12 +5,11 @@ describe('iD.actionStraighten', function () { it('returns falsy for ways with internal nodes near centerline', function () { var graph = iD.Graph([ iD.Node({id: 'a', loc: [0, 0]}), - iD.Node({id: 'b', loc: [1, 0.1]}), + iD.Node({id: 'b', loc: [1, 0.01]}), iD.Node({id: 'c', loc: [2, 0]}), iD.Node({id: 'd', loc: [3, 0]}), iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}) ]); - expect(iD.actionStraighten('-', projection).disabled(graph)).not.to.be.ok; }); @@ -22,7 +21,6 @@ describe('iD.actionStraighten', function () { iD.Node({id: 'd', loc: [3, 0]}), iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}) ]); - expect(iD.actionStraighten('-', projection).disabled(graph)).to.equal('too_bendy'); }); @@ -34,49 +32,108 @@ describe('iD.actionStraighten', function () { iD.Node({id: 'd', loc: [0, 0]}), iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}) ]); - expect(iD.actionStraighten('-', projection).disabled(graph)).to.equal('too_bendy'); }); }); + it('deletes empty nodes', function() { var graph = iD.Graph([ iD.Node({id: 'a', loc: [0, 0]}), - iD.Node({id: 'b', loc: [2, 0], tags: {}}), - iD.Node({id: 'c', loc: [2, 2]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {}}), + iD.Node({id: 'c', loc: [2, 0]}), iD.Way({id: '-', nodes: ['a', 'b', 'c']}) ]); graph = iD.actionStraighten('-', projection)(graph); - + expect(graph.entity('-').nodes).to.eql(['a', 'c']); expect(graph.hasEntity('b')).to.eq(undefined); }); it('does not delete tagged nodes', function() { var graph = iD.Graph([ iD.Node({id: 'a', loc: [0, 0]}), - iD.Node({id: 'b', loc: [2, 0], tags: {foo: 'bar'}}), - iD.Node({id: 'c', loc: [2, 2]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, 0]}), iD.Way({id: '-', nodes: ['a', 'b', 'c']}) ]); graph = iD.actionStraighten('-', projection)(graph); - expect(graph.entity('-').nodes).to.eql(['a', 'b', 'c']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); }); it('does not delete nodes connected to other ways', function() { var graph = iD.Graph([ iD.Node({id: 'a', loc: [0, 0]}), - iD.Node({id: 'b', loc: [2, 0]}), - iD.Node({id: 'c', loc: [2, 2]}), - iD.Node({id: 'd', loc: [0, 2]}), - iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}), + iD.Node({id: 'b', loc: [1, 0.01]}), + iD.Node({id: 'c', loc: [2, 0]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c']}), iD.Way({id: '=', nodes: ['b']}) ]); graph = iD.actionStraighten('-', projection)(graph); - - expect(graph.entity('-').nodes).to.have.length(3); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'c']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); }); + + + describe('transitions', function () { + it('is transitionable', function() { + expect(iD.actionStraighten().transitionable).to.be.true; + }); + + it('straighten at t = 0', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, -0.01]}), + iD.Node({id: 'd', loc: [3, 0]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}) + ]); + + graph = iD.actionStraighten('-', projection)(graph, 0); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'c', 'd']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0.01, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(-0.01, 1e-6); + }); + + it('straighten at t = 0.5', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, -0.01]}), + iD.Node({id: 'd', loc: [3, 0]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}) + ]); + + graph = iD.actionStraighten('-', projection)(graph, 0.5); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'c', 'd']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0.005, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(-0.005, 1e-6); + }); + + it('straighten at t = 1', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, -0.01]}), + iD.Node({id: 'd', loc: [3, 0]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd']}) + ]); + + graph = iD.actionStraighten('-', projection)(graph, 1); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'd']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.hasEntity('c')).to.eq(undefined); + }); + }); + }); From f9c09c0648c21a607393d6c81fa99ad1839f92a7 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 15:05:51 -0500 Subject: [PATCH 09/59] Add tests for transitioned reflect action --- test/spec/actions/reflect.js | 121 +++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/test/spec/actions/reflect.js b/test/spec/actions/reflect.js index 1a8b22061..c06737129 100644 --- a/test/spec/actions/reflect.js +++ b/test/spec/actions/reflect.js @@ -63,4 +63,125 @@ describe('iD.actionReflect', function() { expect(graph.entity('d').loc[1]).to.be.closeTo(2, 1e-6); }); + + describe('transitions', function () { + it('is transitionable', function() { + expect(iD.actionReflect().transitionable).to.be.true; + }); + + it('reflect long at t = 0', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [4, 0]}), + iD.Node({id: 'c', loc: [4, 2]}), + iD.Node({id: 'd', loc: [1, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionReflect(['-'], projection)(graph, 0); + expect(graph.entity('a').loc[0]).to.be.closeTo(0, 1e-6); + expect(graph.entity('a').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('b').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(2, 1e-6); + expect(graph.entity('d').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('d').loc[1]).to.be.closeTo(2, 1e-6); + }); + + it('reflect long at t = 0.5', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [4, 0]}), + iD.Node({id: 'c', loc: [4, 2]}), + iD.Node({id: 'd', loc: [1, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionReflect(['-'], projection)(graph, 0.5); + expect(graph.entity('a').loc[0]).to.be.closeTo(0, 1e-6); + expect(graph.entity('a').loc[1]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(1, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(1, 1e-6); + expect(graph.entity('d').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('d').loc[1]).to.be.closeTo(1, 1e-6); + }); + + it('reflect long at t = 1', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [4, 0]}), + iD.Node({id: 'c', loc: [4, 2]}), + iD.Node({id: 'd', loc: [1, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionReflect(['-'], projection)(graph, 1); + expect(graph.entity('a').loc[0]).to.be.closeTo(0, 1e-6); + expect(graph.entity('a').loc[1]).to.be.closeTo(2, 1e-6); + expect(graph.entity('b').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(2, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('d').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('d').loc[1]).to.be.closeTo(0, 1e-6); + }); + + it('reflect short at t = 0', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [4, 0]}), + iD.Node({id: 'c', loc: [4, 2]}), + iD.Node({id: 'd', loc: [1, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionReflect(['-'], projection).useLongAxis(false)(graph, 0); + expect(graph.entity('a').loc[0]).to.be.closeTo(0, 1e-6); + expect(graph.entity('a').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('b').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(2, 1e-6); + expect(graph.entity('d').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('d').loc[1]).to.be.closeTo(2, 1e-6); + }); + + it('reflect short at t = 0.5', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [4, 0]}), + iD.Node({id: 'c', loc: [4, 2]}), + iD.Node({id: 'd', loc: [1, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionReflect(['-'], projection).useLongAxis(false)(graph, 0.5); + expect(graph.entity('a').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('a').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('b').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(2, 1e-6); + expect(graph.entity('d').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('d').loc[1]).to.be.closeTo(2, 1e-6); + }); + + it('reflect short at t = 1', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [4, 0]}), + iD.Node({id: 'c', loc: [4, 2]}), + iD.Node({id: 'd', loc: [1, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionReflect(['-'], projection).useLongAxis(false)(graph, 1); + expect(graph.entity('a').loc[0]).to.be.closeTo(4, 1e-6); + expect(graph.entity('a').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('b').loc[0]).to.be.closeTo(0, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(0, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(2, 1e-6); + expect(graph.entity('d').loc[0]).to.be.closeTo(3, 1e-6); + expect(graph.entity('d').loc[1]).to.be.closeTo(2, 1e-6); + }); + + }); }); From 5dde5aededca96995ed8efaddb4319c13afa596f Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 16:14:49 -0500 Subject: [PATCH 10/59] Add tests for transitioned circularize action --- test/spec/actions/circularize.js | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test/spec/actions/circularize.js b/test/spec/actions/circularize.js index 7d598f9ed..4c70bc4e2 100644 --- a/test/spec/actions/circularize.js +++ b/test/spec/actions/circularize.js @@ -271,4 +271,53 @@ describe('iD.actionCircularize', function () { expect(isCircular('-', graph)).to.be.ok; }); + + describe('transitions', function () { + it('is transitionable', function() { + expect(iD.actionCircularize().transitionable).to.be.true; + }); + + it('circularize at t = 0', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [2, 0]}), + iD.Node({id: 'c', loc: [2, 2]}), + iD.Node({id: 'd', loc: [0, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionCircularize('-', projection)(graph, 0); + expect(isCircular('-', graph)).to.be.not.ok; + expect(graph.entity('-').nodes).to.have.length(20); + expect(area('-', graph)).to.be.closeTo(-4, 1e-2); + }); + + it('circularize at t = 0.5', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [2, 0]}), + iD.Node({id: 'c', loc: [2, 2]}), + iD.Node({id: 'd', loc: [0, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionCircularize('-', projection)(graph, 0.5); + expect(isCircular('-', graph)).to.be.not.ok; + expect(graph.entity('-').nodes).to.have.length(20); + expect(area('-', graph)).to.be.closeTo(-4.812, 1e-2); + }); + + it('circularize at t = 1', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [2, 0]}), + iD.Node({id: 'c', loc: [2, 2]}), + iD.Node({id: 'd', loc: [0, 2]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'a']}) + ]); + graph = iD.actionCircularize('-', projection)(graph, 1); + expect(isCircular('-', graph)).to.be.ok; + expect(graph.entity('-').nodes).to.have.length(20); + expect(area('-', graph)).to.be.closeTo(-6.168, 1e-2); + }); + }); + }); From ef96fde38a5abbd77a38e405c3421bf6496d3293 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 16:37:17 -0500 Subject: [PATCH 11/59] Add tests for transitioned orthogonalize action --- test/spec/actions/orthogonalize.js | 70 +++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 5 deletions(-) diff --git a/test/spec/actions/orthogonalize.js b/test/spec/actions/orthogonalize.js index 2c8138977..d3fb8946d 100644 --- a/test/spec/actions/orthogonalize.js +++ b/test/spec/actions/orthogonalize.js @@ -11,7 +11,6 @@ describe('iD.actionOrthogonalize', function () { ]); graph = iD.actionOrthogonalize('-', projection)(graph); - expect(graph.entity('-').nodes).to.have.length(5); }); @@ -25,7 +24,6 @@ describe('iD.actionOrthogonalize', function () { ]); graph = iD.actionOrthogonalize('-', projection)(graph); - expect(graph.entity('-').nodes).to.have.length(5); }); @@ -38,7 +36,6 @@ describe('iD.actionOrthogonalize', function () { ]); graph = iD.actionOrthogonalize('-', projection)(graph); - expect(graph.entity('-').nodes).to.have.length(4); }); @@ -53,7 +50,6 @@ describe('iD.actionOrthogonalize', function () { ]); graph = iD.actionOrthogonalize('-', projection)(graph); - expect(graph.hasEntity('d')).to.eq(undefined); }); @@ -68,7 +64,6 @@ describe('iD.actionOrthogonalize', function () { ]); graph = iD.actionOrthogonalize('-', projection)(graph); - expect(graph.entity('-').nodes).to.have.length(6); expect(graph.hasEntity('d')).to.not.eq(undefined); }); @@ -121,4 +116,69 @@ describe('iD.actionOrthogonalize', function () { expect(Object.keys(diff.changes()).sort()).to.eql(['a', 'b', 'c', 'f']); }); + + + describe('transitions', function () { + it('is transitionable', function() { + expect(iD.actionOrthogonalize().transitionable).to.be.true; + }); + + it('orthogonalize at t = 0', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, -0.01]}), + iD.Node({id: 'd', loc: [3, 0]}), + iD.Node({id: 'e', loc: [3, 1]}), + iD.Node({id: 'f', loc: [0, 1]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'e', 'f', 'a']}) + ]); + + graph = iD.actionOrthogonalize('-', projection)(graph, 0); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'c', 'd', 'e', 'f', 'a']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-6); + expect(graph.entity('b').loc[1]).to.be.closeTo(0.01, 1e-6); + expect(graph.entity('c').loc[0]).to.be.closeTo(2, 1e-6); + expect(graph.entity('c').loc[1]).to.be.closeTo(-0.01, 1e-6); + + }); + + it('orthogonalize at t = 0.5', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, -0.01]}), + iD.Node({id: 'd', loc: [3, 0]}), + iD.Node({id: 'e', loc: [3, 1]}), + iD.Node({id: 'f', loc: [0, 1]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'e', 'f', 'a']}) + ]); + + graph = iD.actionOrthogonalize('-', projection)(graph, 0.5); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'c', 'd', 'e', 'f', 'a']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 1e-3); + expect(graph.entity('b').loc[1]).to.be.closeTo(0.005, 1e-3); + expect(graph.entity('c').loc[0]).to.be.closeTo(2, 1e-3); + expect(graph.entity('c').loc[1]).to.be.closeTo(-0.005, 1e-3); + }); + + it('orthogonalize at t = 1', function() { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [0, 0]}), + iD.Node({id: 'b', loc: [1, 0.01], tags: {foo: 'bar'}}), + iD.Node({id: 'c', loc: [2, -0.01]}), + iD.Node({id: 'd', loc: [3, 0]}), + iD.Node({id: 'e', loc: [3, 1]}), + iD.Node({id: 'f', loc: [0, 1]}), + iD.Way({id: '-', nodes: ['a', 'b', 'c', 'd', 'e', 'f', 'a']}) + ]); + + graph = iD.actionOrthogonalize('-', projection)(graph, 1); + expect(graph.entity('-').nodes).to.eql(['a', 'b', 'd', 'e', 'f', 'a']); + expect(graph.entity('b').loc[0]).to.be.closeTo(1, 2e-3); + expect(graph.entity('b').loc[1]).to.be.closeTo(0, 2e-3); + expect(graph.hasEntity('c')).to.eq(undefined); + }); + }); + }); From eb0cdd5e8c4c49c9c4370aaadcc677ab55bfcbae Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 23 Dec 2016 17:18:28 -0500 Subject: [PATCH 12/59] History transition code cleanup --- modules/core/history.js | 106 ++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/modules/core/history.js b/modules/core/history.js index 3e858956a..3f4e03388 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -11,13 +11,15 @@ import { utilRebind } from '../util/rebind'; export function coreHistory(context) { - var stack, index, tree, - imageryUsed = ['Bing'], + var imageryUsed = ['Bing'], dispatch = d3.dispatch('change', 'undone', 'redone'), - lock = utilSessionMutex('lock'); + lock = utilSessionMutex('lock'), + duration = 150, + stack, index, tree; - function perform(actions, t) { + // internal _act, accepts list of actions and eased time + function _act(actions, t) { actions = Array.prototype.slice.call(actions); var annotation; @@ -42,6 +44,40 @@ export function coreHistory(context) { } + // internal _perform with eased time + function _perform(args, t) { + var previous = stack[index].graph; + stack = stack.slice(0, index + 1); + stack.push(_act(args, t)); + index++; + return change(previous); + } + + + // internal _replace with eased time + function _replace(args, t) { + var previous = stack[index].graph; + // assert(index == stack.length - 1) + stack[index] = _act(args, t); + return change(previous); + } + + + // internal _overwrite with eased time + function _overwrite(args, t) { + var previous = stack[index].graph; + if (index > 0) { + index--; + stack.pop(); + } + stack = stack.slice(0, index + 1); + stack.push(_act(args, t)); + index++; + return change(previous); + } + + + // determine diffrence and dispatch a change event function change(previous) { var difference = coreDifference(previous, history.graph()); dispatch.call('change', this, difference); @@ -80,64 +116,46 @@ export function coreHistory(context) { d3.select(document) .interrupt('history.perform'); - var transitionable = false; + var transitionable = false, + action0 = arguments[0]; + if (arguments.length === 1 || arguments.length === 2 && !_.isFunction(arguments[1])) { - transitionable = !!arguments[0].transitionable; + transitionable = !!action0.transitionable; } if (transitionable) { var origArguments = arguments; d3.select(document) .transition('history.perform') - .duration(150) + .duration(duration) .ease(d3.easeLinear) .tween('history.tween', function() { return function(t) { - if (t < 1) _doOverwrite([origArguments[0]], t); + if (t < 1) _overwrite([action0], t); }; }) .on('start', function() { - _doPerform([origArguments[0]], 0); + _perform([action0], 0); }) .on('end interrupt', function() { - _doOverwrite(origArguments, 1); + _overwrite(origArguments, 1); }); } else { - return _doPerform(arguments); - } - - - function _doPerform(args, t) { - var previous = stack[index].graph; - stack = stack.slice(0, index + 1); - stack.push(perform(args, t)); - index++; - return change(previous); - } - - function _doOverwrite(args, t) { - var previous = stack[index].graph; - if (index > 0) { - index--; - stack.pop(); - } - stack = stack.slice(0, index + 1); - stack.push(perform(args, t)); - index++; - return change(previous); + return _perform(arguments); } }, replace: function() { - var previous = stack[index].graph; + return _replace(arguments, 1); + }, - // assert(index == stack.length - 1) - stack[index] = perform(arguments); - return change(previous); + // Same as calling pop and then perform + overwrite: function() { + return _overwrite(arguments, 1); }, @@ -152,22 +170,6 @@ export function coreHistory(context) { }, - // Same as calling pop and then perform - overwrite: function() { - var previous = stack[index].graph; - - if (index > 0) { - index--; - stack.pop(); - } - stack = stack.slice(0, index + 1); - stack.push(perform(arguments)); - index++; - - return change(previous); - }, - - undo: function() { var previous = stack[index].graph; From b074c299e7dd5275cffe20b28cfb87487bd9cf8d Mon Sep 17 00:00:00 2001 From: abdeldjalil09 Date: Tue, 27 Dec 2016 17:26:03 +0100 Subject: [PATCH 13/59] Add "castle_type" field to castle preset --- data/presets/fields/castle_type | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data/presets/fields/castle_type diff --git a/data/presets/fields/castle_type b/data/presets/fields/castle_type new file mode 100644 index 000000000..fbcddf87e --- /dev/null +++ b/data/presets/fields/castle_type @@ -0,0 +1,3 @@ +key": "castle_type", + "type": "combo", +"label": "Type" From 19b0a771f6de9428fdf708db90a441cc4669d3a5 Mon Sep 17 00:00:00 2001 From: popov Date: Wed, 28 Dec 2016 15:32:47 +1000 Subject: [PATCH 14/59] make vertex by midpoint double-clicking --- modules/behavior/select.js | 4 +++- modules/modes/select.js | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/behavior/select.js b/modules/behavior/select.js index cf5c8d139..9c627701d 100644 --- a/modules/behavior/select.js +++ b/modules/behavior/select.js @@ -27,7 +27,9 @@ export function behaviorSelect(context) { lasso = d3.select('#surface .lasso').node(), mode = context.mode(); - if (!(datum instanceof osmEntity)) { + if (datum.type === 'midpoint') { + // do nothing + } else if (!(datum instanceof osmEntity)) { if (!d3.event.shiftKey && !lasso && mode.id !== 'browse') context.enter(modeBrowse(context)); diff --git a/modules/modes/select.js b/modules/modes/select.js index a4d2dc7a6..4715daf7e 100644 --- a/modules/modes/select.js +++ b/modules/modes/select.js @@ -245,6 +245,15 @@ export function modeSelect(context, selectedIDs) { t('operations.add.annotation.vertex') ); + d3.event.preventDefault(); + d3.event.stopPropagation(); + } else if (datum.type === 'midpoint') { + var node = osmNode(); + + context.perform( + actionAddMidpoint({loc: datum.loc, edge: datum.edge}, node), + t('operations.add.annotation.vertex')); + d3.event.preventDefault(); d3.event.stopPropagation(); } From 0386ee249e4c15c8c5010cc6e630c61d7aa9a26a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 28 Dec 2016 00:33:40 -0500 Subject: [PATCH 15/59] Add castle_type field to Castle preset --- data/presets.yaml | 3 +++ data/presets/fields.json | 5 +++++ data/presets/fields/castle_type | 3 --- data/presets/fields/castle_type.json | 5 +++++ data/presets/presets.json | 4 ++++ data/presets/presets/historic/castle.json | 4 ++++ dist/locales/en.json | 3 +++ 7 files changed, 24 insertions(+), 3 deletions(-) delete mode 100644 data/presets/fields/castle_type create mode 100644 data/presets/fields/castle_type.json diff --git a/data/presets.yaml b/data/presets.yaml index c2ddb18cf..24c3d5cce 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -284,6 +284,9 @@ en: WNW: West-northwest # direction=WSW WSW: West-southwest + castle_type: + # castle_type=* + label: Type clock_direction: # direction=* label: Direction diff --git a/data/presets/fields.json b/data/presets/fields.json index ffe867115..30e94f64c 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -364,6 +364,11 @@ } } }, + "castle_type": { + "key": "castle_type", + "type": "combo", + "label": "Type" + }, "clock_direction": { "key": "direction", "type": "combo", diff --git a/data/presets/fields/castle_type b/data/presets/fields/castle_type deleted file mode 100644 index fbcddf87e..000000000 --- a/data/presets/fields/castle_type +++ /dev/null @@ -1,3 +0,0 @@ -key": "castle_type", - "type": "combo", -"label": "Type" diff --git a/data/presets/fields/castle_type.json b/data/presets/fields/castle_type.json new file mode 100644 index 000000000..ea36ca17d --- /dev/null +++ b/data/presets/fields/castle_type.json @@ -0,0 +1,5 @@ +{ + "key": "castle_type", + "type": "combo", + "label": "Type" +} diff --git a/data/presets/presets.json b/data/presets/presets.json index bc329aae5..a6b4f992c 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -5699,6 +5699,10 @@ "name": "Boundary Stone" }, "historic/castle": { + "fields": [ + "castle_type", + "building_area" + ], "geometry": [ "point", "area" diff --git a/data/presets/presets/historic/castle.json b/data/presets/presets/historic/castle.json index fed1adb06..0d9960576 100644 --- a/data/presets/presets/historic/castle.json +++ b/data/presets/presets/historic/castle.json @@ -1,4 +1,8 @@ { + "fields": [ + "castle_type", + "building_area" + ], "geometry": [ "point", "area" diff --git a/dist/locales/en.json b/dist/locales/en.json index 2e877fc5a..c39d46f54 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -954,6 +954,9 @@ "NNW": "North-northwest" } }, + "castle_type": { + "label": "Type" + }, "clock_direction": { "label": "Direction", "options": { From ab5d3e4056c1d01030a70c7c3ae2c4275b416665 Mon Sep 17 00:00:00 2001 From: popov Date: Wed, 28 Dec 2016 15:45:13 +1000 Subject: [PATCH 16/59] reflect-typo --- data/core.yaml | 4 ++-- dist/locales/en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index e614c9fd0..5e0344b81 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -159,10 +159,10 @@ en: short: Y annotation: long: - area: Reflected an area across its long axis. + single: Reflected an object across its long axis. multiple: Reflected multiple objects across their long axis. short: - area: Reflected an area across its short axis. + single: Reflected an object across its short axis. multiple: Reflected multiple objects across their short axis. incomplete_relation: single: This object can't be reflected because it hasn't been fully downloaded. diff --git a/dist/locales/en.json b/dist/locales/en.json index c39d46f54..3a68e6275 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -205,11 +205,11 @@ }, "annotation": { "long": { - "area": "Reflected an area across its long axis.", + "single": "Reflected an object across its long axis.", "multiple": "Reflected multiple objects across their long axis." }, "short": { - "area": "Reflected an area across its short axis.", + "single": "Reflected an object across its short axis.", "multiple": "Reflected multiple objects across their short axis." } }, From 45ad0842dd7607c9aa18c8b1f4e72f5a5fc03a95 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 28 Dec 2016 01:16:57 -0500 Subject: [PATCH 17/59] Pacify eslint --- modules/modes/select.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/modes/select.js b/modules/modes/select.js index 4715daf7e..27032262e 100644 --- a/modules/modes/select.js +++ b/modules/modes/select.js @@ -235,23 +235,19 @@ export function modeSelect(context, selectedIDs) { if (datum instanceof osmWay && !target.classed('fill')) { var choice = geoChooseEdge(context.childNodes(datum), context.mouse(), context.projection), - node = osmNode(); - - var prev = datum.nodes[choice.index - 1], + prev = datum.nodes[choice.index - 1], next = datum.nodes[choice.index]; context.perform( - actionAddMidpoint({loc: choice.loc, edge: [prev, next]}, node), + actionAddMidpoint({loc: choice.loc, edge: [prev, next]}, osmNode()), t('operations.add.annotation.vertex') ); d3.event.preventDefault(); d3.event.stopPropagation(); } else if (datum.type === 'midpoint') { - var node = osmNode(); - context.perform( - actionAddMidpoint({loc: datum.loc, edge: datum.edge}, node), + actionAddMidpoint({loc: datum.loc, edge: datum.edge}, osmNode()), t('operations.add.annotation.vertex')); d3.event.preventDefault(); From 9033c9d638082444a2143993fae770083ebf4762 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 29 Dec 2016 21:35:00 -0500 Subject: [PATCH 18/59] Standardize on calling things "features" instead of "objects" (closes #3689) --- data/core.yaml | 92 ++++++++++++++++++++++---------------------- dist/locales/en.json | 92 ++++++++++++++++++++++---------------------- 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index 5e0344b81..916dfc6de 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -78,24 +78,24 @@ en: delete: title: Delete description: - single: Delete this object permanently. - multiple: Delete these objects permanently. + single: Delete this feature permanently. + multiple: Delete these features permanently. annotation: point: Deleted a point. vertex: Deleted a node from a way. line: Deleted a line. area: Deleted an area. relation: Deleted a relation. - multiple: "Deleted {n} objects." + multiple: "Deleted {n} features." incomplete_relation: - single: This object can't be deleted because it hasn't been fully downloaded. - multiple: These objects can't be deleted because they haven't been fully downloaded. + single: This feature can't be deleted because it hasn't been fully downloaded. + multiple: These features can't be deleted because they haven't been fully downloaded. part_of_relation: - single: This object can't be deleted because it is part of a larger relation. You must remove it from the relation first. - multiple: These objects can't be deleted because they are part of larger relations. You must remove them from the relations first. + single: This feature can't be deleted because it is part of a larger relation. You must remove it from the relation first. + multiple: These features can't be deleted because they are part of larger relations. You must remove them from the relations first. connected_to_hidden: - single: This object can't be deleted because it is connected to a hidden feature. - multiple: These objects can't be deleted because some are connected to hidden features. + single: This feature can't be deleted because it is connected to a hidden feature. + multiple: These features can't be deleted because some are connected to hidden features. add_member: annotation: Added a member to a relation. delete_member: @@ -127,71 +127,71 @@ en: move: title: Move description: - single: Move this object to a different location. - multiple: Move these objects to a different location. + single: Move this feature to a different location. + multiple: Move these features to a different location. key: M annotation: point: Moved a point. vertex: Moved a node in a way. line: Moved a line. area: Moved an area. - multiple: Moved multiple objects. + multiple: Moved multiple features. incomplete_relation: - single: This object can't be moved because it hasn't been fully downloaded. - multiple: These objects can't be moved because they haven't been fully downloaded. + single: This feature can't be moved because it hasn't been fully downloaded. + multiple: These features can't be moved because they haven't been fully downloaded. too_large: - single: This object can't be moved because not enough of it is currently visible. - multiple: These objects can't be moved because not enough of them are currently visible. + single: This feature can't be moved because not enough of it is currently visible. + multiple: These features can't be moved because not enough of them are currently visible. connected_to_hidden: - single: This object can't be moved because it is connected to a hidden feature. - multiple: These objects can't be moved because some are connected to hidden features. + single: This feature can't be moved because it is connected to a hidden feature. + multiple: These features can't be moved because some are connected to hidden features. reflect: title: reflect description: long: - single: Reflect this object across its long axis. - multiple: Reflect these objects across their long axis. + single: Reflect this feature across its long axis. + multiple: Reflect these features across their long axis. short: - single: Reflect this object across its short axis. - multiple: Reflect these objects across their short axis. + single: Reflect this feature across its short axis. + multiple: Reflect these features across their short axis. key: long: T short: Y annotation: long: - single: Reflected an object across its long axis. - multiple: Reflected multiple objects across their long axis. + single: Reflected an feature across its long axis. + multiple: Reflected multiple features across their long axis. short: - single: Reflected an object across its short axis. - multiple: Reflected multiple objects across their short axis. + single: Reflected an feature across its short axis. + multiple: Reflected multiple features across their short axis. incomplete_relation: - single: This object can't be reflected because it hasn't been fully downloaded. - multiple: These objects can't be reflected because they haven't been fully downloaded. + single: This feature can't be reflected because it hasn't been fully downloaded. + multiple: These features can't be reflected because they haven't been fully downloaded. too_large: - single: This object can't be reflected because not enough of it is currently visible. - multiple: These objects can't be reflected because not enough of them are currently visible. + single: This feature can't be reflected because not enough of it is currently visible. + multiple: These features can't be reflected because not enough of them are currently visible. connected_to_hidden: - single: This object can't be reflected because it is connected to a hidden feature. - multiple: These objects can't be reflected because some are connected to hidden features. + single: This feature can't be reflected because it is connected to a hidden feature. + multiple: These features can't be reflected because some are connected to hidden features. rotate: title: Rotate description: - single: Rotate this object around its center point. - multiple: Rotate these objects around their center point. + single: Rotate this feature around its center point. + multiple: Rotate these features around their center point. key: R annotation: line: Rotated a line. area: Rotated an area. - multiple: Rotated multiple objects. + multiple: Rotated multiple features. incomplete_relation: - single: This object can't be rotated because it hasn't been fully downloaded. - multiple: These objects can't be rotated because they haven't been fully downloaded. + single: This feature can't be rotated because it hasn't been fully downloaded. + multiple: These features can't be rotated because they haven't been fully downloaded. too_large: - single: This object can't be rotated because not enough of it is currently visible. - multiple: These objects can't be rotated because not enough of them are currently visible. + single: This feature can't be rotated because not enough of it is currently visible. + multiple: These features can't be rotated because not enough of them are currently visible. connected_to_hidden: - single: This object can't be rotated because it is connected to a hidden feature. - multiple: These objects can't be rotated because some are connected to hidden features. + single: This feature can't be rotated because it is connected to a hidden feature. + multiple: These features can't be rotated because some are connected to hidden features. reverse: title: Reverse description: Make this line go in the opposite direction. @@ -310,7 +310,7 @@ en: back_tooltip: Change feature remove: Remove search: Search - multiselect: Selected items + multiselect: Selected features unknown: Unknown incomplete: feature_list: Search features @@ -423,12 +423,12 @@ en: done: "All conflicts resolved!" help: | Another user changed some of the same map features you changed. - Click on each item below for more details about the conflict, and choose whether to keep + Click on each feature below for more details about the conflict, and choose whether to keep your changes or the other user's changes. merge_remote_changes: conflict: - deleted: 'This object has been deleted by {user}.' - location: 'This object was moved by both you and {user}.' + deleted: 'This feature has been deleted by {user}.' + location: 'This feature was moved by both you and {user}.' nodelist: 'Nodes were changed by both you and {user}.' memberlist: 'Relation members were changed by both you and {user}.' tags: 'You changed the {tag} tag to "{local}" and {user} changed it to "{remote}".' @@ -462,7 +462,7 @@ en: untagged_point: Untagged point untagged_line: Untagged line untagged_area: Untagged area - many_deletions: "You're deleting {n} objects. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org." + many_deletions: "You're deleting {n} features. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org." tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area" untagged_point_tooltip: "Select a feature type that describes what this point is." untagged_line_tooltip: "Select a feature type that describes what this line is." diff --git a/dist/locales/en.json b/dist/locales/en.json index 3a68e6275..657f86b89 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -102,8 +102,8 @@ "delete": { "title": "Delete", "description": { - "single": "Delete this object permanently.", - "multiple": "Delete these objects permanently." + "single": "Delete this feature permanently.", + "multiple": "Delete these features permanently." }, "annotation": { "point": "Deleted a point.", @@ -111,19 +111,19 @@ "line": "Deleted a line.", "area": "Deleted an area.", "relation": "Deleted a relation.", - "multiple": "Deleted {n} objects." + "multiple": "Deleted {n} features." }, "incomplete_relation": { - "single": "This object can't be deleted because it hasn't been fully downloaded.", - "multiple": "These objects can't be deleted because they haven't been fully downloaded." + "single": "This feature can't be deleted because it hasn't been fully downloaded.", + "multiple": "These features can't be deleted because they haven't been fully downloaded." }, "part_of_relation": { - "single": "This object can't be deleted because it is part of a larger relation. You must remove it from the relation first.", - "multiple": "These objects can't be deleted because they are part of larger relations. You must remove them from the relations first." + "single": "This feature can't be deleted because it is part of a larger relation. You must remove it from the relation first.", + "multiple": "These features can't be deleted because they are part of larger relations. You must remove them from the relations first." }, "connected_to_hidden": { - "single": "This object can't be deleted because it is connected to a hidden feature.", - "multiple": "These objects can't be deleted because some are connected to hidden features." + "single": "This feature can't be deleted because it is connected to a hidden feature.", + "multiple": "These features can't be deleted because some are connected to hidden features." } }, "add_member": { @@ -163,8 +163,8 @@ "move": { "title": "Move", "description": { - "single": "Move this object to a different location.", - "multiple": "Move these objects to a different location." + "single": "Move this feature to a different location.", + "multiple": "Move these features to a different location." }, "key": "M", "annotation": { @@ -172,31 +172,31 @@ "vertex": "Moved a node in a way.", "line": "Moved a line.", "area": "Moved an area.", - "multiple": "Moved multiple objects." + "multiple": "Moved multiple features." }, "incomplete_relation": { - "single": "This object can't be moved because it hasn't been fully downloaded.", - "multiple": "These objects can't be moved because they haven't been fully downloaded." + "single": "This feature can't be moved because it hasn't been fully downloaded.", + "multiple": "These features can't be moved because they haven't been fully downloaded." }, "too_large": { - "single": "This object can't be moved because not enough of it is currently visible.", - "multiple": "These objects can't be moved because not enough of them are currently visible." + "single": "This feature can't be moved because not enough of it is currently visible.", + "multiple": "These features can't be moved because not enough of them are currently visible." }, "connected_to_hidden": { - "single": "This object can't be moved because it is connected to a hidden feature.", - "multiple": "These objects can't be moved because some are connected to hidden features." + "single": "This feature can't be moved because it is connected to a hidden feature.", + "multiple": "These features can't be moved because some are connected to hidden features." } }, "reflect": { "title": "reflect", "description": { "long": { - "single": "Reflect this object across its long axis.", - "multiple": "Reflect these objects across their long axis." + "single": "Reflect this feature across its long axis.", + "multiple": "Reflect these features across their long axis." }, "short": { - "single": "Reflect this object across its short axis.", - "multiple": "Reflect these objects across their short axis." + "single": "Reflect this feature across its short axis.", + "multiple": "Reflect these features across their short axis." } }, "key": { @@ -205,50 +205,50 @@ }, "annotation": { "long": { - "single": "Reflected an object across its long axis.", - "multiple": "Reflected multiple objects across their long axis." + "single": "Reflected an feature across its long axis.", + "multiple": "Reflected multiple features across their long axis." }, "short": { - "single": "Reflected an object across its short axis.", - "multiple": "Reflected multiple objects across their short axis." + "single": "Reflected an feature across its short axis.", + "multiple": "Reflected multiple features across their short axis." } }, "incomplete_relation": { - "single": "This object can't be reflected because it hasn't been fully downloaded.", - "multiple": "These objects can't be reflected because they haven't been fully downloaded." + "single": "This feature can't be reflected because it hasn't been fully downloaded.", + "multiple": "These features can't be reflected because they haven't been fully downloaded." }, "too_large": { - "single": "This object can't be reflected because not enough of it is currently visible.", - "multiple": "These objects can't be reflected because not enough of them are currently visible." + "single": "This feature can't be reflected because not enough of it is currently visible.", + "multiple": "These features can't be reflected because not enough of them are currently visible." }, "connected_to_hidden": { - "single": "This object can't be reflected because it is connected to a hidden feature.", - "multiple": "These objects can't be reflected because some are connected to hidden features." + "single": "This feature can't be reflected because it is connected to a hidden feature.", + "multiple": "These features can't be reflected because some are connected to hidden features." } }, "rotate": { "title": "Rotate", "description": { - "single": "Rotate this object around its center point.", - "multiple": "Rotate these objects around their center point." + "single": "Rotate this feature around its center point.", + "multiple": "Rotate these features around their center point." }, "key": "R", "annotation": { "line": "Rotated a line.", "area": "Rotated an area.", - "multiple": "Rotated multiple objects." + "multiple": "Rotated multiple features." }, "incomplete_relation": { - "single": "This object can't be rotated because it hasn't been fully downloaded.", - "multiple": "These objects can't be rotated because they haven't been fully downloaded." + "single": "This feature can't be rotated because it hasn't been fully downloaded.", + "multiple": "These features can't be rotated because they haven't been fully downloaded." }, "too_large": { - "single": "This object can't be rotated because not enough of it is currently visible.", - "multiple": "These objects can't be rotated because not enough of them are currently visible." + "single": "This feature can't be rotated because not enough of it is currently visible.", + "multiple": "These features can't be rotated because not enough of them are currently visible." }, "connected_to_hidden": { - "single": "This object can't be rotated because it is connected to a hidden feature.", - "multiple": "These objects can't be rotated because some are connected to hidden features." + "single": "This feature can't be rotated because it is connected to a hidden feature.", + "multiple": "These features can't be rotated because some are connected to hidden features." } }, "reverse": { @@ -388,7 +388,7 @@ "back_tooltip": "Change feature", "remove": "Remove", "search": "Search", - "multiselect": "Selected items", + "multiselect": "Selected features", "unknown": "Unknown", "incomplete": "", "feature_list": "Search features", @@ -522,13 +522,13 @@ "delete": "Leave Deleted", "download_changes": "Or download your changes.", "done": "All conflicts resolved!", - "help": "Another user changed some of the same map features you changed.\nClick on each item below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes.\n" + "help": "Another user changed some of the same map features you changed.\nClick on each feature below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes.\n" } }, "merge_remote_changes": { "conflict": { - "deleted": "This object has been deleted by {user}.", - "location": "This object was moved by both you and {user}.", + "deleted": "This feature has been deleted by {user}.", + "location": "This feature was moved by both you and {user}.", "nodelist": "Nodes were changed by both you and {user}.", "memberlist": "Relation members were changed by both you and {user}.", "tags": "You changed the {tag} tag to \"{local}\" and {user} changed it to \"{remote}\"." @@ -569,7 +569,7 @@ "untagged_point": "Untagged point", "untagged_line": "Untagged line", "untagged_area": "Untagged area", - "many_deletions": "You're deleting {n} objects. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org.", + "many_deletions": "You're deleting {n} features. Are you sure you want to do this? This will delete them from the map that everyone else sees on openstreetmap.org.", "tag_suggests_area": "The tag {tag} suggests line should be area, but it is not an area", "untagged_point_tooltip": "Select a feature type that describes what this point is.", "untagged_line_tooltip": "Select a feature type that describes what this line is.", From e9dfa04dd49e339124e0972ea3287191a07ce856 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 30 Dec 2016 23:32:00 -0500 Subject: [PATCH 19/59] Social Facility preset improvements (closes #3702) * Add `social facility` field * Make sure Social Facility presets have both `social_facility` and `social_facility:for` * Change `social_facility:for` from radio to combo, because so many choices --- data/presets.yaml | 7 ++--- data/presets/fields.json | 26 +++++-------------- data/presets/fields/social_facility.json | 5 ++++ data/presets/fields/social_facility_for.json | 24 +++-------------- data/presets/presets.json | 18 ++++++++----- data/presets/presets/amenity/crematorium.json | 5 ++-- .../presets/amenity/social_facility.json | 8 +++--- .../amenity/social_facility/food_bank.json | 5 ++-- .../amenity/social_facility/group_home.json | 5 ++-- .../social_facility/homeless_shelter.json | 3 ++- dist/locales/en.json | 6 +++-- 11 files changed, 48 insertions(+), 64 deletions(-) create mode 100644 data/presets/fields/social_facility.json diff --git a/data/presets.yaml b/data/presets.yaml index 24c3d5cce..e13de0430 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -1062,11 +1062,12 @@ en: very_horrible: 'Specialized off-road: tractor, ATV' # smoothness field placeholder placeholder: 'Thin Rollers, Wheels, Off-Road...' + social_facility: + # social_facility=* + label: Type social_facility_for: # 'social_facility:for=*' - label: People served - # social_facility_for field placeholder - placeholder: 'Homeless, Disabled, Child, etc' + label: People Served source: # source=* label: Source diff --git a/data/presets/fields.json b/data/presets/fields.json index 30e94f64c..5c9b606b8 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -1409,25 +1409,13 @@ }, "social_facility_for": { "key": "social_facility:for", - "type": "radio", - "label": "People served", - "placeholder": "Homeless, Disabled, Child, etc", - "options": [ - "abused", - "child", - "disabled", - "diseased", - "drug_addicted", - "homeless", - "juvenile", - "mental_health", - "migrant", - "orphan", - "senior", - "underprivileged", - "unemployed", - "victim" - ] + "type": "combo", + "label": "People Served" + }, + "social_facility": { + "key": "social_facility", + "type": "combo", + "label": "Type" }, "source": { "key": "source", diff --git a/data/presets/fields/social_facility.json b/data/presets/fields/social_facility.json new file mode 100644 index 000000000..901e38fa8 --- /dev/null +++ b/data/presets/fields/social_facility.json @@ -0,0 +1,5 @@ +{ + "key": "social_facility", + "type": "combo", + "label": "Type" +} diff --git a/data/presets/fields/social_facility_for.json b/data/presets/fields/social_facility_for.json index cf4a6212f..960201be5 100644 --- a/data/presets/fields/social_facility_for.json +++ b/data/presets/fields/social_facility_for.json @@ -1,23 +1,5 @@ { "key": "social_facility:for", - "type": "radio", - "label": "People served", - "placeholder": "Homeless, Disabled, Child, etc", - "options": [ - "abused", - "child", - "disabled", - "diseased", - "drug_addicted", - "homeless", - "juvenile", - "mental_health", - "migrant", - "orphan", - "senior", - "underprivileged", - "unemployed", - "victim" - ] - -} \ No newline at end of file + "type": "combo", + "label": "People Served" +} diff --git a/data/presets/presets.json b/data/presets/presets.json index a6b4f992c..12d0d6388 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -2109,9 +2109,10 @@ "operator", "address", "building_area", + "social_facility", + "social_facility_for", "opening_hours", - "wheelchair", - "social_facility_for" + "wheelchair" ], "geometry": [ "point", @@ -2128,8 +2129,9 @@ "operator", "address", "building_area", - "opening_hours", - "social_facility_for" + "social_facility", + "social_facility_for", + "opening_hours" ], "geometry": [ "point", @@ -2147,9 +2149,10 @@ "operator", "address", "building_area", + "social_facility", + "social_facility_for", "opening_hours", - "wheelchair", - "social_facility_for" + "wheelchair" ], "geometry": [ "point", @@ -2172,9 +2175,10 @@ "operator", "address", "building_area", + "social_facility", + "social_facility_for", "opening_hours", "wheelchair", - "social_facility_for", "internet_access", "internet_access/fee", "internet_access/ssid" diff --git a/data/presets/presets/amenity/crematorium.json b/data/presets/presets/amenity/crematorium.json index acfca6ada..cde1bbe3f 100644 --- a/data/presets/presets/amenity/crematorium.json +++ b/data/presets/presets/amenity/crematorium.json @@ -5,10 +5,9 @@ "phone", "opening_hours", "wheelchair" - ], "geometry": [ - "area", + "area", "point" ], "tags": { @@ -16,4 +15,4 @@ }, "terms": ["cemetery","funeral"], "name": "Crematorium" -} \ No newline at end of file +} diff --git a/data/presets/presets/amenity/social_facility.json b/data/presets/presets/amenity/social_facility.json index 926a814b8..58dfa0402 100644 --- a/data/presets/presets/amenity/social_facility.json +++ b/data/presets/presets/amenity/social_facility.json @@ -3,16 +3,16 @@ "operator", "address", "building_area", + "social_facility", + "social_facility_for", "opening_hours", - "wheelchair", - "social_facility_for" + "wheelchair" ], "geometry": [ "point", "area" ], - "terms": [ - ], + "terms": [], "tags": { "amenity": "social_facility" }, diff --git a/data/presets/presets/amenity/social_facility/food_bank.json b/data/presets/presets/amenity/social_facility/food_bank.json index 46053afac..680a7619d 100644 --- a/data/presets/presets/amenity/social_facility/food_bank.json +++ b/data/presets/presets/amenity/social_facility/food_bank.json @@ -3,8 +3,9 @@ "operator", "address", "building_area", - "opening_hours", - "social_facility_for" + "social_facility", + "social_facility_for", + "opening_hours" ], "geometry": [ "point", diff --git a/data/presets/presets/amenity/social_facility/group_home.json b/data/presets/presets/amenity/social_facility/group_home.json index ccf07da2a..620540fac 100644 --- a/data/presets/presets/amenity/social_facility/group_home.json +++ b/data/presets/presets/amenity/social_facility/group_home.json @@ -3,9 +3,10 @@ "operator", "address", "building_area", + "social_facility", + "social_facility_for", "opening_hours", - "wheelchair", - "social_facility_for" + "wheelchair" ], "geometry": [ "point", diff --git a/data/presets/presets/amenity/social_facility/homeless_shelter.json b/data/presets/presets/amenity/social_facility/homeless_shelter.json index 717ddece7..96b6128af 100644 --- a/data/presets/presets/amenity/social_facility/homeless_shelter.json +++ b/data/presets/presets/amenity/social_facility/homeless_shelter.json @@ -3,9 +3,10 @@ "operator", "address", "building_area", + "social_facility", + "social_facility_for", "opening_hours", "wheelchair", - "social_facility_for", "internet_access", "internet_access/fee", "internet_access/ssid" diff --git a/dist/locales/en.json b/dist/locales/en.json index 657f86b89..cb3dabc40 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1607,8 +1607,10 @@ } }, "social_facility_for": { - "label": "People served", - "placeholder": "Homeless, Disabled, Child, etc" + "label": "People Served" + }, + "social_facility": { + "label": "Type" }, "source": { "label": "Source" From 8eb9342409b7ae99ebe5d99c05a93d95ca2b2527 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Fri, 30 Dec 2016 12:49:24 -0500 Subject: [PATCH 20/59] chore(package): update rollup to version 0.39.2 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 55e2b4645..ce0ef9a0c 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "npm-run-all": "~3.1.1", "phantomjs-prebuilt": "~2.1.11", "request": "~2.79.0", - "rollup": "0.38.0", + "rollup": "0.39.2", "rollup-plugin-commonjs": "6.0.1", "rollup-plugin-json": "2.0.2", "rollup-plugin-node-resolve": "2.0.0", From 1f63f43231ab79910256311b3b8f34484ffc7b89 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sat, 31 Dec 2016 00:08:19 -0500 Subject: [PATCH 21/59] chore(package): update rollup-plugin-commonjs to version 7.0.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce0ef9a0c..019d3de9b 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "phantomjs-prebuilt": "~2.1.11", "request": "~2.79.0", "rollup": "0.39.2", - "rollup-plugin-commonjs": "6.0.1", + "rollup-plugin-commonjs": "7.0.0", "rollup-plugin-json": "2.0.2", "rollup-plugin-node-resolve": "2.0.0", "shelljs": "~0.7.5", From 4e2d975e1372721038c9a07167f7c259d5eb5385 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sat, 24 Dec 2016 09:44:51 -0500 Subject: [PATCH 22/59] chore(package): update lodash to version 4.17.3 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 019d3de9b..e509fb5c0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "diacritics": "1.2.3", - "lodash": "4.17.2", + "lodash": "4.17.3", "marked": "0.3.6", "osm-auth": "1.0.1", "rbush": "2.0.1", From c2713c3a3f95eb20b0c7e37e4ae3f918c7032ee8 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 31 Dec 2016 02:01:13 -0500 Subject: [PATCH 23/59] For node-way merge, preserve original node if possible (closes #3683) --- modules/actions/merge.js | 25 ++++++++++++++++++++++--- modules/operations/merge.js | 5 ++++- test/spec/actions/merge.js | 19 +++++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/modules/actions/merge.js b/modules/actions/merge.js index a2ff40ffc..2797253f7 100644 --- a/modules/actions/merge.js +++ b/modules/actions/merge.js @@ -17,15 +17,34 @@ export function actionMerge(ids) { points.forEach(function(point) { target = target.mergeTags(point.tags); + graph = graph.replace(target); graph.parentRelations(point).forEach(function(parent) { graph = graph.replace(parent.replaceMember(point, target)); }); - graph = graph.remove(point); - }); + var nodes = _.uniq(graph.childNodes(target)), + removeNode = point; - graph = graph.replace(target); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (graph.parentWays(node).length > 1 || + graph.parentRelations(node).length || + node.hasInterestingTags()) { + continue; + } + + // Found an uninteresting child node on the target way. + // Move orig point into its place to preserve point's history. #3683 + graph = graph.replace(point.update({ tags: {}, loc: node.loc })); + target = target.replaceNode(node.id, point.id); + graph = graph.replace(target); + removeNode = node; + break; + } + + graph = graph.remove(removeNode); + }); return graph; }; diff --git a/modules/operations/merge.js b/modules/operations/merge.js index d58a9a8bf..c55e3c350 100644 --- a/modules/operations/merge.js +++ b/modules/operations/merge.js @@ -27,7 +27,10 @@ export function operationMerge(selectedIDs, context) { } context.perform(action, annotation); - var ids = selectedIDs.filter(function(id) { return context.hasEntity(id); }); + var ids = selectedIDs.filter(function(id) { + var entity = context.hasEntity(id); + return entity && entity.type !== 'node'; + }); context.enter(modeSelect(context, ids).suppressMenu(true)); }; diff --git a/test/spec/actions/merge.js b/test/spec/actions/merge.js index 6b23ed9a8..dc3d27059 100644 --- a/test/spec/actions/merge.js +++ b/test/spec/actions/merge.js @@ -36,4 +36,23 @@ describe('iD.actionMerge', function () { expect(graph.entity('w').tags).to.eql({a: 'a', b: 'b', area: 'yes'}); expect(graph.entity('r').members).to.eql([{id: 'w', role: 'r', type: 'way'}]); }); + + it('preserves original point if possible', function () { + var graph = iD.Graph([ + iD.Node({id: 'a', loc: [1, 0], tags: {a: 'a'}}), + iD.Node({id: 'p', loc: [0, 0], tags: {p: 'p'}}), + iD.Node({id: 'q', loc: [0, 1]}), + iD.Way({id: 'w', nodes: ['p', 'q'], tags: {w: 'w'}}) + ]), + action = iD.actionMerge(['a', 'w']); + + graph = action(graph); + expect(graph.hasEntity('a')).to.be.ok; + expect(graph.hasEntity('p')).to.be.ok; + expect(graph.hasEntity('q')).to.be.undefined; + expect(graph.entity('w').tags).to.eql({a: 'a', w: 'w'}); + expect(graph.entity('w').nodes).to.eql(['p', 'a']); + expect(graph.entity('a').loc[0]).to.eql(0); + expect(graph.entity('a').loc[1]).to.eql(1); + }); }); From 8c812f6fb8a56855cc1658c2e8d33bff30d6d1dc Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sat, 31 Dec 2016 10:48:49 -0500 Subject: [PATCH 24/59] chore(package): update npm-run-all to version 4.0.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e509fb5c0..2ae4b8658 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "mocha": "~3.2.0", "mocha-phantomjs-core": "~2.1.0", "name-suggestion-index": "0.1.1", - "npm-run-all": "~3.1.1", + "npm-run-all": "~4.0.0", "phantomjs-prebuilt": "~2.1.11", "request": "~2.79.0", "rollup": "0.39.2", From 92b5ce133d573ff863dd736c2a5399226606dfc0 Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Sun, 1 Jan 2017 15:41:47 +0330 Subject: [PATCH 25/59] fix persian characters on chrome and safari --- modules/core/fix-string.js | 90 ++++++++++++++++++++++++++++++++++++++ modules/services/osm.js | 30 +++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 modules/core/fix-string.js diff --git a/modules/core/fix-string.js b/modules/core/fix-string.js new file mode 100644 index 000000000..3e002e8fc --- /dev/null +++ b/modules/core/fix-string.js @@ -0,0 +1,90 @@ +const chars = { + 1575: {initial: "ا", isolated: "ا", medial: "", final: "ﺎ" }, + 1576: {initial: "ﺑ", isolated: "ﺏ", medial: "ﺒ", final: "ﺐ" }, + 1662: {initial: "ﭘ", isolated: "ﭖ", medial: "ﭙ", final: "ﭗ" }, + 1578: {initial: "ﺗ", isolated: "ﺕ", medial: "ﺘ", final: "ﺖ" }, + 1579: {initial: "ﺛ", isolated: "ﺙ", medial: "ﺜ", final: "ﺚ" }, + 1580: {initial: "ﺟ", isolated: "ﺝ", medial: "ﺠ", final: "ﺞ" }, + 1670: {initial: "ﭼ", isolated: "ﭺ", medial: "ﭽ", final: "ﭻ" }, + 1581: {initial: "ﺣ", isolated: "ﺡ", medial: "ﺤ", final: "ﺢ" }, + 1582: {initial: "ﺧ", isolated: "ﺥ", medial: "ﺨ", final: "ﺦ" }, + 1583: {initial: "ﺩ", isolated: "ﺩ", medial: "", final: "ﺪ" }, + 1584: {initial: "ﺫ", isolated: "ﺫ", medial: "", final: "ﺬ" }, + 1585: {initial: "ﺭ", isolated: "ﺭ", medial: "", final: "ﺮ" }, + 1586: {initial: "ﺯ", isolated: "ﺯ", medial: "", final: "ﺰ" }, + 1688: {initial: "ﮊ", isolated: "ﮊ", medial: "", final: "ﮋ" }, + 1587: {initial: "ﺳ", isolated: "ﺱ", medial: "ﺴ", final: "ﺲ" }, + 1588: {initial: "ﺷ", isolated: "ﺵ", medial: "ﺸ", final: "ﺶ" }, + 1589: {initial: "ﺻ", isolated: "ﺹ", medial: "ﺼ", final: "ﺺ" }, + 1590: {initial: "ﺿ", isolated: "ﺽ", medial: "ﻀ", final: "ﺾ" }, + 1591: {initial: "ﻃ", isolated: "ﻁ", medial: "ﻄ", final: "ﻂ" }, + 1592: {initial: "ﻇ", isolated: "ﻅ", medial: "ﻈ", final: "ﻆ" }, + 1593: {initial: "ﻋ", isolated: "ﻉ", medial: "ﻌ", final: "ﻊ" }, + 1594: {initial: "ﻏ", isolated: "ﻍ", medial: "ﻐ", final: "ﻎ" }, + 1601: {initial: "ﻓ", isolated: "ﻑ", medial: "ﻔ", final: "ﻒ" }, + 1602: {initial: "ﻗ", isolated: "ﻕ", medial: "ﻘ", final: "ﻖ" }, + 1705: {initial: "ﻛ", isolated: "ﮎ", medial: "ﻜ", final: "ﮏ" }, + 1711: {initial: "ﮔ", isolated: "ﮒ", medial: "ﮕ", final: "ﮓ" }, + 1604: {initial: "ﻟ", isolated: "ﻝ", medial: "ﻠ", final: "ﻞ" }, + 1605: {initial: "ﻣ", isolated: "ﻡ", medial: "ﻤ", final: "ﻢ" }, + 1606: {initial: "ﻧ", isolated: "ﻥ", medial: "ﻨ", final: "ﻦ" }, + 1608: {initial: "ﻭ", isolated: "ﻭ", medial: "", final: "ﻮ" }, + 1607: {initial: "ﻫ", isolated: "ﻩ", medial: "ﻬ", final: "ﻪ" }, + 1740: {initial: "ﻳ", isolated: "ﻯ", medial: "ﻴ", final: "ﻰ" }, + 5000: {initial: "ﻻ", isolated: "ﻻ", medial: "", final: "ﻼ" } +}; + +export function fixTextForSvg(inputText){ + return inputText.split(' ').reverse().map(function(w){ + return fixWordForSvg(w); + }).join(' '); +} + +export function fixWordForSvg(inputWord){ + let context = true; + let ret = []; + //const inputWord = inputWord.split(''); + for(let i = 0, l = inputWord.length; i < l; i++){ + let code = inputWord[i].charCodeAt(0); + let nextCode = inputWord[i + 1] ? inputWord[i + 1].charCodeAt(0) : 0; + if(!chars[code]){ + ret.push(inputWord[i]); + continue; + } + if(context){ + if(i == l - 1){ + ret.push(chars[code].isolated); + } else { + // special case for لا + if(code == 1604 && nextCode == 1575){ + ret.push(chars[5000].initial); + i++; + context = true; + continue; + } + + ret.push(chars[code].initial); + } + } else { + if(i == l - 1){ + ret.push(chars[code].final); + } else { + // special case for ﻼ + if(code == 1604 && nextCode == 1575){ + ret.push(chars[5000].final); + i++; + context = true; + continue; + } + if(chars[code].medial == ''){ + ret.push(chars[code].final); + } else{ + ret.push(chars[code].medial); + } + } + } + context = (chars[code].medial == ''); + } + + return ret.reverse().join(''); +} \ No newline at end of file diff --git a/modules/services/osm.js b/modules/services/osm.js index defbf6ec1..6ad4366ce 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -7,6 +7,7 @@ import { geoExtent } from '../geo/index'; import { osmEntity, osmNode, osmRelation, osmWay } from '../osm/index'; import { utilDetect } from '../util/detect'; import { utilRebind } from '../util/rebind'; +import { fixTextForSvg } from '../core/fix-string'; var dispatch = d3.dispatch('authLoading', 'authDone', 'change', 'loading', 'loaded'), @@ -70,6 +71,11 @@ function getTags(obj) { var attrs = elems[i].attributes; tags[attrs.k.value] = attrs.v.value; } + var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 + if(tags.name && tags.highway && !isFirefox){ + tags.real_name = tags.name; + tags.name = fixTextForSvg(tags.real_name); + } return tags; } @@ -347,6 +353,30 @@ export default { putChangeset: function(changes, version, comment, imageryUsed, callback) { + if(changes.modified && changes.modified.length > 0){ + for(var i = 0, l = changes.modified.length; i < l; i++){ + if(changes.modified[i].tags.highway && changes.modified[i].tags.real_name){ + changes.modified[i].tags.name = changes.modified[i].tags.real_name; + delete changes.modified[i].tags.real_name; + } + } + } + if(changes.created && changes.created.length > 0){ + for(var i = 0, l = changes.created.length; i < l; i++){ + if(changes.created[i].tags.highway && changes.created[i].tags.real_name){ + changes.created[i].tags.name = changes.created[i].tags.real_name; + delete changes.created[i].tags.real_name; + } + } + } + if(changes.deleted && changes.deleted.length > 0){ + for(var i = 0, l = changes.deleted.length; i < l; i++){ + if(changes.deleted[i].tags.highway && changes.deleted[i].tags.real_name){ + changes.deleted[i].tags.name = changes.deleted[i].tags.real_name; + delete changes.deleted[i].tags.real_name; + } + } + } var that = this; oauth.xhr({ method: 'PUT', From 10d7d7f7b3cf9f718c4c943cf7a531cb8d284ff2 Mon Sep 17 00:00:00 2001 From: Bernd Arnold Date: Sun, 1 Jan 2017 13:16:06 +0100 Subject: [PATCH 26/59] Add fire_hydrant:position field to presets http://wiki.openstreetmap.org/wiki/Tag:emergency%3Dfire_hydrant --- data/presets/fields/fire_hydrant/position.json | 13 +++++++++++++ data/presets/presets/emergency/fire_hydrant.json | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 data/presets/fields/fire_hydrant/position.json diff --git a/data/presets/fields/fire_hydrant/position.json b/data/presets/fields/fire_hydrant/position.json new file mode 100644 index 000000000..e279caf68 --- /dev/null +++ b/data/presets/fields/fire_hydrant/position.json @@ -0,0 +1,13 @@ +{ + "key": "fire_hydrant:position", + "type": "combo", + "label": "Position", + "strings": { + "options": { + "lane": "Lane", + "parking_lot": "Parking lot", + "sidewalk": "Sidewalk", + "green": "Green" + } + } +} diff --git a/data/presets/presets/emergency/fire_hydrant.json b/data/presets/presets/emergency/fire_hydrant.json index 11fb9155f..ea8d5f44d 100644 --- a/data/presets/presets/emergency/fire_hydrant.json +++ b/data/presets/presets/emergency/fire_hydrant.json @@ -1,7 +1,8 @@ { "icon": "fire-station", "fields": [ - "fire_hydrant/type" + "fire_hydrant/type", + "fire_hydrant/position" ], "geometry": [ "point", From dcf90aec3b3dd5f7883b5b5fbd3d13e58899b7b2 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 1 Jan 2017 15:28:08 -0500 Subject: [PATCH 27/59] Run build for presets --- data/presets.yaml | 13 +++++++++++++ data/presets/fields.json | 13 +++++++++++++ data/presets/fields/fire_hydrant/position.json | 2 +- data/presets/presets.json | 6 +++++- data/presets/presets/emergency/fire_hydrant.json | 3 +++ dist/locales/en.json | 11 ++++++++++- 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index e13de0430..8a3a5da72 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -434,6 +434,18 @@ en: fence_type: # fence_type=* label: Type + fire_hydrant/position: + # 'fire_hydrant:position=*' + label: Position + options: + # 'fire_hydrant:position=green' + green: Green + # 'fire_hydrant:position=lane' + lane: Lane + # 'fire_hydrant:position=parking_lot' + parking_lot: Parking Lot + # 'fire_hydrant:position=sidewalk' + sidewalk: Sidewalk fire_hydrant/type: # 'fire_hydrant:type=*' label: Type @@ -2302,6 +2314,7 @@ en: emergency/fire_hydrant: # emergency=fire_hydrant name: Fire Hydrant + # 'terms: fire plug' terms: '' emergency/no: # emergency=no diff --git a/data/presets/fields.json b/data/presets/fields.json index 5c9b606b8..b02b1f869 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -604,6 +604,19 @@ "type": "combo", "label": "Type" }, + "fire_hydrant/position": { + "key": "fire_hydrant:position", + "type": "combo", + "label": "Position", + "strings": { + "options": { + "lane": "Lane", + "parking_lot": "Parking Lot", + "sidewalk": "Sidewalk", + "green": "Green" + } + } + }, "fire_hydrant/type": { "key": "fire_hydrant:type", "type": "combo", diff --git a/data/presets/fields/fire_hydrant/position.json b/data/presets/fields/fire_hydrant/position.json index e279caf68..0d2e245ec 100644 --- a/data/presets/fields/fire_hydrant/position.json +++ b/data/presets/fields/fire_hydrant/position.json @@ -5,7 +5,7 @@ "strings": { "options": { "lane": "Lane", - "parking_lot": "Parking lot", + "parking_lot": "Parking Lot", "sidewalk": "Sidewalk", "green": "Green" } diff --git a/data/presets/presets.json b/data/presets/presets.json index 12d0d6388..6e08a0a28 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -4515,12 +4515,16 @@ "emergency/fire_hydrant": { "icon": "fire-station", "fields": [ - "fire_hydrant/type" + "fire_hydrant/type", + "fire_hydrant/position" ], "geometry": [ "point", "vertex" ], + "terms": [ + "fire plug" + ], "tags": { "emergency": "fire_hydrant" }, diff --git a/data/presets/presets/emergency/fire_hydrant.json b/data/presets/presets/emergency/fire_hydrant.json index ea8d5f44d..e0a161040 100644 --- a/data/presets/presets/emergency/fire_hydrant.json +++ b/data/presets/presets/emergency/fire_hydrant.json @@ -8,6 +8,9 @@ "point", "vertex" ], + "terms": [ + "fire plug" + ], "tags": { "emergency": "fire_hydrant" }, diff --git a/dist/locales/en.json b/dist/locales/en.json index cb3dabc40..9fc5c8e58 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1098,6 +1098,15 @@ "fence_type": { "label": "Type" }, + "fire_hydrant/position": { + "label": "Position", + "options": { + "lane": "Lane", + "parking_lot": "Parking Lot", + "sidewalk": "Sidewalk", + "green": "Green" + } + }, "fire_hydrant/type": { "label": "Type", "options": { @@ -2759,7 +2768,7 @@ }, "emergency/fire_hydrant": { "name": "Fire Hydrant", - "terms": "" + "terms": "fire plug" }, "emergency/phone": { "name": "Emergency Phone", From 84537fa1c8fd7c6b3f0713d1e712a635ae63321d Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Sat, 31 Dec 2016 17:53:50 -0500 Subject: [PATCH 28/59] chore(package): update lodash to version 4.17.4 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ae4b8658..089383ae4 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "diacritics": "1.2.3", - "lodash": "4.17.3", + "lodash": "4.17.4", "marked": "0.3.6", "osm-auth": "1.0.1", "rbush": "2.0.1", From af1ac89df75c3d3d212fd0bf2a3d48a6c0fdbd5c Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Mon, 2 Jan 2017 14:48:22 +0330 Subject: [PATCH 29/59] Rename fix-string.js and fixTextForSvg function name to a more readable name. User regex to detect arabic characters. Fix editing bugs. --- modules/services/osm.js | 9 +++++---- modules/ui/entity_editor.js | 9 +++++++++ .../{core/fix-string.js => util/svg_paths_arabic_fix.js} | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) rename modules/{core/fix-string.js => util/svg_paths_arabic_fix.js} (96%) diff --git a/modules/services/osm.js b/modules/services/osm.js index 6ad4366ce..bac09e0ba 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -7,7 +7,7 @@ import { geoExtent } from '../geo/index'; import { osmEntity, osmNode, osmRelation, osmWay } from '../osm/index'; import { utilDetect } from '../util/detect'; import { utilRebind } from '../util/rebind'; -import { fixTextForSvg } from '../core/fix-string'; +import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix'; var dispatch = d3.dispatch('authLoading', 'authDone', 'change', 'loading', 'loaded'), @@ -71,10 +71,11 @@ function getTags(obj) { var attrs = elems[i].attributes; tags[attrs.k.value] = attrs.v.value; } - var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1 - if(tags.name && tags.highway && !isFirefox){ + var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1 + var arabicRegex = /[\u0600-\u06FF]/g + if(tags.name && tags.highway && !isFirefox && arabicRegex.test(tags.name)){ tags.real_name = tags.name; - tags.name = fixTextForSvg(tags.real_name); + tags.name = fixArabicScriptTextForSvg(tags.real_name); } return tags; } diff --git a/modules/ui/entity_editor.js b/modules/ui/entity_editor.js index ad10e4768..b66424182 100644 --- a/modules/ui/entity_editor.js +++ b/modules/ui/entity_editor.js @@ -12,6 +12,7 @@ import { uiRawTagEditor } from './raw_tag_editor'; import { uiTagReference } from './tag_reference'; import { uiPreset } from './preset'; import { utilRebind } from '../util/rebind'; +import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix'; export function uiEntityEditor(context) { @@ -224,6 +225,14 @@ export function uiEntityEditor(context) { tags[k] = v; } }); + var arabicRegex = /[\u0600-\u06FF]/g + if(tags.highway && tags.real_name){ + if(arabicRegex.test(tags.real_name)){ + tags.name = fixArabicScriptTextForSvg(tags.real_name); + } else{ + tags.name = tags.real_name; + } + } if (!onInput) { tags = clean(tags); diff --git a/modules/core/fix-string.js b/modules/util/svg_paths_arabic_fix.js similarity index 96% rename from modules/core/fix-string.js rename to modules/util/svg_paths_arabic_fix.js index 3e002e8fc..2fdc101de 100644 --- a/modules/core/fix-string.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -34,13 +34,13 @@ const chars = { 5000: {initial: "ﻻ", isolated: "ﻻ", medial: "", final: "ﻼ" } }; -export function fixTextForSvg(inputText){ +export function fixArabicScriptTextForSvg(inputText){ return inputText.split(' ').reverse().map(function(w){ - return fixWordForSvg(w); + return fixArabicScriptWordForSvg(w); }).join(' '); } -export function fixWordForSvg(inputWord){ +export function fixArabicScriptWordForSvg(inputWord){ let context = true; let ret = []; //const inputWord = inputWord.split(''); From 5102782bdb75ea63ce2f30f7e1595751d622cf86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=22Natsuyasumi=22=20Kuranowski?= Date: Mon, 2 Jan 2017 18:07:32 +0100 Subject: [PATCH 30/59] Adding japanese address scheme --- data/address-formats.json | 4 ++++ data/presets.yaml | 6 +++++- data/presets/fields.json | 8 ++++++++ data/presets/fields/address.json | 8 ++++++++ dist/locales/en.json | 4 ++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/data/address-formats.json b/data/address-formats.json index 973535963..0e3f01b7a 100644 --- a/data/address-formats.json +++ b/data/address-formats.json @@ -38,6 +38,10 @@ { "countryCodes": ["tw"], "format": [["postcode", "city", "district"], ["place", "street"], ["housenumber", "floor"]] + }, + { + "countryCodes": ["jp"], + "format": [["province", "county"], ["city", "suburb", "quarter"], ["neighbourhood", "block_number", "housenumber"]] } ] } diff --git a/data/presets.yaml b/data/presets.yaml index d536bc552..d0bae9c11 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -78,20 +78,24 @@ en: # access=* label: Access address: - # 'addr:city=*, addr:conscriptionnumber=*, addr:country=*, addr:district=*, addr:floor=*, addr:hamlet=*, addr:housename=*, addr:housenumber=*, addr:place=*, addr:postcode=*, addr:province=*, addr:state=*, addr:street=*, addr:subdistrict=*, addr:suburb=*' + # 'addr:block_number=*, addr:city=*, addr:conscriptionnumber=*, addr:county=*, addr:country=*, addr:district=*, addr:floor=*, addr:hamlet=*, addr:housename=*, addr:housenumber=*, addr:neighbourhood=*, addr:place=*, addr:postcode=*, addr:province=*, addr:quarter=*, addr:state=*, addr:street=*, addr:subdistrict=*, addr:suburb=*' label: Address placeholders: + block_number: Block number city: City conscriptionnumber: '123' country: Country + county: County district: District floor: Floor hamlet: Hamlet housename: Housename housenumber: '123' + neighbourhood: Neighbourhood place: Place postcode: Postcode province: Province + quarter: Quarter state: State street: Street subdistrict: Subdistrict diff --git a/data/presets/fields.json b/data/presets/fields.json index d7b964d76..6c52c9c70 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -79,17 +79,21 @@ "address": { "type": "address", "keys": [ + "addr:block_number", "addr:city", "addr:conscriptionnumber", + "addr:county", "addr:country", "addr:district", "addr:floor", "addr:hamlet", "addr:housename", "addr:housenumber", + "addr:neighbourhood", "addr:place", "addr:postcode", "addr:province", + "addr:quarter", "addr:state", "addr:street", "addr:subdistrict", @@ -103,17 +107,21 @@ "label": "Address", "strings": { "placeholders": { + "block_number": "Block number", "city": "City", "conscriptionnumber": "123", + "county": "County", "country": "Country", "district": "District", "floor": "Floor", "hamlet": "Hamlet", "housename": "Housename", "housenumber": "123", + "neighbourhood": "Neighbourhood", "place": "Place", "postcode": "Postcode", "province": "Province", + "quarter": "Quarter", "state": "State", "street": "Street", "subdistrict": "Subdistrict", diff --git a/data/presets/fields/address.json b/data/presets/fields/address.json index 9d223b744..ff1e5f505 100644 --- a/data/presets/fields/address.json +++ b/data/presets/fields/address.json @@ -1,17 +1,21 @@ { "type": "address", "keys": [ + "addr:block_number", "addr:city", "addr:conscriptionnumber", + "addr:county", "addr:country", "addr:district", "addr:floor", "addr:hamlet", "addr:housename", "addr:housenumber", + "addr:neighbourhood", "addr:place", "addr:postcode", "addr:province", + "addr:quarter", "addr:state", "addr:street", "addr:subdistrict", @@ -23,17 +27,21 @@ "label": "Address", "strings": { "placeholders": { + "block_number": "Block number", "city": "City", "conscriptionnumber": "123", + "county": "County", "country": "Country", "district": "District", "floor": "Floor", "hamlet": "Hamlet", "housename": "Housename", "housenumber": "123", + "neighbourhood": "Neighbourhood", "place": "Place", "postcode": "Postcode", "province": "Province", + "quarter": "Quarter", "state": "State", "street": "Street", "subdistrict": "Subdistrict", diff --git a/dist/locales/en.json b/dist/locales/en.json index 44949de8f..402a34324 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -703,17 +703,21 @@ "address": { "label": "Address", "placeholders": { + "block_number": "Block number", "city": "City", "conscriptionnumber": "123", + "county": "County", "country": "Country", "district": "District", "floor": "Floor", "hamlet": "Hamlet", "housename": "Housename", "housenumber": "123", + "neighbourhood": "Neighbourhood", "place": "Place", "postcode": "Postcode", "province": "Province", + "quarter": "Quarter", "state": "State", "street": "Street", "subdistrict": "Subdistrict", From fc5aea739fb57a6b3d44adda5d61904a336f8991 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 2 Jan 2017 18:51:12 -0500 Subject: [PATCH 31/59] Update fontstack to use better system fonts over Helvetecia Neue --- css/app.css | 10 ++++++++-- modules/ui/fields/address.js | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/css/app.css b/css/app.css index bb473e00f..071904ffe 100644 --- a/css/app.css +++ b/css/app.css @@ -11,7 +11,10 @@ html, body { } body { - font:normal 12px/1.6667 'Helvetica Neue', Arial, sans-serif; + font: normal 12px/1.6667 -apple-system, BlinkMacSystemFont, + "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", + "Fira Sans", "Droid Sans", "Helvetica Neue", "Arial", + sans-serif; margin:0; padding:0; min-width: 768px; @@ -148,7 +151,10 @@ a:hover { textarea { resize: vertical; - font:normal 12px/20px 'Helvetica Neue', Arial, sans-serif; + font:normal 12px/20px -apple-system, BlinkMacSystemFont, + "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", + "Fira Sans", "Droid Sans", "Helvetica Neue", "Arial", + sans-serif; } textarea, diff --git a/modules/ui/fields/address.js b/modules/ui/fields/address.js index 64c2cb48b..c3eb7f4f2 100644 --- a/modules/ui/fields/address.js +++ b/modules/ui/fields/address.js @@ -159,12 +159,13 @@ export function uiFieldAddress(field, context) { .style('width', function (d) { return d.width * 100 + '%'; }); // Update - // setup dropdowns for common address tags var addrTags = [ - 'street', 'city', 'state', 'province', 'district', - 'subdistrict', 'suburb', 'place', 'postcode' + 'city', 'county', 'country', 'district', 'hamlet', + 'neighbourhood', 'place', 'postcode', 'province', + 'quarter', 'state', 'street', 'subdistrict', 'suburb' ]; + // If fields exist for any of these tags, create dropdowns to pick nearby values.. addrTags.forEach(function(tag) { var nearValues = (tag === 'street') ? getNearStreets : (tag === 'city') ? getNearCities From aba1ab105edaaaaeed72527bc8da4ddc5fef3e06 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 2 Jan 2017 19:41:20 -0500 Subject: [PATCH 32/59] Add postcode to jp address format --- data/address-formats.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/address-formats.json b/data/address-formats.json index 0e3f01b7a..418fd7def 100644 --- a/data/address-formats.json +++ b/data/address-formats.json @@ -41,7 +41,7 @@ }, { "countryCodes": ["jp"], - "format": [["province", "county"], ["city", "suburb", "quarter"], ["neighbourhood", "block_number", "housenumber"]] + "format": [["postcode", "province", "county"], ["city", "suburb", "quarter"], ["neighbourhood", "block_number", "housenumber"]] } ] } From 94ee7d491614a71de7fc50e13f17be4ee6468d0d Mon Sep 17 00:00:00 2001 From: Nick Doiron Date: Tue, 3 Jan 2017 18:18:18 +0800 Subject: [PATCH 33/59] move changes to svg display name --- modules/services/osm.js | 9 +-------- modules/ui/entity_editor.js | 10 ---------- modules/util/util.js | 9 ++++++++- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/modules/services/osm.js b/modules/services/osm.js index bac09e0ba..82feda732 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -7,8 +7,6 @@ import { geoExtent } from '../geo/index'; import { osmEntity, osmNode, osmRelation, osmWay } from '../osm/index'; import { utilDetect } from '../util/detect'; import { utilRebind } from '../util/rebind'; -import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix'; - var dispatch = d3.dispatch('authLoading', 'authDone', 'change', 'loading', 'loaded'), useHttps = window.location.protocol === 'https:', @@ -71,12 +69,7 @@ function getTags(obj) { var attrs = elems[i].attributes; tags[attrs.k.value] = attrs.v.value; } - var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1 - var arabicRegex = /[\u0600-\u06FF]/g - if(tags.name && tags.highway && !isFirefox && arabicRegex.test(tags.name)){ - tags.real_name = tags.name; - tags.name = fixArabicScriptTextForSvg(tags.real_name); - } + return tags; } diff --git a/modules/ui/entity_editor.js b/modules/ui/entity_editor.js index b66424182..86072765a 100644 --- a/modules/ui/entity_editor.js +++ b/modules/ui/entity_editor.js @@ -12,8 +12,6 @@ import { uiRawTagEditor } from './raw_tag_editor'; import { uiTagReference } from './tag_reference'; import { uiPreset } from './preset'; import { utilRebind } from '../util/rebind'; -import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix'; - export function uiEntityEditor(context) { var dispatch = d3.dispatch('choose'), @@ -225,14 +223,6 @@ export function uiEntityEditor(context) { tags[k] = v; } }); - var arabicRegex = /[\u0600-\u06FF]/g - if(tags.highway && tags.real_name){ - if(arabicRegex.test(tags.real_name)){ - tags.name = fixArabicScriptTextForSvg(tags.real_name); - } else{ - tags.name = tags.real_name; - } - } if (!onInput) { tags = clean(tags); diff --git a/modules/util/util.js b/modules/util/util.js index 3302a3f56..112ccb481 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -2,7 +2,7 @@ import * as d3 from 'd3'; import { t, textDirection } from './locale'; import { utilDetect } from './detect'; import { remove as removeDiacritics } from 'diacritics'; - +import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix'; export function utilTagText(entity) { return d3.entries(entity.tags).map(function(e) { @@ -66,6 +66,13 @@ export function utilDisplayName(entity) { name = network + ' ' + name; } } + + var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1 + var arabicRegex = /[\u0600-\u06FF]/g + if(!isFirefox && name && entity.tags.highway && arabicRegex.test(name)){ + name = fixArabicScriptTextForSvg(name); + } + return name; } From 88efc0c8ef33d805ae1008d1d74b40d7c12d6587 Mon Sep 17 00:00:00 2001 From: Nick Doiron Date: Tue, 3 Jan 2017 18:18:29 +0800 Subject: [PATCH 34/59] add and reorder letters --- modules/util/svg_paths_arabic_fix.js | 33 +++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index 2fdc101de..2d37ab0ae 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -1,11 +1,21 @@ const chars = { + // madda above alef + 1570: {initial: "آ‎", isolated: "ﺁ", medial: "ﺁ", final: "ﺂ" }, + + // hamza above and below alef + 1571: { initial: "أ", isolated: "ﺃ", medial: "", final: "ﺄ" }, + // 1572 is ؤ + 1573: { initial: "إ", isolated: "ﺇ", medial: "", final: "ﺈ" }, + // 1574 is ئ 1575: {initial: "ا", isolated: "ا", medial: "", final: "ﺎ" }, 1576: {initial: "ﺑ", isolated: "ﺏ", medial: "ﺒ", final: "ﺐ" }, - 1662: {initial: "ﭘ", isolated: "ﭖ", medial: "ﭙ", final: "ﭗ" }, + + // 1577 ة + 1577: {initial: "", isolated: "ة", medial: "", final: "ﺔ" }, + 1578: {initial: "ﺗ", isolated: "ﺕ", medial: "ﺘ", final: "ﺖ" }, 1579: {initial: "ﺛ", isolated: "ﺙ", medial: "ﺜ", final: "ﺚ" }, 1580: {initial: "ﺟ", isolated: "ﺝ", medial: "ﺠ", final: "ﺞ" }, - 1670: {initial: "ﭼ", isolated: "ﭺ", medial: "ﭽ", final: "ﭻ" }, 1581: {initial: "ﺣ", isolated: "ﺡ", medial: "ﺤ", final: "ﺢ" }, 1582: {initial: "ﺧ", isolated: "ﺥ", medial: "ﺨ", final: "ﺦ" }, 1583: {initial: "ﺩ", isolated: "ﺩ", medial: "", final: "ﺪ" }, @@ -21,15 +31,28 @@ const chars = { 1592: {initial: "ﻇ", isolated: "ﻅ", medial: "ﻈ", final: "ﻆ" }, 1593: {initial: "ﻋ", isolated: "ﻉ", medial: "ﻌ", final: "ﻊ" }, 1594: {initial: "ﻏ", isolated: "ﻍ", medial: "ﻐ", final: "ﻎ" }, + +// 1595 ػ - may be very rare + 1601: {initial: "ﻓ", isolated: "ﻑ", medial: "ﻔ", final: "ﻒ" }, 1602: {initial: "ﻗ", isolated: "ﻕ", medial: "ﻘ", final: "ﻖ" }, - 1705: {initial: "ﻛ", isolated: "ﮎ", medial: "ﻜ", final: "ﮏ" }, - 1711: {initial: "ﮔ", isolated: "ﮒ", medial: "ﮕ", final: "ﮓ" }, 1604: {initial: "ﻟ", isolated: "ﻝ", medial: "ﻠ", final: "ﻞ" }, 1605: {initial: "ﻣ", isolated: "ﻡ", medial: "ﻤ", final: "ﻢ" }, 1606: {initial: "ﻧ", isolated: "ﻥ", medial: "ﻨ", final: "ﻦ" }, - 1608: {initial: "ﻭ", isolated: "ﻭ", medial: "", final: "ﻮ" }, 1607: {initial: "ﻫ", isolated: "ﻩ", medial: "ﻬ", final: "ﻪ" }, + 1608: {initial: "ﻭ", isolated: "ﻭ", medial: "", final: "ﻮ" }, + + // 1609 ى + 1609: {initial: "ﯨ", isolated: "ﻯ", medial: "ﯩ", final: "ﻰ" }, + // 1610 ي + 1610: {initial: "ﻳ", isolated: "ﻱ", medial: "ﻴ", final: "ﻲ" }, + // short vowel sounds / tashkil markings + + 1662: {initial: "ﭘ", isolated: "ﭖ", medial: "ﭙ", final: "ﭗ" }, + + 1670: {initial: "ﭼ", isolated: "ﭺ", medial: "ﭽ", final: "ﭻ" }, + 1705: {initial: "ﻛ", isolated: "ﮎ", medial: "ﻜ", final: "ﮏ" }, + 1711: {initial: "ﮔ", isolated: "ﮒ", medial: "ﮕ", final: "ﮓ" }, 1740: {initial: "ﻳ", isolated: "ﻯ", medial: "ﻴ", final: "ﻰ" }, 5000: {initial: "ﻻ", isolated: "ﻻ", medial: "", final: "ﻼ" } }; From a36650ccbe66fcae2431316f8a74c544a50cdf08 Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Tue, 3 Jan 2017 16:15:08 +0330 Subject: [PATCH 35/59] add arabic kaf to character table --- modules/util/svg_paths_arabic_fix.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index 2d37ab0ae..1e4284ef6 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -51,6 +51,7 @@ const chars = { 1662: {initial: "ﭘ", isolated: "ﭖ", medial: "ﭙ", final: "ﭗ" }, 1670: {initial: "ﭼ", isolated: "ﭺ", medial: "ﭽ", final: "ﭻ" }, + 1603: {initial: "ﻛ", isolated: "ﻙ", medial: "ﻜ", final: "ﻚ" }, 1705: {initial: "ﻛ", isolated: "ﮎ", medial: "ﻜ", final: "ﮏ" }, 1711: {initial: "ﮔ", isolated: "ﮒ", medial: "ﮕ", final: "ﮓ" }, 1740: {initial: "ﻳ", isolated: "ﻯ", medial: "ﻴ", final: "ﻰ" }, From 5da7d83fe9af183ea9409be97dd1ca32ff1f6a98 Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Tue, 3 Jan 2017 16:34:57 +0330 Subject: [PATCH 36/59] Modify railways arabic/persian names --- modules/services/osm.js | 6 +++--- modules/util/util.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/services/osm.js b/modules/services/osm.js index 82feda732..5e6dc3ba0 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -349,7 +349,7 @@ export default { putChangeset: function(changes, version, comment, imageryUsed, callback) { if(changes.modified && changes.modified.length > 0){ for(var i = 0, l = changes.modified.length; i < l; i++){ - if(changes.modified[i].tags.highway && changes.modified[i].tags.real_name){ + if((changes.modified[i].tags.highway || changes.modified[i].tags.railway) && changes.modified[i].tags.real_name){ changes.modified[i].tags.name = changes.modified[i].tags.real_name; delete changes.modified[i].tags.real_name; } @@ -357,7 +357,7 @@ export default { } if(changes.created && changes.created.length > 0){ for(var i = 0, l = changes.created.length; i < l; i++){ - if(changes.created[i].tags.highway && changes.created[i].tags.real_name){ + if((changes.modified[i].tags.highway || changes.modified[i].tags.railway) && changes.created[i].tags.real_name){ changes.created[i].tags.name = changes.created[i].tags.real_name; delete changes.created[i].tags.real_name; } @@ -365,7 +365,7 @@ export default { } if(changes.deleted && changes.deleted.length > 0){ for(var i = 0, l = changes.deleted.length; i < l; i++){ - if(changes.deleted[i].tags.highway && changes.deleted[i].tags.real_name){ + if((changes.modified[i].tags.highway || changes.modified[i].tags.railway) && changes.deleted[i].tags.real_name){ changes.deleted[i].tags.name = changes.deleted[i].tags.real_name; delete changes.deleted[i].tags.real_name; } diff --git a/modules/util/util.js b/modules/util/util.js index 112ccb481..51bbcd976 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -69,7 +69,7 @@ export function utilDisplayName(entity) { var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1 var arabicRegex = /[\u0600-\u06FF]/g - if(!isFirefox && name && entity.tags.highway && arabicRegex.test(name)){ + if(!isFirefox && name && (entity.tags.highway || entity.tags.railway) && arabicRegex.test(name)){ name = fixArabicScriptTextForSvg(name); } From 9e5d3e7c5a3dd33bd0d35d7b518b39c3bb433ef4 Mon Sep 17 00:00:00 2001 From: Nick Doiron Date: Tue, 3 Jan 2017 22:21:15 +0800 Subject: [PATCH 37/59] digest combined LTR and RTL words --- modules/util/svg_paths_arabic_fix.js | 45 +++++++++++++++------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index 1e4284ef6..a6539deba 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -59,56 +59,59 @@ const chars = { }; export function fixArabicScriptTextForSvg(inputText){ - return inputText.split(' ').reverse().map(function(w){ - return fixArabicScriptWordForSvg(w); - }).join(' '); -} - -export function fixArabicScriptWordForSvg(inputWord){ let context = true; - let ret = []; - //const inputWord = inputWord.split(''); - for(let i = 0, l = inputWord.length; i < l; i++){ - let code = inputWord[i].charCodeAt(0); - let nextCode = inputWord[i + 1] ? inputWord[i + 1].charCodeAt(0) : 0; - if(!chars[code]){ - ret.push(inputWord[i]); + let ret = ''; + let rtlBuffer = []; + + for(let i = 0, l = inputText.length; i < l; i++){ + let code = inputText[i].charCodeAt(0); + let nextCode = inputText[i + 1] ? inputText[i + 1].charCodeAt(0) : 0; + if(!chars[code]){ + if (code === 32 && rtlBuffer.length) { + // whitespace + rtlBuffer = [rtlBuffer.reverse().join('') + ' ']; + } else { + // non-RTL character + ret += rtlBuffer.reverse().join('') + inputText[i]; + rtlBuffer = []; + } continue; } if(context){ if(i == l - 1){ - ret.push(chars[code].isolated); + rtlBuffer.push(chars[code].isolated); } else { // special case for لا if(code == 1604 && nextCode == 1575){ - ret.push(chars[5000].initial); + rtlBuffer.push(chars[5000].initial); i++; context = true; continue; } - ret.push(chars[code].initial); + rtlBuffer.push(chars[code].initial); } } else { if(i == l - 1){ - ret.push(chars[code].final); + rtlBuffer.push(chars[code].final); } else { // special case for ﻼ if(code == 1604 && nextCode == 1575){ - ret.push(chars[5000].final); + rtlBuffer.push(chars[5000].final); i++; context = true; continue; } if(chars[code].medial == ''){ - ret.push(chars[code].final); + rtlBuffer.push(chars[code].final); } else{ - ret.push(chars[code].medial); + rtlBuffer.push(chars[code].medial); } } } context = (chars[code].medial == ''); } + ret += rtlBuffer.reverse().join(''); - return ret.reverse().join(''); + return ret; } \ No newline at end of file From 3ef1103c3ae39428712d8c4c7225010989c3e58f Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Tue, 3 Jan 2017 21:57:29 +0330 Subject: [PATCH 38/59] Remove signs of real_name ever existed. --- modules/services/osm.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/modules/services/osm.js b/modules/services/osm.js index 5e6dc3ba0..39cefbee7 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -347,30 +347,6 @@ export default { putChangeset: function(changes, version, comment, imageryUsed, callback) { - if(changes.modified && changes.modified.length > 0){ - for(var i = 0, l = changes.modified.length; i < l; i++){ - if((changes.modified[i].tags.highway || changes.modified[i].tags.railway) && changes.modified[i].tags.real_name){ - changes.modified[i].tags.name = changes.modified[i].tags.real_name; - delete changes.modified[i].tags.real_name; - } - } - } - if(changes.created && changes.created.length > 0){ - for(var i = 0, l = changes.created.length; i < l; i++){ - if((changes.modified[i].tags.highway || changes.modified[i].tags.railway) && changes.created[i].tags.real_name){ - changes.created[i].tags.name = changes.created[i].tags.real_name; - delete changes.created[i].tags.real_name; - } - } - } - if(changes.deleted && changes.deleted.length > 0){ - for(var i = 0, l = changes.deleted.length; i < l; i++){ - if((changes.modified[i].tags.highway || changes.modified[i].tags.railway) && changes.deleted[i].tags.real_name){ - changes.deleted[i].tags.name = changes.deleted[i].tags.real_name; - delete changes.deleted[i].tags.real_name; - } - } - } var that = this; oauth.xhr({ method: 'PUT', From e01534dbd2a6328bc5410fad6d13655007118bda Mon Sep 17 00:00:00 2001 From: Ian Dees Date: Tue, 3 Jan 2017 12:45:32 -0600 Subject: [PATCH 39/59] Move the amenity=coworking_space preset to office=coworking_space --- data/presets/presets/{amenity => office}/coworking_space.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename data/presets/presets/{amenity => office}/coworking_space.json (100%) diff --git a/data/presets/presets/amenity/coworking_space.json b/data/presets/presets/office/coworking_space.json similarity index 100% rename from data/presets/presets/amenity/coworking_space.json rename to data/presets/presets/office/coworking_space.json From 23a37183762adb2b1fe044b9bee3b50d5095eff3 Mon Sep 17 00:00:00 2001 From: Ian Dees Date: Tue, 3 Jan 2017 12:46:53 -0600 Subject: [PATCH 40/59] Lets make it office=coworking instead --- .../presets/office/{coworking_space.json => coworking.json} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename data/presets/presets/office/{coworking_space.json => coworking.json} (91%) diff --git a/data/presets/presets/office/coworking_space.json b/data/presets/presets/office/coworking.json similarity index 91% rename from data/presets/presets/office/coworking_space.json rename to data/presets/presets/office/coworking.json index d10e9135a..e02afb6c5 100644 --- a/data/presets/presets/office/coworking_space.json +++ b/data/presets/presets/office/coworking.json @@ -17,7 +17,7 @@ "office" ], "tags": { - "amenity": "coworking_space" + "office": "coworking" }, "name": "Coworking Space" } From 00d1572bc34bb23422146a0f04fa0c4970745a5e Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 3 Jan 2017 13:58:34 -0500 Subject: [PATCH 41/59] Run build for preset --- data/presets.yaml | 10 ++++----- data/presets/presets.json | 46 +++++++++++++++++++-------------------- data/taginfo.json | 8 +++---- dist/locales/en.json | 8 +++---- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index 87107a6d2..267cd107d 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -1500,11 +1500,6 @@ en: # amenity=courthouse name: Courthouse terms: '' - amenity/coworking_space: - # amenity=coworking_space - name: Coworking Space - # 'terms: coworking,office' - terms: '' amenity/crematorium: # amenity=crematorium name: Crematorium @@ -3252,6 +3247,11 @@ en: # office=company name: Company Office terms: '' + office/coworking: + # office=coworking + name: Coworking Space + # 'terms: coworking,office' + terms: '' office/educational_institution: # office=educational_institution name: Educational Institution diff --git a/data/presets/presets.json b/data/presets/presets.json index 6e08a0a28..d0ba262b6 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -1015,29 +1015,6 @@ }, "name": "Courthouse" }, - "amenity/coworking_space": { - "icon": "commercial", - "fields": [ - "address", - "building_area", - "opening_hours", - "internet_access", - "internet_access/fee", - "internet_access/ssid" - ], - "geometry": [ - "point", - "area" - ], - "terms": [ - "coworking", - "office" - ], - "tags": { - "amenity": "coworking_space" - }, - "name": "Coworking Space" - }, "amenity/crematorium": { "icon": "cemetery", "fields": [ @@ -8168,6 +8145,29 @@ "terms": [], "name": "Company Office" }, + "office/coworking": { + "icon": "commercial", + "fields": [ + "address", + "building_area", + "opening_hours", + "internet_access", + "internet_access/fee", + "internet_access/ssid" + ], + "geometry": [ + "point", + "area" + ], + "terms": [ + "coworking", + "office" + ], + "tags": { + "office": "coworking" + }, + "name": "Coworking Space" + }, "office/educational_institution": { "icon": "commercial", "fields": [ diff --git a/data/taginfo.json b/data/taginfo.json index e8f419cb0..b0b1b15a8 100644 --- a/data/taginfo.json +++ b/data/taginfo.json @@ -231,10 +231,6 @@ "key": "amenity", "value": "courthouse" }, - { - "key": "amenity", - "value": "coworking_space" - }, { "key": "amenity", "value": "crematorium" @@ -1796,6 +1792,10 @@ "key": "office", "value": "company" }, + { + "key": "office", + "value": "coworking" + }, { "key": "office", "value": "educational_institution" diff --git a/dist/locales/en.json b/dist/locales/en.json index e72558924..3c1bfe061 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -2022,10 +2022,6 @@ "name": "Courthouse", "terms": "" }, - "amenity/coworking_space": { - "name": "Coworking Space", - "terms": "coworking,office" - }, "amenity/crematorium": { "name": "Crematorium", "terms": "cemetery,funeral" @@ -3602,6 +3598,10 @@ "name": "Company Office", "terms": "" }, + "office/coworking": { + "name": "Coworking Space", + "terms": "coworking,office" + }, "office/educational_institution": { "name": "Educational Institution", "terms": "" From 2fbeda0f591977938b5957df90af82eeb6734be0 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Tue, 3 Jan 2017 12:12:40 -0500 Subject: [PATCH 42/59] chore(package): update rollup to version 0.40.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 089383ae4..f35c94f60 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "npm-run-all": "~4.0.0", "phantomjs-prebuilt": "~2.1.11", "request": "~2.79.0", - "rollup": "0.39.2", + "rollup": "0.40.0", "rollup-plugin-commonjs": "7.0.0", "rollup-plugin-json": "2.0.2", "rollup-plugin-node-resolve": "2.0.0", From 952a338abf87b62954b475c8195ceeba0643508c Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 3 Jan 2017 17:27:48 -0500 Subject: [PATCH 43/59] eslint / formatting --- modules/util/svg_paths_arabic_fix.js | 127 ++++++++++++++------------- modules/util/util.js | 16 ++-- 2 files changed, 74 insertions(+), 69 deletions(-) diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index a6539deba..2a99c9130 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -1,72 +1,75 @@ const chars = { // madda above alef - 1570: {initial: "آ‎", isolated: "ﺁ", medial: "ﺁ", final: "ﺂ" }, - + 1570: { initial: 'آ‎', isolated: 'ﺁ', medial: 'ﺁ', final: 'ﺂ' }, + // hamza above and below alef - 1571: { initial: "أ", isolated: "ﺃ", medial: "", final: "ﺄ" }, + 1571: { initial: 'أ', isolated: 'ﺃ', medial: '', final: 'ﺄ' }, // 1572 is ؤ - 1573: { initial: "إ", isolated: "ﺇ", medial: "", final: "ﺈ" }, + 1573: { initial: 'إ', isolated: 'ﺇ', medial: '', final: 'ﺈ' }, // 1574 is ئ - 1575: {initial: "ا", isolated: "ا", medial: "", final: "ﺎ" }, - 1576: {initial: "ﺑ", isolated: "ﺏ", medial: "ﺒ", final: "ﺐ" }, + 1575: { initial: 'ا', isolated: 'ا', medial: '', final: 'ﺎ' }, + 1576: { initial: 'ﺑ', isolated: 'ﺏ', medial: 'ﺒ', final: 'ﺐ' }, // 1577 ة - 1577: {initial: "", isolated: "ة", medial: "", final: "ﺔ" }, + 1577: { initial: '', isolated: 'ة', medial: '', final: 'ﺔ' }, - 1578: {initial: "ﺗ", isolated: "ﺕ", medial: "ﺘ", final: "ﺖ" }, - 1579: {initial: "ﺛ", isolated: "ﺙ", medial: "ﺜ", final: "ﺚ" }, - 1580: {initial: "ﺟ", isolated: "ﺝ", medial: "ﺠ", final: "ﺞ" }, - 1581: {initial: "ﺣ", isolated: "ﺡ", medial: "ﺤ", final: "ﺢ" }, - 1582: {initial: "ﺧ", isolated: "ﺥ", medial: "ﺨ", final: "ﺦ" }, - 1583: {initial: "ﺩ", isolated: "ﺩ", medial: "", final: "ﺪ" }, - 1584: {initial: "ﺫ", isolated: "ﺫ", medial: "", final: "ﺬ" }, - 1585: {initial: "ﺭ", isolated: "ﺭ", medial: "", final: "ﺮ" }, - 1586: {initial: "ﺯ", isolated: "ﺯ", medial: "", final: "ﺰ" }, - 1688: {initial: "ﮊ", isolated: "ﮊ", medial: "", final: "ﮋ" }, - 1587: {initial: "ﺳ", isolated: "ﺱ", medial: "ﺴ", final: "ﺲ" }, - 1588: {initial: "ﺷ", isolated: "ﺵ", medial: "ﺸ", final: "ﺶ" }, - 1589: {initial: "ﺻ", isolated: "ﺹ", medial: "ﺼ", final: "ﺺ" }, - 1590: {initial: "ﺿ", isolated: "ﺽ", medial: "ﻀ", final: "ﺾ" }, - 1591: {initial: "ﻃ", isolated: "ﻁ", medial: "ﻄ", final: "ﻂ" }, - 1592: {initial: "ﻇ", isolated: "ﻅ", medial: "ﻈ", final: "ﻆ" }, - 1593: {initial: "ﻋ", isolated: "ﻉ", medial: "ﻌ", final: "ﻊ" }, - 1594: {initial: "ﻏ", isolated: "ﻍ", medial: "ﻐ", final: "ﻎ" }, + 1578: { initial: 'ﺗ', isolated: 'ﺕ', medial: 'ﺘ', final: 'ﺖ' }, + 1579: { initial: 'ﺛ', isolated: 'ﺙ', medial: 'ﺜ', final: 'ﺚ' }, + 1580: { initial: 'ﺟ', isolated: 'ﺝ', medial: 'ﺠ', final: 'ﺞ' }, + 1581: { initial: 'ﺣ', isolated: 'ﺡ', medial: 'ﺤ', final: 'ﺢ' }, + 1582: { initial: 'ﺧ', isolated: 'ﺥ', medial: 'ﺨ', final: 'ﺦ' }, + 1583: { initial: 'ﺩ', isolated: 'ﺩ', medial: '', final: 'ﺪ' }, + 1584: { initial: 'ﺫ', isolated: 'ﺫ', medial: '', final: 'ﺬ' }, + 1585: { initial: 'ﺭ', isolated: 'ﺭ', medial: '', final: 'ﺮ' }, + 1586: { initial: 'ﺯ', isolated: 'ﺯ', medial: '', final: 'ﺰ' }, + 1688: { initial: 'ﮊ', isolated: 'ﮊ', medial: '', final: 'ﮋ' }, + 1587: { initial: 'ﺳ', isolated: 'ﺱ', medial: 'ﺴ', final: 'ﺲ' }, + 1588: { initial: 'ﺷ', isolated: 'ﺵ', medial: 'ﺸ', final: 'ﺶ' }, + 1589: { initial: 'ﺻ', isolated: 'ﺹ', medial: 'ﺼ', final: 'ﺺ' }, + 1590: { initial: 'ﺿ', isolated: 'ﺽ', medial: 'ﻀ', final: 'ﺾ' }, + 1591: { initial: 'ﻃ', isolated: 'ﻁ', medial: 'ﻄ', final: 'ﻂ' }, + 1592: { initial: 'ﻇ', isolated: 'ﻅ', medial: 'ﻈ', final: 'ﻆ' }, + 1593: { initial: 'ﻋ', isolated: 'ﻉ', medial: 'ﻌ', final: 'ﻊ' }, + 1594: { initial: 'ﻏ', isolated: 'ﻍ', medial: 'ﻐ', final: 'ﻎ' }, -// 1595 ػ - may be very rare + // 1595 ػ - may be very rare + + 1601: { initial: 'ﻓ', isolated: 'ﻑ', medial: 'ﻔ', final: 'ﻒ' }, + 1602: { initial: 'ﻗ', isolated: 'ﻕ', medial: 'ﻘ', final: 'ﻖ' }, + 1604: { initial: 'ﻟ', isolated: 'ﻝ', medial: 'ﻠ', final: 'ﻞ' }, + 1605: { initial: 'ﻣ', isolated: 'ﻡ', medial: 'ﻤ', final: 'ﻢ' }, + 1606: { initial: 'ﻧ', isolated: 'ﻥ', medial: 'ﻨ', final: 'ﻦ' }, + 1607: { initial: 'ﻫ', isolated: 'ﻩ', medial: 'ﻬ', final: 'ﻪ' }, + 1608: { initial: 'ﻭ', isolated: 'ﻭ', medial: '', final: 'ﻮ' }, - 1601: {initial: "ﻓ", isolated: "ﻑ", medial: "ﻔ", final: "ﻒ" }, - 1602: {initial: "ﻗ", isolated: "ﻕ", medial: "ﻘ", final: "ﻖ" }, - 1604: {initial: "ﻟ", isolated: "ﻝ", medial: "ﻠ", final: "ﻞ" }, - 1605: {initial: "ﻣ", isolated: "ﻡ", medial: "ﻤ", final: "ﻢ" }, - 1606: {initial: "ﻧ", isolated: "ﻥ", medial: "ﻨ", final: "ﻦ" }, - 1607: {initial: "ﻫ", isolated: "ﻩ", medial: "ﻬ", final: "ﻪ" }, - 1608: {initial: "ﻭ", isolated: "ﻭ", medial: "", final: "ﻮ" }, - // 1609 ى - 1609: {initial: "ﯨ", isolated: "ﻯ", medial: "ﯩ", final: "ﻰ" }, + 1609: { initial: 'ﯨ', isolated: 'ﻯ', medial: 'ﯩ', final: 'ﻰ' }, // 1610 ي - 1610: {initial: "ﻳ", isolated: "ﻱ", medial: "ﻴ", final: "ﻲ" }, + 1610: { initial: 'ﻳ', isolated: 'ﻱ', medial: 'ﻴ', final: 'ﻲ' }, + // short vowel sounds / tashkil markings - 1662: {initial: "ﭘ", isolated: "ﭖ", medial: "ﭙ", final: "ﭗ" }, - - 1670: {initial: "ﭼ", isolated: "ﭺ", medial: "ﭽ", final: "ﭻ" }, - 1603: {initial: "ﻛ", isolated: "ﻙ", medial: "ﻜ", final: "ﻚ" }, - 1705: {initial: "ﻛ", isolated: "ﮎ", medial: "ﻜ", final: "ﮏ" }, - 1711: {initial: "ﮔ", isolated: "ﮒ", medial: "ﮕ", final: "ﮓ" }, - 1740: {initial: "ﻳ", isolated: "ﻯ", medial: "ﻴ", final: "ﻰ" }, - 5000: {initial: "ﻻ", isolated: "ﻻ", medial: "", final: "ﻼ" } + 1662: { initial: 'ﭘ', isolated: 'ﭖ', medial: 'ﭙ', final: 'ﭗ' }, + + 1670: { initial: 'ﭼ', isolated: 'ﭺ', medial: 'ﭽ', final: 'ﭻ' }, + 1603: { initial: 'ﻛ', isolated: 'ﻙ', medial: 'ﻜ', final: 'ﻚ' }, + 1705: { initial: 'ﻛ', isolated: 'ﮎ', medial: 'ﻜ', final: 'ﮏ' }, + 1711: { initial: 'ﮔ', isolated: 'ﮒ', medial: 'ﮕ', final: 'ﮓ' }, + 1740: { initial: 'ﻳ', isolated: 'ﻯ', medial: 'ﻴ', final: 'ﻰ' }, + 5000: { initial: 'ﻻ', isolated: 'ﻻ', medial: '', final: 'ﻼ' } }; -export function fixArabicScriptTextForSvg(inputText){ + +export function fixArabicScriptTextForSvg(inputText) { let context = true; let ret = ''; let rtlBuffer = []; - for(let i = 0, l = inputText.length; i < l; i++){ + for (let i = 0, l = inputText.length; i < l; i++) { let code = inputText[i].charCodeAt(0); let nextCode = inputText[i + 1] ? inputText[i + 1].charCodeAt(0) : 0; - if(!chars[code]){ + + if (!chars[code]) { if (code === 32 && rtlBuffer.length) { // whitespace rtlBuffer = [rtlBuffer.reverse().join('') + ' ']; @@ -76,13 +79,13 @@ export function fixArabicScriptTextForSvg(inputText){ rtlBuffer = []; } continue; - } - if(context){ - if(i == l - 1){ + } + if (context) { + if (i === l - 1) { rtlBuffer.push(chars[code].isolated); } else { // special case for لا - if(code == 1604 && nextCode == 1575){ + if (code === 1604 && nextCode === 1575) { rtlBuffer.push(chars[5000].initial); i++; context = true; @@ -90,28 +93,28 @@ export function fixArabicScriptTextForSvg(inputText){ } rtlBuffer.push(chars[code].initial); - } + } } else { - if(i == l - 1){ + if (i === l - 1){ rtlBuffer.push(chars[code].final); } else { // special case for ﻼ - if(code == 1604 && nextCode == 1575){ + if (code === 1604 && nextCode === 1575){ rtlBuffer.push(chars[5000].final); i++; context = true; continue; } - if(chars[code].medial == ''){ + if (chars[code].medial === ''){ rtlBuffer.push(chars[code].final); - } else{ + } else { rtlBuffer.push(chars[code].medial); - } + } } - } - context = (chars[code].medial == ''); - } + } + context = (chars[code].medial === ''); + } + ret += rtlBuffer.reverse().join(''); - return ret; -} \ No newline at end of file +} diff --git a/modules/util/util.js b/modules/util/util.js index 51bbcd976..cd48a924d 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -2,7 +2,8 @@ import * as d3 from 'd3'; import { t, textDirection } from './locale'; import { utilDetect } from './detect'; import { remove as removeDiacritics } from 'diacritics'; -import { fixArabicScriptTextForSvg } from '../util/svg_paths_arabic_fix'; +import { fixArabicScriptTextForSvg } from './svg_paths_arabic_fix'; + export function utilTagText(entity) { return d3.entries(entity.tags).map(function(e) { @@ -60,19 +61,20 @@ export function utilDisplayName(entity) { var localizedNameKey = 'name:' + utilDetect().locale.toLowerCase().split('-')[0], name = entity.tags[localizedNameKey] || entity.tags.name || '', network = entity.tags.cycle_network || entity.tags.network; + if (!name && entity.tags.ref) { name = entity.tags.ref; if (network) { name = network + ' ' + name; } } - - var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1 - var arabicRegex = /[\u0600-\u06FF]/g - if(!isFirefox && name && (entity.tags.highway || entity.tags.railway) && arabicRegex.test(name)){ - name = fixArabicScriptTextForSvg(name); + + var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1; + var arabicRegex = /[\u0600-\u06FF]/g; + if (!isFirefox && name && (entity.tags.highway || entity.tags.railway) && arabicRegex.test(name)) { + name = fixArabicScriptTextForSvg(name); } - + return name; } From c70b6278fc296569f609dd2f395d3768aa6b1855 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 3 Jan 2017 17:29:33 -0500 Subject: [PATCH 44/59] Avoid es6 let/const (because phantomjs) --- modules/util/svg_paths_arabic_fix.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index 2a99c9130..7f78a08d7 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -1,4 +1,4 @@ -const chars = { +var chars = { // madda above alef 1570: { initial: 'آ‎', isolated: 'ﺁ', medial: 'ﺁ', final: 'ﺂ' }, @@ -61,13 +61,13 @@ const chars = { export function fixArabicScriptTextForSvg(inputText) { - let context = true; - let ret = ''; - let rtlBuffer = []; + var context = true; + var ret = ''; + var rtlBuffer = []; - for (let i = 0, l = inputText.length; i < l; i++) { - let code = inputText[i].charCodeAt(0); - let nextCode = inputText[i + 1] ? inputText[i + 1].charCodeAt(0) : 0; + for (var i = 0, l = inputText.length; i < l; i++) { + var code = inputText[i].charCodeAt(0); + var nextCode = inputText[i + 1] ? inputText[i + 1].charCodeAt(0) : 0; if (!chars[code]) { if (code === 32 && rtlBuffer.length) { From d63c766e699d724b94d45201cb60874c8a3999bc Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 3 Jan 2017 20:58:56 -0500 Subject: [PATCH 45/59] Split into utilDisplayName / utilDisplayNameForPath This is because utilDisplayName gets called a bunch of places and we only want to add the Arabic reversal code for textpath labels --- modules/svg/labels.js | 15 ++++++++++++--- modules/util/index.js | 1 + modules/util/svg_paths_arabic_fix.js | 3 +++ modules/util/util.js | 9 ++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/modules/svg/labels.js b/modules/svg/labels.js index 88adf4906..84b8026a7 100644 --- a/modules/svg/labels.js +++ b/modules/svg/labels.js @@ -1,6 +1,7 @@ import * as d3 from 'd3'; import _ from 'lodash'; import rbush from 'rbush'; + import { geoExtent, geoEuclideanDistance, @@ -8,9 +9,15 @@ import { geoPolygonIntersectsPolygon, geoPathLength } from '../geo/index'; + import { osmEntity } from '../osm/index'; import { utilDetect } from '../util/detect'; -import { utilDisplayName, utilEntitySelector } from '../util/index'; + +import { + utilDisplayName, + utilDisplayNameForPath, + utilEntitySelector +} from '../util/index'; export function svgLabels(projection, context) { @@ -134,7 +141,7 @@ export function svgLabels(projection, context) { .data(entities, osmEntity.key) .attr('startOffset', '50%') .attr('xlink:href', function(d) { return '#labelpath-' + d.id; }) - .text(utilDisplayName); + .text(utilDisplayNameForPath); } @@ -313,9 +320,11 @@ export function svgLabels(projection, context) { entity = labelable[k][i]; geometry = entity.geometry(graph); - var name = utilDisplayName(entity), + var getName = (geometry === 'line') ? utilDisplayNameForPath : utilDisplayName, + name = getName(entity), width = name && textWidth(name, fontSize), p; + if (geometry === 'point') { p = getPointLabel(entity, width, fontSize, geometry); } else if (geometry === 'vertex' && !lowZoom) { diff --git a/modules/util/index.js b/modules/util/index.js index e84dc86db..66847ad5f 100644 --- a/modules/util/index.js +++ b/modules/util/index.js @@ -3,6 +3,7 @@ export { utilEntitySelector } from './util'; export { utilEntityOrMemberSelector } from './util'; export { utilGetAllNodes } from './util'; export { utilDisplayName } from './util'; +export { utilDisplayNameForPath } from './util'; export { utilDisplayType } from './util'; export { utilStringQs } from './util'; export { utilQsString } from './util'; diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index 7f78a08d7..f55878402 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -1,3 +1,6 @@ +// see https://github.com/openstreetmap/iD/pull/3707 +// https://gist.github.com/mapmeld/556b09ddec07a2044c76e1ef45f01c60 + var chars = { // madda above alef 1570: { initial: 'آ‎', isolated: 'ﺁ', medial: 'ﺁ', final: 'ﺂ' }, diff --git a/modules/util/util.js b/modules/util/util.js index cd48a924d..229d0d14b 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -69,9 +69,16 @@ export function utilDisplayName(entity) { } } + return name; +} + + +export function utilDisplayNameForPath(entity) { + var name = utilDisplayName(entity); var isFirefox = utilDetect().browser.toLowerCase().indexOf('firefox') > -1; var arabicRegex = /[\u0600-\u06FF]/g; - if (!isFirefox && name && (entity.tags.highway || entity.tags.railway) && arabicRegex.test(name)) { + + if (!isFirefox && name && arabicRegex.test(name)) { name = fixArabicScriptTextForSvg(name); } From 4729bbbc4e0281a27625294da700159cf03fbed3 Mon Sep 17 00:00:00 2001 From: Milad Karbasizadeh Date: Wed, 4 Jan 2017 11:13:45 +0330 Subject: [PATCH 46/59] fix a bug with space --- modules/util/svg_paths_arabic_fix.js | 141 ++++++++++++++------------- 1 file changed, 73 insertions(+), 68 deletions(-) diff --git a/modules/util/svg_paths_arabic_fix.js b/modules/util/svg_paths_arabic_fix.js index a6539deba..759ed4920 100644 --- a/modules/util/svg_paths_arabic_fix.js +++ b/modules/util/svg_paths_arabic_fix.js @@ -1,72 +1,78 @@ -const chars = { +// see https://github.com/openstreetmap/iD/pull/3707 +// https://gist.github.com/mapmeld/556b09ddec07a2044c76e1ef45f01c60 + +var chars = { // madda above alef - 1570: {initial: "آ‎", isolated: "ﺁ", medial: "ﺁ", final: "ﺂ" }, - + 1570: { initial: 'آ‎', isolated: 'ﺁ', medial: 'ﺁ', final: 'ﺂ' }, + // hamza above and below alef - 1571: { initial: "أ", isolated: "ﺃ", medial: "", final: "ﺄ" }, + 1571: { initial: 'أ', isolated: 'ﺃ', medial: '', final: 'ﺄ' }, // 1572 is ؤ - 1573: { initial: "إ", isolated: "ﺇ", medial: "", final: "ﺈ" }, + 1573: { initial: 'إ', isolated: 'ﺇ', medial: '', final: 'ﺈ' }, // 1574 is ئ - 1575: {initial: "ا", isolated: "ا", medial: "", final: "ﺎ" }, - 1576: {initial: "ﺑ", isolated: "ﺏ", medial: "ﺒ", final: "ﺐ" }, + 1575: { initial: 'ا', isolated: 'ا', medial: '', final: 'ﺎ' }, + 1576: { initial: 'ﺑ', isolated: 'ﺏ', medial: 'ﺒ', final: 'ﺐ' }, // 1577 ة - 1577: {initial: "", isolated: "ة", medial: "", final: "ﺔ" }, + 1577: { initial: '', isolated: 'ة', medial: '', final: 'ﺔ' }, - 1578: {initial: "ﺗ", isolated: "ﺕ", medial: "ﺘ", final: "ﺖ" }, - 1579: {initial: "ﺛ", isolated: "ﺙ", medial: "ﺜ", final: "ﺚ" }, - 1580: {initial: "ﺟ", isolated: "ﺝ", medial: "ﺠ", final: "ﺞ" }, - 1581: {initial: "ﺣ", isolated: "ﺡ", medial: "ﺤ", final: "ﺢ" }, - 1582: {initial: "ﺧ", isolated: "ﺥ", medial: "ﺨ", final: "ﺦ" }, - 1583: {initial: "ﺩ", isolated: "ﺩ", medial: "", final: "ﺪ" }, - 1584: {initial: "ﺫ", isolated: "ﺫ", medial: "", final: "ﺬ" }, - 1585: {initial: "ﺭ", isolated: "ﺭ", medial: "", final: "ﺮ" }, - 1586: {initial: "ﺯ", isolated: "ﺯ", medial: "", final: "ﺰ" }, - 1688: {initial: "ﮊ", isolated: "ﮊ", medial: "", final: "ﮋ" }, - 1587: {initial: "ﺳ", isolated: "ﺱ", medial: "ﺴ", final: "ﺲ" }, - 1588: {initial: "ﺷ", isolated: "ﺵ", medial: "ﺸ", final: "ﺶ" }, - 1589: {initial: "ﺻ", isolated: "ﺹ", medial: "ﺼ", final: "ﺺ" }, - 1590: {initial: "ﺿ", isolated: "ﺽ", medial: "ﻀ", final: "ﺾ" }, - 1591: {initial: "ﻃ", isolated: "ﻁ", medial: "ﻄ", final: "ﻂ" }, - 1592: {initial: "ﻇ", isolated: "ﻅ", medial: "ﻈ", final: "ﻆ" }, - 1593: {initial: "ﻋ", isolated: "ﻉ", medial: "ﻌ", final: "ﻊ" }, - 1594: {initial: "ﻏ", isolated: "ﻍ", medial: "ﻐ", final: "ﻎ" }, + 1578: { initial: 'ﺗ', isolated: 'ﺕ', medial: 'ﺘ', final: 'ﺖ' }, + 1579: { initial: 'ﺛ', isolated: 'ﺙ', medial: 'ﺜ', final: 'ﺚ' }, + 1580: { initial: 'ﺟ', isolated: 'ﺝ', medial: 'ﺠ', final: 'ﺞ' }, + 1581: { initial: 'ﺣ', isolated: 'ﺡ', medial: 'ﺤ', final: 'ﺢ' }, + 1582: { initial: 'ﺧ', isolated: 'ﺥ', medial: 'ﺨ', final: 'ﺦ' }, + 1583: { initial: 'ﺩ', isolated: 'ﺩ', medial: '', final: 'ﺪ' }, + 1584: { initial: 'ﺫ', isolated: 'ﺫ', medial: '', final: 'ﺬ' }, + 1585: { initial: 'ﺭ', isolated: 'ﺭ', medial: '', final: 'ﺮ' }, + 1586: { initial: 'ﺯ', isolated: 'ﺯ', medial: '', final: 'ﺰ' }, + 1688: { initial: 'ﮊ', isolated: 'ﮊ', medial: '', final: 'ﮋ' }, + 1587: { initial: 'ﺳ', isolated: 'ﺱ', medial: 'ﺴ', final: 'ﺲ' }, + 1588: { initial: 'ﺷ', isolated: 'ﺵ', medial: 'ﺸ', final: 'ﺶ' }, + 1589: { initial: 'ﺻ', isolated: 'ﺹ', medial: 'ﺼ', final: 'ﺺ' }, + 1590: { initial: 'ﺿ', isolated: 'ﺽ', medial: 'ﻀ', final: 'ﺾ' }, + 1591: { initial: 'ﻃ', isolated: 'ﻁ', medial: 'ﻄ', final: 'ﻂ' }, + 1592: { initial: 'ﻇ', isolated: 'ﻅ', medial: 'ﻈ', final: 'ﻆ' }, + 1593: { initial: 'ﻋ', isolated: 'ﻉ', medial: 'ﻌ', final: 'ﻊ' }, + 1594: { initial: 'ﻏ', isolated: 'ﻍ', medial: 'ﻐ', final: 'ﻎ' }, -// 1595 ػ - may be very rare + // 1595 ػ - may be very rare + + 1601: { initial: 'ﻓ', isolated: 'ﻑ', medial: 'ﻔ', final: 'ﻒ' }, + 1602: { initial: 'ﻗ', isolated: 'ﻕ', medial: 'ﻘ', final: 'ﻖ' }, + 1604: { initial: 'ﻟ', isolated: 'ﻝ', medial: 'ﻠ', final: 'ﻞ' }, + 1605: { initial: 'ﻣ', isolated: 'ﻡ', medial: 'ﻤ', final: 'ﻢ' }, + 1606: { initial: 'ﻧ', isolated: 'ﻥ', medial: 'ﻨ', final: 'ﻦ' }, + 1607: { initial: 'ﻫ', isolated: 'ﻩ', medial: 'ﻬ', final: 'ﻪ' }, + 1608: { initial: 'ﻭ', isolated: 'ﻭ', medial: '', final: 'ﻮ' }, - 1601: {initial: "ﻓ", isolated: "ﻑ", medial: "ﻔ", final: "ﻒ" }, - 1602: {initial: "ﻗ", isolated: "ﻕ", medial: "ﻘ", final: "ﻖ" }, - 1604: {initial: "ﻟ", isolated: "ﻝ", medial: "ﻠ", final: "ﻞ" }, - 1605: {initial: "ﻣ", isolated: "ﻡ", medial: "ﻤ", final: "ﻢ" }, - 1606: {initial: "ﻧ", isolated: "ﻥ", medial: "ﻨ", final: "ﻦ" }, - 1607: {initial: "ﻫ", isolated: "ﻩ", medial: "ﻬ", final: "ﻪ" }, - 1608: {initial: "ﻭ", isolated: "ﻭ", medial: "", final: "ﻮ" }, - // 1609 ى - 1609: {initial: "ﯨ", isolated: "ﻯ", medial: "ﯩ", final: "ﻰ" }, + 1609: { initial: 'ﯨ', isolated: 'ﻯ', medial: 'ﯩ', final: 'ﻰ' }, // 1610 ي - 1610: {initial: "ﻳ", isolated: "ﻱ", medial: "ﻴ", final: "ﻲ" }, + 1610: { initial: 'ﻳ', isolated: 'ﻱ', medial: 'ﻴ', final: 'ﻲ' }, + // short vowel sounds / tashkil markings - 1662: {initial: "ﭘ", isolated: "ﭖ", medial: "ﭙ", final: "ﭗ" }, - - 1670: {initial: "ﭼ", isolated: "ﭺ", medial: "ﭽ", final: "ﭻ" }, - 1603: {initial: "ﻛ", isolated: "ﻙ", medial: "ﻜ", final: "ﻚ" }, - 1705: {initial: "ﻛ", isolated: "ﮎ", medial: "ﻜ", final: "ﮏ" }, - 1711: {initial: "ﮔ", isolated: "ﮒ", medial: "ﮕ", final: "ﮓ" }, - 1740: {initial: "ﻳ", isolated: "ﻯ", medial: "ﻴ", final: "ﻰ" }, - 5000: {initial: "ﻻ", isolated: "ﻻ", medial: "", final: "ﻼ" } + 1662: { initial: 'ﭘ', isolated: 'ﭖ', medial: 'ﭙ', final: 'ﭗ' }, + + 1670: { initial: 'ﭼ', isolated: 'ﭺ', medial: 'ﭽ', final: 'ﭻ' }, + 1603: { initial: 'ﻛ', isolated: 'ﻙ', medial: 'ﻜ', final: 'ﻚ' }, + 1705: { initial: 'ﻛ', isolated: 'ﮎ', medial: 'ﻜ', final: 'ﮏ' }, + 1711: { initial: 'ﮔ', isolated: 'ﮒ', medial: 'ﮕ', final: 'ﮓ' }, + 1740: { initial: 'ﻳ', isolated: 'ﻯ', medial: 'ﻴ', final: 'ﻰ' }, + 5000: { initial: 'ﻻ', isolated: 'ﻻ', medial: '', final: 'ﻼ' } }; -export function fixArabicScriptTextForSvg(inputText){ - let context = true; - let ret = ''; - let rtlBuffer = []; - for(let i = 0, l = inputText.length; i < l; i++){ - let code = inputText[i].charCodeAt(0); - let nextCode = inputText[i + 1] ? inputText[i + 1].charCodeAt(0) : 0; - if(!chars[code]){ +export function fixArabicScriptTextForSvg(inputText) { + var context = true; + var ret = ''; + var rtlBuffer = []; + + for (var i = 0, l = inputText.length; i < l; i++) { + var code = inputText[i].charCodeAt(0); + var nextCode = inputText[i + 1] ? inputText[i + 1].charCodeAt(0) : 0; + + if (!chars[code]) { if (code === 32 && rtlBuffer.length) { // whitespace rtlBuffer = [rtlBuffer.reverse().join('') + ' ']; @@ -76,42 +82,41 @@ export function fixArabicScriptTextForSvg(inputText){ rtlBuffer = []; } continue; - } - if(context){ - if(i == l - 1){ + } + if (context) { + if (i === l - 1 || nextCode === 32) { rtlBuffer.push(chars[code].isolated); } else { // special case for لا - if(code == 1604 && nextCode == 1575){ + if (code === 1604 && nextCode === 1575) { rtlBuffer.push(chars[5000].initial); i++; context = true; continue; } - rtlBuffer.push(chars[code].initial); - } + } } else { - if(i == l - 1){ + if (i === l - 1 || nextCode === 32){ rtlBuffer.push(chars[code].final); } else { // special case for ﻼ - if(code == 1604 && nextCode == 1575){ + if (code === 1604 && nextCode === 1575){ rtlBuffer.push(chars[5000].final); i++; context = true; continue; } - if(chars[code].medial == ''){ + if (chars[code].medial === ''){ rtlBuffer.push(chars[code].final); - } else{ + } else { rtlBuffer.push(chars[code].medial); - } + } } - } - context = (chars[code].medial == ''); - } + } + context = (chars[code].medial === '') || nextCode === 32; + } + ret += rtlBuffer.reverse().join(''); - return ret; } \ No newline at end of file From 9ba610a9775497ac73277de0b914b1547d44c945 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 4 Jan 2017 16:06:09 -0500 Subject: [PATCH 47/59] Add test for transitioned history.perform --- test/spec/core/history.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/spec/core/history.js b/test/spec/core/history.js index 723474153..10693c726 100644 --- a/test/spec/core/history.js +++ b/test/spec/core/history.js @@ -51,6 +51,7 @@ describe('iD.History', function () { history.on('change', spy); var difference = history.perform(action); expect(spy).to.have.been.calledWith(difference); + expect(spy.callCount).to.eql(1); }); it('performs multiple actions', function () { @@ -61,6 +62,17 @@ describe('iD.History', function () { expect(action2).to.have.been.called; expect(history.undoAnnotation()).to.equal('annotation'); }); + + it('performs transitionable actions in a transition', function (done) { + var action1 = function() { return iD.Graph(); }; + action1.transitionable = true; + history.on('change', spy); + history.perform(action1); + window.setTimeout(function() { + expect(spy.callCount).to.be.above(2); + done(); + }, 300); + }); }); describe('#replace', function () { From ddd1b7e43ad5fc0f18e11c4e8ce8dba18b300ea7 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 4 Jan 2017 17:37:29 -0500 Subject: [PATCH 48/59] Don't change history state while in transition --- modules/core/history.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/core/history.js b/modules/core/history.js index 3f4e03388..09f2279b7 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -113,8 +113,7 @@ export function coreHistory(context) { perform: function() { // complete any transition already in progress - d3.select(document) - .interrupt('history.perform'); + d3.select(document).interrupt('history.perform'); var transitionable = false, action0 = arguments[0]; @@ -149,19 +148,22 @@ export function coreHistory(context) { replace: function() { + d3.select(document).interrupt('history.perform'); return _replace(arguments, 1); }, // Same as calling pop and then perform overwrite: function() { + d3.select(document).interrupt('history.perform'); return _overwrite(arguments, 1); }, pop: function() { - var previous = stack[index].graph; + d3.select(document).interrupt('history.perform'); + var previous = stack[index].graph; if (index > 0) { index--; stack.pop(); @@ -171,6 +173,8 @@ export function coreHistory(context) { undo: function() { + d3.select(document).interrupt('history.perform'); + var previous = stack[index].graph; // Pop to the next annotated state. @@ -185,8 +189,9 @@ export function coreHistory(context) { redo: function() { - var previous = stack[index].graph; + d3.select(document).interrupt('history.perform'); + var previous = stack[index].graph; while (index < stack.length - 1) { index++; if (stack[index].annotation) break; From ae28a1815242df2284ad49595e5035392cd8fe3b Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Fri, 6 Jan 2017 16:38:49 -0500 Subject: [PATCH 49/59] chore(package): update eslint to version 3.13.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f35c94f60..535635e8a 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "ecstatic": "~2.1.0", "editor-layer-index": "osmlab/editor-layer-index.git#gh-pages", "gaze": "~1.1.1", - "eslint": "~3.12.0", + "eslint": "~3.13.0", "glob": "~7.1.0", "happen": "~0.3.1", "js-yaml": "~3.7.0", From aed977d736703ee941dc08c346ba022ec1cb4838 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Fri, 6 Jan 2017 12:17:11 -0500 Subject: [PATCH 50/59] chore(package): update d3 to version 4.4.1 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 535635e8a..325756ff7 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "devDependencies": { "brfs": "1.4.3", "chai": "~3.5.0", - "d3": "4.4.0", + "d3": "4.4.1", "ecstatic": "~2.1.0", "editor-layer-index": "osmlab/editor-layer-index.git#gh-pages", "gaze": "~1.1.1", From 6f18f3865d148c5be44c76739ac3740ba6eb527e Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Fri, 6 Jan 2017 18:21:01 -0500 Subject: [PATCH 51/59] chore(package): update rollup to version 0.41.1 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 325756ff7..cf2362145 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "npm-run-all": "~4.0.0", "phantomjs-prebuilt": "~2.1.11", "request": "~2.79.0", - "rollup": "0.40.0", + "rollup": "0.41.1", "rollup-plugin-commonjs": "7.0.0", "rollup-plugin-json": "2.0.2", "rollup-plugin-node-resolve": "2.0.0", From 739c1e9accfeabfbe1faf11ad4b2182d7bfa5048 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 6 Jan 2017 23:06:36 -0500 Subject: [PATCH 52/59] Move tracktype to top of field list (closes #3718) --- data/presets/presets.json | 2 +- data/presets/presets/highway/track.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/presets/presets.json b/data/presets/presets.json index d0ba262b6..a92ab4569 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -5477,12 +5477,12 @@ "highway/track": { "icon": "highway-track", "fields": [ + "tracktype", "surface", "width", "structure", "access", "incline", - "tracktype", "smoothness", "mtb/scale", "mtb/scale/uphill", diff --git a/data/presets/presets/highway/track.json b/data/presets/presets/highway/track.json index 58b6d0807..50a59cb18 100644 --- a/data/presets/presets/highway/track.json +++ b/data/presets/presets/highway/track.json @@ -1,12 +1,12 @@ { "icon": "highway-track", "fields": [ + "tracktype", "surface", "width", "structure", "access", "incline", - "tracktype", "smoothness", "mtb/scale", "mtb/scale/uphill", From 5db9cd156b0982d34366f7c62259aefc6003ef01 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 6 Jan 2017 23:18:48 -0500 Subject: [PATCH 53/59] Allow toll_booth on area geometry --- data/presets/presets.json | 6 ++++-- data/presets/presets/barrier/toll_booth.json | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/data/presets/presets.json b/data/presets/presets.json index a92ab4569..8e388006c 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -2857,10 +2857,12 @@ "barrier/toll_booth": { "icon": "roadblock", "fields": [ - "access" + "access", + "building_area" ], "geometry": [ - "vertex" + "vertex", + "area" ], "tags": { "barrier": "toll_booth" diff --git a/data/presets/presets/barrier/toll_booth.json b/data/presets/presets/barrier/toll_booth.json index 83059fcb9..618fb8a56 100644 --- a/data/presets/presets/barrier/toll_booth.json +++ b/data/presets/presets/barrier/toll_booth.json @@ -1,10 +1,12 @@ { "icon": "roadblock", "fields": [ - "access" + "access", + "building_area" ], "geometry": [ - "vertex" + "vertex", + "area" ], "tags": { "barrier": "toll_booth" From 8a7e9f86690d2d3f90a605512a22c386d498dbb7 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 6 Jan 2017 23:22:04 -0500 Subject: [PATCH 54/59] Add preset for barrier=border_control (closes #3719) --- data/presets.yaml | 4 ++++ data/presets/presets.json | 15 +++++++++++++++ data/presets/presets/barrier/border_control.json | 15 +++++++++++++++ data/taginfo.json | 4 ++++ dist/locales/en.json | 4 ++++ 5 files changed, 42 insertions(+) create mode 100644 data/presets/presets/barrier/border_control.json diff --git a/data/presets.yaml b/data/presets.yaml index 267cd107d..ef1a7173c 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -1877,6 +1877,10 @@ en: # barrier=bollard name: Bollard terms: '' + barrier/border_control: + # barrier=border_control + name: Border Control + terms: '' barrier/cattle_grid: # barrier=cattle_grid name: Cattle Grid diff --git a/data/presets/presets.json b/data/presets/presets.json index 8e388006c..94c419044 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -2710,6 +2710,21 @@ }, "name": "Bollard" }, + "barrier/border_control": { + "icon": "roadblock", + "fields": [ + "access", + "building_area" + ], + "geometry": [ + "vertex", + "area" + ], + "tags": { + "barrier": "border_control" + }, + "name": "Border Control" + }, "barrier/cattle_grid": { "icon": "prison", "geometry": [ diff --git a/data/presets/presets/barrier/border_control.json b/data/presets/presets/barrier/border_control.json new file mode 100644 index 000000000..ecb669ccc --- /dev/null +++ b/data/presets/presets/barrier/border_control.json @@ -0,0 +1,15 @@ +{ + "icon": "roadblock", + "fields": [ + "access", + "building_area" + ], + "geometry": [ + "vertex", + "area" + ], + "tags": { + "barrier": "border_control" + }, + "name": "Border Control" +} diff --git a/data/taginfo.json b/data/taginfo.json index b0b1b15a8..27eac3778 100644 --- a/data/taginfo.json +++ b/data/taginfo.json @@ -545,6 +545,10 @@ "key": "barrier", "value": "bollard" }, + { + "key": "barrier", + "value": "border_control" + }, { "key": "barrier", "value": "cattle_grid" diff --git a/dist/locales/en.json b/dist/locales/en.json index 3c1bfe061..86c0cfd3f 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -2338,6 +2338,10 @@ "name": "Bollard", "terms": "" }, + "barrier/border_control": { + "name": "Border Control", + "terms": "" + }, "barrier/cattle_grid": { "name": "Cattle Grid", "terms": "" From 6fd7743f009325f1d1bbae9b77e319b5d47f5e0e Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 6 Jan 2017 23:31:21 -0500 Subject: [PATCH 55/59] Add toll field to motorway, trunk --- data/presets.yaml | 4 ++++ data/presets/fields.json | 5 +++++ data/presets/fields/toll.json | 5 +++++ data/presets/presets.json | 13 ++++++++++++- data/presets/presets/highway/motorway.json | 12 +++++++++++- data/presets/presets/highway/trunk.json | 1 + dist/locales/en.json | 5 ++++- 7 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 data/presets/fields/toll.json diff --git a/data/presets.yaml b/data/presets.yaml index ef1a7173c..6b2ed002c 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -1181,6 +1181,9 @@ en: flush: Flush # 'toilets:disposal=pitlatrine' pitlatrine: Pit/Latrine + toll: + # toll=* + label: Toll tourism: # tourism=* label: Type @@ -2455,6 +2458,7 @@ en: highway/motorway: # highway=motorway name: Motorway + # 'terms: autobahn,expressway,freeway,highway,interstate,parkway,thruway,turnpike' terms: '' highway/motorway_junction: # highway=motorway_junction diff --git a/data/presets/fields.json b/data/presets/fields.json index b270f1d05..3a35f2386 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -1591,6 +1591,11 @@ } } }, + "toll": { + "key": "toll", + "type": "check", + "label": "Toll" + }, "tourism": { "key": "tourism", "type": "typeCombo", diff --git a/data/presets/fields/toll.json b/data/presets/fields/toll.json new file mode 100644 index 000000000..4c5cb4999 --- /dev/null +++ b/data/presets/fields/toll.json @@ -0,0 +1,5 @@ +{ + "key": "toll", + "type": "check", + "label": "Toll" +} diff --git a/data/presets/presets.json b/data/presets/presets.json index 94c419044..bd74b56ff 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -5015,6 +5015,7 @@ "lanes", "surface", "maxheight", + "toll", "ref" ], "geometry": [ @@ -5023,7 +5024,16 @@ "tags": { "highway": "motorway" }, - "terms": [], + "terms": [ + "autobahn", + "expressway", + "freeway", + "highway", + "interstate", + "parkway", + "thruway", + "turnpike" + ], "name": "Motorway" }, "highway/path": { @@ -5607,6 +5617,7 @@ "lanes", "surface", "maxheight", + "toll", "ref" ], "geometry": [ diff --git a/data/presets/presets/highway/motorway.json b/data/presets/presets/highway/motorway.json index 28adc22ad..6a86898a2 100644 --- a/data/presets/presets/highway/motorway.json +++ b/data/presets/presets/highway/motorway.json @@ -8,6 +8,7 @@ "lanes", "surface", "maxheight", + "toll", "ref" ], "geometry": [ @@ -16,6 +17,15 @@ "tags": { "highway": "motorway" }, - "terms": [], + "terms": [ + "autobahn", + "expressway", + "freeway", + "highway", + "interstate", + "parkway", + "thruway", + "turnpike" + ], "name": "Motorway" } diff --git a/data/presets/presets/highway/trunk.json b/data/presets/presets/highway/trunk.json index a820c1e9d..a91724862 100644 --- a/data/presets/presets/highway/trunk.json +++ b/data/presets/presets/highway/trunk.json @@ -8,6 +8,7 @@ "lanes", "surface", "maxheight", + "toll", "ref" ], "geometry": [ diff --git a/dist/locales/en.json b/dist/locales/en.json index 86c0cfd3f..bfd2ec696 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1708,6 +1708,9 @@ "bucket": "Bucket" } }, + "toll": { + "label": "Toll" + }, "tourism": { "label": "Type" }, @@ -2892,7 +2895,7 @@ }, "highway/motorway": { "name": "Motorway", - "terms": "" + "terms": "autobahn,expressway,freeway,highway,interstate,parkway,thruway,turnpike" }, "highway/path": { "name": "Path", From 104262e0b0ac8f140a2b62297874c21554068e43 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 7 Jan 2017 00:15:53 -0500 Subject: [PATCH 56/59] Add preset for place=square (closes #3658) --- data/presets.yaml | 4 ++++ data/presets/presets.json | 10 ++++++++++ data/presets/presets/place/square.json | 10 ++++++++++ data/taginfo.json | 4 ++++ dist/locales/en.json | 4 ++++ 5 files changed, 32 insertions(+) create mode 100644 data/presets/presets/place/square.json diff --git a/data/presets.yaml b/data/presets.yaml index 6b2ed002c..a8d7e8022 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -3367,6 +3367,10 @@ en: name: Neighborhood # 'terms: neighbourhood' terms: '' + place/square: + # place=square + name: Square + terms: '' place/suburb: # place=suburb name: Borough diff --git a/data/presets/presets.json b/data/presets/presets.json index bd74b56ff..40d35a16e 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -8619,6 +8619,16 @@ ], "name": "Neighborhood" }, + "place/square": { + "geometry": [ + "point", + "area" + ], + "tags": { + "place": "square" + }, + "name": "Square" + }, "place/suburb": { "icon": "triangle-stroked", "fields": [ diff --git a/data/presets/presets/place/square.json b/data/presets/presets/place/square.json new file mode 100644 index 000000000..b08ef8ec9 --- /dev/null +++ b/data/presets/presets/place/square.json @@ -0,0 +1,10 @@ +{ + "geometry": [ + "point", + "area" + ], + "tags": { + "place": "square" + }, + "name": "Square" +} diff --git a/data/taginfo.json b/data/taginfo.json index 27eac3778..4705ef1be 100644 --- a/data/taginfo.json +++ b/data/taginfo.json @@ -1895,6 +1895,10 @@ "key": "place", "value": "neighbourhood" }, + { + "key": "place", + "value": "square" + }, { "key": "place", "value": "suburb" diff --git a/dist/locales/en.json b/dist/locales/en.json index bfd2ec696..b001ac730 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -3705,6 +3705,10 @@ "name": "Neighborhood", "terms": "neighbourhood" }, + "place/square": { + "name": "Square", + "terms": "" + }, "place/suburb": { "name": "Borough", "terms": "Boro,Quarter" From a4eda3cf085b6d14791ff696c644d0926d7be641 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 7 Jan 2017 00:29:51 -0500 Subject: [PATCH 57/59] Add presets for leisure=horse_riding (closes #3619) --- data/presets.yaml | 5 +++++ data/presets/presets.json | 20 +++++++++++++++++++ .../presets/presets/leisure/horse_riding.json | 20 +++++++++++++++++++ data/taginfo.json | 4 ++++ dist/locales/en.json | 4 ++++ 5 files changed, 53 insertions(+) create mode 100644 data/presets/presets/leisure/horse_riding.json diff --git a/data/presets.yaml b/data/presets.yaml index a8d7e8022..ee928de9a 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -2865,6 +2865,11 @@ en: name: Golf Course # 'terms: links' terms: '' + leisure/horse_riding: + # leisure=horse_riding + name: Horseback Riding Facility + # 'terms: equestrian,stable' + terms: '' leisure/ice_rink: # leisure=ice_rink name: Ice Rink diff --git a/data/presets/presets.json b/data/presets/presets.json index 40d35a16e..fd72e7639 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -6714,6 +6714,26 @@ }, "name": "Golf Course" }, + "leisure/horse_riding": { + "fields": [ + "access_simple", + "operator", + "address", + "building" + ], + "geometry": [ + "point", + "area" + ], + "terms": [ + "equestrian", + "stable" + ], + "tags": { + "leisure": "horse_riding" + }, + "name": "Horseback Riding Facility" + }, "leisure/ice_rink": { "icon": "pitch", "fields": [ diff --git a/data/presets/presets/leisure/horse_riding.json b/data/presets/presets/leisure/horse_riding.json new file mode 100644 index 000000000..d8759f4ac --- /dev/null +++ b/data/presets/presets/leisure/horse_riding.json @@ -0,0 +1,20 @@ +{ + "fields": [ + "access_simple", + "operator", + "address", + "building" + ], + "geometry": [ + "point", + "area" + ], + "terms": [ + "equestrian", + "stable" + ], + "tags": { + "leisure": "horse_riding" + }, + "name": "Horseback Riding Facility" +} diff --git a/data/taginfo.json b/data/taginfo.json index 4705ef1be..4aa527d26 100644 --- a/data/taginfo.json +++ b/data/taginfo.json @@ -1447,6 +1447,10 @@ "key": "leisure", "value": "golf_course" }, + { + "key": "leisure", + "value": "horse_riding" + }, { "key": "leisure", "value": "ice_rink" diff --git a/dist/locales/en.json b/dist/locales/en.json index b001ac730..16fd16057 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -3249,6 +3249,10 @@ "name": "Golf Course", "terms": "links" }, + "leisure/horse_riding": { + "name": "Horseback Riding Facility", + "terms": "equestrian,stable" + }, "leisure/ice_rink": { "name": "Ice Rink", "terms": "hockey,skating,curling" From d268f7983e8fe3d316c64ba48a90c2a497b37e0a Mon Sep 17 00:00:00 2001 From: M1dgard Date: Sat, 7 Jan 2017 23:11:45 +0100 Subject: [PATCH 58/59] amenity=coworking_space as non-searchable preset So that it doesn't show up as a blank Amenity in the Inspector. --- data/presets.yaml | 3 +++ data/presets/presets.json | 20 +++++++++++++++++++ .../presets/amenity/_coworking_space.json | 20 +++++++++++++++++++ data/taginfo.json | 4 ++++ dist/locales/en.json | 4 ++++ 5 files changed, 51 insertions(+) create mode 100644 data/presets/presets/amenity/_coworking_space.json diff --git a/data/presets.yaml b/data/presets.yaml index ee928de9a..cb0f7463d 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -1503,6 +1503,9 @@ en: # amenity=courthouse name: Courthouse terms: '' + amenity/coworking_space: + # office=coworking + name: Coworking Space amenity/crematorium: # amenity=crematorium name: Crematorium diff --git a/data/presets/presets.json b/data/presets/presets.json index fd72e7639..8b89f52ad 100644 --- a/data/presets/presets.json +++ b/data/presets/presets.json @@ -445,6 +445,26 @@ }, "name": "Airport terminal" }, + "amenity/coworking_space": { + "icon": "commercial", + "fields": [ + "address", + "building_area", + "opening_hours", + "internet_access", + "internet_access/fee", + "internet_access/ssid" + ], + "geometry": [ + "point", + "area" + ], + "tags": { + "office": "coworking" + }, + "name": "Coworking Space", + "searchable": false + }, "amenity/register_office": { "icon": "town-hall", "fields": [ diff --git a/data/presets/presets/amenity/_coworking_space.json b/data/presets/presets/amenity/_coworking_space.json new file mode 100644 index 000000000..876080d71 --- /dev/null +++ b/data/presets/presets/amenity/_coworking_space.json @@ -0,0 +1,20 @@ +{ + "icon": "commercial", + "fields": [ + "address", + "building_area", + "opening_hours", + "internet_access", + "internet_access/fee", + "internet_access/ssid" + ], + "geometry": [ + "point", + "area" + ], + "tags": { + "office": "coworking" + }, + "name": "Coworking Space", + "searchable": false +} diff --git a/data/taginfo.json b/data/taginfo.json index 4aa527d26..14ed9dc67 100644 --- a/data/taginfo.json +++ b/data/taginfo.json @@ -115,6 +115,10 @@ "key": "aeroway", "value": "terminal" }, + { + "key": "office", + "value": "coworking" + }, { "key": "amenity", "value": "register_office" diff --git a/dist/locales/en.json b/dist/locales/en.json index 16fd16057..529ae0498 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -1909,6 +1909,10 @@ "name": "Airport terminal", "terms": "airport,aerodrome" }, + "amenity/coworking_space": { + "name": "Coworking Space", + "terms": "" + }, "amenity/register_office": { "name": "Register Office", "terms": "" From 0d2eb8500778855b4a7fc72cfc39d8843a9ffa69 Mon Sep 17 00:00:00 2001 From: Mert Emin Kalender Date: Sat, 7 Jan 2017 19:53:54 -0800 Subject: [PATCH 59/59] Add Turkish address scheme --- data/address-formats.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/address-formats.json b/data/address-formats.json index 418fd7def..18057351b 100644 --- a/data/address-formats.json +++ b/data/address-formats.json @@ -42,6 +42,10 @@ { "countryCodes": ["jp"], "format": [["postcode", "province", "county"], ["city", "suburb", "quarter"], ["neighbourhood", "block_number", "housenumber"]] + }, + { + "countryCodes": ["tr"], + "format": [["neighbourhood"], ["street", "housenumber"], ["postcode", "district", "city"]] } ] }