From 0d0e54fdff07a76049126133ae2a6e56f501d303 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Tue, 4 Oct 2016 21:15:30 -0400 Subject: [PATCH] Fix more namespaces that were missed in the first pass --- modules/actions/connect.js | 2 +- modules/actions/disconnect.js | 2 +- modules/actions/join.js | 2 +- modules/actions/merge_remote_changes.js | 2 +- modules/actions/split.js | 2 +- modules/core/connection.js | 2 +- modules/core/history.js | 6 ++--- modules/geo/extent.js | 29 +++++++++++++------------ modules/geo/index.js | 4 ++-- modules/geo/multipolygon.js | 2 +- modules/modes/add_point.js | 2 +- modules/modes/drag_node.js | 10 ++++----- modules/renderer/background.js | 4 ++-- modules/svg/debug.js | 6 ++--- modules/svg/gpx.js | 12 +++++----- modules/svg/lines.js | 2 +- modules/svg/midpoints.js | 2 +- modules/ui/disclosure.js | 2 +- modules/ui/lasso.js | 2 +- modules/ui/map_in_map.js | 2 +- modules/ui/preset.js | 2 +- modules/ui/save.js | 6 ++--- modules/util/util.js | 4 ++-- 23 files changed, 54 insertions(+), 55 deletions(-) diff --git a/modules/actions/connect.js b/modules/actions/connect.js index 03c0d609e..a3ff1a999 100644 --- a/modules/actions/connect.js +++ b/modules/actions/connect.js @@ -10,7 +10,7 @@ import { actionDeleteNode } from './delete_node'; // Tags and relation memberships of of non-surviving nodes are merged // to the survivor. // -// This is the inverse of `iD.actions.Disconnect`. +// This is the inverse of `iD.actionDisconnect`. // // Reference: // https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MergeNodesAction.as diff --git a/modules/actions/disconnect.js b/modules/actions/disconnect.js index 1c652f7f4..7cebcf54d 100644 --- a/modules/actions/disconnect.js +++ b/modules/actions/disconnect.js @@ -9,7 +9,7 @@ import { coreNode } from '../core/index'; // Normally, this will be undefined and the way will automatically // be assigned a new ID. // -// This is the inverse of `iD.actions.Connect`. +// This is the inverse of `iD.actionConnect`. // // Reference: // https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/UnjoinNodeAction.as diff --git a/modules/actions/join.js b/modules/actions/join.js index 994b45ea0..6f5bd5384 100644 --- a/modules/actions/join.js +++ b/modules/actions/join.js @@ -6,7 +6,7 @@ import { geoJoinWays } from '../geo/index'; // Join ways at the end node they share. // -// This is the inverse of `iD.actions.Split`. +// This is the inverse of `iD.actionSplit`. // // Reference: // https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MergeWaysAction.as diff --git a/modules/actions/merge_remote_changes.js b/modules/actions/merge_remote_changes.js index 34b0f3b2a..3b5b5aa54 100644 --- a/modules/actions/merge_remote_changes.js +++ b/modules/actions/merge_remote_changes.js @@ -213,7 +213,7 @@ export function actionMergeRemoteChanges(id, localGraph, remoteGraph, formatUser // delete/undelete if (!remote.visible) { if (option === 'force_remote') { - return DeleteMultiple([id])(graph); + return actionDeleteMultiple([id])(graph); } else if (option === 'force_local') { if (target.type === 'way') { diff --git a/modules/actions/split.js b/modules/actions/split.js index 0ec0d2831..95b7217d6 100644 --- a/modules/actions/split.js +++ b/modules/actions/split.js @@ -10,7 +10,7 @@ import { utilWrap } from '../util/index'; // Optionally, split only the given ways, if multiple ways share // the given node. // -// This is the inverse of `iD.actions.Join`. +// This is the inverse of `iD.actionJoin`. // // For testing convenience, accepts an ID to assign to the new way. // Normally, this will be undefined and the way will automatically diff --git a/modules/core/connection.js b/modules/core/connection.js index 06139eca2..69cddaf41 100644 --- a/modules/core/connection.js +++ b/modules/core/connection.js @@ -422,7 +422,7 @@ export function coreConnection(useHttps) { return { id: tile.toString(), - extent: Extent( + extent: geoExtent( projection.invert([x, y + ts]), projection.invert([x + ts, y])) }; diff --git a/modules/core/history.js b/modules/core/history.js index 21c6c9e83..f8e6dd3d5 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -296,14 +296,14 @@ export function coreHistory(context) { var allEntities = {}; h.entities.forEach(function(entity) { - allEntities[coreEntity.key(entity)] = Entity(entity); + allEntities[coreEntity.key(entity)] = coreEntity(entity); }); if (h.version === 3) { // This merges originals for changed entities into the base of // the stack even if the current stack doesn't have them (for // example when iD has been restarted in a different region) - var baseEntities = h.baseEntities.map(function(d) { return Entity(d); }); + var baseEntities = h.baseEntities.map(function(d) { return coreEntity(d); }); stack[0].graph.rebase(baseEntities, _.map(stack, 'graph'), true); tree.rebase(baseEntities, true); @@ -382,7 +382,7 @@ export function coreHistory(context) { for (var i in d.entities) { var entity = d.entities[i]; - entities[i] = entity === 'undefined' ? undefined : Entity(entity); + entities[i] = entity === 'undefined' ? undefined : coreEntity(entity); } d.graph = coreGraph(stack[0].graph).load(entities); diff --git a/modules/geo/extent.js b/modules/geo/extent.js index 523d5362c..fbab928c8 100644 --- a/modules/geo/extent.js +++ b/modules/geo/extent.js @@ -32,10 +32,10 @@ _.extend(geoExtent.prototype, { extend: function(obj) { if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); - return Extent([Math.min(obj[0][0], this[0][0]), - Math.min(obj[0][1], this[0][1])], - [Math.max(obj[1][0], this[1][0]), - Math.max(obj[1][1], this[1][1])]); + return geoExtent( + [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])], + [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])] + ); }, @@ -80,7 +80,7 @@ _.extend(geoExtent.prototype, { contains: function(obj) { - if (!(obj instanceof Extent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); return obj[0][0] >= this[0][0] && obj[0][1] >= this[0][1] && obj[1][0] <= this[1][0] && @@ -89,7 +89,7 @@ _.extend(geoExtent.prototype, { intersects: function(obj) { - if (!(obj instanceof Extent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); return obj[0][0] <= this[1][0] && obj[0][1] <= this[1][1] && obj[1][0] >= this[0][0] && @@ -99,15 +99,15 @@ _.extend(geoExtent.prototype, { intersection: function(obj) { if (!this.intersects(obj)) return new geoExtent(); - return new Extent([Math.max(obj[0][0], this[0][0]), - Math.max(obj[0][1], this[0][1])], - [Math.min(obj[1][0], this[1][0]), - Math.min(obj[1][1], this[1][1])]); + return new geoExtent( + [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])], + [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])] + ); }, percentContainedIn: function(obj) { - if (!(obj instanceof Extent)) obj = new geoExtent(obj); + if (!(obj instanceof geoExtent)) obj = new geoExtent(obj); var a1 = this.intersection(obj).area(), a2 = this.area(); @@ -122,9 +122,10 @@ _.extend(geoExtent.prototype, { padByMeters: function(meters) { var dLat = geoMetersToLat(meters), dLon = geoMetersToLon(meters, this.center()[1]); - return Extent( - [this[0][0] - dLon, this[0][1] - dLat], - [this[1][0] + dLon, this[1][1] + dLat]); + return geoExtent( + [this[0][0] - dLon, this[0][1] - dLat], + [this[1][0] + dLon, this[1][1] + dLat] + ); }, diff --git a/modules/geo/index.js b/modules/geo/index.js index bde46a325..09184be68 100644 --- a/modules/geo/index.js +++ b/modules/geo/index.js @@ -124,7 +124,7 @@ export function geoAngle(a, b, projection) { // the closest vertex on that edge. Returns an object with the `index` of the // chosen edge, the chosen `loc` on that edge, and the `distance` to to it. export function geoChooseEdge(nodes, point, projection) { - var dist = euclideanDistance, + var dist = geoEuclideanDistance, points = nodes.map(function(n) { return projection(n.loc); }), min = Infinity, idx, loc; @@ -192,7 +192,7 @@ export function geoLineIntersection(a, b) { t = crossProduct(subtractPoints(q, p), s) / denominator; if ((t >= 0) && (t <= 1) && (u >= 0) && (u <= 1)) { - return interp(p, p2, t); + return geoInterp(p, p2, t); } } diff --git a/modules/geo/multipolygon.js b/modules/geo/multipolygon.js index baf558dc4..ab5250fb8 100644 --- a/modules/geo/multipolygon.js +++ b/modules/geo/multipolygon.js @@ -70,7 +70,7 @@ export function geoSimpleMultipolygonOuterMember(entity, graph) { // used. // // If an member has a `tags` property, its tags will be reversed via -// `iD.actions.Reverse` in the output. +// `iD.actionReverse` in the output. // // Incomplete members (those for which `graph.hasEntity(element.id)` returns // false) and non-way members are ignored. diff --git a/modules/modes/add_point.js b/modules/modes/add_point.js index c93d861ae..beecd8804 100644 --- a/modules/modes/add_point.js +++ b/modules/modes/add_point.js @@ -14,7 +14,7 @@ export function modeAddPoint(context) { key: '1' }; - var behavior = behavriorDraw(context) + var behavior = behaviorDraw(context) .tail(t('modes.add_point.tail')) .on('click', add) .on('clickWay', addWay) diff --git a/modules/modes/drag_node.js b/modules/modes/drag_node.js index d526d32ac..02eaaa77c 100644 --- a/modules/modes/drag_node.js +++ b/modules/modes/drag_node.js @@ -88,15 +88,13 @@ export function modeDragNode(context) { if (wasMidpoint) { var midpoint = entity; entity = coreNode(); - context.perform(AddMidpoint(midpoint, entity)); + context.perform(actionAddMidpoint(midpoint, entity)); - var vertex = context.surface() - .selectAll('.' + entity.id); - behavior.target(vertex.node(), entity); + var vertex = context.surface().selectAll('.' + entity.id); + behavior.target(vertex.node(), entity); } else { - context.perform( - actionNoop()); + context.perform(actionNoop()); } activeIDs = _.map(context.graph().parentWays(entity), 'id'); diff --git a/modules/renderer/background.js b/modules/renderer/background.js index 640418a7e..497e5e0d8 100644 --- a/modules/renderer/background.js +++ b/modules/renderer/background.js @@ -163,7 +163,7 @@ export function rendererBackground(context) { } } - layer = TileLayer(context) + layer = rendererTileLayer(context) .source(d) .projection(context.projection) .dimensions(baseLayer.dimensions()); @@ -212,7 +212,7 @@ export function rendererBackground(context) { } }); - backgroundSources.unshift(BackgroundSource.None()); + backgroundSources.unshift(rendererBackgroundSource.None()); if (!chosen && extent) { best = _.find(this.sources(extent), function(s) { return s.best(); }); diff --git a/modules/svg/debug.js b/modules/svg/debug.js index 1953da221..b55714f0f 100644 --- a/modules/svg/debug.js +++ b/modules/svg/debug.js @@ -1,9 +1,9 @@ import * as d3 from 'd3'; import { geoPolygonIntersectsPolygon } from '../geo/index'; import { - dataImperial as imperialData, - dataDriveLeft as driveLeftData, - dataImagery as imageryData + dataImperial, + dataDriveLeft, + dataImagery } from '../../data/index'; diff --git a/modules/svg/gpx.js b/modules/svg/gpx.js index 320fe1a93..1b115322e 100644 --- a/modules/svg/gpx.js +++ b/modules/svg/gpx.js @@ -114,23 +114,23 @@ export function svgGpx(projection, context, dispatch) { drawGpx.enabled = function(_) { - if (!arguments.length) return Gpx.enabled; - Gpx.enabled = _; + if (!arguments.length) return svgGpx.enabled; + svgGpx.enabled = _; dispatch.call('change'); return this; }; drawGpx.hasGpx = function() { - var geojson = Gpx.geojson; + var geojson = svgGpx.geojson; return (!(_.isEmpty(geojson) || _.isEmpty(geojson.features))); }; drawGpx.geojson = function(gj) { - if (!arguments.length) return Gpx.geojson; + if (!arguments.length) return svgGpx.geojson; if (_.isEmpty(gj) || _.isEmpty(gj.features)) return this; - Gpx.geojson = gj; + svgGpx.geojson = gj; dispatch.call('change'); return this; }; @@ -162,7 +162,7 @@ export function svgGpx(projection, context, dispatch) { drawGpx.fitZoom = function() { if (!this.hasGpx()) return this; - var geojson = Gpx.geojson; + var geojson = svgGpx.geojson; var map = context.map(), viewport = map.trimmedExtent().polygon(), diff --git a/modules/svg/lines.js b/modules/svg/lines.js index dcf4b2da3..09d8e4803 100644 --- a/modules/svg/lines.js +++ b/modules/svg/lines.js @@ -58,7 +58,7 @@ export function svgLines(projection) { _.forOwn(pathdata, function(v, k) { onewaydata[k] = _(v) .filter(function(d) { return d.isOneWay(); }) - .map(OneWaySegments(projection, graph, 35)) + .map(svgOneWaySegments(projection, graph, 35)) .flatten() .valueOf(); }); diff --git a/modules/svg/midpoints.js b/modules/svg/midpoints.js index 2c88078e9..a64b92225 100644 --- a/modules/svg/midpoints.js +++ b/modules/svg/midpoints.js @@ -111,7 +111,7 @@ export function svgMidpoints(projection, context) { groups = groups .merge(enter) .attr('transform', function(d) { - var translate = PointTransform(projection), + var translate = svgPointTransform(projection), a = graph.entity(d.edge[0]), b = graph.entity(d.edge[1]), angleVal = Math.round(geoAngle(a, b, projection) * (180 / Math.PI)); diff --git a/modules/ui/disclosure.js b/modules/ui/disclosure.js index 48498f935..ec38211ba 100644 --- a/modules/ui/disclosure.js +++ b/modules/ui/disclosure.js @@ -41,7 +41,7 @@ export function uiDisclosure() { function toggle() { expanded = !expanded; hideToggle.classed('expanded', expanded); - div.call(Toggle(expanded)); + wrap.call(uiToggle(expanded)); dispatch.call('toggled', this, expanded); } }; diff --git a/modules/ui/lasso.js b/modules/ui/lasso.js index 085ef321f..b2f50efa1 100644 --- a/modules/ui/lasso.js +++ b/modules/ui/lasso.js @@ -35,7 +35,7 @@ export function uiLasso(context) { lasso.extent = function () { return lasso.coordinates.reduce(function(extent, point) { - return extent.extend(Extent(point)); + return extent.extend(geoExtent(point)); }, geoExtent()); }; diff --git a/modules/ui/map_in_map.js b/modules/ui/map_in_map.js index 3078a5df1..b09f77bfc 100644 --- a/modules/ui/map_in_map.js +++ b/modules/ui/map_in_map.js @@ -189,7 +189,7 @@ export function uiMapInMap(context) { var activeOverlayLayers = []; for (var i = 0; i < overlaySources.length; i++) { if (overlaySources[i].validZoom(zMini)) { - if (!overlayLayers[i]) overlayLayers[i] = TileLayer(context); + if (!overlayLayers[i]) overlayLayers[i] = rendererTileLayer(context); activeOverlayLayers.push(overlayLayers[i] .source(overlaySources[i]) .projection(projection) diff --git a/modules/ui/preset.js b/modules/ui/preset.js index c9942b611..cb68ee169 100644 --- a/modules/ui/preset.js +++ b/modules/ui/preset.js @@ -24,7 +24,7 @@ export function uiPreset(context) { function UIField(field, entity, show) { field = _.clone(field); - field.input = fields[field.type](field, context) + field.input = uiFields[field.type](field, context) .on('change', function(t, onInput) { dispatch.call('change', field, t, onInput); }); diff --git a/modules/ui/save.js b/modules/ui/save.js index 3f8746576..b4da7c40e 100644 --- a/modules/ui/save.js +++ b/modules/ui/save.js @@ -43,7 +43,7 @@ export function uiSave(context) { var tooltipBehavior = tooltip() .placement('bottom') .html(true) - .title(tooltipHtml(t('save.no_changes'), key)); + .title(uiTooltipHtml(t('save.no_changes'), key)); var button = selection .append('button') @@ -77,8 +77,8 @@ export function uiSave(context) { return; numChanges = _; - tooltipBehavior.title(tooltipHtml(t(numChanges > 0 ? - 'save.help' : 'save.no_changes'), key)); + tooltipBehavior.title(uiTooltipHtml( + t(numChanges > 0 ? 'save.help' : 'save.no_changes'), key)); var background = getBackground(numChanges); diff --git a/modules/util/util.js b/modules/util/util.js index 42f336eaf..3178425a1 100644 --- a/modules/util/util.js +++ b/modules/util/util.js @@ -118,8 +118,8 @@ export function utilPrefixCSSProperty(property) { var transformProperty; export function utilSetTransform(el, x, y, scale) { - var prop = transformProperty = transformProperty || prefixCSSProperty('Transform'), - translate = Detect().opera ? + var prop = transformProperty = transformProperty || utilPrefixCSSProperty('Transform'), + translate = utilDetect().opera ? 'translate(' + x + 'px,' + y + 'px)' : 'translate3d(' + x + 'px,' + y + 'px,0)'; return el.style(prop, translate + (scale ? ' scale(' + scale + ')' : ''));