])*?>/)
- (/tag/g, block._tag)
- ();
-
-block.paragraph = replace(block.paragraph)
- ('hr', block.hr)
- ('heading', block.heading)
- ('lheading', block.lheading)
- ('blockquote', block.blockquote)
- ('tag', '<' + block._tag)
- ('def', block.def)
- ();
-
-/**
- * Normal Block Grammar
- */
-
-block.normal = merge({}, block);
-
-/**
- * GFM Block Grammar
- */
-
-block.gfm = merge({}, block.normal, {
- fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
- paragraph: /^/
-});
-
-block.gfm.paragraph = replace(block.paragraph)
- ('(?!', '(?!' + block.gfm.fences.source.replace('\\1', '\\2') + '|')
- ();
-
-/**
- * GFM + Tables Block Grammar
- */
-
-block.tables = merge({}, block.gfm, {
- nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
- table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
-});
-
-/**
- * Block Lexer
- */
-
-function Lexer(options) {
- this.tokens = [];
- this.tokens.links = {};
- this.options = options || marked.defaults;
- this.rules = block.normal;
-
- if (this.options.gfm) {
- if (this.options.tables) {
- this.rules = block.tables;
- } else {
- this.rules = block.gfm;
+ // modules/actions/merge_polygon.js
+ function actionMergePolygon(ids, newRelationId) {
+ function groupEntities(graph) {
+ var entities = ids.map(function(id2) {
+ return graph.entity(id2);
+ });
+ var geometryGroups = utilArrayGroupBy(entities, function(entity) {
+ if (entity.type === "way" && entity.isClosed()) {
+ return "closedWay";
+ } else if (entity.type === "relation" && entity.isMultipolygon()) {
+ return "multipolygon";
+ } else {
+ return "other";
+ }
+ });
+ return Object.assign({ closedWay: [], multipolygon: [], other: [] }, geometryGroups);
}
+ var action = function(graph) {
+ var entities = groupEntities(graph);
+ var polygons = entities.multipolygon.reduce(function(polygons2, m) {
+ return polygons2.concat(osmJoinWays(m.members, graph));
+ }, []).concat(entities.closedWay.map(function(d) {
+ var member = [{ id: d.id }];
+ member.nodes = graph.childNodes(d);
+ return member;
+ }));
+ var contained = polygons.map(function(w, i2) {
+ return polygons.map(function(d, n2) {
+ if (i2 === n2)
+ return null;
+ return geoPolygonContainsPolygon(d.nodes.map(function(n3) {
+ return n3.loc;
+ }), w.nodes.map(function(n3) {
+ return n3.loc;
+ }));
+ });
+ });
+ var members = [];
+ var outer = true;
+ while (polygons.length) {
+ extractUncontained(polygons);
+ polygons = polygons.filter(isContained);
+ contained = contained.filter(isContained).map(filterContained);
+ }
+ function isContained(d, i2) {
+ return contained[i2].some(function(val) {
+ return val;
+ });
+ }
+ function filterContained(d) {
+ return d.filter(isContained);
+ }
+ function extractUncontained(polygons2) {
+ polygons2.forEach(function(d, i2) {
+ if (!isContained(d, i2)) {
+ d.forEach(function(member) {
+ members.push({
+ type: "way",
+ id: member.id,
+ role: outer ? "outer" : "inner"
+ });
+ });
+ }
+ });
+ outer = !outer;
+ }
+ var relation;
+ if (entities.multipolygon.length > 0) {
+ var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
+ relation = entities.multipolygon.find((entity) => entity.id === oldestID);
+ } else {
+ relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
+ }
+ entities.multipolygon.forEach(function(m) {
+ if (m.id !== relation.id) {
+ relation = relation.mergeTags(m.tags);
+ graph = graph.remove(m);
+ }
+ });
+ entities.closedWay.forEach(function(way) {
+ function isThisOuter(m) {
+ return m.id === way.id && m.role !== "inner";
+ }
+ if (members.some(isThisOuter)) {
+ relation = relation.mergeTags(way.tags);
+ graph = graph.replace(way.update({ tags: {} }));
+ }
+ });
+ return graph.replace(relation.update({
+ members,
+ tags: utilObjectOmit(relation.tags, ["area"])
+ }));
+ };
+ action.disabled = function(graph) {
+ var entities = groupEntities(graph);
+ if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
+ return "not_eligible";
+ }
+ if (!entities.multipolygon.every(function(r) {
+ return r.isComplete(graph);
+ })) {
+ return "incomplete_relation";
+ }
+ if (!entities.multipolygon.length) {
+ var sharedMultipolygons = [];
+ entities.closedWay.forEach(function(way, i2) {
+ if (i2 === 0) {
+ sharedMultipolygons = graph.parentMultipolygons(way);
+ } else {
+ sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
+ }
+ });
+ sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
+ return relation.members.length === entities.closedWay.length;
+ });
+ if (sharedMultipolygons.length) {
+ return "not_eligible";
+ }
+ } else if (entities.closedWay.some(function(way) {
+ return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
+ })) {
+ return "not_eligible";
+ }
+ };
+ return action;
}
-}
-
-/**
- * Expose Block Rules
- */
-
-Lexer.rules = block;
-/**
- * Static Lex Method
- */
+ // modules/actions/merge_remote_changes.js
+ var import_fast_deep_equal = __toESM(require_fast_deep_equal());
-Lexer.lex = function(src, options) {
- var lexer = new Lexer(options);
- return lexer.lex(src);
-};
-
-/**
- * Preprocessing
- */
-
-Lexer.prototype.lex = function(src) {
- src = src
- .replace(/\r\n|\r/g, '\n')
- .replace(/\t/g, ' ')
- .replace(/\u00a0/g, ' ')
- .replace(/\u2424/g, '\n');
-
- return this.token(src, true);
-};
-
-/**
- * Lexing
- */
-
-Lexer.prototype.token = function(src, top) {
- var src = src.replace(/^ +$/gm, '')
- , next
- , loose
- , cap
- , bull
- , b
- , item
- , space
- , i
- , l;
-
- while (src) {
- // newline
- if (cap = this.rules.newline.exec(src)) {
- src = src.substring(cap[0].length);
- if (cap[0].length > 1) {
- this.tokens.push({
- type: 'space'
- });
+ // node_modules/node-diff3/index.mjs
+ function LCS(buffer1, buffer2) {
+ let equivalenceClasses = {};
+ for (let j2 = 0; j2 < buffer2.length; j2++) {
+ const item = buffer2[j2];
+ if (equivalenceClasses[item]) {
+ equivalenceClasses[item].push(j2);
+ } else {
+ equivalenceClasses[item] = [j2];
}
}
-
- // code
- if (cap = this.rules.code.exec(src)) {
- src = src.substring(cap[0].length);
- cap = cap[0].replace(/^ {4}/gm, '');
- this.tokens.push({
- type: 'code',
- text: !this.options.pedantic
- ? cap.replace(/\n+$/, '')
- : cap
- });
- continue;
+ const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
+ let candidates = [NULLRESULT];
+ for (let i2 = 0; i2 < buffer1.length; i2++) {
+ const item = buffer1[i2];
+ const buffer2indices = equivalenceClasses[item] || [];
+ let r = 0;
+ let c = candidates[0];
+ for (let jx = 0; jx < buffer2indices.length; jx++) {
+ const j2 = buffer2indices[jx];
+ let s;
+ for (s = r; s < candidates.length; s++) {
+ if (candidates[s].buffer2index < j2 && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j2)) {
+ break;
+ }
+ }
+ if (s < candidates.length) {
+ const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
+ if (r === candidates.length) {
+ candidates.push(c);
+ } else {
+ candidates[r] = c;
+ }
+ r = s + 1;
+ c = newCandidate;
+ if (r === candidates.length) {
+ break;
+ }
+ }
+ }
+ candidates[r] = c;
}
-
- // fences (gfm)
- if (cap = this.rules.fences.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'code',
- lang: cap[2],
- text: cap[3]
- });
- continue;
+ return candidates[candidates.length - 1];
+ }
+ function diffIndices(buffer1, buffer2) {
+ const lcs = LCS(buffer1, buffer2);
+ let result = [];
+ let tail1 = buffer1.length;
+ let tail2 = buffer2.length;
+ for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
+ const mismatchLength1 = tail1 - candidate.buffer1index - 1;
+ const mismatchLength2 = tail2 - candidate.buffer2index - 1;
+ tail1 = candidate.buffer1index;
+ tail2 = candidate.buffer2index;
+ if (mismatchLength1 || mismatchLength2) {
+ result.push({
+ buffer1: [tail1 + 1, mismatchLength1],
+ buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
+ buffer2: [tail2 + 1, mismatchLength2],
+ buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
+ });
+ }
}
-
- // heading
- if (cap = this.rules.heading.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'heading',
- depth: cap[1].length,
- text: cap[2]
+ result.reverse();
+ return result;
+ }
+ function diff3MergeRegions(a, o, b) {
+ let hunks = [];
+ function addHunk(h, ab) {
+ hunks.push({
+ ab,
+ oStart: h.buffer1[0],
+ oLength: h.buffer1[1],
+ abStart: h.buffer2[0],
+ abLength: h.buffer2[1]
});
- continue;
}
-
- // table no leading pipe (gfm)
- if (top && (cap = this.rules.nptable.exec(src))) {
- src = src.substring(cap[0].length);
-
- item = {
- type: 'table',
- header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3].replace(/\n$/, '').split('\n')
- };
-
- for (i = 0; i < item.align.length; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
+ diffIndices(o, a).forEach((item) => addHunk(item, "a"));
+ diffIndices(o, b).forEach((item) => addHunk(item, "b"));
+ hunks.sort((x, y) => x.oStart - y.oStart);
+ let results = [];
+ let currOffset = 0;
+ function advanceTo(endOffset) {
+ if (endOffset > currOffset) {
+ results.push({
+ stable: true,
+ buffer: "o",
+ bufferStart: currOffset,
+ bufferLength: endOffset - currOffset,
+ bufferContent: o.slice(currOffset, endOffset)
+ });
+ currOffset = endOffset;
+ }
+ }
+ while (hunks.length) {
+ let hunk = hunks.shift();
+ let regionStart = hunk.oStart;
+ let regionEnd = hunk.oStart + hunk.oLength;
+ let regionHunks = [hunk];
+ advanceTo(regionStart);
+ while (hunks.length) {
+ const nextHunk = hunks[0];
+ const nextHunkStart = nextHunk.oStart;
+ if (nextHunkStart > regionEnd)
+ break;
+ regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
+ regionHunks.push(hunks.shift());
+ }
+ if (regionHunks.length === 1) {
+ if (hunk.abLength > 0) {
+ const buffer = hunk.ab === "a" ? a : b;
+ results.push({
+ stable: true,
+ buffer: hunk.ab,
+ bufferStart: hunk.abStart,
+ bufferLength: hunk.abLength,
+ bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
+ });
}
+ } else {
+ let bounds = {
+ a: [a.length, -1, o.length, -1],
+ b: [b.length, -1, o.length, -1]
+ };
+ while (regionHunks.length) {
+ hunk = regionHunks.shift();
+ const oStart = hunk.oStart;
+ const oEnd = oStart + hunk.oLength;
+ const abStart = hunk.abStart;
+ const abEnd = abStart + hunk.abLength;
+ let b2 = bounds[hunk.ab];
+ b2[0] = Math.min(abStart, b2[0]);
+ b2[1] = Math.max(abEnd, b2[1]);
+ b2[2] = Math.min(oStart, b2[2]);
+ b2[3] = Math.max(oEnd, b2[3]);
+ }
+ const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
+ const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
+ const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
+ const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
+ let result = {
+ stable: false,
+ aStart,
+ aLength: aEnd - aStart,
+ aContent: a.slice(aStart, aEnd),
+ oStart: regionStart,
+ oLength: regionEnd - regionStart,
+ oContent: o.slice(regionStart, regionEnd),
+ bStart,
+ bLength: bEnd - bStart,
+ bContent: b.slice(bStart, bEnd)
+ };
+ results.push(result);
}
-
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = item.cells[i].split(/ *\| */);
+ currOffset = regionEnd;
+ }
+ advanceTo(o.length);
+ return results;
+ }
+ function diff3Merge(a, o, b, options2) {
+ let defaults2 = {
+ excludeFalseConflicts: true,
+ stringSeparator: /\s+/
+ };
+ options2 = Object.assign(defaults2, options2);
+ if (typeof a === "string")
+ a = a.split(options2.stringSeparator);
+ if (typeof o === "string")
+ o = o.split(options2.stringSeparator);
+ if (typeof b === "string")
+ b = b.split(options2.stringSeparator);
+ let results = [];
+ const regions = diff3MergeRegions(a, o, b);
+ let okBuffer = [];
+ function flushOk() {
+ if (okBuffer.length) {
+ results.push({ ok: okBuffer });
}
-
- this.tokens.push(item);
-
- continue;
+ okBuffer = [];
}
-
- // lheading
- if (cap = this.rules.lheading.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'heading',
- depth: cap[2] === '=' ? 1 : 2,
- text: cap[1]
- });
- continue;
+ function isFalseConflict(a2, b2) {
+ if (a2.length !== b2.length)
+ return false;
+ for (let i2 = 0; i2 < a2.length; i2++) {
+ if (a2[i2] !== b2[i2])
+ return false;
+ }
+ return true;
}
+ regions.forEach((region) => {
+ if (region.stable) {
+ okBuffer.push(...region.bufferContent);
+ } else {
+ if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
+ okBuffer.push(...region.aContent);
+ } else {
+ flushOk();
+ results.push({
+ conflict: {
+ a: region.aContent,
+ aIndex: region.aStart,
+ o: region.oContent,
+ oIndex: region.oStart,
+ b: region.bContent,
+ bIndex: region.bStart
+ }
+ });
+ }
+ }
+ });
+ flushOk();
+ return results;
+ }
- // hr
- if (cap = this.rules.hr.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'hr'
- });
- continue;
+ // modules/actions/merge_remote_changes.js
+ var import_lodash = __toESM(require_lodash());
+ function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
+ discardTags = discardTags || {};
+ var _option = "safe";
+ var _conflicts = [];
+ function user(d) {
+ return typeof formatUser === "function" ? formatUser(d) : (0, import_lodash.escape)(d);
}
-
- // blockquote
- if (cap = this.rules.blockquote.exec(src)) {
- src = src.substring(cap[0].length);
-
- this.tokens.push({
- type: 'blockquote_start'
- });
-
- cap = cap[0].replace(/^ *> ?/gm, '');
-
- // Pass `top` to keep the current
- // "toplevel" state. This is exactly
- // how markdown.pl works.
- this.token(cap, top);
-
- this.tokens.push({
- type: 'blockquote_end'
- });
-
- continue;
+ function mergeLocation(remote, target) {
+ function pointEqual(a, b) {
+ var epsilon3 = 1e-6;
+ return Math.abs(a[0] - b[0]) < epsilon3 && Math.abs(a[1] - b[1]) < epsilon3;
+ }
+ if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
+ return target;
+ }
+ if (_option === "force_remote") {
+ return target.update({ loc: remote.loc });
+ }
+ _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
+ return target;
}
-
- // list
- if (cap = this.rules.list.exec(src)) {
- src = src.substring(cap[0].length);
- bull = cap[2];
-
- this.tokens.push({
- type: 'list_start',
- ordered: bull.length > 1
- });
-
- // Get each top-level item.
- cap = cap[0].match(this.rules.item);
-
- next = false;
- l = cap.length;
- i = 0;
-
- for (; i < l; i++) {
- item = cap[i];
-
- // Remove the list item's bullet
- // so it is seen as the next token.
- space = item.length;
- item = item.replace(/^ *([*+-]|\d+\.) +/, '');
-
- // Outdent whatever the
- // list item contains. Hacky.
- if (~item.indexOf('\n ')) {
- space -= item.length;
- item = !this.options.pedantic
- ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
- : item.replace(/^ {1,4}/gm, '');
+ function mergeNodes(base, remote, target) {
+ if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
+ return target;
+ }
+ if (_option === "force_remote") {
+ return target.update({ nodes: remote.nodes });
+ }
+ var ccount = _conflicts.length;
+ var o = base.nodes || [];
+ var a = target.nodes || [];
+ var b = remote.nodes || [];
+ var nodes = [];
+ var hunks = diff3Merge(a, o, b, { excludeFalseConflicts: true });
+ for (var i2 = 0; i2 < hunks.length; i2++) {
+ var hunk = hunks[i2];
+ if (hunk.ok) {
+ nodes.push.apply(nodes, hunk.ok);
+ } else {
+ var c = hunk.conflict;
+ if ((0, import_fast_deep_equal.default)(c.o, c.a)) {
+ nodes.push.apply(nodes, c.b);
+ } else if ((0, import_fast_deep_equal.default)(c.o, c.b)) {
+ nodes.push.apply(nodes, c.a);
+ } else {
+ _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
+ break;
+ }
}
-
- // Determine whether the next list item belongs here.
- // Backpedal if it does not belong in this list.
- if (this.options.smartLists && i !== l - 1) {
- b = block.bullet.exec(cap[i+1])[0];
- if (bull !== b && !(bull.length > 1 && b.length > 1)) {
- src = cap.slice(i + 1).join('\n') + src;
- i = l - 1;
+ }
+ return _conflicts.length === ccount ? target.update({ nodes }) : target;
+ }
+ function mergeChildren(targetWay, children2, updates, graph) {
+ function isUsed(node2, targetWay2) {
+ var hasInterestingParent = graph.parentWays(node2).some(function(way) {
+ return way.id !== targetWay2.id;
+ });
+ return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
+ }
+ var ccount = _conflicts.length;
+ for (var i2 = 0; i2 < children2.length; i2++) {
+ var id3 = children2[i2];
+ var node = graph.hasEntity(id3);
+ if (targetWay.nodes.indexOf(id3) === -1) {
+ if (node && !isUsed(node, targetWay)) {
+ updates.removeIds.push(id3);
}
+ continue;
}
-
- // Determine whether item is loose or not.
- // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
- // for discount behavior.
- loose = next || /\n\n(?!\s*$)/.test(item);
- if (i !== l - 1) {
- next = item[item.length-1] === '\n';
- if (!loose) loose = next;
+ var local = localGraph.hasEntity(id3);
+ var remote = remoteGraph.hasEntity(id3);
+ var target;
+ if (_option === "force_remote" && remote && remote.visible) {
+ updates.replacements.push(remote);
+ } else if (_option === "force_local" && local) {
+ target = osmEntity(local);
+ if (remote) {
+ target = target.update({ version: remote.version });
+ }
+ updates.replacements.push(target);
+ } else if (_option === "safe" && local && remote && local.version !== remote.version) {
+ target = osmEntity(local, { version: remote.version });
+ if (remote.visible) {
+ target = mergeLocation(remote, target);
+ } else {
+ _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
+ }
+ if (_conflicts.length !== ccount)
+ break;
+ updates.replacements.push(target);
}
-
- this.tokens.push({
- type: loose
- ? 'loose_item_start'
- : 'list_item_start'
- });
-
- // Recurse.
- this.token(item, false);
-
- this.tokens.push({
- type: 'list_item_end'
- });
}
-
- this.tokens.push({
- type: 'list_end'
- });
-
- continue;
+ return targetWay;
}
-
- // html
- if (cap = this.rules.html.exec(src)) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: this.options.sanitize
- ? 'paragraph'
- : 'html',
- pre: cap[1] === 'pre' || cap[1] === 'script',
- text: cap[0]
- });
- continue;
+ function updateChildren(updates, graph) {
+ for (var i2 = 0; i2 < updates.replacements.length; i2++) {
+ graph = graph.replace(updates.replacements[i2]);
+ }
+ if (updates.removeIds.length) {
+ graph = actionDeleteMultiple(updates.removeIds)(graph);
+ }
+ return graph;
}
-
- // def
- if (top && (cap = this.rules.def.exec(src))) {
- src = src.substring(cap[0].length);
- this.tokens.links[cap[1].toLowerCase()] = {
- href: cap[2],
- title: cap[3]
- };
- continue;
+ function mergeMembers(remote, target) {
+ if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
+ return target;
+ }
+ if (_option === "force_remote") {
+ return target.update({ members: remote.members });
+ }
+ _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
+ return target;
}
+ function mergeTags(base, remote, target) {
+ if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
+ return target;
+ }
+ if (_option === "force_remote") {
+ return target.update({ tags: remote.tags });
+ }
+ var ccount = _conflicts.length;
+ var o = base.tags || {};
+ var a = target.tags || {};
+ var b = remote.tags || {};
+ var keys = utilArrayUnion(utilArrayUnion(Object.keys(o), Object.keys(a)), Object.keys(b)).filter(function(k2) {
+ return !discardTags[k2];
+ });
+ var tags = Object.assign({}, a);
+ var changed = false;
+ for (var i2 = 0; i2 < keys.length; i2++) {
+ var k = keys[i2];
+ if (o[k] !== b[k] && a[k] !== b[k]) {
+ if (o[k] !== a[k]) {
+ _conflicts.push(_t.html("merge_remote_changes.conflict.tags", { tag: k, local: a[k], remote: b[k], user: { html: user(remote.user) } }));
+ } else {
+ if (b.hasOwnProperty(k)) {
+ tags[k] = b[k];
+ } else {
+ delete tags[k];
+ }
+ changed = true;
+ }
+ }
+ }
+ return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
+ }
+ var action = function(graph) {
+ var updates = { replacements: [], removeIds: [] };
+ var base = graph.base().entities[id2];
+ var local = localGraph.entity(id2);
+ var remote = remoteGraph.entity(id2);
+ var target = osmEntity(local, { version: remote.version });
+ if (!remote.visible) {
+ if (_option === "force_remote") {
+ return actionDeleteMultiple([id2])(graph);
+ } else if (_option === "force_local") {
+ if (target.type === "way") {
+ target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
+ graph = updateChildren(updates, graph);
+ }
+ return graph.replace(target);
+ } else {
+ _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
+ return graph;
+ }
+ }
+ if (target.type === "node") {
+ target = mergeLocation(remote, target);
+ } else if (target.type === "way") {
+ graph.rebase(remoteGraph.childNodes(remote), [graph], false);
+ target = mergeNodes(base, remote, target);
+ target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
+ } else if (target.type === "relation") {
+ target = mergeMembers(remote, target);
+ }
+ target = mergeTags(base, remote, target);
+ if (!_conflicts.length) {
+ graph = updateChildren(updates, graph).replace(target);
+ }
+ return graph;
+ };
+ action.withOption = function(opt) {
+ _option = opt;
+ return action;
+ };
+ action.conflicts = function() {
+ return _conflicts;
+ };
+ return action;
+ }
- // table (gfm)
- if (top && (cap = this.rules.table.exec(src))) {
- src = src.substring(cap[0].length);
-
- item = {
- type: 'table',
- header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
- };
-
- for (i = 0; i < item.align.length; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
+ // modules/actions/move.js
+ function actionMove(moveIDs, tryDelta, projection2, cache) {
+ var _delta = tryDelta;
+ function setupCache(graph) {
+ function canMove(nodeID) {
+ if (moveIDs.indexOf(nodeID) !== -1)
+ return true;
+ var parents = graph.parentWays(graph.entity(nodeID));
+ if (parents.length < 3)
+ return true;
+ var parentsMoving = parents.every(function(way) {
+ return cache.moving[way.id];
+ });
+ if (!parentsMoving)
+ delete cache.moving[nodeID];
+ return parentsMoving;
+ }
+ function cacheEntities(ids) {
+ for (var i2 = 0; i2 < ids.length; i2++) {
+ var id2 = ids[i2];
+ if (cache.moving[id2])
+ continue;
+ cache.moving[id2] = true;
+ var entity = graph.hasEntity(id2);
+ if (!entity)
+ continue;
+ if (entity.type === "node") {
+ cache.nodes.push(id2);
+ cache.startLoc[id2] = entity.loc;
+ } else if (entity.type === "way") {
+ cache.ways.push(id2);
+ cacheEntities(entity.nodes);
+ } else {
+ cacheEntities(entity.members.map(function(member) {
+ return member.id;
+ }));
+ }
}
}
-
- for (i = 0; i < item.cells.length; i++) {
- item.cells[i] = item.cells[i]
- .replace(/^ *\| *| *\| *$/g, '')
- .split(/ *\| */);
+ function cacheIntersections(ids) {
+ function isEndpoint(way2, id3) {
+ return !way2.isClosed() && !!way2.affix(id3);
+ }
+ for (var i2 = 0; i2 < ids.length; i2++) {
+ var id2 = ids[i2];
+ var childNodes = graph.childNodes(graph.entity(id2));
+ for (var j2 = 0; j2 < childNodes.length; j2++) {
+ var node = childNodes[j2];
+ var parents = graph.parentWays(node);
+ if (parents.length !== 2)
+ continue;
+ var moved = graph.entity(id2);
+ var unmoved = null;
+ for (var k = 0; k < parents.length; k++) {
+ var way = parents[k];
+ if (!cache.moving[way.id]) {
+ unmoved = way;
+ break;
+ }
+ }
+ if (!unmoved)
+ continue;
+ if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
+ continue;
+ if (moved.isArea() || unmoved.isArea())
+ continue;
+ cache.intersections.push({
+ nodeId: node.id,
+ movedId: moved.id,
+ unmovedId: unmoved.id,
+ movedIsEP: isEndpoint(moved, node.id),
+ unmovedIsEP: isEndpoint(unmoved, node.id)
+ });
+ }
+ }
+ }
+ if (!cache) {
+ cache = {};
+ }
+ if (!cache.ok) {
+ cache.moving = {};
+ cache.intersections = [];
+ cache.replacedVertex = {};
+ cache.startLoc = {};
+ cache.nodes = [];
+ cache.ways = [];
+ cacheEntities(moveIDs);
+ cacheIntersections(cache.ways);
+ cache.nodes = cache.nodes.filter(canMove);
+ cache.ok = true;
}
-
- this.tokens.push(item);
-
- continue;
}
-
- // top-level paragraph
- if (top && (cap = this.rules.paragraph.exec(src))) {
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'paragraph',
- text: cap[1][cap[1].length-1] === '\n'
- ? cap[1].slice(0, -1)
- : cap[1]
- });
- continue;
+ function replaceMovedVertex(nodeId, wayId, graph, delta) {
+ var way = graph.entity(wayId);
+ var moved = graph.entity(nodeId);
+ var movedIndex = way.nodes.indexOf(nodeId);
+ var len, prevIndex, nextIndex;
+ if (way.isClosed()) {
+ len = way.nodes.length - 1;
+ prevIndex = (movedIndex + len - 1) % len;
+ nextIndex = (movedIndex + len + 1) % len;
+ } else {
+ len = way.nodes.length;
+ prevIndex = movedIndex - 1;
+ nextIndex = movedIndex + 1;
+ }
+ var prev = graph.hasEntity(way.nodes[prevIndex]);
+ var next = graph.hasEntity(way.nodes[nextIndex]);
+ if (!prev || !next)
+ return graph;
+ var key = wayId + "_" + nodeId;
+ var orig = cache.replacedVertex[key];
+ if (!orig) {
+ orig = osmNode();
+ cache.replacedVertex[key] = orig;
+ cache.startLoc[orig.id] = cache.startLoc[nodeId];
+ }
+ var start2, end;
+ if (delta) {
+ start2 = projection2(cache.startLoc[nodeId]);
+ end = projection2.invert(geoVecAdd(start2, delta));
+ } else {
+ end = cache.startLoc[nodeId];
+ }
+ orig = orig.move(end);
+ var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
+ if (angle2 > 175 && angle2 < 185)
+ return graph;
+ var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
+ var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
+ var d1 = geoPathLength(p1);
+ var d2 = geoPathLength(p2);
+ var insertAt = d1 <= d2 ? movedIndex : nextIndex;
+ if (way.isClosed() && insertAt === 0)
+ insertAt = len;
+ way = way.addNode(orig.id, insertAt);
+ return graph.replace(orig).replace(way);
+ }
+ function removeDuplicateVertices(wayId, graph) {
+ var way = graph.entity(wayId);
+ var epsilon3 = 1e-6;
+ var prev, curr;
+ function isInteresting(node, graph2) {
+ return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
+ }
+ for (var i2 = 0; i2 < way.nodes.length; i2++) {
+ curr = graph.entity(way.nodes[i2]);
+ if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
+ if (!isInteresting(prev, graph)) {
+ way = way.removeNode(prev.id);
+ graph = graph.replace(way).remove(prev);
+ } else if (!isInteresting(curr, graph)) {
+ way = way.removeNode(curr.id);
+ graph = graph.replace(way).remove(curr);
+ }
+ }
+ prev = curr;
+ }
+ return graph;
}
-
- // text
- if (cap = this.rules.text.exec(src)) {
- // Top-level should never reach here.
- src = src.substring(cap[0].length);
- this.tokens.push({
- type: 'text',
- text: cap[0]
+ function unZorroIntersection(intersection, graph) {
+ var vertex = graph.entity(intersection.nodeId);
+ var way1 = graph.entity(intersection.movedId);
+ var way2 = graph.entity(intersection.unmovedId);
+ var isEP1 = intersection.movedIsEP;
+ var isEP2 = intersection.unmovedIsEP;
+ if (isEP1 && isEP2)
+ return graph;
+ var nodes1 = graph.childNodes(way1).filter(function(n2) {
+ return n2 !== vertex;
});
- continue;
- }
-
- if (src) {
- throw new
- Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
- }
-
- return this.tokens;
-};
-
-/**
- * Inline-Level Grammar
- */
-
-var inline = {
- escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
- autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
- url: noop,
- tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
- link: /^!?\[(inside)\]\(href\)/,
- reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
- nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
- strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
- em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
- code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
- br: /^ {2,}\n(?!\s*$)/,
- del: noop,
- text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;
-
-inline.link = replace(inline.link)
- ('inside', inline._inside)
- ('href', inline._href)
- ();
-
-inline.reflink = replace(inline.reflink)
- ('inside', inline._inside)
- ();
-
-/**
- * Normal Inline Grammar
- */
-
-inline.normal = merge({}, inline);
-
-/**
- * Pedantic Inline Grammar
- */
-
-inline.pedantic = merge({}, inline.normal, {
- strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
- em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
-});
-
-/**
- * GFM Inline Grammar
- */
-
-inline.gfm = merge({}, inline.normal, {
- escape: replace(inline.escape)('])', '~|])')(),
- url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
- del: /^~~(?=\S)([\s\S]*?\S)~~/,
- text: replace(inline.text)
- (']|', '~]|')
- ('|', '|https?://|')
- ()
-});
-
-/**
- * GFM + Line Breaks Inline Grammar
- */
-
-inline.breaks = merge({}, inline.gfm, {
- br: replace(inline.br)('{2,}', '*')(),
- text: replace(inline.gfm.text)('{2,}', '*')()
-});
-
-/**
- * Inline Lexer & Compiler
- */
-
-function InlineLexer(links, options) {
- this.options = options || marked.defaults;
- this.links = links;
- this.rules = inline.normal;
-
- if (!this.links) {
- throw new
- Error('Tokens array requires a `links` property.');
- }
-
- if (this.options.gfm) {
- if (this.options.breaks) {
- this.rules = inline.breaks;
- } else {
- this.rules = inline.gfm;
- }
- } else if (this.options.pedantic) {
- this.rules = inline.pedantic;
- }
-}
-
-/**
- * Expose Inline Rules
- */
-
-InlineLexer.rules = inline;
-
-/**
- * Static Lexing/Compiling Method
- */
-
-InlineLexer.output = function(src, links, options) {
- var inline = new InlineLexer(links, options);
- return inline.output(src);
-};
-
-/**
- * Lexing/Compiling
- */
-
-InlineLexer.prototype.output = function(src) {
- var out = ''
- , link
- , text
- , href
- , cap;
-
- while (src) {
- // escape
- if (cap = this.rules.escape.exec(src)) {
- src = src.substring(cap[0].length);
- out += cap[1];
- continue;
- }
-
- // autolink
- if (cap = this.rules.autolink.exec(src)) {
- src = src.substring(cap[0].length);
- if (cap[2] === '@') {
- text = cap[1][6] === ':'
- ? this.mangle(cap[1].substring(7))
- : this.mangle(cap[1]);
- href = this.mangle('mailto:') + text;
+ var nodes2 = graph.childNodes(way2).filter(function(n2) {
+ return n2 !== vertex;
+ });
+ if (way1.isClosed() && way1.first() === vertex.id)
+ nodes1.push(nodes1[0]);
+ if (way2.isClosed() && way2.first() === vertex.id)
+ nodes2.push(nodes2[0]);
+ var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
+ var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
+ var loc;
+ if (!isEP1 && !isEP2) {
+ var epsilon3 = 1e-6, maxIter = 10;
+ for (var i2 = 0; i2 < maxIter; i2++) {
+ loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
+ edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
+ edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
+ if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
+ break;
+ }
+ } else if (!isEP1) {
+ loc = edge1.loc;
} else {
- text = escape(cap[1]);
- href = text;
- }
- out += ''
- + text
- + '';
- continue;
- }
-
- // url (gfm)
- if (cap = this.rules.url.exec(src)) {
- src = src.substring(cap[0].length);
- text = escape(cap[1]);
- href = text;
- out += ''
- + text
- + '';
- continue;
- }
-
- // tag
- if (cap = this.rules.tag.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.options.sanitize
- ? escape(cap[0])
- : cap[0];
- continue;
- }
-
- // link
- if (cap = this.rules.link.exec(src)) {
- src = src.substring(cap[0].length);
- out += this.outputLink(cap, {
- href: cap[2],
- title: cap[3]
- });
- continue;
- }
-
- // reflink, nolink
- if ((cap = this.rules.reflink.exec(src))
- || (cap = this.rules.nolink.exec(src))) {
- src = src.substring(cap[0].length);
- link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
- link = this.links[link.toLowerCase()];
- if (!link || !link.href) {
- out += cap[0][0];
- src = cap[0].substring(1) + src;
- continue;
+ loc = edge2.loc;
}
- out += this.outputLink(cap, link);
- continue;
- }
-
- // strong
- if (cap = this.rules.strong.exec(src)) {
- src = src.substring(cap[0].length);
- out += ''
- + this.output(cap[2] || cap[1])
- + '';
- continue;
- }
-
- // em
- if (cap = this.rules.em.exec(src)) {
- src = src.substring(cap[0].length);
- out += ''
- + this.output(cap[2] || cap[1])
- + '';
- continue;
- }
-
- // code
- if (cap = this.rules.code.exec(src)) {
- src = src.substring(cap[0].length);
- out += ''
- + escape(cap[2], true)
- + '
';
- continue;
- }
-
- // br
- if (cap = this.rules.br.exec(src)) {
- src = src.substring(cap[0].length);
- out += '
';
- continue;
- }
-
- // del (gfm)
- if (cap = this.rules.del.exec(src)) {
- src = src.substring(cap[0].length);
- out += ''
- + this.output(cap[1])
- + '';
- continue;
- }
-
- // text
- if (cap = this.rules.text.exec(src)) {
- src = src.substring(cap[0].length);
- out += escape(cap[0]);
- continue;
- }
-
- if (src) {
- throw new
- Error('Infinite loop on byte: ' + src.charCodeAt(0));
- }
- }
-
- return out;
-};
-
-/**
- * Compile Link
- */
-
-InlineLexer.prototype.outputLink = function(cap, link) {
- if (cap[0][0] !== '!') {
- return ''
- + this.output(cap[1])
- + '';
- } else {
- return '
';
- }
-};
-
-/**
- * Smartypants Transformations
- */
-
-InlineLexer.prototype.smartypants = function(text) {
- if (!this.options.smartypants) return text;
- return text
- .replace(/--/g, 'â')
- .replace(/'([^']*)'/g, 'â$1â')
- .replace(/"([^"]*)"/g, 'â$1â')
- .replace(/\.{3}/g, 'â¦');
-};
-
-/**
- * Mangle Links
- */
-
-InlineLexer.prototype.mangle = function(text) {
- var out = ''
- , l = text.length
- , i = 0
- , ch;
-
- for (; i < l; i++) {
- ch = text.charCodeAt(i);
- if (Math.random() > 0.5) {
- ch = 'x' + ch.toString(16);
- }
- out += '' + ch + ';';
- }
-
- return out;
-};
-
-/**
- * Parsing & Compiling
- */
-
-function Parser(options) {
- this.tokens = [];
- this.token = null;
- this.options = options || marked.defaults;
-}
-
-/**
- * Static Parse Method
- */
-
-Parser.parse = function(src, options) {
- var parser = new Parser(options);
- return parser.parse(src);
-};
-
-/**
- * Parse Loop
- */
-
-Parser.prototype.parse = function(src) {
- this.inline = new InlineLexer(src.links, this.options);
- this.tokens = src.reverse();
-
- var out = '';
- while (this.next()) {
- out += this.tok();
- }
-
- return out;
-};
-
-/**
- * Next Token
- */
-
-Parser.prototype.next = function() {
- return this.token = this.tokens.pop();
-};
-
-/**
- * Preview Next Token
- */
-
-Parser.prototype.peek = function() {
- return this.tokens[this.tokens.length-1] || 0;
-};
-
-/**
- * Parse Text Tokens
- */
-
-Parser.prototype.parseText = function() {
- var body = this.token.text;
-
- while (this.peek().type === 'text') {
- body += '\n' + this.next().text;
- }
-
- return this.inline.output(body);
-};
-
-/**
- * Parse Current Token
- */
-
-Parser.prototype.tok = function() {
- switch (this.token.type) {
- case 'space': {
- return '';
- }
- case 'hr': {
- return '
\n';
+ graph = graph.replace(vertex.move(loc));
+ if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
+ way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
+ graph = graph.replace(way1);
+ }
+ if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
+ way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
+ graph = graph.replace(way2);
+ }
+ return graph;
}
- case 'heading': {
- return ''
- + this.inline.output(this.token.text)
- + '\n';
+ function cleanupIntersections(graph) {
+ for (var i2 = 0; i2 < cache.intersections.length; i2++) {
+ var obj = cache.intersections[i2];
+ graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
+ graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
+ graph = unZorroIntersection(obj, graph);
+ graph = removeDuplicateVertices(obj.movedId, graph);
+ graph = removeDuplicateVertices(obj.unmovedId, graph);
+ }
+ return graph;
}
- case 'code': {
- if (this.options.highlight) {
- var code = this.options.highlight(this.token.text, this.token.lang);
- if (code != null && code !== this.token.text) {
- this.token.escaped = true;
- this.token.text = code;
- }
+ function limitDelta(graph) {
+ function moveNode(loc) {
+ return geoVecAdd(projection2(loc), _delta);
}
-
- if (!this.token.escaped) {
- this.token.text = escape(this.token.text, true);
+ for (var i2 = 0; i2 < cache.intersections.length; i2++) {
+ var obj = cache.intersections[i2];
+ if (obj.movedIsEP && obj.unmovedIsEP)
+ continue;
+ if (!obj.movedIsEP)
+ continue;
+ var node = graph.entity(obj.nodeId);
+ var start2 = projection2(node.loc);
+ var end = geoVecAdd(start2, _delta);
+ var movedNodes = graph.childNodes(graph.entity(obj.movedId));
+ var movedPath = movedNodes.map(function(n2) {
+ return moveNode(n2.loc);
+ });
+ var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
+ var unmovedPath = unmovedNodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var hits = geoPathIntersections(movedPath, unmovedPath);
+ for (var j2 = 0; i2 < hits.length; i2++) {
+ if (geoVecEqual(hits[j2], end))
+ continue;
+ var edge = geoChooseEdge(unmovedNodes, end, projection2);
+ _delta = geoVecSubtract(projection2(edge.loc), start2);
+ }
}
-
- return ''
- + this.token.text
- + '
\n';
}
- case 'table': {
- var body = ''
- , heading
- , i
- , row
- , cell
- , j;
-
- // header
- body += '\n\n';
- for (i = 0; i < this.token.header.length; i++) {
- heading = this.inline.output(this.token.header[i]);
- body += this.token.align[i]
- ? '' + heading + ' | \n'
- : '' + heading + ' | \n';
+ var action = function(graph) {
+ if (_delta[0] === 0 && _delta[1] === 0)
+ return graph;
+ setupCache(graph);
+ if (cache.intersections.length) {
+ limitDelta(graph);
}
- body += '
\n\n';
-
- // body
- body += '\n'
- for (i = 0; i < this.token.cells.length; i++) {
- row = this.token.cells[i];
- body += '\n';
- for (j = 0; j < row.length; j++) {
- cell = this.inline.output(row[j]);
- body += this.token.align[j]
- ? '' + cell + ' | \n'
- : '' + cell + ' | \n';
- }
- body += '
\n';
- }
- body += '\n';
-
- return '\n';
- }
- case 'blockquote_start': {
- var body = '';
-
- while (this.next().type !== 'blockquote_end') {
- body += this.tok();
- }
-
- return '\n'
- + body
- + '
\n';
- }
- case 'list_start': {
- var type = this.token.ordered ? 'ol' : 'ul'
- , body = '';
-
- while (this.next().type !== 'list_end') {
- body += this.tok();
- }
-
- return '<'
- + type
- + '>\n'
- + body
- + ''
- + type
- + '>\n';
- }
- case 'list_item_start': {
- var body = '';
-
- while (this.next().type !== 'list_item_end') {
- body += this.token.type === 'text'
- ? this.parseText()
- : this.tok();
- }
-
- return ''
- + body
- + '\n';
- }
- case 'loose_item_start': {
- var body = '';
-
- while (this.next().type !== 'list_item_end') {
- body += this.tok();
+ for (var i2 = 0; i2 < cache.nodes.length; i2++) {
+ var node = graph.entity(cache.nodes[i2]);
+ var start2 = projection2(node.loc);
+ var end = geoVecAdd(start2, _delta);
+ graph = graph.replace(node.move(projection2.invert(end)));
}
-
- return ''
- + body
- + '\n';
- }
- case 'html': {
- return !this.token.pre && !this.options.pedantic
- ? this.inline.output(this.token.text)
- : this.token.text;
- }
- case 'paragraph': {
- return ''
- + this.inline.output(this.token.text)
- + '
\n';
- }
- case 'text': {
- return ''
- + this.parseText()
- + '
\n';
- }
- }
-};
-
-/**
- * Helpers
- */
-
-function escape(html, encode) {
- return html
- .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
- .replace(//g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''');
-}
-
-function replace(regex, opt) {
- regex = regex.source;
- opt = opt || '';
- return function self(name, val) {
- if (!name) return new RegExp(regex, opt);
- val = val.source || val;
- val = val.replace(/(^|[^\[])\^/g, '$1');
- regex = regex.replace(name, val);
- return self;
- };
-}
-
-function noop() {}
-noop.exec = noop;
-
-function merge(obj) {
- var i = 1
- , target
- , key;
-
- for (; i < arguments.length; i++) {
- target = arguments[i];
- for (key in target) {
- if (Object.prototype.hasOwnProperty.call(target, key)) {
- obj[key] = target[key];
+ if (cache.intersections.length) {
+ graph = cleanupIntersections(graph);
}
- }
+ return graph;
+ };
+ action.delta = function() {
+ return _delta;
+ };
+ return action;
}
- return obj;
-}
-
-/**
- * Marked
- */
-
-function marked(src, opt, callback) {
- if (callback || typeof opt === 'function') {
- if (!callback) {
- callback = opt;
- opt = null;
- }
-
- if (opt) opt = merge({}, marked.defaults, opt);
-
- var tokens = Lexer.lex(tokens, opt)
- , highlight = opt.highlight
- , pending = 0
- , l = tokens.length
- , i = 0;
-
- if (!highlight || highlight.length < 3) {
- return callback(null, Parser.parse(tokens, opt));
- }
-
- var done = function() {
- delete opt.highlight;
- var out = Parser.parse(tokens, opt);
- opt.highlight = highlight;
- return callback(null, out);
+ // modules/actions/move_member.js
+ function actionMoveMember(relationId, fromIndex, toIndex) {
+ return function(graph) {
+ return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
};
-
- for (; i < l; i++) {
- (function(token) {
- if (token.type !== 'code') return;
- pending++;
- return highlight(token.text, token.lang, function(err, code) {
- if (code == null || code === token.text) {
- return --pending || done();
- }
- token.text = code;
- token.escaped = true;
- --pending || done();
- });
- })(tokens[i]);
- }
-
- return;
}
- try {
- if (opt) opt = merge({}, marked.defaults, opt);
- return Parser.parse(Lexer.lex(src, opt), opt);
- } catch (e) {
- e.message += '\nPlease report this to https://github.com/chjj/marked.';
- if ((opt || marked.defaults).silent) {
- return 'An error occured:
'
- + escape(e.message + '', true)
- + '
';
- }
- throw e;
- }
-}
-
-/**
- * Options
- */
-
-marked.options =
-marked.setOptions = function(opt) {
- merge(marked.defaults, opt);
- return marked;
-};
-
-marked.defaults = {
- gfm: true,
- tables: true,
- breaks: false,
- pedantic: false,
- sanitize: false,
- smartLists: false,
- silent: false,
- highlight: null,
- langPrefix: 'lang-'
-};
-
-/**
- * Expose
- */
-
-marked.Parser = Parser;
-marked.parser = Parser.parse;
-
-marked.Lexer = Lexer;
-marked.lexer = Lexer.lex;
-
-marked.InlineLexer = InlineLexer;
-marked.inlineLexer = InlineLexer.output;
-
-marked.parse = marked;
-
-if (typeof exports === 'object') {
- module.exports = marked;
-} else if (typeof define === 'function' && define.amd) {
- define(function() { return marked; });
-} else {
- this.marked = marked;
-}
-
-}).call(function() {
- return this || (typeof window !== 'undefined' ? window : global);
-}());
-(function () {
-'use strict';
-window.iD = function () {
- window.locale.en = iD.data.en;
- window.locale.current('en');
-
- var dispatch = d3.dispatch('enter', 'exit', 'change'),
- context = {};
-
- // https://github.com/openstreetmap/iD/issues/772
- // http://mathiasbynens.be/notes/localstorage-pattern#comment-9
- var storage;
- try { storage = localStorage; } catch (e) {} // eslint-disable-line no-empty
- storage = storage || (function() {
- var s = {};
- return {
- getItem: function(k) { return s[k]; },
- setItem: function(k, v) { s[k] = v; },
- removeItem: function(k) { delete s[k]; }
- };
- })();
- context.storage = function(k, v) {
- try {
- if (arguments.length === 1) return storage.getItem(k);
- else if (v === null) storage.removeItem(k);
- else storage.setItem(k, v);
- } catch(e) {
- // localstorage quota exceeded
- /* eslint-disable no-console */
- if (typeof console !== 'undefined') console.error('localStorage quota exceeded');
- /* eslint-enable no-console */
- }
+ // modules/actions/move_node.js
+ function actionMoveNode(nodeID, toLoc) {
+ var action = function(graph, t) {
+ if (t === null || !isFinite(t))
+ t = 1;
+ t = Math.min(Math.max(+t, 0), 1);
+ var node = graph.entity(nodeID);
+ return graph.replace(node.move(geoVecInterp(node.loc, toLoc, t)));
};
+ action.transitionable = true;
+ return action;
+ }
-
- /* Straight accessors. Avoid using these if you can. */
- var ui, connection, history;
- context.ui = function() { return ui; };
- context.connection = function() { return connection; };
- context.history = function() { return history; };
-
-
- /* Connection */
- function entitiesLoaded(err, result) {
- if (!err) history.merge(result.data, result.extent);
- }
-
- context.preauth = function(options) {
- connection.switch(options);
- return context;
+ // modules/actions/noop.js
+ function actionNoop() {
+ return function(graph) {
+ return graph;
};
+ }
- context.loadTiles = function(projection, dimensions, callback) {
- function done(err, result) {
- entitiesLoaded(err, result);
- if (callback) callback(err, result);
+ // modules/actions/orthogonalize.js
+ function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
+ var epsilon3 = ep || 1e-4;
+ var threshold = degThresh || 13;
+ var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
+ var upperThreshold = Math.cos(threshold * Math.PI / 180);
+ 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);
+ way = way.removeNode("");
+ if (way.tags.nonsquare) {
+ var tags = Object.assign({}, way.tags);
+ delete tags.nonsquare;
+ way = way.update({ tags });
+ }
+ graph = graph.replace(way);
+ var isClosed = way.isClosed();
+ var nodes = graph.childNodes(way).slice();
+ if (isClosed)
+ nodes.pop();
+ if (vertexID !== void 0) {
+ nodes = nodeSubset(nodes, vertexID, isClosed);
+ if (nodes.length !== 3)
+ return graph;
+ }
+ var nodeCount = {};
+ var points = [];
+ var corner = { i: 0, dotp: 1 };
+ var node, point, loc, score, motions, i2, j2;
+ for (i2 = 0; i2 < nodes.length; i2++) {
+ node = nodes[i2];
+ nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
+ points.push({ id: node.id, coord: projection2(node.loc) });
+ }
+ if (points.length === 3) {
+ for (i2 = 0; i2 < 1e3; i2++) {
+ motions = points.map(calcMotion);
+ points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
+ score = corner.dotp;
+ if (score < epsilon3) {
+ break;
+ }
}
- connection.loadTiles(projection, dimensions, done);
- };
-
- context.loadEntity = function(id, callback) {
- function done(err, result) {
- entitiesLoaded(err, result);
- if (callback) callback(err, result);
+ node = graph.entity(nodes[corner.i].id);
+ loc = projection2.invert(points[corner.i].coord);
+ graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
+ } else {
+ var straights = [];
+ var simplified = [];
+ for (i2 = 0; i2 < points.length; i2++) {
+ point = points[i2];
+ var dotp = 0;
+ if (isClosed || i2 > 0 && i2 < points.length - 1) {
+ var a = points[(i2 - 1 + points.length) % points.length];
+ var b = points[(i2 + 1) % points.length];
+ dotp = Math.abs(geoOrthoNormalizedDotProduct(a.coord, b.coord, point.coord));
+ }
+ if (dotp > upperThreshold) {
+ straights.push(point);
+ } else {
+ simplified.push(point);
+ }
}
- connection.loadEntity(id, done);
- };
-
- context.zoomToEntity = function(id, zoomTo) {
- if (zoomTo !== false) {
- this.loadEntity(id, function(err, result) {
- if (err) return;
- var entity = _.find(result.data, function(e) { return e.id === id; });
- if (entity) { map.zoomTo(entity); }
- });
+ var bestPoints = clonePoints(simplified);
+ var originalPoints = clonePoints(simplified);
+ score = Infinity;
+ for (i2 = 0; i2 < 1e3; i2++) {
+ motions = simplified.map(calcMotion);
+ for (j2 = 0; j2 < motions.length; j2++) {
+ simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
+ }
+ var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
+ if (newScore < score) {
+ bestPoints = clonePoints(simplified);
+ score = newScore;
+ }
+ if (score < epsilon3) {
+ break;
+ }
}
-
- map.on('drawn.zoomToEntity', function() {
- if (!context.hasEntity(id)) return;
- map.on('drawn.zoomToEntity', null);
- context.on('enter.zoomToEntity', null);
- context.enter(iD.modes.Select(context, [id]));
+ var bestCoords = bestPoints.map(function(p) {
+ return p.coord;
});
-
- context.on('enter.zoomToEntity', function() {
- if (mode.id !== 'browse') {
- map.on('drawn.zoomToEntity', null);
- context.on('enter.zoomToEntity', null);
+ if (isClosed)
+ bestCoords.push(bestCoords[0]);
+ for (i2 = 0; i2 < bestPoints.length; i2++) {
+ point = bestPoints[i2];
+ if (!geoVecEqual(originalPoints[i2].coord, point.coord)) {
+ node = graph.entity(point.id);
+ loc = projection2.invert(point.coord);
+ graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
+ }
+ }
+ for (i2 = 0; i2 < straights.length; i2++) {
+ point = straights[i2];
+ if (nodeCount[point.id] > 1)
+ continue;
+ node = graph.entity(point.id);
+ if (t === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
+ graph = actionDeleteNode(node.id)(graph);
+ } else {
+ var choice = geoVecProject(point.coord, bestCoords);
+ if (choice) {
+ loc = projection2.invert(choice.target);
+ graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t)));
}
+ }
+ }
+ }
+ return graph;
+ function clonePoints(array2) {
+ return array2.map(function(p) {
+ return { id: p.id, coord: [p.coord[0], p.coord[1]] };
});
+ }
+ function calcMotion(point2, i3, array2) {
+ if (!isClosed && (i3 === 0 || i3 === array2.length - 1))
+ return [0, 0];
+ if (nodeCount[array2[i3].id] > 1)
+ return [0, 0];
+ var a2 = array2[(i3 - 1 + array2.length) % array2.length].coord;
+ var origin = point2.coord;
+ var b2 = array2[(i3 + 1) % array2.length].coord;
+ var p = geoVecSubtract(a2, origin);
+ var q = geoVecSubtract(b2, origin);
+ var scale = 2 * Math.min(geoVecLength(p), geoVecLength(q));
+ p = geoVecNormalize(p);
+ q = geoVecNormalize(q);
+ var dotp2 = p[0] * q[0] + p[1] * q[1];
+ var val = Math.abs(dotp2);
+ if (val < lowerThreshold) {
+ corner.i = i3;
+ corner.dotp = val;
+ var vec = geoVecNormalize(geoVecAdd(p, q));
+ return geoVecScale(vec, 0.1 * dotp2 * scale);
+ }
+ return [0, 0];
+ }
};
-
- var minEditableZoom = 16;
- context.minEditableZoom = function(_) {
- if (!arguments.length) return minEditableZoom;
- minEditableZoom = _;
- connection.tileZoom(_);
- return context;
- };
-
-
- /* History */
- var inIntro = false;
- context.inIntro = function(_) {
- if (!arguments.length) return inIntro;
- inIntro = _;
- return context;
- };
-
- context.save = function() {
- if (inIntro || (mode && mode.id === 'save') || d3.select('.modal').size()) return;
- history.save();
- if (history.hasChanges()) return t('save.unsaved_changes');
+ function nodeSubset(nodes, vertexID2, isClosed) {
+ var first = isClosed ? 0 : 1;
+ var last = isClosed ? nodes.length : nodes.length - 1;
+ for (var i2 = first; i2 < last; i2++) {
+ if (nodes[i2].id === vertexID2) {
+ return [
+ nodes[(i2 - 1 + nodes.length) % nodes.length],
+ nodes[i2],
+ nodes[(i2 + 1) % nodes.length]
+ ];
+ }
+ }
+ return [];
+ }
+ action.disabled = function(graph) {
+ var way = graph.entity(wayID);
+ way = way.removeNode("");
+ graph = graph.replace(way);
+ var isClosed = way.isClosed();
+ var nodes = graph.childNodes(way).slice();
+ if (isClosed)
+ nodes.pop();
+ var allowStraightAngles = false;
+ if (vertexID !== void 0) {
+ allowStraightAngles = true;
+ nodes = nodeSubset(nodes, vertexID, isClosed);
+ if (nodes.length !== 3)
+ return "end_vertex";
+ }
+ var coords = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
+ if (score === null) {
+ return "not_squarish";
+ } else if (score === 0) {
+ return "square_enough";
+ } else {
+ return false;
+ }
};
+ action.transitionable = true;
+ return action;
+ }
- context.flush = function() {
- context.debouncedSave.cancel();
- connection.flush();
- features.reset();
- history.reset();
- _.each(iD.services, function(service) {
- var reset = service().reset;
- if (reset) reset(context);
+ // modules/actions/restrict_turn.js
+ function actionRestrictTurn(turn, restrictionType, restrictionID) {
+ return function(graph) {
+ var fromWay = graph.entity(turn.from.way);
+ var toWay = graph.entity(turn.to.way);
+ var viaNode = turn.via.node && graph.entity(turn.via.node);
+ var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
+ return graph.entity(id2);
+ });
+ var members = [];
+ members.push({ id: fromWay.id, type: "way", role: "from" });
+ if (viaNode) {
+ members.push({ id: viaNode.id, type: "node", role: "via" });
+ } else if (viaWays) {
+ viaWays.forEach(function(viaWay) {
+ members.push({ id: viaWay.id, type: "way", role: "via" });
});
- return context;
- };
-
-
- /* Graph */
- context.hasEntity = function(id) {
- return history.graph().hasEntity(id);
- };
- context.entity = function(id) {
- return history.graph().entity(id);
- };
- context.childNodes = function(way) {
- return history.graph().childNodes(way);
- };
- context.geometry = function(id) {
- return context.entity(id).geometry(history.graph());
- };
-
-
- /* Modes */
- var mode;
- context.mode = function() {
- return mode;
- };
- context.enter = function(newMode) {
- if (mode) {
- mode.exit();
- dispatch.exit(mode);
- }
-
- mode = newMode;
- mode.enter();
- dispatch.enter(mode);
+ }
+ members.push({ id: toWay.id, type: "way", role: "to" });
+ return graph.replace(osmRelation({
+ id: restrictionID,
+ tags: {
+ type: "restriction",
+ restriction: restrictionType
+ },
+ members
+ }));
};
+ }
- context.selectedIDs = function() {
- if (mode && mode.selectedIDs) {
- return mode.selectedIDs();
- } else {
- return [];
+ // modules/actions/revert.js
+ function actionRevert(id2) {
+ var action = function(graph) {
+ var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
+ if (entity && !base) {
+ if (entity.type === "node") {
+ graph.parentWays(entity).forEach(function(parent) {
+ parent = parent.removeNode(id2);
+ graph = graph.replace(parent);
+ if (parent.isDegenerate()) {
+ graph = actionDeleteWay(parent.id)(graph);
+ }
+ });
}
+ graph.parentRelations(entity).forEach(function(parent) {
+ parent = parent.removeMembersWithID(id2);
+ graph = graph.replace(parent);
+ if (parent.isDegenerate()) {
+ graph = actionDeleteRelation(parent.id)(graph);
+ }
+ });
+ }
+ return graph.revert(id2);
};
+ return action;
+ }
-
- /* Behaviors */
- context.install = function(behavior) {
- context.surface().call(behavior);
- };
- context.uninstall = function(behavior) {
- context.surface().call(behavior.off);
- };
-
-
- /* Copy/Paste */
- var copyIDs = [], copyGraph;
- context.copyGraph = function() { return copyGraph; };
- context.copyIDs = function(_) {
- if (!arguments.length) return copyIDs;
- copyIDs = _;
- copyGraph = history.graph();
- return context;
- };
-
-
- /* Background */
- var background;
- context.background = function() { return background; };
-
-
- /* Features */
- var features;
- context.features = function() { return features; };
- context.hasHiddenConnections = function(id) {
- var graph = history.graph(),
- entity = graph.entity(id);
- return features.hasHiddenConnections(entity, graph);
- };
-
-
- /* Map */
- var map;
- context.map = function() { return map; };
- context.layers = function() { return map.layers; };
- context.surface = function() { return map.surface; };
- context.editable = function() { return map.editable(); };
-
- context.surfaceRect = function() {
- // Work around a bug in Firefox.
- // http://stackoverflow.com/questions/18153989/
- // https://bugzilla.mozilla.org/show_bug.cgi?id=530985
- return context.surface().node().parentNode.getBoundingClientRect();
- };
-
-
- /* Debug */
- var debugTile = false, debugCollision = false;
- context.debugTile = function(_) {
- if (!arguments.length) return debugTile;
- debugTile = _;
- dispatch.change();
- return context;
- };
- context.debugCollision = function(_) {
- if (!arguments.length) return debugCollision;
- debugCollision = _;
- dispatch.change();
- return context;
- };
-
-
- /* Presets */
- var presets;
- context.presets = function(_) {
- if (!arguments.length) return presets;
- presets.load(_);
- iD.areaKeys = presets.areaKeys();
- return context;
+ // modules/actions/rotate.js
+ function actionRotate(rotateIds, pivot, angle2, projection2) {
+ var action = function(graph) {
+ return graph.update(function(graph2) {
+ utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
+ var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
+ graph2 = graph2.replace(node.move(projection2.invert(point)));
+ });
+ });
};
+ return action;
+ }
-
- /* Imagery */
- context.imagery = function(_) {
- background.load(_);
- return context;
+ // modules/actions/scale.js
+ function actionScale(ids, pivotLoc, scaleFactor, projection2) {
+ return function(graph) {
+ return graph.update(function(graph2) {
+ let point, radial;
+ utilGetAllNodes(ids, graph2).forEach(function(node) {
+ point = projection2(node.loc);
+ radial = [
+ point[0] - pivotLoc[0],
+ point[1] - pivotLoc[1]
+ ];
+ point = [
+ pivotLoc[0] + scaleFactor * radial[0],
+ pivotLoc[1] + scaleFactor * radial[1]
+ ];
+ graph2 = graph2.replace(node.move(projection2.invert(point)));
+ });
+ });
};
+ }
-
- /* Container */
- var container, embed;
- context.container = function(_) {
- if (!arguments.length) return container;
- container = _;
- container.classed('id-container', true);
- return context;
- };
- context.embed = function(_) {
- if (!arguments.length) return embed;
- embed = _;
- return context;
+ // modules/actions/straighten_nodes.js
+ function actionStraightenNodes(nodeIDs, projection2) {
+ function positionAlongWay(a, o, b) {
+ return geoVecDot(a, b, o) / geoVecDot(b, b, o);
+ }
+ function getEndpoints(points) {
+ var ssr = geoGetSmallestSurroundingRectangle(points);
+ var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
+ var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
+ var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
+ var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
+ var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
+ if (isLong) {
+ return [p1, q1];
+ }
+ return [p2, q2];
+ }
+ var action = function(graph, t) {
+ if (t === null || !isFinite(t))
+ t = 1;
+ t = Math.min(Math.max(+t, 0), 1);
+ var nodes = nodeIDs.map(function(id2) {
+ return graph.entity(id2);
+ });
+ var points = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var endpoints = getEndpoints(points);
+ var startPoint = endpoints[0];
+ var endPoint = endpoints[1];
+ for (var i2 = 0; i2 < points.length; i2++) {
+ var node = nodes[i2];
+ var point = points[i2];
+ var u = positionAlongWay(point, startPoint, endPoint);
+ var point2 = geoVecInterp(startPoint, endPoint, u);
+ var loc2 = projection2.invert(point2);
+ graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
+ }
+ return graph;
};
-
-
- /* Taginfo */
- var taginfo;
- context.taginfo = function(_) {
- if (!arguments.length) return taginfo;
- taginfo = _;
- return context;
+ action.disabled = function(graph) {
+ var nodes = nodeIDs.map(function(id2) {
+ return graph.entity(id2);
+ });
+ var points = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var endpoints = getEndpoints(points);
+ var startPoint = endpoints[0];
+ var endPoint = endpoints[1];
+ var maxDistance = 0;
+ for (var i2 = 0; i2 < points.length; i2++) {
+ var point = points[i2];
+ var u = positionAlongWay(point, startPoint, endPoint);
+ var p = geoVecInterp(startPoint, endPoint, u);
+ var dist = geoVecLength(p, point);
+ if (!isNaN(dist) && dist > maxDistance) {
+ maxDistance = dist;
+ }
+ }
+ if (maxDistance < 1e-4) {
+ return "straight_enough";
+ }
};
+ action.transitionable = true;
+ return action;
+ }
-
- /* Assets */
- var assetPath = '';
- context.assetPath = function(_) {
- if (!arguments.length) return assetPath;
- assetPath = _;
- return context;
+ // modules/actions/straighten_way.js
+ function actionStraightenWay(selectedIDs, projection2) {
+ function positionAlongWay(a, o, b) {
+ return geoVecDot(a, b, o) / geoVecDot(b, b, o);
+ }
+ function allNodes(graph) {
+ var nodes = [];
+ var startNodes = [];
+ var endNodes = [];
+ var remainingWays = [];
+ var selectedWays = selectedIDs.filter(function(w) {
+ return graph.entity(w).type === "way";
+ });
+ var selectedNodes = selectedIDs.filter(function(n2) {
+ return graph.entity(n2).type === "node";
+ });
+ for (var i2 = 0; i2 < selectedWays.length; i2++) {
+ var way = graph.entity(selectedWays[i2]);
+ nodes = way.nodes.slice(0);
+ remainingWays.push(nodes);
+ startNodes.push(nodes[0]);
+ endNodes.push(nodes[nodes.length - 1]);
+ }
+ startNodes = startNodes.filter(function(n2) {
+ return startNodes.indexOf(n2) === startNodes.lastIndexOf(n2);
+ });
+ endNodes = endNodes.filter(function(n2) {
+ return endNodes.indexOf(n2) === endNodes.lastIndexOf(n2);
+ });
+ var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
+ var nextWay = [];
+ nodes = [];
+ var getNextWay = function(currNode2, remainingWays2) {
+ return remainingWays2.filter(function(way2) {
+ return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
+ })[0];
+ };
+ while (remainingWays.length) {
+ nextWay = getNextWay(currNode, remainingWays);
+ remainingWays = utilArrayDifference(remainingWays, [nextWay]);
+ if (nextWay[0] !== currNode) {
+ nextWay.reverse();
+ }
+ nodes = nodes.concat(nextWay);
+ currNode = nodes[nodes.length - 1];
+ }
+ if (selectedNodes.length === 2) {
+ var startNodeIdx = nodes.indexOf(selectedNodes[0]);
+ var endNodeIdx = nodes.indexOf(selectedNodes[1]);
+ var sortedStartEnd = [startNodeIdx, endNodeIdx];
+ sortedStartEnd.sort(function(a, b) {
+ return a - b;
+ });
+ nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
+ }
+ return nodes.map(function(n2) {
+ return graph.entity(n2);
+ });
+ }
+ function shouldKeepNode(node, graph) {
+ return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
+ }
+ var action = function(graph, t) {
+ if (t === null || !isFinite(t))
+ t = 1;
+ t = Math.min(Math.max(+t, 0), 1);
+ var nodes = allNodes(graph);
+ var points = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var startPoint = points[0];
+ var endPoint = points[points.length - 1];
+ var toDelete = [];
+ var i2;
+ for (i2 = 1; i2 < points.length - 1; i2++) {
+ var node = nodes[i2];
+ var point = points[i2];
+ if (t < 1 || shouldKeepNode(node, graph)) {
+ var u = positionAlongWay(point, startPoint, endPoint);
+ var p = geoVecInterp(startPoint, endPoint, u);
+ var loc2 = projection2.invert(p);
+ graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t)));
+ } else {
+ if (toDelete.indexOf(node) === -1) {
+ toDelete.push(node);
+ }
+ }
+ }
+ for (i2 = 0; i2 < toDelete.length; i2++) {
+ graph = actionDeleteNode(toDelete[i2].id)(graph);
+ }
+ return graph;
};
-
- var assetMap = {};
- context.assetMap = function(_) {
- if (!arguments.length) return assetMap;
- assetMap = _;
- return context;
+ action.disabled = function(graph) {
+ var nodes = allNodes(graph);
+ var points = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var startPoint = points[0];
+ var endPoint = points[points.length - 1];
+ var threshold = 0.2 * geoVecLength(startPoint, endPoint);
+ var i2;
+ if (threshold === 0) {
+ return "too_bendy";
+ }
+ var maxDistance = 0;
+ for (i2 = 1; i2 < points.length - 1; i2++) {
+ var point = points[i2];
+ var u = positionAlongWay(point, startPoint, endPoint);
+ var p = geoVecInterp(startPoint, endPoint, u);
+ var dist = geoVecLength(p, point);
+ if (isNaN(dist) || dist > threshold) {
+ return "too_bendy";
+ } else if (dist > maxDistance) {
+ maxDistance = dist;
+ }
+ }
+ var keepingAllNodes = nodes.every(function(node, i3) {
+ return i3 === 0 || i3 === nodes.length - 1 || shouldKeepNode(node, graph);
+ });
+ if (maxDistance < 1e-4 && keepingAllNodes) {
+ return "straight_enough";
+ }
};
+ action.transitionable = true;
+ return action;
+ }
- context.asset = function(_) {
- var filename = assetPath + _;
- return assetMap[filename] || filename;
+ // modules/actions/unrestrict_turn.js
+ function actionUnrestrictTurn(turn) {
+ return function(graph) {
+ return actionDeleteRelation(turn.restrictionID)(graph);
};
+ }
- context.imagePath = function(_) {
- return context.asset('img/' + _);
+ // modules/actions/reflect.js
+ function actionReflect(reflectIds, projection2) {
+ var _useLongAxis = true;
+ 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);
+ var points = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ var ssr = geoGetSmallestSurroundingRectangle(points);
+ var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
+ var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
+ var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
+ var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
+ var p, q;
+ var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
+ if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
+ p = p1;
+ q = q1;
+ } else {
+ p = p2;
+ q = q2;
+ }
+ var dx = q[0] - p[0];
+ var dy = q[1] - p[1];
+ var a = (dx * dx - dy * dy) / (dx * dx + dy * dy);
+ var b = 2 * dx * dy / (dx * dx + dy * dy);
+ for (var i2 = 0; i2 < nodes.length; i2++) {
+ var node = nodes[i2];
+ var c = projection2(node.loc);
+ var c2 = [
+ a * (c[0] - p[0]) + b * (c[1] - p[1]) + p[0],
+ b * (c[0] - p[0]) - a * (c[1] - p[1]) + p[1]
+ ];
+ var loc2 = projection2.invert(c2);
+ node = node.move(geoVecInterp(node.loc, loc2, t));
+ graph = graph.replace(node);
+ }
+ return graph;
};
-
- var locale, localePath;
- context.locale = function(loc, path) {
- locale = loc;
- localePath = path;
-
- // Also set iD.detect().locale (unless we detected 'en-us' and openstreetmap wants 'en')..
- if (!(loc.toLowerCase() === 'en' && iD.detect().locale.toLowerCase() === 'en-us')) {
- iD.detect().locale = loc;
- }
-
- return context;
+ action.useLongAxis = function(val) {
+ if (!arguments.length)
+ return _useLongAxis;
+ _useLongAxis = val;
+ return action;
};
+ action.transitionable = true;
+ return action;
+ }
- context.loadLocale = function(cb) {
- if (locale && locale !== 'en' && iD.data.locales.indexOf(locale) !== -1) {
- localePath = localePath || context.asset('locales/' + locale + '.json');
- d3.json(localePath, function(err, result) {
- window.locale[locale] = result;
- window.locale.current(locale);
- cb();
- });
+ // modules/actions/upgrade_tags.js
+ function actionUpgradeTags(entityId, oldTags, replaceTags) {
+ return function(graph) {
+ var entity = graph.entity(entityId);
+ var tags = Object.assign({}, entity.tags);
+ var transferValue;
+ var semiIndex;
+ for (var oldTagKey in oldTags) {
+ if (!(oldTagKey in tags))
+ continue;
+ if (oldTags[oldTagKey] === "*") {
+ transferValue = tags[oldTagKey];
+ delete tags[oldTagKey];
+ } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
+ delete tags[oldTagKey];
} else {
- cb();
+ var vals = tags[oldTagKey].split(";").filter(Boolean);
+ var oldIndex = vals.indexOf(oldTags[oldTagKey]);
+ if (vals.length === 1 || oldIndex === -1) {
+ delete tags[oldTagKey];
+ } else {
+ if (replaceTags && replaceTags[oldTagKey]) {
+ semiIndex = oldIndex;
+ }
+ vals.splice(oldIndex, 1);
+ tags[oldTagKey] = vals.join(";");
+ }
+ }
+ }
+ if (replaceTags) {
+ for (var replaceKey in replaceTags) {
+ var replaceValue = replaceTags[replaceKey];
+ if (replaceValue === "*") {
+ if (tags[replaceKey] && tags[replaceKey] !== "no") {
+ continue;
+ } else {
+ tags[replaceKey] = "yes";
+ }
+ } else if (replaceValue === "$1") {
+ tags[replaceKey] = transferValue;
+ } else {
+ if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
+ var existingVals = tags[replaceKey].split(";").filter(Boolean);
+ if (existingVals.indexOf(replaceValue) === -1) {
+ existingVals.splice(semiIndex, 0, replaceValue);
+ tags[replaceKey] = existingVals.join(";");
+ }
+ } else {
+ tags[replaceKey] = replaceValue;
+ }
+ }
}
+ }
+ return graph.replace(entity.update({ tags }));
};
+ }
-
- /* Init */
-
- context.projection = iD.geo.RawMercator();
-
- locale = iD.detect().locale;
- if (locale && iD.data.locales.indexOf(locale) === -1) {
- locale = locale.split('-')[0];
+ // modules/behavior/edit.js
+ function behaviorEdit(context) {
+ function behavior() {
+ context.map().minzoom(context.minEditableZoom());
}
+ behavior.off = function() {
+ context.map().minzoom(0);
+ };
+ return behavior;
+ }
- history = iD.History(context);
- context.graph = history.graph;
- context.changes = history.changes;
- context.intersects = history.intersects;
-
- // Debounce save, since it's a synchronous localStorage write,
- // and history changes can happen frequently (e.g. when dragging).
- context.debouncedSave = _.debounce(context.save, 350);
- function withDebouncedSave(fn) {
- return function() {
- var result = fn.apply(history, arguments);
- context.debouncedSave();
- return result;
- };
+ // modules/behavior/hover.js
+ function behaviorHover(context) {
+ var dispatch10 = dispatch_default("hover");
+ var _selection = select_default2(null);
+ var _newNodeId = null;
+ var _initialNodeID = null;
+ var _altDisables;
+ var _ignoreVertex;
+ var _targets = [];
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function keydown(d3_event) {
+ if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
+ _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
+ _selection.classed("hover-disabled", true);
+ dispatch10.call("hover", this, null);
+ }
}
-
- context.perform = withDebouncedSave(history.perform);
- context.replace = withDebouncedSave(history.replace);
- context.pop = withDebouncedSave(history.pop);
- context.overwrite = withDebouncedSave(history.overwrite);
- context.undo = withDebouncedSave(history.undo);
- context.redo = withDebouncedSave(history.redo);
-
- ui = iD.ui(context);
-
- connection = iD.Connection();
-
- background = iD.Background(context);
-
- features = iD.Features(context);
-
- map = iD.Map(context);
- context.mouse = map.mouse;
- context.extent = map.extent;
- context.pan = map.pan;
- context.zoomIn = map.zoomIn;
- context.zoomOut = map.zoomOut;
- context.zoomInFurther = map.zoomInFurther;
- context.zoomOutFurther = map.zoomOutFurther;
- context.redrawEnable = map.redrawEnable;
-
- presets = iD.presets();
-
- return d3.rebind(context, dispatch, 'on');
-};
-
-
-iD.version = '1.9.6';
-
-(function() {
- var detected = {};
-
- var ua = navigator.userAgent,
- m = null;
-
- m = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i); // Edge
- if (m !== null) {
- detected.browser = m[1];
- detected.version = m[2];
+ function keyup(d3_event) {
+ if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
+ _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
+ _selection.classed("hover-disabled", false);
+ dispatch10.call("hover", this, _targets);
+ }
}
- if (!detected.browser) {
- m = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i); // IE11
- if (m !== null) {
- detected.browser = 'msie';
- detected.version = m[1];
+ function behavior(selection2) {
+ _selection = selection2;
+ _targets = [];
+ if (_initialNodeID) {
+ _newNodeId = _initialNodeID;
+ _initialNodeID = null;
+ } else {
+ _newNodeId = null;
+ }
+ _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
+ select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
+ function eventTarget(d3_event) {
+ var datum2 = d3_event.target && d3_event.target.__data__;
+ if (typeof datum2 !== "object")
+ return null;
+ if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
+ return datum2.properties.entity;
+ }
+ return datum2;
+ }
+ function pointerover(d3_event) {
+ if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
+ return;
+ var target = eventTarget(d3_event);
+ if (target && _targets.indexOf(target) === -1) {
+ _targets.push(target);
+ updateHover(d3_event, _targets);
}
- }
- if (!detected.browser) {
- m = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i); // Opera 15+
- if (m !== null) {
- detected.browser = 'Opera';
- detected.version = m[2];
+ }
+ function pointerout(d3_event) {
+ var target = eventTarget(d3_event);
+ var index = _targets.indexOf(target);
+ if (index !== -1) {
+ _targets.splice(index);
+ updateHover(d3_event, _targets);
}
- }
- if (!detected.browser) {
- m = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
- if (m !== null) {
- detected.browser = m[1];
- detected.version = m[2];
- m = ua.match(/version\/([\.\d]+)/i);
- if (m !== null) detected.version = m[1];
+ }
+ function allowsVertex(d) {
+ return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
+ }
+ function modeAllowsHover(target) {
+ var mode = context.mode();
+ if (mode.id === "add-point") {
+ return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
}
+ return true;
+ }
+ function updateHover(d3_event, targets) {
+ _selection.selectAll(".hover").classed("hover", false);
+ _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
+ var mode = context.mode();
+ if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
+ var node = targets.find(function(target) {
+ return target instanceof osmEntity && target.type === "node";
+ });
+ _newNodeId = node && node.id;
+ }
+ targets = targets.filter(function(datum3) {
+ if (datum3 instanceof osmEntity) {
+ return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
+ }
+ return true;
+ });
+ var selector = "";
+ for (var i2 in targets) {
+ var datum2 = targets[i2];
+ if (datum2.__featurehash__) {
+ selector += ", .data" + datum2.__featurehash__;
+ } else if (datum2 instanceof QAItem) {
+ selector += ", ." + datum2.service + ".itemId-" + datum2.id;
+ } else if (datum2 instanceof osmNote) {
+ selector += ", .note-" + datum2.id;
+ } else if (datum2 instanceof osmEntity) {
+ selector += ", ." + datum2.id;
+ if (datum2.type === "relation") {
+ for (var j2 in datum2.members) {
+ selector += ", ." + datum2.members[j2].id;
+ }
+ }
+ }
+ }
+ var suppressed = _altDisables && d3_event && d3_event.altKey;
+ if (selector.trim().length) {
+ selector = selector.slice(1);
+ _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
+ }
+ dispatch10.call("hover", this, !suppressed && targets);
+ }
}
- if (!detected.browser) {
- detected.browser = navigator.appName;
- detected.version = navigator.appVersion;
- }
-
- // keep major.minor version only..
- detected.version = detected.version.split(/\W/).slice(0,2).join('.');
+ behavior.off = function(selection2) {
+ selection2.selectAll(".hover").classed("hover", false);
+ selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
+ selection2.classed("hover-disabled", false);
+ selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
+ select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
+ };
+ behavior.altDisables = function(val) {
+ if (!arguments.length)
+ return _altDisables;
+ _altDisables = val;
+ return behavior;
+ };
+ behavior.ignoreVertex = function(val) {
+ if (!arguments.length)
+ return _ignoreVertex;
+ _ignoreVertex = val;
+ return behavior;
+ };
+ behavior.initialNodeID = function(nodeId) {
+ _initialNodeID = nodeId;
+ return behavior;
+ };
+ return utilRebind(behavior, dispatch10, "on");
+ }
- if (detected.browser.toLowerCase() === 'msie') {
- detected.ie = true;
- detected.browser = 'Internet Explorer';
- detected.support = parseFloat(detected.version) >= 11;
- } else {
- detected.ie = false;
- detected.support = true;
+ // modules/behavior/draw.js
+ var _disableSpace = false;
+ var _lastSpace = null;
+ function behaviorDraw(context) {
+ var dispatch10 = dispatch_default("move", "down", "downcancel", "click", "clickWay", "clickNode", "undo", "cancel", "finish");
+ var keybinding = utilKeybinding("draw");
+ var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
+ var _edit = behaviorEdit(context);
+ var _closeTolerance = 4;
+ var _tolerance = 12;
+ var _mouseLeave = false;
+ var _lastMouse = null;
+ var _lastPointerUpEvent;
+ var _downPointer;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function datum2(d3_event) {
+ var mode = context.mode();
+ var isNote = mode && mode.id.indexOf("note") !== -1;
+ if (d3_event.altKey || isNote)
+ return {};
+ var element;
+ if (d3_event.type === "keydown") {
+ element = _lastMouse && _lastMouse.target;
+ } else {
+ element = d3_event.target;
+ }
+ var d = element.__data__;
+ return d && d.properties && d.properties.target ? d : {};
}
-
- // Added due to incomplete svg style support. See #715
- detected.opera = (detected.browser.toLowerCase() === 'opera' && parseFloat(detected.version) < 15 );
-
- detected.locale = (navigator.languages && navigator.languages.length)
- ? navigator.languages[0] : (navigator.language || navigator.userLanguage || 'en-US');
-
- detected.filedrop = (window.FileReader && 'ondrop' in window);
-
- function nav(x) {
- return navigator.userAgent.indexOf(x) !== -1;
+ function pointerdown(d3_event) {
+ if (_downPointer)
+ return;
+ var pointerLocGetter = utilFastMouse(this);
+ _downPointer = {
+ id: d3_event.pointerId || "mouse",
+ pointerLocGetter,
+ downTime: +new Date(),
+ downLoc: pointerLocGetter(d3_event)
+ };
+ dispatch10.call("down", this, d3_event, datum2(d3_event));
}
-
- if (nav('Win')) {
- detected.os = 'win';
- detected.platform = 'Windows';
+ function pointerup(d3_event) {
+ if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
+ return;
+ var downPointer = _downPointer;
+ _downPointer = null;
+ _lastPointerUpEvent = d3_event;
+ if (downPointer.isCancelled)
+ return;
+ var t2 = +new Date();
+ var p2 = downPointer.pointerLocGetter(d3_event);
+ var dist = geoVecLength(downPointer.downLoc, p2);
+ if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
+ select_default2(window).on("click.draw-block", function() {
+ d3_event.stopPropagation();
+ }, true);
+ context.map().dblclickZoomEnable(false);
+ window.setTimeout(function() {
+ context.map().dblclickZoomEnable(true);
+ select_default2(window).on("click.draw-block", null);
+ }, 500);
+ click(d3_event, p2);
+ }
}
- else if (nav('Mac')) {
- detected.os = 'mac';
- detected.platform = 'Macintosh';
+ function pointermove(d3_event) {
+ if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
+ var p2 = _downPointer.pointerLocGetter(d3_event);
+ var dist = geoVecLength(_downPointer.downLoc, p2);
+ if (dist >= _closeTolerance) {
+ _downPointer.isCancelled = true;
+ dispatch10.call("downcancel", this);
+ }
+ }
+ if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
+ return;
+ if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
+ return;
+ _lastMouse = d3_event;
+ dispatch10.call("move", this, d3_event, datum2(d3_event));
}
- else if (nav('X11') || nav('Linux')) {
- detected.os = 'linux';
- detected.platform = 'Linux';
+ function pointercancel(d3_event) {
+ if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
+ if (!_downPointer.isCancelled) {
+ dispatch10.call("downcancel", this);
+ }
+ _downPointer = null;
+ }
}
- else {
- detected.os = 'win';
- detected.platform = 'Unknown';
+ function mouseenter() {
+ _mouseLeave = false;
}
-
- iD.detect = function() { return detected; };
-})();
-iD.services = {};
-iD.services.mapillary = function() {
- var mapillary = {},
- dispatch = d3.dispatch('loadedImages', 'loadedSigns'),
- apibase = 'https://a.mapillary.com/v2/',
- viewercss = 'https://npmcdn.com/mapillary-js@1.3.0/dist/mapillary-js.min.css',
- viewerjs = 'https://npmcdn.com/mapillary-js@1.3.0/dist/mapillary-js.min.js',
- clientId = 'NzNRM2otQkR2SHJzaXJmNmdQWVQ0dzo1ZWYyMmYwNjdmNDdlNmVi',
- maxResults = 1000,
- maxPages = 10,
- tileZoom = 14;
-
-
- function loadSignStyles(context) {
- d3.select('head').selectAll('#traffico')
- .data([0])
- .enter()
- .append('link')
- .attr('id', 'traffico')
- .attr('rel', 'stylesheet')
- .attr('href', context.asset('traffico/stylesheets/traffico.css'));
- }
-
- function loadSignDefs(context) {
- if (iD.services.mapillary.sign_defs) return;
- iD.services.mapillary.sign_defs = {};
-
- _.each(['au', 'br', 'ca', 'de', 'us'], function(region) {
- d3.json(context.asset('traffico/string-maps/' + region + '-map.json'), function(err, data) {
- if (err) return;
- if (region === 'de') region = 'eu';
- iD.services.mapillary.sign_defs[region] = data;
- });
- });
+ function mouseleave() {
+ _mouseLeave = true;
}
-
- function loadViewer() {
- // mapillary-wrap
- var wrap = d3.select('#content').selectAll('.mapillary-wrap')
- .data([0]);
-
- var enter = wrap.enter().append('div')
- .attr('class', 'mapillary-wrap')
- .classed('al', true) // 'al'=left, 'ar'=right
- .classed('hidden', true);
-
- enter.append('button')
- .attr('class', 'thumb-hide')
- .on('click', function () { mapillary.hideViewer(); })
- .append('div')
- .call(iD.svg.Icon('#icon-close'));
-
- enter.append('div')
- .attr('id', 'mly')
- .attr('class', 'mly-wrapper')
- .classed('active', false);
-
- // mapillary-viewercss
- d3.select('head').selectAll('#mapillary-viewercss')
- .data([0])
- .enter()
- .append('link')
- .attr('id', 'mapillary-viewercss')
- .attr('rel', 'stylesheet')
- .attr('href', viewercss);
-
- // mapillary-viewerjs
- d3.select('head').selectAll('#mapillary-viewerjs')
- .data([0])
- .enter()
- .append('script')
- .attr('id', 'mapillary-viewerjs')
- .attr('src', viewerjs);
- }
-
- function initViewer(imageKey, context) {
-
- function nodeChanged(d) {
- var clicks = iD.services.mapillary.clicks;
- var index = clicks.indexOf(d.key);
- if (index > -1) { // nodechange initiated from clicking on a marker..
- clicks.splice(index, 1);
- } else { // nodechange initiated from the Mapillary viewer controls..
- var loc = d.apiNavImIm ? [d.apiNavImIm.lon, d.apiNavImIm.lat] : [d.latLon.lon, d.latLon.lat];
- context.map().centerEase(loc);
- mapillary.setSelectedImage(d.key, false);
- }
- }
-
- if (Mapillary && imageKey) {
- var opts = {
- baseImageSize: 320,
- cover: false,
- cache: true,
- debug: false,
- imagePlane: true,
- loading: true,
- sequence: true
- };
-
- var viewer = new Mapillary.Viewer('mly', clientId, imageKey, opts);
- viewer.on('nodechanged', nodeChanged);
- viewer.on('loadingchanged', mapillary.setViewerLoading);
- iD.services.mapillary.viewer = viewer;
- }
+ function allowsVertex(d) {
+ return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
}
-
- function abortRequest(i) {
- i.abort();
+ function click(d3_event, loc) {
+ var d = datum2(d3_event);
+ var target = d && d.properties && d.properties.entity;
+ var mode = context.mode();
+ if (target && target.type === "node" && allowsVertex(target)) {
+ dispatch10.call("clickNode", this, target, d);
+ return;
+ } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
+ var choice = geoChooseEdge(context.graph().childNodes(target), loc, context.projection, context.activeID());
+ if (choice) {
+ var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
+ dispatch10.call("clickWay", this, choice.loc, edge, d);
+ return;
+ }
+ } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
+ var locLatLng = context.projection.invert(loc);
+ dispatch10.call("click", this, locLatLng, d);
+ }
}
-
- function nearNullIsland(x, y, z) {
- if (z >= 7) {
- var center = Math.pow(2, z - 1),
- width = Math.pow(2, z - 6),
- min = center - (width / 2),
- max = center + (width / 2) - 1;
- return x >= min && x <= max && y >= min && y <= max;
+ function space(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var currSpace = context.map().mouse();
+ if (_disableSpace && _lastSpace) {
+ var dist = geoVecLength(_lastSpace, currSpace);
+ if (dist > _tolerance) {
+ _disableSpace = false;
}
- return false;
- }
-
- function getTiles(projection, dimensions) {
- var s = projection.scale() * 2 * Math.PI,
- z = Math.max(Math.log(s) / Math.log(2) - 8, 0),
- ts = 256 * Math.pow(2, z - tileZoom),
- origin = [
- s / 2 - projection.translate()[0],
- s / 2 - projection.translate()[1]];
-
- return d3.geo.tile()
- .scaleExtent([tileZoom, tileZoom])
- .scale(s)
- .size(dimensions)
- .translate(projection.translate())()
- .map(function(tile) {
- var x = tile[0] * ts - origin[0],
- y = tile[1] * ts - origin[1];
-
- return {
- id: tile.toString(),
- extent: iD.geo.Extent(
- projection.invert([x, y + ts]),
- projection.invert([x + ts, y]))
- };
- });
- }
-
-
- function loadTiles(which, url, projection, dimensions) {
- var tiles = getTiles(projection, dimensions).filter(function(t) {
- var xyz = t.id.split(',');
- return !nearNullIsland(xyz[0], xyz[1], xyz[2]);
- });
-
- _.filter(which.inflight, function(v, k) {
- var wanted = _.find(tiles, function(tile) { return k === (tile.id + ',0'); });
- if (!wanted) delete which.inflight[k];
- return !wanted;
- }).map(abortRequest);
-
- tiles.forEach(function(tile) {
- loadTilePage(which, url, tile, 0);
- });
- }
-
- function loadTilePage(which, url, tile, page) {
- var cache = iD.services.mapillary.cache[which],
- id = tile.id + ',' + String(page),
- rect = tile.extent.rectangle();
-
- if (cache.loaded[id] || cache.inflight[id]) return;
-
- cache.inflight[id] = d3.json(url +
- iD.util.qsString({
- geojson: 'true',
- limit: maxResults,
- page: page,
- client_id: clientId,
- min_lon: rect[0],
- min_lat: rect[1],
- max_lon: rect[2],
- max_lat: rect[3]
- }), function(err, data) {
- cache.loaded[id] = true;
- delete cache.inflight[id];
- if (err || !data.features || !data.features.length) return;
-
- var features = [],
- nextPage = page + 1,
- feature, loc, d;
-
- for (var i = 0; i < data.features.length; i++) {
- feature = data.features[i];
- loc = feature.geometry.coordinates;
- d = { key: feature.properties.key, loc: loc };
- if (which === 'images') d.ca = feature.properties.ca;
- if (which === 'signs') d.signs = feature.properties.rects;
-
- features.push([loc[0], loc[1], loc[0], loc[1], d]);
- }
-
- cache.rtree.load(features);
+ }
+ if (_disableSpace || _mouseLeave || !_lastMouse)
+ return;
+ _lastSpace = currSpace;
+ _disableSpace = true;
+ select_default2(window).on("keyup.space-block", function() {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ _disableSpace = false;
+ select_default2(window).on("keyup.space-block", null);
+ });
+ var loc = context.map().mouse() || context.projection(context.map().center());
+ click(d3_event, loc);
+ }
+ function backspace(d3_event) {
+ d3_event.preventDefault();
+ dispatch10.call("undo");
+ }
+ function del(d3_event) {
+ d3_event.preventDefault();
+ dispatch10.call("cancel");
+ }
+ function ret(d3_event) {
+ d3_event.preventDefault();
+ dispatch10.call("finish");
+ }
+ function behavior(selection2) {
+ context.install(_hover);
+ context.install(_edit);
+ _downPointer = null;
+ keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
+ selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
+ select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
+ select_default2(document).call(keybinding);
+ return behavior;
+ }
+ behavior.off = function(selection2) {
+ context.ui().sidebar.hover.cancel();
+ context.uninstall(_hover);
+ context.uninstall(_edit);
+ selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
+ select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
+ select_default2(document).call(keybinding.unbind);
+ };
+ behavior.hover = function() {
+ return _hover;
+ };
+ return utilRebind(behavior, dispatch10, "on");
+ }
- if (which === 'images') dispatch.loadedImages();
- if (which === 'signs') dispatch.loadedSigns();
+ // modules/behavior/breathe.js
+ var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
- if (data.features.length === maxResults && nextPage < maxPages) {
- loadTilePage(which, url, tile, nextPage);
- }
- }
- );
+ // node_modules/d3-scale/src/init.js
+ function initRange(domain2, range3) {
+ switch (arguments.length) {
+ case 0:
+ break;
+ case 1:
+ this.range(domain2);
+ break;
+ default:
+ this.range(range3).domain(domain2);
+ break;
}
+ return this;
+ }
- mapillary.loadImages = function(projection, dimensions) {
- var url = apibase + 'search/im/geojson?';
- loadTiles('images', url, projection, dimensions);
+ // node_modules/d3-scale/src/constant.js
+ function constants(x) {
+ return function() {
+ return x;
};
+ }
- mapillary.loadSigns = function(context, projection, dimensions) {
- var url = apibase + 'search/im/geojson/or?';
- loadSignStyles(context);
- loadSignDefs(context);
- loadTiles('signs', url, projection, dimensions);
- };
+ // node_modules/d3-scale/src/number.js
+ function number2(x) {
+ return +x;
+ }
- mapillary.loadViewer = function() {
- loadViewer();
+ // node_modules/d3-scale/src/continuous.js
+ var unit = [0, 1];
+ function identity3(x) {
+ return x;
+ }
+ function normalize(a, b) {
+ return (b -= a = +a) ? function(x) {
+ return (x - a) / b;
+ } : constants(isNaN(b) ? NaN : 0.5);
+ }
+ function clamper(a, b) {
+ var t;
+ if (a > b)
+ t = a, a = b, b = t;
+ return function(x) {
+ return Math.max(a, Math.min(b, x));
};
-
-
- // partition viewport into `psize` x `psize` regions
- function partitionViewport(psize, projection, dimensions) {
- psize = psize || 16;
- var cols = d3.range(0, dimensions[0], psize),
- rows = d3.range(0, dimensions[1], psize),
- partitions = [];
-
- rows.forEach(function(y) {
- cols.forEach(function(x) {
- var min = [x, y + psize],
- max = [x + psize, y];
- partitions.push(
- iD.geo.Extent(projection.invert(min), projection.invert(max)));
- });
- });
-
- return partitions;
+ }
+ function bimap(domain2, range3, interpolate) {
+ var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
+ if (d1 < d0)
+ d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
+ else
+ d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
+ return function(x) {
+ return r0(d0(x));
+ };
+ }
+ function polymap(domain2, range3, interpolate) {
+ var j2 = Math.min(domain2.length, range3.length) - 1, d = new Array(j2), r = new Array(j2), i2 = -1;
+ if (domain2[j2] < domain2[0]) {
+ domain2 = domain2.slice().reverse();
+ range3 = range3.slice().reverse();
}
-
- // no more than `limit` results per partition.
- function searchLimited(psize, limit, projection, dimensions, rtree) {
- limit = limit || 3;
-
- var partitions = partitionViewport(psize, projection, dimensions);
- return _.flatten(_.compact(_.map(partitions, function(extent) {
- return rtree.search(extent.rectangle())
- .slice(0, limit)
- .map(function(d) { return d[4]; });
- })));
+ while (++i2 < j2) {
+ d[i2] = normalize(domain2[i2], domain2[i2 + 1]);
+ r[i2] = interpolate(range3[i2], range3[i2 + 1]);
}
-
- mapillary.images = function(projection, dimensions) {
- var psize = 16, limit = 3;
- return searchLimited(psize, limit, projection, dimensions, iD.services.mapillary.cache.images.rtree);
- };
-
- mapillary.signs = function(projection, dimensions) {
- var psize = 32, limit = 3;
- return searchLimited(psize, limit, projection, dimensions, iD.services.mapillary.cache.signs.rtree);
- };
-
- mapillary.signsSupported = function() {
- var detected = iD.detect();
- return (!(detected.ie || detected.browser.toLowerCase() === 'safari'));
+ return function(x) {
+ var i3 = bisect_default(domain2, x, 1, j2) - 1;
+ return r[i3](d[i3](x));
};
-
- mapillary.signHTML = function(d) {
- if (!iD.services.mapillary.sign_defs) return;
-
- var detectionPackage = d.signs[0].package,
- type = d.signs[0].type,
- country = detectionPackage.split('_')[1];
-
- return iD.services.mapillary.sign_defs[country][type];
+ }
+ function copy(source, target) {
+ return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
+ }
+ function transformer2() {
+ var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
+ function rescale() {
+ var n2 = Math.min(domain2.length, range3.length);
+ if (clamp3 !== identity3)
+ clamp3 = clamper(domain2[0], domain2[n2 - 1]);
+ piecewise = n2 > 2 ? polymap : bimap;
+ output = input = null;
+ return scale;
+ }
+ function scale(x) {
+ return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x)));
+ }
+ scale.invert = function(y) {
+ return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y)));
};
-
- mapillary.showViewer = function() {
- d3.select('#content')
- .selectAll('.mapillary-wrap')
- .classed('hidden', false)
- .selectAll('.mly-wrapper')
- .classed('active', true);
-
- return mapillary;
+ scale.domain = function(_) {
+ return arguments.length ? (domain2 = Array.from(_, number2), rescale()) : domain2.slice();
};
-
- mapillary.hideViewer = function() {
- d3.select('#content')
- .selectAll('.mapillary-wrap')
- .classed('hidden', true)
- .selectAll('.mly-wrapper')
- .classed('active', false);
-
- d3.selectAll('.layer-mapillary-images .viewfield-group, .layer-mapillary-signs .icon-sign')
- .classed('selected', false);
-
- iD.services.mapillary.image = null;
-
- return mapillary;
+ scale.range = function(_) {
+ return arguments.length ? (range3 = Array.from(_), rescale()) : range3.slice();
};
-
- mapillary.setViewerLoading = function(loading) {
- var canvas = d3.select('#content')
- .selectAll('.mly-wrapper canvas');
-
- if (canvas.empty()) return; // viewer not loaded yet
-
- var cover = d3.select('#content')
- .selectAll('.mly-wrapper .Cover');
-
- cover.classed('CoverDone', !loading);
-
- var button = cover.selectAll('.CoverButton')
- .data(loading ? [0] : []);
-
- button.enter()
- .append('div')
- .attr('class', 'CoverButton')
- .append('div')
- .attr('class', 'uil-ripple-css')
- .append('div');
-
- button.exit()
- .remove();
-
- return mapillary;
+ scale.rangeRound = function(_) {
+ return range3 = Array.from(_), interpolate = round_default, rescale();
};
-
- mapillary.updateViewer = function(imageKey, context) {
- if (!iD.services.mapillary) return;
- if (!imageKey) return;
-
- if (!iD.services.mapillary.viewer) {
- initViewer(imageKey, context);
- } else {
- iD.services.mapillary.viewer.moveToKey(imageKey);
- }
-
- return mapillary;
+ scale.clamp = function(_) {
+ return arguments.length ? (clamp3 = _ ? true : identity3, rescale()) : clamp3 !== identity3;
};
-
- mapillary.getSelectedImage = function() {
- if (!iD.services.mapillary) return null;
- return iD.services.mapillary.image;
+ scale.interpolate = function(_) {
+ return arguments.length ? (interpolate = _, rescale()) : interpolate;
};
-
- mapillary.setSelectedImage = function(imageKey, fromClick) {
- if (!iD.services.mapillary) return null;
-
- iD.services.mapillary.image = imageKey;
- if (fromClick) {
- iD.services.mapillary.clicks.push(imageKey);
- }
-
- d3.selectAll('.layer-mapillary-images .viewfield-group, .layer-mapillary-signs .icon-sign')
- .classed('selected', function(d) { return d.key === imageKey; });
-
- return mapillary;
+ scale.unknown = function(_) {
+ return arguments.length ? (unknown = _, scale) : unknown;
};
-
- mapillary.reset = function() {
- var cache = iD.services.mapillary.cache;
-
- if (cache) {
- _.forEach(cache.images.inflight, abortRequest);
- _.forEach(cache.signs.inflight, abortRequest);
- }
-
- iD.services.mapillary.cache = {
- images: { inflight: {}, loaded: {}, rtree: rbush() },
- signs: { inflight: {}, loaded: {}, rtree: rbush() }
- };
-
- iD.services.mapillary.image = null;
- iD.services.mapillary.clicks = [];
-
- return mapillary;
+ return function(t, u) {
+ transform2 = t, untransform = u;
+ return rescale();
};
+ }
+ function continuous() {
+ return transformer2()(identity3, identity3);
+ }
+ // node_modules/d3-format/src/formatDecimal.js
+ function formatDecimal_default(x) {
+ return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
+ }
+ function formatDecimalParts(x, p) {
+ if ((i2 = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0)
+ return null;
+ var i2, coefficient = x.slice(0, i2);
+ return [
+ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
+ +x.slice(i2 + 1)
+ ];
+ }
- if (!iD.services.mapillary.cache) {
- mapillary.reset();
- }
-
- return d3.rebind(mapillary, dispatch, 'on');
-};
-iD.services.nominatim = function() {
- var nominatim = {},
- endpoint = 'https://nominatim.openstreetmap.org/reverse?';
-
-
- nominatim.countryCode = function(location, callback) {
- var cache = iD.services.nominatim.cache,
- countryCodes = cache.search([location[0], location[1], location[0], location[1]]);
-
- if (countryCodes.length > 0)
- return callback(null, countryCodes[0][4]);
-
- d3.json(endpoint +
- iD.util.qsString({
- format: 'json',
- addressdetails: 1,
- lat: location[1],
- lon: location[0]
- }), function(err, result) {
- if (err)
- return callback(err);
- else if (result && result.error)
- return callback(result.error);
-
- var extent = iD.geo.Extent(location).padByMeters(1000);
-
- cache.insert(extent.rectangle().concat(result.address.country_code));
+ // node_modules/d3-format/src/exponent.js
+ function exponent_default(x) {
+ return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;
+ }
- callback(null, result.address.country_code);
- });
+ // node_modules/d3-format/src/formatGroup.js
+ function formatGroup_default(grouping, thousands) {
+ return function(value, width) {
+ var i2 = value.length, t = [], j2 = 0, g = grouping[0], length = 0;
+ while (i2 > 0 && g > 0) {
+ if (length + g + 1 > width)
+ g = Math.max(1, width - length);
+ t.push(value.substring(i2 -= g, i2 + g));
+ if ((length += g + 1) > width)
+ break;
+ g = grouping[j2 = (j2 + 1) % grouping.length];
+ }
+ return t.reverse().join(thousands);
};
+ }
- nominatim.reset = function() {
- iD.services.nominatim.cache = rbush();
- return nominatim;
+ // node_modules/d3-format/src/formatNumerals.js
+ function formatNumerals_default(numerals) {
+ return function(value) {
+ return value.replace(/[0-9]/g, function(i2) {
+ return numerals[+i2];
+ });
};
+ }
+ // node_modules/d3-format/src/formatSpecifier.js
+ var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
+ function formatSpecifier(specifier) {
+ if (!(match = re.exec(specifier)))
+ throw new Error("invalid format: " + specifier);
+ var match;
+ return new FormatSpecifier({
+ fill: match[1],
+ align: match[2],
+ sign: match[3],
+ symbol: match[4],
+ zero: match[5],
+ width: match[6],
+ comma: match[7],
+ precision: match[8] && match[8].slice(1),
+ trim: match[9],
+ type: match[10]
+ });
+ }
+ formatSpecifier.prototype = FormatSpecifier.prototype;
+ function FormatSpecifier(specifier) {
+ this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
+ this.align = specifier.align === void 0 ? ">" : specifier.align + "";
+ this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
+ this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
+ this.zero = !!specifier.zero;
+ this.width = specifier.width === void 0 ? void 0 : +specifier.width;
+ this.comma = !!specifier.comma;
+ this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
+ this.trim = !!specifier.trim;
+ this.type = specifier.type === void 0 ? "" : specifier.type + "";
+ }
+ FormatSpecifier.prototype.toString = function() {
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
+ };
- if (!iD.services.nominatim.cache) {
- nominatim.reset();
- }
-
- return nominatim;
-};
-iD.services.taginfo = function() {
- var taginfo = {},
- endpoint = 'https://taginfo.openstreetmap.org/api/4/',
- tag_sorts = {
- point: 'count_nodes',
- vertex: 'count_nodes',
- area: 'count_ways',
- line: 'count_ways'
- },
- tag_filters = {
- point: 'nodes',
- vertex: 'nodes',
- area: 'ways',
- line: 'ways'
- };
-
-
- function sets(parameters, n, o) {
- if (parameters.geometry && o[parameters.geometry]) {
- parameters[n] = o[parameters.geometry];
+ // node_modules/d3-format/src/formatTrim.js
+ function formatTrim_default(s) {
+ out:
+ for (var n2 = s.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) {
+ switch (s[i2]) {
+ case ".":
+ i0 = i1 = i2;
+ break;
+ case "0":
+ if (i0 === 0)
+ i0 = i2;
+ i1 = i2;
+ break;
+ default:
+ if (!+s[i2])
+ break out;
+ if (i0 > 0)
+ i0 = 0;
+ break;
}
- return parameters;
- }
+ }
+ return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;
+ }
- function setFilter(parameters) {
- return sets(parameters, 'filter', tag_filters);
- }
+ // node_modules/d3-format/src/formatPrefixAuto.js
+ var prefixExponent;
+ function formatPrefixAuto_default(x, p) {
+ var d = formatDecimalParts(x, p);
+ if (!d)
+ return x + "";
+ var coefficient = d[0], exponent = d[1], i2 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n2 = coefficient.length;
+ return i2 === n2 ? coefficient : i2 > n2 ? coefficient + new Array(i2 - n2 + 1).join("0") : i2 > 0 ? coefficient.slice(0, i2) + "." + coefficient.slice(i2) : "0." + new Array(1 - i2).join("0") + formatDecimalParts(x, Math.max(0, p + i2 - 1))[0];
+ }
- function setSort(parameters) {
- return sets(parameters, 'sortname', tag_sorts);
- }
+ // node_modules/d3-format/src/formatRounded.js
+ function formatRounded_default(x, p) {
+ var d = formatDecimalParts(x, p);
+ if (!d)
+ return x + "";
+ var coefficient = d[0], exponent = d[1];
+ return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
+ }
- function clean(parameters) {
- return _.omit(parameters, 'geometry', 'debounce');
- }
+ // node_modules/d3-format/src/formatTypes.js
+ var formatTypes_default = {
+ "%": (x, p) => (x * 100).toFixed(p),
+ "b": (x) => Math.round(x).toString(2),
+ "c": (x) => x + "",
+ "d": formatDecimal_default,
+ "e": (x, p) => x.toExponential(p),
+ "f": (x, p) => x.toFixed(p),
+ "g": (x, p) => x.toPrecision(p),
+ "o": (x) => Math.round(x).toString(8),
+ "p": (x, p) => formatRounded_default(x * 100, p),
+ "r": formatRounded_default,
+ "s": formatPrefixAuto_default,
+ "X": (x) => Math.round(x).toString(16).toUpperCase(),
+ "x": (x) => Math.round(x).toString(16)
+ };
- function filterKeys(type) {
- var count_type = type ? 'count_' + type : 'count_all';
- return function(d) {
- return parseFloat(d[count_type]) > 2500 || d.in_wiki;
- };
- }
+ // node_modules/d3-format/src/identity.js
+ function identity_default3(x) {
+ return x;
+ }
- function filterMultikeys() {
- return function(d) {
- return (d.key.match(/:/g) || []).length === 1; // exactly one ':'
- };
+ // node_modules/d3-format/src/locale.js
+ var map = Array.prototype.map;
+ var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
+ function locale_default(locale2) {
+ var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default3 : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default3 : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
+ function newFormat(specifier) {
+ specifier = formatSpecifier(specifier);
+ var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision2 = specifier.precision, trim = specifier.trim, type3 = specifier.type;
+ if (type3 === "n")
+ comma = true, type3 = "g";
+ else if (!formatTypes_default[type3])
+ precision2 === void 0 && (precision2 = 12), trim = true, type3 = "g";
+ if (zero3 || fill === "0" && align === "=")
+ zero3 = true, fill = "0", align = "=";
+ var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type3) ? "0" + type3.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type3) ? percent : "";
+ var formatType = formatTypes_default[type3], maybeSuffix = /[defgprs%]/.test(type3);
+ precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type3) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
+ function format2(value) {
+ var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c;
+ if (type3 === "c") {
+ valueSuffix = formatType(value) + valueSuffix;
+ value = "";
+ } else {
+ value = +value;
+ var valueNegative = value < 0 || 1 / value < 0;
+ value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
+ if (trim)
+ value = formatTrim_default(value);
+ if (valueNegative && +value === 0 && sign2 !== "+")
+ valueNegative = false;
+ valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
+ valueSuffix = (type3 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
+ if (maybeSuffix) {
+ i2 = -1, n2 = value.length;
+ while (++i2 < n2) {
+ if (c = value.charCodeAt(i2), 48 > c || c > 57) {
+ valueSuffix = (c === 46 ? decimal + value.slice(i2 + 1) : value.slice(i2)) + valueSuffix;
+ value = value.slice(0, i2);
+ break;
+ }
+ }
+ }
+ }
+ if (comma && !zero3)
+ value = group(value, Infinity);
+ var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
+ if (comma && zero3)
+ value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
+ switch (align) {
+ case "<":
+ value = valuePrefix + value + valueSuffix + padding;
+ break;
+ case "=":
+ value = valuePrefix + padding + value + valueSuffix;
+ break;
+ case "^":
+ value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
+ break;
+ default:
+ value = padding + valuePrefix + value + valueSuffix;
+ break;
+ }
+ return numerals(value);
+ }
+ format2.toString = function() {
+ return specifier + "";
+ };
+ return format2;
}
-
- function filterValues() {
- return function(d) {
- if (d.value.match(/[A-Z*;,]/) !== null) return false; // exclude some punctuation, uppercase letters
- return parseFloat(d.fraction) > 0.0 || d.in_wiki;
- };
+ function formatPrefix2(specifier, value) {
+ var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
+ return function(value2) {
+ return f2(k * value2) + prefix;
+ };
}
+ return {
+ format: newFormat,
+ formatPrefix: formatPrefix2
+ };
+ }
- function valKey(d) {
- return {
- value: d.key,
- title: d.key
- };
- }
+ // node_modules/d3-format/src/defaultLocale.js
+ var locale;
+ var format;
+ var formatPrefix;
+ defaultLocale({
+ thousands: ",",
+ grouping: [3],
+ currency: ["$", ""]
+ });
+ function defaultLocale(definition) {
+ locale = locale_default(definition);
+ format = locale.format;
+ formatPrefix = locale.formatPrefix;
+ return locale;
+ }
- function valKeyDescription(d) {
- return {
- value: d.value,
- title: d.description || d.value
- };
- }
+ // node_modules/d3-format/src/precisionFixed.js
+ function precisionFixed_default(step) {
+ return Math.max(0, -exponent_default(Math.abs(step)));
+ }
- // sort keys with ':' lower than keys without ':'
- function sortKeys(a, b) {
- return (a.key.indexOf(':') === -1 && b.key.indexOf(':') !== -1) ? -1
- : (a.key.indexOf(':') !== -1 && b.key.indexOf(':') === -1) ? 1
- : 0;
- }
+ // node_modules/d3-format/src/precisionPrefix.js
+ function precisionPrefix_default(step, value) {
+ return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
+ }
- var debounced = _.debounce(d3.json, 100, true);
+ // node_modules/d3-format/src/precisionRound.js
+ function precisionRound_default(step, max3) {
+ step = Math.abs(step), max3 = Math.abs(max3) - step;
+ return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
+ }
- function request(url, debounce, callback) {
- var cache = iD.services.taginfo.cache;
+ // node_modules/d3-scale/src/tickFormat.js
+ function tickFormat(start2, stop, count, specifier) {
+ var step = tickStep(start2, stop, count), precision2;
+ specifier = formatSpecifier(specifier == null ? ",f" : specifier);
+ switch (specifier.type) {
+ case "s": {
+ var value = Math.max(Math.abs(start2), Math.abs(stop));
+ if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
+ specifier.precision = precision2;
+ return formatPrefix(specifier, value);
+ }
+ case "":
+ case "e":
+ case "g":
+ case "p":
+ case "r": {
+ if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
+ specifier.precision = precision2 - (specifier.type === "e");
+ break;
+ }
+ case "f":
+ case "%": {
+ if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
+ specifier.precision = precision2 - (specifier.type === "%") * 2;
+ break;
+ }
+ }
+ return format(specifier);
+ }
- if (cache[url]) {
- callback(null, cache[url]);
- } else if (debounce) {
- debounced(url, done);
+ // node_modules/d3-scale/src/linear.js
+ function linearish(scale) {
+ var domain2 = scale.domain;
+ scale.ticks = function(count) {
+ var d = domain2();
+ return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
+ };
+ scale.tickFormat = function(count, specifier) {
+ var d = domain2();
+ return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
+ };
+ scale.nice = function(count) {
+ if (count == null)
+ count = 10;
+ var d = domain2();
+ var i0 = 0;
+ var i1 = d.length - 1;
+ var start2 = d[i0];
+ var stop = d[i1];
+ var prestep;
+ var step;
+ var maxIter = 10;
+ if (stop < start2) {
+ step = start2, start2 = stop, stop = step;
+ step = i0, i0 = i1, i1 = step;
+ }
+ while (maxIter-- > 0) {
+ step = tickIncrement(start2, stop, count);
+ if (step === prestep) {
+ d[i0] = start2;
+ d[i1] = stop;
+ return domain2(d);
+ } else if (step > 0) {
+ start2 = Math.floor(start2 / step) * step;
+ stop = Math.ceil(stop / step) * step;
+ } else if (step < 0) {
+ start2 = Math.ceil(start2 * step) / step;
+ stop = Math.floor(stop * step) / step;
} else {
- d3.json(url, done);
+ break;
}
+ prestep = step;
+ }
+ return scale;
+ };
+ return scale;
+ }
+ function linear3() {
+ var scale = continuous();
+ scale.copy = function() {
+ return copy(scale, linear3());
+ };
+ initRange.apply(scale, arguments);
+ return linearish(scale);
+ }
- function done(err, data) {
- if (!err) cache[url] = data;
- callback(err, data);
- }
+ // node_modules/d3-scale/src/quantize.js
+ function quantize() {
+ var x05 = 0, x12 = 1, n2 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
+ function scale(x) {
+ return x != null && x <= x ? range3[bisect_default(domain2, x, 0, n2)] : unknown;
}
-
- taginfo.keys = function(parameters, callback) {
- var debounce = parameters.debounce;
- parameters = clean(setSort(parameters));
- request(endpoint + 'keys/all?' +
- iD.util.qsString(_.extend({
- rp: 10,
- sortname: 'count_all',
- sortorder: 'desc',
- page: 1
- }, parameters)), debounce, function(err, d) {
- if (err) return callback(err);
- var f = filterKeys(parameters.filter);
- callback(null, d.data.filter(f).sort(sortKeys).map(valKey));
- });
+ function rescale() {
+ var i2 = -1;
+ domain2 = new Array(n2);
+ while (++i2 < n2)
+ domain2[i2] = ((i2 + 1) * x12 - (i2 - n2) * x05) / (n2 + 1);
+ return scale;
+ }
+ scale.domain = function(_) {
+ return arguments.length ? ([x05, x12] = _, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
};
-
- taginfo.multikeys = function(parameters, callback) {
- var debounce = parameters.debounce;
- parameters = clean(setSort(parameters));
- request(endpoint + 'keys/all?' +
- iD.util.qsString(_.extend({
- rp: 25,
- sortname: 'count_all',
- sortorder: 'desc',
- page: 1
- }, parameters)), debounce, function(err, d) {
- if (err) return callback(err);
- var f = filterMultikeys();
- callback(null, d.data.filter(f).map(valKey));
- });
+ scale.range = function(_) {
+ return arguments.length ? (n2 = (range3 = Array.from(_)).length - 1, rescale()) : range3.slice();
};
-
- taginfo.values = function(parameters, callback) {
- var debounce = parameters.debounce;
- parameters = clean(setSort(setFilter(parameters)));
- request(endpoint + 'key/values?' +
- iD.util.qsString(_.extend({
- rp: 25,
- sortname: 'count_all',
- sortorder: 'desc',
- page: 1
- }, parameters)), debounce, function(err, d) {
- if (err) return callback(err);
- var f = filterValues();
- callback(null, d.data.filter(f).map(valKeyDescription));
- });
+ scale.invertExtent = function(y) {
+ var i2 = range3.indexOf(y);
+ return i2 < 0 ? [NaN, NaN] : i2 < 1 ? [x05, domain2[0]] : i2 >= n2 ? [domain2[n2 - 1], x12] : [domain2[i2 - 1], domain2[i2]];
};
-
- taginfo.docs = function(parameters, callback) {
- var debounce = parameters.debounce;
- parameters = clean(setSort(parameters));
-
- var path = 'key/wiki_pages?';
- if (parameters.value) path = 'tag/wiki_pages?';
- else if (parameters.rtype) path = 'relation/wiki_pages?';
-
- request(endpoint + path + iD.util.qsString(parameters), debounce, function(err, d) {
- if (err) return callback(err);
- callback(null, d.data);
- });
+ scale.unknown = function(_) {
+ return arguments.length ? (unknown = _, scale) : scale;
};
-
- taginfo.endpoint = function(_) {
- if (!arguments.length) return endpoint;
- endpoint = _;
- return taginfo;
+ scale.thresholds = function() {
+ return domain2.slice();
};
-
- taginfo.reset = function() {
- iD.services.taginfo.cache = {};
- return taginfo;
+ scale.copy = function() {
+ return quantize().domain([x05, x12]).range(range3).unknown(unknown);
};
+ return initRange.apply(linearish(scale), arguments);
+ }
-
- if (!iD.services.taginfo.cache) {
- taginfo.reset();
+ // modules/behavior/breathe.js
+ function behaviorBreathe() {
+ var duration = 800;
+ var steps = 4;
+ var selector = ".selected.shadow, .selected .shadow";
+ var _selected = select_default2(null);
+ var _classed = "";
+ var _params = {};
+ var _done = false;
+ var _timer;
+ function ratchetyInterpolator(a, b, steps2, units) {
+ a = parseFloat(a);
+ b = parseFloat(b);
+ var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a, b), steps2));
+ return function(t) {
+ return String(sample(t)) + (units || "");
+ };
+ }
+ function reset(selection2) {
+ selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
+ }
+ function setAnimationParams(transition2, fromTo) {
+ var toFrom = fromTo === "from" ? "to" : "from";
+ transition2.styleTween("stroke-opacity", function(d) {
+ return ratchetyInterpolator(_params[d.id][toFrom].opacity, _params[d.id][fromTo].opacity, steps);
+ }).styleTween("stroke-width", function(d) {
+ return ratchetyInterpolator(_params[d.id][toFrom].width, _params[d.id][fromTo].width, steps, "px");
+ }).styleTween("fill-opacity", function(d) {
+ return ratchetyInterpolator(_params[d.id][toFrom].opacity, _params[d.id][fromTo].opacity, steps);
+ }).styleTween("r", function(d) {
+ return ratchetyInterpolator(_params[d.id][toFrom].width, _params[d.id][fromTo].width, steps, "px");
+ });
+ }
+ function calcAnimationParams(selection2) {
+ selection2.call(reset).each(function(d) {
+ var s = select_default2(this);
+ var tag = s.node().tagName;
+ var p = { "from": {}, "to": {} };
+ var opacity;
+ var width;
+ if (tag === "circle") {
+ opacity = parseFloat(s.style("fill-opacity") || 0.5);
+ width = parseFloat(s.style("r") || 15.5);
+ } else {
+ opacity = parseFloat(s.style("stroke-opacity") || 0.7);
+ width = parseFloat(s.style("stroke-width") || 10);
+ }
+ p.tag = tag;
+ p.from.opacity = opacity * 0.6;
+ p.to.opacity = opacity * 1.25;
+ p.from.width = width * 0.7;
+ p.to.width = width * (tag === "circle" ? 1.5 : 1);
+ _params[d.id] = p;
+ });
+ }
+ function run(surface, fromTo) {
+ var toFrom = fromTo === "from" ? "to" : "from";
+ var currSelected = surface.selectAll(selector);
+ var currClassed = surface.attr("class");
+ if (_done || currSelected.empty()) {
+ _selected.call(reset);
+ _selected = select_default2(null);
+ return;
+ }
+ if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
+ _selected.call(reset);
+ _classed = currClassed;
+ _selected = currSelected.call(calcAnimationParams);
+ }
+ var didCallNextRun = false;
+ _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
+ if (!didCallNextRun) {
+ surface.call(run, toFrom);
+ didCallNextRun = true;
+ }
+ if (!select_default2(this).classed("selected")) {
+ reset(select_default2(this));
+ }
+ });
+ }
+ function behavior(surface) {
+ _done = false;
+ _timer = timer(function() {
+ if (surface.selectAll(selector).empty()) {
+ return false;
+ }
+ surface.call(run, "from");
+ _timer.stop();
+ return true;
+ }, 20);
}
+ behavior.restartIfNeeded = function(surface) {
+ if (_selected.empty()) {
+ surface.call(run, "from");
+ if (_timer) {
+ _timer.stop();
+ }
+ }
+ };
+ behavior.off = function() {
+ _done = true;
+ if (_timer) {
+ _timer.stop();
+ }
+ _selected.interrupt().call(reset);
+ };
+ return behavior;
+ }
- return taginfo;
-};
-iD.services.wikidata = function() {
- var wiki = {},
- endpoint = 'https://www.wikidata.org/w/api.php?';
+ // modules/behavior/operation.js
+ function behaviorOperation(context) {
+ var _operation;
+ function keypress(d3_event) {
+ if (!context.map().withinEditableZoom())
+ return;
+ if (_operation.availableForKeypress && !_operation.availableForKeypress())
+ return;
+ d3_event.preventDefault();
+ var disabled = _operation.disabled();
+ if (disabled) {
+ context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip)();
+ } else {
+ context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
+ if (_operation.point)
+ _operation.point(null);
+ _operation();
+ }
+ }
+ function behavior() {
+ if (_operation && _operation.available()) {
+ context.keybinding().on(_operation.keys, keypress);
+ }
+ return behavior;
+ }
+ behavior.off = function() {
+ context.keybinding().off(_operation.keys);
+ };
+ behavior.which = function(_) {
+ if (!arguments.length)
+ return _operation;
+ _operation = _;
+ return behavior;
+ };
+ return behavior;
+ }
- // Given a Wikipedia language and article title, return an array of
- // corresponding Wikidata entities.
- wiki.itemsByTitle = function(lang, title, callback) {
- lang = lang || 'en';
- d3.jsonp(endpoint + iD.util.qsString({
- action: 'wbgetentities',
- format: 'json',
- sites: lang.replace(/-/g, '_') + 'wiki',
- titles: title,
- languages: 'en', // shrink response by filtering to one language
- callback: '{callback}'
- }), function(data) {
- callback(title, data.entities || {});
+ // modules/operations/circularize.js
+ function operationCircularize(context, selectedIDs) {
+ var _extent;
+ var _actions = selectedIDs.map(getAction).filter(Boolean);
+ var _amount = _actions.length === 1 ? "single" : "multiple";
+ var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
+ return n2.loc;
+ });
+ function getAction(entityID) {
+ var entity = context.entity(entityID);
+ if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
+ return null;
+ if (!_extent) {
+ _extent = entity.extent(context.graph());
+ } else {
+ _extent = _extent.extend(entity.extent(context.graph()));
+ }
+ return actionCircularize(entityID, context.projection);
+ }
+ var operation = function() {
+ if (!_actions.length)
+ return;
+ var combinedAction = function(graph, t) {
+ _actions.forEach(function(action) {
+ if (!action.disabled(graph)) {
+ graph = action(graph, t);
+ }
});
+ return graph;
+ };
+ combinedAction.transitionable = true;
+ context.perform(combinedAction, operation.annotation());
+ window.setTimeout(function() {
+ context.validator().validate();
+ }, 300);
};
-
- return wiki;
-};
-iD.services.wikipedia = function() {
- var wiki = {},
- endpoint = 'https://en.wikipedia.org/w/api.php?';
-
- wiki.search = function(lang, query, callback) {
- lang = lang || 'en';
- d3.jsonp(endpoint.replace('en', lang) +
- iD.util.qsString({
- action: 'query',
- list: 'search',
- srlimit: '10',
- srinfo: 'suggestion',
- format: 'json',
- callback: '{callback}',
- srsearch: query
- }), function(data) {
- if (!data.query) return;
- callback(query, data.query.search.map(function(d) {
- return d.title;
- }));
- });
+ operation.available = function() {
+ return _actions.length && selectedIDs.length === _actions.length;
};
-
- wiki.suggestions = function(lang, query, callback) {
- lang = lang || 'en';
- d3.jsonp(endpoint.replace('en', lang) +
- iD.util.qsString({
- action: 'opensearch',
- namespace: 0,
- suggest: '',
- format: 'json',
- callback: '{callback}',
- search: query
- }), function(d) {
- callback(d[0], d[1]);
+ operation.disabled = function() {
+ if (!_actions.length)
+ return "";
+ var actionDisableds = _actions.map(function(action) {
+ return action.disabled(context.graph());
+ }).filter(Boolean);
+ if (actionDisableds.length === _actions.length) {
+ if (new Set(actionDisableds).size > 1) {
+ return "multiple_blockers";
+ }
+ return actionDisableds[0];
+ } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = _coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
});
+ return true;
+ }
+ }
+ return false;
+ }
};
-
- wiki.translations = function(lang, title, callback) {
- d3.jsonp(endpoint.replace('en', lang) +
- iD.util.qsString({
- action: 'query',
- prop: 'langlinks',
- format: 'json',
- callback: '{callback}',
- lllimit: 500,
- titles: title
- }), function(d) {
- var list = d.query.pages[Object.keys(d.query.pages)[0]],
- translations = {};
- if (list && list.langlinks) {
- list.langlinks.forEach(function(d) {
- translations[d.lang] = d['*'];
- });
- callback(translations);
- }
- });
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.circularize." + disable + "." + _amount) : _t("operations.circularize.description." + _amount);
};
+ operation.annotation = function() {
+ return _t("operations.circularize.annotation.feature", { n: _actions.length });
+ };
+ operation.id = "circularize";
+ operation.keys = [_t("operations.circularize.key")];
+ operation.title = _t("operations.circularize.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- return wiki;
-};
-iD.util = {};
-
-iD.util.tagText = function(entity) {
- return d3.entries(entity.tags).map(function(e) {
- return e.key + '=' + e.value;
- }).join(', ');
-};
-
-iD.util.entitySelector = function(ids) {
- return ids.length ? '.' + ids.join(',.') : 'nothing';
-};
-
-iD.util.entityOrMemberSelector = function(ids, graph) {
- var s = iD.util.entitySelector(ids);
+ // modules/ui/cmd.js
+ var uiCmd = function(code) {
+ var detected = utilDetect();
+ if (detected.os === "mac") {
+ return code;
+ }
+ if (detected.os === "win") {
+ if (code === "\u2318\u21E7Z")
+ return "Ctrl+Y";
+ }
+ var result = "", replacements = {
+ "\u2318": "Ctrl",
+ "\u21E7": "Shift",
+ "\u2325": "Alt",
+ "\u232B": "Backspace",
+ "\u2326": "Delete"
+ };
+ for (var i2 = 0; i2 < code.length; i2++) {
+ if (code[i2] in replacements) {
+ result += replacements[code[i2]] + (i2 < code.length - 1 ? "+" : "");
+ } else {
+ result += code[i2];
+ }
+ }
+ return result;
+ };
+ uiCmd.display = function(code) {
+ if (code.length !== 1)
+ return code;
+ var detected = utilDetect();
+ var mac = detected.os === "mac";
+ var replacements = {
+ "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
+ "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
+ "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
+ "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
+ "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
+ "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
+ "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
+ "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
+ "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
+ "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
+ "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
+ "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
+ "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
+ };
+ return replacements[code] || code;
+ };
- ids.forEach(function(id) {
- var entity = graph.hasEntity(id);
- if (entity && entity.type === 'relation') {
- entity.members.forEach(function(member) {
- s += ',.' + member.id;
- });
- }
+ // modules/operations/delete.js
+ function operationDelete(context, selectedIDs) {
+ var multi = selectedIDs.length === 1 ? "single" : "multiple";
+ var action = actionDeleteMultiple(selectedIDs);
+ var nodes = utilGetAllNodes(selectedIDs, context.graph());
+ var coords = nodes.map(function(n2) {
+ return n2.loc;
});
-
- return s;
-};
-
-iD.util.displayName = function(entity) {
- var localeName = 'name:' + iD.detect().locale.toLowerCase().split('-')[0];
- return entity.tags[localeName] || entity.tags.name || entity.tags.ref;
-};
-
-iD.util.displayType = function(id) {
- return {
- n: t('inspector.node'),
- w: t('inspector.way'),
- r: t('inspector.relation')
- }[id.charAt(0)];
-};
-
-iD.util.stringQs = function(str) {
- return str.split('&').reduce(function(obj, pair){
- var parts = pair.split('=');
- if (parts.length === 2) {
- obj[parts[0]] = (null === parts[1]) ? '' : decodeURIComponent(parts[1]);
+ var extent = utilTotalExtent(selectedIDs, context.graph());
+ var operation = function() {
+ var nextSelectedID;
+ var nextSelectedLoc;
+ if (selectedIDs.length === 1) {
+ var id2 = selectedIDs[0];
+ var entity = context.entity(id2);
+ var geometry = entity.geometry(context.graph());
+ var parents = context.graph().parentWays(entity);
+ var parent = parents[0];
+ if (geometry === "vertex") {
+ var nodes2 = parent.nodes;
+ var i2 = nodes2.indexOf(id2);
+ if (i2 === 0) {
+ i2++;
+ } else if (i2 === nodes2.length - 1) {
+ i2--;
+ } else {
+ var a = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 - 1]).loc);
+ var b = geoSphericalDistance(entity.loc, context.entity(nodes2[i2 + 1]).loc);
+ i2 = a < b ? i2 - 1 : i2 + 1;
+ }
+ nextSelectedID = nodes2[i2];
+ nextSelectedLoc = context.entity(nextSelectedID).loc;
}
- return obj;
- }, {});
-};
-
-iD.util.qsString = function(obj, noencode) {
- function softEncode(s) {
- // encode everything except special characters used in certain hash parameters:
- // "/" in map states, ":", ",", {" and "}" in background
- return encodeURIComponent(s).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
- }
- return Object.keys(obj).sort().map(function(key) {
- return encodeURIComponent(key) + '=' + (
- noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
- }).join('&');
-};
-
-iD.util.prefixDOMProperty = function(property) {
- var prefixes = ['webkit', 'ms', 'moz', 'o'],
- i = -1,
- n = prefixes.length,
- s = document.body;
-
- if (property in s)
- return property;
-
- property = property.substr(0, 1).toUpperCase() + property.substr(1);
-
- while (++i < n)
- if (prefixes[i] + property in s)
- return prefixes[i] + property;
-
- return false;
-};
-
-iD.util.prefixCSSProperty = function(property) {
- var prefixes = ['webkit', 'ms', 'Moz', 'O'],
- i = -1,
- n = prefixes.length,
- s = document.body.style;
-
- if (property.toLowerCase() in s)
- return property.toLowerCase();
-
- while (++i < n)
- if (prefixes[i] + property in s)
- return '-' + prefixes[i].toLowerCase() + property.replace(/([A-Z])/g, '-$1').toLowerCase();
-
- return false;
-};
-
-
-iD.util.setTransform = function(el, x, y, scale) {
- var prop = iD.util.transformProperty = iD.util.transformProperty || iD.util.prefixCSSProperty('Transform'),
- translate = iD.detect().opera ?
- 'translate(' + x + 'px,' + y + 'px)' :
- 'translate3d(' + x + 'px,' + y + 'px,0)';
- return el.style(prop, translate + (scale ? ' scale(' + scale + ')' : ''));
-};
-
-iD.util.getStyle = function(selector) {
- for (var i = 0; i < document.styleSheets.length; i++) {
- var rules = document.styleSheets[i].rules || document.styleSheets[i].cssRules || [];
- for (var k = 0; k < rules.length; k++) {
- var selectorText = rules[k].selectorText && rules[k].selectorText.split(', ');
- if (_.includes(selectorText, selector)) {
- return rules[k];
- }
+ }
+ context.perform(action, operation.annotation());
+ context.validator().validate();
+ if (nextSelectedID && nextSelectedLoc) {
+ if (context.hasEntity(nextSelectedID)) {
+ context.enter(modeSelect(context, [nextSelectedID]).follow(true));
+ } else {
+ context.map().centerEase(nextSelectedLoc);
+ context.enter(modeBrowse(context));
}
- }
-};
+ } else {
+ context.enter(modeBrowse(context));
+ }
+ };
+ operation.available = function() {
+ return true;
+ };
+ operation.disabled = function() {
+ if (extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ } else if (selectedIDs.some(protectedMember)) {
+ return "part_of_relation";
+ } else if (selectedIDs.some(incompleteRelation)) {
+ return "incomplete_relation";
+ } else if (selectedIDs.some(hasWikidataTag)) {
+ return "has_wikidata_tag";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
+ });
+ return true;
+ }
+ }
+ return false;
+ }
+ function hasWikidataTag(id2) {
+ var entity = context.entity(id2);
+ return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
+ }
+ function incompleteRelation(id2) {
+ var entity = context.entity(id2);
+ return entity.type === "relation" && !entity.isComplete(context.graph());
+ }
+ function protectedMember(id2) {
+ var entity = context.entity(id2);
+ if (entity.type !== "way")
+ return false;
+ var parents = context.graph().parentRelations(entity);
+ for (var i2 = 0; i2 < parents.length; i2++) {
+ var parent = parents[i2];
+ var type3 = parent.tags.type;
+ var role = parent.memberById(id2).role || "outer";
+ if (type3 === "route" || type3 === "boundary" || type3 === "multipolygon" && role === "outer") {
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.delete." + disable + "." + multi) : _t("operations.delete.description." + multi);
+ };
+ operation.annotation = function() {
+ return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
+ };
+ operation.id = "delete";
+ operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
+ operation.title = _t("operations.delete.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
-iD.util.editDistance = function(a, b) {
- if (a.length === 0) return b.length;
- if (b.length === 0) return a.length;
- var matrix = [];
- for (var i = 0; i <= b.length; i++) { matrix[i] = [i]; }
- for (var j = 0; j <= a.length; j++) { matrix[0][j] = j; }
- for (i = 1; i <= b.length; i++) {
- for (j = 1; j <= a.length; j++) {
- if (b.charAt(i-1) === a.charAt(j-1)) {
- matrix[i][j] = matrix[i-1][j-1];
- } else {
- matrix[i][j] = Math.min(matrix[i-1][j-1] + 1, // substitution
- Math.min(matrix[i][j-1] + 1, // insertion
- matrix[i-1][j] + 1)); // deletion
- }
+ // modules/operations/orthogonalize.js
+ function operationOrthogonalize(context, selectedIDs) {
+ var _extent;
+ var _type;
+ var _actions = selectedIDs.map(chooseAction).filter(Boolean);
+ var _amount = _actions.length === 1 ? "single" : "multiple";
+ var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n2) {
+ return n2.loc;
+ });
+ function chooseAction(entityID) {
+ var entity = context.entity(entityID);
+ var geometry = entity.geometry(context.graph());
+ if (!_extent) {
+ _extent = entity.extent(context.graph());
+ } else {
+ _extent = _extent.extend(entity.extent(context.graph()));
+ }
+ if (entity.type === "way" && new Set(entity.nodes).size > 2) {
+ if (_type && _type !== "feature")
+ return null;
+ _type = "feature";
+ return actionOrthogonalize(entityID, context.projection);
+ } else if (geometry === "vertex") {
+ if (_type && _type !== "corner")
+ return null;
+ _type = "corner";
+ var graph = context.graph();
+ var parents = graph.parentWays(entity);
+ if (parents.length === 1) {
+ var way = parents[0];
+ if (way.nodes.indexOf(entityID) !== -1) {
+ return actionOrthogonalize(way.id, context.projection, entityID);
+ }
}
+ }
+ return null;
}
- return matrix[b.length][a.length];
-};
-
-// a d3.mouse-alike which
-// 1. Only works on HTML elements, not SVG
-// 2. Does not cause style recalculation
-iD.util.fastMouse = function(container) {
- var rect = container.getBoundingClientRect(),
- rectLeft = rect.left,
- rectTop = rect.top,
- clientLeft = +container.clientLeft,
- clientTop = +container.clientTop;
- return function(e) {
- return [
- e.clientX - rectLeft - clientLeft,
- e.clientY - rectTop - clientTop];
+ var operation = function() {
+ if (!_actions.length)
+ return;
+ var combinedAction = function(graph, t) {
+ _actions.forEach(function(action) {
+ if (!action.disabled(graph)) {
+ graph = action(graph, t);
+ }
+ });
+ return graph;
+ };
+ combinedAction.transitionable = true;
+ context.perform(combinedAction, operation.annotation());
+ window.setTimeout(function() {
+ context.validator().validate();
+ }, 300);
+ };
+ operation.available = function() {
+ return _actions.length && selectedIDs.length === _actions.length;
+ };
+ operation.disabled = function() {
+ if (!_actions.length)
+ return "";
+ var actionDisableds = _actions.map(function(action) {
+ return action.disabled(context.graph());
+ }).filter(Boolean);
+ if (actionDisableds.length === _actions.length) {
+ if (new Set(actionDisableds).size > 1) {
+ return "multiple_blockers";
+ }
+ return actionDisableds[0];
+ } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = _coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
+ });
+ return true;
+ }
+ }
+ return false;
+ }
};
-};
-
-/* eslint-disable no-proto */
-iD.util.getPrototypeOf = Object.getPrototypeOf || function(obj) { return obj.__proto__; };
-/* eslint-enable no-proto */
-
-iD.util.asyncMap = function(inputs, func, callback) {
- var remaining = inputs.length,
- results = [],
- errors = [];
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.orthogonalize." + disable + "." + _amount) : _t("operations.orthogonalize.description." + _type + "." + _amount);
+ };
+ operation.annotation = function() {
+ return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
+ };
+ operation.id = "orthogonalize";
+ operation.keys = [_t("operations.orthogonalize.key")];
+ operation.title = _t("operations.orthogonalize.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- inputs.forEach(function(d, i) {
- func(d, function done(err, data) {
- errors[i] = err;
- results[i] = data;
- remaining--;
- if (!remaining) callback(errors, results);
- });
+ // modules/operations/reflect.js
+ function operationReflectShort(context, selectedIDs) {
+ return operationReflect(context, selectedIDs, "short");
+ }
+ function operationReflectLong(context, selectedIDs) {
+ return operationReflect(context, selectedIDs, "long");
+ }
+ function operationReflect(context, selectedIDs, axis) {
+ axis = axis || "long";
+ var multi = selectedIDs.length === 1 ? "single" : "multiple";
+ var nodes = utilGetAllNodes(selectedIDs, context.graph());
+ var coords = nodes.map(function(n2) {
+ return n2.loc;
});
-};
-
-// wraps an index to an interval [0..length-1]
-iD.util.wrap = function(index, length) {
- if (index < 0)
- index += Math.ceil(-index/length)*length;
- return index % length;
-};
-// A per-domain session mutex backed by a cookie and dead man's
-// switch. If the session crashes, the mutex will auto-release
-// after 5 seconds.
-
-iD.util.SessionMutex = function(name) {
- var mutex = {},
- intervalID;
-
- function renew() {
- var expires = new Date();
- expires.setSeconds(expires.getSeconds() + 5);
- document.cookie = name + '=1; expires=' + expires.toUTCString();
- }
-
- mutex.lock = function() {
- if (intervalID) return true;
- var cookie = document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + name + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1');
- if (cookie) return false;
- renew();
- intervalID = window.setInterval(renew, 4000);
- return true;
+ var extent = utilTotalExtent(selectedIDs, context.graph());
+ var operation = function() {
+ var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
+ context.perform(action, operation.annotation());
+ window.setTimeout(function() {
+ context.validator().validate();
+ }, 300);
};
-
- mutex.unlock = function() {
- if (!intervalID) return;
- document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT';
- clearInterval(intervalID);
- intervalID = null;
+ operation.available = function() {
+ return nodes.length >= 3;
};
-
- mutex.locked = function() {
- return !!intervalID;
+ operation.disabled = function() {
+ if (extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ } else if (selectedIDs.some(incompleteRelation)) {
+ return "incomplete_relation";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
+ });
+ return true;
+ }
+ }
+ return false;
+ }
+ function incompleteRelation(id2) {
+ var entity = context.entity(id2);
+ return entity.type === "relation" && !entity.isComplete(context.graph());
+ }
};
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.reflect." + disable + "." + multi) : _t("operations.reflect.description." + axis + "." + multi);
+ };
+ operation.annotation = function() {
+ return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
+ };
+ operation.id = "reflect-" + axis;
+ operation.keys = [_t("operations.reflect.key." + axis)];
+ operation.title = _t("operations.reflect.title." + axis);
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- return mutex;
-};
-iD.util.SuggestNames = function(preset, suggestions) {
- preset = preset.id.split('/', 2);
- var k = preset[0],
- v = preset[1];
-
- return function(value, callback) {
- var result = [];
- if (value && value.length > 2) {
- if (suggestions[k] && suggestions[k][v]) {
- for (var sugg in suggestions[k][v]) {
- var dist = iD.util.editDistance(value, sugg.substring(0, value.length));
- if (dist < 3) {
- result.push({
- title: sugg,
- value: sugg,
- dist: dist
- });
- }
- }
- }
- result.sort(function(a, b) {
- return a.dist - b.dist;
+ // modules/operations/move.js
+ function operationMove(context, selectedIDs) {
+ var multi = selectedIDs.length === 1 ? "single" : "multiple";
+ var nodes = utilGetAllNodes(selectedIDs, context.graph());
+ var coords = nodes.map(function(n2) {
+ return n2.loc;
+ });
+ var extent = utilTotalExtent(selectedIDs, context.graph());
+ var operation = function() {
+ context.enter(modeMove(context, selectedIDs));
+ };
+ operation.available = function() {
+ return selectedIDs.length > 0;
+ };
+ operation.disabled = function() {
+ if (extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ } else if (selectedIDs.some(incompleteRelation)) {
+ return "incomplete_relation";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
});
+ return true;
+ }
}
- result = result.slice(0,3);
- callback(result);
- };
-};
-iD.geo = {};
-
-iD.geo.roundCoords = function(c) {
- return [Math.floor(c[0]), Math.floor(c[1])];
-};
-
-iD.geo.interp = function(p1, p2, t) {
- return [p1[0] + (p2[0] - p1[0]) * t,
- p1[1] + (p2[1] - p1[1]) * t];
-};
-
-// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.
-// Returns a positive value, if OAB makes a counter-clockwise turn,
-// negative for clockwise turn, and zero if the points are collinear.
-iD.geo.cross = function(o, a, b) {
- return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
-};
-
-// http://jsperf.com/id-dist-optimization
-iD.geo.euclideanDistance = function(a, b) {
- var x = a[0] - b[0], y = a[1] - b[1];
- return Math.sqrt((x * x) + (y * y));
-};
-
-// using WGS84 polar radius (6356752.314245179 m)
-// const = 2 * PI * r / 360
-iD.geo.latToMeters = function(dLat) {
- return dLat * 110946.257617;
-};
-
-// using WGS84 equatorial radius (6378137.0 m)
-// const = 2 * PI * r / 360
-iD.geo.lonToMeters = function(dLon, atLat) {
- return Math.abs(atLat) >= 90 ? 0 :
- dLon * 111319.490793 * Math.abs(Math.cos(atLat * (Math.PI/180)));
-};
-
-// using WGS84 polar radius (6356752.314245179 m)
-// const = 2 * PI * r / 360
-iD.geo.metersToLat = function(m) {
- return m / 110946.257617;
-};
-
-// using WGS84 equatorial radius (6378137.0 m)
-// const = 2 * PI * r / 360
-iD.geo.metersToLon = function(m, atLat) {
- return Math.abs(atLat) >= 90 ? 0 :
- m / 111319.490793 / Math.abs(Math.cos(atLat * (Math.PI/180)));
-};
-
-iD.geo.offsetToMeters = function(offset) {
- var equatRadius = 6356752.314245179,
- polarRadius = 6378137.0,
- tileSize = 256;
-
- return [
- offset[0] * 2 * Math.PI * equatRadius / tileSize,
- -offset[1] * 2 * Math.PI * polarRadius / tileSize
- ];
-};
-
-iD.geo.metersToOffset = function(meters) {
- var equatRadius = 6356752.314245179,
- polarRadius = 6378137.0,
- tileSize = 256;
+ return false;
+ }
+ function incompleteRelation(id2) {
+ var entity = context.entity(id2);
+ return entity.type === "relation" && !entity.isComplete(context.graph());
+ }
+ };
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.move." + disable + "." + multi) : _t("operations.move.description." + multi);
+ };
+ operation.annotation = function() {
+ return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
+ };
+ operation.id = "move";
+ operation.keys = [_t("operations.move.key")];
+ operation.title = _t("operations.move.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ operation.mouseOnly = true;
+ return operation;
+ }
- return [
- meters[0] * tileSize / (2 * Math.PI * equatRadius),
- -meters[1] * tileSize / (2 * Math.PI * polarRadius)
+ // modules/modes/rotate.js
+ function modeRotate(context, entityIDs) {
+ var _tolerancePx = 4;
+ var mode = {
+ id: "rotate",
+ button: "browse"
+ };
+ var keybinding = utilKeybinding("rotate");
+ var behaviors = [
+ behaviorEdit(context),
+ operationCircularize(context, entityIDs).behavior,
+ operationDelete(context, entityIDs).behavior,
+ operationMove(context, entityIDs).behavior,
+ operationOrthogonalize(context, entityIDs).behavior,
+ operationReflectLong(context, entityIDs).behavior,
+ operationReflectShort(context, entityIDs).behavior
];
-};
-
-// Equirectangular approximation of spherical distances on Earth
-iD.geo.sphericalDistance = function(a, b) {
- var x = iD.geo.lonToMeters(a[0] - b[0], (a[1] + b[1]) / 2),
- y = iD.geo.latToMeters(a[1] - b[1]);
- return Math.sqrt((x * x) + (y * y));
-};
-
-iD.geo.edgeEqual = function(a, b) {
- return (a[0] === b[0] && a[1] === b[1]) ||
- (a[0] === b[1] && a[1] === b[0]);
-};
-
-// Return the counterclockwise angle in the range (-pi, pi)
-// between the positive X axis and the line intersecting a and b.
-iD.geo.angle = function(a, b, projection) {
- a = projection(a.loc);
- b = projection(b.loc);
- return Math.atan2(b[1] - a[1], b[0] - a[0]);
-};
-
-// Choose the edge with the minimal distance from `point` to its orthogonal
-// projection onto that edge, if such a projection exists, or the distance to
-// 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.
-iD.geo.chooseEdge = function(nodes, point, projection) {
- var dist = iD.geo.euclideanDistance,
- points = nodes.map(function(n) { return projection(n.loc); }),
- min = Infinity,
- idx, loc;
-
- function dot(p, q) {
- return p[0] * q[0] + p[1] * q[1];
- }
-
- for (var i = 0; i < points.length - 1; i++) {
- var o = points[i],
- s = [points[i + 1][0] - o[0],
- points[i + 1][1] - o[1]],
- v = [point[0] - o[0],
- point[1] - o[1]],
- proj = dot(v, s) / dot(s, s),
- p;
-
- if (proj < 0) {
- p = o;
- } else if (proj > 1) {
- p = points[i + 1];
+ var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
+ var _prevGraph;
+ var _prevAngle;
+ var _prevTransform;
+ var _pivot;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function doRotate(d3_event) {
+ var fn;
+ if (context.graph() !== _prevGraph) {
+ fn = context.perform;
+ } else {
+ fn = context.replace;
+ }
+ var projection2 = context.projection;
+ var currTransform = projection2.transform();
+ if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
+ var nodes = utilGetAllNodes(entityIDs, context.graph());
+ var points = nodes.map(function(n2) {
+ return projection2(n2.loc);
+ });
+ _pivot = getPivot(points);
+ _prevAngle = void 0;
+ }
+ var currMouse = context.map().mouse(d3_event);
+ var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
+ if (typeof _prevAngle === "undefined")
+ _prevAngle = currAngle;
+ var delta = currAngle - _prevAngle;
+ fn(actionRotate(entityIDs, _pivot, delta, projection2));
+ _prevTransform = currTransform;
+ _prevAngle = currAngle;
+ _prevGraph = context.graph();
+ }
+ function getPivot(points) {
+ var _pivot2;
+ if (points.length === 1) {
+ _pivot2 = points[0];
+ } else if (points.length === 2) {
+ _pivot2 = geoVecInterp(points[0], points[1], 0.5);
+ } else {
+ var polygonHull = hull_default(points);
+ if (polygonHull.length === 2) {
+ _pivot2 = geoVecInterp(points[0], points[1], 0.5);
} else {
- p = [o[0] + proj * s[0], o[1] + proj * s[1]];
- }
-
- var d = dist(p, point);
- if (d < min) {
- min = d;
- idx = i + 1;
- loc = projection.invert(p);
+ _pivot2 = centroid_default2(hull_default(points));
}
+ }
+ return _pivot2;
}
-
- return {
- index: idx,
- distance: min,
- loc: loc
- };
-};
-
-// Return the intersection point of 2 line segments.
-// From https://github.com/pgkelley4/line-segments-intersect
-// This uses the vector cross product approach described below:
-// http://stackoverflow.com/a/565282/786339
-iD.geo.lineIntersection = function(a, b) {
- function subtractPoints(point1, point2) {
- return [point1[0] - point2[0], point1[1] - point2[1]];
- }
- function crossProduct(point1, point2) {
- return point1[0] * point2[1] - point1[1] * point2[0];
- }
-
- var p = [a[0][0], a[0][1]],
- p2 = [a[1][0], a[1][1]],
- q = [b[0][0], b[0][1]],
- q2 = [b[1][0], b[1][1]],
- r = subtractPoints(p2, p),
- s = subtractPoints(q2, q),
- uNumerator = crossProduct(subtractPoints(q, p), r),
- denominator = crossProduct(r, s);
-
- if (uNumerator && denominator) {
- var u = uNumerator / denominator,
- t = crossProduct(subtractPoints(q, p), s) / denominator;
-
- if ((t >= 0) && (t <= 1) && (u >= 0) && (u <= 1)) {
- return iD.geo.interp(p, p2, t);
- }
+ function finish(d3_event) {
+ d3_event.stopPropagation();
+ context.replace(actionNoop(), annotation);
+ context.enter(modeSelect(context, entityIDs));
}
-
- return null;
-};
-
-iD.geo.pathIntersections = function(path1, path2) {
- var intersections = [];
- for (var i = 0; i < path1.length - 1; i++) {
- for (var j = 0; j < path2.length - 1; j++) {
- var a = [ path1[i], path1[i+1] ],
- b = [ path2[j], path2[j+1] ],
- hit = iD.geo.lineIntersection(a, b);
- if (hit) intersections.push(hit);
- }
+ function cancel() {
+ if (_prevGraph)
+ context.pop();
+ context.enter(modeSelect(context, entityIDs));
}
- return intersections;
-};
-
-// Return whether point is contained in polygon.
-//
-// `point` should be a 2-item array of coordinates.
-// `polygon` should be an array of 2-item arrays of coordinates.
-//
-// From https://github.com/substack/point-in-polygon.
-// ray-casting algorithm based on
-// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
-//
-iD.geo.pointInPolygon = function(point, polygon) {
- var x = point[0],
- y = point[1],
- inside = false;
-
- for (var i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
- var xi = polygon[i][0], yi = polygon[i][1];
- var xj = polygon[j][0], yj = polygon[j][1];
-
- var intersect = ((yi > y) !== (yj > y)) &&
- (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
- if (intersect) inside = !inside;
+ function undone() {
+ context.enter(modeBrowse(context));
}
+ mode.enter = function() {
+ _prevGraph = null;
+ context.features().forceVisible(entityIDs);
+ behaviors.forEach(context.install);
+ var downEvent;
+ context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
+ downEvent = d3_event;
+ });
+ select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
+ if (!downEvent)
+ return;
+ var mapNode = context.container().select(".main-map").node();
+ var pointGetter = utilFastMouse(mapNode);
+ var p1 = pointGetter(downEvent);
+ var p2 = pointGetter(d3_event);
+ var dist = geoVecLength(p1, p2);
+ if (dist <= _tolerancePx)
+ finish(d3_event);
+ downEvent = null;
+ }, true);
+ context.history().on("undone.modeRotate", undone);
+ keybinding.on("\u238B", cancel).on("\u21A9", finish);
+ select_default2(document).call(keybinding);
+ };
+ mode.exit = function() {
+ behaviors.forEach(context.uninstall);
+ context.surface().on(_pointerPrefix + "down.modeRotate", null);
+ select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
+ context.history().on("undone.modeRotate", null);
+ select_default2(document).call(keybinding.unbind);
+ context.features().forceVisible([]);
+ };
+ mode.selectedIDs = function() {
+ if (!arguments.length)
+ return entityIDs;
+ return mode;
+ };
+ return mode;
+ }
- return inside;
-};
-
-iD.geo.polygonContainsPolygon = function(outer, inner) {
- return _.every(inner, function(point) {
- return iD.geo.pointInPolygon(point, outer);
+ // modules/operations/rotate.js
+ function operationRotate(context, selectedIDs) {
+ var multi = selectedIDs.length === 1 ? "single" : "multiple";
+ var nodes = utilGetAllNodes(selectedIDs, context.graph());
+ var coords = nodes.map(function(n2) {
+ return n2.loc;
});
-};
-
-iD.geo.polygonIntersectsPolygon = function(outer, inner, checkSegments) {
- function testSegments(outer, inner) {
- for (var i = 0; i < outer.length - 1; i++) {
- for (var j = 0; j < inner.length - 1; j++) {
- var a = [ outer[i], outer[i+1] ],
- b = [ inner[j], inner[j+1] ];
- if (iD.geo.lineIntersection(a, b)) return true;
- }
+ var extent = utilTotalExtent(selectedIDs, context.graph());
+ var operation = function() {
+ context.enter(modeRotate(context, selectedIDs));
+ };
+ operation.available = function() {
+ return nodes.length >= 2;
+ };
+ operation.disabled = function() {
+ if (extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ } else if (selectedIDs.some(incompleteRelation)) {
+ return "incomplete_relation";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
+ });
+ return true;
+ }
}
return false;
- }
+ }
+ function incompleteRelation(id2) {
+ var entity = context.entity(id2);
+ return entity.type === "relation" && !entity.isComplete(context.graph());
+ }
+ };
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.rotate." + disable + "." + multi) : _t("operations.rotate.description." + multi);
+ };
+ operation.annotation = function() {
+ return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
+ };
+ operation.id = "rotate";
+ operation.keys = [_t("operations.rotate.key")];
+ operation.title = _t("operations.rotate.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ operation.mouseOnly = true;
+ return operation;
+ }
- function testPoints(outer, inner) {
- return _.some(inner, function(point) {
- return iD.geo.pointInPolygon(point, outer);
- });
+ // modules/modes/move.js
+ function modeMove(context, entityIDs, baseGraph) {
+ var _tolerancePx = 4;
+ var mode = {
+ id: "move",
+ button: "browse"
+ };
+ var keybinding = utilKeybinding("move");
+ var behaviors = [
+ behaviorEdit(context),
+ operationCircularize(context, entityIDs).behavior,
+ operationDelete(context, entityIDs).behavior,
+ operationOrthogonalize(context, entityIDs).behavior,
+ operationReflectLong(context, entityIDs).behavior,
+ operationReflectShort(context, entityIDs).behavior,
+ operationRotate(context, entityIDs).behavior
+ ];
+ var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
+ var _prevGraph;
+ var _cache4;
+ var _origin;
+ var _nudgeInterval;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function doMove(nudge) {
+ nudge = nudge || [0, 0];
+ var fn;
+ if (_prevGraph !== context.graph()) {
+ _cache4 = {};
+ _origin = context.map().mouseCoordinates();
+ fn = context.perform;
+ } else {
+ fn = context.overwrite;
+ }
+ var currMouse = context.map().mouse();
+ var origMouse = context.projection(_origin);
+ var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
+ fn(actionMove(entityIDs, delta, context.projection, _cache4));
+ _prevGraph = context.graph();
}
-
- return testPoints(outer, inner) || (!!checkSegments && testSegments(outer, inner));
-};
-
-iD.geo.pathLength = function(path) {
- var length = 0,
- dx, dy;
- for (var i = 0; i < path.length - 1; i++) {
- dx = path[i][0] - path[i + 1][0];
- dy = path[i][1] - path[i + 1][1];
- length += Math.sqrt(dx * dx + dy * dy);
+ function startNudge(nudge) {
+ if (_nudgeInterval)
+ window.clearInterval(_nudgeInterval);
+ _nudgeInterval = window.setInterval(function() {
+ context.map().pan(nudge);
+ doMove(nudge);
+ }, 50);
}
- return length;
-};
-iD.geo.Extent = function geoExtent(min, max) {
- if (!(this instanceof iD.geo.Extent)) return new iD.geo.Extent(min, max);
- if (min instanceof iD.geo.Extent) {
- return min;
- } else if (min && min.length === 2 && min[0].length === 2 && min[1].length === 2) {
- this[0] = min[0];
- this[1] = min[1];
- } else {
- this[0] = min || [ Infinity, Infinity];
- this[1] = max || min || [-Infinity, -Infinity];
+ function stopNudge() {
+ if (_nudgeInterval) {
+ window.clearInterval(_nudgeInterval);
+ _nudgeInterval = null;
+ }
}
-};
-
-iD.geo.Extent.prototype = new Array(2);
-
-_.extend(iD.geo.Extent.prototype, {
- equals: function (obj) {
- return this[0][0] === obj[0][0] &&
- this[0][1] === obj[0][1] &&
- this[1][0] === obj[1][0] &&
- this[1][1] === obj[1][1];
- },
-
- extend: function(obj) {
- if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
- return iD.geo.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])]);
- },
-
- _extend: function(extent) {
- this[0][0] = Math.min(extent[0][0], this[0][0]);
- this[0][1] = Math.min(extent[0][1], this[0][1]);
- this[1][0] = Math.max(extent[1][0], this[1][0]);
- this[1][1] = Math.max(extent[1][1], this[1][1]);
- },
-
- area: function() {
- return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
- },
-
- center: function() {
- return [(this[0][0] + this[1][0]) / 2,
- (this[0][1] + this[1][1]) / 2];
- },
-
- rectangle: function() {
- return [this[0][0], this[0][1], this[1][0], this[1][1]];
- },
-
- polygon: function() {
- return [
- [this[0][0], this[0][1]],
- [this[0][0], this[1][1]],
- [this[1][0], this[1][1]],
- [this[1][0], this[0][1]],
- [this[0][0], this[0][1]]
- ];
- },
-
- contains: function(obj) {
- if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
- return obj[0][0] >= this[0][0] &&
- obj[0][1] >= this[0][1] &&
- obj[1][0] <= this[1][0] &&
- obj[1][1] <= this[1][1];
- },
-
- intersects: function(obj) {
- if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
- return obj[0][0] <= this[1][0] &&
- obj[0][1] <= this[1][1] &&
- obj[1][0] >= this[0][0] &&
- obj[1][1] >= this[0][1];
- },
-
- intersection: function(obj) {
- if (!this.intersects(obj)) return new iD.geo.Extent();
- return new iD.geo.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])]);
- },
-
- percentContainedIn: function(obj) {
- if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
- var a1 = this.intersection(obj).area(),
- a2 = this.area();
-
- if (a1 === Infinity || a2 === Infinity || a1 === 0 || a2 === 0) {
- return 0;
- } else {
- return a1 / a2;
- }
- },
-
- padByMeters: function(meters) {
- var dLat = iD.geo.metersToLat(meters),
- dLon = iD.geo.metersToLon(meters, this.center()[1]);
- return iD.geo.Extent(
- [this[0][0] - dLon, this[0][1] - dLat],
- [this[1][0] + dLon, this[1][1] + dLat]);
- },
-
- toParam: function() {
- return this.rectangle().join(',');
+ function move() {
+ doMove();
+ var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
+ if (nudge) {
+ startNudge(nudge);
+ } else {
+ stopNudge();
+ }
}
-
-});
-iD.geo.Turn = function(turn) {
- if (!(this instanceof iD.geo.Turn))
- return new iD.geo.Turn(turn);
- _.extend(this, turn);
-};
-
-iD.geo.Intersection = function(graph, vertexId) {
- var vertex = graph.entity(vertexId),
- parentWays = graph.parentWays(vertex),
- coincident = [],
- highways = {};
-
- function addHighway(way, adjacentNodeId) {
- if (highways[adjacentNodeId]) {
- coincident.push(adjacentNodeId);
- } else {
- highways[adjacentNodeId] = way;
- }
+ function finish(d3_event) {
+ d3_event.stopPropagation();
+ context.replace(actionNoop(), annotation);
+ context.enter(modeSelect(context, entityIDs));
+ stopNudge();
}
-
- // Pre-split ways that would need to be split in
- // order to add a restriction. The real split will
- // happen when the restriction is added.
- parentWays.forEach(function(way) {
- if (!way.tags.highway || way.isArea() || way.isDegenerate())
- return;
-
- var isFirst = (vertexId === way.first()),
- isLast = (vertexId === way.last()),
- isAffix = (isFirst || isLast),
- isClosingNode = (isFirst && isLast);
-
- if (isAffix && !isClosingNode) {
- var index = (isFirst ? 1 : way.nodes.length - 2);
- addHighway(way, way.nodes[index]);
-
- } else {
- var splitIndex, wayA, wayB, indexA, indexB;
- if (isClosingNode) {
- splitIndex = Math.ceil(way.nodes.length / 2); // split at midpoint
- wayA = iD.Way({id: way.id + '-a', tags: way.tags, nodes: way.nodes.slice(0, splitIndex)});
- wayB = iD.Way({id: way.id + '-b', tags: way.tags, nodes: way.nodes.slice(splitIndex)});
- indexA = 1;
- indexB = way.nodes.length - 2;
- } else {
- splitIndex = _.indexOf(way.nodes, vertex.id, 1); // split at vertexid
- wayA = iD.Way({id: way.id + '-a', tags: way.tags, nodes: way.nodes.slice(0, splitIndex + 1)});
- wayB = iD.Way({id: way.id + '-b', tags: way.tags, nodes: way.nodes.slice(splitIndex)});
- indexA = splitIndex - 1;
- indexB = splitIndex + 1;
- }
- graph = graph.replace(wayA).replace(wayB);
- addHighway(wayA, way.nodes[indexA]);
- addHighway(wayB, way.nodes[indexB]);
- }
- });
-
- // remove any ways from this intersection that are coincident
- // (i.e. any adjacent node used by more than one intersecting way)
- coincident.forEach(function (n) {
- delete highways[n];
- });
-
-
- var intersection = {
- highways: highways,
- ways: _.values(highways),
- graph: graph
- };
-
- intersection.adjacentNodeId = function(fromWayId) {
- return _.find(_.keys(highways), function(k) {
- return highways[k].id === fromWayId;
- });
+ function cancel() {
+ if (baseGraph) {
+ while (context.graph() !== baseGraph)
+ context.pop();
+ context.enter(modeBrowse(context));
+ } else {
+ if (_prevGraph)
+ context.pop();
+ context.enter(modeSelect(context, entityIDs));
+ }
+ stopNudge();
+ }
+ function undone() {
+ context.enter(modeBrowse(context));
+ }
+ mode.enter = function() {
+ _origin = context.map().mouseCoordinates();
+ _prevGraph = null;
+ _cache4 = {};
+ context.features().forceVisible(entityIDs);
+ behaviors.forEach(context.install);
+ var downEvent;
+ context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
+ downEvent = d3_event;
+ });
+ select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
+ if (!downEvent)
+ return;
+ var mapNode = context.container().select(".main-map").node();
+ var pointGetter = utilFastMouse(mapNode);
+ var p1 = pointGetter(downEvent);
+ var p2 = pointGetter(d3_event);
+ var dist = geoVecLength(p1, p2);
+ if (dist <= _tolerancePx)
+ finish(d3_event);
+ downEvent = null;
+ }, true);
+ context.history().on("undone.modeMove", undone);
+ keybinding.on("\u238B", cancel).on("\u21A9", finish);
+ select_default2(document).call(keybinding);
};
+ mode.exit = function() {
+ stopNudge();
+ behaviors.forEach(function(behavior) {
+ context.uninstall(behavior);
+ });
+ context.surface().on(_pointerPrefix + "down.modeMove", null);
+ select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
+ context.history().on("undone.modeMove", null);
+ select_default2(document).call(keybinding.unbind);
+ context.features().forceVisible([]);
+ };
+ mode.selectedIDs = function() {
+ if (!arguments.length)
+ return entityIDs;
+ return mode;
+ };
+ return mode;
+ }
- intersection.turns = function(fromNodeId) {
- var start = highways[fromNodeId];
- if (!start)
- return [];
-
- if (start.first() === vertex.id && start.tags.oneway === 'yes')
- return [];
- if (start.last() === vertex.id && start.tags.oneway === '-1')
- return [];
-
- function withRestriction(turn) {
- graph.parentRelations(graph.entity(turn.from.way)).forEach(function(relation) {
- if (relation.tags.type !== 'restriction')
- return;
-
- var f = relation.memberByRole('from'),
- t = relation.memberByRole('to'),
- v = relation.memberByRole('via');
-
- if (f && f.id === turn.from.way &&
- v && v.id === turn.via.node &&
- t && t.id === turn.to.way) {
- turn.restriction = relation.id;
- } else if (/^only_/.test(relation.tags.restriction) &&
- f && f.id === turn.from.way &&
- v && v.id === turn.via.node &&
- t && t.id !== turn.to.way) {
- turn.restriction = relation.id;
- turn.indirect_restriction = true;
- }
- });
-
- return iD.geo.Turn(turn);
- }
-
- var from = {
- node: fromNodeId,
- way: start.id.split(/-(a|b)/)[0]
- },
- via = { node: vertex.id },
- turns = [];
-
- _.each(highways, function(end, adjacentNodeId) {
- if (end === start)
- return;
-
- // backward
- if (end.first() !== vertex.id && end.tags.oneway !== 'yes') {
- turns.push(withRestriction({
- from: from,
- via: via,
- to: {
- node: adjacentNodeId,
- way: end.id.split(/-(a|b)/)[0]
- }
- }));
- }
-
- // forward
- if (end.last() !== vertex.id && end.tags.oneway !== '-1') {
- turns.push(withRestriction({
- from: from,
- via: via,
- to: {
- node: adjacentNodeId,
- way: end.id.split(/-(a|b)/)[0]
- }
- }));
- }
-
+ // modules/behavior/paste.js
+ function behaviorPaste(context) {
+ function doPaste(d3_event) {
+ if (!context.map().withinEditableZoom())
+ return;
+ d3_event.preventDefault();
+ var baseGraph = context.graph();
+ var mouse = context.map().mouse();
+ var projection2 = context.projection;
+ var viewport = geoExtent(projection2.clipExtent()).polygon();
+ if (!geoPointInPolygon(mouse, viewport))
+ return;
+ var oldIDs = context.copyIDs();
+ if (!oldIDs.length)
+ return;
+ var extent = geoExtent();
+ var oldGraph = context.copyGraph();
+ var newIDs = [];
+ var action = actionCopyEntities(oldIDs, oldGraph);
+ context.perform(action);
+ var copies = action.copies();
+ var originals = /* @__PURE__ */ new Set();
+ Object.values(copies).forEach(function(entity) {
+ originals.add(entity.id);
+ });
+ for (var id2 in copies) {
+ var oldEntity = oldGraph.entity(id2);
+ var newEntity = copies[id2];
+ extent._extend(oldEntity.extent(oldGraph));
+ var parents = context.graph().parentWays(newEntity);
+ var parentCopied = parents.some(function(parent) {
+ return originals.has(parent.id);
});
-
- // U-turn
- if (start.tags.oneway !== 'yes' && start.tags.oneway !== '-1') {
- turns.push(withRestriction({
- from: from,
- via: via,
- to: from,
- u: true
- }));
+ if (!parentCopied) {
+ newIDs.push(newEntity.id);
}
-
- return turns;
+ }
+ var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
+ var delta = geoVecSubtract(mouse, copyPoint);
+ context.perform(actionMove(newIDs, delta, projection2));
+ context.enter(modeMove(context, newIDs, baseGraph));
+ }
+ function behavior() {
+ context.keybinding().on(uiCmd("\u2318V"), doPaste);
+ return behavior;
+ }
+ behavior.off = function() {
+ context.keybinding().off(uiCmd("\u2318V"));
};
+ return behavior;
+ }
- return intersection;
-};
-
-
-iD.geo.inferRestriction = function(graph, from, via, to, projection) {
- var fromWay = graph.entity(from.way),
- fromNode = graph.entity(from.node),
- toWay = graph.entity(to.way),
- toNode = graph.entity(to.node),
- viaNode = graph.entity(via.node),
- fromOneWay = (fromWay.tags.oneway === 'yes' && fromWay.last() === via.node) ||
- (fromWay.tags.oneway === '-1' && fromWay.first() === via.node),
- toOneWay = (toWay.tags.oneway === 'yes' && toWay.first() === via.node) ||
- (toWay.tags.oneway === '-1' && toWay.last() === via.node),
- angle = iD.geo.angle(viaNode, fromNode, projection) -
- iD.geo.angle(viaNode, toNode, projection);
-
- angle = angle * 180 / Math.PI;
-
- while (angle < 0)
- angle += 360;
-
- if (fromNode === toNode)
- return 'no_u_turn';
- if ((angle < 23 || angle > 336) && fromOneWay && toOneWay)
- return 'no_u_turn';
- if (angle < 158)
- return 'no_right_turn';
- if (angle > 202)
- return 'no_left_turn';
-
- return 'no_straight_on';
-};
-// For fixing up rendering of multipolygons with tags on the outer member.
-// https://github.com/openstreetmap/iD/issues/613
-iD.geo.isSimpleMultipolygonOuterMember = function(entity, graph) {
- if (entity.type !== 'way')
- return false;
-
- var parents = graph.parentRelations(entity);
- if (parents.length !== 1)
- return false;
-
- var parent = parents[0];
- if (!parent.isMultipolygon() || Object.keys(parent.tags).length > 1)
- return false;
-
- var members = parent.members, member;
- for (var i = 0; i < members.length; i++) {
- member = members[i];
- if (member.id === entity.id && member.role && member.role !== 'outer')
- return false; // Not outer member
- if (member.id !== entity.id && (!member.role || member.role === 'outer'))
- return false; // Not a simple multipolygon
+ // modules/behavior/drag.js
+ function behaviorDrag() {
+ var dispatch10 = dispatch_default("start", "move", "end");
+ var _tolerancePx = 1;
+ var _penTolerancePx = 4;
+ var _origin = null;
+ var _selector = "";
+ var _targetNode;
+ var _targetEntity;
+ var _surface;
+ var _pointerId;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
+ var d3_event_userSelectSuppress = function() {
+ var selection2 = selection_default();
+ var select = selection2.style(d3_event_userSelectProperty);
+ selection2.style(d3_event_userSelectProperty, "none");
+ return function() {
+ selection2.style(d3_event_userSelectProperty, select);
+ };
+ };
+ function pointerdown(d3_event) {
+ if (_pointerId)
+ return;
+ _pointerId = d3_event.pointerId || "mouse";
+ _targetNode = this;
+ var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
+ var offset;
+ var startOrigin = pointerLocGetter(d3_event);
+ var started = false;
+ var selectEnable = d3_event_userSelectSuppress();
+ select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
+ if (_origin) {
+ offset = _origin.call(_targetNode, _targetEntity);
+ offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
+ } else {
+ offset = [0, 0];
+ }
+ d3_event.stopPropagation();
+ function pointermove(d3_event2) {
+ if (_pointerId !== (d3_event2.pointerId || "mouse"))
+ return;
+ var p = pointerLocGetter(d3_event2);
+ if (!started) {
+ var dist = geoVecLength(startOrigin, p);
+ var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
+ if (dist < tolerance)
+ return;
+ started = true;
+ dispatch10.call("start", this, d3_event2, _targetEntity);
+ } else {
+ startOrigin = p;
+ d3_event2.stopPropagation();
+ d3_event2.preventDefault();
+ var dx = p[0] - startOrigin[0];
+ var dy = p[1] - startOrigin[1];
+ dispatch10.call("move", this, d3_event2, _targetEntity, [p[0] + offset[0], p[1] + offset[1]], [dx, dy]);
+ }
+ }
+ function pointerup(d3_event2) {
+ if (_pointerId !== (d3_event2.pointerId || "mouse"))
+ return;
+ _pointerId = null;
+ if (started) {
+ dispatch10.call("end", this, d3_event2, _targetEntity);
+ d3_event2.preventDefault();
+ }
+ select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
+ selectEnable();
+ }
}
+ function behavior(selection2) {
+ var matchesSelector = utilPrefixDOMProperty("matchesSelector");
+ var delegate = pointerdown;
+ if (_selector) {
+ delegate = function(d3_event) {
+ var root3 = this;
+ var target = d3_event.target;
+ for (; target && target !== root3; target = target.parentNode) {
+ var datum2 = target.__data__;
+ _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
+ if (_targetEntity && target[matchesSelector](_selector)) {
+ return pointerdown.call(target, d3_event);
+ }
+ }
+ };
+ }
+ selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
+ }
+ behavior.off = function(selection2) {
+ selection2.on(_pointerPrefix + "down.drag" + _selector, null);
+ };
+ behavior.selector = function(_) {
+ if (!arguments.length)
+ return _selector;
+ _selector = _;
+ return behavior;
+ };
+ behavior.origin = function(_) {
+ if (!arguments.length)
+ return _origin;
+ _origin = _;
+ return behavior;
+ };
+ behavior.cancel = function() {
+ select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
+ return behavior;
+ };
+ behavior.targetNode = function(_) {
+ if (!arguments.length)
+ return _targetNode;
+ _targetNode = _;
+ return behavior;
+ };
+ behavior.targetEntity = function(_) {
+ if (!arguments.length)
+ return _targetEntity;
+ _targetEntity = _;
+ return behavior;
+ };
+ behavior.surface = function(_) {
+ if (!arguments.length)
+ return _surface;
+ _surface = _;
+ return behavior;
+ };
+ return utilRebind(behavior, dispatch10, "on");
+ }
- return parent;
-};
-
-iD.geo.simpleMultipolygonOuterMember = function(entity, graph) {
- if (entity.type !== 'way')
- return false;
-
- var parents = graph.parentRelations(entity);
- if (parents.length !== 1)
- return false;
-
- var parent = parents[0];
- if (!parent.isMultipolygon() || Object.keys(parent.tags).length > 1)
+ // modules/modes/drag_node.js
+ function modeDragNode(context) {
+ var mode = {
+ id: "drag-node",
+ button: "browse"
+ };
+ var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
+ var edit2 = behaviorEdit(context);
+ var _nudgeInterval;
+ var _restoreSelectedIDs = [];
+ var _wasMidpoint = false;
+ var _isCancelled = false;
+ var _activeEntity;
+ var _startLoc;
+ var _lastLoc;
+ function startNudge(d3_event, entity, nudge) {
+ if (_nudgeInterval)
+ window.clearInterval(_nudgeInterval);
+ _nudgeInterval = window.setInterval(function() {
+ context.map().pan(nudge);
+ doMove(d3_event, entity, nudge);
+ }, 50);
+ }
+ function stopNudge() {
+ if (_nudgeInterval) {
+ window.clearInterval(_nudgeInterval);
+ _nudgeInterval = null;
+ }
+ }
+ function moveAnnotation(entity) {
+ return _t("operations.move.annotation." + entity.geometry(context.graph()));
+ }
+ function connectAnnotation(nodeEntity, targetEntity) {
+ var nodeGeometry = nodeEntity.geometry(context.graph());
+ var targetGeometry = targetEntity.geometry(context.graph());
+ if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
+ var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
+ var targetParentWayIDs = context.graph().parentWays(targetEntity);
+ var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
+ if (sharedParentWays.length !== 0) {
+ if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
+ return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
+ }
+ return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
+ }
+ }
+ return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
+ }
+ function shouldSnapToNode(target) {
+ if (!_activeEntity)
return false;
-
- var members = parent.members, member, outerMember;
- for (var i = 0; i < members.length; i++) {
- member = members[i];
- if (!member.role || member.role === 'outer') {
- if (outerMember)
- return false; // Not a simple multipolygon
- outerMember = member;
- }
- }
-
- return outerMember && graph.hasEntity(outerMember.id);
-};
-
-// Join `array` into sequences of connecting ways.
-//
-// Segments which share identical start/end nodes will, as much as possible,
-// be connected with each other.
-//
-// The return value is a nested array. Each constituent array contains elements
-// of `array` which have been determined to connect. Each consitituent array
-// also has a `nodes` property whose value is an ordered array of member nodes,
-// with appropriate order reversal and start/end coordinate de-duplication.
-//
-// Members of `array` must have, at minimum, `type` and `id` properties.
-// Thus either an array of `iD.Way`s or a relation member array may be
-// used.
-//
-// If an member has a `tags` property, its tags will be reversed via
-// `iD.actions.Reverse` in the output.
-//
-// Incomplete members (those for which `graph.hasEntity(element.id)` returns
-// false) and non-way members are ignored.
-//
-iD.geo.joinWays = function(array, graph) {
- var joined = [], member, current, nodes, first, last, i, how, what;
-
- array = array.filter(function(member) {
- return member.type === 'way' && graph.hasEntity(member.id);
- });
-
- function resolve(member) {
- return graph.childNodes(graph.entity(member.id));
+ return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
}
-
- function reverse(member) {
- return member.tags ? iD.actions.Reverse(member.id, {reverseOneway: true})(graph).entity(member.id) : member;
+ function origin(entity) {
+ return context.projection(entity.loc);
}
-
- while (array.length) {
- member = array.shift();
- current = [member];
- current.nodes = nodes = resolve(member).slice();
- joined.push(current);
-
- while (array.length && _.first(nodes) !== _.last(nodes)) {
- first = _.first(nodes);
- last = _.last(nodes);
-
- for (i = 0; i < array.length; i++) {
- member = array[i];
- what = resolve(member);
-
- if (last === _.first(what)) {
- how = nodes.push;
- what = what.slice(1);
- break;
- } else if (last === _.last(what)) {
- how = nodes.push;
- what = what.slice(0, -1).reverse();
- member = reverse(member);
- break;
- } else if (first === _.last(what)) {
- how = nodes.unshift;
- what = what.slice(0, -1);
- break;
- } else if (first === _.first(what)) {
- how = nodes.unshift;
- what = what.slice(1).reverse();
- member = reverse(member);
- break;
- } else {
- what = how = null;
- }
- }
-
- if (!what)
- break; // No more joinable ways.
-
- how.apply(current, [member]);
- how.apply(nodes, what);
-
- array.splice(i, 1);
+ function keydown(d3_event) {
+ if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
+ if (context.surface().classed("nope")) {
+ context.surface().classed("nope-suppressed", true);
}
+ context.surface().classed("nope", false).classed("nope-disabled", true);
+ }
}
-
- return joined;
-};
-/*
- Bypasses features of D3's default projection stream pipeline that are unnecessary:
- * Antimeridian clipping
- * Spherical rotation
- * Resampling
-*/
-iD.geo.RawMercator = function () {
- var project = d3.geo.mercator.raw,
- k = 512 / Math.PI, // scale
- x = 0, y = 0, // translate
- clipExtent = [[0, 0], [0, 0]];
-
- function projection(point) {
- point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
- return [point[0] * k + x, y - point[1] * k];
+ function keyup(d3_event) {
+ if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
+ if (context.surface().classed("nope-suppressed")) {
+ context.surface().classed("nope", true);
+ }
+ context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
+ }
}
-
- projection.invert = function(point) {
- point = project.invert((point[0] - x) / k, (y - point[1]) / k);
- return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
- };
-
- projection.scale = function(_) {
- if (!arguments.length) return k;
- k = +_;
- return projection;
- };
-
- projection.translate = function(_) {
- if (!arguments.length) return [x, y];
- x = +_[0];
- y = +_[1];
- return projection;
- };
-
- projection.clipExtent = function(_) {
- if (!arguments.length) return clipExtent;
- clipExtent = _;
- return projection;
- };
-
- projection.stream = d3.geo.transform({
- point: function(x, y) {
- x = projection([x, y]);
- this.stream.point(x[0], x[1]);
+ function start2(d3_event, entity) {
+ _wasMidpoint = entity.type === "midpoint";
+ var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
+ _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
+ if (_isCancelled) {
+ if (hasHidden) {
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t("modes.drag_node.connected_to_hidden"))();
}
- }).stream;
-
- return projection;
-};
-iD.actions = {};
-iD.actions.AddEntity = function(way) {
- return function(graph) {
- return graph.replace(way);
- };
-};
-iD.actions.AddMember = function(relationId, member, memberIndex) {
- return function(graph) {
- var relation = graph.entity(relationId);
-
- if (isNaN(memberIndex) && member.type === 'way') {
- var members = relation.indexedMembers();
- members.push(member);
-
- var joined = iD.geo.joinWays(members, graph);
- for (var i = 0; i < joined.length; i++) {
- var segment = joined[i];
- for (var j = 0; j < segment.length && segment.length >= 2; j++) {
- if (segment[j] !== member)
- continue;
-
- if (j === 0) {
- memberIndex = segment[j + 1].index;
- } else if (j === segment.length - 1) {
- memberIndex = segment[j - 1].index + 1;
- } else {
- memberIndex = Math.min(segment[j - 1].index + 1, segment[j + 1].index + 1);
- }
- }
- }
+ return drag.cancel();
+ }
+ if (_wasMidpoint) {
+ var midpoint = entity;
+ entity = osmNode();
+ context.perform(actionAddMidpoint(midpoint, entity));
+ entity = context.entity(entity.id);
+ var vertex = context.surface().selectAll("." + entity.id);
+ drag.targetNode(vertex.node()).targetEntity(entity);
+ } else {
+ context.perform(actionNoop());
+ }
+ _activeEntity = entity;
+ _startLoc = entity.loc;
+ hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
+ context.surface().selectAll("." + _activeEntity.id).classed("active", true);
+ context.enter(mode);
+ }
+ function datum2(d3_event) {
+ if (!d3_event || d3_event.altKey) {
+ return {};
+ } else {
+ var d = d3_event.target.__data__;
+ return d && d.properties && d.properties.target ? d : {};
+ }
+ }
+ function doMove(d3_event, entity, nudge) {
+ nudge = nudge || [0, 0];
+ var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
+ var currMouse = geoVecSubtract(currPoint, nudge);
+ var loc = context.projection.invert(currMouse);
+ var target, edge;
+ if (!_nudgeInterval) {
+ var d = datum2(d3_event);
+ target = d && d.properties && d.properties.entity;
+ var targetLoc = target && target.loc;
+ var targetNodes = d && d.properties && d.properties.nodes;
+ if (targetLoc) {
+ if (shouldSnapToNode(target)) {
+ loc = targetLoc;
+ }
+ } else if (targetNodes) {
+ edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
+ if (edge) {
+ loc = edge.loc;
+ }
}
-
- return graph.replace(relation.addMember(member, memberIndex));
- };
-};
-iD.actions.AddMidpoint = function(midpoint, node) {
- return function(graph) {
- graph = graph.replace(node.move(midpoint.loc));
-
- var parents = _.intersection(
- graph.parentWays(graph.entity(midpoint.edge[0])),
- graph.parentWays(graph.entity(midpoint.edge[1])));
-
- parents.forEach(function(way) {
- for (var i = 0; i < way.nodes.length - 1; i++) {
- if (iD.geo.edgeEqual([way.nodes[i], way.nodes[i + 1]], midpoint.edge)) {
- graph = graph.replace(graph.entity(way.id).addNode(node.id, i + 1));
-
- // Add only one midpoint on doubled-back segments,
- // turning them into self-intersections.
- return;
- }
+ }
+ context.replace(actionMoveNode(entity.id, loc));
+ var isInvalid = false;
+ if (target) {
+ isInvalid = hasRelationConflict(entity, target, edge, context.graph());
+ }
+ if (!isInvalid) {
+ isInvalid = hasInvalidGeometry(entity, context.graph());
+ }
+ var nope = context.surface().classed("nope");
+ if (isInvalid === "relation" || isInvalid === "restriction") {
+ if (!nope) {
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.connect." + isInvalid, { relation: _mainPresetIndex.item("type/restriction").name() }))();
+ }
+ } else if (isInvalid) {
+ var errorID = isInvalid === "line" ? "lines" : "areas";
+ context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.html("self_intersection.error." + errorID))();
+ } else {
+ if (nope) {
+ context.ui().flash.duration(1).label("")();
+ }
+ }
+ var nopeDisabled = context.surface().classed("nope-disabled");
+ if (nopeDisabled) {
+ context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
+ } else {
+ context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
+ }
+ _lastLoc = loc;
+ }
+ function hasRelationConflict(entity, target, edge, graph) {
+ var testGraph = graph.update();
+ if (edge) {
+ var midpoint = osmNode();
+ var action = actionAddMidpoint({
+ loc: edge.loc,
+ edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
+ }, midpoint);
+ testGraph = action(testGraph);
+ target = midpoint;
+ }
+ var ids = [entity.id, target.id];
+ return actionConnect(ids).disabled(testGraph);
+ }
+ function hasInvalidGeometry(entity, graph) {
+ var parents = graph.parentWays(entity);
+ var i2, j2, k;
+ for (i2 = 0; i2 < parents.length; i2++) {
+ var parent = parents[i2];
+ var nodes = [];
+ var activeIndex = null;
+ var relations = graph.parentRelations(parent);
+ for (j2 = 0; j2 < relations.length; j2++) {
+ if (!relations[j2].isMultipolygon())
+ continue;
+ var rings = osmJoinWays(relations[j2].members, graph);
+ for (k = 0; k < rings.length; k++) {
+ nodes = rings[k].nodes;
+ if (nodes.find(function(n2) {
+ return n2.id === entity.id;
+ })) {
+ activeIndex = k;
+ if (geoHasSelfIntersections(nodes, entity.id)) {
+ return "multipolygonMember";
+ }
+ }
+ rings[k].coords = nodes.map(function(n2) {
+ return n2.loc;
+ });
+ }
+ for (k = 0; k < rings.length; k++) {
+ if (k === activeIndex)
+ continue;
+ if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k].nodes, entity.id)) {
+ return "multipolygonRing";
}
+ }
+ }
+ if (activeIndex === null) {
+ nodes = parent.nodes.map(function(nodeID) {
+ return graph.entity(nodeID);
+ });
+ if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
+ return parent.geometry(graph);
+ }
+ }
+ }
+ return false;
+ }
+ function move(d3_event, entity, point) {
+ if (_isCancelled)
+ return;
+ d3_event.stopPropagation();
+ context.surface().classed("nope-disabled", d3_event.altKey);
+ _lastLoc = context.projection.invert(point);
+ doMove(d3_event, entity);
+ var nudge = geoViewportEdge(point, context.map().dimensions());
+ if (nudge) {
+ startNudge(d3_event, entity, nudge);
+ } else {
+ stopNudge();
+ }
+ }
+ function end(d3_event, entity) {
+ if (_isCancelled)
+ return;
+ var wasPoint = entity.geometry(context.graph()) === "point";
+ var d = datum2(d3_event);
+ var nope = d && d.properties && d.properties.nope || context.surface().classed("nope");
+ var target = d && d.properties && d.properties.entity;
+ if (nope) {
+ context.perform(_actionBounceBack(entity.id, _startLoc));
+ } else if (target && target.type === "way") {
+ var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
+ context.replace(actionAddMidpoint({
+ loc: choice.loc,
+ edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
+ }, entity), connectAnnotation(entity, target));
+ } else if (target && target.type === "node" && shouldSnapToNode(target)) {
+ context.replace(actionConnect([target.id, entity.id]), connectAnnotation(entity, target));
+ } else if (_wasMidpoint) {
+ context.replace(actionNoop(), _t("operations.add.annotation.vertex"));
+ } else {
+ context.replace(actionNoop(), moveAnnotation(entity));
+ }
+ if (wasPoint) {
+ context.enter(modeSelect(context, [entity.id]));
+ } else {
+ var reselection = _restoreSelectedIDs.filter(function(id2) {
+ return context.graph().hasEntity(id2);
});
-
- return graph;
- };
-};
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/AddNodeToWayAction.as
-iD.actions.AddVertex = function(wayId, nodeId, index) {
- return function(graph) {
- return graph.replace(graph.entity(wayId).addNode(nodeId, index));
- };
-};
-iD.actions.ChangeMember = function(relationId, member, memberIndex) {
- return function(graph) {
- return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
- };
-};
-iD.actions.ChangePreset = function(entityId, oldPreset, newPreset) {
- return function(graph) {
- var entity = graph.entity(entityId),
- geometry = entity.geometry(graph),
- tags = entity.tags;
-
- if (oldPreset) tags = oldPreset.removeTags(tags, geometry);
- if (newPreset) tags = newPreset.applyTags(tags, geometry);
-
- return graph.replace(entity.update({tags: tags}));
+ if (reselection.length) {
+ context.enter(modeSelect(context, reselection));
+ } else {
+ context.enter(modeBrowse(context));
+ }
+ }
+ }
+ function _actionBounceBack(nodeID, toLoc) {
+ var moveNode = actionMoveNode(nodeID, toLoc);
+ var action = function(graph, t) {
+ if (t === 1)
+ context.pop();
+ return moveNode(graph, t);
+ };
+ action.transitionable = true;
+ return action;
+ }
+ function cancel() {
+ drag.cancel();
+ context.enter(modeBrowse(context));
+ }
+ var drag = behaviorDrag().selector(".layer-touch.points .target").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
+ mode.enter = function() {
+ context.install(hover);
+ context.install(edit2);
+ select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
+ context.history().on("undone.drag-node", cancel);
};
-};
-iD.actions.ChangeTags = function(entityId, tags) {
- return function(graph) {
- var entity = graph.entity(entityId);
- return graph.replace(entity.update({tags: tags}));
+ mode.exit = function() {
+ context.ui().sidebar.hover.cancel();
+ context.uninstall(hover);
+ context.uninstall(edit2);
+ select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
+ context.history().on("undone.drag-node", null);
+ _activeEntity = null;
+ context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
+ stopNudge();
};
-};
-iD.actions.Circularize = function(wayId, projection, maxAngle) {
- maxAngle = (maxAngle || 20) * Math.PI / 180;
+ mode.selectedIDs = function() {
+ if (!arguments.length)
+ return _activeEntity ? [_activeEntity.id] : [];
+ return mode;
+ };
+ mode.activeID = function() {
+ if (!arguments.length)
+ return _activeEntity && _activeEntity.id;
+ return mode;
+ };
+ mode.restoreSelectedIDs = function(_) {
+ if (!arguments.length)
+ return _restoreSelectedIDs;
+ _restoreSelectedIDs = _;
+ return mode;
+ };
+ mode.behavior = drag;
+ return mode;
+ }
- var action = function(graph) {
- var way = graph.entity(wayId);
+ // modules/services/keepRight.js
+ var import_rbush = __toESM(require_rbush_min());
- if (!way.isConvex(graph)) {
- graph = action.makeConvex(graph);
- }
+ // node_modules/d3-fetch/src/text.js
+ function responseText(response) {
+ if (!response.ok)
+ throw new Error(response.status + " " + response.statusText);
+ return response.text();
+ }
+ function text_default3(input, init2) {
+ return fetch(input, init2).then(responseText);
+ }
- var nodes = _.uniq(graph.childNodes(way)),
- keyNodes = nodes.filter(function(n) { return graph.parentWays(n).length !== 1; }),
- points = nodes.map(function(n) { return projection(n.loc); }),
- keyPoints = keyNodes.map(function(n) { return projection(n.loc); }),
- centroid = (points.length === 2) ? iD.geo.interp(points[0], points[1], 0.5) : d3.geom.polygon(points).centroid(),
- radius = d3.median(points, function(p) { return iD.geo.euclideanDistance(centroid, p); }),
- sign = d3.geom.polygon(points).area() > 0 ? 1 : -1,
- ids;
+ // node_modules/d3-fetch/src/json.js
+ function responseJson(response) {
+ if (!response.ok)
+ throw new Error(response.status + " " + response.statusText);
+ if (response.status === 204 || response.status === 205)
+ return;
+ return response.json();
+ }
+ function json_default(input, init2) {
+ return fetch(input, init2).then(responseJson);
+ }
- // we need atleast two key nodes for the algorithm to work
- if (!keyNodes.length) {
- keyNodes = [nodes[0]];
- keyPoints = [points[0]];
+ // node_modules/d3-fetch/src/xml.js
+ function parser(type3) {
+ return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type3));
+ }
+ var xml_default = parser("application/xml");
+ var html = parser("text/html");
+ var svg = parser("image/svg+xml");
+
+ // modules/services/keepRight.js
+ var tiler = utilTiler();
+ var dispatch2 = dispatch_default("loaded");
+ var _tileZoom = 14;
+ var _krUrlRoot = "https://www.keepright.at";
+ var _krData = { errorTypes: {}, localizeStrings: {} };
+ var _cache;
+ var _krRuleset = [
+ 30,
+ 40,
+ 50,
+ 60,
+ 70,
+ 90,
+ 100,
+ 110,
+ 120,
+ 130,
+ 150,
+ 160,
+ 170,
+ 180,
+ 190,
+ 191,
+ 192,
+ 193,
+ 194,
+ 195,
+ 196,
+ 197,
+ 198,
+ 200,
+ 201,
+ 202,
+ 203,
+ 204,
+ 205,
+ 206,
+ 207,
+ 208,
+ 210,
+ 220,
+ 230,
+ 231,
+ 232,
+ 270,
+ 280,
+ 281,
+ 282,
+ 283,
+ 284,
+ 285,
+ 290,
+ 291,
+ 292,
+ 293,
+ 294,
+ 295,
+ 296,
+ 297,
+ 298,
+ 300,
+ 310,
+ 311,
+ 312,
+ 313,
+ 320,
+ 350,
+ 360,
+ 370,
+ 380,
+ 390,
+ 400,
+ 401,
+ 402,
+ 410,
+ 411,
+ 412,
+ 413
+ ];
+ function abortRequest(controller) {
+ if (controller) {
+ controller.abort();
+ }
+ }
+ function abortUnwantedRequests(cache, tiles) {
+ Object.keys(cache.inflightTile).forEach((k) => {
+ const wanted = tiles.find((tile) => k === tile.id);
+ if (!wanted) {
+ abortRequest(cache.inflightTile[k]);
+ delete cache.inflightTile[k];
+ }
+ });
+ }
+ function encodeIssueRtree(d) {
+ return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
+ }
+ function updateRtree(item, replace) {
+ _cache.rtree.remove(item, (a, b) => a.data.id === b.data.id);
+ if (replace) {
+ _cache.rtree.insert(item);
+ }
+ }
+ function tokenReplacements(d) {
+ if (!(d instanceof QAItem))
+ return;
+ const replacements = {};
+ const issueTemplate = _krData.errorTypes[d.whichType];
+ if (!issueTemplate) {
+ console.log("No Template: ", d.whichType);
+ console.log(" ", d.description);
+ return;
+ }
+ if (!issueTemplate.regex)
+ return;
+ const errorRegex = new RegExp(issueTemplate.regex, "i");
+ const errorMatch = errorRegex.exec(d.description);
+ if (!errorMatch) {
+ console.log("Unmatched: ", d.whichType);
+ console.log(" ", d.description);
+ console.log(" ", errorRegex);
+ return;
+ }
+ for (let i2 = 1; i2 < errorMatch.length; i2++) {
+ let capture = errorMatch[i2];
+ let idType;
+ idType = "IDs" in issueTemplate ? issueTemplate.IDs[i2 - 1] : "";
+ if (idType && capture) {
+ capture = parseError(capture, idType);
+ } else {
+ const compare = capture.toLowerCase();
+ if (_krData.localizeStrings[compare]) {
+ capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
+ } else {
+ capture = unescape_default(capture);
}
-
- if (keyNodes.length === 1) {
- var index = nodes.indexOf(keyNodes[0]),
- oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
-
- keyNodes.push(nodes[oppositeIndex]);
- keyPoints.push(points[oppositeIndex]);
+ }
+ replacements["var" + i2] = capture;
+ }
+ return replacements;
+ }
+ function parseError(capture, idType) {
+ const compare = capture.toLowerCase();
+ if (_krData.localizeStrings[compare]) {
+ capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
+ }
+ switch (idType) {
+ case "this":
+ capture = linkErrorObject2(capture);
+ break;
+ case "url":
+ capture = linkURL(capture);
+ break;
+ case "n":
+ case "w":
+ case "r":
+ capture = linkEntity2(idType + capture);
+ break;
+ case "20":
+ capture = parse20(capture);
+ break;
+ case "211":
+ capture = parse211(capture);
+ break;
+ case "231":
+ capture = parse231(capture);
+ break;
+ case "294":
+ capture = parse294(capture);
+ break;
+ case "370":
+ capture = parse370(capture);
+ break;
+ }
+ return capture;
+ function linkErrorObject2(d) {
+ return { html: `${d}` };
+ }
+ function linkEntity2(d) {
+ return { html: `${d}` };
+ }
+ function linkURL(d) {
+ return { html: `${d}` };
+ }
+ function parse211(capture2) {
+ let newList = [];
+ const items = capture2.split(", ");
+ items.forEach((item) => {
+ let id2 = linkEntity2("n" + item.slice(1));
+ newList.push(id2);
+ });
+ return newList.join(", ");
+ }
+ function parse231(capture2) {
+ let newList = [];
+ const items = capture2.split("),");
+ items.forEach((item) => {
+ const match = item.match(/\#(\d+)\((.+)\)?/);
+ if (match !== null && match.length > 2) {
+ newList.push(linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] }));
}
+ });
+ return newList.join(", ");
+ }
+ function parse294(capture2) {
+ let newList = [];
+ const items = capture2.split(",");
+ items.forEach((item) => {
+ item = item.split(" ");
+ const role = `"${item[0]}"`;
+ const idType2 = item[1].slice(0, 1);
+ let id2 = item[2].slice(1);
+ id2 = linkEntity2(idType2 + id2);
+ newList.push(`${role} ${item[1]} ${id2}`);
+ });
+ return newList.join(", ");
+ }
+ function parse370(capture2) {
+ if (!capture2)
+ return "";
+ const match = capture2.match(/\(including the name (\'.+\')\)/);
+ if (match && match.length) {
+ return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
+ }
+ return "";
+ }
+ function parse20(capture2) {
+ let newList = [];
+ const items = capture2.split(",");
+ items.forEach((item) => {
+ const id2 = linkEntity2("n" + item.slice(1));
+ newList.push(id2);
+ });
+ return newList.join(", ");
+ }
+ }
+ var keepRight_default = {
+ title: "keepRight",
+ init() {
+ _mainFileFetcher.get("keepRight").then((d) => _krData = d);
+ if (!_cache) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch2, "on");
+ },
+ reset() {
+ if (_cache) {
+ Object.values(_cache.inflightTile).forEach(abortRequest);
+ }
+ _cache = {
+ data: {},
+ loadedTile: {},
+ inflightTile: {},
+ inflightPost: {},
+ closed: {},
+ rtree: new import_rbush.default()
+ };
+ },
+ loadIssues(projection2) {
+ const options2 = {
+ format: "geojson",
+ ch: _krRuleset
+ };
+ const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
+ abortUnwantedRequests(_cache, tiles);
+ tiles.forEach((tile) => {
+ if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
+ return;
+ const [left, top, right, bottom] = tile.extent.rectangle();
+ const params = Object.assign({}, options2, { left, bottom, right, top });
+ const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
+ const controller = new AbortController();
+ _cache.inflightTile[tile.id] = controller;
+ json_default(url, { signal: controller.signal }).then((data) => {
+ delete _cache.inflightTile[tile.id];
+ _cache.loadedTile[tile.id] = true;
+ if (!data || !data.features || !data.features.length) {
+ throw new Error("No Data");
+ }
+ data.features.forEach((feature3) => {
+ const {
+ properties: {
+ error_type: itemType,
+ error_id: id2,
+ comment = null,
+ object_id: objectId,
+ object_type: objectType,
+ schema,
+ title
+ }
+ } = feature3;
+ let {
+ geometry: { coordinates: loc },
+ properties: { description: description2 = "" }
+ } = feature3;
+ const issueTemplate = _krData.errorTypes[itemType];
+ const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
+ const whichType = issueTemplate ? itemType : parentIssueType;
+ const whichTemplate = _krData.errorTypes[whichType];
+ switch (whichType) {
+ case "170":
+ description2 = `This feature has a FIXME tag: ${description2}`;
+ break;
+ case "292":
+ case "293":
+ description2 = description2.replace("A turn-", "This turn-");
+ break;
+ case "294":
+ case "295":
+ case "296":
+ case "297":
+ case "298":
+ description2 = `This turn-restriction~${description2}`;
+ break;
+ case "300":
+ description2 = "This highway is missing a maxspeed tag";
+ break;
+ case "411":
+ case "412":
+ case "413":
+ description2 = `This feature~${description2}`;
+ break;
+ }
+ let coincident = false;
+ do {
+ let delta = coincident ? [1e-5, 0] : [0, 1e-5];
+ loc = geoVecAdd(loc, delta);
+ let bbox = geoExtent(loc).bbox();
+ coincident = _cache.rtree.search(bbox).length;
+ } while (coincident);
+ let d = new QAItem(loc, this, itemType, id2, {
+ comment,
+ description: description2,
+ whichType,
+ parentIssueType,
+ severity: whichTemplate.severity || "error",
+ objectId,
+ objectType,
+ schema,
+ title
+ });
+ d.replacements = tokenReplacements(d);
+ _cache.data[id2] = d;
+ _cache.rtree.insert(encodeIssueRtree(d));
+ });
+ dispatch2.call("loaded");
+ }).catch(() => {
+ delete _cache.inflightTile[tile.id];
+ _cache.loadedTile[tile.id] = true;
+ });
+ });
+ },
+ postUpdate(d, callback) {
+ if (_cache.inflightPost[d.id]) {
+ return callback({ message: "Error update already inflight", status: -2 }, d);
+ }
+ const params = { schema: d.schema, id: d.id };
+ if (d.newStatus) {
+ params.st = d.newStatus;
+ }
+ if (d.newComment !== void 0) {
+ params.co = d.newComment;
+ }
+ const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
+ const controller = new AbortController();
+ _cache.inflightPost[d.id] = controller;
+ json_default(url, { signal: controller.signal }).finally(() => {
+ delete _cache.inflightPost[d.id];
+ if (d.newStatus === "ignore") {
+ this.removeItem(d);
+ } else if (d.newStatus === "ignore_t") {
+ this.removeItem(d);
+ _cache.closed[`${d.schema}:${d.id}`] = true;
+ } else {
+ d = this.replaceItem(d.update({
+ comment: d.newComment,
+ newComment: void 0,
+ newState: void 0
+ }));
+ }
+ if (callback)
+ callback(null, d);
+ });
+ },
+ getItems(projection2) {
+ const viewport = projection2.clipExtent();
+ const min3 = [viewport[0][0], viewport[1][1]];
+ const max3 = [viewport[1][0], viewport[0][1]];
+ const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ return _cache.rtree.search(bbox).map((d) => d.data);
+ },
+ getError(id2) {
+ return _cache.data[id2];
+ },
+ replaceItem(item) {
+ if (!(item instanceof QAItem) || !item.id)
+ return;
+ _cache.data[item.id] = item;
+ updateRtree(encodeIssueRtree(item), true);
+ return item;
+ },
+ removeItem(item) {
+ if (!(item instanceof QAItem) || !item.id)
+ return;
+ delete _cache.data[item.id];
+ updateRtree(encodeIssueRtree(item), false);
+ },
+ issueURL(item) {
+ return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
+ },
+ getClosedIDs() {
+ return Object.keys(_cache.closed).sort();
+ }
+ };
- // key points and nodes are those connected to the ways,
- // they are projected onto the circle, inbetween nodes are moved
- // to constant intervals between key nodes, extra inbetween nodes are
- // added if necessary.
- for (var i = 0; i < keyPoints.length; i++) {
- var nextKeyNodeIndex = (i + 1) % keyNodes.length,
- startNode = keyNodes[i],
- endNode = keyNodes[nextKeyNodeIndex],
- startNodeIndex = nodes.indexOf(startNode),
- endNodeIndex = nodes.indexOf(endNode),
- numberNewPoints = -1,
- indexRange = endNodeIndex - startNodeIndex,
- distance, totalAngle, eachAngle, startAngle, endAngle,
- angle, loc, node, j,
- inBetweenNodes = [];
-
- if (indexRange < 0) {
- indexRange += nodes.length;
+ // modules/services/improveOSM.js
+ var import_rbush2 = __toESM(require_rbush_min());
+ var tiler2 = utilTiler();
+ var dispatch3 = dispatch_default("loaded");
+ var _tileZoom2 = 14;
+ var _impOsmUrls = {
+ ow: "https://grab.community.improve-osm.org/directionOfFlowService",
+ mr: "https://grab.community.improve-osm.org/missingGeoService",
+ tr: "https://grab.community.improve-osm.org/turnRestrictionService"
+ };
+ var _impOsmData = { icons: {} };
+ var _cache2;
+ function abortRequest2(i2) {
+ Object.values(i2).forEach((controller) => {
+ if (controller) {
+ controller.abort();
+ }
+ });
+ }
+ function abortUnwantedRequests2(cache, tiles) {
+ Object.keys(cache.inflightTile).forEach((k) => {
+ const wanted = tiles.find((tile) => k === tile.id);
+ if (!wanted) {
+ abortRequest2(cache.inflightTile[k]);
+ delete cache.inflightTile[k];
+ }
+ });
+ }
+ function encodeIssueRtree2(d) {
+ return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
+ }
+ function updateRtree2(item, replace) {
+ _cache2.rtree.remove(item, (a, b) => a.data.id === b.data.id);
+ if (replace) {
+ _cache2.rtree.insert(item);
+ }
+ }
+ function linkErrorObject(d) {
+ return { html: `${d}` };
+ }
+ function linkEntity(d) {
+ return { html: `${d}` };
+ }
+ function pointAverage(points) {
+ if (points.length) {
+ const sum = points.reduce((acc, point) => geoVecAdd(acc, [point.lon, point.lat]), [0, 0]);
+ return geoVecScale(sum, 1 / points.length);
+ } else {
+ return [0, 0];
+ }
+ }
+ function relativeBearing(p1, p2) {
+ let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
+ if (angle2 < 0) {
+ angle2 += 2 * Math.PI;
+ }
+ return angle2 * 180 / Math.PI;
+ }
+ function cardinalDirection(bearing) {
+ const dir = 45 * Math.round(bearing / 45);
+ const compass = {
+ 0: "north",
+ 45: "northeast",
+ 90: "east",
+ 135: "southeast",
+ 180: "south",
+ 225: "southwest",
+ 270: "west",
+ 315: "northwest",
+ 360: "north"
+ };
+ return _t(`QA.improveOSM.directions.${compass[dir]}`);
+ }
+ function preventCoincident(loc, bumpUp) {
+ let coincident = false;
+ do {
+ let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
+ loc = geoVecAdd(loc, delta);
+ let bbox = geoExtent(loc).bbox();
+ coincident = _cache2.rtree.search(bbox).length;
+ } while (coincident);
+ return loc;
+ }
+ var improveOSM_default = {
+ title: "improveOSM",
+ init() {
+ _mainFileFetcher.get("qa_data").then((d) => _impOsmData = d.improveOSM);
+ if (!_cache2) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch3, "on");
+ },
+ reset() {
+ if (_cache2) {
+ Object.values(_cache2.inflightTile).forEach(abortRequest2);
+ }
+ _cache2 = {
+ data: {},
+ loadedTile: {},
+ inflightTile: {},
+ inflightPost: {},
+ closed: {},
+ rtree: new import_rbush2.default()
+ };
+ },
+ loadIssues(projection2) {
+ const options2 = {
+ client: "iD",
+ status: "OPEN",
+ zoom: "19"
+ };
+ const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
+ abortUnwantedRequests2(_cache2, tiles);
+ tiles.forEach((tile) => {
+ if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
+ return;
+ const [east, north, west, south] = tile.extent.rectangle();
+ const params = Object.assign({}, options2, { east, south, west, north });
+ const requests = {};
+ Object.keys(_impOsmUrls).forEach((k) => {
+ const kParams = Object.assign({}, params, k === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" });
+ const url = `${_impOsmUrls[k]}/search?` + utilQsString(kParams);
+ const controller = new AbortController();
+ requests[k] = controller;
+ json_default(url, { signal: controller.signal }).then((data) => {
+ delete _cache2.inflightTile[tile.id][k];
+ if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
+ delete _cache2.inflightTile[tile.id];
+ _cache2.loadedTile[tile.id] = true;
}
-
- // position this key node
- distance = iD.geo.euclideanDistance(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])));
-
- // figure out the between delta angle we want to match to
- startAngle = Math.atan2(keyPoints[i][1] - centroid[1], keyPoints[i][0] - centroid[0]);
- endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
- totalAngle = endAngle - startAngle;
-
- // detects looping around -pi/pi
- if (totalAngle * sign > 0) {
- totalAngle = -sign * (2 * Math.PI - Math.abs(totalAngle));
+ if (data.roadSegments) {
+ data.roadSegments.forEach((feature3) => {
+ const { points, wayId, fromNodeId, toNodeId } = feature3;
+ const itemId = `${wayId}${fromNodeId}${toNodeId}`;
+ let mid = points.length / 2;
+ let loc;
+ if (mid % 1 === 0) {
+ loc = pointAverage([points[mid - 1], points[mid]]);
+ } else {
+ mid = points[Math.floor(mid)];
+ loc = [mid.lon, mid.lat];
+ }
+ loc = preventCoincident(loc, false);
+ let d = new QAItem(loc, this, k, itemId, {
+ issueKey: k,
+ identifier: {
+ wayId,
+ fromNodeId,
+ toNodeId
+ },
+ objectId: wayId,
+ objectType: "way"
+ });
+ d.replacements = {
+ percentage: feature3.percentOfTrips,
+ num_trips: feature3.numberOfTrips,
+ highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
+ from_node: linkEntity("n" + feature3.fromNodeId),
+ to_node: linkEntity("n" + feature3.toNodeId)
+ };
+ _cache2.data[d.id] = d;
+ _cache2.rtree.insert(encodeIssueRtree2(d));
+ });
}
-
- do {
- numberNewPoints++;
- eachAngle = totalAngle / (indexRange + numberNewPoints);
- } while (Math.abs(eachAngle) > maxAngle);
-
- // move existing points
- 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]);
-
- node = nodes[(j + startNodeIndex) % nodes.length].move(loc);
- graph = graph.replace(node);
- }
-
- // add new inbetween nodes if necessary
- for (j = 0; j < numberNewPoints; j++) {
- angle = startAngle + (indexRange + j) * eachAngle;
- loc = projection.invert([
- centroid[0] + Math.cos(angle) * radius,
- centroid[1] + Math.sin(angle) * radius]);
-
- node = iD.Node({loc: loc});
- graph = graph.replace(node);
-
- nodes.splice(endNodeIndex + j, 0, node);
- inBetweenNodes.push(node.id);
- }
-
- // Check for other ways that share these keyNodes..
- // If keyNodes are adjacent in both ways,
- // we can add inBetween nodes to that shared way too..
- if (indexRange === 1 && inBetweenNodes.length) {
- var startIndex1 = way.nodes.lastIndexOf(startNode.id),
- endIndex1 = way.nodes.lastIndexOf(endNode.id),
- wayDirection1 = (endIndex1 - startIndex1);
- if (wayDirection1 < -1) { wayDirection1 = 1; }
-
- /* eslint-disable no-loop-func */
- _.each(_.without(graph.parentWays(keyNodes[i]), way), function(sharedWay) {
- if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
- var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id),
- endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id),
- wayDirection2 = (endIndex2 - startIndex2),
- insertAt = endIndex2;
- if (wayDirection2 < -1) { wayDirection2 = 1; }
-
- if (wayDirection1 !== wayDirection2) {
- inBetweenNodes.reverse();
- insertAt = startIndex2;
- }
- for (j = 0; j < inBetweenNodes.length; j++) {
- sharedWay = sharedWay.addNode(inBetweenNodes[j], insertAt + j);
- }
- graph = graph.replace(sharedWay);
- }
+ if (data.tiles) {
+ data.tiles.forEach((feature3) => {
+ const { type: type3, x, y, numberOfTrips } = feature3;
+ const geoType = type3.toLowerCase();
+ const itemId = `${geoType}${x}${y}${numberOfTrips}`;
+ let loc = pointAverage(feature3.points);
+ loc = preventCoincident(loc, false);
+ let d = new QAItem(loc, this, `${k}-${geoType}`, itemId, {
+ issueKey: k,
+ identifier: { x, y }
});
- /* eslint-enable no-loop-func */
+ d.replacements = {
+ num_trips: numberOfTrips,
+ geometry_type: _t(`QA.improveOSM.geometry_types.${geoType}`)
+ };
+ if (numberOfTrips === -1) {
+ d.desc = _t("QA.improveOSM.error_types.mr.description_alt", d.replacements);
+ }
+ _cache2.data[d.id] = d;
+ _cache2.rtree.insert(encodeIssueRtree2(d));
+ });
}
-
- }
-
- // update the way to have all the new nodes
- ids = nodes.map(function(n) { return n.id; });
- ids.push(ids[0]);
-
- way = way.update({nodes: ids});
- graph = graph.replace(way);
-
- return graph;
- };
-
- action.makeConvex = function(graph) {
- var way = graph.entity(wayId),
- nodes = _.uniq(graph.childNodes(way)),
- points = nodes.map(function(n) { return projection(n.loc); }),
- sign = d3.geom.polygon(points).area() > 0 ? 1 : -1,
- hull = d3.geom.hull(points);
-
- // D3 convex hulls go counterclockwise..
- if (sign === -1) {
- nodes.reverse();
- points.reverse();
- }
-
- for (var i = 0; i < hull.length - 1; i++) {
- var startIndex = points.indexOf(hull[i]),
- endIndex = points.indexOf(hull[i+1]),
- indexRange = (endIndex - startIndex);
-
- if (indexRange < 0) {
- indexRange += nodes.length;
+ if (data.entities) {
+ data.entities.forEach((feature3) => {
+ const { point, id: id2, segments, numberOfPasses, turnType } = feature3;
+ const itemId = `${id2.replace(/[,:+#]/g, "_")}`;
+ const loc = preventCoincident([point.lon, point.lat], true);
+ const ids = id2.split(",");
+ const from_way = ids[0];
+ const via_node = ids[3];
+ const to_way = ids[2].split(":")[1];
+ let d = new QAItem(loc, this, k, itemId, {
+ issueKey: k,
+ identifier: id2,
+ objectId: via_node,
+ objectType: "node"
+ });
+ const [p1, p2] = segments[0].points;
+ const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
+ d.replacements = {
+ num_passed: numberOfPasses,
+ num_trips: segments[0].numberOfTrips,
+ turn_restriction: turnType.toLowerCase(),
+ from_way: linkEntity("w" + from_way),
+ to_way: linkEntity("w" + to_way),
+ travel_direction: dir_of_travel,
+ junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
+ };
+ _cache2.data[d.id] = d;
+ _cache2.rtree.insert(encodeIssueRtree2(d));
+ dispatch3.call("loaded");
+ });
}
-
- // move interior nodes to the surface of the convex hull..
- for (var j = 1; j < indexRange; j++) {
- var point = iD.geo.interp(hull[i], hull[i+1], j / indexRange),
- node = nodes[(j + startIndex) % nodes.length].move(projection.invert(point));
- graph = graph.replace(node);
+ }).catch(() => {
+ delete _cache2.inflightTile[tile.id][k];
+ if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
+ delete _cache2.inflightTile[tile.id];
+ _cache2.loadedTile[tile.id] = true;
}
- }
- return graph;
- };
-
- action.disabled = function(graph) {
- if (!graph.entity(wayId).isClosed())
- return 'not_closed';
- };
-
- return action;
-};
-// Connect the ways at the given nodes.
-//
-// The last node will survive. All other nodes will be replaced with
-// the surviving node in parent ways, and then removed.
-//
-// Tags and relation memberships of of non-surviving nodes are merged
-// to the survivor.
-//
-// This is the inverse of `iD.actions.Disconnect`.
-//
-// Reference:
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MergeNodesAction.as
-// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/actions/MergeNodesAction.java
-//
-iD.actions.Connect = function(nodeIds) {
- return function(graph) {
- var survivor = graph.entity(_.last(nodeIds));
-
- for (var i = 0; i < nodeIds.length - 1; i++) {
- var node = graph.entity(nodeIds[i]);
-
- /* eslint-disable no-loop-func */
- graph.parentWays(node).forEach(function(parent) {
- if (!parent.areAdjacent(node.id, survivor.id)) {
- graph = graph.replace(parent.replaceNode(node.id, survivor.id));
- }
- });
-
- graph.parentRelations(node).forEach(function(parent) {
- graph = graph.replace(parent.replaceMember(node, survivor));
- });
- /* eslint-enable no-loop-func */
-
- survivor = survivor.mergeTags(node.tags);
- graph = iD.actions.DeleteNode(node.id)(graph);
- }
-
- graph = graph.replace(survivor);
-
- return graph;
- };
-};
-iD.actions.CopyEntities = function(ids, fromGraph) {
- var copies = {};
-
- var action = function(graph) {
- ids.forEach(function(id) {
- fromGraph.entity(id).copy(fromGraph, copies);
+ });
});
-
- for (var id in copies) {
- graph = graph.replace(copies[id]);
- }
-
- return graph;
- };
-
- action.copies = function() {
- return copies;
- };
-
- return action;
-};
-iD.actions.DeleteMember = function(relationId, memberIndex) {
- return function(graph) {
- var relation = graph.entity(relationId)
- .removeMember(memberIndex);
-
- graph = graph.replace(relation);
-
- if (relation.isDegenerate())
- graph = iD.actions.DeleteRelation(relation.id)(graph);
-
- return graph;
- };
-};
-iD.actions.DeleteMultiple = function(ids) {
- var actions = {
- way: iD.actions.DeleteWay,
- node: iD.actions.DeleteNode,
- relation: iD.actions.DeleteRelation
- };
-
- var action = function(graph) {
- ids.forEach(function(id) {
- if (graph.hasEntity(id)) { // It may have been deleted aready.
- graph = actions[graph.entity(id).type](id)(graph);
+ _cache2.inflightTile[tile.id] = requests;
+ });
+ },
+ getComments(item) {
+ if (item.comments) {
+ return Promise.resolve(item);
+ }
+ const key = item.issueKey;
+ let qParams = {};
+ if (key === "ow") {
+ qParams = item.identifier;
+ } else if (key === "mr") {
+ qParams.tileX = item.identifier.x;
+ qParams.tileY = item.identifier.y;
+ } else if (key === "tr") {
+ qParams.targetId = item.identifier;
+ }
+ const url = `${_impOsmUrls[key]}/retrieveComments?` + utilQsString(qParams);
+ const cacheComments = (data) => {
+ item.comments = data.comments ? data.comments.reverse() : [];
+ this.replaceItem(item);
+ };
+ return json_default(url).then(cacheComments).then(() => item);
+ },
+ postUpdate(d, callback) {
+ if (!osm_default.authenticated()) {
+ return callback({ message: "Not Authenticated", status: -3 }, d);
+ }
+ if (_cache2.inflightPost[d.id]) {
+ return callback({ message: "Error update already inflight", status: -2 }, d);
+ }
+ osm_default.userDetails(sendPayload.bind(this));
+ function sendPayload(err, user) {
+ if (err) {
+ return callback(err, d);
+ }
+ const key = d.issueKey;
+ const url = `${_impOsmUrls[key]}/comment`;
+ const payload = {
+ username: user.display_name,
+ targetIds: [d.identifier]
+ };
+ if (d.newStatus) {
+ payload.status = d.newStatus;
+ payload.text = "status changed";
+ }
+ if (d.newComment) {
+ payload.text = d.newComment;
+ }
+ const controller = new AbortController();
+ _cache2.inflightPost[d.id] = controller;
+ const options2 = {
+ method: "POST",
+ signal: controller.signal,
+ body: JSON.stringify(payload)
+ };
+ json_default(url, options2).then(() => {
+ delete _cache2.inflightPost[d.id];
+ if (!d.newStatus) {
+ const now3 = new Date();
+ let comments = d.comments ? d.comments : [];
+ comments.push({
+ username: payload.username,
+ text: payload.text,
+ timestamp: now3.getTime() / 1e3
+ });
+ this.replaceItem(d.update({
+ comments,
+ newComment: void 0
+ }));
+ } else {
+ this.removeItem(d);
+ if (d.newStatus === "SOLVED") {
+ if (!(d.issueKey in _cache2.closed)) {
+ _cache2.closed[d.issueKey] = 0;
+ }
+ _cache2.closed[d.issueKey] += 1;
}
+ }
+ if (callback)
+ callback(null, d);
+ }).catch((err2) => {
+ delete _cache2.inflightPost[d.id];
+ if (callback)
+ callback(err2.message);
});
+ }
+ },
+ getItems(projection2) {
+ const viewport = projection2.clipExtent();
+ const min3 = [viewport[0][0], viewport[1][1]];
+ const max3 = [viewport[1][0], viewport[0][1]];
+ const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ return _cache2.rtree.search(bbox).map((d) => d.data);
+ },
+ getError(id2) {
+ return _cache2.data[id2];
+ },
+ getIcon(itemType) {
+ return _impOsmData.icons[itemType];
+ },
+ replaceItem(issue) {
+ if (!(issue instanceof QAItem) || !issue.id)
+ return;
+ _cache2.data[issue.id] = issue;
+ updateRtree2(encodeIssueRtree2(issue), true);
+ return issue;
+ },
+ removeItem(issue) {
+ if (!(issue instanceof QAItem) || !issue.id)
+ return;
+ delete _cache2.data[issue.id];
+ updateRtree2(encodeIssueRtree2(issue), false);
+ },
+ getClosedCounts() {
+ return _cache2.closed;
+ }
+ };
- return graph;
- };
-
- action.disabled = function(graph) {
- for (var i = 0; i < ids.length; i++) {
- var id = ids[i],
- disabled = actions[graph.entity(id).type](id).disabled(graph);
- if (disabled) return disabled;
- }
- };
-
- return action;
-};
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/DeleteNodeAction.as
-iD.actions.DeleteNode = function(nodeId) {
- var action = function(graph) {
- var node = graph.entity(nodeId);
-
- graph.parentWays(node)
- .forEach(function(parent) {
- parent = parent.removeNode(nodeId);
- graph = graph.replace(parent);
-
- if (parent.isDegenerate()) {
- graph = iD.actions.DeleteWay(parent.id)(graph);
- }
- });
-
- graph.parentRelations(node)
- .forEach(function(parent) {
- parent = parent.removeMembersWithID(nodeId);
- graph = graph.replace(parent);
-
- if (parent.isDegenerate()) {
- graph = iD.actions.DeleteRelation(parent.id)(graph);
- }
- });
-
- return graph.remove(node);
- };
+ // modules/services/osmose.js
+ var import_rbush3 = __toESM(require_rbush_min());
- action.disabled = function() {
- return false;
+ // node_modules/marked/lib/marked.esm.js
+ function getDefaults() {
+ return {
+ baseUrl: null,
+ breaks: false,
+ extensions: null,
+ gfm: true,
+ headerIds: true,
+ headerPrefix: "",
+ highlight: null,
+ langPrefix: "language-",
+ mangle: true,
+ pedantic: false,
+ renderer: null,
+ sanitize: false,
+ sanitizer: null,
+ silent: false,
+ smartLists: false,
+ smartypants: false,
+ tokenizer: null,
+ walkTokens: null,
+ xhtml: false
};
-
- return action;
-};
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/DeleteRelationAction.as
-iD.actions.DeleteRelation = function(relationId) {
- function deleteEntity(entity, graph) {
- return !graph.parentWays(entity).length &&
- !graph.parentRelations(entity).length &&
- !entity.hasInterestingTags();
+ }
+ var defaults = getDefaults();
+ function changeDefaults(newDefaults) {
+ defaults = newDefaults;
+ }
+ var escapeTest = /[&<>"']/;
+ var escapeReplace = /[&<>"']/g;
+ var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
+ var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
+ var escapeReplacements = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': """,
+ "'": "'"
+ };
+ var getEscapeReplacement = (ch) => escapeReplacements[ch];
+ function escape4(html2, encode) {
+ if (encode) {
+ if (escapeTest.test(html2)) {
+ return html2.replace(escapeReplace, getEscapeReplacement);
+ }
+ } else {
+ if (escapeTestNoEncode.test(html2)) {
+ return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
+ }
}
-
- var action = function(graph) {
- var relation = graph.entity(relationId);
-
- graph.parentRelations(relation)
- .forEach(function(parent) {
- parent = parent.removeMembersWithID(relationId);
- graph = graph.replace(parent);
-
- if (parent.isDegenerate()) {
- graph = iD.actions.DeleteRelation(parent.id)(graph);
- }
- });
-
- _.uniq(_.map(relation.members, 'id')).forEach(function(memberId) {
- graph = graph.replace(relation.removeMembersWithID(memberId));
-
- var entity = graph.entity(memberId);
- if (deleteEntity(entity, graph)) {
- graph = iD.actions.DeleteMultiple([memberId])(graph);
- }
- });
-
- return graph.remove(relation);
+ return html2;
+ }
+ var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
+ function unescape3(html2) {
+ return html2.replace(unescapeTest, (_, n2) => {
+ n2 = n2.toLowerCase();
+ if (n2 === "colon")
+ return ":";
+ if (n2.charAt(0) === "#") {
+ return n2.charAt(1) === "x" ? String.fromCharCode(parseInt(n2.substring(2), 16)) : String.fromCharCode(+n2.substring(1));
+ }
+ return "";
+ });
+ }
+ var caret = /(^|[^\[])\^/g;
+ function edit(regex, opt) {
+ regex = typeof regex === "string" ? regex : regex.source;
+ opt = opt || "";
+ const obj = {
+ replace: (name2, val) => {
+ val = val.source || val;
+ val = val.replace(caret, "$1");
+ regex = regex.replace(name2, val);
+ return obj;
+ },
+ getRegex: () => {
+ return new RegExp(regex, opt);
+ }
};
-
- action.disabled = function(graph) {
- if (!graph.entity(relationId).isComplete(graph))
- return 'incomplete_relation';
+ return obj;
+ }
+ var nonWordAndColonTest = /[^\w:]/g;
+ var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
+ function cleanUrl(sanitize, base, href) {
+ if (sanitize) {
+ let prot;
+ try {
+ prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
+ } catch (e) {
+ return null;
+ }
+ if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
+ return null;
+ }
+ }
+ if (base && !originIndependentUrl.test(href)) {
+ href = resolveUrl(base, href);
+ }
+ try {
+ href = encodeURI(href).replace(/%25/g, "%");
+ } catch (e) {
+ return null;
+ }
+ return href;
+ }
+ var baseUrls = {};
+ var justDomain = /^[^:]+:\/*[^/]*$/;
+ var protocol = /^([^:]+:)[\s\S]*$/;
+ var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
+ function resolveUrl(base, href) {
+ if (!baseUrls[" " + base]) {
+ if (justDomain.test(base)) {
+ baseUrls[" " + base] = base + "/";
+ } else {
+ baseUrls[" " + base] = rtrim(base, "/", true);
+ }
+ }
+ base = baseUrls[" " + base];
+ const relativeBase = base.indexOf(":") === -1;
+ if (href.substring(0, 2) === "//") {
+ if (relativeBase) {
+ return href;
+ }
+ return base.replace(protocol, "$1") + href;
+ } else if (href.charAt(0) === "/") {
+ if (relativeBase) {
+ return href;
+ }
+ return base.replace(domain, "$1") + href;
+ } else {
+ return base + href;
+ }
+ }
+ var noopTest = { exec: function noopTest2() {
+ } };
+ function merge2(obj) {
+ let i2 = 1, target, key;
+ for (; i2 < arguments.length; i2++) {
+ target = arguments[i2];
+ for (key in target) {
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
+ obj[key] = target[key];
+ }
+ }
+ }
+ return obj;
+ }
+ function splitCells(tableRow, count) {
+ const row = tableRow.replace(/\|/g, (match, offset, str2) => {
+ let escaped = false, curr = offset;
+ while (--curr >= 0 && str2[curr] === "\\")
+ escaped = !escaped;
+ if (escaped) {
+ return "|";
+ } else {
+ return " |";
+ }
+ }), cells = row.split(/ \|/);
+ let i2 = 0;
+ if (!cells[0].trim()) {
+ cells.shift();
+ }
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
+ cells.pop();
+ }
+ if (cells.length > count) {
+ cells.splice(count);
+ } else {
+ while (cells.length < count)
+ cells.push("");
+ }
+ for (; i2 < cells.length; i2++) {
+ cells[i2] = cells[i2].trim().replace(/\\\|/g, "|");
+ }
+ return cells;
+ }
+ function rtrim(str2, c, invert) {
+ const l = str2.length;
+ if (l === 0) {
+ return "";
+ }
+ let suffLen = 0;
+ while (suffLen < l) {
+ const currChar = str2.charAt(l - suffLen - 1);
+ if (currChar === c && !invert) {
+ suffLen++;
+ } else if (currChar !== c && invert) {
+ suffLen++;
+ } else {
+ break;
+ }
+ }
+ return str2.slice(0, l - suffLen);
+ }
+ function findClosingBracket(str2, b) {
+ if (str2.indexOf(b[1]) === -1) {
+ return -1;
+ }
+ const l = str2.length;
+ let level = 0, i2 = 0;
+ for (; i2 < l; i2++) {
+ if (str2[i2] === "\\") {
+ i2++;
+ } else if (str2[i2] === b[0]) {
+ level++;
+ } else if (str2[i2] === b[1]) {
+ level--;
+ if (level < 0) {
+ return i2;
+ }
+ }
+ }
+ return -1;
+ }
+ function checkSanitizeDeprecation(opt) {
+ if (opt && opt.sanitize && !opt.silent) {
+ console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
+ }
+ }
+ function repeatString(pattern, count) {
+ if (count < 1) {
+ return "";
+ }
+ let result = "";
+ while (count > 1) {
+ if (count & 1) {
+ result += pattern;
+ }
+ count >>= 1;
+ pattern += pattern;
+ }
+ return result + pattern;
+ }
+ function outputLink(cap, link2, raw, lexer2) {
+ const href = link2.href;
+ const title = link2.title ? escape4(link2.title) : null;
+ const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
+ if (cap[0].charAt(0) !== "!") {
+ lexer2.state.inLink = true;
+ const token = {
+ type: "link",
+ raw,
+ href,
+ title,
+ text: text2,
+ tokens: lexer2.inlineTokens(text2, [])
+ };
+ lexer2.state.inLink = false;
+ return token;
+ }
+ return {
+ type: "image",
+ raw,
+ href,
+ title,
+ text: escape4(text2)
};
-
- return action;
-};
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/DeleteWayAction.as
-iD.actions.DeleteWay = function(wayId) {
- function deleteNode(node, graph) {
- return !graph.parentWays(node).length &&
- !graph.parentRelations(node).length &&
- !node.hasInterestingTags();
+ }
+ function indentCodeCompensation(raw, text2) {
+ const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
+ if (matchIndentToCode === null) {
+ return text2;
+ }
+ const indentToCode = matchIndentToCode[1];
+ return text2.split("\n").map((node) => {
+ const matchIndentInNode = node.match(/^\s+/);
+ if (matchIndentInNode === null) {
+ return node;
+ }
+ const [indentInNode] = matchIndentInNode;
+ if (indentInNode.length >= indentToCode.length) {
+ return node.slice(indentToCode.length);
+ }
+ return node;
+ }).join("\n");
+ }
+ var Tokenizer = class {
+ constructor(options2) {
+ this.options = options2 || defaults;
+ }
+ space(src) {
+ const cap = this.rules.block.newline.exec(src);
+ if (cap && cap[0].length > 0) {
+ return {
+ type: "space",
+ raw: cap[0]
+ };
+ }
+ }
+ code(src) {
+ const cap = this.rules.block.code.exec(src);
+ if (cap) {
+ const text2 = cap[0].replace(/^ {1,4}/gm, "");
+ return {
+ type: "code",
+ raw: cap[0],
+ codeBlockStyle: "indented",
+ text: !this.options.pedantic ? rtrim(text2, "\n") : text2
+ };
+ }
+ }
+ fences(src) {
+ const cap = this.rules.block.fences.exec(src);
+ if (cap) {
+ const raw = cap[0];
+ const text2 = indentCodeCompensation(raw, cap[3] || "");
+ return {
+ type: "code",
+ raw,
+ lang: cap[2] ? cap[2].trim() : cap[2],
+ text: text2
+ };
+ }
}
-
- var action = function(graph) {
- var way = graph.entity(wayId);
-
- graph.parentRelations(way)
- .forEach(function(parent) {
- parent = parent.removeMembersWithID(wayId);
- graph = graph.replace(parent);
-
- if (parent.isDegenerate()) {
- graph = iD.actions.DeleteRelation(parent.id)(graph);
- }
- });
-
- _.uniq(way.nodes).forEach(function(nodeId) {
- graph = graph.replace(way.removeNode(nodeId));
-
- var node = graph.entity(nodeId);
- if (deleteNode(node, graph)) {
- graph = graph.remove(node);
+ heading(src) {
+ const cap = this.rules.block.heading.exec(src);
+ if (cap) {
+ let text2 = cap[2].trim();
+ if (/#$/.test(text2)) {
+ const trimmed = rtrim(text2, "#");
+ if (this.options.pedantic) {
+ text2 = trimmed.trim();
+ } else if (!trimmed || / $/.test(trimmed)) {
+ text2 = trimmed.trim();
+ }
+ }
+ const token = {
+ type: "heading",
+ raw: cap[0],
+ depth: cap[1].length,
+ text: text2,
+ tokens: []
+ };
+ this.lexer.inline(token.text, token.tokens);
+ return token;
+ }
+ }
+ hr(src) {
+ const cap = this.rules.block.hr.exec(src);
+ if (cap) {
+ return {
+ type: "hr",
+ raw: cap[0]
+ };
+ }
+ }
+ blockquote(src) {
+ const cap = this.rules.block.blockquote.exec(src);
+ if (cap) {
+ const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
+ return {
+ type: "blockquote",
+ raw: cap[0],
+ tokens: this.lexer.blockTokens(text2, []),
+ text: text2
+ };
+ }
+ }
+ list(src) {
+ let cap = this.rules.block.list.exec(src);
+ if (cap) {
+ let raw, istask, ischecked, indent2, i2, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
+ let bull = cap[1].trim();
+ const isordered = bull.length > 1;
+ const list = {
+ type: "list",
+ raw: "",
+ ordered: isordered,
+ start: isordered ? +bull.slice(0, -1) : "",
+ loose: false,
+ items: []
+ };
+ bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
+ if (this.options.pedantic) {
+ bull = isordered ? bull : "[*+-]";
+ }
+ const itemRegex = new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`);
+ while (src) {
+ endEarly = false;
+ if (!(cap = itemRegex.exec(src))) {
+ break;
+ }
+ if (this.rules.block.hr.test(src)) {
+ break;
+ }
+ raw = cap[0];
+ src = src.substring(raw.length);
+ line = cap[2].split("\n", 1)[0];
+ nextLine = src.split("\n", 1)[0];
+ if (this.options.pedantic) {
+ indent2 = 2;
+ itemContents = line.trimLeft();
+ } else {
+ indent2 = cap[2].search(/[^ ]/);
+ indent2 = indent2 > 4 ? 1 : indent2;
+ itemContents = line.slice(indent2);
+ indent2 += cap[1].length;
+ }
+ blankLine = false;
+ if (!line && /^ *$/.test(nextLine)) {
+ raw += nextLine + "\n";
+ src = src.substring(nextLine.length + 1);
+ endEarly = true;
+ }
+ if (!endEarly) {
+ const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`);
+ const hrRegex = new RegExp(`^ {0,${Math.min(3, indent2 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
+ while (src) {
+ rawLine = src.split("\n", 1)[0];
+ line = rawLine;
+ if (this.options.pedantic) {
+ line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
+ }
+ if (nextBulletRegex.test(line)) {
+ break;
+ }
+ if (hrRegex.test(src)) {
+ break;
+ }
+ if (line.search(/[^ ]/) >= indent2 || !line.trim()) {
+ itemContents += "\n" + line.slice(indent2);
+ } else if (!blankLine) {
+ itemContents += "\n" + line;
+ } else {
+ break;
+ }
+ if (!blankLine && !line.trim()) {
+ blankLine = true;
+ }
+ raw += rawLine + "\n";
+ src = src.substring(rawLine.length + 1);
}
- });
-
- return graph.remove(way);
- };
-
- action.disabled = function(graph) {
- var disabled = false;
-
- graph.parentRelations(graph.entity(wayId)).forEach(function(parent) {
- var type = parent.tags.type,
- role = parent.memberById(wayId).role || 'outer';
- if (type === 'route' || type === 'boundary' || (type === 'multipolygon' && role === 'outer')) {
- disabled = 'part_of_relation';
+ }
+ if (!list.loose) {
+ if (endsWithBlankLine) {
+ list.loose = true;
+ } else if (/\n *\n *$/.test(raw)) {
+ endsWithBlankLine = true;
}
- });
-
- return disabled;
- };
-
- return action;
-};
-iD.actions.DeprecateTags = function(entityId) {
- return function(graph) {
- var entity = graph.entity(entityId),
- newtags = _.clone(entity.tags),
- change = false,
- rule;
-
- // This handles deprecated tags with a single condition
- for (var i = 0; i < iD.data.deprecated.length; i++) {
-
- rule = iD.data.deprecated[i];
- var match = _.toPairs(rule.old)[0],
- replacements = rule.replace ? _.toPairs(rule.replace) : null;
-
- if (entity.tags[match[0]] && match[1] === '*') {
-
- var value = entity.tags[match[0]];
- if (replacements && !newtags[replacements[0][0]]) {
- newtags[replacements[0][0]] = value;
- }
- delete newtags[match[0]];
- change = true;
-
- } else if (entity.tags[match[0]] === match[1]) {
- newtags = _.assign({}, rule.replace || {}, _.omit(newtags, match[0]));
- change = true;
+ }
+ if (this.options.gfm) {
+ istask = /^\[[ xX]\] /.exec(itemContents);
+ if (istask) {
+ ischecked = istask[0] !== "[ ] ";
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
}
- }
-
- if (change) {
- return graph.replace(entity.update({tags: newtags}));
- } else {
- return graph;
- }
- };
-};
-iD.actions.DiscardTags = function(difference) {
- return function(graph) {
- function discardTags(entity) {
- if (!_.isEmpty(entity.tags)) {
- var tags = {};
- _.each(entity.tags, function(v, k) {
- if (v) tags[k] = v;
- });
-
- graph = graph.replace(entity.update({
- tags: _.omit(tags, iD.data.discarded)
- }));
+ }
+ list.items.push({
+ type: "list_item",
+ raw,
+ task: !!istask,
+ checked: ischecked,
+ loose: false,
+ text: itemContents
+ });
+ list.raw += raw;
+ }
+ list.items[list.items.length - 1].raw = raw.trimRight();
+ list.items[list.items.length - 1].text = itemContents.trimRight();
+ list.raw = list.raw.trimRight();
+ const l = list.items.length;
+ for (i2 = 0; i2 < l; i2++) {
+ this.lexer.state.top = false;
+ list.items[i2].tokens = this.lexer.blockTokens(list.items[i2].text, []);
+ const spacers = list.items[i2].tokens.filter((t) => t.type === "space");
+ const hasMultipleLineBreaks = spacers.every((t) => {
+ const chars = t.raw.split("");
+ let lineBreaks = 0;
+ for (const char of chars) {
+ if (char === "\n") {
+ lineBreaks += 1;
+ }
+ if (lineBreaks > 1) {
+ return true;
+ }
}
+ return false;
+ });
+ if (!list.loose && spacers.length && hasMultipleLineBreaks) {
+ list.loose = true;
+ list.items[i2].loose = true;
+ }
}
-
- difference.modified().forEach(discardTags);
- difference.created().forEach(discardTags);
-
- return graph;
- };
-};
-// Disconect the ways at the given node.
-//
-// Optionally, disconnect only the given ways.
-//
-// For testing convenience, accepts an ID to assign to the (first) new node.
-// Normally, this will be undefined and the way will automatically
-// be assigned a new ID.
-//
-// This is the inverse of `iD.actions.Connect`.
-//
-// Reference:
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/UnjoinNodeAction.as
-// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/actions/UnGlueAction.java
-//
-iD.actions.Disconnect = function(nodeId, newNodeId) {
- var wayIds;
-
- var action = function(graph) {
- var node = graph.entity(nodeId),
- connections = action.connections(graph);
-
- connections.forEach(function(connection) {
- var way = graph.entity(connection.wayID),
- newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
-
- graph = graph.replace(newNode);
- if (connection.index === 0 && way.isArea()) {
- // replace shared node with shared node..
- graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
+ return list;
+ }
+ }
+ html(src) {
+ const cap = this.rules.block.html.exec(src);
+ if (cap) {
+ const token = {
+ type: "html",
+ raw: cap[0],
+ pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
+ text: cap[0]
+ };
+ if (this.options.sanitize) {
+ token.type = "paragraph";
+ token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
+ token.tokens = [];
+ this.lexer.inline(token.text, token.tokens);
+ }
+ return token;
+ }
+ }
+ def(src) {
+ const cap = this.rules.block.def.exec(src);
+ if (cap) {
+ if (cap[3])
+ cap[3] = cap[3].substring(1, cap[3].length - 1);
+ const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
+ return {
+ type: "def",
+ tag,
+ raw: cap[0],
+ href: cap[2],
+ title: cap[3]
+ };
+ }
+ }
+ table(src) {
+ const cap = this.rules.block.table.exec(src);
+ if (cap) {
+ const item = {
+ type: "table",
+ header: splitCells(cap[1]).map((c) => {
+ return { text: c };
+ }),
+ align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
+ rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
+ };
+ if (item.header.length === item.align.length) {
+ item.raw = cap[0];
+ let l = item.align.length;
+ let i2, j2, k, row;
+ for (i2 = 0; i2 < l; i2++) {
+ if (/^ *-+: *$/.test(item.align[i2])) {
+ item.align[i2] = "right";
+ } else if (/^ *:-+: *$/.test(item.align[i2])) {
+ item.align[i2] = "center";
+ } else if (/^ *:-+ *$/.test(item.align[i2])) {
+ item.align[i2] = "left";
} else {
- // replace shared node with multiple new nodes..
- graph = graph.replace(way.updateNode(newNode.id, connection.index));
+ item.align[i2] = null;
}
- });
-
- return graph;
- };
-
- action.connections = function(graph) {
- var candidates = [],
- keeping = false,
- parentWays = graph.parentWays(graph.entity(nodeId));
-
- parentWays.forEach(function(way) {
- if (wayIds && wayIds.indexOf(way.id) === -1) {
- keeping = true;
- return;
+ }
+ l = item.rows.length;
+ for (i2 = 0; i2 < l; i2++) {
+ item.rows[i2] = splitCells(item.rows[i2], item.header.length).map((c) => {
+ return { text: c };
+ });
+ }
+ l = item.header.length;
+ for (j2 = 0; j2 < l; j2++) {
+ item.header[j2].tokens = [];
+ this.lexer.inline(item.header[j2].text, item.header[j2].tokens);
+ }
+ l = item.rows.length;
+ for (j2 = 0; j2 < l; j2++) {
+ row = item.rows[j2];
+ for (k = 0; k < row.length; k++) {
+ row[k].tokens = [];
+ this.lexer.inline(row[k].text, row[k].tokens);
}
- if (way.isArea() && (way.nodes[0] === nodeId)) {
- candidates.push({wayID: way.id, index: 0});
- } else {
- way.nodes.forEach(function(waynode, index) {
- if (waynode === nodeId) {
- candidates.push({wayID: way.id, index: index});
- }
- });
+ }
+ return item;
+ }
+ }
+ }
+ lheading(src) {
+ const cap = this.rules.block.lheading.exec(src);
+ if (cap) {
+ const token = {
+ type: "heading",
+ raw: cap[0],
+ depth: cap[2].charAt(0) === "=" ? 1 : 2,
+ text: cap[1],
+ tokens: []
+ };
+ this.lexer.inline(token.text, token.tokens);
+ return token;
+ }
+ }
+ paragraph(src) {
+ const cap = this.rules.block.paragraph.exec(src);
+ if (cap) {
+ const token = {
+ type: "paragraph",
+ raw: cap[0],
+ text: cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1],
+ tokens: []
+ };
+ this.lexer.inline(token.text, token.tokens);
+ return token;
+ }
+ }
+ text(src) {
+ const cap = this.rules.block.text.exec(src);
+ if (cap) {
+ const token = {
+ type: "text",
+ raw: cap[0],
+ text: cap[0],
+ tokens: []
+ };
+ this.lexer.inline(token.text, token.tokens);
+ return token;
+ }
+ }
+ escape(src) {
+ const cap = this.rules.inline.escape.exec(src);
+ if (cap) {
+ return {
+ type: "escape",
+ raw: cap[0],
+ text: escape4(cap[1])
+ };
+ }
+ }
+ tag(src) {
+ const cap = this.rules.inline.tag.exec(src);
+ if (cap) {
+ if (!this.lexer.state.inLink && /^/i.test(cap[0])) {
+ this.lexer.state.inLink = false;
+ }
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
+ this.lexer.state.inRawBlock = true;
+ } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
+ this.lexer.state.inRawBlock = false;
+ }
+ return {
+ type: this.options.sanitize ? "text" : "html",
+ raw: cap[0],
+ inLink: this.lexer.state.inLink,
+ inRawBlock: this.lexer.state.inRawBlock,
+ text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
+ };
+ }
+ }
+ link(src) {
+ const cap = this.rules.inline.link.exec(src);
+ if (cap) {
+ const trimmedUrl = cap[2].trim();
+ if (!this.options.pedantic && /^$/.test(trimmedUrl)) {
+ return;
+ }
+ const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
+ return;
+ }
+ } else {
+ const lastParenIndex = findClosingBracket(cap[2], "()");
+ if (lastParenIndex > -1) {
+ const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
+ const linkLen = start2 + cap[1].length + lastParenIndex;
+ cap[2] = cap[2].substring(0, lastParenIndex);
+ cap[0] = cap[0].substring(0, linkLen).trim();
+ cap[3] = "";
+ }
+ }
+ let href = cap[2];
+ let title = "";
+ if (this.options.pedantic) {
+ const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
+ if (link2) {
+ href = link2[1];
+ title = link2[3];
+ }
+ } else {
+ title = cap[3] ? cap[3].slice(1, -1) : "";
+ }
+ href = href.trim();
+ if (/^$/.test(trimmedUrl)) {
+ href = href.slice(1);
+ } else {
+ href = href.slice(1, -1);
+ }
+ }
+ return outputLink(cap, {
+ href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
+ title: title ? title.replace(this.rules.inline._escapes, "$1") : title
+ }, cap[0], this.lexer);
+ }
+ }
+ reflink(src, links) {
+ let cap;
+ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
+ let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
+ link2 = links[link2.toLowerCase()];
+ if (!link2 || !link2.href) {
+ const text2 = cap[0].charAt(0);
+ return {
+ type: "text",
+ raw: text2,
+ text: text2
+ };
+ }
+ return outputLink(cap, link2, cap[0], this.lexer);
+ }
+ }
+ emStrong(src, maskedSrc, prevChar = "") {
+ let match = this.rules.inline.emStrong.lDelim.exec(src);
+ if (!match)
+ return;
+ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
+ return;
+ const nextChar = match[1] || match[2] || "";
+ if (!nextChar || nextChar && (prevChar === "" || this.rules.inline.punctuation.exec(prevChar))) {
+ const lLength = match[0].length - 1;
+ let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
+ const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
+ endReg.lastIndex = 0;
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
+ while ((match = endReg.exec(maskedSrc)) != null) {
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
+ if (!rDelim)
+ continue;
+ rLength = rDelim.length;
+ if (match[3] || match[4]) {
+ delimTotal += rLength;
+ continue;
+ } else if (match[5] || match[6]) {
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
+ midDelimTotal += rLength;
+ continue;
}
- });
-
- return keeping ? candidates : candidates.slice(1);
- };
-
- action.disabled = function(graph) {
- var connections = action.connections(graph);
- if (connections.length === 0 || (wayIds && wayIds.length !== connections.length))
- return 'not_connected';
-
- var parentWays = graph.parentWays(graph.entity(nodeId)),
- seenRelationIds = {},
- sharedRelation;
-
- parentWays.forEach(function(way) {
- if (wayIds && wayIds.indexOf(way.id) === -1)
- return;
-
- var relations = graph.parentRelations(way);
- relations.forEach(function(relation) {
- if (relation.id in seenRelationIds) {
- sharedRelation = relation;
- } else {
- seenRelationIds[relation.id] = true;
- }
- });
- });
-
- if (sharedRelation)
- return 'relation';
- };
-
- action.limitWays = function(_) {
- if (!arguments.length) return wayIds;
- wayIds = _;
- return action;
- };
-
- return action;
-};
-// Join ways at the end node they share.
-//
-// This is the inverse of `iD.actions.Split`.
-//
-// Reference:
-// https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MergeWaysAction.as
-// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/actions/CombineWayAction.java
-//
-iD.actions.Join = function(ids) {
-
- function groupEntitiesByGeometry(graph) {
- var entities = ids.map(function(id) { return graph.entity(id); });
- return _.extend({line: []}, _.groupBy(entities, function(entity) { return entity.geometry(graph); }));
+ }
+ delimTotal -= rLength;
+ if (delimTotal > 0)
+ continue;
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
+ if (Math.min(lLength, rLength) % 2) {
+ const text3 = src.slice(1, lLength + match.index + rLength);
+ return {
+ type: "em",
+ raw: src.slice(0, lLength + match.index + rLength + 1),
+ text: text3,
+ tokens: this.lexer.inlineTokens(text3, [])
+ };
+ }
+ const text2 = src.slice(2, lLength + match.index + rLength - 1);
+ return {
+ type: "strong",
+ raw: src.slice(0, lLength + match.index + rLength + 1),
+ text: text2,
+ tokens: this.lexer.inlineTokens(text2, [])
+ };
+ }
+ }
}
-
- var action = function(graph) {
- var ways = ids.map(graph.entity, graph),
- survivor = ways[0];
-
- // Prefer to keep an existing way.
- for (var i = 0; i < ways.length; i++) {
- if (!ways[i].isNew()) {
- survivor = ways[i];
- break;
+ codespan(src) {
+ const cap = this.rules.inline.code.exec(src);
+ if (cap) {
+ let text2 = cap[2].replace(/\n/g, " ");
+ const hasNonSpaceChars = /[^ ]/.test(text2);
+ const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
+ text2 = text2.substring(1, text2.length - 1);
+ }
+ text2 = escape4(text2, true);
+ return {
+ type: "codespan",
+ raw: cap[0],
+ text: text2
+ };
+ }
+ }
+ br(src) {
+ const cap = this.rules.inline.br.exec(src);
+ if (cap) {
+ return {
+ type: "br",
+ raw: cap[0]
+ };
+ }
+ }
+ del(src) {
+ const cap = this.rules.inline.del.exec(src);
+ if (cap) {
+ return {
+ type: "del",
+ raw: cap[0],
+ text: cap[2],
+ tokens: this.lexer.inlineTokens(cap[2], [])
+ };
+ }
+ }
+ autolink(src, mangle2) {
+ const cap = this.rules.inline.autolink.exec(src);
+ if (cap) {
+ let text2, href;
+ if (cap[2] === "@") {
+ text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
+ href = "mailto:" + text2;
+ } else {
+ text2 = escape4(cap[1]);
+ href = text2;
+ }
+ return {
+ type: "link",
+ raw: cap[0],
+ text: text2,
+ href,
+ tokens: [
+ {
+ type: "text",
+ raw: text2,
+ text: text2
}
+ ]
+ };
+ }
+ }
+ url(src, mangle2) {
+ let cap;
+ if (cap = this.rules.inline.url.exec(src)) {
+ let text2, href;
+ if (cap[2] === "@") {
+ text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
+ href = "mailto:" + text2;
+ } else {
+ let prevCapZero;
+ do {
+ prevCapZero = cap[0];
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
+ } while (prevCapZero !== cap[0]);
+ text2 = escape4(cap[0]);
+ if (cap[1] === "www.") {
+ href = "http://" + text2;
+ } else {
+ href = text2;
+ }
}
-
- var joined = iD.geo.joinWays(ways, graph)[0];
-
- survivor = survivor.update({nodes: _.map(joined.nodes, 'id')});
- graph = graph.replace(survivor);
-
- joined.forEach(function(way) {
- if (way.id === survivor.id)
- return;
-
- graph.parentRelations(way).forEach(function(parent) {
- graph = graph.replace(parent.replaceMember(way, survivor));
- });
-
- survivor = survivor.mergeTags(way.tags);
-
- graph = graph.replace(survivor);
- graph = iD.actions.DeleteWay(way.id)(graph);
- });
-
- return graph;
- };
-
- action.disabled = function(graph) {
- var geometries = groupEntitiesByGeometry(graph);
- if (ids.length < 2 || ids.length !== geometries.line.length)
- return 'not_eligible';
-
- var joined = iD.geo.joinWays(ids.map(graph.entity, graph), graph);
- if (joined.length > 1)
- return 'not_adjacent';
-
- var nodeIds = _.map(joined[0].nodes, 'id').slice(1, -1),
- relation,
- tags = {},
- conflicting = false;
-
- joined[0].forEach(function(way) {
- var parents = graph.parentRelations(way);
- parents.forEach(function(parent) {
- if (parent.isRestriction() && parent.members.some(function(m) { return nodeIds.indexOf(m.id) >= 0; }))
- relation = parent;
- });
-
- for (var k in way.tags) {
- if (!(k in tags)) {
- tags[k] = way.tags[k];
- } else if (tags[k] && iD.interestingTag(k) && tags[k] !== way.tags[k]) {
- conflicting = true;
- }
+ return {
+ type: "link",
+ raw: cap[0],
+ text: text2,
+ href,
+ tokens: [
+ {
+ type: "text",
+ raw: text2,
+ text: text2
}
- });
-
- if (relation)
- return 'restriction';
-
- if (conflicting)
- return 'conflicting_tags';
- };
-
- return action;
-};
-iD.actions.Merge = function(ids) {
- function groupEntitiesByGeometry(graph) {
- var entities = ids.map(function(id) { return graph.entity(id); });
- return _.extend({point: [], area: [], line: [], relation: []},
- _.groupBy(entities, function(entity) { return entity.geometry(graph); }));
+ ]
+ };
+ }
+ }
+ inlineText(src, smartypants2) {
+ const cap = this.rules.inline.text.exec(src);
+ if (cap) {
+ let text2;
+ if (this.lexer.state.inRawBlock) {
+ text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
+ } else {
+ text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
+ }
+ return {
+ type: "text",
+ raw: cap[0],
+ text: text2
+ };
+ }
+ }
+ };
+ var block = {
+ newline: /^(?: *(?:\n|$))+/,
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
+ hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
+ list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
+ html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
+ table: noopTest,
+ lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
+ text: /^[^\n]+/
+ };
+ block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
+ block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
+ block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
+ block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
+ block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex();
+ block._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
+ block._comment = /|$)/;
+ block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
+ block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
+ block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
+ block.normal = merge2({}, block);
+ block.gfm = merge2({}, block.normal, {
+ table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
+ });
+ block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
+ block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
+ block.pedantic = merge2({}, block.normal, {
+ html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
+ def: /^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
+ fences: noopTest,
+ paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
+ });
+ var inline = {
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
+ url: noopTest,
+ tag: "^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
+ reflink: /^!?\[(label)\]\[(ref)\]/,
+ nolink: /^!?\[(ref)\](?:\[\])?/,
+ reflinkSearch: "reflink|nolink(?!\\()",
+ emStrong: {
+ lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
+ rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
+ rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
+ },
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
+ br: /^( {2,}|\\)\n(?!\s*$)/,
+ del: noopTest,
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~";
+ inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
+ inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
+ inline.escapedEmSt = /\\\*|\\_/g;
+ inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
+ inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
+ inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "g").replace(/punct/g, inline._punctuation).getRegex();
+ inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "g").replace(/punct/g, inline._punctuation).getRegex();
+ inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
+ inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
+ inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
+ inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
+ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
+ inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
+ inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
+ inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
+ inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
+ inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
+ inline.normal = merge2({}, inline);
+ inline.pedantic = merge2({}, inline.normal, {
+ strong: {
+ start: /^__|\*\*/,
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+ endAst: /\*\*(?!\*)/g,
+ endUnd: /__(?!_)/g
+ },
+ em: {
+ start: /^_|\*/,
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
+ endAst: /\*(?!\*)/g,
+ endUnd: /_(?!_)/g
+ },
+ link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
+ });
+ inline.gfm = merge2({}, inline.normal, {
+ escape: edit(inline.escape).replace("])", "~|])").getRegex(),
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
+ _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ 0.5) {
+ ch = "x" + ch.toString(16);
+ }
+ out += "" + ch + ";";
+ }
+ return out;
+ }
+ var Lexer = class {
+ constructor(options2) {
+ this.tokens = [];
+ this.tokens.links = /* @__PURE__ */ Object.create(null);
+ this.options = options2 || defaults;
+ this.options.tokenizer = this.options.tokenizer || new Tokenizer();
+ this.tokenizer = this.options.tokenizer;
+ this.tokenizer.options = this.options;
+ this.tokenizer.lexer = this;
+ this.inlineQueue = [];
+ this.state = {
+ inLink: false,
+ inRawBlock: false,
+ top: true
+ };
+ const rules = {
+ block: block.normal,
+ inline: inline.normal
+ };
+ if (this.options.pedantic) {
+ rules.block = block.pedantic;
+ rules.inline = inline.pedantic;
+ } else if (this.options.gfm) {
+ rules.block = block.gfm;
+ if (this.options.breaks) {
+ rules.inline = inline.breaks;
+ } else {
+ rules.inline = inline.gfm;
+ }
+ }
+ this.tokenizer.rules = rules;
}
-
- var action = function(graph) {
- var geometries = groupEntitiesByGeometry(graph),
- target = geometries.area[0] || geometries.line[0],
- points = geometries.point;
-
- points.forEach(function(point) {
- target = target.mergeTags(point.tags);
-
- graph.parentRelations(point).forEach(function(parent) {
- graph = graph.replace(parent.replaceMember(point, target));
- });
-
- graph = graph.remove(point);
- });
-
- graph = graph.replace(target);
-
- return graph;
- };
-
- action.disabled = function(graph) {
- var geometries = groupEntitiesByGeometry(graph);
- if (geometries.point.length === 0 ||
- (geometries.area.length + geometries.line.length) !== 1 ||
- geometries.relation.length !== 0)
- return 'not_eligible';
- };
-
- return action;
-};
-iD.actions.MergePolygon = function(ids, newRelationId) {
-
- function groupEntities(graph) {
- var entities = ids.map(function (id) { return graph.entity(id); });
- return _.extend({
- closedWay: [],
- multipolygon: [],
- other: []
- }, _.groupBy(entities, function(entity) {
- if (entity.type === 'way' && entity.isClosed()) {
- return 'closedWay';
- } else if (entity.type === 'relation' && entity.isMultipolygon()) {
- return 'multipolygon';
- } else {
- return 'other';
- }
- }));
+ static get rules() {
+ return {
+ block,
+ inline
+ };
}
-
- var action = function(graph) {
- var entities = groupEntities(graph);
-
- // An array representing all the polygons that are part of the multipolygon.
- //
- // Each element is itself an array of objects with an id property, and has a
- // locs property which is an array of the locations forming the polygon.
- var polygons = entities.multipolygon.reduce(function(polygons, m) {
- return polygons.concat(iD.geo.joinWays(m.members, graph));
- }, []).concat(entities.closedWay.map(function(d) {
- var member = [{id: d.id}];
- member.nodes = graph.childNodes(d);
- return member;
- }));
-
- // contained is an array of arrays of boolean values,
- // where contained[j][k] is true iff the jth way is
- // contained by the kth way.
- var contained = polygons.map(function(w, i) {
- return polygons.map(function(d, n) {
- if (i === n) return null;
- return iD.geo.polygonContainsPolygon(
- _.map(d.nodes, 'loc'),
- _.map(w.nodes, 'loc'));
- });
+ static lex(src, options2) {
+ const lexer2 = new Lexer(options2);
+ return lexer2.lex(src);
+ }
+ static lexInline(src, options2) {
+ const lexer2 = new Lexer(options2);
+ return lexer2.inlineTokens(src);
+ }
+ lex(src) {
+ src = src.replace(/\r\n|\r/g, "\n");
+ this.blockTokens(src, this.tokens);
+ let next;
+ while (next = this.inlineQueue.shift()) {
+ this.inlineTokens(next.src, next.tokens);
+ }
+ return this.tokens;
+ }
+ blockTokens(src, tokens = []) {
+ if (this.options.pedantic) {
+ src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
+ } else {
+ src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
+ return leading + " ".repeat(tabs.length);
});
-
- // Sort all polygons as either outer or inner ways
- var members = [],
- outer = true;
-
- while (polygons.length) {
- extractUncontained(polygons);
- polygons = polygons.filter(isContained);
- contained = contained.filter(isContained).map(filterContained);
+ }
+ let token, lastToken, cutSrc, lastParagraphClipped;
+ while (src) {
+ if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
+ if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ return true;
+ }
+ return false;
+ })) {
+ continue;
}
-
- function isContained(d, i) {
- return _.some(contained[i]);
+ if (token = this.tokenizer.space(src)) {
+ src = src.substring(token.raw.length);
+ if (token.raw.length === 1 && tokens.length > 0) {
+ tokens[tokens.length - 1].raw += "\n";
+ } else {
+ tokens.push(token);
+ }
+ continue;
}
-
- function filterContained(d) {
- return d.filter(isContained);
+ if (token = this.tokenizer.code(src)) {
+ src = src.substring(token.raw.length);
+ lastToken = tokens[tokens.length - 1];
+ if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
+ lastToken.raw += "\n" + token.raw;
+ lastToken.text += "\n" + token.text;
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
+ } else {
+ tokens.push(token);
+ }
+ continue;
}
-
- function extractUncontained(polygons) {
- polygons.forEach(function(d, i) {
- if (!isContained(d, i)) {
- d.forEach(function(member) {
- members.push({
- type: 'way',
- id: member.id,
- role: outer ? 'outer' : 'inner'
- });
- });
- }
- });
- outer = !outer;
+ if (token = this.tokenizer.fences(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- // Move all tags to one relation
- var relation = entities.multipolygon[0] ||
- iD.Relation({ id: newRelationId, tags: { type: 'multipolygon' }});
-
- entities.multipolygon.slice(1).forEach(function(m) {
- relation = relation.mergeTags(m.tags);
- graph = graph.remove(m);
- });
-
- entities.closedWay.forEach(function(way) {
- function isThisOuter(m) {
- return m.id === way.id && m.role !== 'inner';
- }
- if (members.some(isThisOuter)) {
- relation = relation.mergeTags(way.tags);
- graph = graph.replace(way.update({ tags: {} }));
- }
- });
-
- return graph.replace(relation.update({
- members: members,
- tags: _.omit(relation.tags, 'area')
- }));
- };
-
- action.disabled = function(graph) {
- var entities = groupEntities(graph);
- if (entities.other.length > 0 ||
- entities.closedWay.length + entities.multipolygon.length < 2)
- return 'not_eligible';
- if (!entities.multipolygon.every(function(r) { return r.isComplete(graph); }))
- return 'incomplete_relation';
- };
-
- return action;
-};
-iD.actions.MergeRemoteChanges = function(id, localGraph, remoteGraph, formatUser) {
- var option = 'safe', // 'safe', 'force_local', 'force_remote'
- conflicts = [];
-
- function user(d) {
- return _.isFunction(formatUser) ? formatUser(d) : d;
- }
-
-
- function mergeLocation(remote, target) {
- function pointEqual(a, b) {
- var epsilon = 1e-6;
- return (Math.abs(a[0] - b[0]) < epsilon) && (Math.abs(a[1] - b[1]) < epsilon);
+ if (token = this.tokenizer.heading(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- if (option === 'force_local' || pointEqual(target.loc, remote.loc)) {
- return target;
+ if (token = this.tokenizer.hr(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
- if (option === 'force_remote') {
- return target.update({loc: remote.loc});
+ if (token = this.tokenizer.blockquote(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- conflicts.push(t('merge_remote_changes.conflict.location', { user: user(remote.user) }));
- return target;
- }
-
-
- function mergeNodes(base, remote, target) {
- if (option === 'force_local' || _.isEqual(target.nodes, remote.nodes)) {
- return target;
+ if (token = this.tokenizer.list(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
- if (option === 'force_remote') {
- return target.update({nodes: remote.nodes});
+ if (token = this.tokenizer.html(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- var ccount = conflicts.length,
- o = base.nodes || [],
- a = target.nodes || [],
- b = remote.nodes || [],
- nodes = [],
- hunks = Diff3.diff3_merge(a, o, b, true);
-
- for (var i = 0; i < hunks.length; i++) {
- var hunk = hunks[i];
- if (hunk.ok) {
- nodes.push.apply(nodes, hunk.ok);
- } else {
- // for all conflicts, we can assume c.a !== c.b
- // because `diff3_merge` called with `true` option to exclude false conflicts..
- var c = hunk.conflict;
- if (_.isEqual(c.o, c.a)) { // only changed remotely
- nodes.push.apply(nodes, c.b);
- } else if (_.isEqual(c.o, c.b)) { // only changed locally
- nodes.push.apply(nodes, c.a);
- } else { // changed both locally and remotely
- conflicts.push(t('merge_remote_changes.conflict.nodelist', { user: user(remote.user) }));
- break;
- }
- }
+ if (token = this.tokenizer.def(src)) {
+ src = src.substring(token.raw.length);
+ lastToken = tokens[tokens.length - 1];
+ if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
+ lastToken.raw += "\n" + token.raw;
+ lastToken.text += "\n" + token.raw;
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
+ } else if (!this.tokens.links[token.tag]) {
+ this.tokens.links[token.tag] = {
+ href: token.href,
+ title: token.title
+ };
+ }
+ continue;
}
-
- return (conflicts.length === ccount) ? target.update({nodes: nodes}) : target;
- }
-
-
- function mergeChildren(targetWay, children, updates, graph) {
- function isUsed(node, targetWay) {
- var parentWays = _.map(graph.parentWays(node), 'id');
- return node.hasInterestingTags() ||
- _.without(parentWays, targetWay.id).length > 0 ||
- graph.parentRelations(node).length > 0;
+ if (token = this.tokenizer.table(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- var ccount = conflicts.length;
-
- for (var i = 0; i < children.length; i++) {
- var id = children[i],
- node = graph.hasEntity(id);
-
- // remove unused childNodes..
- if (targetWay.nodes.indexOf(id) === -1) {
- if (node && !isUsed(node, targetWay)) {
- updates.removeIds.push(id);
- }
- continue;
+ if (token = this.tokenizer.lheading(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
+ }
+ cutSrc = src;
+ if (this.options.extensions && this.options.extensions.startBlock) {
+ let startIndex = Infinity;
+ const tempSrc = src.slice(1);
+ let tempStart;
+ this.options.extensions.startBlock.forEach(function(getStartIndex) {
+ tempStart = getStartIndex.call({ lexer: this }, tempSrc);
+ if (typeof tempStart === "number" && tempStart >= 0) {
+ startIndex = Math.min(startIndex, tempStart);
}
-
- // restore used childNodes..
- var local = localGraph.hasEntity(id),
- remote = remoteGraph.hasEntity(id),
- target;
-
- if (option === 'force_remote' && remote && remote.visible) {
- updates.replacements.push(remote);
-
- } else if (option === 'force_local' && local) {
- target = iD.Entity(local);
- if (remote) {
- target = target.update({ version: remote.version });
- }
- updates.replacements.push(target);
-
- } else if (option === 'safe' && local && remote && local.version !== remote.version) {
- target = iD.Entity(local, { version: remote.version });
- if (remote.visible) {
- target = mergeLocation(remote, target);
- } else {
- conflicts.push(t('merge_remote_changes.conflict.deleted', { user: user(remote.user) }));
- }
-
- if (conflicts.length !== ccount) break;
- updates.replacements.push(target);
+ });
+ if (startIndex < Infinity && startIndex >= 0) {
+ cutSrc = src.substring(0, startIndex + 1);
+ }
+ }
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
+ lastToken = tokens[tokens.length - 1];
+ if (lastParagraphClipped && lastToken.type === "paragraph") {
+ lastToken.raw += "\n" + token.raw;
+ lastToken.text += "\n" + token.text;
+ this.inlineQueue.pop();
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
+ } else {
+ tokens.push(token);
+ }
+ lastParagraphClipped = cutSrc.length !== src.length;
+ src = src.substring(token.raw.length);
+ continue;
+ }
+ if (token = this.tokenizer.text(src)) {
+ src = src.substring(token.raw.length);
+ lastToken = tokens[tokens.length - 1];
+ if (lastToken && lastToken.type === "text") {
+ lastToken.raw += "\n" + token.raw;
+ lastToken.text += "\n" + token.text;
+ this.inlineQueue.pop();
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
+ } else {
+ tokens.push(token);
+ }
+ continue;
+ }
+ if (src) {
+ const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
+ if (this.options.silent) {
+ console.error(errMsg);
+ break;
+ } else {
+ throw new Error(errMsg);
+ }
+ }
+ }
+ this.state.top = true;
+ return tokens;
+ }
+ inline(src, tokens) {
+ this.inlineQueue.push({ src, tokens });
+ }
+ inlineTokens(src, tokens = []) {
+ let token, lastToken, cutSrc;
+ let maskedSrc = src;
+ let match;
+ let keepPrevChar, prevChar;
+ if (this.tokens.links) {
+ const links = Object.keys(this.tokens.links);
+ if (links.length > 0) {
+ while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
+ if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
+ maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
}
+ }
}
-
- return targetWay;
- }
-
-
- function updateChildren(updates, graph) {
- for (var i = 0; i < updates.replacements.length; i++) {
- graph = graph.replace(updates.replacements[i]);
+ }
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
+ maskedSrc = maskedSrc.slice(0, match.index) + "[" + repeatString("a", match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
+ }
+ while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
+ maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
+ }
+ while (src) {
+ if (!keepPrevChar) {
+ prevChar = "";
+ }
+ keepPrevChar = false;
+ if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
+ if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ return true;
+ }
+ return false;
+ })) {
+ continue;
}
- if (updates.removeIds.length) {
- graph = iD.actions.DeleteMultiple(updates.removeIds)(graph);
+ if (token = this.tokenizer.escape(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
- return graph;
- }
-
-
- function mergeMembers(remote, target) {
- if (option === 'force_local' || _.isEqual(target.members, remote.members)) {
- return target;
+ if (token = this.tokenizer.tag(src)) {
+ src = src.substring(token.raw.length);
+ lastToken = tokens[tokens.length - 1];
+ if (lastToken && token.type === "text" && lastToken.type === "text") {
+ lastToken.raw += token.raw;
+ lastToken.text += token.text;
+ } else {
+ tokens.push(token);
+ }
+ continue;
}
- if (option === 'force_remote') {
- return target.update({members: remote.members});
+ if (token = this.tokenizer.link(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- conflicts.push(t('merge_remote_changes.conflict.memberlist', { user: user(remote.user) }));
- return target;
- }
-
-
- function mergeTags(base, remote, target) {
- function ignoreKey(k) {
- return _.includes(iD.data.discarded, k);
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
+ src = src.substring(token.raw.length);
+ lastToken = tokens[tokens.length - 1];
+ if (lastToken && token.type === "text" && lastToken.type === "text") {
+ lastToken.raw += token.raw;
+ lastToken.text += token.text;
+ } else {
+ tokens.push(token);
+ }
+ continue;
}
-
- if (option === 'force_local' || _.isEqual(target.tags, remote.tags)) {
- return target;
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
- if (option === 'force_remote') {
- return target.update({tags: remote.tags});
+ if (token = this.tokenizer.codespan(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- var ccount = conflicts.length,
- o = base.tags || {},
- a = target.tags || {},
- b = remote.tags || {},
- keys = _.reject(_.union(_.keys(o), _.keys(a), _.keys(b)), ignoreKey),
- tags = _.clone(a),
- changed = false;
-
- for (var i = 0; i < keys.length; i++) {
- var k = keys[i];
-
- if (o[k] !== b[k] && a[k] !== b[k]) { // changed remotely..
- if (o[k] !== a[k]) { // changed locally..
- conflicts.push(t('merge_remote_changes.conflict.tags',
- { tag: k, local: a[k], remote: b[k], user: user(remote.user) }));
-
- } else { // unchanged locally, accept remote change..
- if (b.hasOwnProperty(k)) {
- tags[k] = b[k];
- } else {
- delete tags[k];
- }
- changed = true;
- }
- }
+ if (token = this.tokenizer.br(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
}
-
- return (changed && conflicts.length === ccount) ? target.update({tags: tags}) : target;
- }
-
-
- // `graph.base()` is the common ancestor of the two graphs.
- // `localGraph` contains user's edits up to saving
- // `remoteGraph` contains remote edits to modified nodes
- // `graph` must be a descendent of `localGraph` and may include
- // some conflict resolution actions performed on it.
- //
- // --- ... --- `localGraph` -- ... -- `graph`
- // /
- // `graph.base()` --- ... --- `remoteGraph`
- //
- var action = function(graph) {
- var updates = { replacements: [], removeIds: [] },
- base = graph.base().entities[id],
- local = localGraph.entity(id),
- remote = remoteGraph.entity(id),
- target = iD.Entity(local, { version: remote.version });
-
- // delete/undelete
- if (!remote.visible) {
- if (option === 'force_remote') {
- return iD.actions.DeleteMultiple([id])(graph);
-
- } else if (option === 'force_local') {
- if (target.type === 'way') {
- target = mergeChildren(target, _.uniq(local.nodes), updates, graph);
- graph = updateChildren(updates, graph);
- }
- return graph.replace(target);
-
- } else {
- conflicts.push(t('merge_remote_changes.conflict.deleted', { user: user(remote.user) }));
- return graph; // do nothing
+ if (token = this.tokenizer.del(src)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
+ }
+ if (token = this.tokenizer.autolink(src, mangle)) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
+ }
+ if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
+ src = src.substring(token.raw.length);
+ tokens.push(token);
+ continue;
+ }
+ cutSrc = src;
+ if (this.options.extensions && this.options.extensions.startInline) {
+ let startIndex = Infinity;
+ const tempSrc = src.slice(1);
+ let tempStart;
+ this.options.extensions.startInline.forEach(function(getStartIndex) {
+ tempStart = getStartIndex.call({ lexer: this }, tempSrc);
+ if (typeof tempStart === "number" && tempStart >= 0) {
+ startIndex = Math.min(startIndex, tempStart);
}
+ });
+ if (startIndex < Infinity && startIndex >= 0) {
+ cutSrc = src.substring(0, startIndex + 1);
+ }
}
-
- // merge
- if (target.type === 'node') {
- target = mergeLocation(remote, target);
-
- } else if (target.type === 'way') {
- // pull in any child nodes that may not be present locally..
- graph.rebase(remoteGraph.childNodes(remote), [graph], false);
- target = mergeNodes(base, remote, target);
- target = mergeChildren(target, _.union(local.nodes, remote.nodes), updates, graph);
-
- } else if (target.type === 'relation') {
- target = mergeMembers(remote, target);
+ if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
+ src = src.substring(token.raw.length);
+ if (token.raw.slice(-1) !== "_") {
+ prevChar = token.raw.slice(-1);
+ }
+ keepPrevChar = true;
+ lastToken = tokens[tokens.length - 1];
+ if (lastToken && lastToken.type === "text") {
+ lastToken.raw += token.raw;
+ lastToken.text += token.text;
+ } else {
+ tokens.push(token);
+ }
+ continue;
}
-
- target = mergeTags(base, remote, target);
-
- if (!conflicts.length) {
- graph = updateChildren(updates, graph).replace(target);
+ if (src) {
+ const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
+ if (this.options.silent) {
+ console.error(errMsg);
+ break;
+ } else {
+ throw new Error(errMsg);
+ }
}
-
- return graph;
- };
-
- action.withOption = function(opt) {
- option = opt;
- return action;
- };
-
- action.conflicts = function() {
- return conflicts;
- };
-
- return action;
-};
-// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/command/MoveCommand.java
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MoveNodeAction.as
-iD.actions.Move = function(moveIds, tryDelta, projection, cache) {
- var delta = tryDelta;
-
- function vecAdd(a, b) { return [a[0] + b[0], a[1] + b[1]]; }
- function vecSub(a, b) { return [a[0] - b[0], a[1] - b[1]]; }
-
- function setupCache(graph) {
- function canMove(nodeId) {
- var parents = _.map(graph.parentWays(graph.entity(nodeId)), 'id');
- if (parents.length < 3) return true;
-
- // Don't move a vertex where >2 ways meet, unless all parentWays are moving too..
- var parentsMoving = _.all(parents, function(id) { return cache.moving[id]; });
- if (!parentsMoving) delete cache.moving[nodeId];
-
- return parentsMoving;
+ }
+ return tokens;
+ }
+ };
+ var Renderer = class {
+ constructor(options2) {
+ this.options = options2 || defaults;
+ }
+ code(code, infostring, escaped) {
+ const lang = (infostring || "").match(/\S*/)[0];
+ if (this.options.highlight) {
+ const out = this.options.highlight(code, lang);
+ if (out != null && out !== code) {
+ escaped = true;
+ code = out;
+ }
+ }
+ code = code.replace(/\n$/, "") + "\n";
+ if (!lang) {
+ return "" + (escaped ? code : escape4(code, true)) + "
\n";
+ }
+ return '' + (escaped ? code : escape4(code, true)) + "
\n";
+ }
+ blockquote(quote2) {
+ return `
+${quote2}
+`;
+ }
+ html(html2) {
+ return html2;
+ }
+ heading(text2, level, raw, slugger) {
+ if (this.options.headerIds) {
+ const id2 = this.options.headerPrefix + slugger.slug(raw);
+ return `${text2}
+`;
+ }
+ return `${text2}
+`;
+ }
+ hr() {
+ return this.options.xhtml ? "
\n" : "
\n";
+ }
+ list(body, ordered, start2) {
+ const type3 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
+ return "<" + type3 + startatt + ">\n" + body + "" + type3 + ">\n";
+ }
+ listitem(text2) {
+ return `${text2}
+`;
+ }
+ checkbox(checked) {
+ return " ";
+ }
+ paragraph(text2) {
+ return `${text2}
+`;
+ }
+ table(header, body) {
+ if (body)
+ body = `${body}`;
+ return "\n\n" + header + "\n" + body + "
\n";
+ }
+ tablerow(content) {
+ return `
+${content}
+`;
+ }
+ tablecell(content, flags) {
+ const type3 = flags.header ? "th" : "td";
+ const tag = flags.align ? `<${type3} align="${flags.align}">` : `<${type3}>`;
+ return tag + content + `${type3}>
+`;
+ }
+ strong(text2) {
+ return `${text2}`;
+ }
+ em(text2) {
+ return `${text2}`;
+ }
+ codespan(text2) {
+ return `${text2}
`;
+ }
+ br() {
+ return this.options.xhtml ? "
" : "
";
+ }
+ del(text2) {
+ return `${text2}`;
+ }
+ link(href, title, text2) {
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text2;
+ }
+ let out = '" + text2 + "";
+ return out;
+ }
+ image(href, title, text2) {
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
+ if (href === null) {
+ return text2;
+ }
+ let out = `
" : ">";
+ return out;
+ }
+ text(text2) {
+ return text2;
+ }
+ };
+ var TextRenderer = class {
+ strong(text2) {
+ return text2;
+ }
+ em(text2) {
+ return text2;
+ }
+ codespan(text2) {
+ return text2;
+ }
+ del(text2) {
+ return text2;
+ }
+ html(text2) {
+ return text2;
+ }
+ text(text2) {
+ return text2;
+ }
+ link(href, title, text2) {
+ return "" + text2;
+ }
+ image(href, title, text2) {
+ return "" + text2;
+ }
+ br() {
+ return "";
+ }
+ };
+ var Slugger = class {
+ constructor() {
+ this.seen = {};
+ }
+ serialize(value) {
+ return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
+ }
+ getNextSafeSlug(originalSlug, isDryRun) {
+ let slug = originalSlug;
+ let occurenceAccumulator = 0;
+ if (this.seen.hasOwnProperty(slug)) {
+ occurenceAccumulator = this.seen[originalSlug];
+ do {
+ occurenceAccumulator++;
+ slug = originalSlug + "-" + occurenceAccumulator;
+ } while (this.seen.hasOwnProperty(slug));
+ }
+ if (!isDryRun) {
+ this.seen[originalSlug] = occurenceAccumulator;
+ this.seen[slug] = 0;
+ }
+ return slug;
+ }
+ slug(value, options2 = {}) {
+ const slug = this.serialize(value);
+ return this.getNextSafeSlug(slug, options2.dryrun);
+ }
+ };
+ var Parser = class {
+ constructor(options2) {
+ this.options = options2 || defaults;
+ this.options.renderer = this.options.renderer || new Renderer();
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+ this.textRenderer = new TextRenderer();
+ this.slugger = new Slugger();
+ }
+ static parse(tokens, options2) {
+ const parser3 = new Parser(options2);
+ return parser3.parse(tokens);
+ }
+ static parseInline(tokens, options2) {
+ const parser3 = new Parser(options2);
+ return parser3.parseInline(tokens);
+ }
+ parse(tokens, top = true) {
+ let out = "", i2, j2, k, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
+ const l = tokens.length;
+ for (i2 = 0; i2 < l; i2++) {
+ token = tokens[i2];
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
+ ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
+ if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
+ out += ret || "";
+ continue;
+ }
}
-
- function cacheEntities(ids) {
- _.each(ids, function(id) {
- if (cache.moving[id]) return;
- cache.moving[id] = true;
-
- var entity = graph.hasEntity(id);
- if (!entity) return;
-
- if (entity.type === 'node') {
- cache.nodes.push(id);
- cache.startLoc[id] = entity.loc;
- } else if (entity.type === 'way') {
- cache.ways.push(id);
- cacheEntities(entity.nodes);
+ switch (token.type) {
+ case "space": {
+ continue;
+ }
+ case "hr": {
+ out += this.renderer.hr();
+ continue;
+ }
+ case "heading": {
+ out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
+ continue;
+ }
+ case "code": {
+ out += this.renderer.code(token.text, token.lang, token.escaped);
+ continue;
+ }
+ case "table": {
+ header = "";
+ cell = "";
+ l2 = token.header.length;
+ for (j2 = 0; j2 < l2; j2++) {
+ cell += this.renderer.tablecell(this.parseInline(token.header[j2].tokens), { header: true, align: token.align[j2] });
+ }
+ header += this.renderer.tablerow(cell);
+ body = "";
+ l2 = token.rows.length;
+ for (j2 = 0; j2 < l2; j2++) {
+ row = token.rows[j2];
+ cell = "";
+ l3 = row.length;
+ for (k = 0; k < l3; k++) {
+ cell += this.renderer.tablecell(this.parseInline(row[k].tokens), { header: false, align: token.align[k] });
+ }
+ body += this.renderer.tablerow(cell);
+ }
+ out += this.renderer.table(header, body);
+ continue;
+ }
+ case "blockquote": {
+ body = this.parse(token.tokens);
+ out += this.renderer.blockquote(body);
+ continue;
+ }
+ case "list": {
+ ordered = token.ordered;
+ start2 = token.start;
+ loose = token.loose;
+ l2 = token.items.length;
+ body = "";
+ for (j2 = 0; j2 < l2; j2++) {
+ item = token.items[j2];
+ checked = item.checked;
+ task = item.task;
+ itemBody = "";
+ if (item.task) {
+ checkbox = this.renderer.checkbox(checked);
+ if (loose) {
+ if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
+ item.tokens[0].text = checkbox + " " + item.tokens[0].text;
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
+ item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
+ }
+ } else {
+ item.tokens.unshift({
+ type: "text",
+ text: checkbox
+ });
+ }
} else {
- cacheEntities(_.map(entity.members, 'id'));
+ itemBody += checkbox;
}
- });
- }
-
- function cacheIntersections(ids) {
- function isEndpoint(way, id) { return !way.isClosed() && !!way.affix(id); }
-
- _.each(ids, function(id) {
- // consider only intersections with 1 moved and 1 unmoved way.
- _.each(graph.childNodes(graph.entity(id)), function(node) {
- var parents = graph.parentWays(node);
- if (parents.length !== 2) return;
-
- var moved = graph.entity(id),
- unmoved = _.find(parents, function(way) { return !cache.moving[way.id]; });
- if (!unmoved) return;
-
- // exclude ways that are overly connected..
- if (_.intersection(moved.nodes, unmoved.nodes).length > 2) return;
-
- if (moved.isArea() || unmoved.isArea()) return;
-
- cache.intersection[node.id] = {
- nodeId: node.id,
- movedId: moved.id,
- unmovedId: unmoved.id,
- movedIsEP: isEndpoint(moved, node.id),
- unmovedIsEP: isEndpoint(unmoved, node.id)
- };
- });
- });
+ }
+ itemBody += this.parse(item.tokens, loose);
+ body += this.renderer.listitem(itemBody, task, checked);
+ }
+ out += this.renderer.list(body, ordered, start2);
+ continue;
+ }
+ case "html": {
+ out += this.renderer.html(token.text);
+ continue;
+ }
+ case "paragraph": {
+ out += this.renderer.paragraph(this.parseInline(token.tokens));
+ continue;
+ }
+ case "text": {
+ body = token.tokens ? this.parseInline(token.tokens) : token.text;
+ while (i2 + 1 < l && tokens[i2 + 1].type === "text") {
+ token = tokens[++i2];
+ body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
+ }
+ out += top ? this.renderer.paragraph(body) : body;
+ continue;
+ }
+ default: {
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
+ if (this.options.silent) {
+ console.error(errMsg);
+ return;
+ } else {
+ throw new Error(errMsg);
+ }
+ }
}
-
-
- if (!cache) {
- cache = {};
+ }
+ return out;
+ }
+ parseInline(tokens, renderer) {
+ renderer = renderer || this.renderer;
+ let out = "", i2, token, ret;
+ const l = tokens.length;
+ for (i2 = 0; i2 < l; i2++) {
+ token = tokens[i2];
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
+ ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
+ if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
+ out += ret || "";
+ continue;
+ }
}
- if (!cache.ok) {
- cache.moving = {};
- cache.intersection = {};
- cache.replacedVertex = {};
- cache.startLoc = {};
- cache.nodes = [];
- cache.ways = [];
-
- cacheEntities(moveIds);
- cacheIntersections(cache.ways);
- cache.nodes = _.filter(cache.nodes, canMove);
-
- cache.ok = true;
+ switch (token.type) {
+ case "escape": {
+ out += renderer.text(token.text);
+ break;
+ }
+ case "html": {
+ out += renderer.html(token.text);
+ break;
+ }
+ case "link": {
+ out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
+ break;
+ }
+ case "image": {
+ out += renderer.image(token.href, token.title, token.text);
+ break;
+ }
+ case "strong": {
+ out += renderer.strong(this.parseInline(token.tokens, renderer));
+ break;
+ }
+ case "em": {
+ out += renderer.em(this.parseInline(token.tokens, renderer));
+ break;
+ }
+ case "codespan": {
+ out += renderer.codespan(token.text);
+ break;
+ }
+ case "br": {
+ out += renderer.br();
+ break;
+ }
+ case "del": {
+ out += renderer.del(this.parseInline(token.tokens, renderer));
+ break;
+ }
+ case "text": {
+ out += renderer.text(token.text);
+ break;
+ }
+ default: {
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
+ if (this.options.silent) {
+ console.error(errMsg);
+ return;
+ } else {
+ throw new Error(errMsg);
+ }
+ }
}
+ }
+ return out;
}
-
-
- // Place a vertex where the moved vertex used to be, to preserve way shape..
- function replaceMovedVertex(nodeId, wayId, graph, delta) {
- var way = graph.entity(wayId),
- moved = graph.entity(nodeId),
- movedIndex = way.nodes.indexOf(nodeId),
- len, prevIndex, nextIndex;
-
- if (way.isClosed()) {
- len = way.nodes.length - 1;
- prevIndex = (movedIndex + len - 1) % len;
- nextIndex = (movedIndex + len + 1) % len;
- } else {
- len = way.nodes.length;
- prevIndex = movedIndex - 1;
- nextIndex = movedIndex + 1;
- }
-
- var prev = graph.hasEntity(way.nodes[prevIndex]),
- next = graph.hasEntity(way.nodes[nextIndex]);
-
- // Don't add orig vertex at endpoint..
- if (!prev || !next) return graph;
-
- var key = wayId + '_' + nodeId,
- orig = cache.replacedVertex[key];
- if (!orig) {
- orig = iD.Node();
- cache.replacedVertex[key] = orig;
- cache.startLoc[orig.id] = cache.startLoc[nodeId];
- }
-
- var start, end;
- if (delta) {
- start = projection(cache.startLoc[nodeId]);
- end = projection.invert(vecAdd(start, delta));
- } else {
- end = cache.startLoc[nodeId];
- }
- orig = orig.move(end);
-
- var angle = Math.abs(iD.geo.angle(orig, prev, projection) -
- iD.geo.angle(orig, next, projection)) * 180 / Math.PI;
-
- // Don't add orig vertex if it would just make a straight line..
- if (angle > 175 && angle < 185) return graph;
-
- // Don't add orig vertex if another point is already nearby (within 10m)
- if (iD.geo.sphericalDistance(prev.loc, orig.loc) < 10 ||
- iD.geo.sphericalDistance(orig.loc, next.loc) < 10) return graph;
-
- // moving forward or backward along way?
- var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection),
- p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection),
- d1 = iD.geo.pathLength(p1),
- d2 = iD.geo.pathLength(p2),
- insertAt = (d1 < d2) ? movedIndex : nextIndex;
-
- // moving around closed loop?
- if (way.isClosed() && insertAt === 0) insertAt = len;
-
- way = way.addNode(orig.id, insertAt);
- return graph.replace(orig).replace(way);
+ };
+ function marked(src, opt, callback) {
+ if (typeof src === "undefined" || src === null) {
+ throw new Error("marked(): input parameter is undefined or null");
}
-
- // Reorder nodes around intersections that have moved..
- function unZorroIntersection(intersection, graph) {
- var vertex = graph.entity(intersection.nodeId),
- way1 = graph.entity(intersection.movedId),
- way2 = graph.entity(intersection.unmovedId),
- isEP1 = intersection.movedIsEP,
- isEP2 = intersection.unmovedIsEP;
-
- // don't move the vertex if it is the endpoint of both ways.
- if (isEP1 && isEP2) return graph;
-
- var nodes1 = _.without(graph.childNodes(way1), vertex),
- nodes2 = _.without(graph.childNodes(way2), vertex);
-
- if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
- if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
-
- var edge1 = !isEP1 && iD.geo.chooseEdge(nodes1, projection(vertex.loc), projection),
- edge2 = !isEP2 && iD.geo.chooseEdge(nodes2, projection(vertex.loc), projection),
- loc;
-
- // snap vertex to nearest edge (or some point between them)..
- if (!isEP1 && !isEP2) {
- var epsilon = 1e-4, maxIter = 10;
- for (var i = 0; i < maxIter; i++) {
- loc = iD.geo.interp(edge1.loc, edge2.loc, 0.5);
- edge1 = iD.geo.chooseEdge(nodes1, projection(loc), projection);
- edge2 = iD.geo.chooseEdge(nodes2, projection(loc), projection);
- if (Math.abs(edge1.distance - edge2.distance) < epsilon) break;
- }
- } else if (!isEP1) {
- loc = edge1.loc;
- } else {
- loc = edge2.loc;
- }
-
- graph = graph.replace(vertex.move(loc));
-
- // if zorro happened, reorder nodes..
- if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
- way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
- graph = graph.replace(way1);
- }
- if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
- way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
- graph = graph.replace(way2);
- }
-
- return graph;
+ if (typeof src !== "string") {
+ throw new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
}
-
-
- function cleanupIntersections(graph) {
- _.each(cache.intersection, function(obj) {
- graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, delta);
- graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
- graph = unZorroIntersection(obj, graph);
- });
-
- return graph;
+ if (typeof opt === "function") {
+ callback = opt;
+ opt = null;
}
-
- // check if moving way endpoint can cross an unmoved way, if so limit delta..
- function limitDelta(graph) {
- _.each(cache.intersection, function(obj) {
- if (!obj.movedIsEP) return;
-
- var node = graph.entity(obj.nodeId),
- start = projection(node.loc),
- end = vecAdd(start, delta),
- movedNodes = graph.childNodes(graph.entity(obj.movedId)),
- movedPath = _.map(_.map(movedNodes, 'loc'),
- function(loc) { return vecAdd(projection(loc), delta); }),
- unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId)),
- unmovedPath = _.map(_.map(unmovedNodes, 'loc'), projection),
- hits = iD.geo.pathIntersections(movedPath, unmovedPath);
-
- for (var i = 0; i < hits.length; i++) {
- if (_.isEqual(hits[i], end)) continue;
- var edge = iD.geo.chooseEdge(unmovedNodes, end, projection);
- delta = vecSub(projection(edge.loc), start);
+ opt = merge2({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation(opt);
+ if (callback) {
+ const highlight = opt.highlight;
+ let tokens;
+ try {
+ tokens = Lexer.lex(src, opt);
+ } catch (e) {
+ return callback(e);
+ }
+ const done = function(err) {
+ let out;
+ if (!err) {
+ try {
+ if (opt.walkTokens) {
+ marked.walkTokens(tokens, opt.walkTokens);
}
- });
- }
-
-
- var action = function(graph) {
- if (delta[0] === 0 && delta[1] === 0) return graph;
-
- setupCache(graph);
-
- if (!_.isEmpty(cache.intersection)) {
- limitDelta(graph);
- }
-
- _.each(cache.nodes, function(id) {
- var node = graph.entity(id),
- start = projection(node.loc),
- end = vecAdd(start, delta);
- graph = graph.replace(node.move(projection.invert(end)));
- });
-
- if (!_.isEmpty(cache.intersection)) {
- graph = cleanupIntersections(graph);
+ out = Parser.parse(tokens, opt);
+ } catch (e) {
+ err = e;
+ }
}
-
- return graph;
- };
-
- action.disabled = function(graph) {
- function incompleteRelation(id) {
- var entity = graph.entity(id);
- return entity.type === 'relation' && !entity.isComplete(graph);
+ opt.highlight = highlight;
+ return err ? callback(err) : callback(null, out);
+ };
+ if (!highlight || highlight.length < 3) {
+ return done();
+ }
+ delete opt.highlight;
+ if (!tokens.length)
+ return done();
+ let pending = 0;
+ marked.walkTokens(tokens, function(token) {
+ if (token.type === "code") {
+ pending++;
+ setTimeout(() => {
+ highlight(token.text, token.lang, function(err, code) {
+ if (err) {
+ return done(err);
+ }
+ if (code != null && code !== token.text) {
+ token.text = code;
+ token.escaped = true;
+ }
+ pending--;
+ if (pending === 0) {
+ done();
+ }
+ });
+ }, 0);
}
-
- if (_.some(moveIds, incompleteRelation))
- return 'incomplete_relation';
- };
-
- action.delta = function() {
- return delta;
- };
-
- return action;
-};
-// https://github.com/openstreetmap/josm/blob/mirror/src/org/openstreetmap/josm/command/MoveCommand.java
-// https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/MoveNodeAction.as
-iD.actions.MoveNode = function(nodeId, loc) {
- return function(graph) {
- return graph.replace(graph.entity(nodeId).move(loc));
- };
-};
-iD.actions.Noop = function() {
- return function(graph) {
- return graph;
- };
-};
-/*
- * Based on https://github.com/openstreetmap/potlatch2/blob/master/net/systemeD/potlatch2/tools/Quadrilateralise.as
- */
-
-iD.actions.Orthogonalize = function(wayId, projection) {
- var threshold = 12, // degrees within right or straight to alter
- lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180),
- upperThreshold = Math.cos(threshold * Math.PI / 180);
-
- var action = function(graph) {
- 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;
-
- if (nodes.length === 4) {
- for (i = 0; i < 1000; i++) {
- motions = points.map(calcMotion);
- points[corner.i] = addPoints(points[corner.i],motions[corner.i]);
- score = corner.dotp;
- if (score < epsilon) {
- break;
+ });
+ if (pending === 0) {
+ done();
+ }
+ return;
+ }
+ try {
+ const tokens = Lexer.lex(src, opt);
+ if (opt.walkTokens) {
+ marked.walkTokens(tokens, opt.walkTokens);
+ }
+ return Parser.parse(tokens, opt);
+ } catch (e) {
+ e.message += "\nPlease report this to https://github.com/markedjs/marked.";
+ if (opt.silent) {
+ return "An error occurred:
" + escape4(e.message + "", true) + "
";
+ }
+ throw e;
+ }
+ }
+ marked.options = marked.setOptions = function(opt) {
+ merge2(marked.defaults, opt);
+ changeDefaults(marked.defaults);
+ return marked;
+ };
+ marked.getDefaults = getDefaults;
+ marked.defaults = defaults;
+ marked.use = function(...args) {
+ const opts = merge2({}, ...args);
+ const extensions = marked.defaults.extensions || { renderers: {}, childTokens: {} };
+ let hasExtensions;
+ args.forEach((pack) => {
+ if (pack.extensions) {
+ hasExtensions = true;
+ pack.extensions.forEach((ext) => {
+ if (!ext.name) {
+ throw new Error("extension name required");
+ }
+ if (ext.renderer) {
+ const prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
+ if (prevRenderer) {
+ extensions.renderers[ext.name] = function(...args2) {
+ let ret = ext.renderer.apply(this, args2);
+ if (ret === false) {
+ ret = prevRenderer.apply(this, args2);
}
+ return ret;
+ };
+ } else {
+ extensions.renderers[ext.name] = ext.renderer;
}
-
- graph = graph.replace(graph.entity(nodes[corner.i].id)
- .move(projection.invert(points[corner.i])));
- } else {
- var best,
- originalPoints = _.clone(points);
- score = Infinity;
-
- for (i = 0; i < 1000; i++) {
- motions = points.map(calcMotion);
- for (j = 0; j < motions.length; j++) {
- points[j] = addPoints(points[j],motions[j]);
- }
- var newScore = squareness(points);
- if (newScore < score) {
- best = _.clone(points);
- score = newScore;
- }
- if (score < epsilon) {
- break;
- }
+ }
+ if (ext.tokenizer) {
+ if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
+ throw new Error("extension level must be 'block' or 'inline'");
}
-
- points = best;
-
- 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])));
- }
+ if (extensions[ext.level]) {
+ extensions[ext.level].unshift(ext.tokenizer);
+ } else {
+ extensions[ext.level] = [ext.tokenizer];
}
-
- // remove empty nodes on straight sections
- for (i = 0; i < points.length; i++) {
- var node = nodes[i];
-
- if (graph.parentWays(node).length > 1 ||
- graph.parentRelations(node).length ||
- node.hasInterestingTags()) {
-
- continue;
+ if (ext.start) {
+ if (ext.level === "block") {
+ if (extensions.startBlock) {
+ extensions.startBlock.push(ext.start);
+ } else {
+ extensions.startBlock = [ext.start];
}
-
- var dotp = normalizedDotProduct(i, points);
- if (dotp < -1 + epsilon) {
- graph = iD.actions.DeleteNode(nodes[i].id)(graph);
+ } else if (ext.level === "inline") {
+ if (extensions.startInline) {
+ extensions.startInline.push(ext.start);
+ } else {
+ extensions.startInline = [ext.start];
}
+ }
+ }
+ }
+ if (ext.childTokens) {
+ extensions.childTokens[ext.name] = ext.childTokens;
+ }
+ });
+ }
+ if (pack.renderer) {
+ const renderer = marked.defaults.renderer || new Renderer();
+ for (const prop in pack.renderer) {
+ const prevRenderer = renderer[prop];
+ renderer[prop] = (...args2) => {
+ let ret = pack.renderer[prop].apply(renderer, args2);
+ if (ret === false) {
+ ret = prevRenderer.apply(renderer, args2);
}
+ return ret;
+ };
}
-
- return graph;
-
- function calcMotion(b, i, array) {
- var a = array[(i - 1 + array.length) % array.length],
- c = array[(i + 1) % array.length],
- p = subtractPoints(a, b),
- q = subtractPoints(c, b),
- scale, dotp;
-
- scale = 2 * Math.min(iD.geo.euclideanDistance(p, [0, 0]), iD.geo.euclideanDistance(q, [0, 0]));
- p = normalizePoint(p, 1.0);
- q = normalizePoint(q, 1.0);
-
- dotp = filterDotProduct(p[0] * q[0] + p[1] * q[1]);
-
- // nasty hack to deal with almost-straight segments (angle is closer to 180 than to 90/270).
- if (array.length > 3) {
- if (dotp < -0.707106781186547) {
- dotp += 1.0;
- }
- } else if (dotp && Math.abs(dotp) < corner.dotp) {
- corner.i = i;
- corner.dotp = Math.abs(dotp);
+ opts.renderer = renderer;
+ }
+ if (pack.tokenizer) {
+ const tokenizer = marked.defaults.tokenizer || new Tokenizer();
+ for (const prop in pack.tokenizer) {
+ const prevTokenizer = tokenizer[prop];
+ tokenizer[prop] = (...args2) => {
+ let ret = pack.tokenizer[prop].apply(tokenizer, args2);
+ if (ret === false) {
+ ret = prevTokenizer.apply(tokenizer, args2);
}
-
- return normalizePoint(addPoints(p, q), 0.1 * dotp * scale);
+ return ret;
+ };
+ }
+ opts.tokenizer = tokenizer;
+ }
+ if (pack.walkTokens) {
+ const walkTokens2 = marked.defaults.walkTokens;
+ opts.walkTokens = function(token) {
+ pack.walkTokens.call(this, token);
+ if (walkTokens2) {
+ walkTokens2.call(this, token);
+ }
+ };
+ }
+ if (hasExtensions) {
+ opts.extensions = extensions;
+ }
+ marked.setOptions(opts);
+ });
+ };
+ marked.walkTokens = function(tokens, callback) {
+ for (const token of tokens) {
+ callback.call(marked, token);
+ switch (token.type) {
+ case "table": {
+ for (const cell of token.header) {
+ marked.walkTokens(cell.tokens, callback);
+ }
+ for (const row of token.rows) {
+ for (const cell of row) {
+ marked.walkTokens(cell.tokens, callback);
+ }
+ }
+ break;
+ }
+ case "list": {
+ marked.walkTokens(token.items, callback);
+ break;
+ }
+ default: {
+ if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
+ marked.defaults.extensions.childTokens[token.type].forEach(function(childTokens) {
+ marked.walkTokens(token[childTokens], callback);
+ });
+ } else if (token.tokens) {
+ marked.walkTokens(token.tokens, callback);
+ }
+ }
+ }
+ }
+ };
+ marked.parseInline = function(src, opt) {
+ if (typeof src === "undefined" || src === null) {
+ throw new Error("marked.parseInline(): input parameter is undefined or null");
+ }
+ if (typeof src !== "string") {
+ throw new Error("marked.parseInline(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected");
+ }
+ opt = merge2({}, marked.defaults, opt || {});
+ checkSanitizeDeprecation(opt);
+ try {
+ const tokens = Lexer.lexInline(src, opt);
+ if (opt.walkTokens) {
+ marked.walkTokens(tokens, opt.walkTokens);
+ }
+ return Parser.parseInline(tokens, opt);
+ } catch (e) {
+ e.message += "\nPlease report this to https://github.com/markedjs/marked.";
+ if (opt.silent) {
+ return "An error occurred:
" + escape4(e.message + "", true) + "
";
+ }
+ throw e;
+ }
+ };
+ marked.Parser = Parser;
+ marked.parser = Parser.parse;
+ marked.Renderer = Renderer;
+ marked.TextRenderer = TextRenderer;
+ marked.Lexer = Lexer;
+ marked.lexer = Lexer.lex;
+ marked.Tokenizer = Tokenizer;
+ marked.Slugger = Slugger;
+ marked.parse = marked;
+ var options = marked.options;
+ var setOptions = marked.setOptions;
+ var use = marked.use;
+ var walkTokens = marked.walkTokens;
+ var parseInline = marked.parseInline;
+ var parser2 = Parser.parse;
+ var lexer = Lexer.lex;
+
+ // modules/services/osmose.js
+ var tiler3 = utilTiler();
+ var dispatch4 = dispatch_default("loaded");
+ var _tileZoom3 = 14;
+ var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
+ var _osmoseData = { icons: {}, items: [] };
+ var _cache3;
+ function abortRequest3(controller) {
+ if (controller) {
+ controller.abort();
+ }
+ }
+ function abortUnwantedRequests3(cache, tiles) {
+ Object.keys(cache.inflightTile).forEach((k) => {
+ let wanted = tiles.find((tile) => k === tile.id);
+ if (!wanted) {
+ abortRequest3(cache.inflightTile[k]);
+ delete cache.inflightTile[k];
+ }
+ });
+ }
+ function encodeIssueRtree3(d) {
+ return { minX: d.loc[0], minY: d.loc[1], maxX: d.loc[0], maxY: d.loc[1], data: d };
+ }
+ function updateRtree3(item, replace) {
+ _cache3.rtree.remove(item, (a, b) => a.data.id === b.data.id);
+ if (replace) {
+ _cache3.rtree.insert(item);
+ }
+ }
+ function preventCoincident2(loc) {
+ let coincident = false;
+ do {
+ let delta = coincident ? [1e-5, 0] : [0, 1e-5];
+ loc = geoVecAdd(loc, delta);
+ let bbox = geoExtent(loc).bbox();
+ coincident = _cache3.rtree.search(bbox).length;
+ } while (coincident);
+ return loc;
+ }
+ var osmose_default = {
+ title: "osmose",
+ init() {
+ _mainFileFetcher.get("qa_data").then((d) => {
+ _osmoseData = d.osmose;
+ _osmoseData.items = Object.keys(d.osmose.icons).map((s) => s.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
+ });
+ if (!_cache3) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch4, "on");
+ },
+ reset() {
+ let _strings = {};
+ let _colors = {};
+ if (_cache3) {
+ Object.values(_cache3.inflightTile).forEach(abortRequest3);
+ _strings = _cache3.strings;
+ _colors = _cache3.colors;
+ }
+ _cache3 = {
+ data: {},
+ loadedTile: {},
+ inflightTile: {},
+ inflightPost: {},
+ closed: {},
+ rtree: new import_rbush3.default(),
+ strings: _strings,
+ colors: _colors
+ };
+ },
+ loadIssues(projection2) {
+ let params = {
+ item: _osmoseData.items
+ };
+ let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
+ abortUnwantedRequests3(_cache3, tiles);
+ tiles.forEach((tile) => {
+ if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
+ return;
+ let [x, y, z] = tile.xyz;
+ let url = `${_osmoseUrlRoot}/issues/${z}/${x}/${y}.json?` + utilQsString(params);
+ let controller = new AbortController();
+ _cache3.inflightTile[tile.id] = controller;
+ json_default(url, { signal: controller.signal }).then((data) => {
+ delete _cache3.inflightTile[tile.id];
+ _cache3.loadedTile[tile.id] = true;
+ if (data.features) {
+ data.features.forEach((issue) => {
+ const { item, class: cl, uuid: id2 } = issue.properties;
+ const itemType = `${item}-${cl}`;
+ if (itemType in _osmoseData.icons) {
+ let loc = issue.geometry.coordinates;
+ loc = preventCoincident2(loc);
+ let d = new QAItem(loc, this, itemType, id2, { item });
+ if (item === 8300 || item === 8360) {
+ d.elems = [];
+ }
+ _cache3.data[d.id] = d;
+ _cache3.rtree.insert(encodeIssueRtree3(d));
+ }
+ });
+ }
+ dispatch4.call("loaded");
+ }).catch(() => {
+ delete _cache3.inflightTile[tile.id];
+ _cache3.loadedTile[tile.id] = true;
+ });
+ });
+ },
+ loadIssueDetail(issue) {
+ if (issue.elems !== void 0) {
+ return Promise.resolve(issue);
+ }
+ const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
+ const cacheDetails = (data) => {
+ issue.elems = data.elems.map((e) => e.type.substring(0, 1) + e.id);
+ issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
+ this.replaceItem(issue);
+ };
+ return json_default(url).then(cacheDetails).then(() => issue);
+ },
+ loadStrings(locale2 = _mainLocalizer.localeCode()) {
+ const items = Object.keys(_osmoseData.icons);
+ if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
+ return Promise.resolve(_cache3.strings[locale2]);
+ }
+ if (!(locale2 in _cache3.strings)) {
+ _cache3.strings[locale2] = {};
+ }
+ const allRequests = items.map((itemType) => {
+ if (itemType in _cache3.strings[locale2])
+ return null;
+ const cacheData = (data) => {
+ const [cat = { items: [] }] = data.categories;
+ const [item2 = { class: [] }] = cat.items;
+ const [cl2 = null] = item2.class;
+ if (!cl2) {
+ console.log(`Osmose strings request (${itemType}) had unexpected data`);
+ return;
+ }
+ const { item: itemInt, color: color2 } = item2;
+ if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
+ _cache3.colors[itemInt] = color2;
+ }
+ const { title, detail, fix, trap } = cl2;
+ let issueStrings = {};
+ if (title)
+ issueStrings.title = title.auto;
+ if (detail)
+ issueStrings.detail = marked(detail.auto);
+ if (trap)
+ issueStrings.trap = marked(trap.auto);
+ if (fix)
+ issueStrings.fix = marked(fix.auto);
+ _cache3.strings[locale2][itemType] = issueStrings;
+ };
+ const [item, cl] = itemType.split("-");
+ const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale2}`;
+ return json_default(url).then(cacheData);
+ }).filter(Boolean);
+ return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
+ },
+ getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
+ return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
+ },
+ getColor(itemType) {
+ return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
+ },
+ postUpdate(issue, callback) {
+ if (_cache3.inflightPost[issue.id]) {
+ return callback({ message: "Issue update already inflight", status: -2 }, issue);
+ }
+ const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
+ const controller = new AbortController();
+ const after = () => {
+ delete _cache3.inflightPost[issue.id];
+ this.removeItem(issue);
+ if (issue.newStatus === "done") {
+ if (!(issue.item in _cache3.closed)) {
+ _cache3.closed[issue.item] = 0;
+ }
+ _cache3.closed[issue.item] += 1;
}
- };
-
- function squareness(points) {
- return points.reduce(function(sum, val, i, array) {
- var dotp = normalizedDotProduct(i, array);
-
- dotp = filterDotProduct(dotp);
- return sum + 2.0 * Math.min(Math.abs(dotp - 1.0), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
- }, 0);
- }
-
- function normalizedDotProduct(i, points) {
- var a = points[(i - 1 + points.length) % points.length],
- b = points[i],
- c = points[(i + 1) % points.length],
- p = subtractPoints(a, b),
- q = subtractPoints(c, b);
-
- p = normalizePoint(p, 1.0);
- q = normalizePoint(q, 1.0);
-
- return p[0] * q[0] + p[1] * q[1];
- }
-
- function subtractPoints(a, b) {
- return [a[0] - b[0], a[1] - b[1]];
+ if (callback)
+ callback(null, issue);
+ };
+ _cache3.inflightPost[issue.id] = controller;
+ fetch(url, { signal: controller.signal }).then(after).catch((err) => {
+ delete _cache3.inflightPost[issue.id];
+ if (callback)
+ callback(err.message);
+ });
+ },
+ getItems(projection2) {
+ const viewport = projection2.clipExtent();
+ const min3 = [viewport[0][0], viewport[1][1]];
+ const max3 = [viewport[1][0], viewport[0][1]];
+ const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ return _cache3.rtree.search(bbox).map((d) => d.data);
+ },
+ getError(id2) {
+ return _cache3.data[id2];
+ },
+ getIcon(itemType) {
+ return _osmoseData.icons[itemType];
+ },
+ replaceItem(item) {
+ if (!(item instanceof QAItem) || !item.id)
+ return;
+ _cache3.data[item.id] = item;
+ updateRtree3(encodeIssueRtree3(item), true);
+ return item;
+ },
+ removeItem(item) {
+ if (!(item instanceof QAItem) || !item.id)
+ return;
+ delete _cache3.data[item.id];
+ updateRtree3(encodeIssueRtree3(item), false);
+ },
+ getClosedCounts() {
+ return _cache3.closed;
+ },
+ itemURL(item) {
+ return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
}
+ };
- function addPoints(a, b) {
- return [a[0] + b[0], a[1] + b[1]];
+ // modules/services/mapillary.js
+ var import_pbf = __toESM(require_pbf());
+ var import_rbush4 = __toESM(require_rbush_min());
+ var import_vector_tile = __toESM(require_vector_tile());
+ var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
+ var apiUrl = "https://graph.mapillary.com/";
+ var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
+ var mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
+ var tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
+ var trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
+ var viewercss = "mapillary-js/mapillary.css";
+ var viewerjs = "mapillary-js/mapillary.js";
+ var minZoom = 14;
+ var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
+ var _loadViewerPromise;
+ var _mlyActiveImage;
+ var _mlyCache;
+ var _mlyFallback = false;
+ var _mlyHighlightedDetection;
+ var _mlyShowFeatureDetections = false;
+ var _mlyShowSignDetections = false;
+ var _mlyViewer;
+ var _mlyViewerFilter = ["all"];
+ function loadTiles(which, url, maxZoom2, projection2) {
+ const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
+ const tiles = tiler8.getTiles(projection2);
+ tiles.forEach(function(tile) {
+ loadTile(which, url, tile);
+ });
+ }
+ function loadTile(which, url, tile) {
+ const cache = _mlyCache.requests;
+ const tileId = `${tile.id}-${which}`;
+ if (cache.loaded[tileId] || cache.inflight[tileId])
+ return;
+ const controller = new AbortController();
+ cache.inflight[tileId] = controller;
+ const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
+ fetch(requestUrl, { signal: controller.signal }).then(function(response) {
+ if (!response.ok) {
+ throw new Error(response.status + " " + response.statusText);
+ }
+ cache.loaded[tileId] = true;
+ delete cache.inflight[tileId];
+ return response.arrayBuffer();
+ }).then(function(data) {
+ if (!data) {
+ throw new Error("No Data");
+ }
+ loadTileDataToCache(data, tile, which);
+ if (which === "images") {
+ dispatch5.call("loadedImages");
+ } else if (which === "signs") {
+ dispatch5.call("loadedSigns");
+ } else if (which === "points") {
+ dispatch5.call("loadedMapFeatures");
+ }
+ }).catch(function() {
+ cache.loaded[tileId] = true;
+ delete cache.inflight[tileId];
+ });
+ }
+ function loadTileDataToCache(data, tile, which) {
+ const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
+ let features2, cache, layer, i2, feature3, loc, d;
+ if (vectorTile.layers.hasOwnProperty("image")) {
+ features2 = [];
+ cache = _mlyCache.images;
+ layer = vectorTile.layers.image;
+ for (i2 = 0; i2 < layer.length; i2++) {
+ feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
+ loc = feature3.geometry.coordinates;
+ d = {
+ loc,
+ captured_at: feature3.properties.captured_at,
+ ca: feature3.properties.compass_angle,
+ id: feature3.properties.id,
+ is_pano: feature3.properties.is_pano,
+ sequence_id: feature3.properties.sequence_id
+ };
+ cache.forImageId[d.id] = d;
+ features2.push({
+ minX: loc[0],
+ minY: loc[1],
+ maxX: loc[0],
+ maxY: loc[1],
+ data: d
+ });
+ }
+ if (cache.rtree) {
+ cache.rtree.load(features2);
+ }
}
-
- function normalizePoint(point, scale) {
- var vector = [0, 0];
- var length = Math.sqrt(point[0] * point[0] + point[1] * point[1]);
- if (length !== 0) {
- vector[0] = point[0] / length;
- vector[1] = point[1] / length;
+ if (vectorTile.layers.hasOwnProperty("sequence")) {
+ features2 = [];
+ cache = _mlyCache.sequences;
+ layer = vectorTile.layers.sequence;
+ for (i2 = 0; i2 < layer.length; i2++) {
+ feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
+ if (cache.lineString[feature3.properties.id]) {
+ cache.lineString[feature3.properties.id].push(feature3);
+ } else {
+ cache.lineString[feature3.properties.id] = [feature3];
}
-
- vector[0] *= scale;
- vector[1] *= scale;
-
- return vector;
+ }
}
-
- function filterDotProduct(dotp) {
- if (lowerThreshold > Math.abs(dotp) || Math.abs(dotp) > upperThreshold) {
- return dotp;
- }
-
- return 0;
+ if (vectorTile.layers.hasOwnProperty("point")) {
+ features2 = [];
+ cache = _mlyCache[which];
+ layer = vectorTile.layers.point;
+ for (i2 = 0; i2 < layer.length; i2++) {
+ feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
+ loc = feature3.geometry.coordinates;
+ d = {
+ loc,
+ id: feature3.properties.id,
+ first_seen_at: feature3.properties.first_seen_at,
+ last_seen_at: feature3.properties.last_seen_at,
+ value: feature3.properties.value
+ };
+ features2.push({
+ minX: loc[0],
+ minY: loc[1],
+ maxX: loc[0],
+ maxY: loc[1],
+ data: d
+ });
+ }
+ if (cache.rtree) {
+ cache.rtree.load(features2);
+ }
}
-
- action.disabled = function(graph) {
- var way = graph.entity(wayId),
- nodes = graph.childNodes(way),
- points = _.uniq(nodes).map(function(n) { return projection(n.loc); });
-
- if (squareness(points)) {
- return false;
- }
-
- return 'not_squarish';
- };
-
- return action;
-};
-// Create a restriction relation for `turn`, which must have the following structure:
-//
-// {
-// from: { node: , way: },
-// via: { node: },
-// to: { node: , way: },
-// restriction: <'no_right_turn', 'no_left_turn', etc.>
-// }
-//
-// This specifies a restriction of type `restriction` when traveling from
-// `from.node` in `from.way` toward `to.node` in `to.way` via `via.node`.
-// (The action does not check that these entities form a valid intersection.)
-//
-// If `restriction` is not provided, it is automatically determined by
-// iD.geo.inferRestriction.
-//
-// If necessary, the `from` and `to` ways are split. In these cases, `from.node`
-// and `to.node` are used to determine which portion of the split ways become
-// members of the restriction.
-//
-// For testing convenience, accepts an ID to assign to the new relation.
-// Normally, this will be undefined and the relation will automatically
-// be assigned a new ID.
-//
-iD.actions.RestrictTurn = function(turn, projection, restrictionId) {
- return function(graph) {
- var from = graph.entity(turn.from.way),
- via = graph.entity(turn.via.node),
- to = graph.entity(turn.to.way);
-
- function isClosingNode(way, nodeId) {
- return nodeId === way.first() && nodeId === way.last();
- }
-
- function split(toOrFrom) {
- var newID = toOrFrom.newID || iD.Way().id;
- graph = iD.actions.Split(via.id, [newID])
- .limitWays([toOrFrom.way])(graph);
-
- var a = graph.entity(newID),
- b = graph.entity(toOrFrom.way);
-
- if (a.nodes.indexOf(toOrFrom.node) !== -1) {
- return [a, b];
- } else {
- return [b, a];
- }
+ if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
+ features2 = [];
+ cache = _mlyCache[which];
+ layer = vectorTile.layers.traffic_sign;
+ for (i2 = 0; i2 < layer.length; i2++) {
+ feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
+ loc = feature3.geometry.coordinates;
+ d = {
+ loc,
+ id: feature3.properties.id,
+ first_seen_at: feature3.properties.first_seen_at,
+ last_seen_at: feature3.properties.last_seen_at,
+ value: feature3.properties.value
+ };
+ features2.push({
+ minX: loc[0],
+ minY: loc[1],
+ maxX: loc[0],
+ maxY: loc[1],
+ data: d
+ });
+ }
+ if (cache.rtree) {
+ cache.rtree.load(features2);
+ }
+ }
+ }
+ function loadData(url) {
+ return fetch(url).then(function(response) {
+ if (!response.ok) {
+ throw new Error(response.status + " " + response.statusText);
+ }
+ return response.json();
+ }).then(function(result) {
+ if (!result) {
+ return [];
+ }
+ return result.data || [];
+ });
+ }
+ function partitionViewport(projection2) {
+ const z = geoScaleToZoom(projection2.scale());
+ const z2 = Math.ceil(z * 2) / 2 + 2.5;
+ const tiler8 = utilTiler().zoomExtent([z2, z2]);
+ return tiler8.getTiles(projection2).map(function(tile) {
+ return tile.extent;
+ });
+ }
+ function searchLimited(limit, projection2, rtree) {
+ limit = limit || 5;
+ return partitionViewport(projection2).reduce(function(result, extent) {
+ const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
+ return d.data;
+ });
+ return found.length ? result.concat(found) : result;
+ }, []);
+ }
+ var mapillary_default = {
+ init: function() {
+ if (!_mlyCache) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch5, "on");
+ },
+ reset: function() {
+ if (_mlyCache) {
+ Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
+ request3.abort();
+ });
+ }
+ _mlyCache = {
+ images: { rtree: new import_rbush4.default(), forImageId: {} },
+ image_detections: { forImageId: {} },
+ signs: { rtree: new import_rbush4.default() },
+ points: { rtree: new import_rbush4.default() },
+ sequences: { rtree: new import_rbush4.default(), lineString: {} },
+ requests: { loaded: {}, inflight: {} }
+ };
+ _mlyActiveImage = null;
+ },
+ images: function(projection2) {
+ const limit = 5;
+ return searchLimited(limit, projection2, _mlyCache.images.rtree);
+ },
+ signs: function(projection2) {
+ const limit = 5;
+ return searchLimited(limit, projection2, _mlyCache.signs.rtree);
+ },
+ mapFeatures: function(projection2) {
+ const limit = 5;
+ return searchLimited(limit, projection2, _mlyCache.points.rtree);
+ },
+ cachedImage: function(imageId) {
+ return _mlyCache.images.forImageId[imageId];
+ },
+ sequences: function(projection2) {
+ const viewport = projection2.clipExtent();
+ const min3 = [viewport[0][0], viewport[1][1]];
+ const max3 = [viewport[1][0], viewport[0][1]];
+ const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ const sequenceIds = {};
+ let lineStrings = [];
+ _mlyCache.images.rtree.search(bbox).forEach(function(d) {
+ if (d.data.sequence_id) {
+ sequenceIds[d.data.sequence_id] = true;
}
-
- if (!from.affix(via.id) || isClosingNode(from, via.id)) {
- if (turn.from.node === turn.to.node) {
- // U-turn
- from = to = split(turn.from)[0];
- } else if (turn.from.way === turn.to.way) {
- // Straight-on or circular
- var s = split(turn.from);
- from = s[0];
- to = s[1];
- } else {
- // Other
- from = split(turn.from)[0];
- }
+ });
+ Object.keys(sequenceIds).forEach(function(sequenceId) {
+ if (_mlyCache.sequences.lineString[sequenceId]) {
+ lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
}
-
- if (!to.affix(via.id) || isClosingNode(to, via.id)) {
- to = split(turn.to)[0];
+ });
+ return lineStrings;
+ },
+ loadImages: function(projection2) {
+ loadTiles("images", tileUrl, 14, projection2);
+ },
+ loadSigns: function(projection2) {
+ loadTiles("signs", trafficSignTileUrl, 14, projection2);
+ },
+ loadMapFeatures: function(projection2) {
+ loadTiles("points", mapFeatureTileUrl, 14, projection2);
+ },
+ ensureViewerLoaded: function(context) {
+ if (_loadViewerPromise)
+ return _loadViewerPromise;
+ const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
+ wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
+ const that = this;
+ _loadViewerPromise = new Promise((resolve, reject) => {
+ let loadedCount = 0;
+ function loaded() {
+ loadedCount += 1;
+ if (loadedCount === 2)
+ resolve();
+ }
+ const head = select_default2("head");
+ head.selectAll("#ideditor-mapillary-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapillary-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(viewercss)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
+ reject();
+ });
+ head.selectAll("#ideditor-mapillary-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapillary-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(viewerjs)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
+ reject();
+ });
+ }).catch(function() {
+ _loadViewerPromise = null;
+ }).then(function() {
+ that.initViewer(context);
+ });
+ return _loadViewerPromise;
+ },
+ loadSignResources: function(context) {
+ context.ui().svgDefs.addSprites(["mapillary-sprite"], false);
+ return this;
+ },
+ loadObjectResources: function(context) {
+ context.ui().svgDefs.addSprites(["mapillary-object-sprite"], false);
+ return this;
+ },
+ resetTags: function() {
+ if (_mlyViewer && !_mlyFallback) {
+ _mlyViewer.getComponent("tag").removeAll();
+ }
+ },
+ showFeatureDetections: function(value) {
+ _mlyShowFeatureDetections = value;
+ if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
+ this.resetTags();
+ }
+ },
+ showSignDetections: function(value) {
+ _mlyShowSignDetections = value;
+ if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
+ this.resetTags();
+ }
+ },
+ filterViewer: function(context) {
+ const showsPano = context.photos().showsPanoramic();
+ const showsFlat = context.photos().showsFlat();
+ const fromDate = context.photos().fromDate();
+ const toDate = context.photos().toDate();
+ const filter2 = ["all"];
+ if (!showsPano)
+ filter2.push(["!=", "cameraType", "spherical"]);
+ if (!showsFlat && showsPano)
+ filter2.push(["==", "pano", true]);
+ if (fromDate) {
+ filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
+ }
+ if (toDate) {
+ filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
+ }
+ if (_mlyViewer) {
+ _mlyViewer.setFilter(filter2);
+ }
+ _mlyViewerFilter = filter2;
+ return filter2;
+ },
+ showViewer: function(context) {
+ const wrap2 = context.container().select(".photoviewer").classed("hide", false);
+ const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
+ if (isHidden && _mlyViewer) {
+ wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
+ wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
+ _mlyViewer.resize();
+ }
+ return this;
+ },
+ hideViewer: function(context) {
+ _mlyActiveImage = null;
+ if (!_mlyFallback && _mlyViewer) {
+ _mlyViewer.getComponent("sequence").stop();
+ }
+ const viewer = context.container().select(".photoviewer");
+ if (!viewer.empty())
+ viewer.datum(null);
+ viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
+ this.updateUrlImage(null);
+ dispatch5.call("imageChanged");
+ dispatch5.call("loadedMapFeatures");
+ dispatch5.call("loadedSigns");
+ return this.setStyles(context, null);
+ },
+ updateUrlImage: function(imageId) {
+ if (!window.mocha) {
+ const hash = utilStringQs(window.location.hash);
+ if (imageId) {
+ hash.photo = "mapillary/" + imageId;
+ } else {
+ delete hash.photo;
}
-
- return graph.replace(iD.Relation({
- id: restrictionId,
- tags: {
- type: 'restriction',
- restriction: turn.restriction ||
- iD.geo.inferRestriction(
- graph,
- turn.from,
- turn.via,
- turn.to,
- projection)
- },
- members: [
- {id: from.id, type: 'way', role: 'from'},
- {id: via.id, type: 'node', role: 'via'},
- {id: to.id, type: 'way', role: 'to'}
- ]
- }));
- };
-};
-/*
- Order the nodes of a way in reverse order and reverse any direction dependent tags
- other than `oneway`. (We assume that correcting a backwards oneway is the primary
- reason for reversing a way.)
-
- The following transforms are performed:
-
- Keys:
- *:right=* ⺠*:left=*
- *:forward=* ⺠*:backward=*
- direction=up ⺠direction=down
- incline=up ⺠incline=down
- *=right ⺠*=left
-
- Relation members:
- role=forward ⺠role=backward
- role=north ⺠role=south
- role=east ⺠role=west
-
- In addition, numeric-valued `incline` tags are negated.
-
- The JOSM implementation was used as a guide, but transformations that were of unclear benefit
- or adjusted tags that don't seem to be used in practice were omitted.
-
- References:
- http://wiki.openstreetmap.org/wiki/Forward_%26_backward,_left_%26_right
- http://wiki.openstreetmap.org/wiki/Key:direction#Steps
- http://wiki.openstreetmap.org/wiki/Key:incline
- http://wiki.openstreetmap.org/wiki/Route#Members
- http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
- */
-iD.actions.Reverse = function(wayId, options) {
- var replacements = [
- [/:right$/, ':left'], [/:left$/, ':right'],
- [/:forward$/, ':backward'], [/:backward$/, ':forward']
- ],
- numeric = /^([+\-]?)(?=[\d.])/,
- roleReversals = {
- forward: 'backward',
- backward: 'forward',
- north: 'south',
- south: 'north',
- east: 'west',
- west: 'east'
+ window.location.replace("#" + utilQsString(hash, true));
+ }
+ },
+ highlightDetection: function(detection) {
+ if (detection) {
+ _mlyHighlightedDetection = detection.id;
+ }
+ return this;
+ },
+ initViewer: function(context) {
+ const that = this;
+ if (!window.mapillary)
+ return;
+ const opts = {
+ accessToken,
+ component: {
+ cover: false,
+ keyboard: false,
+ tag: true
+ },
+ container: "ideditor-mly"
+ };
+ if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
+ _mlyFallback = true;
+ opts.component = {
+ cover: false,
+ direction: false,
+ imagePlane: false,
+ keyboard: false,
+ mouse: false,
+ sequence: false,
+ tag: false,
+ image: true,
+ navigation: true
};
-
- function reverseKey(key) {
- for (var i = 0; i < replacements.length; ++i) {
- var replacement = replacements[i];
- if (replacement[0].test(key)) {
- return key.replace(replacement[0], replacement[1]);
+ }
+ _mlyViewer = new mapillary.Viewer(opts);
+ _mlyViewer.on("image", imageChanged);
+ _mlyViewer.on("bearing", bearingChanged);
+ if (_mlyViewerFilter) {
+ _mlyViewer.setFilter(_mlyViewerFilter);
+ }
+ context.ui().photoviewer.on("resize.mapillary", function() {
+ if (_mlyViewer)
+ _mlyViewer.resize();
+ });
+ function imageChanged(node) {
+ that.resetTags();
+ const image = node.image;
+ that.setActiveImage(image);
+ that.setStyles(context, null);
+ const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
+ context.map().centerEase(loc);
+ that.updateUrlImage(image.id);
+ if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
+ that.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
+ }
+ dispatch5.call("imageChanged");
+ }
+ function bearingChanged(e) {
+ dispatch5.call("bearingChanged", void 0, e);
+ }
+ },
+ selectImage: function(context, imageId) {
+ if (_mlyViewer && imageId) {
+ _mlyViewer.moveTo(imageId).catch(function(e) {
+ console.error("mly3", e);
+ });
+ }
+ return this;
+ },
+ getActiveImage: function() {
+ return _mlyActiveImage;
+ },
+ getDetections: function(id2) {
+ return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
+ },
+ setActiveImage: function(image) {
+ if (image) {
+ _mlyActiveImage = {
+ ca: image.originalCompassAngle,
+ id: image.id,
+ loc: [image.originalLngLat.lng, image.originalLngLat.lat],
+ is_pano: image.cameraType === "spherical",
+ sequence_id: image.sequenceId
+ };
+ } else {
+ _mlyActiveImage = null;
+ }
+ },
+ setStyles: function(context, hovered) {
+ const hoveredImageId = hovered && hovered.id;
+ const hoveredSequenceId = hovered && hovered.sequence_id;
+ const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
+ context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d) {
+ return d.sequence_id === selectedSequenceId || d.id === hoveredImageId;
+ }).classed("hovered", function(d) {
+ return d.id === hoveredImageId;
+ });
+ context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d) {
+ return d.properties.id === hoveredSequenceId;
+ }).classed("currentView", function(d) {
+ return d.properties.id === selectedSequenceId;
+ });
+ return this;
+ },
+ updateDetections: function(imageId, url) {
+ if (!_mlyViewer || _mlyFallback)
+ return;
+ if (!imageId)
+ return;
+ const cache = _mlyCache.image_detections;
+ if (cache.forImageId[imageId]) {
+ showDetections(_mlyCache.image_detections.forImageId[imageId]);
+ } else {
+ loadData(url).then((detections) => {
+ detections.forEach(function(detection) {
+ if (!cache.forImageId[imageId]) {
+ cache.forImageId[imageId] = [];
}
- }
- return key;
+ cache.forImageId[imageId].push({
+ geometry: detection.geometry,
+ id: detection.id,
+ image_id: imageId,
+ value: detection.value
+ });
+ });
+ showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
+ });
+ }
+ function showDetections(detections) {
+ const tagComponent = _mlyViewer.getComponent("tag");
+ detections.forEach(function(data) {
+ const tag = makeTag(data);
+ if (tag) {
+ tagComponent.add([tag]);
+ }
+ });
+ }
+ function makeTag(data) {
+ const valueParts = data.value.split("--");
+ if (!valueParts.length)
+ return;
+ let tag;
+ let text2;
+ let color2 = 16777215;
+ if (_mlyHighlightedDetection === data.id) {
+ color2 = 16776960;
+ text2 = valueParts[1];
+ if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
+ text2 = valueParts[2];
+ }
+ text2 = text2.replace(/-/g, " ");
+ text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
+ _mlyHighlightedDetection = null;
+ }
+ var decodedGeometry = window.atob(data.geometry);
+ var uintArray = new Uint8Array(decodedGeometry.length);
+ for (var i2 = 0; i2 < decodedGeometry.length; i2++) {
+ uintArray[i2] = decodedGeometry.charCodeAt(i2);
+ }
+ const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
+ const layer = tile.layers["mpy-or"];
+ const geometries = layer.feature(0).loadGeometry();
+ const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
+ tag = new mapillary.OutlineTag(data.id, new mapillary.PolygonGeometry(polygon2[0]), {
+ text: text2,
+ textColor: color2,
+ lineColor: color2,
+ lineWidth: 2,
+ fillColor: color2,
+ fillOpacity: 0.3
+ });
+ return tag;
+ }
+ },
+ cache: function() {
+ return _mlyCache;
}
+ };
- function reverseValue(key, value) {
- if (key === 'incline' && numeric.test(value)) {
- return value.replace(numeric, function(_, sign) { return sign === '-' ? '' : '-'; });
- } else if (key === 'incline' || key === 'direction') {
- return {up: 'down', down: 'up'}[value] || value;
- } else if (options && options.reverseOneway && key === 'oneway') {
- return {yes: '-1', '1': '-1', '-1': 'yes'}[value] || value;
- } else {
- return {left: 'right', right: 'left'}[value] || value;
- }
+ // modules/core/validation/models.js
+ function validationIssue(attrs) {
+ this.type = attrs.type;
+ this.subtype = attrs.subtype;
+ this.severity = attrs.severity;
+ this.message = attrs.message;
+ this.reference = attrs.reference;
+ this.entityIds = attrs.entityIds;
+ this.loc = attrs.loc;
+ this.data = attrs.data;
+ this.dynamicFixes = attrs.dynamicFixes;
+ this.hash = attrs.hash;
+ this.id = generateID.apply(this);
+ this.key = generateKey.apply(this);
+ this.autoFix = null;
+ function generateID() {
+ var parts = [this.type];
+ if (this.hash) {
+ parts.push(this.hash);
+ }
+ if (this.subtype) {
+ parts.push(this.subtype);
+ }
+ if (this.entityIds) {
+ var entityKeys = this.entityIds.slice().sort();
+ parts.push.apply(parts, entityKeys);
+ }
+ return parts.join(":");
}
-
- return function(graph) {
- var way = graph.entity(wayId),
- nodes = way.nodes.slice().reverse(),
- tags = {}, key, role;
-
- for (key in way.tags) {
- tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
+ function generateKey() {
+ return this.id + ":" + Date.now().toString();
+ }
+ this.extent = function(resolver) {
+ if (this.loc) {
+ return geoExtent(this.loc);
+ }
+ if (this.entityIds && this.entityIds.length) {
+ return this.entityIds.reduce(function(extent, entityId) {
+ return extent.extend(resolver.entity(entityId).extent(resolver));
+ }, geoExtent());
+ }
+ return null;
+ };
+ this.fixes = function(context) {
+ var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
+ var issue = this;
+ if (issue.severity === "warning") {
+ fixes.push(new validationIssueFix({
+ title: _t.html("issues.fix.ignore_issue.title"),
+ icon: "iD-icon-close",
+ onClick: function() {
+ context.validator().ignoreIssue(this.issue.id);
+ }
+ }));
+ }
+ fixes.forEach(function(fix) {
+ fix.id = fix.title;
+ fix.issue = issue;
+ if (fix.autoArgs) {
+ issue.autoFix = fix;
}
-
- graph.parentRelations(way).forEach(function(relation) {
- relation.members.forEach(function(member, index) {
- if (member.id === way.id && (role = roleReversals[member.role])) {
- relation = relation.updateMember({role: role}, index);
- graph = graph.replace(relation);
- }
- });
- });
-
- return graph.replace(way.update({nodes: nodes, tags: tags}));
+ });
+ return fixes;
};
-};
-iD.actions.Revert = function(id) {
-
- var action = function(graph) {
- var entity = graph.hasEntity(id),
- base = graph.base().entities[id];
-
- if (entity && !base) { // entity will be removed..
- if (entity.type === 'node') {
- graph.parentWays(entity)
- .forEach(function(parent) {
- parent = parent.removeNode(id);
- graph = graph.replace(parent);
-
- if (parent.isDegenerate()) {
- graph = iD.actions.DeleteWay(parent.id)(graph);
- }
- });
- }
-
- graph.parentRelations(entity)
- .forEach(function(parent) {
- parent = parent.removeMembersWithID(id);
- graph = graph.replace(parent);
-
- if (parent.isDegenerate()) {
- graph = iD.actions.DeleteRelation(parent.id)(graph);
- }
- });
- }
+ }
+ function validationIssueFix(attrs) {
+ this.title = attrs.title;
+ this.onClick = attrs.onClick;
+ this.disabledReason = attrs.disabledReason;
+ this.icon = attrs.icon;
+ this.entityIds = attrs.entityIds || [];
+ this.autoArgs = attrs.autoArgs;
+ this.issue = null;
+ }
- return graph.revert(id);
+ // modules/services/maprules.js
+ var buildRuleChecks = function() {
+ return {
+ equals: function(equals) {
+ return function(tags) {
+ return Object.keys(equals).every(function(k) {
+ return equals[k] === tags[k];
+ });
+ };
+ },
+ notEquals: function(notEquals) {
+ return function(tags) {
+ return Object.keys(notEquals).some(function(k) {
+ return notEquals[k] !== tags[k];
+ });
+ };
+ },
+ absence: function(absence) {
+ return function(tags) {
+ return Object.keys(tags).indexOf(absence) === -1;
+ };
+ },
+ presence: function(presence) {
+ return function(tags) {
+ return Object.keys(tags).indexOf(presence) > -1;
+ };
+ },
+ greaterThan: function(greaterThan) {
+ var key = Object.keys(greaterThan)[0];
+ var value = greaterThan[key];
+ return function(tags) {
+ return tags[key] > value;
+ };
+ },
+ greaterThanEqual: function(greaterThanEqual) {
+ var key = Object.keys(greaterThanEqual)[0];
+ var value = greaterThanEqual[key];
+ return function(tags) {
+ return tags[key] >= value;
+ };
+ },
+ lessThan: function(lessThan) {
+ var key = Object.keys(lessThan)[0];
+ var value = lessThan[key];
+ return function(tags) {
+ return tags[key] < value;
+ };
+ },
+ lessThanEqual: function(lessThanEqual) {
+ var key = Object.keys(lessThanEqual)[0];
+ var value = lessThanEqual[key];
+ return function(tags) {
+ return tags[key] <= value;
+ };
+ },
+ positiveRegex: function(positiveRegex) {
+ var tagKey = Object.keys(positiveRegex)[0];
+ var expression = positiveRegex[tagKey].join("|");
+ var regex = new RegExp(expression);
+ return function(tags) {
+ return regex.test(tags[tagKey]);
+ };
+ },
+ negativeRegex: function(negativeRegex) {
+ var tagKey = Object.keys(negativeRegex)[0];
+ var expression = negativeRegex[tagKey].join("|");
+ var regex = new RegExp(expression);
+ return function(tags) {
+ return !regex.test(tags[tagKey]);
+ };
+ }
};
-
- return action;
-};
-iD.actions.RotateWay = function(wayId, pivot, angle, projection) {
- return function(graph) {
- return graph.update(function(graph) {
- var way = graph.entity(wayId);
-
- _.uniq(way.nodes).forEach(function(id) {
-
- var node = graph.entity(id),
- point = projection(node.loc),
- radial = [0,0];
-
- radial[0] = point[0] - pivot[0];
- radial[1] = point[1] - pivot[1];
-
- point = [
- radial[0] * Math.cos(angle) - radial[1] * Math.sin(angle) + pivot[0],
- radial[0] * Math.sin(angle) + radial[1] * Math.cos(angle) + pivot[1]
- ];
-
- graph = graph.replace(node.move(projection.invert(point)));
-
- });
-
- });
+ };
+ var buildLineKeys = function() {
+ return {
+ highway: {
+ rest_area: true,
+ services: true
+ },
+ railway: {
+ roundhouse: true,
+ station: true,
+ traverser: true,
+ turntable: true,
+ wash: true
+ }
};
-};
-// Split a way at the given node.
-//
-// Optionally, split only the given ways, if multiple ways share
-// the given node.
-//
-// This is the inverse of `iD.actions.Join`.
-//
-// For testing convenience, accepts an ID to assign to the new way.
-// Normally, this will be undefined and the way will automatically
-// be assigned a new ID.
-//
-// Reference:
-// https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/actions/SplitWayAction.as
-//
-iD.actions.Split = function(nodeId, newWayIds) {
- var wayIds;
-
- // if the way is closed, we need to search for a partner node
- // to split the way at.
- //
- // The following looks for a node that is both far away from
- // the initial node in terms of way segment length and nearby
- // in terms of beeline-distance. This assures that areas get
- // split on the most "natural" points (independent of the number
- // of nodes).
- // For example: bone-shaped areas get split across their waist
- // line, circles across the diameter.
- function splitArea(nodes, idxA, graph) {
- var lengths = new Array(nodes.length),
- length,
- i,
- best = 0,
- idxB;
-
- function wrap(index) {
- return iD.util.wrap(index, nodes.length);
+ };
+ var maprules_default = {
+ init: function() {
+ this._ruleChecks = buildRuleChecks();
+ this._validationRules = [];
+ this._areaKeys = osmAreaKeys;
+ this._lineKeys = buildLineKeys();
+ },
+ filterRuleChecks: function(selector) {
+ var _ruleChecks = this._ruleChecks;
+ return Object.keys(selector).reduce(function(rules, key) {
+ if (["geometry", "error", "warning"].indexOf(key) === -1) {
+ rules.push(_ruleChecks[key](selector[key]));
+ }
+ return rules;
+ }, []);
+ },
+ buildTagMap: function(selector) {
+ var getRegexValues = function(regexes) {
+ return regexes.map(function(regex) {
+ return regex.replace(/\$|\^/g, "");
+ });
+ };
+ var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
+ var values;
+ var isRegex = /regex/gi.test(key);
+ var isEqual = /equals/gi.test(key);
+ if (isRegex || isEqual) {
+ Object.keys(selector[key]).forEach(function(selectorKey) {
+ values = isEqual ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
+ if (expectedTags.hasOwnProperty(selectorKey)) {
+ values = values.concat(expectedTags[selectorKey]);
+ }
+ expectedTags[selectorKey] = values;
+ });
+ } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
+ var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
+ values = [selector[key][tagKey]];
+ if (expectedTags.hasOwnProperty(tagKey)) {
+ values = values.concat(expectedTags[tagKey]);
+ }
+ expectedTags[tagKey] = values;
}
-
- function dist(nA, nB) {
- return iD.geo.sphericalDistance(graph.entity(nA).loc, graph.entity(nB).loc);
+ return expectedTags;
+ }, {});
+ return tagMap;
+ },
+ inferGeometry: function(tagMap) {
+ var _lineKeys = this._lineKeys;
+ var _areaKeys = this._areaKeys;
+ var keyValueDoesNotImplyArea = function(key2) {
+ return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
+ };
+ var keyValueImpliesLine = function(key2) {
+ return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
+ };
+ if (tagMap.hasOwnProperty("area")) {
+ if (tagMap.area.indexOf("yes") > -1) {
+ return "area";
}
-
- // calculate lengths
- length = 0;
- for (i = wrap(idxA+1); i !== idxA; i = wrap(i+1)) {
- length += dist(nodes[i], nodes[wrap(i-1)]);
- lengths[i] = length;
+ if (tagMap.area.indexOf("no") > -1) {
+ return "line";
}
-
- length = 0;
- for (i = wrap(idxA-1); i !== idxA; i = wrap(i-1)) {
- length += dist(nodes[i], nodes[wrap(i+1)]);
- if (length < lengths[i])
- lengths[i] = length;
+ }
+ for (var key in tagMap) {
+ if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
+ return "area";
}
-
- // determine best opposite node to split
- for (i = 0; i < nodes.length; i++) {
- var cost = lengths[i] / dist(nodes[idxA], nodes[i]);
- if (cost > best) {
- idxB = i;
- best = cost;
- }
+ if (key in _lineKeys && keyValueImpliesLine(key)) {
+ return "area";
}
-
- return idxB;
+ }
+ return "line";
+ },
+ addRule: function(selector) {
+ var rule = {
+ checks: this.filterRuleChecks(selector),
+ matches: function(entity) {
+ return this.checks.every(function(check) {
+ return check(entity.tags);
+ });
+ },
+ inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
+ geometryMatches: function(entity, graph) {
+ if (entity.type === "node" || entity.type === "relation") {
+ return selector.geometry === entity.type;
+ } else if (entity.type === "way") {
+ return this.inferredGeometry === entity.geometry(graph);
+ }
+ },
+ findIssues: function(entity, graph, issues) {
+ if (this.geometryMatches(entity, graph) && this.matches(entity)) {
+ var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
+ var message = selector[severity];
+ issues.push(new validationIssue({
+ type: "maprules",
+ severity,
+ message: function() {
+ return message;
+ },
+ entityIds: [entity.id]
+ }));
+ }
+ }
+ };
+ this._validationRules.push(rule);
+ },
+ clearRules: function() {
+ this._validationRules = [];
+ },
+ validationRules: function() {
+ return this._validationRules;
+ },
+ ruleChecks: function() {
+ return this._ruleChecks;
}
+ };
- function split(graph, wayA, newWayId) {
- var wayB = iD.Way({id: newWayId, tags: wayA.tags}),
- nodesA,
- nodesB,
- isArea = wayA.isArea(),
- isOuter = iD.geo.isSimpleMultipolygonOuterMember(wayA, graph);
-
- if (wayA.isClosed()) {
- var nodes = wayA.nodes.slice(0, -1),
- idxA = _.indexOf(nodes, nodeId),
- idxB = splitArea(nodes, idxA, graph);
-
- if (idxB < idxA) {
- nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
- nodesB = nodes.slice(idxB, idxA + 1);
- } else {
- nodesA = nodes.slice(idxA, idxB + 1);
- nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
- }
+ // modules/services/nominatim.js
+ var import_rbush5 = __toESM(require_rbush_min());
+ var apibase = "https://nominatim.openstreetmap.org/";
+ var _inflight = {};
+ var _nominatimCache;
+ var nominatim_default = {
+ init: function() {
+ _inflight = {};
+ _nominatimCache = new import_rbush5.default();
+ },
+ reset: function() {
+ Object.values(_inflight).forEach(function(controller) {
+ controller.abort();
+ });
+ _inflight = {};
+ _nominatimCache = new import_rbush5.default();
+ },
+ countryCode: function(location, callback) {
+ this.reverse(location, function(err, result) {
+ if (err) {
+ return callback(err);
+ } else if (result.address) {
+ return callback(null, result.address.country_code);
} else {
- var idx = _.indexOf(wayA.nodes, nodeId, 1);
- nodesA = wayA.nodes.slice(0, idx + 1);
- nodesB = wayA.nodes.slice(idx);
+ return callback("Unable to geocode", null);
}
+ });
+ },
+ reverse: function(loc, callback) {
+ var cached = _nominatimCache.search({ minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] });
+ if (cached.length > 0) {
+ if (callback)
+ callback(null, cached[0].data);
+ return;
+ }
+ var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
+ var url = apibase + "reverse?" + utilQsString(params);
+ if (_inflight[url])
+ return;
+ var controller = new AbortController();
+ _inflight[url] = controller;
+ json_default(url, { signal: controller.signal }).then(function(result) {
+ delete _inflight[url];
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ var extent = geoExtent(loc).padByMeters(200);
+ _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
+ if (callback)
+ callback(null, result);
+ }).catch(function(err) {
+ delete _inflight[url];
+ if (err.name === "AbortError")
+ return;
+ if (callback)
+ callback(err.message);
+ });
+ },
+ search: function(val, callback) {
+ var searchVal = encodeURIComponent(val);
+ var url = apibase + "search/" + searchVal + "?limit=10&format=json";
+ if (_inflight[url])
+ return;
+ var controller = new AbortController();
+ _inflight[url] = controller;
+ json_default(url, { signal: controller.signal }).then(function(result) {
+ delete _inflight[url];
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ if (callback)
+ callback(null, result);
+ }).catch(function(err) {
+ delete _inflight[url];
+ if (err.name === "AbortError")
+ return;
+ if (callback)
+ callback(err.message);
+ });
+ }
+ };
- wayA = wayA.update({nodes: nodesA});
- wayB = wayB.update({nodes: nodesB});
+ // node_modules/name-suggestion-index/lib/matcher.js
+ var import_which_polygon3 = __toESM(require_which_polygon(), 1);
- graph = graph.replace(wayA);
- graph = graph.replace(wayB);
+ // node_modules/name-suggestion-index/lib/simplify.js
+ var import_diacritics2 = __toESM(require_diacritics(), 1);
+ function simplify(str2) {
+ if (typeof str2 !== "string")
+ return "";
+ return import_diacritics2.default.remove(str2.replace(/&/g, "and").replace(/Ä°/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`â\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase());
+ }
- graph.parentRelations(wayA).forEach(function(relation) {
- if (relation.isRestriction()) {
- var via = relation.memberByRole('via');
- if (via && wayB.contains(via.id)) {
- relation = relation.updateMember({id: wayB.id}, relation.memberById(wayA.id).index);
- graph = graph.replace(relation);
- }
- } else {
- if (relation === isOuter) {
- graph = graph.replace(relation.mergeTags(wayA.tags));
- graph = graph.replace(wayA.update({tags: {}}));
- graph = graph.replace(wayB.update({tags: {}}));
- }
+ // node_modules/name-suggestion-index/config/matchGroups.json
+ var matchGroups = {
+ adult_gaming_centre: [
+ "amenity/casino",
+ "amenity/gambling",
+ "leisure/adult_gaming_centre"
+ ],
+ beauty: [
+ "shop/beauty",
+ "shop/hairdresser_supply"
+ ],
+ bed: [
+ "shop/bed",
+ "shop/furniture"
+ ],
+ beverages: [
+ "shop/alcohol",
+ "shop/beer",
+ "shop/beverages",
+ "shop/wine"
+ ],
+ camping: [
+ "tourism/camp_site",
+ "tourism/caravan_site"
+ ],
+ car_parts: [
+ "shop/car_parts",
+ "shop/car_repair",
+ "shop/tires",
+ "shop/tyres"
+ ],
+ clinic: [
+ "amenity/clinic",
+ "amenity/doctors",
+ "healthcare/clinic",
+ "healthcare/laboratory",
+ "healthcare/physiotherapist",
+ "healthcare/sample_collection",
+ "healthcare/dialysis"
+ ],
+ convenience: [
+ "shop/beauty",
+ "shop/chemist",
+ "shop/convenience",
+ "shop/cosmetics",
+ "shop/grocery",
+ "shop/newsagent",
+ "shop/perfumery"
+ ],
+ coworking: [
+ "amenity/coworking_space",
+ "office/coworking",
+ "office/coworking_space"
+ ],
+ dentist: [
+ "amenity/dentist",
+ "amenity/doctors",
+ "healthcare/dentist"
+ ],
+ electronics: [
+ "office/telecommunication",
+ "shop/computer",
+ "shop/electronics",
+ "shop/hifi",
+ "shop/mobile",
+ "shop/mobile_phone",
+ "shop/telecommunication"
+ ],
+ fabric: [
+ "shop/fabric",
+ "shop/haberdashery",
+ "shop/sewing"
+ ],
+ fashion: [
+ "shop/accessories",
+ "shop/bag",
+ "shop/boutique",
+ "shop/clothes",
+ "shop/department_store",
+ "shop/fashion",
+ "shop/fashion_accessories",
+ "shop/sports",
+ "shop/shoes"
+ ],
+ financial: [
+ "amenity/bank",
+ "office/accountant",
+ "office/financial",
+ "office/financial_advisor",
+ "office/tax_advisor",
+ "shop/tax"
+ ],
+ fitness: [
+ "leisure/fitness_centre",
+ "leisure/fitness_center",
+ "leisure/sports_centre",
+ "leisure/sports_center"
+ ],
+ food: [
+ "amenity/bar",
+ "amenity/cafe",
+ "amenity/fast_food",
+ "amenity/ice_cream",
+ "amenity/pub",
+ "amenity/restaurant",
+ "shop/bakery",
+ "shop/candy",
+ "shop/chocolate",
+ "shop/coffee",
+ "shop/confectionary",
+ "shop/confectionery",
+ "shop/food",
+ "shop/ice_cream",
+ "shop/pastry",
+ "shop/tea"
+ ],
+ fuel: [
+ "amenity/fuel",
+ "shop/gas",
+ "shop/convenience;gas",
+ "shop/gas;convenience"
+ ],
+ gift: [
+ "shop/gift",
+ "shop/card",
+ "shop/cards",
+ "shop/stationery"
+ ],
+ hardware: [
+ "shop/bathroom_furnishing",
+ "shop/carpet",
+ "shop/diy",
+ "shop/doityourself",
+ "shop/doors",
+ "shop/electrical",
+ "shop/flooring",
+ "shop/hardware",
+ "shop/hardware_store",
+ "shop/power_tools",
+ "shop/tool_hire",
+ "shop/tools",
+ "shop/trade"
+ ],
+ health_food: [
+ "shop/health",
+ "shop/health_food",
+ "shop/herbalist",
+ "shop/nutrition_supplements"
+ ],
+ hobby: [
+ "shop/electronics",
+ "shop/hobby",
+ "shop/books",
+ "shop/games",
+ "shop/collector",
+ "shop/toys",
+ "shop/model",
+ "shop/video_games",
+ "shop/anime"
+ ],
+ hospital: [
+ "amenity/doctors",
+ "amenity/hospital",
+ "healthcare/hospital"
+ ],
+ houseware: [
+ "shop/houseware",
+ "shop/interior_decoration"
+ ],
+ lifeboat_station: [
+ "amenity/lifeboat_station",
+ "emergency/lifeboat_station",
+ "emergency/marine_rescue"
+ ],
+ lodging: [
+ "tourism/hotel",
+ "tourism/motel"
+ ],
+ money_transfer: [
+ "amenity/money_transfer",
+ "shop/money_transfer"
+ ],
+ office_supplies: [
+ "shop/office_supplies",
+ "shop/stationary",
+ "shop/stationery"
+ ],
+ outdoor: [
+ "shop/clothes",
+ "shop/outdoor",
+ "shop/sports"
+ ],
+ parcel_locker: [
+ "amenity/parcel_locker",
+ "amenity/vending_machine"
+ ],
+ pharmacy: [
+ "amenity/doctors",
+ "amenity/pharmacy",
+ "healthcare/pharmacy"
+ ],
+ playground: [
+ "amenity/theme_park",
+ "leisure/amusement_arcade",
+ "leisure/playground"
+ ],
+ rental: [
+ "amenity/bicycle_rental",
+ "amenity/boat_rental",
+ "amenity/car_rental",
+ "amenity/truck_rental",
+ "amenity/vehicle_rental",
+ "shop/rental"
+ ],
+ school: [
+ "amenity/childcare",
+ "amenity/college",
+ "amenity/kindergarten",
+ "amenity/language_school",
+ "amenity/prep_school",
+ "amenity/school",
+ "amenity/university"
+ ],
+ storage: [
+ "shop/storage_units",
+ "shop/storage_rental"
+ ],
+ substation: [
+ "power/station",
+ "power/substation",
+ "power/sub_station"
+ ],
+ supermarket: [
+ "shop/food",
+ "shop/frozen_food",
+ "shop/greengrocer",
+ "shop/grocery",
+ "shop/supermarket",
+ "shop/wholesale"
+ ],
+ variety_store: [
+ "shop/variety_store",
+ "shop/discount",
+ "shop/convenience"
+ ],
+ vending: [
+ "amenity/vending_machine",
+ "shop/vending_machine"
+ ],
+ weight_loss: [
+ "amenity/clinic",
+ "amenity/doctors",
+ "amenity/weight_clinic",
+ "healthcare/counselling",
+ "leisure/fitness_centre",
+ "office/therapist",
+ "shop/beauty",
+ "shop/diet",
+ "shop/food",
+ "shop/health_food",
+ "shop/herbalist",
+ "shop/nutrition",
+ "shop/nutrition_supplements",
+ "shop/weight_loss"
+ ],
+ wholesale: [
+ "shop/wholesale",
+ "shop/supermarket",
+ "shop/department_store"
+ ]
+ };
+ var matchGroups_default = {
+ matchGroups
+ };
- var member = {
- id: wayB.id,
- type: 'way',
- role: relation.memberById(wayA.id).role
- };
+ // node_modules/name-suggestion-index/config/genericWords.json
+ var genericWords = [
+ "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
+ "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
+ "^(club|green|out|ware)\\s?house$",
+ "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
+ "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
+ "^(hofladen|librairie|magazine?|maison)$",
+ "^(mobile home|skate)?\\s?park$",
+ "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
+ "^\\?+$",
+ "^private$",
+ "^tattoo( studio)?$",
+ "^windmill$",
+ "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
+ ];
+ var genericWords_default = {
+ genericWords
+ };
+
+ // node_modules/name-suggestion-index/config/trees.json
+ var trees = {
+ brands: {
+ emoji: "\u{1F354}",
+ mainTag: "brand:wikidata",
+ sourceTags: ["brand", "name"],
+ nameTags: {
+ primary: "^(name|name:\\w+)$",
+ alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
+ }
+ },
+ flags: {
+ emoji: "\u{1F6A9}",
+ mainTag: "flag:wikidata",
+ nameTags: {
+ primary: "^(flag:name|flag:name:\\w+)$",
+ alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
+ }
+ },
+ operators: {
+ emoji: "\u{1F4BC}",
+ mainTag: "operator:wikidata",
+ sourceTags: ["operator"],
+ nameTags: {
+ primary: "^(name|name:\\w+|operator|operator:\\w+)$",
+ alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
+ }
+ },
+ transit: {
+ emoji: "\u{1F687}",
+ mainTag: "network:wikidata",
+ sourceTags: ["network"],
+ nameTags: {
+ primary: "^network$",
+ alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
+ }
+ }
+ };
+ var trees_default = {
+ trees
+ };
- graph = iD.actions.AddMember(relation.id, member)(graph);
+ // node_modules/name-suggestion-index/lib/matcher.js
+ var matchGroups2 = matchGroups_default.matchGroups;
+ var trees2 = trees_default.trees;
+ var Matcher = class {
+ constructor() {
+ this.matchIndex = void 0;
+ this.genericWords = /* @__PURE__ */ new Map();
+ (genericWords_default.genericWords || []).forEach((s) => this.genericWords.set(s, new RegExp(s, "i")));
+ this.itemLocation = void 0;
+ this.locationSets = void 0;
+ this.locationIndex = void 0;
+ this.warnings = [];
+ }
+ buildMatchIndex(data) {
+ const that = this;
+ if (that.matchIndex)
+ return;
+ that.matchIndex = /* @__PURE__ */ new Map();
+ const seenTree = /* @__PURE__ */ new Map();
+ Object.keys(data).forEach((tkv) => {
+ const category = data[tkv];
+ const parts = tkv.split("/", 3);
+ const t = parts[0];
+ const k = parts[1];
+ const v = parts[2];
+ const thiskv = `${k}/${v}`;
+ const tree = trees2[t];
+ let branch = that.matchIndex.get(thiskv);
+ if (!branch) {
+ branch = {
+ primary: /* @__PURE__ */ new Map(),
+ alternate: /* @__PURE__ */ new Map(),
+ excludeGeneric: /* @__PURE__ */ new Map(),
+ excludeNamed: /* @__PURE__ */ new Map()
+ };
+ that.matchIndex.set(thiskv, branch);
+ }
+ const properties = category.properties || {};
+ const exclude = properties.exclude || {};
+ (exclude.generic || []).forEach((s) => branch.excludeGeneric.set(s, new RegExp(s, "i")));
+ (exclude.named || []).forEach((s) => branch.excludeNamed.set(s, new RegExp(s, "i")));
+ const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
+ let items = category.items;
+ if (!Array.isArray(items) || !items.length)
+ return;
+ const primaryName = new RegExp(tree.nameTags.primary, "i");
+ const alternateName = new RegExp(tree.nameTags.alternate, "i");
+ const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
+ const skipGenericKV = skipGenericKVMatches(t, k, v);
+ const genericKV = /* @__PURE__ */ new Set([`${k}/yes`, `building/yes`]);
+ const matchGroupKV = /* @__PURE__ */ new Set();
+ Object.values(matchGroups2).forEach((matchGroup) => {
+ const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
+ if (!inGroup)
+ return;
+ matchGroup.forEach((otherkv) => {
+ if (otherkv === thiskv)
+ return;
+ matchGroupKV.add(otherkv);
+ const otherk = otherkv.split("/", 2)[0];
+ genericKV.add(`${otherk}/yes`);
+ });
+ });
+ items.forEach((item) => {
+ if (!item.id)
+ return;
+ if (Array.isArray(item.matchTags) && item.matchTags.length) {
+ item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
+ if (!item.matchTags.length)
+ delete item.matchTags;
+ }
+ let kvTags = [`${thiskv}`].concat(item.matchTags || []);
+ if (!skipGenericKV) {
+ kvTags = kvTags.concat(Array.from(genericKV));
+ }
+ Object.keys(item.tags).forEach((osmkey) => {
+ if (notName.test(osmkey))
+ return;
+ const osmvalue = item.tags[osmkey];
+ if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
+ return;
+ if (primaryName.test(osmkey)) {
+ kvTags.forEach((kv) => insertName("primary", t, kv, simplify(osmvalue), item.id));
+ } else if (alternateName.test(osmkey)) {
+ kvTags.forEach((kv) => insertName("alternate", t, kv, simplify(osmvalue), item.id));
}
+ });
+ let keepMatchNames = /* @__PURE__ */ new Set();
+ (item.matchNames || []).forEach((matchName) => {
+ const nsimple = simplify(matchName);
+ kvTags.forEach((kv) => {
+ const branch2 = that.matchIndex.get(kv);
+ const primaryLeaf = branch2 && branch2.primary.get(nsimple);
+ const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
+ const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
+ const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
+ if (!inPrimary && !inAlternate) {
+ insertName("alternate", t, kv, nsimple, item.id);
+ keepMatchNames.add(matchName);
+ }
+ });
+ });
+ if (keepMatchNames.size) {
+ item.matchNames = Array.from(keepMatchNames);
+ } else {
+ delete item.matchNames;
+ }
});
-
- if (!isOuter && isArea) {
- var multipolygon = iD.Relation({
- tags: _.extend({}, wayA.tags, {type: 'multipolygon'}),
- members: [
- {id: wayA.id, role: 'outer', type: 'way'},
- {id: wayB.id, role: 'outer', type: 'way'}
- ]});
-
- graph = graph.replace(multipolygon);
- graph = graph.replace(wayA.update({tags: {}}));
- graph = graph.replace(wayB.update({tags: {}}));
+ });
+ function insertName(which, t, kv, nsimple, itemID) {
+ if (!nsimple) {
+ that.warnings.push(`Warning: skipping empty ${which} name for item ${t}/${kv}: ${itemID}`);
+ return;
+ }
+ let branch = that.matchIndex.get(kv);
+ if (!branch) {
+ branch = {
+ primary: /* @__PURE__ */ new Map(),
+ alternate: /* @__PURE__ */ new Map(),
+ excludeGeneric: /* @__PURE__ */ new Map(),
+ excludeNamed: /* @__PURE__ */ new Map()
+ };
+ that.matchIndex.set(kv, branch);
+ }
+ let leaf = branch[which].get(nsimple);
+ if (!leaf) {
+ leaf = /* @__PURE__ */ new Set();
+ branch[which].set(nsimple, leaf);
+ }
+ leaf.add(itemID);
+ if (!/yes$/.test(kv)) {
+ const kvnsimple = `${kv}/${nsimple}`;
+ const existing = seenTree.get(kvnsimple);
+ if (existing && existing !== t) {
+ const items = Array.from(leaf);
+ that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t}" and "${existing}", check items: ${items}`);
+ return;
+ }
+ seenTree.set(kvnsimple, t);
}
-
- return graph;
+ }
+ function skipGenericKVMatches(t, k, v) {
+ return t === "flags" || t === "transit" || k === "landuse" || v === "atm" || v === "bicycle_parking" || v === "car_sharing" || v === "caravan_site" || v === "charging_station" || v === "dog_park" || v === "parking" || v === "phone" || v === "playground" || v === "post_box" || v === "public_bookcase" || v === "recycling" || v === "vending_machine";
+ }
}
-
- var action = function(graph) {
- var candidates = action.ways(graph);
- for (var i = 0; i < candidates.length; i++) {
- graph = split(graph, candidates[i], newWayIds && newWayIds[i]);
+ buildLocationIndex(data, loco) {
+ const that = this;
+ if (that.locationIndex)
+ return;
+ that.itemLocation = /* @__PURE__ */ new Map();
+ that.locationSets = /* @__PURE__ */ new Map();
+ Object.keys(data).forEach((tkv) => {
+ const items = data[tkv].items;
+ if (!Array.isArray(items) || !items.length)
+ return;
+ items.forEach((item) => {
+ if (that.itemLocation.has(item.id))
+ return;
+ let resolved;
+ try {
+ resolved = loco.resolveLocationSet(item.locationSet);
+ } catch (err) {
+ console.warn(`buildLocationIndex: ${err.message}`);
+ }
+ if (!resolved || !resolved.id)
+ return;
+ that.itemLocation.set(item.id, resolved.id);
+ if (that.locationSets.has(resolved.id))
+ return;
+ let feature3 = _cloneDeep2(resolved.feature);
+ feature3.id = resolved.id;
+ feature3.properties.id = resolved.id;
+ if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
+ console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
+ console.warn(JSON.stringify(feature3));
+ return;
+ }
+ that.locationSets.set(resolved.id, feature3);
+ });
+ });
+ that.locationIndex = (0, import_which_polygon3.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
+ function _cloneDeep2(obj) {
+ return JSON.parse(JSON.stringify(obj));
+ }
+ }
+ match(k, v, n2, loc) {
+ const that = this;
+ if (!that.matchIndex) {
+ throw new Error("match: matchIndex not built.");
+ }
+ let matchLocations;
+ if (Array.isArray(loc) && that.locationIndex) {
+ matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
+ }
+ const nsimple = simplify(n2);
+ let seen = /* @__PURE__ */ new Set();
+ let results = [];
+ gatherResults("primary");
+ gatherResults("alternate");
+ if (results.length)
+ return results;
+ gatherResults("exclude");
+ return results.length ? results : null;
+ function gatherResults(which) {
+ const kv = `${k}/${v}`;
+ let didMatch = tryMatch(which, kv);
+ if (didMatch)
+ return;
+ for (let mg in matchGroups2) {
+ const matchGroup = matchGroups2[mg];
+ const inGroup = matchGroup.some((otherkv) => otherkv === kv);
+ if (!inGroup)
+ continue;
+ for (let i2 = 0; i2 < matchGroup.length; i2++) {
+ const otherkv = matchGroup[i2];
+ if (otherkv === kv)
+ continue;
+ didMatch = tryMatch(which, otherkv);
+ if (didMatch)
+ return;
+ }
}
- return graph;
- };
-
- action.ways = function(graph) {
- var node = graph.entity(nodeId),
- parents = graph.parentWays(node),
- hasLines = _.some(parents, function(parent) { return parent.geometry(graph) === 'line'; });
-
- return parents.filter(function(parent) {
- if (wayIds && wayIds.indexOf(parent.id) === -1)
- return false;
-
- if (!wayIds && hasLines && parent.geometry(graph) !== 'line')
- return false;
-
- if (parent.isClosed()) {
- return true;
- }
-
- for (var i = 1; i < parent.nodes.length - 1; i++) {
- if (parent.nodes[i] === nodeId) {
- return true;
- }
- }
-
- return false;
+ if (which === "exclude") {
+ const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n2));
+ if (regex) {
+ results.push({ match: "excludeGeneric", pattern: String(regex) });
+ return;
+ }
+ }
+ }
+ function tryMatch(which, kv) {
+ const branch = that.matchIndex.get(kv);
+ if (!branch)
+ return;
+ if (which === "exclude") {
+ let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n2));
+ if (regex) {
+ results.push({ match: "excludeNamed", pattern: String(regex), kv });
+ return;
+ }
+ regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n2));
+ if (regex) {
+ results.push({ match: "excludeGeneric", pattern: String(regex), kv });
+ return;
+ }
+ return;
+ }
+ const leaf = branch[which].get(nsimple);
+ if (!leaf || !leaf.size)
+ return;
+ let hits = Array.from(leaf).map((itemID) => {
+ let area = Infinity;
+ if (that.itemLocation && that.locationSets) {
+ const location = that.locationSets.get(that.itemLocation.get(itemID));
+ area = location && location.properties.area || Infinity;
+ }
+ return { match: which, itemID, area, kv, nsimple };
});
- };
-
- action.disabled = function(graph) {
- var candidates = action.ways(graph);
- if (candidates.length === 0 || (wayIds && wayIds.length !== candidates.length))
- return 'not_eligible';
- };
-
- action.limitWays = function(_) {
- if (!arguments.length) return wayIds;
- wayIds = _;
- return action;
- };
-
- return action;
-};
-/*
- * Based on https://github.com/openstreetmap/potlatch2/net/systemeD/potlatch2/tools/Straighten.as
- */
-
-iD.actions.Straighten = function(wayId, projection) {
- function positionAlongWay(n, s, e) {
- 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));
+ let sortFn = byAreaDescending;
+ if (matchLocations) {
+ hits = hits.filter(isValidLocation);
+ sortFn = byAreaAscending;
+ }
+ if (!hits.length)
+ return;
+ hits.sort(sortFn).forEach((hit) => {
+ if (seen.has(hit.itemID))
+ return;
+ seen.add(hit.itemID);
+ results.push(hit);
+ });
+ return true;
+ function isValidLocation(hit) {
+ if (!that.itemLocation)
+ return true;
+ return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
+ }
+ function byAreaAscending(hitA, hitB) {
+ return hitA.area - hitB.area;
+ }
+ function byAreaDescending(hitA, hitB) {
+ return hitB.area - hitA.area;
+ }
+ }
}
+ getWarnings() {
+ return this.warnings;
+ }
+ };
- var action = function(graph) {
- var way = graph.entity(wayId),
- nodes = graph.childNodes(way),
- points = nodes.map(function(n) { return projection(n.loc); }),
- startPoint = points[0],
- endPoint = points[points.length-1],
- toDelete = [],
- i;
-
- for (i = 1; i < points.length-1; i++) {
- var node = nodes[i],
- point = points[i];
-
- if (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]);
-
- graph = graph.replace(graph.entity(node.id)
- .move(projection.invert([p0, p1])));
- } else {
- // safe to delete
- if (toDelete.indexOf(node) === -1) {
- toDelete.push(node);
- }
- }
+ // modules/services/nsi.js
+ var import_vparse2 = __toESM(require_vparse());
+
+ // modules/core/difference.js
+ var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
+ function coreDifference(base, head) {
+ var _changes = {};
+ var _didChange = {};
+ var _diff = {};
+ function checkEntityID(id2) {
+ var h = head.entities[id2];
+ var b = base.entities[id2];
+ if (h === b)
+ return;
+ if (_changes[id2])
+ return;
+ if (!h && b) {
+ _changes[id2] = { base: b, head: h };
+ _didChange.deletion = true;
+ return;
+ }
+ if (h && !b) {
+ _changes[id2] = { base: b, head: h };
+ _didChange.addition = true;
+ return;
+ }
+ if (h && b) {
+ if (h.members && b.members && !(0, import_fast_deep_equal3.default)(h.members, b.members)) {
+ _changes[id2] = { base: b, head: h };
+ _didChange.geometry = true;
+ _didChange.properties = true;
+ return;
}
-
- for (i = 0; i < toDelete.length; i++) {
- graph = iD.actions.DeleteNode(toDelete[i].id)(graph);
+ if (h.loc && b.loc && !geoVecEqual(h.loc, b.loc)) {
+ _changes[id2] = { base: b, head: h };
+ _didChange.geometry = true;
}
-
- return graph;
- };
-
- action.disabled = function(graph) {
- // check way isn't too bendy
- var way = graph.entity(wayId),
- nodes = graph.childNodes(way),
- points = nodes.map(function(n) { return projection(n.loc); }),
- startPoint = points[0],
- endPoint = points[points.length-1],
- threshold = 0.2 * Math.sqrt(Math.pow(startPoint[0] - endPoint[0], 2) + Math.pow(startPoint[1] - endPoint[1], 2)),
- i;
-
- if (threshold === 0) {
- return 'too_bendy';
+ if (h.nodes && b.nodes && !(0, import_fast_deep_equal3.default)(h.nodes, b.nodes)) {
+ _changes[id2] = { base: b, head: h };
+ _didChange.geometry = true;
}
-
- for (i = 1; i < points.length-1; i++) {
- var point = points[i],
- u = positionAlongWay(point, startPoint, endPoint),
- p0 = startPoint[0] + u * (endPoint[0] - startPoint[0]),
- p1 = startPoint[1] + u * (endPoint[1] - startPoint[1]),
- dist = Math.sqrt(Math.pow(p0 - point[0], 2) + Math.pow(p1 - point[1], 2));
-
- // to bendy if point is off by 20% of total start/end distance in projected space
- if (isNaN(dist) || dist > threshold) {
- return 'too_bendy';
+ if (h.tags && b.tags && !(0, import_fast_deep_equal3.default)(h.tags, b.tags)) {
+ _changes[id2] = { base: b, head: h };
+ _didChange.properties = true;
+ }
+ }
+ }
+ function load() {
+ var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
+ for (var i2 = 0; i2 < ids.length; i2++) {
+ checkEntityID(ids[i2]);
+ }
+ }
+ load();
+ _diff.length = function length() {
+ return Object.keys(_changes).length;
+ };
+ _diff.changes = function changes() {
+ return _changes;
+ };
+ _diff.didChange = _didChange;
+ _diff.extantIDs = function extantIDs(includeRelMembers) {
+ var result = /* @__PURE__ */ new Set();
+ Object.keys(_changes).forEach(function(id2) {
+ if (_changes[id2].head) {
+ result.add(id2);
+ }
+ var h = _changes[id2].head;
+ var b = _changes[id2].base;
+ var entity = h || b;
+ if (includeRelMembers && entity.type === "relation") {
+ var mh = h ? h.members.map(function(m) {
+ return m.id;
+ }) : [];
+ var mb = b ? b.members.map(function(m) {
+ return m.id;
+ }) : [];
+ utilArrayUnion(mh, mb).forEach(function(memberID) {
+ if (head.hasEntity(memberID)) {
+ result.add(memberID);
}
+ });
}
+ });
+ return Array.from(result);
};
-
- return action;
-};
-// Remove the effects of `turn.restriction` on `turn`, which must have the
-// following structure:
-//
-// {
-// from: { node: , way: },
-// via: { node: },
-// to: { node: , way: },
-// restriction:
-// }
-//
-// In the simple case, `restriction` is a reference to a `no_*` restriction
-// on the turn itself. In this case, it is simply deleted.
-//
-// The more complex case is where `restriction` references an `only_*`
-// restriction on a different turn in the same intersection. In that case,
-// that restriction is also deleted, but at the same time restrictions on
-// the turns other than the first two are created.
-//
-iD.actions.UnrestrictTurn = function(turn) {
- return function(graph) {
- return iD.actions.DeleteRelation(turn.restriction)(graph);
+ _diff.modified = function modified() {
+ var result = [];
+ Object.values(_changes).forEach(function(change) {
+ if (change.base && change.head) {
+ result.push(change.head);
+ }
+ });
+ return result;
};
-};
-iD.behavior = {};
-iD.behavior.AddWay = function(context) {
- var event = d3.dispatch('start', 'startFromWay', 'startFromNode'),
- draw = iD.behavior.Draw(context);
-
- var addWay = function(surface) {
- draw.on('click', event.start)
- .on('clickWay', event.startFromWay)
- .on('clickNode', event.startFromNode)
- .on('cancel', addWay.cancel)
- .on('finish', addWay.cancel);
-
- context.map()
- .dblclickEnable(false);
-
- surface.call(draw);
+ _diff.created = function created() {
+ var result = [];
+ Object.values(_changes).forEach(function(change) {
+ if (!change.base && change.head) {
+ result.push(change.head);
+ }
+ });
+ return result;
};
-
- addWay.off = function(surface) {
- surface.call(draw.off);
+ _diff.deleted = function deleted() {
+ var result = [];
+ Object.values(_changes).forEach(function(change) {
+ if (change.base && !change.head) {
+ result.push(change.base);
+ }
+ });
+ return result;
};
+ _diff.summary = function summary() {
+ var relevant = {};
+ var keys = Object.keys(_changes);
+ for (var i2 = 0; i2 < keys.length; i2++) {
+ var change = _changes[keys[i2]];
+ if (change.head && change.head.geometry(head) !== "vertex") {
+ addEntity(change.head, head, change.base ? "modified" : "created");
+ } else if (change.base && change.base.geometry(base) !== "vertex") {
+ addEntity(change.base, base, "deleted");
+ } else if (change.base && change.head) {
+ var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
+ var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
+ if (moved) {
+ addParents(change.head);
+ }
+ if (retagged || moved && change.head.hasInterestingTags()) {
+ addEntity(change.head, head, "modified");
+ }
+ } else if (change.head && change.head.hasInterestingTags()) {
+ addEntity(change.head, head, "created");
+ } else if (change.base && change.base.hasInterestingTags()) {
+ addEntity(change.base, base, "deleted");
+ }
+ }
+ return Object.values(relevant);
+ function addEntity(entity, graph, changeType) {
+ relevant[entity.id] = {
+ entity,
+ graph,
+ changeType
+ };
+ }
+ function addParents(entity) {
+ var parents = head.parentWays(entity);
+ for (var j2 = parents.length - 1; j2 >= 0; j2--) {
+ var parent = parents[j2];
+ if (!(parent.id in relevant)) {
+ addEntity(parent, head, "modified");
+ }
+ }
+ }
+ };
+ _diff.complete = function complete(extent) {
+ var result = {};
+ var id2, change;
+ for (id2 in _changes) {
+ change = _changes[id2];
+ var h = change.head;
+ var b = change.base;
+ var entity = h || b;
+ var i2;
+ if (extent && (!h || !h.intersects(extent, head)) && (!b || !b.intersects(extent, base))) {
+ continue;
+ }
+ result[id2] = h;
+ if (entity.type === "way") {
+ var nh = h ? h.nodes : [];
+ var nb = b ? b.nodes : [];
+ var diff;
+ diff = utilArrayDifference(nh, nb);
+ for (i2 = 0; i2 < diff.length; i2++) {
+ result[diff[i2]] = head.hasEntity(diff[i2]);
+ }
+ diff = utilArrayDifference(nb, nh);
+ for (i2 = 0; i2 < diff.length; i2++) {
+ result[diff[i2]] = head.hasEntity(diff[i2]);
+ }
+ }
+ if (entity.type === "relation" && entity.isMultipolygon()) {
+ var mh = h ? h.members.map(function(m) {
+ return m.id;
+ }) : [];
+ var mb = b ? b.members.map(function(m) {
+ return m.id;
+ }) : [];
+ var ids = utilArrayUnion(mh, mb);
+ for (i2 = 0; i2 < ids.length; i2++) {
+ var member = head.hasEntity(ids[i2]);
+ if (!member)
+ continue;
+ if (extent && !member.intersects(extent, head))
+ continue;
+ result[ids[i2]] = member;
+ }
+ }
+ addParents(head.parentWays(entity), result);
+ addParents(head.parentRelations(entity), result);
+ }
+ return result;
+ function addParents(parents, result2) {
+ for (var i3 = 0; i3 < parents.length; i3++) {
+ var parent = parents[i3];
+ if (parent.id in result2)
+ continue;
+ result2[parent.id] = parent;
+ addParents(head.parentRelations(parent), result2);
+ }
+ }
+ };
+ return _diff;
+ }
- addWay.cancel = function() {
- window.setTimeout(function() {
- context.map().dblclickEnable(true);
- }, 1000);
-
- context.enter(iD.modes.Browse(context));
- };
-
- addWay.tail = function(text) {
- draw.tail(text);
- return addWay;
- };
-
- return d3.rebind(addWay, event, 'on');
-};
-iD.behavior.Breathe = function() {
- var duration = 800,
- selector = '.selected.shadow, .selected .shadow',
- selected = d3.select(null),
- classed = '',
- params = {},
- done;
-
- function reset(selection) {
- selection
- .style('stroke-opacity', null)
- .style('stroke-width', null)
- .style('fill-opacity', null)
- .style('r', null);
- }
-
- function setAnimationParams(transition, fromTo) {
- transition
- .style('stroke-opacity', function(d) { return params[d.id][fromTo].opacity; })
- .style('stroke-width', function(d) { return params[d.id][fromTo].width; })
- .style('fill-opacity', function(d) { return params[d.id][fromTo].opacity; })
- .style('r', function(d) { return params[d.id][fromTo].width; });
- }
-
- function calcAnimationParams(selection) {
- selection
- .call(reset)
- .each(function(d) {
- var s = d3.select(this),
- tag = s.node().tagName,
- p = {'from': {}, 'to': {}},
- opacity, width;
-
- // determine base opacity and width
- if (tag === 'circle') {
- opacity = parseFloat(s.style('fill-opacity') || 0.5);
- width = parseFloat(s.style('r') || 15.5);
- } else {
- opacity = parseFloat(s.style('stroke-opacity') || 0.7);
- width = parseFloat(s.style('stroke-width') || 10);
- }
-
- // calculate from/to interpolation params..
- p.tag = tag;
- p.from.opacity = opacity * 0.6;
- p.to.opacity = opacity * 1.25;
- p.from.width = width * 0.9;
- p.to.width = width * (tag === 'circle' ? 1.5 : 1.25);
- params[d.id] = p;
- });
+ // modules/core/tree.js
+ var import_rbush6 = __toESM(require_rbush_min());
+ function coreTree(head) {
+ var _rtree = new import_rbush6.default();
+ var _bboxes = {};
+ var _segmentsRTree = new import_rbush6.default();
+ var _segmentsBBoxes = {};
+ var _segmentsByWayId = {};
+ var tree = {};
+ function entityBBox(entity) {
+ var bbox = entity.extent(head).bbox();
+ bbox.id = entity.id;
+ _bboxes[entity.id] = bbox;
+ return bbox;
+ }
+ function segmentBBox(segment) {
+ var extent = segment.extent(head);
+ if (!extent)
+ return null;
+ var bbox = extent.bbox();
+ bbox.segment = segment;
+ _segmentsBBoxes[segment.id] = bbox;
+ return bbox;
+ }
+ function removeEntity(entity) {
+ _rtree.remove(_bboxes[entity.id]);
+ delete _bboxes[entity.id];
+ if (_segmentsByWayId[entity.id]) {
+ _segmentsByWayId[entity.id].forEach(function(segment) {
+ _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
+ delete _segmentsBBoxes[segment.id];
+ });
+ delete _segmentsByWayId[entity.id];
+ }
}
-
- function run(surface, fromTo) {
- var toFrom = (fromTo === 'from' ? 'to': 'from'),
- currSelected = surface.selectAll(selector),
- currClassed = surface.attr('class'),
- n = 0;
-
- if (done || currSelected.empty()) {
- selected.call(reset);
- return;
+ function loadEntities(entities) {
+ _rtree.load(entities.map(entityBBox));
+ var segments = [];
+ entities.forEach(function(entity) {
+ if (entity.segments) {
+ var entitySegments = entity.segments(head);
+ _segmentsByWayId[entity.id] = entitySegments;
+ segments = segments.concat(entitySegments);
}
-
- if (!_.isEqual(currSelected, selected) || currClassed !== classed) {
- selected.call(reset);
- classed = currClassed;
- selected = currSelected.call(calcAnimationParams);
+ });
+ if (segments.length)
+ _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
+ }
+ function updateParents(entity, insertions, memo) {
+ head.parentWays(entity).forEach(function(way) {
+ if (_bboxes[way.id]) {
+ removeEntity(way);
+ insertions[way.id] = way;
}
-
- selected
- .transition()
- .call(setAnimationParams, fromTo)
- .duration(duration)
- .each(function() { ++n; })
- .each('end', function() {
- if (!--n) { // call once
- surface.call(run, toFrom);
- }
- });
+ updateParents(way, insertions, memo);
+ });
+ head.parentRelations(entity).forEach(function(relation) {
+ if (memo[entity.id])
+ return;
+ memo[entity.id] = true;
+ if (_bboxes[relation.id]) {
+ removeEntity(relation);
+ insertions[relation.id] = relation;
+ }
+ updateParents(relation, insertions, memo);
+ });
}
-
- var breathe = function(surface) {
- done = false;
- d3.timer(function() {
- if (done) return true;
-
- var currSelected = surface.selectAll(selector);
- if (currSelected.empty()) return false;
-
- surface.call(run, 'from');
- return true;
- }, 200);
+ tree.rebase = function(entities, force) {
+ var insertions = {};
+ for (var i2 = 0; i2 < entities.length; i2++) {
+ var entity = entities[i2];
+ if (!entity.visible)
+ continue;
+ if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
+ if (!force) {
+ continue;
+ } else if (_bboxes[entity.id]) {
+ removeEntity(entity);
+ }
+ }
+ insertions[entity.id] = entity;
+ updateParents(entity, insertions, {});
+ }
+ loadEntities(Object.values(insertions));
+ return tree;
+ };
+ function updateToGraph(graph) {
+ if (graph === head)
+ return;
+ var diff = coreDifference(head, graph);
+ head = graph;
+ var changed = diff.didChange;
+ if (!changed.addition && !changed.deletion && !changed.geometry)
+ return;
+ var insertions = {};
+ if (changed.deletion) {
+ diff.deleted().forEach(function(entity) {
+ removeEntity(entity);
+ });
+ }
+ if (changed.geometry) {
+ diff.modified().forEach(function(entity) {
+ removeEntity(entity);
+ insertions[entity.id] = entity;
+ updateParents(entity, insertions, {});
+ });
+ }
+ if (changed.addition) {
+ diff.created().forEach(function(entity) {
+ insertions[entity.id] = entity;
+ });
+ }
+ loadEntities(Object.values(insertions));
+ }
+ tree.intersects = function(extent, graph) {
+ updateToGraph(graph);
+ return _rtree.search(extent.bbox()).map(function(bbox) {
+ return graph.entity(bbox.id);
+ });
};
-
- breathe.off = function() {
- done = true;
- d3.timer.flush();
- selected
- .transition()
- .call(reset)
- .duration(0);
+ tree.waySegments = function(extent, graph) {
+ updateToGraph(graph);
+ return _segmentsRTree.search(extent.bbox()).map(function(bbox) {
+ return bbox.segment;
+ });
};
+ return tree;
+ }
- return breathe;
-};
-iD.behavior.Copy = function(context) {
- var keybinding = d3.keybinding('copy');
-
- function groupEntities(ids, graph) {
- var entities = ids.map(function (id) { return graph.entity(id); });
- return _.extend({relation: [], way: [], node: []},
- _.groupBy(entities, function(entity) { return entity.type; }));
- }
-
- function getDescendants(id, graph, descendants) {
- var entity = graph.entity(id),
- i, children;
-
- descendants = descendants || {};
-
- if (entity.type === 'relation') {
- children = _.map(entity.members, 'id');
- } else if (entity.type === 'way') {
- children = entity.nodes;
- } else {
- children = [];
- }
+ // modules/svg/icon.js
+ function svgIcon(name2, svgklass, useklass) {
+ return function drawIcon(selection2) {
+ selection2.selectAll("svg.icon" + (svgklass ? "." + svgklass.split(" ")[0] : "")).data([0]).enter().append("svg").attr("class", "icon " + (svgklass || "")).append("use").attr("xlink:href", name2).attr("class", useklass);
+ };
+ }
- for (i = 0; i < children.length; i++) {
- if (!descendants[children[i]]) {
- descendants[children[i]] = true;
- descendants = getDescendants(children[i], graph, descendants);
- }
+ // modules/ui/modal.js
+ function uiModal(selection2, blocking) {
+ let keybinding = utilKeybinding("modal");
+ let previous = selection2.select("div.modal");
+ let animate = previous.empty();
+ previous.transition().duration(200).style("opacity", 0).remove();
+ let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
+ shaded.close = () => {
+ shaded.transition().duration(200).style("opacity", 0).remove();
+ modal.transition().duration(200).style("top", "0px");
+ select_default2(document).call(keybinding.unbind);
+ };
+ let modal = shaded.append("div").attr("class", "modal fillL");
+ modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
+ if (!blocking) {
+ shaded.on("click.remove-modal", (d3_event) => {
+ if (d3_event.target === this) {
+ shaded.close();
}
-
- return descendants;
+ });
+ modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
+ keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
+ select_default2(document).call(keybinding);
}
-
- function doCopy() {
- d3.event.preventDefault();
- if (context.inIntro()) return;
-
- var graph = context.graph(),
- selected = groupEntities(context.selectedIDs(), graph),
- canCopy = [],
- skip = {},
- i, entity;
-
- for (i = 0; i < selected.relation.length; i++) {
- entity = selected.relation[i];
- if (!skip[entity.id] && entity.isComplete(graph)) {
- canCopy.push(entity.id);
- skip = getDescendants(entity.id, graph, skip);
- }
- }
- for (i = 0; i < selected.way.length; i++) {
- entity = selected.way[i];
- if (!skip[entity.id]) {
- canCopy.push(entity.id);
- skip = getDescendants(entity.id, graph, skip);
- }
- }
- for (i = 0; i < selected.node.length; i++) {
- entity = selected.node[i];
- if (!skip[entity.id]) {
- canCopy.push(entity.id);
- }
- }
-
- context.copyIDs(canCopy);
+ modal.append("div").attr("class", "content");
+ modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
+ if (animate) {
+ shaded.transition().style("opacity", 1);
+ } else {
+ shaded.style("opacity", 1);
}
-
- function copy() {
- keybinding.on(iD.ui.cmd('âC'), doCopy);
- d3.select(document).call(keybinding);
- return copy;
+ return shaded;
+ function moveFocusToFirst() {
+ let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
+ if (node) {
+ node.focus();
+ } else {
+ select_default2(this).node().blur();
+ }
}
-
- copy.off = function() {
- d3.select(document).call(keybinding.off);
- };
-
- return copy;
-};
-/*
- `iD.behavior.drag` is like `d3.behavior.drag`, with the following differences:
-
- * The `origin` function is expected to return an [x, y] tuple rather than an
- {x, y} object.
- * The events are `start`, `move`, and `end`.
- (https://github.com/mbostock/d3/issues/563)
- * The `start` event is not dispatched until the first cursor movement occurs.
- (https://github.com/mbostock/d3/pull/368)
- * The `move` event has a `point` and `delta` [x, y] tuple properties rather
- than `x`, `y`, `dx`, and `dy` properties.
- * The `end` event is not dispatched if no movement occurs.
- * An `off` function is available that unbinds the drag's internal event handlers.
- * Delegation is supported via the `delegate` function.
-
- */
-iD.behavior.drag = function() {
- function d3_eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
+ function moveFocusToLast() {
+ let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
+ if (nodes.length) {
+ nodes[nodes.length - 1].focus();
+ } else {
+ select_default2(this).node().blur();
+ }
}
+ }
- var event = d3.dispatch('start', 'move', 'end'),
- origin = null,
- selector = '',
- filter = null,
- event_, target, surface;
-
- event.of = function(thiz, argumentz) {
- return function(e1) {
- var e0 = e1.sourceEvent = d3.event;
- e1.target = drag;
- d3.event = e1;
- try {
- event[e1.type].apply(thiz, argumentz);
- } finally {
- d3.event = e0;
- }
- };
+ // modules/ui/loading.js
+ function uiLoading(context) {
+ let _modalSelection = select_default2(null);
+ let _message = "";
+ let _blocking = false;
+ let loading = (selection2) => {
+ _modalSelection = uiModal(selection2, _blocking);
+ let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
+ loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
+ loadertext.append("h3").html(_message);
+ _modalSelection.select("button.close").attr("class", "hide");
+ return loading;
+ };
+ loading.message = function(val) {
+ if (!arguments.length)
+ return _message;
+ _message = val;
+ return loading;
+ };
+ loading.blocking = function(val) {
+ if (!arguments.length)
+ return _blocking;
+ _blocking = val;
+ return loading;
+ };
+ loading.close = () => {
+ _modalSelection.remove();
+ };
+ loading.isShown = () => {
+ return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
};
+ return loading;
+ }
- var d3_event_userSelectProperty = iD.util.prefixCSSProperty('UserSelect'),
- d3_event_userSelectSuppress = d3_event_userSelectProperty ?
- function () {
- var selection = d3.selection(),
- select = selection.style(d3_event_userSelectProperty);
- selection.style(d3_event_userSelectProperty, 'none');
- return function () {
- selection.style(d3_event_userSelectProperty, select);
- };
- } :
- function (type) {
- var w = d3.select(window).on('selectstart.' + type, d3_eventCancel);
- return function () {
- w.on('selectstart.' + type, null);
- };
+ // modules/core/history.js
+ function coreHistory(context) {
+ var dispatch10 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
+ var lock = utilSessionMutex("lock");
+ var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
+ var duration = 150;
+ var _imageryUsed = [];
+ var _photoOverlaysUsed = [];
+ var _checkpoints = {};
+ var _pausedGraph;
+ var _stack;
+ var _index;
+ var _tree;
+ function _act(actions, t) {
+ actions = Array.prototype.slice.call(actions);
+ var annotation;
+ if (typeof actions[actions.length - 1] !== "function") {
+ annotation = actions.pop();
+ }
+ var graph = _stack[_index].graph;
+ for (var i2 = 0; i2 < actions.length; i2++) {
+ graph = actions[i2](graph, t);
+ }
+ return {
+ graph,
+ annotation,
+ imageryUsed: _imageryUsed,
+ photoOverlaysUsed: _photoOverlaysUsed,
+ transform: context.projection.transform(),
+ selectedIDs: context.selectedIDs()
+ };
+ }
+ function _perform(args, t) {
+ var previous = _stack[_index].graph;
+ _stack = _stack.slice(0, _index + 1);
+ var actionResult = _act(args, t);
+ _stack.push(actionResult);
+ _index++;
+ return change(previous);
+ }
+ function _replace(args, t) {
+ var previous = _stack[_index].graph;
+ var actionResult = _act(args, t);
+ _stack[_index] = actionResult;
+ return change(previous);
+ }
+ function _overwrite(args, t) {
+ var previous = _stack[_index].graph;
+ if (_index > 0) {
+ _index--;
+ _stack.pop();
+ }
+ _stack = _stack.slice(0, _index + 1);
+ var actionResult = _act(args, t);
+ _stack.push(actionResult);
+ _index++;
+ return change(previous);
+ }
+ function change(previous) {
+ var difference = coreDifference(previous, history.graph());
+ if (!_pausedGraph) {
+ dispatch10.call("change", this, difference);
+ }
+ return difference;
+ }
+ function getKey(n2) {
+ return "iD_" + window.location.origin + "_" + n2;
+ }
+ var history = {
+ graph: function() {
+ return _stack[_index].graph;
+ },
+ tree: function() {
+ return _tree;
+ },
+ base: function() {
+ return _stack[0].graph;
+ },
+ merge: function(entities) {
+ var stack = _stack.map(function(state) {
+ return state.graph;
+ });
+ _stack[0].graph.rebase(entities, stack, false);
+ _tree.rebase(entities, false);
+ dispatch10.call("merge", this, entities);
+ },
+ perform: function() {
+ select_default2(document).interrupt("history.perform");
+ var transitionable = false;
+ var action0 = arguments[0];
+ if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
+ transitionable = !!action0.transitionable;
+ }
+ if (transitionable) {
+ var origArguments = arguments;
+ select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
+ return function(t) {
+ if (t < 1)
+ _overwrite([action0], t);
};
-
- function mousedown() {
- target = this;
- event_ = event.of(target, arguments);
- var eventTarget = d3.event.target,
- touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null,
- offset,
- origin_ = point(),
- started = false,
- selectEnable = d3_event_userSelectSuppress(touchId !== null ? 'drag-' + touchId : 'drag');
-
- var w = d3.select(window)
- .on(touchId !== null ? 'touchmove.drag-' + touchId : 'mousemove.drag', dragmove)
- .on(touchId !== null ? 'touchend.drag-' + touchId : 'mouseup.drag', dragend, true);
-
- if (origin) {
- offset = origin.apply(target, arguments);
- offset = [offset[0] - origin_[0], offset[1] - origin_[1]];
+ }).on("start", function() {
+ _perform([action0], 0);
+ }).on("end interrupt", function() {
+ _overwrite(origArguments, 1);
+ });
} else {
- offset = [0, 0];
+ return _perform(arguments);
}
-
- if (touchId === null) d3.event.stopPropagation();
-
- function point() {
- var p = target.parentNode || surface;
- return touchId !== null ? d3.touches(p).filter(function(p) {
- return p.identifier === touchId;
- })[0] : d3.mouse(p);
+ },
+ replace: function() {
+ select_default2(document).interrupt("history.perform");
+ return _replace(arguments, 1);
+ },
+ overwrite: function() {
+ select_default2(document).interrupt("history.perform");
+ return _overwrite(arguments, 1);
+ },
+ pop: function(n2) {
+ select_default2(document).interrupt("history.perform");
+ var previous = _stack[_index].graph;
+ if (isNaN(+n2) || +n2 < 0) {
+ n2 = 1;
}
-
- function dragmove() {
-
- var p = point(),
- dx = p[0] - origin_[0],
- dy = p[1] - origin_[1];
-
- if (dx === 0 && dy === 0)
- return;
-
- if (!started) {
- started = true;
- event_({
- type: 'start'
- });
- }
-
- origin_ = p;
- d3_eventCancel();
-
- event_({
- type: 'move',
- point: [p[0] + offset[0], p[1] + offset[1]],
- delta: [dx, dy]
- });
+ while (n2-- > 0 && _index > 0) {
+ _index--;
+ _stack.pop();
}
-
- function dragend() {
- if (started) {
- event_({
- type: 'end'
- });
-
- d3_eventCancel();
- if (d3.event.target === eventTarget) w.on('click.drag', click, true);
- }
-
- w.on(touchId !== null ? 'touchmove.drag-' + touchId : 'mousemove.drag', null)
- .on(touchId !== null ? 'touchend.drag-' + touchId : 'mouseup.drag', null);
- selectEnable();
+ return change(previous);
+ },
+ undo: function() {
+ select_default2(document).interrupt("history.perform");
+ var previousStack = _stack[_index];
+ var previous = previousStack.graph;
+ while (_index > 0) {
+ _index--;
+ if (_stack[_index].annotation)
+ break;
+ }
+ dispatch10.call("undone", this, _stack[_index], previousStack);
+ return change(previous);
+ },
+ redo: function() {
+ select_default2(document).interrupt("history.perform");
+ var previousStack = _stack[_index];
+ var previous = previousStack.graph;
+ var tryIndex = _index;
+ while (tryIndex < _stack.length - 1) {
+ tryIndex++;
+ if (_stack[tryIndex].annotation) {
+ _index = tryIndex;
+ dispatch10.call("redone", this, _stack[_index], previousStack);
+ break;
+ }
}
-
- function click() {
- d3_eventCancel();
- w.on('click.drag', null);
+ return change(previous);
+ },
+ pauseChangeDispatch: function() {
+ if (!_pausedGraph) {
+ _pausedGraph = _stack[_index].graph;
}
- }
-
- function drag(selection) {
- var matchesSelector = iD.util.prefixDOMProperty('matchesSelector'),
- delegate = mousedown;
-
- if (selector) {
- delegate = function() {
- var root = this,
- target = d3.event.target;
- for (; target && target !== root; target = target.parentNode) {
- if (target[matchesSelector](selector) &&
- (!filter || filter(target.__data__))) {
- return mousedown.call(target, target.__data__);
- }
- }
- };
+ },
+ resumeChangeDispatch: function() {
+ if (_pausedGraph) {
+ var previous = _pausedGraph;
+ _pausedGraph = null;
+ return change(previous);
}
-
- selection.on('mousedown.drag' + selector, delegate)
- .on('touchstart.drag' + selector, delegate);
- }
-
- drag.off = function(selection) {
- selection.on('mousedown.drag' + selector, null)
- .on('touchstart.drag' + selector, null);
- };
-
- drag.delegate = function(_) {
- if (!arguments.length) return selector;
- selector = _;
- return drag;
- };
-
- drag.filter = function(_) {
- if (!arguments.length) return origin;
- filter = _;
- return drag;
- };
-
- drag.origin = function (_) {
- if (!arguments.length) return origin;
- origin = _;
- return drag;
- };
-
- drag.cancel = function() {
- d3.select(window)
- .on('mousemove.drag', null)
- .on('mouseup.drag', null);
- return drag;
- };
-
- drag.target = function() {
- if (!arguments.length) return target;
- target = arguments[0];
- event_ = event.of(target, Array.prototype.slice.call(arguments, 1));
- return drag;
- };
-
- drag.surface = function() {
- if (!arguments.length) return surface;
- surface = arguments[0];
- return drag;
- };
-
- return d3.rebind(drag, event, 'on');
-};
-iD.behavior.Draw = function(context) {
- var event = d3.dispatch('move', 'click', 'clickWay',
- 'clickNode', 'undo', 'cancel', 'finish'),
- keybinding = d3.keybinding('draw'),
- hover = iD.behavior.Hover(context)
- .altDisables(true)
- .on('hover', context.ui().sidebar.hover),
- tail = iD.behavior.Tail(),
- edit = iD.behavior.Edit(context),
- closeTolerance = 4,
- tolerance = 12,
- mouseLeave = false,
- lastMouse = null,
- cached = iD.behavior.Draw;
-
- function datum() {
- if (d3.event.altKey) return {};
-
- if (d3.event.type === 'keydown') {
- return (lastMouse && lastMouse.target.__data__) || {};
- } else {
- return d3.event.target.__data__ || {};
+ },
+ undoAnnotation: function() {
+ var i2 = _index;
+ while (i2 >= 0) {
+ if (_stack[i2].annotation)
+ return _stack[i2].annotation;
+ i2--;
}
- }
-
- function mousedown() {
-
- function point() {
- var p = context.container().node();
- return touchId !== null ? d3.touches(p).filter(function(p) {
- return p.identifier === touchId;
- })[0] : d3.mouse(p);
+ },
+ redoAnnotation: function() {
+ var i2 = _index + 1;
+ while (i2 <= _stack.length - 1) {
+ if (_stack[i2].annotation)
+ return _stack[i2].annotation;
+ i2++;
}
-
- var element = d3.select(this),
- touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null,
- t1 = +new Date(),
- p1 = point();
-
- element.on('mousemove.draw', null);
-
- d3.select(window).on('mouseup.draw', function() {
- var t2 = +new Date(),
- p2 = point(),
- dist = iD.geo.euclideanDistance(p1, p2);
-
- element.on('mousemove.draw', mousemove);
- d3.select(window).on('mouseup.draw', null);
-
- if (dist < closeTolerance || (dist < tolerance && (t2 - t1) < 500)) {
- // Prevent a quick second click
- d3.select(window).on('click.draw-block', function() {
- d3.event.stopPropagation();
- }, true);
-
- context.map().dblclickEnable(false);
-
- window.setTimeout(function() {
- context.map().dblclickEnable(true);
- d3.select(window).on('click.draw-block', null);
- }, 500);
-
- click();
- }
- });
- }
-
- function mousemove() {
- lastMouse = d3.event;
- event.move(datum());
- }
-
- function mouseenter() {
- mouseLeave = false;
- }
-
- function mouseleave() {
- mouseLeave = true;
- }
-
- function click() {
- var d = datum();
- if (d.type === 'way') {
- var dims = context.map().dimensions(),
- mouse = context.mouse(),
- pad = 5,
- trySnap = mouse[0] > pad && mouse[0] < dims[0] - pad &&
- mouse[1] > pad && mouse[1] < dims[1] - pad;
-
- if (trySnap) {
- var choice = iD.geo.chooseEdge(context.childNodes(d), context.mouse(), context.projection),
- edge = [d.nodes[choice.index - 1], d.nodes[choice.index]];
- event.clickWay(choice.loc, edge);
- } else {
- event.click(context.map().mouseCoordinates());
- }
-
- } else if (d.type === 'node') {
- event.clickNode(d);
-
+ },
+ intersects: function(extent) {
+ return _tree.intersects(extent, _stack[_index].graph);
+ },
+ difference: function() {
+ var base = _stack[0].graph;
+ var head = _stack[_index].graph;
+ return coreDifference(base, head);
+ },
+ changes: function(action) {
+ var base = _stack[0].graph;
+ var head = _stack[_index].graph;
+ if (action) {
+ head = action(head);
+ }
+ var difference = coreDifference(base, head);
+ return {
+ modified: difference.modified(),
+ created: difference.created(),
+ deleted: difference.deleted()
+ };
+ },
+ hasChanges: function() {
+ return this.difference().length() > 0;
+ },
+ imageryUsed: function(sources) {
+ if (sources) {
+ _imageryUsed = sources;
+ return history;
} else {
- event.click(context.map().mouseCoordinates());
+ var s = /* @__PURE__ */ new Set();
+ _stack.slice(1, _index + 1).forEach(function(state) {
+ state.imageryUsed.forEach(function(source) {
+ if (source !== "Custom") {
+ s.add(source);
+ }
+ });
+ });
+ return Array.from(s);
}
- }
-
- function space() {
- var currSpace = context.mouse();
- if (cached.disableSpace && cached.lastSpace) {
- var dist = iD.geo.euclideanDistance(cached.lastSpace, currSpace);
- if (dist > tolerance) {
- cached.disableSpace = false;
+ },
+ photoOverlaysUsed: function(sources) {
+ if (sources) {
+ _photoOverlaysUsed = sources;
+ return history;
+ } else {
+ var s = /* @__PURE__ */ new Set();
+ _stack.slice(1, _index + 1).forEach(function(state) {
+ if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
+ state.photoOverlaysUsed.forEach(function(photoOverlay) {
+ s.add(photoOverlay);
+ });
}
+ });
+ return Array.from(s);
}
-
- if (cached.disableSpace || mouseLeave || !lastMouse) return;
-
- // user must move mouse or release space bar to allow another click
- cached.lastSpace = currSpace;
- cached.disableSpace = true;
-
- d3.select(window).on('keyup.space-block', function() {
- cached.disableSpace = false;
- d3.select(window).on('keyup.space-block', null);
+ },
+ checkpoint: function(key) {
+ _checkpoints[key] = {
+ stack: _stack,
+ index: _index
+ };
+ return history;
+ },
+ reset: function(key) {
+ if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
+ _stack = _checkpoints[key].stack;
+ _index = _checkpoints[key].index;
+ } else {
+ _stack = [{ graph: coreGraph() }];
+ _index = 0;
+ _tree = coreTree(_stack[0].graph);
+ _checkpoints = {};
+ }
+ dispatch10.call("reset");
+ dispatch10.call("change");
+ return history;
+ },
+ toIntroGraph: function() {
+ var nextID = { n: 0, r: 0, w: 0 };
+ var permIDs = {};
+ var graph = this.graph();
+ var baseEntities = {};
+ Object.values(graph.base().entities).forEach(function(entity) {
+ var copy2 = copyIntroEntity(entity);
+ baseEntities[copy2.id] = copy2;
});
-
- d3.event.preventDefault();
- click();
- }
-
- function backspace() {
- d3.event.preventDefault();
- event.undo();
- }
-
- function del() {
- d3.event.preventDefault();
- event.cancel();
- }
-
- function ret() {
- d3.event.preventDefault();
- event.finish();
- }
-
- function draw(selection) {
- context.install(hover);
- context.install(edit);
-
- if (!context.inIntro() && !cached.usedTails[tail.text()]) {
- context.install(tail);
- }
-
- keybinding
- .on('â«', backspace)
- .on('â¦', del)
- .on('â', ret)
- .on('â©', ret)
- .on('space', space)
- .on('â¥space', space);
-
- selection
- .on('mouseenter.draw', mouseenter)
- .on('mouseleave.draw', mouseleave)
- .on('mousedown.draw', mousedown)
- .on('mousemove.draw', mousemove);
-
- d3.select(document)
- .call(keybinding);
-
- return draw;
- }
-
- draw.off = function(selection) {
- context.ui().sidebar.hover.cancel();
- context.uninstall(hover);
- context.uninstall(edit);
-
- if (!context.inIntro() && !cached.usedTails[tail.text()]) {
- context.uninstall(tail);
- cached.usedTails[tail.text()] = true;
+ Object.keys(graph.entities).forEach(function(id2) {
+ var entity = graph.entities[id2];
+ if (entity) {
+ var copy2 = copyIntroEntity(entity);
+ baseEntities[copy2.id] = copy2;
+ } else {
+ delete baseEntities[id2];
+ }
+ });
+ Object.values(baseEntities).forEach(function(entity) {
+ if (Array.isArray(entity.nodes)) {
+ entity.nodes = entity.nodes.map(function(node) {
+ return permIDs[node] || node;
+ });
+ }
+ if (Array.isArray(entity.members)) {
+ entity.members = entity.members.map(function(member) {
+ member.id = permIDs[member.id] || member.id;
+ return member;
+ });
+ }
+ });
+ return JSON.stringify({ dataIntroGraph: baseEntities });
+ function copyIntroEntity(source) {
+ var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
+ if (copy2.tags && !Object.keys(copy2.tags)) {
+ delete copy2.tags;
+ }
+ if (Array.isArray(copy2.loc)) {
+ copy2.loc[0] = +copy2.loc[0].toFixed(6);
+ copy2.loc[1] = +copy2.loc[1].toFixed(6);
+ }
+ var match = source.id.match(/([nrw])-\d*/);
+ if (match !== null) {
+ var nrw = match[1];
+ var permID;
+ do {
+ permID = nrw + ++nextID[nrw];
+ } while (baseEntities.hasOwnProperty(permID));
+ copy2.id = permIDs[source.id] = permID;
+ }
+ return copy2;
}
-
- selection
- .on('mouseenter.draw', null)
- .on('mouseleave.draw', null)
- .on('mousedown.draw', null)
- .on('mousemove.draw', null);
-
- d3.select(window)
- .on('mouseup.draw', null);
- // note: keyup.space-block, click.draw-block should remain
-
- d3.select(document)
- .call(keybinding.off);
- };
-
- draw.tail = function(_) {
- tail.text(_);
- return draw;
- };
-
- return d3.rebind(draw, event, 'on');
-};
-
-iD.behavior.Draw.usedTails = {};
-iD.behavior.Draw.disableSpace = false;
-iD.behavior.Draw.lastSpace = null;
-iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
- var way = context.entity(wayId),
- isArea = context.geometry(wayId) === 'area',
- finished = false,
- annotation = t((way.isDegenerate() ?
- 'operations.start.annotation.' :
- 'operations.continue.annotation.') + context.geometry(wayId)),
- draw = iD.behavior.Draw(context);
-
- var startIndex = typeof index === 'undefined' ? way.nodes.length - 1 : 0,
- start = iD.Node({loc: context.graph().entity(way.nodes[startIndex]).loc}),
- end = iD.Node({loc: context.map().mouseCoordinates()}),
- segment = iD.Way({
- nodes: typeof index === 'undefined' ? [start.id, end.id] : [end.id, start.id],
- tags: _.clone(way.tags)
+ },
+ toJSON: function() {
+ if (!this.hasChanges())
+ return;
+ var allEntities = {};
+ var baseEntities = {};
+ var base = _stack[0];
+ var s = _stack.map(function(i2) {
+ var modified = [];
+ var deleted = [];
+ Object.keys(i2.graph.entities).forEach(function(id2) {
+ var entity = i2.graph.entities[id2];
+ if (entity) {
+ var key = osmEntity.key(entity);
+ allEntities[key] = entity;
+ modified.push(key);
+ } else {
+ deleted.push(id2);
+ }
+ if (id2 in base.graph.entities) {
+ baseEntities[id2] = base.graph.entities[id2];
+ }
+ if (entity && entity.nodes) {
+ entity.nodes.forEach(function(nodeID) {
+ if (nodeID in base.graph.entities) {
+ baseEntities[nodeID] = base.graph.entities[nodeID];
+ }
+ });
+ }
+ var baseParents = base.graph._parentWays[id2];
+ if (baseParents) {
+ baseParents.forEach(function(parentID) {
+ if (parentID in base.graph.entities) {
+ baseEntities[parentID] = base.graph.entities[parentID];
+ }
+ });
+ }
+ });
+ var x = {};
+ if (modified.length)
+ x.modified = modified;
+ if (deleted.length)
+ x.deleted = deleted;
+ if (i2.imageryUsed)
+ x.imageryUsed = i2.imageryUsed;
+ if (i2.photoOverlaysUsed)
+ x.photoOverlaysUsed = i2.photoOverlaysUsed;
+ if (i2.annotation)
+ x.annotation = i2.annotation;
+ if (i2.transform)
+ x.transform = i2.transform;
+ if (i2.selectedIDs)
+ x.selectedIDs = i2.selectedIDs;
+ return x;
});
-
- var f = context[way.isDegenerate() ? 'replace' : 'perform'];
- if (isArea) {
- f(iD.actions.AddEntity(end),
- iD.actions.AddVertex(wayId, end.id, index));
- } else {
- f(iD.actions.AddEntity(start),
- iD.actions.AddEntity(end),
- iD.actions.AddEntity(segment));
- }
-
- function move(datum) {
- var loc;
-
- if (datum.type === 'node' && datum.id !== end.id) {
- loc = datum.loc;
-
- } else if (datum.type === 'way' && datum.id !== segment.id) {
- var dims = context.map().dimensions(),
- mouse = context.mouse(),
- pad = 5,
- trySnap = mouse[0] > pad && mouse[0] < dims[0] - pad &&
- mouse[1] > pad && mouse[1] < dims[1] - pad;
-
- if (trySnap) {
- loc = iD.geo.chooseEdge(context.childNodes(datum), context.mouse(), context.projection).loc;
+ return JSON.stringify({
+ version: 3,
+ entities: Object.values(allEntities),
+ baseEntities: Object.values(baseEntities),
+ stack: s,
+ nextIDs: osmEntity.id.next,
+ index: _index,
+ timestamp: new Date().getTime()
+ });
+ },
+ fromJSON: function(json, loadChildNodes) {
+ var h = JSON.parse(json);
+ var loadComplete = true;
+ osmEntity.id.next = h.nextIDs;
+ _index = h.index;
+ if (h.version === 2 || h.version === 3) {
+ var allEntities = {};
+ h.entities.forEach(function(entity) {
+ allEntities[osmEntity.key(entity)] = osmEntity(entity);
+ });
+ if (h.version === 3) {
+ var baseEntities = h.baseEntities.map(function(d) {
+ return osmEntity(d);
+ });
+ var stack = _stack.map(function(state) {
+ return state.graph;
+ });
+ _stack[0].graph.rebase(baseEntities, stack, true);
+ _tree.rebase(baseEntities, true);
+ if (loadChildNodes) {
+ var osm = context.connection();
+ var baseWays = baseEntities.filter(function(e) {
+ return e.type === "way";
+ });
+ var nodeIDs = baseWays.reduce(function(acc, way) {
+ return utilArrayUnion(acc, way.nodes);
+ }, []);
+ var missing = nodeIDs.filter(function(n2) {
+ return !_stack[0].graph.hasEntity(n2);
+ });
+ if (missing.length && osm) {
+ loadComplete = false;
+ context.map().redrawEnable(false);
+ var loading = uiLoading(context).blocking(true);
+ context.container().call(loading);
+ var childNodesLoaded = function(err, result) {
+ if (!err) {
+ var visibleGroups = utilArrayGroupBy(result.data, "visible");
+ var visibles = visibleGroups.true || [];
+ var invisibles = visibleGroups.false || [];
+ if (visibles.length) {
+ var visibleIDs = visibles.map(function(entity) {
+ return entity.id;
+ });
+ var stack2 = _stack.map(function(state) {
+ return state.graph;
+ });
+ missing = utilArrayDifference(missing, visibleIDs);
+ _stack[0].graph.rebase(visibles, stack2, true);
+ _tree.rebase(visibles, true);
+ }
+ invisibles.forEach(function(entity) {
+ osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
+ });
+ }
+ if (err || !missing.length) {
+ loading.close();
+ context.map().redrawEnable(true);
+ dispatch10.call("change");
+ dispatch10.call("restore", this);
+ }
+ };
+ osm.loadMultiple(missing, childNodesLoaded);
+ }
}
- }
-
- if (!loc) {
- loc = context.map().mouseCoordinates();
- }
-
- context.replace(iD.actions.MoveNode(end.id, loc));
- }
-
- function undone() {
- finished = true;
- context.enter(iD.modes.Browse(context));
- }
-
- function setActiveElements() {
- var active = isArea ? [wayId, end.id] : [segment.id, start.id, end.id];
- context.surface().selectAll(iD.util.entitySelector(active))
- .classed('active', true);
- }
-
- var drawWay = function(surface) {
- draw.on('move', move)
- .on('click', drawWay.add)
- .on('clickWay', drawWay.addWay)
- .on('clickNode', drawWay.addNode)
- .on('undo', context.undo)
- .on('cancel', drawWay.cancel)
- .on('finish', drawWay.finish);
-
- context.map()
- .dblclickEnable(false)
- .on('drawn.draw', setActiveElements);
-
- setActiveElements();
-
- surface.call(draw);
-
- context.history()
- .on('undone.draw', undone);
- };
-
- drawWay.off = function(surface) {
- if (!finished)
- context.pop();
-
- context.map()
- .on('drawn.draw', null);
-
- surface.call(draw.off)
- .selectAll('.active')
- .classed('active', false);
-
- context.history()
- .on('undone.draw', null);
+ }
+ _stack = h.stack.map(function(d) {
+ var entities = {}, entity;
+ if (d.modified) {
+ d.modified.forEach(function(key) {
+ entity = allEntities[key];
+ entities[entity.id] = entity;
+ });
+ }
+ if (d.deleted) {
+ d.deleted.forEach(function(id2) {
+ entities[id2] = void 0;
+ });
+ }
+ return {
+ graph: coreGraph(_stack[0].graph).load(entities),
+ annotation: d.annotation,
+ imageryUsed: d.imageryUsed,
+ photoOverlaysUsed: d.photoOverlaysUsed,
+ transform: d.transform,
+ selectedIDs: d.selectedIDs
+ };
+ });
+ } else {
+ _stack = h.stack.map(function(d) {
+ var entities = {};
+ for (var i2 in d.entities) {
+ var entity = d.entities[i2];
+ entities[i2] = entity === "undefined" ? void 0 : osmEntity(entity);
+ }
+ d.graph = coreGraph(_stack[0].graph).load(entities);
+ return d;
+ });
+ }
+ var transform2 = _stack[_index].transform;
+ if (transform2) {
+ context.map().transformEase(transform2, 0);
+ }
+ if (loadComplete) {
+ dispatch10.call("change");
+ dispatch10.call("restore", this);
+ }
+ return history;
+ },
+ lock: function() {
+ return lock.lock();
+ },
+ unlock: function() {
+ lock.unlock();
+ },
+ save: function() {
+ if (lock.locked() && !_hasUnresolvedRestorableChanges) {
+ const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
+ if (!success)
+ dispatch10.call("storage_error");
+ }
+ return history;
+ },
+ clearSaved: function() {
+ context.debouncedSave.cancel();
+ if (lock.locked()) {
+ _hasUnresolvedRestorableChanges = false;
+ corePreferences(getKey("saved_history"), null);
+ corePreferences("comment", null);
+ corePreferences("hashtags", null);
+ corePreferences("source", null);
+ }
+ return history;
+ },
+ savedHistoryJSON: function() {
+ return corePreferences(getKey("saved_history"));
+ },
+ hasRestorableChanges: function() {
+ return _hasUnresolvedRestorableChanges;
+ },
+ restore: function() {
+ if (lock.locked()) {
+ _hasUnresolvedRestorableChanges = false;
+ var json = this.savedHistoryJSON();
+ if (json)
+ history.fromJSON(json, true);
+ }
+ },
+ _getKey: getKey
};
+ history.reset();
+ return utilRebind(history, dispatch10, "on");
+ }
- function ReplaceTemporaryNode(newNode) {
- return function(graph) {
- if (isArea) {
- return graph
- .replace(way.addNode(newNode.id, index))
- .remove(end);
+ // modules/validations/index.js
+ var validations_exports = {};
+ __export(validations_exports, {
+ validationAlmostJunction: () => validationAlmostJunction,
+ validationCloseNodes: () => validationCloseNodes,
+ validationCrossingWays: () => validationCrossingWays,
+ validationDisconnectedWay: () => validationDisconnectedWay,
+ validationFormatting: () => validationFormatting,
+ validationHelpRequest: () => validationHelpRequest,
+ validationImpossibleOneway: () => validationImpossibleOneway,
+ validationIncompatibleSource: () => validationIncompatibleSource,
+ validationMaprules: () => validationMaprules,
+ validationMismatchedGeometry: () => validationMismatchedGeometry,
+ validationMissingRole: () => validationMissingRole,
+ validationMissingTag: () => validationMissingTag,
+ validationOutdatedTags: () => validationOutdatedTags,
+ validationPrivateData: () => validationPrivateData,
+ validationSuspiciousName: () => validationSuspiciousName,
+ validationUnsquareWay: () => validationUnsquareWay
+ });
+ // modules/validations/almost_junction.js
+ function validationAlmostJunction(context) {
+ const type3 = "almost_junction";
+ const EXTEND_TH_METERS = 5;
+ const WELD_TH_METERS = 0.75;
+ const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
+ const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
+ function isHighway(entity) {
+ return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
+ }
+ function isTaggedAsNotContinuing(node) {
+ return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
+ }
+ const validation = function checkAlmostJunction(entity, graph) {
+ if (!isHighway(entity))
+ return [];
+ if (entity.isDegenerate())
+ return [];
+ const tree = context.history().tree();
+ const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
+ let issues = [];
+ extendableNodeInfos.forEach((extendableNodeInfo) => {
+ issues.push(new validationIssue({
+ type: type3,
+ subtype: "highway-highway",
+ severity: "warning",
+ message: function(context2) {
+ const entity1 = context2.hasEntity(this.entityIds[0]);
+ if (this.entityIds[0] === this.entityIds[2]) {
+ return entity1 ? _t.html("issues.almost_junction.self.message", {
+ feature: utilDisplayLabel(entity1, context2.graph())
+ }) : "";
} else {
- return graph
- .replace(graph.entity(wayId).addNode(newNode.id, index))
- .remove(end)
- .remove(segment)
- .remove(start);
+ const entity2 = context2.hasEntity(this.entityIds[2]);
+ return entity1 && entity2 ? _t.html("issues.almost_junction.message", {
+ feature: utilDisplayLabel(entity1, context2.graph()),
+ feature2: utilDisplayLabel(entity2, context2.graph())
+ }) : "";
}
- };
- }
-
- // Accept the current position of the temporary node and continue drawing.
- drawWay.add = function(loc) {
-
- // prevent duplicate nodes
- var last = context.hasEntity(way.nodes[way.nodes.length - (isArea ? 2 : 1)]);
- if (last && last.loc[0] === loc[0] && last.loc[1] === loc[1]) return;
-
- var newNode = iD.Node({loc: loc});
-
- context.replace(
- iD.actions.AddEntity(newNode),
- ReplaceTemporaryNode(newNode),
- annotation);
-
- finished = true;
- context.enter(mode);
- };
-
- // Connect the way to an existing way.
- drawWay.addWay = function(loc, edge) {
- var previousEdge = startIndex ?
- [way.nodes[startIndex], way.nodes[startIndex - 1]] :
- [way.nodes[0], way.nodes[1]];
-
- // Avoid creating duplicate segments
- if (!isArea && iD.geo.edgeEqual(edge, previousEdge))
+ },
+ reference: showReference,
+ entityIds: [
+ entity.id,
+ extendableNodeInfo.node.id,
+ extendableNodeInfo.wid
+ ],
+ loc: extendableNodeInfo.node.loc,
+ hash: JSON.stringify(extendableNodeInfo.node.loc),
+ data: {
+ midId: extendableNodeInfo.mid.id,
+ edge: extendableNodeInfo.edge,
+ cross_loc: extendableNodeInfo.cross_loc
+ },
+ dynamicFixes: makeFixes
+ }));
+ });
+ return issues;
+ function makeFixes(context2) {
+ let fixes = [new validationIssueFix({
+ icon: "iD-icon-abutment",
+ title: _t.html("issues.fix.connect_features.title"),
+ onClick: function(context3) {
+ const annotation = _t("issues.fix.connect_almost_junction.annotation");
+ const [, endNodeId, crossWayId] = this.issue.entityIds;
+ const midNode = context3.entity(this.issue.data.midId);
+ const endNode = context3.entity(endNodeId);
+ const crossWay = context3.entity(crossWayId);
+ const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
+ if (nearEndNodes.length > 0) {
+ const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
+ if (collinear) {
+ context3.perform(actionMergeNodes([collinear.id, endNode.id], collinear.loc), annotation);
+ return;
+ }
+ }
+ const targetEdge = this.issue.data.edge;
+ const crossLoc = this.issue.data.cross_loc;
+ const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
+ const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
+ if (closestNodeInfo.distance < WELD_TH_METERS) {
+ context3.perform(actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc), annotation);
+ } else {
+ context3.perform(actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode), annotation);
+ }
+ }
+ })];
+ const node = context2.hasEntity(this.entityIds[1]);
+ if (node && !node.hasInterestingTags()) {
+ fixes.push(new validationIssueFix({
+ icon: "maki-barrier",
+ title: _t.html("issues.fix.tag_as_disconnected.title"),
+ onClick: function(context3) {
+ const nodeID = this.issue.entityIds[1];
+ const tags = Object.assign({}, context3.entity(nodeID).tags);
+ tags.noexit = "yes";
+ context3.perform(actionChangeTags(nodeID, tags), _t("issues.fix.tag_as_disconnected.annotation"));
+ }
+ }));
+ }
+ return fixes;
+ }
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
+ }
+ function isExtendableCandidate(node, way) {
+ const osm = services.osm;
+ if (osm && !osm.isDataLoaded(node.loc)) {
+ return false;
+ }
+ if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
+ return false;
+ }
+ let occurrences = 0;
+ for (const index in way.nodes) {
+ if (way.nodes[index] === node.id) {
+ occurrences += 1;
+ if (occurrences > 1) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ function findConnectableEndNodesByExtension(way) {
+ let results = [];
+ if (way.isClosed())
+ return results;
+ let testNodes;
+ const indices = [0, way.nodes.length - 1];
+ indices.forEach((nodeIndex) => {
+ const nodeID = way.nodes[nodeIndex];
+ const node = graph.entity(nodeID);
+ if (!isExtendableCandidate(node, way))
return;
-
- var newNode = iD.Node({ loc: loc });
-
- context.perform(
- iD.actions.AddMidpoint({ loc: loc, edge: edge}, newNode),
- ReplaceTemporaryNode(newNode),
- annotation);
-
- finished = true;
- context.enter(mode);
- };
-
- // Connect the way to an existing node and continue drawing.
- drawWay.addNode = function(node) {
-
- // Avoid creating duplicate segments
- if (way.areAdjacent(node.id, way.nodes[way.nodes.length - 1])) return;
-
- context.perform(
- ReplaceTemporaryNode(node),
- annotation);
-
- finished = true;
- context.enter(mode);
+ const connectionInfo = canConnectByExtend(way, nodeIndex);
+ if (!connectionInfo)
+ return;
+ testNodes = graph.childNodes(way).slice();
+ testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
+ if (geoHasSelfIntersections(testNodes, nodeID))
+ return;
+ results.push(connectionInfo);
+ });
+ return results;
+ }
+ function findNearbyEndNodes(node, way) {
+ return [
+ way.nodes[0],
+ way.nodes[way.nodes.length - 1]
+ ].map((d) => graph.entity(d)).filter((d) => {
+ return d.id !== node.id && geoSphericalDistance(node.loc, d.loc) <= CLOSE_NODE_TH;
+ });
+ }
+ function findSmallJoinAngle(midNode, tipNode, endNodes) {
+ let joinTo;
+ let minAngle = Infinity;
+ endNodes.forEach((endNode) => {
+ const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
+ const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
+ const diff = Math.max(a1, a2) - Math.min(a1, a2);
+ if (diff < minAngle) {
+ joinTo = endNode;
+ minAngle = diff;
+ }
+ });
+ if (minAngle <= SIG_ANGLE_TH)
+ return joinTo;
+ return null;
+ }
+ function hasTag(tags, key) {
+ return tags[key] !== void 0 && tags[key] !== "no";
+ }
+ function canConnectWays(way, way2) {
+ if (way.id === way2.id)
+ return true;
+ if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
+ return false;
+ if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
+ return false;
+ const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
+ if (layer1 !== layer2)
+ return false;
+ const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
+ if (level1 !== level2)
+ return false;
+ return true;
+ }
+ function canConnectByExtend(way, endNodeIdx) {
+ const tipNid = way.nodes[endNodeIdx];
+ const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
+ const tipNode = graph.entity(tipNid);
+ const midNode = graph.entity(midNid);
+ const lon = tipNode.loc[0];
+ const lat = tipNode.loc[1];
+ const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
+ const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
+ const queryExtent = geoExtent([
+ [lon - lon_range, lat - lat_range],
+ [lon + lon_range, lat + lat_range]
+ ]);
+ const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
+ const t = EXTEND_TH_METERS / edgeLen + 1;
+ const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t);
+ const segmentInfos = tree.waySegments(queryExtent, graph);
+ for (let i2 = 0; i2 < segmentInfos.length; i2++) {
+ let segmentInfo = segmentInfos[i2];
+ let way2 = graph.entity(segmentInfo.wayId);
+ if (!isHighway(way2))
+ continue;
+ if (!canConnectWays(way, way2))
+ continue;
+ let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
+ if (nAid === tipNid || nBid === tipNid)
+ continue;
+ let nA = graph.entity(nAid), nB = graph.entity(nBid);
+ let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
+ if (crossLoc) {
+ return {
+ mid: midNode,
+ node: tipNode,
+ wid: way2.id,
+ edge: [nA.id, nB.id],
+ cross_loc: crossLoc
+ };
+ }
+ }
+ return null;
+ }
};
+ validation.type = type3;
+ return validation;
+ }
- // Finish the draw operation, removing the temporary node. If the way has enough
- // nodes to be valid, it's selected. Otherwise, return to browse mode.
- drawWay.finish = function() {
- context.pop();
- finished = true;
-
- window.setTimeout(function() {
- context.map().dblclickEnable(true);
- }, 1000);
-
- if (context.hasEntity(wayId)) {
- context.enter(
- iD.modes.Select(context, [wayId])
- .suppressMenu(true)
- .newFeature(true));
+ // modules/validations/close_nodes.js
+ function validationCloseNodes(context) {
+ var type3 = "close_nodes";
+ var pointThresholdMeters = 0.2;
+ var validation = function(entity, graph) {
+ if (entity.type === "node") {
+ return getIssuesForNode(entity);
+ } else if (entity.type === "way") {
+ return getIssuesForWay(entity);
+ }
+ return [];
+ function getIssuesForNode(node) {
+ var parentWays = graph.parentWays(node);
+ if (parentWays.length) {
+ return getIssuesForVertex(node, parentWays);
} else {
- context.enter(iD.modes.Browse(context));
+ return getIssuesForDetachedPoint(node);
}
- };
-
- // Cancel the draw operation and return to browse, deleting everything drawn.
- drawWay.cancel = function() {
- context.perform(
- d3.functor(baseGraph),
- t('operations.cancel_draw.annotation'));
-
- window.setTimeout(function() {
- context.map().dblclickEnable(true);
- }, 1000);
-
- finished = true;
- context.enter(iD.modes.Browse(context));
- };
-
- drawWay.tail = function(text) {
- draw.tail(text);
- return drawWay;
- };
-
- return drawWay;
-};
-iD.behavior.Edit = function(context) {
- function edit() {
- context.map()
- .minzoom(context.minEditableZoom());
- }
-
- edit.off = function() {
- context.map()
- .minzoom(0);
- };
-
- return edit;
-};
-iD.behavior.Hash = function(context) {
- var s0 = null, // cached location.hash
- lat = 90 - 1e-8; // allowable latitude range
-
- var parser = function(map, s) {
- var q = iD.util.stringQs(s);
- var args = (q.map || '').split('/').map(Number);
- if (args.length < 3 || args.some(isNaN)) {
- return true; // replace bogus hash
- } else if (s !== formatter(map).slice(1)) {
- map.centerZoom([args[1],
- Math.min(lat, Math.max(-lat, args[2]))], args[0]);
+ }
+ function wayTypeFor(way) {
+ if (way.tags.boundary && way.tags.boundary !== "no")
+ return "boundary";
+ if (way.tags.indoor && way.tags.indoor !== "no")
+ return "indoor";
+ if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
+ return "building";
+ if (osmPathHighwayTagValues[way.tags.highway])
+ return "path";
+ var parentRelations = graph.parentRelations(way);
+ for (var i2 in parentRelations) {
+ var relation = parentRelations[i2];
+ if (relation.tags.type === "boundary")
+ return "boundary";
+ if (relation.isMultipolygon()) {
+ if (relation.tags.indoor && relation.tags.indoor !== "no")
+ return "indoor";
+ if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
+ return "building";
+ }
}
- };
-
- var formatter = function(map) {
- var mode = context.mode(),
- center = map.center(),
- zoom = map.zoom(),
- precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)),
- q = _.omit(iD.util.stringQs(location.hash.substring(1)), 'comment'),
- newParams = {};
-
- if (mode && mode.id === 'browse') {
- delete q.id;
- } else {
- var selected = context.selectedIDs().filter(function(id) {
- return !context.entity(id).isNew();
- });
- if (selected.length) {
- newParams.id = selected.join(',');
+ return "other";
+ }
+ function shouldCheckWay(way) {
+ if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
+ return false;
+ var bbox = way.extent(graph).bbox();
+ var hypotenuseMeters = geoSphericalDistance([bbox.minX, bbox.minY], [bbox.maxX, bbox.maxY]);
+ if (hypotenuseMeters < 1.5)
+ return false;
+ return true;
+ }
+ function getIssuesForWay(way) {
+ if (!shouldCheckWay(way))
+ return [];
+ var issues = [], nodes = graph.childNodes(way);
+ for (var i2 = 0; i2 < nodes.length - 1; i2++) {
+ var node1 = nodes[i2];
+ var node2 = nodes[i2 + 1];
+ var issue = getWayIssueIfAny(node1, node2, way);
+ if (issue)
+ issues.push(issue);
+ }
+ return issues;
+ }
+ function getIssuesForVertex(node, parentWays) {
+ var issues = [];
+ function checkForCloseness(node1, node2, way) {
+ var issue = getWayIssueIfAny(node1, node2, way);
+ if (issue)
+ issues.push(issue);
+ }
+ for (var i2 = 0; i2 < parentWays.length; i2++) {
+ var parentWay = parentWays[i2];
+ if (!shouldCheckWay(parentWay))
+ continue;
+ var lastIndex = parentWay.nodes.length - 1;
+ for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
+ if (j2 !== 0) {
+ if (parentWay.nodes[j2 - 1] === node.id) {
+ checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
+ }
+ }
+ if (j2 !== lastIndex) {
+ if (parentWay.nodes[j2 + 1] === node.id) {
+ checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
+ }
}
+ }
}
-
- newParams.map = zoom.toFixed(2) +
- '/' + center[0].toFixed(precision) +
- '/' + center[1].toFixed(precision);
-
- return '#' + iD.util.qsString(_.assign(q, newParams), true);
+ return issues;
+ }
+ function thresholdMetersForWay(way) {
+ if (!shouldCheckWay(way))
+ return 0;
+ var wayType = wayTypeFor(way);
+ if (wayType === "boundary")
+ return 0;
+ if (wayType === "indoor")
+ return 0.01;
+ if (wayType === "building")
+ return 0.05;
+ if (wayType === "path")
+ return 0.1;
+ return 0.2;
+ }
+ function getIssuesForDetachedPoint(node) {
+ var issues = [];
+ var lon = node.loc[0];
+ var lat = node.loc[1];
+ var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
+ var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
+ var queryExtent = geoExtent([
+ [lon - lon_range, lat - lat_range],
+ [lon + lon_range, lat + lat_range]
+ ]);
+ var intersected = context.history().tree().intersects(queryExtent, graph);
+ for (var j2 = 0; j2 < intersected.length; j2++) {
+ var nearby = intersected[j2];
+ if (nearby.id === node.id)
+ continue;
+ if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
+ continue;
+ if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
+ var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
+ var zAxisDifferentiates = false;
+ for (var key in zAxisKeys) {
+ var nodeValue = node.tags[key] || "0";
+ var nearbyValue = nearby.tags[key] || "0";
+ if (nodeValue !== nearbyValue) {
+ zAxisDifferentiates = true;
+ break;
+ }
+ }
+ if (zAxisDifferentiates)
+ continue;
+ issues.push(new validationIssue({
+ type: type3,
+ subtype: "detached",
+ severity: "warning",
+ message: function(context2) {
+ var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
+ return entity2 && entity22 ? _t.html("issues.close_nodes.detached.message", {
+ feature: utilDisplayLabel(entity2, context2.graph()),
+ feature2: utilDisplayLabel(entity22, context2.graph())
+ }) : "";
+ },
+ reference: showReference,
+ entityIds: [node.id, nearby.id],
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ icon: "iD-operation-disconnect",
+ title: _t.html("issues.fix.move_points_apart.title")
+ }),
+ new validationIssueFix({
+ icon: "iD-icon-layers",
+ title: _t.html("issues.fix.use_different_layers_or_levels.title")
+ })
+ ];
+ }
+ }));
+ }
+ }
+ return issues;
+ function showReference(selection2) {
+ var referenceText = _t("issues.close_nodes.detached.reference");
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
+ }
+ }
+ function getWayIssueIfAny(node1, node2, way) {
+ if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
+ return null;
+ }
+ if (node1.loc !== node2.loc) {
+ var parentWays1 = graph.parentWays(node1);
+ var parentWays2 = new Set(graph.parentWays(node2));
+ var sharedWays = parentWays1.filter(function(parentWay) {
+ return parentWays2.has(parentWay);
+ });
+ var thresholds = sharedWays.map(function(parentWay) {
+ return thresholdMetersForWay(parentWay);
+ });
+ var threshold = Math.min(...thresholds);
+ var distance = geoSphericalDistance(node1.loc, node2.loc);
+ if (distance > threshold)
+ return null;
+ }
+ return new validationIssue({
+ type: type3,
+ subtype: "vertices",
+ severity: "warning",
+ message: function(context2) {
+ var entity2 = context2.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
+ },
+ reference: showReference,
+ entityIds: [way.id, node1.id, node2.id],
+ loc: node1.loc,
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ icon: "iD-icon-plus",
+ title: _t.html("issues.fix.merge_points.title"),
+ onClick: function(context2) {
+ var entityIds = this.issue.entityIds;
+ var action = actionMergeNodes([entityIds[1], entityIds[2]]);
+ context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
+ }
+ }),
+ new validationIssueFix({
+ icon: "iD-operation-disconnect",
+ title: _t.html("issues.fix.move_points_apart.title")
+ })
+ ];
+ }
+ });
+ function showReference(selection2) {
+ var referenceText = _t("issues.close_nodes.reference");
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
+ }
+ }
};
+ validation.type = type3;
+ return validation;
+ }
- function update() {
- if (context.inIntro()) return;
- var s1 = formatter(context.map());
- if (s0 !== s1) location.replace(s0 = s1); // don't recenter the map!
- }
-
- var throttledUpdate = _.throttle(update, 500);
-
- function hashchange() {
- if (location.hash === s0) return; // ignore spurious hashchange events
- if (parser(context.map(), (s0 = location.hash).substring(1))) {
- update(); // replace bogus hash
+ // modules/validations/crossing_ways.js
+ function validationCrossingWays(context) {
+ var type3 = "crossing_ways";
+ function getFeatureWithFeatureTypeTagsForWay(way, graph) {
+ if (getFeatureType(way, graph) === null) {
+ var parentRels = graph.parentRelations(way);
+ for (var i2 = 0; i2 < parentRels.length; i2++) {
+ var rel = parentRels[i2];
+ if (getFeatureType(rel, graph) !== null) {
+ return rel;
+ }
}
+ }
+ return way;
}
-
- function hash() {
- context.map()
- .on('move.hash', throttledUpdate);
-
- context
- .on('enter.hash', throttledUpdate);
-
- d3.select(window)
- .on('hashchange.hash', hashchange);
-
- if (location.hash) {
- var q = iD.util.stringQs(location.hash.substring(1));
- if (q.id) context.zoomToEntity(q.id.split(',')[0], !q.map);
- if (q.comment) context.storage('comment', q.comment);
- hashchange();
- if (q.map) hash.hadHash = true;
- }
+ function hasTag(tags, key) {
+ return tags[key] !== void 0 && tags[key] !== "no";
}
-
- hash.off = function() {
- throttledUpdate.cancel();
-
- context.map()
- .on('move.hash', null);
-
- context
- .on('enter.hash', null);
-
- d3.select(window)
- .on('hashchange.hash', null);
-
- location.hash = '';
+ function taggedAsIndoor(tags) {
+ return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
+ }
+ function allowsBridge(featureType) {
+ return featureType === "highway" || featureType === "railway" || featureType === "waterway";
+ }
+ function allowsTunnel(featureType) {
+ return featureType === "highway" || featureType === "railway" || featureType === "waterway";
+ }
+ var ignoredBuildings = {
+ demolished: true,
+ dismantled: true,
+ proposed: true,
+ razed: true
};
-
- return hash;
-};
-/*
- The hover behavior adds the `.hover` class on mouseover to all elements to which
- the identical datum is bound, and removes it on mouseout.
-
- The :hover pseudo-class is insufficient for iD's purposes because a datum's visual
- representation may consist of several elements scattered throughout the DOM hierarchy.
- Only one of these elements can have the :hover pseudo-class, but all of them will
- have the .hover class.
- */
-iD.behavior.Hover = function() {
- var dispatch = d3.dispatch('hover'),
- selection,
- altDisables,
- target;
-
- function keydown() {
- if (altDisables && d3.event.keyCode === d3.keybinding.modifierCodes.alt) {
- dispatch.hover(null);
- selection.selectAll('.hover')
- .classed('hover-suppressed', true)
- .classed('hover', false);
- }
+ function getFeatureType(entity, graph) {
+ var geometry = entity.geometry(graph);
+ if (geometry !== "line" && geometry !== "area")
+ return null;
+ var tags = entity.tags;
+ if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
+ return "building";
+ if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
+ return "highway";
+ if (geometry !== "line")
+ return null;
+ if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
+ return "railway";
+ if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
+ return "waterway";
+ return null;
+ }
+ function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
+ var level1 = tags1.level || "0";
+ var level2 = tags2.level || "0";
+ if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
+ return true;
+ }
+ var layer1 = tags1.layer || "0";
+ var layer2 = tags2.layer || "0";
+ if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
+ if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
+ return true;
+ if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
+ return true;
+ if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
+ return true;
+ } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
+ return true;
+ else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
+ return true;
+ if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
+ if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
+ return true;
+ if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
+ return true;
+ if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
+ return true;
+ } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
+ return true;
+ else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
+ return true;
+ if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
+ return true;
+ if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
+ return true;
+ if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
+ if (layer1 !== layer2)
+ return true;
+ }
+ return false;
}
-
- function keyup() {
- if (altDisables && d3.event.keyCode === d3.keybinding.modifierCodes.alt) {
- dispatch.hover(target ? target.id : null);
- selection.selectAll('.hover-suppressed')
- .classed('hover-suppressed', false)
- .classed('hover', true);
+ var highwaysDisallowingFords = {
+ motorway: true,
+ motorway_link: true,
+ trunk: true,
+ trunk_link: true,
+ primary: true,
+ primary_link: true,
+ secondary: true,
+ secondary_link: true
+ };
+ var nonCrossingHighways = { track: true };
+ function tagsForConnectionNodeIfAllowed(entity1, entity2, graph) {
+ var featureType1 = getFeatureType(entity1, graph);
+ var featureType2 = getFeatureType(entity2, graph);
+ var geometry1 = entity1.geometry(graph);
+ var geometry2 = entity2.geometry(graph);
+ var bothLines = geometry1 === "line" && geometry2 === "line";
+ if (featureType1 === featureType2) {
+ if (featureType1 === "highway") {
+ var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
+ var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
+ if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
+ var roadFeature = entity1IsPath ? entity2 : entity1;
+ if (nonCrossingHighways[roadFeature.tags.highway]) {
+ return {};
+ }
+ var pathFeature = entity1IsPath ? entity1 : entity2;
+ if (["marked", "unmarked"].indexOf(pathFeature.tags.crossing) !== -1) {
+ return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
+ }
+ return bothLines ? { highway: "crossing" } : {};
+ }
+ return {};
}
- }
-
- var hover = function(__) {
- selection = __;
-
- function enter(d) {
- if (d === target) return;
-
- target = d;
-
- selection.selectAll('.hover')
- .classed('hover', false);
- selection.selectAll('.hover-suppressed')
- .classed('hover-suppressed', false);
-
- if (target instanceof iD.Entity) {
- var selector = '.' + target.id;
-
- if (target.type === 'relation') {
- target.members.forEach(function(member) {
- selector += ', .' + member.id;
- });
- }
-
- var suppressed = altDisables && d3.event && d3.event.altKey;
-
- selection.selectAll(selector)
- .classed(suppressed ? 'hover-suppressed' : 'hover', true);
-
- dispatch.hover(target.id);
+ if (featureType1 === "waterway")
+ return {};
+ if (featureType1 === "railway")
+ return {};
+ } else {
+ var featureTypes = [featureType1, featureType2];
+ if (featureTypes.indexOf("highway") !== -1) {
+ if (featureTypes.indexOf("railway") !== -1) {
+ if (!bothLines)
+ return {};
+ var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
+ if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
+ if (isTram)
+ return { railway: "tram_crossing" };
+ return { railway: "crossing" };
} else {
- dispatch.hover(null);
+ if (isTram)
+ return { railway: "tram_level_crossing" };
+ return { railway: "level_crossing" };
}
+ }
+ if (featureTypes.indexOf("waterway") !== -1) {
+ if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
+ return null;
+ if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
+ return null;
+ if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
+ return null;
+ }
+ return bothLines ? { ford: "yes" } : {};
+ }
}
-
- var down;
-
- function mouseover() {
- if (down) return;
- var target = d3.event.target;
- enter(target ? target.__data__ : null);
- }
-
- function mouseout() {
- if (down) return;
- var target = d3.event.relatedTarget;
- enter(target ? target.__data__ : null);
+ }
+ return null;
+ }
+ function findCrossingsByWay(way1, graph, tree) {
+ var edgeCrossInfos = [];
+ if (way1.type !== "way")
+ return edgeCrossInfos;
+ var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
+ var way1FeatureType = getFeatureType(taggedFeature1, graph);
+ if (way1FeatureType === null)
+ return edgeCrossInfos;
+ var checkedSingleCrossingWays = {};
+ var i2, j2;
+ var extent;
+ var n1, n2, nA, nB, nAId, nBId;
+ var segment1, segment2;
+ var oneOnly;
+ var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
+ var way1Nodes = graph.childNodes(way1);
+ var comparedWays = {};
+ for (i2 = 0; i2 < way1Nodes.length - 1; i2++) {
+ n1 = way1Nodes[i2];
+ n2 = way1Nodes[i2 + 1];
+ extent = geoExtent([
+ [
+ Math.min(n1.loc[0], n2.loc[0]),
+ Math.min(n1.loc[1], n2.loc[1])
+ ],
+ [
+ Math.max(n1.loc[0], n2.loc[0]),
+ Math.max(n1.loc[1], n2.loc[1])
+ ]
+ ]);
+ segmentInfos = tree.waySegments(extent, graph);
+ for (j2 = 0; j2 < segmentInfos.length; j2++) {
+ segment2Info = segmentInfos[j2];
+ if (segment2Info.wayId === way1.id)
+ continue;
+ if (checkedSingleCrossingWays[segment2Info.wayId])
+ continue;
+ comparedWays[segment2Info.wayId] = true;
+ way2 = graph.hasEntity(segment2Info.wayId);
+ if (!way2)
+ continue;
+ taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
+ way2FeatureType = getFeatureType(taggedFeature2, graph);
+ if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
+ continue;
+ }
+ oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
+ nAId = segment2Info.nodes[0];
+ nBId = segment2Info.nodes[1];
+ if (nAId === n1.id || nAId === n2.id || nBId === n1.id || nBId === n2.id) {
+ continue;
+ }
+ nA = graph.hasEntity(nAId);
+ if (!nA)
+ continue;
+ nB = graph.hasEntity(nBId);
+ if (!nB)
+ continue;
+ segment1 = [n1.loc, n2.loc];
+ segment2 = [nA.loc, nB.loc];
+ var point = geoLineIntersection(segment1, segment2);
+ if (point) {
+ edgeCrossInfos.push({
+ wayInfos: [
+ {
+ way: way1,
+ featureType: way1FeatureType,
+ edge: [n1.id, n2.id]
+ },
+ {
+ way: way2,
+ featureType: way2FeatureType,
+ edge: [nA.id, nB.id]
+ }
+ ],
+ crossPoint: point
+ });
+ if (oneOnly) {
+ checkedSingleCrossingWays[way2.id] = true;
+ break;
+ }
+ }
}
-
- function mousedown() {
- down = true;
- d3.select(window)
- .on('mouseup.hover', mouseup);
+ }
+ return edgeCrossInfos;
+ }
+ function waysToCheck(entity, graph) {
+ var featureType = getFeatureType(entity, graph);
+ if (!featureType)
+ return [];
+ if (entity.type === "way") {
+ return [entity];
+ } else if (entity.type === "relation") {
+ return entity.members.reduce(function(array2, member) {
+ if (member.type === "way" && (!member.role || member.role === "outer" || member.role === "inner")) {
+ var entity2 = graph.hasEntity(member.id);
+ if (entity2 && array2.indexOf(entity2) === -1) {
+ array2.push(entity2);
+ }
+ }
+ return array2;
+ }, []);
+ }
+ return [];
+ }
+ var validation = function checkCrossingWays(entity, graph) {
+ var tree = context.history().tree();
+ var ways = waysToCheck(entity, graph);
+ var issues = [];
+ var wayIndex, crossingIndex, crossings;
+ for (wayIndex in ways) {
+ crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
+ for (crossingIndex in crossings) {
+ issues.push(createIssue(crossings[crossingIndex], graph));
}
-
- function mouseup() {
- down = false;
+ }
+ return issues;
+ };
+ function createIssue(crossing, graph) {
+ crossing.wayInfos.sort(function(way1Info, way2Info) {
+ var type1 = way1Info.featureType;
+ var type22 = way2Info.featureType;
+ if (type1 === type22) {
+ return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
+ } else if (type1 === "waterway") {
+ return true;
+ } else if (type22 === "waterway") {
+ return false;
}
-
- selection
- .on('mouseover.hover', mouseover)
- .on('mouseout.hover', mouseout)
- .on('mousedown.hover', mousedown)
- .on('mouseup.hover', mouseup);
-
- d3.select(window)
- .on('keydown.hover', keydown)
- .on('keyup.hover', keyup);
- };
-
- hover.off = function(selection) {
- selection.selectAll('.hover')
- .classed('hover', false);
- selection.selectAll('.hover-suppressed')
- .classed('hover-suppressed', false);
-
- selection
- .on('mouseover.hover', null)
- .on('mouseout.hover', null)
- .on('mousedown.hover', null)
- .on('mouseup.hover', null);
-
- d3.select(window)
- .on('keydown.hover', null)
- .on('keyup.hover', null)
- .on('mouseup.hover', null);
- };
-
- hover.altDisables = function(_) {
- if (!arguments.length) return altDisables;
- altDisables = _;
- return hover;
- };
-
- return d3.rebind(hover, dispatch, 'on');
-};
-iD.behavior.Lasso = function(context) {
-
- var behavior = function(selection) {
- var lasso;
-
- function mousedown() {
- var button = 0; // left
- if (d3.event.button === button && d3.event.shiftKey === true) {
- lasso = null;
-
- selection
- .on('mousemove.lasso', mousemove)
- .on('mouseup.lasso', mouseup);
-
- d3.event.stopPropagation();
+ return type1 < type22;
+ });
+ var entities = crossing.wayInfos.map(function(wayInfo) {
+ return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
+ });
+ var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
+ var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
+ var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
+ var featureType1 = crossing.wayInfos[0].featureType;
+ var featureType2 = crossing.wayInfos[1].featureType;
+ var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
+ var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
+ var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
+ var subtype = [featureType1, featureType2].sort().join("-");
+ var crossingTypeID = subtype;
+ if (isCrossingIndoors) {
+ crossingTypeID = "indoor-indoor";
+ } else if (isCrossingTunnels) {
+ crossingTypeID = "tunnel-tunnel";
+ } else if (isCrossingBridges) {
+ crossingTypeID = "bridge-bridge";
+ }
+ if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
+ crossingTypeID += "_connectable";
+ }
+ var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
+ return new validationIssue({
+ type: type3,
+ subtype,
+ severity: "warning",
+ message: function(context2) {
+ var graph2 = context2.graph();
+ var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
+ return entity1 && entity2 ? _t.html("issues.crossing_ways.message", {
+ feature: utilDisplayLabel(entity1, graph2),
+ feature2: utilDisplayLabel(entity2, graph2)
+ }) : "";
+ },
+ reference: showReference,
+ entityIds: entities.map(function(entity) {
+ return entity.id;
+ }),
+ data: {
+ edges,
+ featureTypes,
+ connectionTags
+ },
+ hash: uniqueID,
+ loc: crossing.crossPoint,
+ dynamicFixes: function(context2) {
+ var mode = context2.mode();
+ if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
+ return [];
+ var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
+ var selectedFeatureType = this.data.featureTypes[selectedIndex];
+ var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
+ var fixes = [];
+ if (connectionTags) {
+ fixes.push(makeConnectWaysFix(this.data.connectionTags));
+ }
+ if (isCrossingIndoors) {
+ fixes.push(new validationIssueFix({
+ icon: "iD-icon-layers",
+ title: _t.html("issues.fix.use_different_levels.title")
+ }));
+ } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
+ fixes.push(makeChangeLayerFix("higher"));
+ fixes.push(makeChangeLayerFix("lower"));
+ } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
+ if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
+ fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
}
- }
-
- function mousemove() {
- if (!lasso) {
- lasso = iD.ui.Lasso(context);
- context.surface().call(lasso);
+ var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
+ if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
+ fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
}
-
- lasso.p(context.mouse());
- }
-
- function normalize(a, b) {
- return [
- [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
- [Math.max(a[0], b[0]), Math.max(a[1], b[1])]];
+ }
+ fixes.push(new validationIssueFix({
+ icon: "iD-operation-move",
+ title: _t.html("issues.fix.reposition_features.title")
+ }));
+ return fixes;
}
-
- function lassoed() {
- if (!lasso) return [];
-
- var graph = context.graph(),
- bounds = lasso.extent().map(context.projection.invert),
- extent = iD.geo.Extent(normalize(bounds[0], bounds[1]));
-
- return _.map(context.intersects(extent).filter(function(entity) {
- return entity.type === 'node' &&
- iD.geo.pointInPolygon(context.projection(entity.loc), lasso.coordinates) &&
- !context.features().isHidden(entity, graph, entity.geometry(graph));
- }), 'id');
+ });
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
+ }
+ }
+ function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
+ return new validationIssueFix({
+ icon: iconName,
+ title: _t.html("issues.fix." + fixTitleID + ".title"),
+ onClick: function(context2) {
+ var mode = context2.mode();
+ if (!mode || mode.id !== "select")
+ return;
+ var selectedIDs = mode.selectedIDs();
+ if (selectedIDs.length !== 1)
+ return;
+ var selectedWayID = selectedIDs[0];
+ if (!context2.hasEntity(selectedWayID))
+ return;
+ var resultWayIDs = [selectedWayID];
+ var edge, crossedEdge, crossedWayID;
+ if (this.issue.entityIds[0] === selectedWayID) {
+ edge = this.issue.data.edges[0];
+ crossedEdge = this.issue.data.edges[1];
+ crossedWayID = this.issue.entityIds[1];
+ } else {
+ edge = this.issue.data.edges[1];
+ crossedEdge = this.issue.data.edges[0];
+ crossedWayID = this.issue.entityIds[0];
+ }
+ var crossingLoc = this.issue.loc;
+ var projection2 = context2.projection;
+ var action = function actionAddStructure(graph) {
+ var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
+ var crossedWay = graph.hasEntity(crossedWayID);
+ var structLengthMeters = crossedWay && crossedWay.tags.width && parseFloat(crossedWay.tags.width);
+ if (!structLengthMeters) {
+ structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
+ }
+ if (structLengthMeters) {
+ if (getFeatureType(crossedWay, graph) === "railway") {
+ structLengthMeters *= 2;
+ }
+ } else {
+ structLengthMeters = 8;
+ }
+ var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
+ var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
+ var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
+ if (crossingAngle > Math.PI)
+ crossingAngle -= Math.PI;
+ structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
+ structLengthMeters += 4;
+ structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
+ function geomToProj(geoPoint) {
+ return [
+ geoLonToMeters(geoPoint[0], geoPoint[1]),
+ geoLatToMeters(geoPoint[1])
+ ];
+ }
+ function projToGeom(projPoint) {
+ var lat = geoMetersToLat(projPoint[1]);
+ return [
+ geoMetersToLon(projPoint[0], lat),
+ lat
+ ];
+ }
+ var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
+ var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
+ var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
+ var projectedCrossingLoc = geomToProj(crossingLoc);
+ var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
+ function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
+ var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
+ return projToGeom([
+ projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
+ projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
+ ]);
+ }
+ var endpointLocGetter1 = function(lengthMeters) {
+ return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
+ };
+ var endpointLocGetter2 = function(lengthMeters) {
+ return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
+ };
+ var minEdgeLengthMeters = 0.55;
+ function determineEndpoint(edge2, endNode, locGetter) {
+ var newNode;
+ var idealLengthMeters = structLengthMeters / 2;
+ var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
+ if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
+ var idealNodeLoc = locGetter(idealLengthMeters);
+ newNode = osmNode();
+ graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
+ } else {
+ var edgeCount = 0;
+ endNode.parentIntersectionWays(graph).forEach(function(way) {
+ way.nodes.forEach(function(nodeID) {
+ if (nodeID === endNode.id) {
+ if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
+ edgeCount += 1;
+ } else {
+ edgeCount += 2;
+ }
+ }
+ });
+ });
+ if (edgeCount >= 3) {
+ var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
+ if (insetLength > minEdgeLengthMeters) {
+ var insetNodeLoc = locGetter(insetLength);
+ newNode = osmNode();
+ graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
+ }
+ }
+ }
+ if (!newNode)
+ newNode = endNode;
+ var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
+ graph = splitAction(graph);
+ if (splitAction.getCreatedWayIDs().length) {
+ resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
+ }
+ return newNode;
+ }
+ var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
+ var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
+ var structureWay = resultWayIDs.map(function(id2) {
+ return graph.entity(id2);
+ }).find(function(way) {
+ return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
+ });
+ var tags = Object.assign({}, structureWay.tags);
+ if (bridgeOrTunnel === "bridge") {
+ tags.bridge = "yes";
+ tags.layer = "1";
+ } else {
+ var tunnelValue = "yes";
+ if (getFeatureType(structureWay, graph) === "waterway") {
+ tunnelValue = "culvert";
+ }
+ tags.tunnel = tunnelValue;
+ tags.layer = "-1";
+ }
+ graph = actionChangeTags(structureWay.id, tags)(graph);
+ return graph;
+ };
+ context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
+ context2.enter(modeSelect(context2, resultWayIDs));
}
-
- function mouseup() {
- selection
- .on('mousemove.lasso', null)
- .on('mouseup.lasso', null);
-
- if (!lasso) return;
-
- var ids = lassoed();
- lasso.close();
-
- if (ids.length) {
- context.enter(iD.modes.Select(context, ids));
+ });
+ }
+ function makeConnectWaysFix(connectionTags) {
+ var fixTitleID = "connect_features";
+ if (connectionTags.ford) {
+ fixTitleID = "connect_using_ford";
+ }
+ return new validationIssueFix({
+ icon: "iD-icon-crossing",
+ title: _t.html("issues.fix." + fixTitleID + ".title"),
+ onClick: function(context2) {
+ var loc = this.issue.loc;
+ var connectionTags2 = this.issue.data.connectionTags;
+ var edges = this.issue.data.edges;
+ context2.perform(function actionConnectCrossingWays(graph) {
+ var node = osmNode({ loc, tags: connectionTags2 });
+ graph = graph.replace(node);
+ var nodesToMerge = [node.id];
+ var mergeThresholdInMeters = 0.75;
+ edges.forEach(function(edge) {
+ var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
+ var nearby = geoSphericalClosestNode(edgeNodes, loc);
+ if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
+ nodesToMerge.push(nearby.node.id);
+ } else {
+ graph = actionAddMidpoint({ loc, edge }, node)(graph);
+ }
+ });
+ if (nodesToMerge.length > 1) {
+ graph = actionMergeNodes(nodesToMerge, loc)(graph);
}
+ return graph;
+ }, _t("issues.fix.connect_crossing_features.annotation"));
}
-
- selection
- .on('mousedown.lasso', mousedown);
- };
-
- behavior.off = function(selection) {
- selection.on('mousedown.lasso', null);
- };
-
- return behavior;
-};
-iD.behavior.Paste = function(context) {
- var keybinding = d3.keybinding('paste');
-
- function omitTag(v, k) {
- return (
- k === 'phone' ||
- k === 'fax' ||
- k === 'email' ||
- k === 'website' ||
- k === 'url' ||
- k === 'note' ||
- k === 'description' ||
- k.indexOf('name') !== -1 ||
- k.indexOf('wiki') === 0 ||
- k.indexOf('addr:') === 0 ||
- k.indexOf('contact:') === 0
- );
+ });
}
-
- function doPaste() {
- d3.event.preventDefault();
- if (context.inIntro()) return;
-
- var baseGraph = context.graph(),
- mouse = context.mouse(),
- projection = context.projection,
- viewport = iD.geo.Extent(projection.clipExtent()).polygon();
-
- if (!iD.geo.pointInPolygon(mouse, viewport)) return;
-
- var extent = iD.geo.Extent(),
- oldIDs = context.copyIDs(),
- oldGraph = context.copyGraph(),
- newIDs = [];
-
- if (!oldIDs.length) return;
-
- var action = iD.actions.CopyEntities(oldIDs, oldGraph);
- context.perform(action);
-
- var copies = action.copies();
- for (var id in copies) {
- var oldEntity = oldGraph.entity(id),
- newEntity = copies[id];
-
- extent._extend(oldEntity.extent(oldGraph));
- newIDs.push(newEntity.id);
- context.perform(iD.actions.ChangeTags(newEntity.id, _.omit(newEntity.tags, omitTag)));
+ function makeChangeLayerFix(higherOrLower) {
+ return new validationIssueFix({
+ icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
+ title: _t.html("issues.fix.tag_this_as_" + higherOrLower + ".title"),
+ onClick: function(context2) {
+ var mode = context2.mode();
+ if (!mode || mode.id !== "select")
+ return;
+ var selectedIDs = mode.selectedIDs();
+ if (selectedIDs.length !== 1)
+ return;
+ var selectedID = selectedIDs[0];
+ if (!this.issue.entityIds.some(function(entityId) {
+ return entityId === selectedID;
+ }))
+ return;
+ var entity = context2.hasEntity(selectedID);
+ if (!entity)
+ return;
+ var tags = Object.assign({}, entity.tags);
+ var layer = tags.layer && Number(tags.layer);
+ if (layer && !isNaN(layer)) {
+ if (higherOrLower === "higher") {
+ layer += 1;
+ } else {
+ layer -= 1;
+ }
+ } else {
+ if (higherOrLower === "higher") {
+ layer = 1;
+ } else {
+ layer = -1;
+ }
+ }
+ tags.layer = layer.toString();
+ context2.perform(actionChangeTags(entity.id, tags), _t("operations.change_tags.annotation"));
}
-
- // Put pasted objects where mouse pointer is..
- var center = projection(extent.center()),
- delta = [ mouse[0] - center[0], mouse[1] - center[1] ];
-
- context.perform(iD.actions.Move(newIDs, delta, projection));
- context.enter(iD.modes.Move(context, newIDs, baseGraph));
+ });
}
+ validation.type = type3;
+ return validation;
+ }
- function paste() {
- keybinding.on(iD.ui.cmd('âV'), doPaste);
- d3.select(document).call(keybinding);
- return paste;
+ // modules/behavior/draw_way.js
+ function behaviorDrawWay(context, wayID, mode, startGraph) {
+ const keybinding = utilKeybinding("drawWay");
+ var dispatch10 = dispatch_default("rejectedSelfIntersection");
+ var behavior = behaviorDraw(context);
+ var _nodeIndex;
+ var _origWay;
+ var _wayGeometry;
+ var _headNodeID;
+ var _annotation;
+ var _pointerHasMoved = false;
+ var _drawNode;
+ var _didResolveTempEdit = false;
+ function createDrawNode(loc) {
+ _drawNode = osmNode({ loc });
+ context.pauseChangeDispatch();
+ context.replace(function actionAddDrawNode(graph) {
+ var way = graph.entity(wayID);
+ return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
+ }, _annotation);
+ context.resumeChangeDispatch();
+ setActiveElements();
+ }
+ function removeDrawNode() {
+ context.pauseChangeDispatch();
+ context.replace(function actionDeleteDrawNode(graph) {
+ var way = graph.entity(wayID);
+ return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
+ }, _annotation);
+ _drawNode = void 0;
+ context.resumeChangeDispatch();
+ }
+ function keydown(d3_event) {
+ if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
+ if (context.surface().classed("nope")) {
+ context.surface().classed("nope-suppressed", true);
+ }
+ context.surface().classed("nope", false).classed("nope-disabled", true);
+ }
}
-
- paste.off = function() {
- d3.select(document).call(keybinding.off);
- };
-
- return paste;
-};
-iD.behavior.Select = function(context) {
- function keydown() {
- if (d3.event && d3.event.shiftKey) {
- context.surface()
- .classed('behavior-multiselect', true);
+ function keyup(d3_event) {
+ if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
+ if (context.surface().classed("nope-suppressed")) {
+ context.surface().classed("nope", true);
}
+ context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
+ }
}
-
- function keyup() {
- if (!d3.event || !d3.event.shiftKey) {
- context.surface()
- .classed('behavior-multiselect', false);
+ function allowsVertex(d) {
+ return d.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d, context.graph());
+ }
+ function move(d3_event, datum2) {
+ var loc = context.map().mouseCoordinates();
+ if (!_drawNode)
+ createDrawNode(loc);
+ context.surface().classed("nope-disabled", d3_event.altKey);
+ var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
+ var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
+ if (targetLoc) {
+ loc = targetLoc;
+ } else if (targetNodes) {
+ var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
+ if (choice) {
+ loc = choice.loc;
}
+ }
+ context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
+ _drawNode = context.entity(_drawNode.id);
+ checkGeometry(true);
+ }
+ function checkGeometry(includeDrawNode) {
+ var nopeDisabled = context.surface().classed("nope-disabled");
+ var isInvalid = isInvalidGeometry(includeDrawNode);
+ if (nopeDisabled) {
+ context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
+ } else {
+ context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
+ }
}
-
- function click() {
- var datum = d3.event.target.__data__,
- lasso = d3.select('#surface .lasso').node(),
- mode = context.mode();
-
- if (!(datum instanceof iD.Entity)) {
- if (!d3.event.shiftKey && !lasso && mode.id !== 'browse')
- context.enter(iD.modes.Browse(context));
-
- } else if (!d3.event.shiftKey && !lasso) {
- // Avoid re-entering Select mode with same entity.
- if (context.selectedIDs().length !== 1 || context.selectedIDs()[0] !== datum.id) {
- context.enter(iD.modes.Select(context, [datum.id]));
- } else {
- mode.suppressMenu(false).reselect();
- }
- } else if (context.selectedIDs().indexOf(datum.id) >= 0) {
- var selectedIDs = _.without(context.selectedIDs(), datum.id);
- context.enter(selectedIDs.length ?
- iD.modes.Select(context, selectedIDs) :
- iD.modes.Browse(context));
-
+ function isInvalidGeometry(includeDrawNode) {
+ var testNode = _drawNode;
+ var parentWay = context.graph().entity(wayID);
+ var nodes = context.graph().childNodes(parentWay).slice();
+ if (includeDrawNode) {
+ if (parentWay.isClosed()) {
+ nodes.pop();
+ }
+ } else {
+ if (parentWay.isClosed()) {
+ if (nodes.length < 3)
+ return false;
+ if (_drawNode)
+ nodes.splice(-2, 1);
+ testNode = nodes[nodes.length - 2];
} else {
- context.enter(iD.modes.Select(context, context.selectedIDs().concat([datum.id])));
+ return false;
}
+ }
+ return testNode && geoHasSelfIntersections(nodes, testNode.id);
}
-
- var behavior = function(selection) {
- d3.select(window)
- .on('keydown.select', keydown)
- .on('keyup.select', keyup);
-
- selection.on('click.select', click);
-
- keydown();
- };
-
- behavior.off = function(selection) {
- d3.select(window)
- .on('keydown.select', null)
- .on('keyup.select', null);
-
- selection.on('click.select', null);
-
- keyup();
+ function undone() {
+ _didResolveTempEdit = true;
+ context.pauseChangeDispatch();
+ var nextMode;
+ if (context.graph() === startGraph) {
+ nextMode = modeSelect(context, [wayID]);
+ } else {
+ context.pop(1);
+ nextMode = mode;
+ }
+ context.perform(actionNoop());
+ context.pop(1);
+ context.resumeChangeDispatch();
+ context.enter(nextMode);
+ }
+ function setActiveElements() {
+ if (!_drawNode)
+ return;
+ context.surface().selectAll("." + _drawNode.id).classed("active", true);
+ }
+ function resetToStartGraph() {
+ while (context.graph() !== startGraph) {
+ context.pop();
+ }
+ }
+ var drawWay = function(surface) {
+ _drawNode = void 0;
+ _didResolveTempEdit = false;
+ _origWay = context.entity(wayID);
+ if (typeof _nodeIndex === "number") {
+ _headNodeID = _origWay.nodes[_nodeIndex];
+ } else if (_origWay.isClosed()) {
+ _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
+ } else {
+ _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
+ }
+ _wayGeometry = _origWay.geometry(context.graph());
+ _annotation = _t((_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry);
+ _pointerHasMoved = false;
+ context.pauseChangeDispatch();
+ context.perform(actionNoop(), _annotation);
+ context.resumeChangeDispatch();
+ behavior.hover().initialNodeID(_headNodeID);
+ behavior.on("move", function() {
+ _pointerHasMoved = true;
+ move.apply(this, arguments);
+ }).on("down", function() {
+ move.apply(this, arguments);
+ }).on("downcancel", function() {
+ if (_drawNode)
+ removeDrawNode();
+ }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
+ select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
+ context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
+ setActiveElements();
+ surface.call(behavior);
+ context.history().on("undone.draw", undone);
};
-
- return behavior;
-};
-iD.behavior.Tail = function() {
- var text,
- container,
- xmargin = 25,
- tooltipSize = [0, 0],
- selectionSize = [0, 0];
-
- function tail(selection) {
- if (!text) return;
-
- d3.select(window)
- .on('resize.tail', function() { selectionSize = selection.dimensions(); });
-
- function show() {
- container.style('display', 'block');
- tooltipSize = container.dimensions();
- }
-
- function mousemove() {
- if (container.style('display') === 'none') show();
- var xoffset = ((d3.event.clientX + tooltipSize[0] + xmargin) > selectionSize[0]) ?
- -tooltipSize[0] - xmargin : xmargin;
- container.classed('left', xoffset > 0);
- iD.util.setTransform(container, d3.event.clientX + xoffset, d3.event.clientY);
- }
-
- function mouseleave() {
- if (d3.event.relatedTarget !== container.node()) {
- container.style('display', 'none');
- }
- }
-
- function mouseenter() {
- if (d3.event.relatedTarget !== container.node()) {
- show();
- }
+ drawWay.off = function(surface) {
+ if (!_didResolveTempEdit) {
+ context.pauseChangeDispatch();
+ resetToStartGraph();
+ context.resumeChangeDispatch();
+ }
+ _drawNode = void 0;
+ _nodeIndex = void 0;
+ context.map().on("drawn.draw", null);
+ surface.call(behavior.off).selectAll(".active").classed("active", false);
+ surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
+ select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
+ context.history().on("undone.draw", null);
+ };
+ function attemptAdd(d, loc, doAdd) {
+ if (_drawNode) {
+ context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
+ _drawNode = context.entity(_drawNode.id);
+ } else {
+ createDrawNode(loc);
+ }
+ checkGeometry(true);
+ if (d && d.properties && d.properties.nope || context.surface().classed("nope")) {
+ if (!_pointerHasMoved) {
+ removeDrawNode();
}
-
- container = d3.select(document.body)
- .append('div')
- .style('display', 'none')
- .attr('class', 'tail tooltip-inner');
-
- container.append('div')
- .text(text);
-
- selection
- .on('mousemove.tail', mousemove)
- .on('mouseenter.tail', mouseenter)
- .on('mouseleave.tail', mouseleave);
-
- container
- .on('mousemove.tail', mousemove);
-
- tooltipSize = container.dimensions();
- selectionSize = selection.dimensions();
- }
-
- tail.off = function(selection) {
- if (!text) return;
-
- container
- .on('mousemove.tail', null)
- .remove();
-
- selection
- .on('mousemove.tail', null)
- .on('mouseenter.tail', null)
- .on('mouseleave.tail', null);
-
- d3.select(window)
- .on('resize.tail', null);
+ dispatch10.call("rejectedSelfIntersection", this);
+ return;
+ }
+ context.pauseChangeDispatch();
+ doAdd();
+ _didResolveTempEdit = true;
+ context.resumeChangeDispatch();
+ context.enter(mode);
+ }
+ drawWay.add = function(loc, d) {
+ attemptAdd(d, loc, function() {
+ });
};
-
- tail.text = function(_) {
- if (!arguments.length) return text;
- text = _;
- return tail;
+ drawWay.addWay = function(loc, edge, d) {
+ attemptAdd(d, loc, function() {
+ context.replace(actionAddMidpoint({ loc, edge }, _drawNode), _annotation);
+ });
};
-
- return tail;
-};
-iD.modes = {};
-iD.modes.AddArea = function(context) {
- var mode = {
- id: 'add-area',
- button: 'area',
- title: t('modes.add_area.title'),
- description: t('modes.add_area.description'),
- key: '3'
+ drawWay.addNode = function(node, d) {
+ if (node.id === _headNodeID || _origWay.isClosed() && node.id === _origWay.first()) {
+ drawWay.finish();
+ return;
+ }
+ attemptAdd(d, node.loc, function() {
+ context.replace(function actionReplaceDrawNode(graph) {
+ graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
+ return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
+ }, _annotation);
+ });
};
-
- var behavior = iD.behavior.AddWay(context)
- .tail(t('modes.add_area.tail'))
- .on('start', start)
- .on('startFromWay', startFromWay)
- .on('startFromNode', startFromNode),
- defaultTags = {area: 'yes'};
-
- function start(loc) {
- var graph = context.graph(),
- node = iD.Node({loc: loc}),
- way = iD.Way({tags: defaultTags});
-
- context.perform(
- iD.actions.AddEntity(node),
- iD.actions.AddEntity(way),
- iD.actions.AddVertex(way.id, node.id),
- iD.actions.AddVertex(way.id, node.id));
-
- context.enter(iD.modes.DrawArea(context, way.id, graph));
- }
-
- function startFromWay(loc, edge) {
- var graph = context.graph(),
- node = iD.Node({loc: loc}),
- way = iD.Way({tags: defaultTags});
-
- context.perform(
- iD.actions.AddEntity(node),
- iD.actions.AddEntity(way),
- iD.actions.AddVertex(way.id, node.id),
- iD.actions.AddVertex(way.id, node.id),
- iD.actions.AddMidpoint({ loc: loc, edge: edge }, node));
-
- context.enter(iD.modes.DrawArea(context, way.id, graph));
+ function getFeatureType(ways) {
+ if (ways.every((way) => way.isClosed()))
+ return "area";
+ if (ways.every((way) => !way.isClosed()))
+ return "line";
+ return "generic";
}
-
- function startFromNode(node) {
- var graph = context.graph(),
- way = iD.Way({tags: defaultTags});
-
- context.perform(
- iD.actions.AddEntity(way),
- iD.actions.AddVertex(way.id, node.id),
- iD.actions.AddVertex(way.id, node.id));
-
- context.enter(iD.modes.DrawArea(context, way.id, graph));
+ function followMode() {
+ if (_didResolveTempEdit)
+ return;
+ try {
+ const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
+ const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
+ const historyGraph = context.history().graph();
+ if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.follow.error.needs_more_initial_nodes"))();
+ return;
+ }
+ const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w) => w.id !== wayID);
+ const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w) => w.id !== wayID);
+ const featureType = getFeatureType(lastNodesParents);
+ if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
+ return;
+ }
+ if (!secondLastNodesParents.some((n2) => n2.id === lastNodesParents[0].id)) {
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
+ return;
+ }
+ const way = lastNodesParents[0];
+ const indexOfLast = way.nodes.indexOf(lastNodeId);
+ const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
+ const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
+ let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
+ if (nextNodeIndex === -1)
+ nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
+ const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
+ drawWay.addNode(nextNode, {
+ geometry: { type: "Point", coordinates: nextNode.loc },
+ id: nextNode.id,
+ properties: { target: true, entity: nextNode }
+ });
+ } catch (ex) {
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.html("operations.follow.error.unknown"))();
+ }
}
-
- mode.enter = function() {
- context.install(behavior);
- };
-
- mode.exit = function() {
- context.uninstall(behavior);
+ keybinding.on(_t("operations.follow.key"), followMode);
+ select_default2(document).call(keybinding);
+ drawWay.finish = function() {
+ checkGeometry(false);
+ if (context.surface().classed("nope")) {
+ dispatch10.call("rejectedSelfIntersection", this);
+ return;
+ }
+ context.pauseChangeDispatch();
+ context.pop(1);
+ _didResolveTempEdit = true;
+ context.resumeChangeDispatch();
+ var way = context.hasEntity(wayID);
+ if (!way || way.isDegenerate()) {
+ drawWay.cancel();
+ return;
+ }
+ window.setTimeout(function() {
+ context.map().dblclickZoomEnable(true);
+ }, 1e3);
+ var isNewFeature = !mode.isContinuing;
+ context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
};
+ drawWay.cancel = function() {
+ context.pauseChangeDispatch();
+ resetToStartGraph();
+ context.resumeChangeDispatch();
+ window.setTimeout(function() {
+ context.map().dblclickZoomEnable(true);
+ }, 1e3);
+ context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
+ context.enter(modeBrowse(context));
+ };
+ drawWay.nodeIndex = function(val) {
+ if (!arguments.length)
+ return _nodeIndex;
+ _nodeIndex = val;
+ return drawWay;
+ };
+ drawWay.activeID = function() {
+ if (!arguments.length)
+ return _drawNode && _drawNode.id;
+ return drawWay;
+ };
+ return utilRebind(drawWay, dispatch10, "on");
+ }
- return mode;
-};
-iD.modes.AddLine = function(context) {
+ // modules/modes/draw_line.js
+ function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
var mode = {
- id: 'add-line',
- button: 'line',
- title: t('modes.add_line.title'),
- description: t('modes.add_line.description'),
- key: '2'
+ button,
+ id: "draw-line"
};
-
- var behavior = iD.behavior.AddWay(context)
- .tail(t('modes.add_line.tail'))
- .on('start', start)
- .on('startFromWay', startFromWay)
- .on('startFromNode', startFromNode);
-
- function start(loc) {
- var baseGraph = context.graph(),
- node = iD.Node({loc: loc}),
- way = iD.Way();
-
- context.perform(
- iD.actions.AddEntity(node),
- iD.actions.AddEntity(way),
- iD.actions.AddVertex(way.id, node.id));
-
- context.enter(iD.modes.DrawLine(context, way.id, baseGraph));
- }
-
- function startFromWay(loc, edge) {
- var baseGraph = context.graph(),
- node = iD.Node({loc: loc}),
- way = iD.Way();
-
- context.perform(
- iD.actions.AddEntity(node),
- iD.actions.AddEntity(way),
- iD.actions.AddVertex(way.id, node.id),
- iD.actions.AddMidpoint({ loc: loc, edge: edge }, node));
-
- context.enter(iD.modes.DrawLine(context, way.id, baseGraph));
- }
-
- function startFromNode(node) {
- var baseGraph = context.graph(),
- way = iD.Way();
-
- context.perform(
- iD.actions.AddEntity(way),
- iD.actions.AddVertex(way.id, node.id));
-
- context.enter(iD.modes.DrawLine(context, way.id, baseGraph));
- }
-
+ var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
+ context.ui().flash.iconName("#iD-icon-no").label(_t.html("self_intersection.error.lines"))();
+ });
+ mode.wayID = wayID;
+ mode.isContinuing = continuing;
mode.enter = function() {
- context.install(behavior);
+ behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
+ context.install(behavior);
};
-
mode.exit = function() {
- context.uninstall(behavior);
+ context.uninstall(behavior);
};
-
- return mode;
-};
-iD.modes.AddPoint = function(context) {
- var mode = {
- id: 'add-point',
- button: 'point',
- title: t('modes.add_point.title'),
- description: t('modes.add_point.description'),
- key: '1'
+ mode.selectedIDs = function() {
+ return [wayID];
};
+ mode.activeID = function() {
+ return behavior && behavior.activeID() || [];
+ };
+ return mode;
+ }
- var behavior = iD.behavior.Draw(context)
- .tail(t('modes.add_point.tail'))
- .on('click', add)
- .on('clickWay', addWay)
- .on('clickNode', addNode)
- .on('cancel', cancel)
- .on('finish', cancel);
-
- function add(loc) {
- var node = iD.Node({loc: loc});
-
- context.perform(
- iD.actions.AddEntity(node),
- t('operations.add.annotation.point'));
-
- context.enter(
- iD.modes.Select(context, [node.id])
- .suppressMenu(true)
- .newFeature(true));
- }
-
- function addWay(loc) {
- add(loc);
- }
-
- function addNode(node) {
- add(node.loc);
- }
-
- function cancel() {
- context.enter(iD.modes.Browse(context));
+ // modules/validations/disconnected_way.js
+ function validationDisconnectedWay() {
+ var type3 = "disconnected_way";
+ function isTaggedAsHighway(entity) {
+ return osmRoutableHighwayTagValues[entity.tags.highway];
}
-
- mode.enter = function() {
- context.install(behavior);
+ var validation = function checkDisconnectedWay(entity, graph) {
+ var routingIslandWays = routingIslandForEntity(entity);
+ if (!routingIslandWays)
+ return [];
+ return [new validationIssue({
+ type: type3,
+ subtype: "highway",
+ severity: "warning",
+ message: function(context) {
+ var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
+ var label = entity2 && utilDisplayLabel(entity2, context.graph());
+ return _t.html("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
+ },
+ reference: showReference,
+ entityIds: Array.from(routingIslandWays).map(function(way) {
+ return way.id;
+ }),
+ dynamicFixes: makeFixes
+ })];
+ function makeFixes(context) {
+ var fixes = [];
+ var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
+ if (singleEntity) {
+ if (singleEntity.type === "way" && !singleEntity.isClosed()) {
+ var textDirection = _mainLocalizer.textDirection();
+ var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
+ if (startFix)
+ fixes.push(startFix);
+ var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
+ if (endFix)
+ fixes.push(endFix);
+ }
+ if (!fixes.length) {
+ fixes.push(new validationIssueFix({
+ title: _t.html("issues.fix.connect_feature.title")
+ }));
+ }
+ fixes.push(new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix.delete_feature.title"),
+ entityIds: [singleEntity.id],
+ onClick: function(context2) {
+ var id2 = this.issue.entityIds[0];
+ var operation = operationDelete(context2, [id2]);
+ if (!operation.disabled()) {
+ operation();
+ }
+ }
+ }));
+ } else {
+ fixes.push(new validationIssueFix({
+ title: _t.html("issues.fix.connect_features.title")
+ }));
+ }
+ return fixes;
+ }
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
+ }
+ function routingIslandForEntity(entity2) {
+ var routingIsland = /* @__PURE__ */ new Set();
+ var waysToCheck = [];
+ function queueParentWays(node) {
+ graph.parentWays(node).forEach(function(parentWay) {
+ if (!routingIsland.has(parentWay) && isRoutableWay(parentWay, false)) {
+ routingIsland.add(parentWay);
+ waysToCheck.push(parentWay);
+ }
+ });
+ }
+ if (entity2.type === "way" && isRoutableWay(entity2, true)) {
+ routingIsland.add(entity2);
+ waysToCheck.push(entity2);
+ } else if (entity2.type === "node" && isRoutableNode(entity2)) {
+ routingIsland.add(entity2);
+ queueParentWays(entity2);
+ } else {
+ return null;
+ }
+ while (waysToCheck.length) {
+ var wayToCheck = waysToCheck.pop();
+ var childNodes = graph.childNodes(wayToCheck);
+ for (var i2 in childNodes) {
+ var vertex = childNodes[i2];
+ if (isConnectedVertex(vertex)) {
+ return null;
+ }
+ if (isRoutableNode(vertex)) {
+ routingIsland.add(vertex);
+ }
+ queueParentWays(vertex);
+ }
+ }
+ return routingIsland;
+ }
+ function isConnectedVertex(vertex) {
+ var osm = services.osm;
+ if (osm && !osm.isDataLoaded(vertex.loc))
+ return true;
+ if (vertex.tags.entrance && vertex.tags.entrance !== "no")
+ return true;
+ if (vertex.tags.amenity === "parking_entrance")
+ return true;
+ return false;
+ }
+ function isRoutableNode(node) {
+ if (node.tags.highway === "elevator")
+ return true;
+ return false;
+ }
+ function isRoutableWay(way, ignoreInnerWays) {
+ if (isTaggedAsHighway(way) || way.tags.route === "ferry")
+ return true;
+ return graph.parentRelations(way).some(function(parentRelation) {
+ if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
+ return true;
+ if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
+ return true;
+ return false;
+ });
+ }
+ function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
+ var vertex = graph.hasEntity(vertexID);
+ if (!vertex || vertex.tags.noexit === "yes")
+ return null;
+ var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
+ return new validationIssueFix({
+ icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
+ title: _t.html("issues.fix.continue_from_" + whichEnd + ".title"),
+ entityIds: [vertexID],
+ onClick: function(context) {
+ var wayId = this.issue.entityIds[0];
+ var way = context.hasEntity(wayId);
+ var vertexId = this.entityIds[0];
+ var vertex2 = context.hasEntity(vertexId);
+ if (!way || !vertex2)
+ return;
+ var map2 = context.map();
+ if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
+ map2.zoomToEase(vertex2);
+ }
+ context.enter(modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true));
+ }
+ });
+ }
};
+ validation.type = type3;
+ return validation;
+ }
- mode.exit = function() {
- context.uninstall(behavior);
+ // modules/validations/invalid_format.js
+ function validationFormatting() {
+ var type3 = "invalid_format";
+ var validation = function(entity) {
+ var issues = [];
+ function isValidEmail(email) {
+ var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
+ return !email || valid_email.test(email);
+ }
+ function showReferenceEmail(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
+ }
+ if (entity.tags.email) {
+ var emails = entity.tags.email.split(";").map(function(s) {
+ return s.trim();
+ }).filter(function(x) {
+ return !isValidEmail(x);
+ });
+ if (emails.length) {
+ issues.push(new validationIssue({
+ type: type3,
+ subtype: "email",
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.invalid_format.email.message" + this.data, { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }) : "";
+ },
+ reference: showReferenceEmail,
+ entityIds: [entity.id],
+ hash: emails.join(),
+ data: emails.length > 1 ? "_multi" : ""
+ }));
+ }
+ }
+ return issues;
};
+ validation.type = type3;
+ return validation;
+ }
- return mode;
-};
-iD.modes.Browse = function(context) {
- var mode = {
- button: 'browse',
- id: 'browse',
- title: t('modes.browse.title'),
- description: t('modes.browse.description')
- }, sidebar;
-
- var behaviors = [
- iD.behavior.Paste(context),
- iD.behavior.Hover(context)
- .on('hover', context.ui().sidebar.hover),
- iD.behavior.Select(context),
- iD.behavior.Lasso(context),
- iD.modes.DragNode(context).behavior];
+ // modules/validations/help_request.js
+ function validationHelpRequest(context) {
+ var type3 = "help_request";
+ var validation = function checkFixmeTag(entity) {
+ if (!entity.tags.fixme)
+ return [];
+ if (entity.version === void 0)
+ return [];
+ if (entity.v !== void 0) {
+ var baseEntity = context.history().base().hasEntity(entity.id);
+ if (!baseEntity || !baseEntity.tags.fixme)
+ return [];
+ }
+ return [new validationIssue({
+ type: type3,
+ subtype: "fixme_tag",
+ severity: "warning",
+ message: function(context2) {
+ var entity2 = context2.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.fixme_tag.message", {
+ feature: utilDisplayLabel(entity2, context2.graph(), true)
+ }) : "";
+ },
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ title: _t.html("issues.fix.address_the_concern.title")
+ })
+ ];
+ },
+ reference: showReference,
+ entityIds: [entity.id]
+ })];
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
+ }
+ };
+ validation.type = type3;
+ return validation;
+ }
- mode.enter = function() {
- behaviors.forEach(function(behavior) {
- context.install(behavior);
+ // modules/validations/impossible_oneway.js
+ function validationImpossibleOneway() {
+ var type3 = "impossible_oneway";
+ var validation = function checkImpossibleOneway(entity, graph) {
+ if (entity.type !== "way" || entity.geometry(graph) !== "line")
+ return [];
+ if (entity.isClosed())
+ return [];
+ if (!typeForWay(entity))
+ return [];
+ if (!isOneway(entity))
+ return [];
+ var firstIssues = issuesForNode(entity, entity.first());
+ var lastIssues = issuesForNode(entity, entity.last());
+ return firstIssues.concat(lastIssues);
+ function typeForWay(way) {
+ if (way.geometry(graph) !== "line")
+ return null;
+ if (osmRoutableHighwayTagValues[way.tags.highway])
+ return "highway";
+ if (osmFlowingWaterwayTagValues[way.tags.waterway])
+ return "waterway";
+ return null;
+ }
+ function isOneway(way) {
+ if (way.tags.oneway === "yes")
+ return true;
+ if (way.tags.oneway)
+ return false;
+ for (var key in way.tags) {
+ if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
+ return true;
+ }
+ }
+ return false;
+ }
+ function nodeOccursMoreThanOnce(way, nodeID) {
+ var occurrences = 0;
+ for (var index in way.nodes) {
+ if (way.nodes[index] === nodeID) {
+ occurrences += 1;
+ if (occurrences > 1)
+ return true;
+ }
+ }
+ return false;
+ }
+ function isConnectedViaOtherTypes(way, node) {
+ var wayType = typeForWay(way);
+ if (wayType === "highway") {
+ if (node.tags.entrance && node.tags.entrance !== "no")
+ return true;
+ if (node.tags.amenity === "parking_entrance")
+ return true;
+ } else if (wayType === "waterway") {
+ if (node.id === way.first()) {
+ if (node.tags.natural === "spring")
+ return true;
+ } else {
+ if (node.tags.manhole === "drain")
+ return true;
+ }
+ }
+ return graph.parentWays(node).some(function(parentWay) {
+ if (parentWay.id === way.id)
+ return false;
+ if (wayType === "highway") {
+ if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
+ return true;
+ if (parentWay.tags.route === "ferry")
+ return true;
+ return graph.parentRelations(parentWay).some(function(parentRelation) {
+ if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
+ return true;
+ return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
+ });
+ } else if (wayType === "waterway") {
+ if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
+ return true;
+ }
+ return false;
});
-
- // Get focus on the body.
- if (document.activeElement && document.activeElement.blur) {
- document.activeElement.blur();
+ }
+ function issuesForNode(way, nodeID) {
+ var isFirst = nodeID === way.first();
+ var wayType = typeForWay(way);
+ if (nodeOccursMoreThanOnce(way, nodeID))
+ return [];
+ var osm = services.osm;
+ if (!osm)
+ return [];
+ var node = graph.hasEntity(nodeID);
+ if (!node || !osm.isDataLoaded(node.loc))
+ return [];
+ if (isConnectedViaOtherTypes(way, node))
+ return [];
+ var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
+ if (parentWay.id === way.id)
+ return false;
+ return typeForWay(parentWay) === wayType;
+ });
+ if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
+ return [];
+ var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
+ return isOneway(attachedWay);
+ });
+ if (attachedOneways.length < attachedWaysOfSameType.length)
+ return [];
+ if (attachedOneways.length) {
+ var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
+ if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
+ return true;
+ if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
+ return true;
+ return false;
+ });
+ if (connectedEndpointsOkay)
+ return [];
}
-
- if (sidebar) {
- context.ui().sidebar.show(sidebar);
+ var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
+ if (wayType === "waterway") {
+ messageID += "connected." + placement;
+ referenceID += "connected";
} else {
- context.ui().sidebar.select(null);
+ messageID += placement;
+ referenceID += placement;
+ }
+ return [new validationIssue({
+ type: type3,
+ subtype: wayType,
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.impossible_oneway." + messageID + ".message", {
+ feature: utilDisplayLabel(entity2, context.graph())
+ }) : "";
+ },
+ reference: getReference(referenceID),
+ entityIds: [way.id, node.id],
+ dynamicFixes: function() {
+ var fixes = [];
+ if (attachedOneways.length) {
+ fixes.push(new validationIssueFix({
+ icon: "iD-operation-reverse",
+ title: _t.html("issues.fix.reverse_feature.title"),
+ entityIds: [way.id],
+ onClick: function(context) {
+ var id2 = this.issue.entityIds[0];
+ context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
+ }
+ }));
+ }
+ if (node.tags.noexit !== "yes") {
+ var textDirection = _mainLocalizer.textDirection();
+ var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
+ fixes.push(new validationIssueFix({
+ icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
+ title: _t.html("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
+ onClick: function(context) {
+ var entityID = this.issue.entityIds[0];
+ var vertexID = this.issue.entityIds[1];
+ var way2 = context.entity(entityID);
+ var vertex = context.entity(vertexID);
+ continueDrawing(way2, vertex, context);
+ }
+ }));
+ }
+ return fixes;
+ },
+ loc: node.loc
+ })];
+ function getReference(referenceID2) {
+ return function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
+ };
}
+ }
};
+ function continueDrawing(way, vertex, context) {
+ var map2 = context.map();
+ if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
+ map2.zoomToEase(vertex);
+ }
+ context.enter(modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true));
+ }
+ validation.type = type3;
+ return validation;
+ }
- mode.exit = function() {
- context.ui().sidebar.hover.cancel();
- behaviors.forEach(function(behavior) {
- context.uninstall(behavior);
+ // modules/validations/incompatible_source.js
+ function validationIncompatibleSource() {
+ const type3 = "incompatible_source";
+ const incompatibleRules = [
+ {
+ id: "amap",
+ regex: /(^amap$|^amap\.com|autonavi|mapabc|é«å¾·)/i
+ },
+ {
+ id: "baidu",
+ regex: /(baidu|mapbar|ç¾åº¦)/i
+ },
+ {
+ id: "google",
+ regex: /google/i,
+ exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
+ }
+ ];
+ const validation = function checkIncompatibleSource(entity) {
+ const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
+ if (!entitySources)
+ return [];
+ const entityID = entity.id;
+ return entitySources.map((source) => {
+ const matchRule = incompatibleRules.find((rule) => {
+ if (!rule.regex.test(source))
+ return false;
+ if (rule.exceptRegex && rule.exceptRegex.test(source))
+ return false;
+ return true;
});
-
- if (sidebar) {
- context.ui().sidebar.hide();
- }
+ if (!matchRule)
+ return null;
+ return new validationIssue({
+ type: type3,
+ severity: "warning",
+ message: (context) => {
+ const entity2 = context.hasEntity(entityID);
+ return entity2 ? _t.html("issues.incompatible_source.feature.message", {
+ feature: utilDisplayLabel(entity2, context.graph(), true),
+ value: source
+ }) : "";
+ },
+ reference: getReference(matchRule.id),
+ entityIds: [entityID],
+ hash: source,
+ dynamicFixes: () => {
+ return [
+ new validationIssueFix({ title: _t.html("issues.fix.remove_proprietary_data.title") })
+ ];
+ }
+ });
+ }).filter(Boolean);
+ function getReference(id2) {
+ return function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
+ };
+ }
};
+ validation.type = type3;
+ return validation;
+ }
- mode.sidebar = function(_) {
- if (!arguments.length) return sidebar;
- sidebar = _;
- return mode;
+ // modules/validations/maprules.js
+ function validationMaprules() {
+ var type3 = "maprules";
+ var validation = function checkMaprules(entity, graph) {
+ if (!services.maprules)
+ return [];
+ var rules = services.maprules.validationRules();
+ var issues = [];
+ for (var i2 = 0; i2 < rules.length; i2++) {
+ var rule = rules[i2];
+ rule.findIssues(entity, graph, issues);
+ }
+ return issues;
};
+ validation.type = type3;
+ return validation;
+ }
- return mode;
-};
-iD.modes.DragNode = function(context) {
- var mode = {
- id: 'drag-node',
- button: 'browse'
- };
-
- var nudgeInterval,
- activeIDs,
- wasMidpoint,
- cancelled,
- selectedIDs = [],
- hover = iD.behavior.Hover(context)
- .altDisables(true)
- .on('hover', context.ui().sidebar.hover),
- edit = iD.behavior.Edit(context);
-
- function edge(point, size) {
- var pad = [30, 100, 30, 100];
- if (point[0] > size[0] - pad[0]) return [-10, 0];
- else if (point[0] < pad[2]) return [10, 0];
- else if (point[1] > size[1] - pad[1]) return [0, -10];
- else if (point[1] < pad[3]) return [0, 10];
+ // modules/validations/mismatched_geometry.js
+ var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
+ function validationMismatchedGeometry() {
+ var type3 = "mismatched_geometry";
+ function tagSuggestingLineIsArea(entity) {
+ if (entity.type !== "way" || entity.isClosed())
+ return null;
+ var tagSuggestingArea = entity.tagSuggestingArea();
+ if (!tagSuggestingArea) {
+ return null;
+ }
+ var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
+ var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
+ if (asLine && asArea && asLine === asArea) {
return null;
+ }
+ return tagSuggestingArea;
}
-
- function startNudge(nudge) {
- if (nudgeInterval) window.clearInterval(nudgeInterval);
- nudgeInterval = window.setInterval(function() {
- context.pan(nudge);
- }, 50);
+ function makeConnectEndpointsFixOnClick(way, graph) {
+ if (way.nodes.length < 3)
+ return null;
+ var nodes = graph.childNodes(way), testNodes;
+ var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
+ if (firstToLastDistanceMeters < 0.75) {
+ testNodes = nodes.slice();
+ testNodes.pop();
+ testNodes.push(testNodes[0]);
+ if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
+ return function(context) {
+ var way2 = context.entity(this.issue.entityIds[0]);
+ context.perform(actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc), _t("issues.fix.connect_endpoints.annotation"));
+ };
+ }
+ }
+ testNodes = nodes.slice();
+ testNodes.push(testNodes[0]);
+ if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
+ return function(context) {
+ var wayId = this.issue.entityIds[0];
+ var way2 = context.entity(wayId);
+ var nodeId = way2.nodes[0];
+ var index = way2.nodes.length;
+ context.perform(actionAddVertex(wayId, nodeId, index), _t("issues.fix.connect_endpoints.annotation"));
+ };
+ }
}
-
- function stopNudge() {
- if (nudgeInterval) window.clearInterval(nudgeInterval);
- nudgeInterval = null;
+ function lineTaggedAsAreaIssue(entity) {
+ var tagSuggestingArea = tagSuggestingLineIsArea(entity);
+ if (!tagSuggestingArea)
+ return null;
+ return new validationIssue({
+ type: type3,
+ subtype: "area_as_line",
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.tag_suggests_area.message", {
+ feature: utilDisplayLabel(entity2, "area", true),
+ tag: utilTagText({ tags: tagSuggestingArea })
+ }) : "";
+ },
+ reference: showReference,
+ entityIds: [entity.id],
+ hash: JSON.stringify(tagSuggestingArea),
+ dynamicFixes: function(context) {
+ var fixes = [];
+ var entity2 = context.entity(this.entityIds[0]);
+ var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
+ fixes.push(new validationIssueFix({
+ title: _t.html("issues.fix.connect_endpoints.title"),
+ onClick: connectEndsOnClick
+ }));
+ fixes.push(new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix.remove_tag.title"),
+ onClick: function(context2) {
+ var entityId = this.issue.entityIds[0];
+ var entity3 = context2.entity(entityId);
+ var tags = Object.assign({}, entity3.tags);
+ for (var key in tagSuggestingArea) {
+ delete tags[key];
+ }
+ context2.perform(actionChangeTags(entityId, tags), _t("issues.fix.remove_tag.annotation"));
+ }
+ }));
+ return fixes;
+ }
+ });
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
+ }
}
-
- function moveAnnotation(entity) {
- return t('operations.move.annotation.' + entity.geometry(context.graph()));
+ function vertexPointIssue(entity, graph) {
+ if (entity.type !== "node")
+ return null;
+ if (Object.keys(entity.tags).length === 0)
+ return null;
+ if (entity.isOnAddressLine(graph))
+ return null;
+ var geometry = entity.geometry(graph);
+ var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
+ if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
+ return new validationIssue({
+ type: type3,
+ subtype: "vertex_as_point",
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.vertex_as_point.message", {
+ feature: utilDisplayLabel(entity2, "vertex", true)
+ }) : "";
+ },
+ reference: function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
+ },
+ entityIds: [entity.id]
+ });
+ } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
+ return new validationIssue({
+ type: type3,
+ subtype: "point_as_vertex",
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.point_as_vertex.message", {
+ feature: utilDisplayLabel(entity2, "point", true)
+ }) : "";
+ },
+ reference: function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
+ },
+ entityIds: [entity.id],
+ dynamicFixes: extractPointDynamicFixes
+ });
+ }
+ return null;
}
-
- function connectAnnotation(entity) {
- return t('operations.connect.annotation.' + entity.geometry(context.graph()));
+ function otherMismatchIssue(entity, graph) {
+ if (!entity.hasInterestingTags())
+ return null;
+ if (entity.type !== "node" && entity.type !== "way")
+ return null;
+ if (entity.type === "node" && entity.isOnAddressLine(graph))
+ return null;
+ var sourceGeom = entity.geometry(graph);
+ var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
+ if (sourceGeom === "area")
+ targetGeoms.unshift("line");
+ var asSource = _mainPresetIndex.match(entity, graph);
+ var targetGeom = targetGeoms.find((nodeGeom) => {
+ var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
+ if (!asSource || !asTarget || asSource === asTarget || (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
+ return false;
+ if (asTarget.isFallback())
+ return false;
+ var primaryKey = Object.keys(asTarget.tags)[0];
+ if (primaryKey === "building")
+ return false;
+ if (asTarget.tags[primaryKey] === "*")
+ return false;
+ return asSource.isFallback() || asSource.tags[primaryKey] === "*";
+ });
+ if (!targetGeom)
+ return null;
+ var subtype = targetGeom + "_as_" + sourceGeom;
+ if (targetGeom === "vertex")
+ targetGeom = "point";
+ if (sourceGeom === "vertex")
+ sourceGeom = "point";
+ var referenceId = targetGeom + "_as_" + sourceGeom;
+ var dynamicFixes;
+ if (targetGeom === "point") {
+ dynamicFixes = extractPointDynamicFixes;
+ } else if (sourceGeom === "area" && targetGeom === "line") {
+ dynamicFixes = lineToAreaDynamicFixes;
+ }
+ return new validationIssue({
+ type: type3,
+ subtype,
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues." + referenceId + ".message", {
+ feature: utilDisplayLabel(entity2, targetGeom, true)
+ }) : "";
+ },
+ reference: function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
+ },
+ entityIds: [entity.id],
+ dynamicFixes
+ });
}
-
- function origin(entity) {
- return context.projection(entity.loc);
+ function lineToAreaDynamicFixes(context) {
+ var convertOnClick;
+ var entityId = this.entityIds[0];
+ var entity = context.entity(entityId);
+ var tags = Object.assign({}, entity.tags);
+ delete tags.area;
+ if (!osmTagSuggestingArea(tags)) {
+ convertOnClick = function(context2) {
+ var entityId2 = this.issue.entityIds[0];
+ var entity2 = context2.entity(entityId2);
+ var tags2 = Object.assign({}, entity2.tags);
+ if (tags2.area) {
+ delete tags2.area;
+ }
+ context2.perform(actionChangeTags(entityId2, tags2), _t("issues.fix.convert_to_line.annotation"));
+ };
+ }
+ return [
+ new validationIssueFix({
+ icon: "iD-icon-line",
+ title: _t.html("issues.fix.convert_to_line.title"),
+ onClick: convertOnClick
+ })
+ ];
}
+ function extractPointDynamicFixes(context) {
+ var entityId = this.entityIds[0];
+ var extractOnClick = null;
+ if (!context.hasHiddenConnections(entityId)) {
+ extractOnClick = function(context2) {
+ var entityId2 = this.issue.entityIds[0];
+ var action = actionExtract(entityId2, context2.projection);
+ context2.perform(action, _t("operations.extract.annotation", { n: 1 }));
+ context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
+ };
+ }
+ return [
+ new validationIssueFix({
+ icon: "iD-operation-extract",
+ title: _t.html("issues.fix.extract_point.title"),
+ onClick: extractOnClick
+ })
+ ];
+ }
+ function unclosedMultipolygonPartIssues(entity, graph) {
+ if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || !entity.isComplete(graph))
+ return [];
+ var sequences = osmJoinWays(entity.members, graph);
+ var issues = [];
+ for (var i2 in sequences) {
+ var sequence = sequences[i2];
+ if (!sequence.nodes)
+ continue;
+ var firstNode = sequence.nodes[0];
+ var lastNode = sequence.nodes[sequence.nodes.length - 1];
+ if (firstNode === lastNode)
+ continue;
+ var issue = new validationIssue({
+ type: type3,
+ subtype: "unclosed_multipolygon_part",
+ severity: "warning",
+ message: function(context) {
+ var entity2 = context.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.unclosed_multipolygon_part.message", {
+ feature: utilDisplayLabel(entity2, context.graph(), true)
+ }) : "";
+ },
+ reference: showReference,
+ loc: sequence.nodes[0].loc,
+ entityIds: [entity.id],
+ hash: sequence.map(function(way) {
+ return way.id;
+ }).join()
+ });
+ issues.push(issue);
+ }
+ return issues;
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
+ }
+ }
+ var validation = function checkMismatchedGeometry(entity, graph) {
+ var vertexPoint = vertexPointIssue(entity, graph);
+ if (vertexPoint)
+ return [vertexPoint];
+ var lineAsArea = lineTaggedAsAreaIssue(entity);
+ if (lineAsArea)
+ return [lineAsArea];
+ var mismatch = otherMismatchIssue(entity, graph);
+ if (mismatch)
+ return [mismatch];
+ return unclosedMultipolygonPartIssues(entity, graph);
+ };
+ validation.type = type3;
+ return validation;
+ }
- function start(entity) {
- cancelled = d3.event.sourceEvent.shiftKey ||
- context.features().hasHiddenConnections(entity, context.graph());
-
- if (cancelled) return behavior.cancel();
+ // modules/validations/missing_role.js
+ function validationMissingRole() {
+ var type3 = "missing_role";
+ var validation = function checkMissingRole(entity, graph) {
+ var issues = [];
+ if (entity.type === "way") {
+ graph.parentRelations(entity).forEach(function(relation) {
+ if (!relation.isMultipolygon())
+ return;
+ var member = relation.memberById(entity.id);
+ if (member && isMissingRole(member)) {
+ issues.push(makeIssue(entity, relation, member));
+ }
+ });
+ } else if (entity.type === "relation" && entity.isMultipolygon()) {
+ entity.indexedMembers().forEach(function(member) {
+ var way = graph.hasEntity(member.id);
+ if (way && isMissingRole(member)) {
+ issues.push(makeIssue(way, entity, member));
+ }
+ });
+ }
+ return issues;
+ };
+ function isMissingRole(member) {
+ return !member.role || !member.role.trim().length;
+ }
+ function makeIssue(way, relation, member) {
+ return new validationIssue({
+ type: type3,
+ severity: "warning",
+ message: function(context) {
+ var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
+ return member2 && relation2 ? _t.html("issues.missing_role.message", {
+ member: utilDisplayLabel(member2, context.graph()),
+ relation: utilDisplayLabel(relation2, context.graph())
+ }) : "";
+ },
+ reference: showReference,
+ entityIds: [relation.id, way.id],
+ data: {
+ member
+ },
+ hash: member.index.toString(),
+ dynamicFixes: function() {
+ return [
+ makeAddRoleFix("inner"),
+ makeAddRoleFix("outer"),
+ new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix.remove_from_relation.title"),
+ onClick: function(context) {
+ context.perform(actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index), _t("operations.delete_member.annotation", {
+ n: 1
+ }));
+ }
+ })
+ ];
+ }
+ });
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
+ }
+ }
+ function makeAddRoleFix(role) {
+ return new validationIssueFix({
+ title: _t.html("issues.fix.set_as_" + role + ".title"),
+ onClick: function(context) {
+ var oldMember = this.issue.data.member;
+ var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
+ context.perform(actionChangeMember(this.issue.entityIds[0], member, oldMember.index), _t("operations.change_role.annotation", {
+ n: 1
+ }));
+ }
+ });
+ }
+ validation.type = type3;
+ return validation;
+ }
- wasMidpoint = entity.type === 'midpoint';
- if (wasMidpoint) {
- var midpoint = entity;
- entity = iD.Node();
- context.perform(iD.actions.AddMidpoint(midpoint, entity));
+ // modules/validations/missing_tag.js
+ function validationMissingTag(context) {
+ var type3 = "missing_tag";
+ function hasDescriptiveTags(entity, graph) {
+ var onlyAttributeKeys = ["description", "name", "note", "start_date"];
+ var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k) {
+ if (k === "area" || !osmIsInterestingTag(k))
+ return false;
+ return !onlyAttributeKeys.some(function(attributeKey) {
+ return k === attributeKey || k.indexOf(attributeKey + ":") === 0;
+ });
+ });
+ if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
+ return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
+ }
+ return entityDescriptiveKeys.length > 0;
+ }
+ function isUnknownRoad(entity) {
+ return entity.type === "way" && entity.tags.highway === "road";
+ }
+ function isUntypedRelation(entity) {
+ return entity.type === "relation" && !entity.tags.type;
+ }
+ var validation = function checkMissingTag(entity, graph) {
+ var subtype;
+ var osm = context.connection();
+ var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
+ if (!isUnloadedNode && entity.geometry(graph) !== "vertex" && !entity.hasParentRelations(graph)) {
+ if (Object.keys(entity.tags).length === 0) {
+ subtype = "any";
+ } else if (!hasDescriptiveTags(entity, graph)) {
+ subtype = "descriptive";
+ } else if (isUntypedRelation(entity)) {
+ subtype = "relation_type";
+ }
+ }
+ if (!subtype && isUnknownRoad(entity)) {
+ subtype = "highway_classification";
+ }
+ if (!subtype)
+ return [];
+ var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
+ var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
+ var canDelete = entity.version === void 0 || entity.v !== void 0;
+ var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
+ return [new validationIssue({
+ type: type3,
+ subtype,
+ severity,
+ message: function(context2) {
+ var entity2 = context2.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues." + messageID + ".message", {
+ feature: utilDisplayLabel(entity2, context2.graph())
+ }) : "";
+ },
+ reference: showReference,
+ entityIds: [entity.id],
+ dynamicFixes: function(context2) {
+ var fixes = [];
+ var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
+ fixes.push(new validationIssueFix({
+ icon: "iD-icon-search",
+ title: _t.html("issues.fix." + selectFixType + ".title"),
+ onClick: function(context3) {
+ context3.ui().sidebar.showPresetList();
+ }
+ }));
+ var deleteOnClick;
+ var id2 = this.entityIds[0];
+ var operation = operationDelete(context2, [id2]);
+ var disabledReasonID = operation.disabled();
+ if (!disabledReasonID) {
+ deleteOnClick = function(context3) {
+ var id3 = this.issue.entityIds[0];
+ var operation2 = operationDelete(context3, [id3]);
+ if (!operation2.disabled()) {
+ operation2();
+ }
+ };
+ }
+ fixes.push(new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix.delete_feature.title"),
+ disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
+ onClick: deleteOnClick
+ }));
+ return fixes;
+ }
+ })];
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
+ }
+ };
+ validation.type = type3;
+ return validation;
+ }
- var vertex = context.surface()
- .selectAll('.' + entity.id);
- behavior.target(vertex.node(), entity);
+ // modules/validations/outdated_tags.js
+ function validationOutdatedTags() {
+ const type3 = "outdated_tags";
+ let _waitingForDeprecated = true;
+ let _dataDeprecated;
+ _mainFileFetcher.get("deprecated").then((d) => _dataDeprecated = d).catch(() => {
+ }).finally(() => _waitingForDeprecated = false);
+ function oldTagIssues(entity, graph) {
+ const oldTags = Object.assign({}, entity.tags);
+ let preset = _mainPresetIndex.match(entity, graph);
+ let subtype = "deprecated_tags";
+ if (!preset)
+ return [];
+ if (!entity.hasInterestingTags())
+ return [];
+ if (preset.replacement) {
+ const newPreset = _mainPresetIndex.item(preset.replacement);
+ graph = actionChangePreset(entity.id, preset, newPreset, true)(graph);
+ entity = graph.entity(entity.id);
+ preset = newPreset;
+ }
+ if (_dataDeprecated) {
+ const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
+ if (deprecatedTags.length) {
+ deprecatedTags.forEach((tag) => {
+ graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
+ });
+ entity = graph.entity(entity.id);
+ }
+ }
+ let newTags = Object.assign({}, entity.tags);
+ if (preset.tags !== preset.addTags) {
+ Object.keys(preset.addTags).forEach((k) => {
+ if (!newTags[k]) {
+ if (preset.addTags[k] === "*") {
+ newTags[k] = "yes";
+ } else {
+ newTags[k] = preset.addTags[k];
+ }
+ }
+ });
+ }
+ const nsi = services.nsi;
+ let waitingForNsi = false;
+ let nsiResult;
+ if (nsi) {
+ waitingForNsi = nsi.status() === "loading";
+ if (!waitingForNsi) {
+ const loc = entity.extent(graph).center();
+ nsiResult = nsi.upgradeTags(newTags, loc);
+ if (nsiResult) {
+ newTags = nsiResult.newTags;
+ subtype = "noncanonical_brand";
+ }
+ }
+ }
+ let issues = [];
+ issues.provisional = _waitingForDeprecated || waitingForNsi;
+ const tagDiff = utilTagDiff(oldTags, newTags);
+ if (!tagDiff.length)
+ return issues;
+ const isOnlyAddingTags = tagDiff.every((d) => d.type === "+");
+ let prefix = "";
+ if (nsiResult) {
+ prefix = "noncanonical_brand.";
+ } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
+ subtype = "incomplete_tags";
+ prefix = "incomplete.";
+ }
+ let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
+ issues.push(new validationIssue({
+ type: type3,
+ subtype,
+ severity: "warning",
+ message: showMessage,
+ reference: showReference,
+ entityIds: [entity.id],
+ hash: utilHashcode(JSON.stringify(tagDiff)),
+ dynamicFixes: () => {
+ let fixes = [
+ new validationIssueFix({
+ autoArgs,
+ title: _t.html("issues.fix.upgrade_tags.title"),
+ onClick: (context) => {
+ context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
+ }
+ })
+ ];
+ const item = nsiResult && nsiResult.matched;
+ if (item) {
+ fixes.push(new validationIssueFix({
+ title: _t.html("issues.fix.tag_as_not.title", { name: item.displayName }),
+ onClick: (context) => {
+ context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
+ }
+ }));
+ }
+ return fixes;
+ }
+ }));
+ return issues;
+ function doUpgrade(graph2) {
+ const currEntity = graph2.hasEntity(entity.id);
+ if (!currEntity)
+ return graph2;
+ let newTags2 = Object.assign({}, currEntity.tags);
+ tagDiff.forEach((diff) => {
+ if (diff.type === "-") {
+ delete newTags2[diff.key];
+ } else if (diff.type === "+") {
+ newTags2[diff.key] = diff.newVal;
+ }
+ });
+ return actionChangeTags(currEntity.id, newTags2)(graph2);
+ }
+ function addNotTag(graph2) {
+ const currEntity = graph2.hasEntity(entity.id);
+ if (!currEntity)
+ return graph2;
+ const item = nsiResult && nsiResult.matched;
+ if (!item)
+ return graph2;
+ let newTags2 = Object.assign({}, currEntity.tags);
+ const wd = item.mainTag;
+ const notwd = `not:${wd}`;
+ const qid = item.tags[wd];
+ newTags2[notwd] = qid;
+ if (newTags2[wd] === qid) {
+ const wp = item.mainTag.replace("wikidata", "wikipedia");
+ delete newTags2[wd];
+ delete newTags2[wp];
+ }
+ return actionChangeTags(currEntity.id, newTags2)(graph2);
+ }
+ function showMessage(context) {
+ const currEntity = context.hasEntity(entity.id);
+ if (!currEntity)
+ return "";
+ let messageID = `issues.outdated_tags.${prefix}message`;
+ if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
+ messageID += "_incomplete";
+ }
+ return _t.html(messageID, {
+ feature: utilDisplayLabel(currEntity, context.graph(), true)
+ });
+ }
+ function showReference(selection2) {
+ let enter = selection2.selectAll(".issue-reference").data([0]).enter();
+ enter.append("div").attr("class", "issue-reference").call(_t.append(`issues.outdated_tags.${prefix}reference`));
+ enter.append("strong").call(_t.append("issues.suggested"));
+ enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d) => {
+ let klass = d.type === "+" ? "add" : "remove";
+ return `tagDiff-cell tagDiff-cell-${klass}`;
+ }).html((d) => d.display);
+ }
+ }
+ function oldMultipolygonIssues(entity, graph) {
+ let multipolygon, outerWay;
+ if (entity.type === "relation") {
+ outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
+ multipolygon = entity;
+ } else if (entity.type === "way") {
+ multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
+ outerWay = entity;
+ } else {
+ return [];
+ }
+ if (!multipolygon || !outerWay)
+ return [];
+ return [new validationIssue({
+ type: type3,
+ subtype: "old_multipolygon",
+ severity: "warning",
+ message: showMessage,
+ reference: showReference,
+ entityIds: [outerWay.id, multipolygon.id],
+ dynamicFixes: () => {
+ return [
+ new validationIssueFix({
+ autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
+ title: _t.html("issues.fix.move_tags.title"),
+ onClick: (context) => {
+ context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
+ }
+ })
+ ];
+ }
+ })];
+ function doUpgrade(graph2) {
+ let currMultipolygon = graph2.hasEntity(multipolygon.id);
+ let currOuterWay = graph2.hasEntity(outerWay.id);
+ if (!currMultipolygon || !currOuterWay)
+ return graph2;
+ currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
+ graph2 = graph2.replace(currMultipolygon);
+ return actionChangeTags(currOuterWay.id, {})(graph2);
+ }
+ function showMessage(context) {
+ let currMultipolygon = context.hasEntity(multipolygon.id);
+ if (!currMultipolygon)
+ return "";
+ return _t.html("issues.old_multipolygon.message", { multipolygon: utilDisplayLabel(currMultipolygon, context.graph(), true) });
+ }
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
+ }
+ }
+ let validation = function checkOutdatedTags(entity, graph) {
+ let issues = oldMultipolygonIssues(entity, graph);
+ if (!issues.length)
+ issues = oldTagIssues(entity, graph);
+ return issues;
+ };
+ validation.type = type3;
+ return validation;
+ }
- } else {
- context.perform(
- iD.actions.Noop());
+ // modules/validations/private_data.js
+ function validationPrivateData() {
+ var type3 = "private_data";
+ var privateBuildingValues = {
+ detached: true,
+ farm: true,
+ house: true,
+ houseboat: true,
+ residential: true,
+ semidetached_house: true,
+ static_caravan: true
+ };
+ var publicKeys = {
+ amenity: true,
+ craft: true,
+ historic: true,
+ leisure: true,
+ office: true,
+ shop: true,
+ tourism: true
+ };
+ var personalTags = {
+ "contact:email": true,
+ "contact:fax": true,
+ "contact:phone": true,
+ email: true,
+ fax: true,
+ phone: true
+ };
+ var validation = function checkPrivateData(entity) {
+ var tags = entity.tags;
+ if (!tags.building || !privateBuildingValues[tags.building])
+ return [];
+ var keepTags = {};
+ for (var k in tags) {
+ if (publicKeys[k])
+ return [];
+ if (!personalTags[k]) {
+ keepTags[k] = tags[k];
+ }
+ }
+ var tagDiff = utilTagDiff(tags, keepTags);
+ if (!tagDiff.length)
+ return [];
+ var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
+ return [new validationIssue({
+ type: type3,
+ severity: "warning",
+ message: showMessage,
+ reference: showReference,
+ entityIds: [entity.id],
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix." + fixID + ".title"),
+ onClick: function(context) {
+ context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
+ }
+ })
+ ];
}
+ })];
+ function doUpgrade(graph) {
+ var currEntity = graph.hasEntity(entity.id);
+ if (!currEntity)
+ return graph;
+ var newTags = Object.assign({}, currEntity.tags);
+ tagDiff.forEach(function(diff) {
+ if (diff.type === "-") {
+ delete newTags[diff.key];
+ } else if (diff.type === "+") {
+ newTags[diff.key] = diff.newVal;
+ }
+ });
+ return actionChangeTags(currEntity.id, newTags)(graph);
+ }
+ function showMessage(context) {
+ var currEntity = context.hasEntity(this.entityIds[0]);
+ if (!currEntity)
+ return "";
+ return _t.html("issues.private_data.contact.message", { feature: utilDisplayLabel(currEntity, context.graph()) });
+ }
+ function showReference(selection2) {
+ var enter = selection2.selectAll(".issue-reference").data([0]).enter();
+ enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
+ enter.append("strong").call(_t.append("issues.suggested"));
+ enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d) {
+ var klass = d.type === "+" ? "add" : "remove";
+ return "tagDiff-cell tagDiff-cell-" + klass;
+ }).html(function(d) {
+ return d.display;
+ });
+ }
+ };
+ validation.type = type3;
+ return validation;
+ }
- activeIDs = _.map(context.graph().parentWays(entity), 'id');
- activeIDs.push(entity.id);
-
- context.enter(mode);
+ // modules/validations/suspicious_name.js
+ function validationSuspiciousName() {
+ const type3 = "suspicious_name";
+ const keysToTestForGenericValues = [
+ "aerialway",
+ "aeroway",
+ "amenity",
+ "building",
+ "craft",
+ "highway",
+ "leisure",
+ "railway",
+ "man_made",
+ "office",
+ "shop",
+ "tourism",
+ "waterway"
+ ];
+ let _waitingForNsi = false;
+ function isGenericMatchInNsi(tags) {
+ const nsi = services.nsi;
+ if (nsi) {
+ _waitingForNsi = nsi.status() === "loading";
+ if (!_waitingForNsi) {
+ return nsi.isGenericName(tags);
+ }
+ }
+ return false;
}
-
- function datum() {
- if (d3.event.sourceEvent.altKey) {
- return {};
+ function nameMatchesRawTag(lowercaseName, tags) {
+ for (let i2 = 0; i2 < keysToTestForGenericValues.length; i2++) {
+ let key = keysToTestForGenericValues[i2];
+ let val = tags[key];
+ if (val) {
+ val = val.toLowerCase();
+ if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
+ return true;
+ }
}
-
- return d3.event.sourceEvent.target.__data__ || {};
+ }
+ return false;
}
-
- // via https://gist.github.com/shawnbot/4166283
- function childOf(p, c) {
- if (p === c) return false;
- while (c && c !== p) c = c.parentNode;
- return c === p;
+ function isGenericName(name2, tags) {
+ name2 = name2.toLowerCase();
+ return nameMatchesRawTag(name2, tags) || isGenericMatchInNsi(tags);
+ }
+ function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
+ return new validationIssue({
+ type: type3,
+ subtype: "generic_name",
+ severity: "warning",
+ message: function(context) {
+ let entity = context.hasEntity(this.entityIds[0]);
+ if (!entity)
+ return "";
+ let preset = _mainPresetIndex.match(entity, context.graph());
+ let langName = langCode && _mainLocalizer.languageName(langCode);
+ return _t.html("issues.generic_name.message" + (langName ? "_language" : ""), { feature: preset.name(), name: genericName, language: langName });
+ },
+ reference: showReference,
+ entityIds: [entityId],
+ hash: `${nameKey}=${genericName}`,
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix.remove_the_name.title"),
+ onClick: function(context) {
+ let entityId2 = this.issue.entityIds[0];
+ let entity = context.entity(entityId2);
+ let tags = Object.assign({}, entity.tags);
+ delete tags[nameKey];
+ context.perform(actionChangeTags(entityId2, tags), _t("issues.fix.remove_generic_name.annotation"));
+ }
+ })
+ ];
+ }
+ });
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
+ }
}
-
- function move(entity) {
- if (cancelled) return;
- d3.event.sourceEvent.stopPropagation();
-
- var nudge = childOf(context.container().node(),
- d3.event.sourceEvent.toElement) &&
- edge(d3.event.point, context.map().dimensions());
-
- if (nudge) startNudge(nudge);
- else stopNudge();
-
- var loc = context.projection.invert(d3.event.point);
-
- var d = datum();
- if (d.type === 'node' && d.id !== entity.id) {
- loc = d.loc;
- } else if (d.type === 'way' && !d3.select(d3.event.sourceEvent.target).classed('fill')) {
- loc = iD.geo.chooseEdge(context.childNodes(d), context.mouse(), context.projection).loc;
+ function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
+ return new validationIssue({
+ type: type3,
+ subtype: "not_name",
+ severity: "warning",
+ message: function(context) {
+ const entity = context.hasEntity(this.entityIds[0]);
+ if (!entity)
+ return "";
+ const preset = _mainPresetIndex.match(entity, context.graph());
+ const langName = langCode && _mainLocalizer.languageName(langCode);
+ return _t.html("issues.incorrect_name.message" + (langName ? "_language" : ""), { feature: preset.name(), name: incorrectName, language: langName });
+ },
+ reference: showReference,
+ entityIds: [entityId],
+ hash: `${nameKey}=${incorrectName}`,
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ icon: "iD-operation-delete",
+ title: _t.html("issues.fix.remove_the_name.title"),
+ onClick: function(context) {
+ const entityId2 = this.issue.entityIds[0];
+ const entity = context.entity(entityId2);
+ let tags = Object.assign({}, entity.tags);
+ delete tags[nameKey];
+ context.perform(actionChangeTags(entityId2, tags), _t("issues.fix.remove_mistaken_name.annotation"));
+ }
+ })
+ ];
}
-
- context.replace(
- iD.actions.MoveNode(entity.id, loc),
- moveAnnotation(entity));
+ });
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
+ }
}
-
- function end(entity) {
- if (cancelled) return;
-
- var d = datum();
-
- if (d.type === 'way') {
- var choice = iD.geo.chooseEdge(context.childNodes(d), context.mouse(), context.projection);
- context.replace(
- iD.actions.AddMidpoint({ loc: choice.loc, edge: [d.nodes[choice.index - 1], d.nodes[choice.index]] }, entity),
- connectAnnotation(d));
-
- } else if (d.type === 'node' && d.id !== entity.id) {
- context.replace(
- iD.actions.Connect([d.id, entity.id]),
- connectAnnotation(d));
-
- } else if (wasMidpoint) {
- context.replace(
- iD.actions.Noop(),
- t('operations.add.annotation.vertex'));
-
- } else {
- context.replace(
- iD.actions.Noop(),
- moveAnnotation(entity));
+ let validation = function checkGenericName(entity) {
+ const tags = entity.tags;
+ const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
+ if (hasWikidata)
+ return [];
+ let issues = [];
+ const notNames2 = (tags["not:name"] || "").split(";");
+ for (let key in tags) {
+ const m = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
+ if (!m)
+ continue;
+ const langCode = m.length >= 2 ? m[1] : null;
+ const value = tags[key];
+ if (notNames2.length) {
+ for (let i2 in notNames2) {
+ const notName = notNames2[i2];
+ if (notName && value === notName) {
+ issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
+ continue;
+ }
+ }
}
-
- var reselection = selectedIDs.filter(function(id) {
- return context.graph().hasEntity(id);
- });
-
- if (reselection.length) {
- context.enter(
- iD.modes.Select(context, reselection)
- .suppressMenu(true));
- } else {
- context.enter(iD.modes.Browse(context));
+ if (isGenericName(value, tags)) {
+ issues.provisional = _waitingForNsi;
+ issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
}
- }
-
- function cancel() {
- behavior.cancel();
- context.enter(iD.modes.Browse(context));
- }
+ }
+ return issues;
+ };
+ validation.type = type3;
+ return validation;
+ }
- function setActiveElements() {
- context.surface().selectAll(iD.util.entitySelector(activeIDs))
- .classed('active', true);
+ // modules/validations/unsquare_way.js
+ function validationUnsquareWay(context) {
+ var type3 = "unsquare_way";
+ var DEFAULT_DEG_THRESHOLD = 5;
+ var epsilon3 = 0.05;
+ var nodeThreshold = 10;
+ function isBuilding(entity, graph) {
+ if (entity.type !== "way" || entity.geometry(graph) !== "area")
+ return false;
+ return entity.tags.building && entity.tags.building !== "no";
}
-
- var behavior = iD.behavior.drag()
- .delegate('g.node, g.point, g.midpoint')
- .surface(context.surface().node())
- .origin(origin)
- .on('start', start)
- .on('move', move)
- .on('end', end);
-
- mode.enter = function() {
- context.install(hover);
- context.install(edit);
-
- context.history()
- .on('undone.drag-node', cancel);
-
- context.map()
- .on('drawn.drag-node', setActiveElements);
-
- setActiveElements();
+ var validation = function checkUnsquareWay(entity, graph) {
+ if (!isBuilding(entity, graph))
+ return [];
+ if (entity.tags.nonsquare === "yes")
+ return [];
+ var isClosed = entity.isClosed();
+ if (!isClosed)
+ return [];
+ var nodes = graph.childNodes(entity).slice();
+ if (nodes.length > nodeThreshold + 1)
+ return [];
+ var osm = services.osm;
+ if (!osm || nodes.some(function(node) {
+ return !osm.isDataLoaded(node.loc);
+ }))
+ return [];
+ var hasConnectedSquarableWays = nodes.some(function(node) {
+ return graph.parentWays(node).some(function(way) {
+ if (way.id === entity.id)
+ return false;
+ if (isBuilding(way, graph))
+ return true;
+ return graph.parentRelations(way).some(function(parentRelation) {
+ return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
+ });
+ });
+ });
+ if (hasConnectedSquarableWays)
+ return [];
+ var storedDegreeThreshold = corePreferences("validate-square-degrees");
+ var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold);
+ var points = nodes.map(function(node) {
+ return context.projection(node.loc);
+ });
+ if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
+ return [];
+ var autoArgs;
+ if (!entity.tags.wikidata) {
+ var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
+ autoAction.transitionable = false;
+ autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
+ }
+ return [new validationIssue({
+ type: type3,
+ subtype: "building",
+ severity: "warning",
+ message: function(context2) {
+ var entity2 = context2.hasEntity(this.entityIds[0]);
+ return entity2 ? _t.html("issues.unsquare_way.message", {
+ feature: utilDisplayLabel(entity2, context2.graph())
+ }) : "";
+ },
+ reference: showReference,
+ entityIds: [entity.id],
+ hash: degreeThreshold,
+ dynamicFixes: function() {
+ return [
+ new validationIssueFix({
+ icon: "iD-operation-orthogonalize",
+ title: _t.html("issues.fix.square_feature.title"),
+ autoArgs,
+ onClick: function(context2, completionHandler) {
+ var entityId = this.issue.entityIds[0];
+ context2.perform(actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold), _t("operations.orthogonalize.annotation.feature", { n: 1 }));
+ window.setTimeout(function() {
+ completionHandler();
+ }, 175);
+ }
+ })
+ ];
+ }
+ })];
+ function showReference(selection2) {
+ selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
+ }
};
+ validation.type = type3;
+ return validation;
+ }
- mode.exit = function() {
- context.ui().sidebar.hover.cancel();
- context.uninstall(hover);
- context.uninstall(edit);
-
- context.history()
- .on('undone.drag-node', null);
-
- context.map()
- .on('drawn.drag-node', null);
-
- context.surface()
- .selectAll('.active')
- .classed('active', false);
-
- stopNudge();
+ // modules/core/validator.js
+ function coreValidator(context) {
+ let dispatch10 = dispatch_default("validated", "focusedIssue");
+ let validator = utilRebind({}, dispatch10, "on");
+ let _rules = {};
+ let _disabledRules = {};
+ let _ignoredIssueIDs = /* @__PURE__ */ new Set();
+ let _resolvedIssueIDs = /* @__PURE__ */ new Set();
+ let _baseCache = validationCache("base");
+ let _headCache = validationCache("head");
+ let _completeDiff = {};
+ let _headIsCurrent = false;
+ let _deferredRIC = {};
+ let _deferredST = /* @__PURE__ */ new Set();
+ let _headPromise;
+ const RETRY = 5e3;
+ const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
+ const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
+ const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
+ function parseHashParam(param) {
+ let result = [];
+ let rules = (param || "").split(",");
+ rules.forEach((rule) => {
+ rule = rule.trim();
+ const parts = rule.split("/", 2);
+ const type3 = parts[0];
+ const subtype = parts[1] || "*";
+ if (!type3 || !subtype)
+ return;
+ result.push({ type: makeRegExp(type3), subtype: makeRegExp(subtype) });
+ });
+ return result;
+ function makeRegExp(str2) {
+ const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
+ return new RegExp("^" + escaped + "$");
+ }
+ }
+ validator.init = () => {
+ Object.values(validations_exports).forEach((validation) => {
+ if (typeof validation !== "function")
+ return;
+ const fn = validation(context);
+ const key = fn.type;
+ _rules[key] = fn;
+ });
+ let disabledRules = corePreferences("validate-disabledRules");
+ if (disabledRules) {
+ disabledRules.split(",").forEach((k) => _disabledRules[k] = true);
+ }
};
-
- mode.selectedIDs = function(_) {
- if (!arguments.length) return selectedIDs;
- selectedIDs = _;
- return mode;
+ function reset(resetIgnored) {
+ _baseCache.queue = [];
+ _headCache.queue = [];
+ Object.keys(_deferredRIC).forEach((key) => {
+ window.cancelIdleCallback(key);
+ _deferredRIC[key]();
+ });
+ _deferredRIC = {};
+ _deferredST.forEach(window.clearTimeout);
+ _deferredST.clear();
+ if (resetIgnored)
+ _ignoredIssueIDs.clear();
+ _resolvedIssueIDs.clear();
+ _baseCache = validationCache("base");
+ _headCache = validationCache("head");
+ _completeDiff = {};
+ _headIsCurrent = false;
+ }
+ validator.reset = () => {
+ reset(true);
+ };
+ validator.resetIgnoredIssues = () => {
+ _ignoredIssueIDs.clear();
+ dispatch10.call("validated");
+ };
+ validator.revalidateUnsquare = () => {
+ revalidateUnsquare(_headCache);
+ revalidateUnsquare(_baseCache);
+ dispatch10.call("validated");
+ };
+ function revalidateUnsquare(cache) {
+ const checkUnsquareWay = _rules.unsquare_way;
+ if (!cache.graph || typeof checkUnsquareWay !== "function")
+ return;
+ cache.uncacheIssuesOfType("unsquare_way");
+ const buildings = context.history().tree().intersects(geoExtent([-180, -90], [180, 90]), cache.graph).filter((entity) => entity.type === "way" && entity.tags.building && entity.tags.building !== "no");
+ buildings.forEach((entity) => {
+ const detected = checkUnsquareWay(entity, cache.graph);
+ if (!detected.length)
+ return;
+ cache.cacheIssues(detected);
+ });
+ }
+ validator.getIssues = (options2) => {
+ const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
+ const view = context.map().extent();
+ let seen = /* @__PURE__ */ new Set();
+ let results = [];
+ if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
+ Object.values(_headCache.issuesByIssueID).forEach((issue) => {
+ const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
+ if (opts.what === "edited" && !userModified)
+ return;
+ if (!filter2(issue))
+ return;
+ seen.add(issue.id);
+ results.push(issue);
+ });
+ }
+ if (opts.what === "all") {
+ Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
+ if (!filter2(issue))
+ return;
+ seen.add(issue.id);
+ results.push(issue);
+ });
+ }
+ return results;
+ function filter2(issue) {
+ if (!issue)
+ return false;
+ if (seen.has(issue.id))
+ return false;
+ if (_resolvedIssueIDs.has(issue.id))
+ return false;
+ if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
+ return false;
+ if (!opts.includeDisabledRules && _disabledRules[issue.type])
+ return false;
+ if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
+ return false;
+ if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
+ return false;
+ if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
+ return false;
+ if (opts.where === "visible") {
+ const extent = issue.extent(context.graph());
+ if (!view.intersects(extent))
+ return false;
+ }
+ return true;
+ }
};
-
- mode.behavior = behavior;
-
- return mode;
-};
-iD.modes.DrawArea = function(context, wayId, baseGraph) {
- var mode = {
- button: 'area',
- id: 'draw-area'
+ validator.getResolvedIssues = () => {
+ return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
};
-
- var behavior;
-
- mode.enter = function() {
- var way = context.entity(wayId),
- headId = way.nodes[way.nodes.length - 2],
- tailId = way.first();
-
- behavior = iD.behavior.DrawWay(context, wayId, -1, mode, baseGraph)
- .tail(t('modes.draw_area.tail'));
-
- var addNode = behavior.addNode;
-
- behavior.addNode = function(node) {
- if (node.id === headId || node.id === tailId) {
- behavior.finish();
- } else {
- addNode(node);
+ validator.focusIssue = (issue) => {
+ const graph = context.graph();
+ let selectID;
+ let focusCenter;
+ const issueExtent = issue.extent(graph);
+ if (issueExtent) {
+ focusCenter = issueExtent.center();
+ }
+ if (issue.entityIds && issue.entityIds.length) {
+ selectID = issue.entityIds[0];
+ if (selectID && selectID.charAt(0) === "r") {
+ const ids = utilEntityAndDeepMemberIDs([selectID], graph);
+ let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
+ if (!nodeID) {
+ const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
+ if (wayID) {
+ nodeID = graph.entity(wayID).first();
}
- };
-
- context.install(behavior);
- };
-
- mode.exit = function() {
- context.uninstall(behavior);
+ }
+ if (nodeID) {
+ focusCenter = graph.entity(nodeID).loc;
+ }
+ }
+ }
+ if (focusCenter) {
+ const setZoom = Math.max(context.map().zoom(), 19);
+ context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
+ }
+ if (selectID) {
+ window.setTimeout(() => {
+ context.enter(modeSelect(context, [selectID]));
+ dispatch10.call("focusedIssue", this, issue);
+ }, 250);
+ }
};
-
- mode.selectedIDs = function() {
- return [wayId];
+ validator.getIssuesBySeverity = (options2) => {
+ let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
+ groups.error = groups.error || [];
+ groups.warning = groups.warning || [];
+ return groups;
+ };
+ validator.getSharedEntityIssues = (entityIDs, options2) => {
+ const orderedIssueTypes = [
+ "missing_tag",
+ "missing_role",
+ "outdated_tags",
+ "mismatched_geometry",
+ "crossing_ways",
+ "almost_junction",
+ "disconnected_way",
+ "impossible_oneway"
+ ];
+ const allIssues = validator.getIssues(options2);
+ const forEntityIDs = new Set(entityIDs);
+ return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
+ if (issue1.type === issue2.type) {
+ return issue1.id < issue2.id ? -1 : 1;
+ }
+ const index1 = orderedIssueTypes.indexOf(issue1.type);
+ const index2 = orderedIssueTypes.indexOf(issue2.type);
+ if (index1 !== -1 && index2 !== -1) {
+ return index1 - index2;
+ } else if (index1 === -1 && index2 === -1) {
+ return issue1.type < issue2.type ? -1 : 1;
+ } else {
+ return index1 !== -1 ? -1 : 1;
+ }
+ });
};
-
- return mode;
-};
-iD.modes.DrawLine = function(context, wayId, baseGraph, affix) {
- var mode = {
- button: 'line',
- id: 'draw-line'
+ validator.getEntityIssues = (entityID, options2) => {
+ return validator.getSharedEntityIssues([entityID], options2);
};
-
- var behavior;
-
- mode.enter = function() {
- var way = context.entity(wayId),
- index = (affix === 'prefix') ? 0 : undefined,
- headId = (affix === 'prefix') ? way.first() : way.last();
-
- behavior = iD.behavior.DrawWay(context, wayId, index, mode, baseGraph)
- .tail(t('modes.draw_line.tail'));
-
- var addNode = behavior.addNode;
-
- behavior.addNode = function(node) {
- if (node.id === headId) {
- behavior.finish();
- } else {
- addNode(node);
- }
- };
-
- context.install(behavior);
+ validator.getRuleKeys = () => {
+ return Object.keys(_rules);
};
-
- mode.exit = function() {
- context.uninstall(behavior);
+ validator.isRuleEnabled = (key) => {
+ return !_disabledRules[key];
};
-
- mode.selectedIDs = function() {
- return [wayId];
+ validator.toggleRule = (key) => {
+ if (_disabledRules[key]) {
+ delete _disabledRules[key];
+ } else {
+ _disabledRules[key] = true;
+ }
+ corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
+ validator.validate();
+ };
+ validator.disableRules = (keys) => {
+ _disabledRules = {};
+ keys.forEach((k) => _disabledRules[k] = true);
+ corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
+ validator.validate();
+ };
+ validator.ignoreIssue = (issueID) => {
+ _ignoredIssueIDs.add(issueID);
+ };
+ validator.validate = () => {
+ const baseGraph = context.history().base();
+ if (!_headCache.graph)
+ _headCache.graph = baseGraph;
+ if (!_baseCache.graph)
+ _baseCache.graph = baseGraph;
+ const prevGraph = _headCache.graph;
+ const currGraph = context.graph();
+ if (currGraph === prevGraph) {
+ _headIsCurrent = true;
+ dispatch10.call("validated");
+ return Promise.resolve();
+ }
+ if (_headPromise) {
+ _headIsCurrent = false;
+ return _headPromise;
+ }
+ _headCache.graph = currGraph;
+ _completeDiff = context.history().difference().complete();
+ const incrementalDiff = coreDifference(prevGraph, currGraph);
+ let entityIDs = Object.keys(incrementalDiff.complete());
+ entityIDs = _headCache.withAllRelatedEntities(entityIDs);
+ if (!entityIDs.size) {
+ dispatch10.call("validated");
+ return Promise.resolve();
+ }
+ _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch10.call("validated")).catch(() => {
+ }).then(() => {
+ _headPromise = null;
+ if (!_headIsCurrent) {
+ validator.validate();
+ }
+ });
+ return _headPromise;
};
-
- return mode;
-};
-iD.modes.Move = function(context, entityIDs, baseGraph) {
- var mode = {
- id: 'move',
- button: 'browse'
- };
-
- var keybinding = d3.keybinding('move'),
- edit = iD.behavior.Edit(context),
- annotation = entityIDs.length === 1 ?
- t('operations.move.annotation.' + context.geometry(entityIDs[0])) :
- t('operations.move.annotation.multiple'),
- cache,
- origin,
- nudgeInterval;
-
- function vecSub(a, b) { return [a[0] - b[0], a[1] - b[1]]; }
-
- function edge(point, size) {
- var pad = [30, 100, 30, 100];
- if (point[0] > size[0] - pad[0]) return [-10, 0];
- else if (point[0] < pad[2]) return [10, 0];
- else if (point[1] > size[1] - pad[1]) return [0, -10];
- else if (point[1] < pad[3]) return [0, 10];
- return null;
- }
-
- function startNudge(nudge) {
- if (nudgeInterval) window.clearInterval(nudgeInterval);
- nudgeInterval = window.setInterval(function() {
- context.pan(nudge);
-
- var currMouse = context.mouse(),
- origMouse = context.projection(origin),
- delta = vecSub(vecSub(currMouse, origMouse), nudge),
- action = iD.actions.Move(entityIDs, delta, context.projection, cache);
-
- context.overwrite(action, annotation);
-
- }, 50);
- }
-
- function stopNudge() {
- if (nudgeInterval) window.clearInterval(nudgeInterval);
- nudgeInterval = null;
- }
-
- function move() {
- var currMouse = context.mouse(),
- origMouse = context.projection(origin),
- delta = vecSub(currMouse, origMouse),
- action = iD.actions.Move(entityIDs, delta, context.projection, cache);
-
- context.overwrite(action, annotation);
-
- var nudge = edge(currMouse, context.map().dimensions());
- if (nudge) startNudge(nudge);
- else stopNudge();
- }
-
- function finish() {
- d3.event.stopPropagation();
- context.enter(iD.modes.Select(context, entityIDs).suppressMenu(true));
- stopNudge();
- }
-
- function cancel() {
- if (baseGraph) {
- while (context.graph() !== baseGraph) context.pop();
- context.enter(iD.modes.Browse(context));
- } else {
- context.pop();
- context.enter(iD.modes.Select(context, entityIDs).suppressMenu(true));
+ context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
+ reset(false);
+ validator.validate();
+ });
+ context.on("exit.validator", validator.validate);
+ context.history().on("merge.validator", (entities) => {
+ if (!entities)
+ return;
+ const baseGraph = context.history().base();
+ if (!_headCache.graph)
+ _headCache.graph = baseGraph;
+ if (!_baseCache.graph)
+ _baseCache.graph = baseGraph;
+ let entityIDs = entities.map((entity) => entity.id);
+ entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
+ validateEntitiesAsync(entityIDs, _baseCache);
+ });
+ function validateEntity(entity, graph) {
+ let result = { issues: [], provisional: false };
+ Object.keys(_rules).forEach(runValidation);
+ return result;
+ function runValidation(key) {
+ const fn = _rules[key];
+ if (typeof fn !== "function") {
+ console.error("no such validation rule = " + key);
+ return;
+ }
+ let detected = fn(entity, graph);
+ if (detected.provisional) {
+ result.provisional = true;
+ }
+ detected = detected.filter(applySeverityOverrides);
+ result.issues = result.issues.concat(detected);
+ function applySeverityOverrides(issue) {
+ const type3 = issue.type;
+ const subtype = issue.subtype || "";
+ let i2;
+ for (i2 = 0; i2 < _errorOverrides.length; i2++) {
+ if (_errorOverrides[i2].type.test(type3) && _errorOverrides[i2].subtype.test(subtype)) {
+ issue.severity = "error";
+ return true;
+ }
+ }
+ for (i2 = 0; i2 < _warningOverrides.length; i2++) {
+ if (_warningOverrides[i2].type.test(type3) && _warningOverrides[i2].subtype.test(subtype)) {
+ issue.severity = "warning";
+ return true;
+ }
+ }
+ for (i2 = 0; i2 < _disableOverrides.length; i2++) {
+ if (_disableOverrides[i2].type.test(type3) && _disableOverrides[i2].subtype.test(subtype)) {
+ return false;
+ }
+ }
+ return true;
}
- stopNudge();
+ }
}
-
- function undone() {
- context.enter(iD.modes.Browse(context));
+ function updateResolvedIssues(entityIDs) {
+ entityIDs.forEach((entityID) => {
+ const baseIssues = _baseCache.issuesByEntityID[entityID];
+ if (!baseIssues)
+ return;
+ baseIssues.forEach((issueID) => {
+ const issue = _baseCache.issuesByIssueID[issueID];
+ const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
+ if (userModified && !_headCache.issuesByIssueID[issueID]) {
+ _resolvedIssueIDs.add(issueID);
+ } else {
+ _resolvedIssueIDs.delete(issueID);
+ }
+ });
+ });
}
-
- mode.enter = function() {
- origin = context.map().mouseCoordinates();
- cache = {};
-
- context.install(edit);
-
- context.perform(
- iD.actions.Noop(),
- annotation);
-
- context.surface()
- .on('mousemove.move', move)
- .on('click.move', finish);
-
- context.history()
- .on('undone.move', undone);
-
- keybinding
- .on('â', cancel)
- .on('â©', finish);
-
- d3.select(document)
- .call(keybinding);
+ function validateEntitiesAsync(entityIDs, cache) {
+ const jobs = Array.from(entityIDs).map((entityID) => {
+ if (cache.queuedEntityIDs.has(entityID))
+ return null;
+ cache.queuedEntityIDs.add(entityID);
+ cache.uncacheEntityID(entityID);
+ return () => {
+ cache.queuedEntityIDs.delete(entityID);
+ const graph = cache.graph;
+ if (!graph)
+ return;
+ const entity = graph.hasEntity(entityID);
+ if (!entity)
+ return;
+ const result = validateEntity(entity, graph);
+ if (result.provisional) {
+ cache.provisionalEntityIDs.add(entityID);
+ }
+ cache.cacheIssues(result.issues);
+ };
+ }).filter(Boolean);
+ cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
+ if (cache.queuePromise)
+ return cache.queuePromise;
+ cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
+ }).finally(() => cache.queuePromise = null);
+ return cache.queuePromise;
+ }
+ function revalidateProvisionalEntities(cache) {
+ if (!cache.provisionalEntityIDs.size)
+ return;
+ const handle = window.setTimeout(() => {
+ _deferredST.delete(handle);
+ if (!cache.provisionalEntityIDs.size)
+ return;
+ validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
+ }, RETRY);
+ _deferredST.add(handle);
+ }
+ function processQueue(cache) {
+ if (!cache.queue.length)
+ return Promise.resolve();
+ const chunk = cache.queue.pop();
+ return new Promise((resolvePromise, rejectPromise) => {
+ const handle = window.requestIdleCallback(() => {
+ delete _deferredRIC[handle];
+ chunk.forEach((job) => job());
+ resolvePromise();
+ });
+ _deferredRIC[handle] = rejectPromise;
+ }).then(() => {
+ if (cache.queue.length % 25 === 0)
+ dispatch10.call("validated");
+ }).then(() => processQueue(cache));
+ }
+ return validator;
+ }
+ function validationCache(which) {
+ let cache = {
+ which,
+ graph: null,
+ queue: [],
+ queuePromise: null,
+ queuedEntityIDs: /* @__PURE__ */ new Set(),
+ provisionalEntityIDs: /* @__PURE__ */ new Set(),
+ issuesByIssueID: {},
+ issuesByEntityID: {}
+ };
+ cache.cacheIssue = (issue) => {
+ (issue.entityIds || []).forEach((entityID) => {
+ if (!cache.issuesByEntityID[entityID]) {
+ cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
+ }
+ cache.issuesByEntityID[entityID].add(issue.id);
+ });
+ cache.issuesByIssueID[issue.id] = issue;
+ };
+ cache.uncacheIssue = (issue) => {
+ (issue.entityIds || []).forEach((entityID) => {
+ if (cache.issuesByEntityID[entityID]) {
+ cache.issuesByEntityID[entityID].delete(issue.id);
+ }
+ });
+ delete cache.issuesByIssueID[issue.id];
};
-
- mode.exit = function() {
- stopNudge();
-
- context.uninstall(edit);
-
- context.surface()
- .on('mousemove.move', null)
- .on('click.move', null);
-
- context.history()
- .on('undone.move', null);
-
- keybinding.off();
+ cache.cacheIssues = (issues) => {
+ issues.forEach(cache.cacheIssue);
};
-
- return mode;
-};
-iD.modes.RotateWay = function(context, wayId) {
- var mode = {
- id: 'rotate-way',
- button: 'browse'
+ cache.uncacheIssues = (issues) => {
+ issues.forEach(cache.uncacheIssue);
};
-
- var keybinding = d3.keybinding('rotate-way'),
- edit = iD.behavior.Edit(context);
-
- mode.enter = function() {
- context.install(edit);
-
- var annotation = t('operations.rotate.annotation.' + context.geometry(wayId)),
- way = context.graph().entity(wayId),
- nodes = _.uniq(context.graph().childNodes(way)),
- points = nodes.map(function(n) { return context.projection(n.loc); }),
- pivot = d3.geom.polygon(points).centroid(),
- angle;
-
- context.perform(
- iD.actions.Noop(),
- annotation);
-
- function rotate() {
-
- var mousePoint = context.mouse(),
- newAngle = Math.atan2(mousePoint[1] - pivot[1], mousePoint[0] - pivot[0]);
-
- if (typeof angle === 'undefined') angle = newAngle;
-
- context.replace(
- iD.actions.RotateWay(wayId, pivot, newAngle - angle, context.projection),
- annotation);
-
- angle = newAngle;
- }
-
- function finish() {
- d3.event.stopPropagation();
- context.enter(iD.modes.Select(context, [wayId])
- .suppressMenu(true));
- }
-
- function cancel() {
- context.pop();
- context.enter(iD.modes.Select(context, [wayId])
- .suppressMenu(true));
- }
-
- function undone() {
- context.enter(iD.modes.Browse(context));
+ cache.uncacheIssuesOfType = (type3) => {
+ const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type3);
+ cache.uncacheIssues(issuesOfType);
+ };
+ cache.uncacheEntityID = (entityID) => {
+ const entityIssueIDs = cache.issuesByEntityID[entityID];
+ if (entityIssueIDs) {
+ entityIssueIDs.forEach((issueID) => {
+ const issue = cache.issuesByIssueID[issueID];
+ if (issue) {
+ cache.uncacheIssue(issue);
+ } else {
+ delete cache.issuesByIssueID[issueID];
+ }
+ });
+ }
+ delete cache.issuesByEntityID[entityID];
+ cache.provisionalEntityIDs.delete(entityID);
+ };
+ cache.withAllRelatedEntities = (entityIDs) => {
+ let result = /* @__PURE__ */ new Set();
+ (entityIDs || []).forEach((entityID) => {
+ result.add(entityID);
+ const entityIssueIDs = cache.issuesByEntityID[entityID];
+ if (entityIssueIDs) {
+ entityIssueIDs.forEach((issueID) => {
+ const issue = cache.issuesByIssueID[issueID];
+ if (issue) {
+ (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
+ } else {
+ delete cache.issuesByIssueID[issueID];
+ }
+ });
}
-
- context.surface()
- .on('mousemove.rotate-way', rotate)
- .on('click.rotate-way', finish);
-
- context.history()
- .on('undone.rotate-way', undone);
-
- keybinding
- .on('â', cancel)
- .on('â©', finish);
-
- d3.select(document)
- .call(keybinding);
+ });
+ return result;
};
+ return cache;
+ }
- mode.exit = function() {
- context.uninstall(edit);
-
- context.surface()
- .on('mousemove.rotate-way', null)
- .on('click.rotate-way', null);
-
- context.history()
- .on('undone.rotate-way', null);
-
- keybinding.off();
+ // modules/core/uploader.js
+ function coreUploader(context) {
+ var dispatch10 = dispatch_default("saveStarted", "saveEnded", "willAttemptUpload", "progressChanged", "resultNoChanges", "resultErrors", "resultConflicts", "resultSuccess");
+ var _isSaving = false;
+ var _conflicts = [];
+ var _errors = [];
+ var _origChanges;
+ var _discardTags = {};
+ _mainFileFetcher.get("discarded").then(function(d) {
+ _discardTags = d;
+ }).catch(function() {
+ });
+ var uploader = utilRebind({}, dispatch10, "on");
+ uploader.isSaving = function() {
+ return _isSaving;
};
-
- return mode;
-};
-iD.modes.Save = function(context) {
- var ui = iD.ui.Commit(context)
- .on('cancel', cancel)
- .on('save', save);
-
- function cancel() {
- context.enter(iD.modes.Browse(context));
- }
-
- function save(e, tryAgain) {
- function withChildNodes(ids, graph) {
- return _.uniq(_.reduce(ids, function(result, id) {
- var e = graph.entity(id);
- if (e.type === 'way') {
- try {
- var cn = graph.childNodes(e);
- result.push.apply(result, _.map(_.filter(cn, 'version'), 'id'));
- } catch(err) {
- /* eslint-disable no-console */
- if (typeof console !== 'undefined') console.error(err);
- /* eslint-enable no-console */
- }
- }
- return result;
- }, _.clone(ids)));
- }
-
- var loading = iD.ui.Loading(context).message(t('save.uploading')).blocking(true),
- history = context.history(),
- origChanges = history.changes(iD.actions.DiscardTags(history.difference())),
- localGraph = context.graph(),
- remoteGraph = iD.Graph(history.base(), true),
- modified = _.filter(history.difference().summary(), {changeType: 'modified'}),
- toCheck = _.map(_.map(modified, 'entity'), 'id'),
- toLoad = withChildNodes(toCheck, localGraph),
- conflicts = [],
- errors = [];
-
- if (!tryAgain) history.perform(iD.actions.Noop()); // checkpoint
- context.container().call(loading);
-
- if (toCheck.length) {
- context.connection().loadMultiple(toLoad, loaded);
- } else {
- finalize();
+ uploader.save = function(changeset, tryAgain, checkConflicts) {
+ if (_isSaving && !tryAgain) {
+ return;
+ }
+ var osm = context.connection();
+ if (!osm)
+ return;
+ if (!osm.authenticated()) {
+ osm.authenticate(function(err) {
+ if (!err) {
+ uploader.save(changeset, tryAgain, checkConflicts);
+ }
+ });
+ return;
+ }
+ if (!_isSaving) {
+ _isSaving = true;
+ dispatch10.call("saveStarted", this);
+ }
+ var history = context.history();
+ _conflicts = [];
+ _errors = [];
+ _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
+ if (!tryAgain) {
+ history.perform(actionNoop());
+ }
+ if (!checkConflicts) {
+ upload(changeset);
+ } else {
+ performFullConflictCheck(changeset);
+ }
+ };
+ function performFullConflictCheck(changeset) {
+ var osm = context.connection();
+ if (!osm)
+ return;
+ var history = context.history();
+ var localGraph = context.graph();
+ var remoteGraph = coreGraph(history.base(), true);
+ var summary = history.difference().summary();
+ var _toCheck = [];
+ for (var i2 = 0; i2 < summary.length; i2++) {
+ var item = summary[i2];
+ if (item.changeType === "modified") {
+ _toCheck.push(item.entity.id);
}
-
-
- // Reload modified entities into an alternate graph and check for conflicts..
- function loaded(err, result) {
- if (errors.length) return;
-
- if (err) {
- errors.push({
- msg: err.responseText,
- details: [ t('save.status_code', { code: err.status }) ]
- });
- showErrors();
-
- } else {
- var loadMore = [];
- _.each(result.data, function(entity) {
- remoteGraph.replace(entity);
- toLoad = _.without(toLoad, entity.id);
-
- // Because loadMultiple doesn't download /full like loadEntity,
- // need to also load children that aren't already being checked..
- if (!entity.visible) return;
- if (entity.type === 'way') {
- loadMore.push.apply(loadMore,
- _.difference(entity.nodes, toCheck, toLoad, loadMore));
- } else if (entity.type === 'relation' && entity.isMultipolygon()) {
- loadMore.push.apply(loadMore,
- _.difference(_.map(entity.members, 'id'), toCheck, toLoad, loadMore));
- }
- });
-
- if (loadMore.length) {
- toLoad.push.apply(toLoad, loadMore);
- context.connection().loadMultiple(loadMore, loaded);
+ }
+ var _toLoad = withChildNodes(_toCheck, localGraph);
+ var _loaded = {};
+ var _toLoadCount = 0;
+ var _toLoadTotal = _toLoad.length;
+ if (_toCheck.length) {
+ dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
+ _toLoad.forEach(function(id2) {
+ _loaded[id2] = false;
+ });
+ osm.loadMultiple(_toLoad, loaded);
+ } else {
+ upload(changeset);
+ }
+ return;
+ function withChildNodes(ids, graph) {
+ var s = new Set(ids);
+ ids.forEach(function(id2) {
+ var entity = graph.entity(id2);
+ if (entity.type !== "way")
+ return;
+ graph.childNodes(entity).forEach(function(child) {
+ if (child.version !== void 0) {
+ s.add(child.id);
+ }
+ });
+ });
+ return Array.from(s);
+ }
+ function loaded(err, result) {
+ if (_errors.length)
+ return;
+ if (err) {
+ _errors.push({
+ msg: err.message || err.responseText,
+ details: [_t("save.status_code", { code: err.status })]
+ });
+ didResultInErrors();
+ } else {
+ var loadMore = [];
+ result.data.forEach(function(entity) {
+ remoteGraph.replace(entity);
+ _loaded[entity.id] = true;
+ _toLoad = _toLoad.filter(function(val) {
+ return val !== entity.id;
+ });
+ if (!entity.visible)
+ return;
+ var i3, id2;
+ if (entity.type === "way") {
+ for (i3 = 0; i3 < entity.nodes.length; i3++) {
+ id2 = entity.nodes[i3];
+ if (_loaded[id2] === void 0) {
+ _loaded[id2] = false;
+ loadMore.push(id2);
}
-
- if (!toLoad.length) {
- checkConflicts();
+ }
+ } else if (entity.type === "relation" && entity.isMultipolygon()) {
+ for (i3 = 0; i3 < entity.members.length; i3++) {
+ id2 = entity.members[i3].id;
+ if (_loaded[id2] === void 0) {
+ _loaded[id2] = false;
+ loadMore.push(id2);
}
+ }
}
+ });
+ _toLoadCount += result.data.length;
+ _toLoadTotal += loadMore.length;
+ dispatch10.call("progressChanged", this, _toLoadCount, _toLoadTotal);
+ if (loadMore.length) {
+ _toLoad.push.apply(_toLoad, loadMore);
+ osm.loadMultiple(loadMore, loaded);
+ }
+ if (!_toLoad.length) {
+ detectConflicts();
+ upload(changeset);
+ }
}
-
-
- function checkConflicts() {
- function choice(id, text, action) {
- return { id: id, text: text, action: function() { history.replace(action); } };
- }
- function formatUser(d) {
- return '' + d + '';
- }
- function entityName(entity) {
- return iD.util.displayName(entity) || (iD.util.displayType(entity.id) + ' ' + entity.id);
- }
-
- function compareVersions(local, remote) {
- if (local.version !== remote.version) return false;
-
- if (local.type === 'way') {
- var children = _.union(local.nodes, remote.nodes);
-
- for (var i = 0; i < children.length; i++) {
- var a = localGraph.hasEntity(children[i]),
- b = remoteGraph.hasEntity(children[i]);
-
- if (a && b && a.version !== b.version) return false;
- }
- }
-
- return true;
+ }
+ function detectConflicts() {
+ function choice(id2, text2, action) {
+ return {
+ id: id2,
+ text: text2,
+ action: function() {
+ history.replace(action);
}
-
- _.each(toCheck, function(id) {
- var local = localGraph.entity(id),
- remote = remoteGraph.entity(id);
-
- if (compareVersions(local, remote)) return;
-
- var action = iD.actions.MergeRemoteChanges,
- merge = action(id, localGraph, remoteGraph, formatUser);
-
- history.replace(merge);
-
- var mergeConflicts = merge.conflicts();
- if (!mergeConflicts.length) return; // merged safely
-
- var forceLocal = action(id, localGraph, remoteGraph).withOption('force_local'),
- forceRemote = action(id, localGraph, remoteGraph).withOption('force_remote'),
- keepMine = t('save.conflict.' + (remote.visible ? 'keep_local' : 'restore')),
- keepTheirs = t('save.conflict.' + (remote.visible ? 'keep_remote' : 'delete'));
-
- conflicts.push({
- id: id,
- name: entityName(local),
- details: mergeConflicts,
- chosen: 1,
- choices: [
- choice(id, keepMine, forceLocal),
- choice(id, keepTheirs, forceRemote)
- ]
- });
- });
-
- finalize();
+ };
}
-
-
- function finalize() {
- if (conflicts.length) {
- conflicts.sort(function(a,b) { return b.id.localeCompare(a.id); });
- showConflicts();
- } else if (errors.length) {
- showErrors();
- } else {
- var changes = history.changes(iD.actions.DiscardTags(history.difference()));
- if (changes.modified.length || changes.created.length || changes.deleted.length) {
- context.connection().putChangeset(
- changes,
- e.comment,
- history.imageryUsed(),
- function(err, changeset_id) {
- if (err) {
- errors.push({
- msg: err.responseText,
- details: [ t('save.status_code', { code: err.status }) ]
- });
- showErrors();
- } else {
- history.clearSaved();
- success(e, changeset_id);
- // Add delay to allow for postgres replication #1646 #2678
- window.setTimeout(function() {
- loading.close();
- context.flush();
- }, 2500);
- }
- });
- } else { // changes were insignificant or reverted by user
- loading.close();
- context.flush();
- cancel();
- }
+ function formatUser(d) {
+ return '' + escape_default(d) + "";
+ }
+ function entityName(entity) {
+ return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
+ }
+ function sameVersions(local, remote) {
+ if (local.version !== remote.version)
+ return false;
+ if (local.type === "way") {
+ var children2 = utilArrayUnion(local.nodes, remote.nodes);
+ for (var i3 = 0; i3 < children2.length; i3++) {
+ var a = localGraph.hasEntity(children2[i3]);
+ var b = remoteGraph.hasEntity(children2[i3]);
+ if (a && b && a.version !== b.version)
+ return false;
}
+ }
+ return true;
}
-
-
- function showConflicts() {
- var selection = context.container()
- .select('#sidebar')
- .append('div')
- .attr('class','sidebar-component');
-
- loading.close();
-
- selection.call(iD.ui.Conflicts(context)
- .list(conflicts)
- .on('download', function() {
- var data = JXON.stringify(context.connection().osmChangeJXON('CHANGEME', origChanges)),
- win = window.open('data:text/xml,' + encodeURIComponent(data), '_blank');
- win.focus();
- })
- .on('cancel', function() {
- history.pop();
- selection.remove();
- })
- .on('save', function() {
- for (var i = 0; i < conflicts.length; i++) {
- if (conflicts[i].chosen === 1) { // user chose "keep theirs"
- var entity = context.hasEntity(conflicts[i].id);
- if (entity && entity.type === 'way') {
- var children = _.uniq(entity.nodes);
- for (var j = 0; j < children.length; j++) {
- history.replace(iD.actions.Revert(children[j]));
- }
- }
- history.replace(iD.actions.Revert(conflicts[i].id));
- }
- }
-
- selection.remove();
- save(e, true);
- })
- );
+ _toCheck.forEach(function(id2) {
+ var local = localGraph.entity(id2);
+ var remote = remoteGraph.entity(id2);
+ if (sameVersions(local, remote))
+ return;
+ var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
+ history.replace(merge3);
+ var mergeConflicts = merge3.conflicts();
+ if (!mergeConflicts.length)
+ return;
+ var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
+ var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
+ var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
+ var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
+ _conflicts.push({
+ id: id2,
+ name: entityName(local),
+ details: mergeConflicts,
+ chosen: 1,
+ choices: [
+ choice(id2, keepMine, forceLocal),
+ choice(id2, keepTheirs, forceRemote)
+ ]
+ });
+ });
+ }
+ }
+ function upload(changeset) {
+ var osm = context.connection();
+ if (!osm) {
+ _errors.push({ msg: "No OSM Service" });
+ }
+ if (_conflicts.length) {
+ didResultInConflicts(changeset);
+ } else if (_errors.length) {
+ didResultInErrors();
+ } else {
+ var history = context.history();
+ var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
+ if (changes.modified.length || changes.created.length || changes.deleted.length) {
+ dispatch10.call("willAttemptUpload", this);
+ osm.putChangeset(changeset, changes, uploadCallback);
+ } else {
+ didResultInNoChanges();
}
-
-
- function showErrors() {
- var selection = iD.ui.confirm(context.container());
-
- history.pop();
- loading.close();
-
- selection
- .select('.modal-section.header')
- .append('h3')
- .text(t('save.error'));
-
- addErrors(selection, errors);
- selection.okButton();
+ }
+ }
+ function uploadCallback(err, changeset) {
+ if (err) {
+ if (err.status === 409) {
+ uploader.save(changeset, true, true);
+ } else {
+ _errors.push({
+ msg: err.message || err.responseText,
+ details: [_t("save.status_code", { code: err.status })]
+ });
+ didResultInErrors();
}
-
-
- function addErrors(selection, data) {
- var message = selection
- .select('.modal-section.message-text');
-
- var items = message
- .selectAll('.error-container')
- .data(data);
-
- var enter = items.enter()
- .append('div')
- .attr('class', 'error-container');
-
- enter
- .append('a')
- .attr('class', 'error-description')
- .attr('href', '#')
- .classed('hide-toggle', true)
- .text(function(d) { return d.msg || t('save.unknown_error_details'); })
- .on('click', function() {
- var error = d3.select(this),
- detail = d3.select(this.nextElementSibling),
- exp = error.classed('expanded');
-
- detail.style('display', exp ? 'none' : 'block');
- error.classed('expanded', !exp);
-
- d3.event.preventDefault();
- });
-
- var details = enter
- .append('div')
- .attr('class', 'error-detail-container')
- .style('display', 'none');
-
- details
- .append('ul')
- .attr('class', 'error-detail-list')
- .selectAll('li')
- .data(function(d) { return d.details || []; })
- .enter()
- .append('li')
- .attr('class', 'error-detail-item')
- .text(function(d) { return d; });
-
- items.exit()
- .remove();
+ } else {
+ didResultInSuccess(changeset);
+ }
+ }
+ function didResultInNoChanges() {
+ dispatch10.call("resultNoChanges", this);
+ endSave();
+ context.flush();
+ }
+ function didResultInErrors() {
+ context.history().pop();
+ dispatch10.call("resultErrors", this, _errors);
+ endSave();
+ }
+ function didResultInConflicts(changeset) {
+ _conflicts.sort(function(a, b) {
+ return b.id.localeCompare(a.id);
+ });
+ dispatch10.call("resultConflicts", this, changeset, _conflicts, _origChanges);
+ endSave();
+ }
+ function didResultInSuccess(changeset) {
+ context.history().clearSaved();
+ dispatch10.call("resultSuccess", this, changeset);
+ window.setTimeout(function() {
+ endSave();
+ context.flush();
+ }, 2500);
+ }
+ function endSave() {
+ _isSaving = false;
+ dispatch10.call("saveEnded", this);
+ }
+ uploader.cancelConflictResolution = function() {
+ context.history().pop();
+ };
+ uploader.processResolvedConflicts = function(changeset) {
+ var history = context.history();
+ for (var i2 = 0; i2 < _conflicts.length; i2++) {
+ if (_conflicts[i2].chosen === 1) {
+ var entity = context.hasEntity(_conflicts[i2].id);
+ if (entity && entity.type === "way") {
+ var children2 = utilArrayUniq(entity.nodes);
+ for (var j2 = 0; j2 < children2.length; j2++) {
+ history.replace(actionRevert(children2[j2]));
+ }
+ }
+ history.replace(actionRevert(_conflicts[i2].id));
}
+ }
+ uploader.save(changeset, true, false);
+ };
+ uploader.reset = function() {
+ };
+ return uploader;
+ }
+ // modules/renderer/background_source.js
+ var import_lodash2 = __toESM(require_lodash());
+
+ // modules/util/IntervalTasksQueue.js
+ var IntervalTasksQueue = class {
+ constructor(intervalInMs) {
+ this.intervalInMs = intervalInMs;
+ this.pendingHandles = [];
+ this.time = 0;
+ }
+ enqueue(task) {
+ let taskTimeout = this.time;
+ this.time += this.intervalInMs;
+ this.pendingHandles.push(setTimeout(() => {
+ this.time -= this.intervalInMs;
+ task();
+ }, taskTimeout));
+ }
+ clear() {
+ this.pendingHandles.forEach((timeoutHandle) => {
+ clearTimeout(timeoutHandle);
+ });
+ this.pendingHandles = [];
+ this.time = 0;
}
+ };
-
- function success(e, changeset_id) {
- context.enter(iD.modes.Browse(context)
- .sidebar(iD.ui.Success(context)
- .changeset({
- id: changeset_id,
- comment: e.comment
- })
- .on('cancel', function() {
- context.ui().sidebar.hide();
- })));
+ // modules/renderer/background_source.js
+ var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
+ window.matchMedia(`
+ (-webkit-min-device-pixel-ratio: 2), /* Safari */
+ (min-resolution: 2dppx), /* standard */
+ (min-resolution: 192dpi) /* fallback */
+ `).addListener(function() {
+ isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
+ });
+ function localeDateString(s) {
+ if (!s)
+ return null;
+ var options2 = { day: "numeric", month: "short", year: "numeric" };
+ var d = new Date(s);
+ if (isNaN(d.getTime()))
+ return null;
+ return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
+ }
+ function vintageRange(vintage) {
+ var s;
+ if (vintage.start || vintage.end) {
+ s = vintage.start || "?";
+ if (vintage.start !== vintage.end) {
+ s += " - " + (vintage.end || "?");
+ }
}
-
- var mode = {
- id: 'save'
+ return s;
+ }
+ function rendererBackgroundSource(data) {
+ var source = Object.assign({}, data);
+ var _offset = [0, 0];
+ var _name = source.name;
+ var _description = source.description;
+ var _best = !!source.best;
+ var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
+ source.tileSize = data.tileSize || 256;
+ source.zoomExtent = data.zoomExtent || [0, 22];
+ source.overzoom = data.overzoom !== false;
+ source.offset = function(val) {
+ if (!arguments.length)
+ return _offset;
+ _offset = val;
+ return source;
+ };
+ source.nudge = function(val, zoomlevel) {
+ _offset[0] += val[0] / Math.pow(2, zoomlevel);
+ _offset[1] += val[1] / Math.pow(2, zoomlevel);
+ return source;
+ };
+ source.name = function() {
+ var id_safe = source.id.replace(/\./g, "");
+ return _t("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
+ };
+ source.label = function() {
+ var id_safe = source.id.replace(/\./g, "");
+ return _t.html("imagery." + id_safe + ".name", { default: (0, import_lodash2.escape)(_name) });
+ };
+ source.description = function() {
+ var id_safe = source.id.replace(/\./g, "");
+ return _t.html("imagery." + id_safe + ".description", { default: (0, import_lodash2.escape)(_description) });
+ };
+ source.best = function() {
+ return _best;
+ };
+ source.area = function() {
+ if (!data.polygon)
+ return Number.MAX_VALUE;
+ var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
+ return isNaN(area) ? 0 : area;
+ };
+ source.imageryUsed = function() {
+ return _name || source.id;
+ };
+ source.template = function(val) {
+ if (!arguments.length)
+ return _template;
+ if (source.id === "custom" || source.id === "Bing") {
+ _template = val;
+ }
+ return source;
+ };
+ source.url = function(coord2) {
+ var result = _template.replace(/#.*/su, "");
+ if (result === "")
+ return result;
+ if (!source.type || source.id === "custom") {
+ if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
+ source.type = "wms";
+ source.projection = "EPSG:3857";
+ } else if (/\{(x|y)\}/.test(result)) {
+ source.type = "tms";
+ } else if (/\{u\}/.test(result)) {
+ source.type = "bing";
+ }
+ }
+ if (source.type === "wms") {
+ var tileToProjectedCoords = function(x, y, z) {
+ var zoomSize = Math.pow(2, z);
+ var lon = x / zoomSize * Math.PI * 2 - Math.PI;
+ var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zoomSize)));
+ switch (source.projection) {
+ case "EPSG:4326":
+ return {
+ x: lon * 180 / Math.PI,
+ y: lat * 180 / Math.PI
+ };
+ default:
+ var mercCoords = mercatorRaw(lon, lat);
+ return {
+ x: 2003750834e-2 / Math.PI * mercCoords[0],
+ y: 2003750834e-2 / Math.PI * mercCoords[1]
+ };
+ }
+ };
+ var tileSize = source.tileSize;
+ var projection2 = source.projection;
+ var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
+ var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
+ result = result.replace(/\{(\w+)\}/g, function(token, key) {
+ switch (key) {
+ case "width":
+ case "height":
+ return tileSize;
+ case "proj":
+ return projection2;
+ case "wkid":
+ return projection2.replace(/^EPSG:/, "");
+ case "bbox":
+ if (projection2 === "EPSG:4326" && /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
+ return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
+ } else {
+ return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
+ }
+ case "w":
+ return minXmaxY.x;
+ case "s":
+ return maxXminY.y;
+ case "n":
+ return maxXminY.x;
+ case "e":
+ return minXmaxY.y;
+ default:
+ return token;
+ }
+ });
+ } else if (source.type === "tms") {
+ result = result.replace("{x}", coord2[0]).replace("{y}", coord2[1]).replace(/\{[t-]y\}/, Math.pow(2, coord2[2]) - coord2[1] - 1).replace(/\{z(oom)?\}/, coord2[2]).replace(/\{@2x\}|\{r\}/, isRetina ? "@2x" : "");
+ } else if (source.type === "bing") {
+ result = result.replace("{u}", function() {
+ var u = "";
+ for (var zoom = coord2[2]; zoom > 0; zoom--) {
+ var b = 0;
+ var mask = 1 << zoom - 1;
+ if ((coord2[0] & mask) !== 0)
+ b++;
+ if ((coord2[1] & mask) !== 0)
+ b += 2;
+ u += b.toString();
+ }
+ return u;
+ });
+ }
+ result = result.replace(/\{switch:([^}]+)\}/, function(s, r) {
+ var subdomains = r.split(",");
+ return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
+ });
+ return result;
+ };
+ source.validZoom = function(z) {
+ return source.zoomExtent[0] <= z && (source.overzoom || source.zoomExtent[1] > z);
+ };
+ source.isLocatorOverlay = function() {
+ return source.id === "mapbox_locator_overlay";
+ };
+ source.isHidden = function() {
+ return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
+ };
+ source.copyrightNotices = function() {
+ };
+ source.getMetadata = function(center, tileCoord, callback) {
+ var vintage = {
+ start: localeDateString(source.startDate),
+ end: localeDateString(source.endDate)
+ };
+ vintage.range = vintageRange(vintage);
+ var metadata = { vintage };
+ callback(null, metadata);
+ };
+ return source;
+ }
+ rendererBackgroundSource.Bing = function(data, dispatch10) {
+ data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
+ var bing = rendererBackgroundSource(data);
+ var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
+ const strictParam = "n";
+ var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
+ var cache = {};
+ var inflight = {};
+ var providers = [];
+ var taskQueue = new IntervalTasksQueue(250);
+ var metadataLastZoom = -1;
+ json_default(url).then(function(json) {
+ let imageryResource = json.resourceSets[0].resources[0];
+ let template = imageryResource.imageUrl;
+ let subDomains = imageryResource.imageUrlSubdomains;
+ let subDomainNumbers = subDomains.map((subDomain) => {
+ return subDomain.substring(1);
+ }).join(",");
+ template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
+ if (!new URLSearchParams(template).has(strictParam)) {
+ template += `&${strictParam}=z`;
+ }
+ bing.template(template);
+ providers = imageryResource.imageryProviders.map(function(provider) {
+ return {
+ attribution: provider.attribution,
+ areas: provider.coverageAreas.map(function(area) {
+ return {
+ zoom: [area.zoomMin, area.zoomMax],
+ extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
+ };
+ })
+ };
+ });
+ dispatch10.call("change");
+ }).catch(function() {
+ });
+ bing.copyrightNotices = function(zoom, extent) {
+ zoom = Math.min(zoom, 21);
+ return providers.filter(function(provider) {
+ return provider.areas.some(function(area) {
+ return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
+ });
+ }).map(function(provider) {
+ return provider.attribution;
+ }).join(", ");
+ };
+ bing.getMetadata = function(center, tileCoord, callback) {
+ var tileID = tileCoord.slice(0, 3).join("/");
+ var zoom = Math.min(tileCoord[2], 21);
+ var centerPoint = center[1] + "," + center[0];
+ var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
+ if (inflight[tileID])
+ return;
+ if (!cache[tileID]) {
+ cache[tileID] = {};
+ }
+ if (cache[tileID] && cache[tileID].metadata) {
+ return callback(null, cache[tileID].metadata);
+ }
+ inflight[tileID] = true;
+ if (metadataLastZoom !== tileCoord[2]) {
+ metadataLastZoom = tileCoord[2];
+ taskQueue.clear();
+ }
+ taskQueue.enqueue(() => {
+ json_default(url2).then(function(result) {
+ delete inflight[tileID];
+ if (!result) {
+ throw new Error("Unknown Error");
+ }
+ var vintage = {
+ start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
+ end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
+ };
+ vintage.range = vintageRange(vintage);
+ var metadata = { vintage };
+ cache[tileID].metadata = metadata;
+ if (callback)
+ callback(null, metadata);
+ }).catch(function(err) {
+ delete inflight[tileID];
+ if (callback)
+ callback(err.message);
+ });
+ });
+ };
+ bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
+ return bing;
+ };
+ rendererBackgroundSource.Esri = function(data) {
+ if (data.template.match(/blankTile/) === null) {
+ data.template = data.template + "?blankTile=false";
+ }
+ var esri = rendererBackgroundSource(data);
+ var cache = {};
+ var inflight = {};
+ var _prevCenter;
+ esri.fetchTilemap = function(center) {
+ if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
+ return;
+ _prevCenter = center;
+ var z = 20;
+ var dummyUrl = esri.url([1, 2, 3]);
+ var x = Math.floor((center[0] + 180) / 360 * Math.pow(2, z));
+ var y = Math.floor((1 - Math.log(Math.tan(center[1] * Math.PI / 180) + 1 / Math.cos(center[1] * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, z));
+ var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z + "/" + y + "/" + x + "/8/8";
+ json_default(tilemapUrl).then(function(tilemap) {
+ if (!tilemap) {
+ throw new Error("Unknown Error");
+ }
+ var hasTiles = true;
+ for (var i2 = 0; i2 < tilemap.data.length; i2++) {
+ if (!tilemap.data[i2]) {
+ hasTiles = false;
+ break;
+ }
+ }
+ esri.zoomExtent[1] = hasTiles ? 22 : 19;
+ }).catch(function() {
+ });
+ };
+ esri.getMetadata = function(center, tileCoord, callback) {
+ if (esri.id !== "EsriWorldImagery") {
+ return callback(null, {});
+ }
+ var tileID = tileCoord.slice(0, 3).join("/");
+ var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
+ var centerPoint = center[0] + "," + center[1];
+ var unknown = _t("info_panels.background.unknown");
+ var vintage = {};
+ var metadata = {};
+ if (inflight[tileID])
+ return;
+ var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
+ url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
+ if (!cache[tileID]) {
+ cache[tileID] = {};
+ }
+ if (cache[tileID] && cache[tileID].metadata) {
+ return callback(null, cache[tileID].metadata);
+ }
+ inflight[tileID] = true;
+ json_default(url).then(function(result) {
+ delete inflight[tileID];
+ result = result.features.map((f2) => f2.attributes).filter((a) => a.MinMapLevel <= zoom && a.MaxMapLevel >= zoom)[0];
+ if (!result) {
+ throw new Error("Unknown Error");
+ } else if (result.features && result.features.length < 1) {
+ throw new Error("No Results");
+ } else if (result.error && result.error.message) {
+ throw new Error(result.error.message);
+ }
+ var captureDate = localeDateString(result.SRC_DATE2);
+ vintage = {
+ start: captureDate,
+ end: captureDate,
+ range: captureDate
+ };
+ metadata = {
+ vintage,
+ source: clean2(result.NICE_NAME),
+ description: clean2(result.NICE_DESC),
+ resolution: clean2(+parseFloat(result.SRC_RES).toFixed(4)),
+ accuracy: clean2(+parseFloat(result.SRC_ACC).toFixed(4))
+ };
+ if (isFinite(metadata.resolution)) {
+ metadata.resolution += " m";
+ }
+ if (isFinite(metadata.accuracy)) {
+ metadata.accuracy += " m";
+ }
+ cache[tileID].metadata = metadata;
+ if (callback)
+ callback(null, metadata);
+ }).catch(function(err) {
+ delete inflight[tileID];
+ if (callback)
+ callback(err.message);
+ });
+ function clean2(val) {
+ return String(val).trim() || unknown;
+ }
};
-
- mode.enter = function() {
- context.connection().authenticate(function(err) {
- if (err) {
- cancel();
- } else {
- context.ui().sidebar.show(ui);
- }
+ return esri;
+ };
+ rendererBackgroundSource.None = function() {
+ var source = rendererBackgroundSource({ id: "none", template: "" });
+ source.name = function() {
+ return _t("background.none");
+ };
+ source.label = function() {
+ return _t.html("background.none");
+ };
+ source.imageryUsed = function() {
+ return null;
+ };
+ source.area = function() {
+ return -1;
+ };
+ return source;
+ };
+ rendererBackgroundSource.Custom = function(template) {
+ var source = rendererBackgroundSource({ id: "custom", template });
+ source.name = function() {
+ return _t("background.custom");
+ };
+ source.label = function() {
+ return _t.html("background.custom");
+ };
+ source.imageryUsed = function() {
+ var cleaned = source.template();
+ if (cleaned.indexOf("?") !== -1) {
+ var parts = cleaned.split("?", 2);
+ var qs = utilStringQs(parts[1]);
+ ["access_token", "connectId", "token"].forEach(function(param) {
+ if (qs[param]) {
+ qs[param] = "{apikey}";
+ }
});
+ cleaned = parts[0] + "?" + utilQsString(qs, true);
+ }
+ cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
+ return "Custom (" + cleaned + " )";
};
-
- mode.exit = function() {
- context.ui().sidebar.hide();
+ source.area = function() {
+ return -2;
};
+ return source;
+ };
- return mode;
-};
-iD.modes.Select = function(context, selectedIDs) {
- var mode = {
- id: 'select',
- button: 'browse'
- };
-
- var keybinding = d3.keybinding('select'),
- timeout = null,
- behaviors = [
- iD.behavior.Copy(context),
- iD.behavior.Paste(context),
- iD.behavior.Breathe(context),
- iD.behavior.Hover(context),
- iD.behavior.Select(context),
- iD.behavior.Lasso(context),
- iD.modes.DragNode(context)
- .selectedIDs(selectedIDs)
- .behavior],
- inspector,
- radialMenu,
- newFeature = false,
- suppressMenu = false;
-
- var wrap = context.container()
- .select('.inspector-wrap');
-
-
- function singular() {
- if (selectedIDs.length === 1) {
- return context.hasEntity(selectedIDs[0]);
+ // modules/renderer/background.js
+ var import_which_polygon4 = __toESM(require_which_polygon());
+
+ // modules/renderer/tile_layer.js
+ function rendererTileLayer(context) {
+ var transformProp = utilPrefixCSSProperty("Transform");
+ var tiler8 = utilTiler();
+ var _tileSize = 256;
+ var _projection;
+ var _cache4 = {};
+ var _tileOrigin;
+ var _zoom;
+ var _source;
+ function tileSizeAtZoom(d, z) {
+ var EPSILON = 2e-3;
+ return _tileSize * Math.pow(2, z - d[2]) / _tileSize + EPSILON;
+ }
+ function atZoom(t, distance) {
+ var power = Math.pow(2, distance);
+ return [
+ Math.floor(t[0] * power),
+ Math.floor(t[1] * power),
+ t[2] + distance
+ ];
+ }
+ function lookUp(d) {
+ for (var up = -1; up > -d[2]; up--) {
+ var tile = atZoom(d, up);
+ if (_cache4[_source.url(tile)] !== false) {
+ return tile;
}
+ }
}
-
- function closeMenu() {
- if (radialMenu) {
- context.surface().call(radialMenu.close);
+ function uniqueBy(a, n2) {
+ var o = [];
+ var seen = {};
+ for (var i2 = 0; i2 < a.length; i2++) {
+ if (seen[a[i2][n2]] === void 0) {
+ o.push(a[i2]);
+ seen[a[i2][n2]] = true;
}
+ }
+ return o;
}
-
- function positionMenu() {
- if (suppressMenu || !radialMenu) { return; }
-
- var entity = singular();
- if (entity && context.geometry(entity.id) === 'relation') {
- suppressMenu = true;
- } else if (entity && entity.type === 'node') {
- radialMenu.center(context.projection(entity.loc));
- } else {
- var point = context.mouse(),
- viewport = iD.geo.Extent(context.projection.clipExtent()).polygon();
- if (iD.geo.pointInPolygon(point, viewport)) {
- radialMenu.center(point);
+ function addSource(d) {
+ d.push(_source.url(d));
+ return d;
+ }
+ function background(selection2) {
+ _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
+ var pixelOffset;
+ if (_source) {
+ pixelOffset = [
+ _source.offset()[0] * Math.pow(2, _zoom),
+ _source.offset()[1] * Math.pow(2, _zoom)
+ ];
+ } else {
+ pixelOffset = [0, 0];
+ }
+ var translate = [
+ _projection.translate()[0] + pixelOffset[0],
+ _projection.translate()[1] + pixelOffset[1]
+ ];
+ tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
+ _tileOrigin = [
+ _projection.scale() * Math.PI - translate[0],
+ _projection.scale() * Math.PI - translate[1]
+ ];
+ render(selection2);
+ }
+ function render(selection2) {
+ if (!_source)
+ return;
+ var requests = [];
+ var showDebug = context.getDebug("tile") && !_source.overlay;
+ if (_source.validZoom(_zoom)) {
+ tiler8.skipNullIsland(!!_source.overlay);
+ tiler8().forEach(function(d) {
+ addSource(d);
+ if (d[3] === "")
+ return;
+ if (typeof d[3] !== "string")
+ return;
+ requests.push(d);
+ if (_cache4[d[3]] === false && lookUp(d)) {
+ requests.push(addSource(lookUp(d)));
+ }
+ });
+ requests = uniqueBy(requests, 3).filter(function(r) {
+ return _cache4[r[3]] !== false;
+ });
+ }
+ function load(d3_event, d) {
+ _cache4[d[3]] = true;
+ select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
+ render(selection2);
+ }
+ function error(d3_event, d) {
+ _cache4[d[3]] = false;
+ select_default2(this).on("error", null).on("load", null).remove();
+ render(selection2);
+ }
+ function imageTransform(d) {
+ var ts = _tileSize * Math.pow(2, _zoom - d[2]);
+ var scale = tileSizeAtZoom(d, _zoom);
+ return "translate(" + (d[0] * ts - _tileOrigin[0]) + "px," + (d[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
+ }
+ function tileCenter(d) {
+ var ts = _tileSize * Math.pow(2, _zoom - d[2]);
+ return [
+ d[0] * ts - _tileOrigin[0] + ts / 2,
+ d[1] * ts - _tileOrigin[1] + ts / 2
+ ];
+ }
+ function debugTransform(d) {
+ var coord2 = tileCenter(d);
+ return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
+ }
+ var dims = tiler8.size();
+ var mapCenter = [dims[0] / 2, dims[1] / 2];
+ var minDist = Math.max(dims[0], dims[1]);
+ var nearCenter;
+ requests.forEach(function(d) {
+ var c = tileCenter(d);
+ var dist = geoVecLength(c, mapCenter);
+ if (dist < minDist) {
+ minDist = dist;
+ nearCenter = d;
+ }
+ });
+ var image = selection2.selectAll("img").data(requests, function(d) {
+ return d[3];
+ });
+ image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
+ var tile = select_default2(this);
+ window.setTimeout(function() {
+ if (tile.classed("tile-removing")) {
+ tile.remove();
+ }
+ }, 300);
+ });
+ image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d) {
+ return d[3];
+ }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d) {
+ return d === nearCenter;
+ });
+ var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d) {
+ return d[3];
+ });
+ debug2.exit().remove();
+ if (showDebug) {
+ var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
+ debugEnter.append("div").attr("class", "tile-label-debug-coord");
+ debugEnter.append("div").attr("class", "tile-label-debug-vintage");
+ debug2 = debug2.merge(debugEnter);
+ debug2.style(transformProp, debugTransform);
+ debug2.selectAll(".tile-label-debug-coord").text(function(d) {
+ return d[2] + " / " + d[0] + " / " + d[1];
+ });
+ debug2.selectAll(".tile-label-debug-vintage").each(function(d) {
+ var span = select_default2(this);
+ var center = context.projection.invert(tileCenter(d));
+ _source.getMetadata(center, d, function(err, result) {
+ if (result && result.vintage && result.vintage.range) {
+ span.text(result.vintage.range);
} else {
- suppressMenu = true;
+ span.html(_t.html("info_panels.background.vintage") + ": " + _t.html("info_panels.background.unknown"));
}
- }
+ });
+ });
+ }
}
+ background.projection = function(val) {
+ if (!arguments.length)
+ return _projection;
+ _projection = val;
+ return background;
+ };
+ background.dimensions = function(val) {
+ if (!arguments.length)
+ return tiler8.size();
+ tiler8.size(val);
+ return background;
+ };
+ background.source = function(val) {
+ if (!arguments.length)
+ return _source;
+ _source = val;
+ _tileSize = _source.tileSize;
+ _cache4 = {};
+ tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
+ return background;
+ };
+ return background;
+ }
- function showMenu() {
- closeMenu();
- if (!suppressMenu && radialMenu) {
- context.surface().call(radialMenu);
- }
+ // modules/renderer/background.js
+ var _imageryIndex = null;
+ function rendererBackground(context) {
+ const dispatch10 = dispatch_default("change");
+ const baseLayer = rendererTileLayer(context).projection(context.projection);
+ let _checkedBlocklists = [];
+ let _isValid = true;
+ let _overlayLayers = [];
+ let _brightness = 1;
+ let _contrast = 1;
+ let _saturation = 1;
+ let _sharpness = 1;
+ function ensureImageryIndex() {
+ return _mainFileFetcher.get("imagery").then((sources) => {
+ if (_imageryIndex)
+ return _imageryIndex;
+ _imageryIndex = {
+ imagery: sources,
+ features: {}
+ };
+ const features2 = sources.map((source) => {
+ if (!source.polygon)
+ return null;
+ const rings = source.polygon.map((ring) => [ring]);
+ const feature3 = {
+ type: "Feature",
+ properties: { id: source.id },
+ geometry: { type: "MultiPolygon", coordinates: rings }
+ };
+ _imageryIndex.features[source.id] = feature3;
+ return feature3;
+ }).filter(Boolean);
+ _imageryIndex.query = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: features2 });
+ _imageryIndex.backgrounds = sources.map((source) => {
+ if (source.type === "bing") {
+ return rendererBackgroundSource.Bing(source, dispatch10);
+ } else if (/^EsriWorldImagery/.test(source.id)) {
+ return rendererBackgroundSource.Esri(source);
+ } else {
+ return rendererBackgroundSource(source);
+ }
+ });
+ _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
+ let template = corePreferences("background-custom-template") || "";
+ const custom = rendererBackgroundSource.Custom(template);
+ _imageryIndex.backgrounds.unshift(custom);
+ return _imageryIndex;
+ });
}
-
- function toggleMenu() {
- if (d3.select('.radial-menu').empty()) {
- showMenu();
- } else {
- closeMenu();
+ function background(selection2) {
+ const currSource = baseLayer.source();
+ if (context.map().zoom() > 18) {
+ if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
+ const center = context.map().center();
+ currSource.fetchTilemap(center);
}
+ }
+ const sources = background.sources(context.map().extent());
+ const wasValid = _isValid;
+ _isValid = !!sources.filter((d) => d === currSource).length;
+ if (wasValid !== _isValid) {
+ background.updateImagery();
+ }
+ let baseFilter = "";
+ if (_brightness !== 1) {
+ baseFilter += ` brightness(${_brightness})`;
+ }
+ if (_contrast !== 1) {
+ baseFilter += ` contrast(${_contrast})`;
+ }
+ if (_saturation !== 1) {
+ baseFilter += ` saturate(${_saturation})`;
+ }
+ if (_sharpness < 1) {
+ const blur = number_default(0.5, 5)(1 - _sharpness);
+ baseFilter += ` blur(${blur}px)`;
+ }
+ let base = selection2.selectAll(".layer-background").data([0]);
+ base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
+ base.style("filter", baseFilter || null);
+ let imagery = base.selectAll(".layer-imagery").data([0]);
+ imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
+ let maskFilter = "";
+ let mixBlendMode = "";
+ if (_sharpness > 1) {
+ mixBlendMode = "overlay";
+ maskFilter = "saturate(0) blur(3px) invert(1)";
+ let contrast = _sharpness - 1;
+ maskFilter += ` contrast(${contrast})`;
+ let brightness = number_default(1, 0.85)(_sharpness - 1);
+ maskFilter += ` brightness(${brightness})`;
+ }
+ let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
+ mask.exit().remove();
+ mask.enter().append("div").attr("class", "layer layer-mask layer-unsharp-mask").merge(mask).call(baseLayer).style("filter", maskFilter || null).style("mix-blend-mode", mixBlendMode || null);
+ let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d) => d.source().name());
+ overlays.exit().remove();
+ overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i2, nodes) => select_default2(nodes[i2]).call(layer));
}
-
- mode.selectedIDs = function() {
- return selectedIDs;
- };
-
- mode.reselect = function() {
- var surfaceNode = context.surface().node();
- if (surfaceNode.focus) { // FF doesn't support it
- surfaceNode.focus();
+ background.updateImagery = function() {
+ let currSource = baseLayer.source();
+ if (context.inIntro() || !currSource)
+ return;
+ let o = _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).map((d) => d.source().id).join(",");
+ const meters = geoOffsetToMeters(currSource.offset());
+ const EPSILON = 0.01;
+ const x = +meters[0].toFixed(2);
+ const y = +meters[1].toFixed(2);
+ let hash = utilStringQs(window.location.hash);
+ let id2 = currSource.id;
+ if (id2 === "custom") {
+ id2 = `custom:${currSource.template()}`;
+ }
+ if (id2) {
+ hash.background = id2;
+ } else {
+ delete hash.background;
+ }
+ if (o) {
+ hash.overlays = o;
+ } else {
+ delete hash.overlays;
+ }
+ if (Math.abs(x) > EPSILON || Math.abs(y) > EPSILON) {
+ hash.offset = `${x},${y}`;
+ } else {
+ delete hash.offset;
+ }
+ if (!window.mocha) {
+ window.location.replace("#" + utilQsString(hash, true));
+ }
+ let imageryUsed = [];
+ let photoOverlaysUsed = [];
+ const currUsed = currSource.imageryUsed();
+ if (currUsed && _isValid) {
+ imageryUsed.push(currUsed);
+ }
+ _overlayLayers.filter((d) => !d.source().isLocatorOverlay() && !d.source().isHidden()).forEach((d) => imageryUsed.push(d.source().imageryUsed()));
+ const dataLayer = context.layers().layer("data");
+ if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
+ imageryUsed.push(dataLayer.getSrc());
+ }
+ const photoOverlayLayers = {
+ streetside: "Bing Streetside",
+ mapillary: "Mapillary Images",
+ "mapillary-map-features": "Mapillary Map Features",
+ "mapillary-signs": "Mapillary Signs",
+ kartaview: "KartaView Images"
+ };
+ for (let layerID in photoOverlayLayers) {
+ const layer = context.layers().layer(layerID);
+ if (layer && layer.enabled()) {
+ photoOverlaysUsed.push(layerID);
+ imageryUsed.push(photoOverlayLayers[layerID]);
}
-
- positionMenu();
- showMenu();
+ }
+ context.history().imageryUsed(imageryUsed);
+ context.history().photoOverlaysUsed(photoOverlaysUsed);
};
-
- mode.newFeature = function(_) {
- if (!arguments.length) return newFeature;
- newFeature = _;
- return mode;
+ background.sources = (extent, zoom, includeCurrent) => {
+ if (!_imageryIndex)
+ return [];
+ let visible = {};
+ (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d) => visible[d.id] = true);
+ const currSource = baseLayer.source();
+ const osm = context.connection();
+ const blocklists = osm && osm.imageryBlocklists() || [];
+ const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
+ if (blocklistChanged) {
+ _imageryIndex.backgrounds.forEach((source) => {
+ source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
+ });
+ _checkedBlocklists = blocklists.map((regex) => String(regex));
+ }
+ return _imageryIndex.backgrounds.filter((source) => {
+ if (includeCurrent && currSource === source)
+ return true;
+ if (source.isBlocked)
+ return false;
+ if (!source.polygon)
+ return true;
+ if (zoom && zoom < 6)
+ return false;
+ return visible[source.id];
+ });
};
-
- mode.suppressMenu = function(_) {
- if (!arguments.length) return suppressMenu;
- suppressMenu = _;
- return mode;
+ background.dimensions = (val) => {
+ if (!val)
+ return;
+ baseLayer.dimensions(val);
+ _overlayLayers.forEach((layer) => layer.dimensions(val));
};
-
- mode.enter = function() {
- function update() {
- closeMenu();
- if (_.some(selectedIDs, function(id) { return !context.hasEntity(id); })) {
- // Exit mode if selected entity gets undone
- context.enter(iD.modes.Browse(context));
- }
- }
-
- function dblclick() {
- var target = d3.select(d3.event.target),
- datum = target.datum();
-
- if (datum instanceof iD.Way && !target.classed('fill')) {
- var choice = iD.geo.chooseEdge(context.childNodes(datum), context.mouse(), context.projection),
- node = iD.Node();
-
- var prev = datum.nodes[choice.index - 1],
- next = datum.nodes[choice.index];
-
- context.perform(
- iD.actions.AddMidpoint({loc: choice.loc, edge: [prev, next]}, node),
- t('operations.add.annotation.vertex'));
-
- d3.event.preventDefault();
- d3.event.stopPropagation();
- }
+ background.baseLayerSource = function(d) {
+ if (!arguments.length)
+ return baseLayer.source();
+ const osm = context.connection();
+ if (!osm)
+ return background;
+ const blocklists = osm.imageryBlocklists();
+ const template = d.template();
+ let fail = false;
+ let tested = 0;
+ let regex;
+ for (let i2 = 0; i2 < blocklists.length; i2++) {
+ regex = blocklists[i2];
+ fail = regex.test(template);
+ tested++;
+ if (fail)
+ break;
+ }
+ if (!tested) {
+ regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
+ fail = regex.test(template);
+ }
+ baseLayer.source(!fail ? d : background.findSource("none"));
+ dispatch10.call("change");
+ background.updateImagery();
+ return background;
+ };
+ background.findSource = (id2) => {
+ if (!id2 || !_imageryIndex)
+ return null;
+ return _imageryIndex.backgrounds.find((d) => d.id && d.id === id2);
+ };
+ background.bing = () => {
+ background.baseLayerSource(background.findSource("Bing"));
+ };
+ background.showsLayer = (d) => {
+ const currSource = baseLayer.source();
+ if (!d || !currSource)
+ return false;
+ return d.id === currSource.id || _overlayLayers.some((layer) => d.id === layer.source().id);
+ };
+ background.overlayLayerSources = () => {
+ return _overlayLayers.map((layer) => layer.source());
+ };
+ background.toggleOverlayLayer = (d) => {
+ let layer;
+ for (let i2 = 0; i2 < _overlayLayers.length; i2++) {
+ layer = _overlayLayers[i2];
+ if (layer.source() === d) {
+ _overlayLayers.splice(i2, 1);
+ dispatch10.call("change");
+ background.updateImagery();
+ return;
}
-
- function selectElements(drawn) {
- var entity = singular();
- if (entity && context.geometry(entity.id) === 'relation') {
- suppressMenu = true;
- return;
- }
-
- var selection = context.surface()
- .selectAll(iD.util.entityOrMemberSelector(selectedIDs, context.graph()));
-
- if (selection.empty()) {
- if (drawn) { // Exit mode if selected DOM elements have disappeared..
- context.enter(iD.modes.Browse(context));
- }
- } else {
- selection
- .classed('selected', true);
- }
+ }
+ layer = rendererTileLayer(context).source(d).projection(context.projection).dimensions(baseLayer.dimensions());
+ _overlayLayers.push(layer);
+ dispatch10.call("change");
+ background.updateImagery();
+ };
+ background.nudge = (d, zoom) => {
+ const currSource = baseLayer.source();
+ if (currSource) {
+ currSource.nudge(d, zoom);
+ dispatch10.call("change");
+ background.updateImagery();
+ }
+ return background;
+ };
+ background.offset = function(d) {
+ const currSource = baseLayer.source();
+ if (!arguments.length) {
+ return currSource && currSource.offset() || [0, 0];
+ }
+ if (currSource) {
+ currSource.offset(d);
+ dispatch10.call("change");
+ background.updateImagery();
+ }
+ return background;
+ };
+ background.brightness = function(d) {
+ if (!arguments.length)
+ return _brightness;
+ _brightness = d;
+ if (context.mode())
+ dispatch10.call("change");
+ return background;
+ };
+ background.contrast = function(d) {
+ if (!arguments.length)
+ return _contrast;
+ _contrast = d;
+ if (context.mode())
+ dispatch10.call("change");
+ return background;
+ };
+ background.saturation = function(d) {
+ if (!arguments.length)
+ return _saturation;
+ _saturation = d;
+ if (context.mode())
+ dispatch10.call("change");
+ return background;
+ };
+ background.sharpness = function(d) {
+ if (!arguments.length)
+ return _sharpness;
+ _sharpness = d;
+ if (context.mode())
+ dispatch10.call("change");
+ return background;
+ };
+ let _loadPromise;
+ background.ensureLoaded = () => {
+ if (_loadPromise)
+ return _loadPromise;
+ function parseMapParams(qmap) {
+ if (!qmap)
+ return false;
+ const params = qmap.split("/").map(Number);
+ if (params.length < 3 || params.some(isNaN))
+ return false;
+ return geoExtent([params[2], params[1]]);
+ }
+ const hash = utilStringQs(window.location.hash);
+ const requested = hash.background || hash.layer;
+ let extent = parseMapParams(hash.map);
+ return _loadPromise = ensureImageryIndex().then((imageryIndex) => {
+ const first = imageryIndex.backgrounds.length && imageryIndex.backgrounds[0];
+ let best;
+ if (!requested && extent) {
+ best = background.sources(extent).find((s) => s.best());
+ }
+ if (requested && requested.indexOf("custom:") === 0) {
+ const template = requested.replace(/^custom:/, "");
+ const custom = background.findSource("custom");
+ background.baseLayerSource(custom.template(template));
+ corePreferences("background-custom-template", template);
+ } else {
+ background.baseLayerSource(background.findSource(requested) || best || background.findSource(corePreferences("background-last-used")) || background.findSource("Bing") || first || background.findSource("none"));
}
-
- function esc() {
- if (!context.inIntro()) {
- context.enter(iD.modes.Browse(context));
- }
+ const locator = imageryIndex.backgrounds.find((d) => d.overlay && d.default);
+ if (locator) {
+ background.toggleOverlayLayer(locator);
}
-
-
- behaviors.forEach(function(behavior) {
- context.install(behavior);
- });
-
- var operations = _.without(d3.values(iD.operations), iD.operations.Delete)
- .map(function(o) { return o(selectedIDs, context); })
- .filter(function(o) { return o.available(); });
-
- operations.unshift(iD.operations.Delete(selectedIDs, context));
-
- keybinding
- .on('â', esc, true)
- .on('space', toggleMenu);
-
- operations.forEach(function(operation) {
- operation.keys.forEach(function(key) {
- keybinding.on(key, function() {
- if (!(context.inIntro() || operation.disabled())) {
- operation();
- }
- });
- });
+ const overlays = (hash.overlays || "").split(",");
+ overlays.forEach((overlay) => {
+ overlay = background.findSource(overlay);
+ if (overlay) {
+ background.toggleOverlayLayer(overlay);
+ }
});
-
- d3.select(document)
- .call(keybinding);
-
- radialMenu = iD.ui.RadialMenu(context, operations);
-
- context.ui().sidebar
- .select(singular() ? singular().id : null, newFeature);
-
- context.history()
- .on('undone.select', update)
- .on('redone.select', update);
-
- context.map()
- .on('move.select', closeMenu)
- .on('drawn.select', selectElements);
-
- selectElements();
-
- var show = d3.event && !suppressMenu;
-
- if (show) {
- positionMenu();
+ if (hash.gpx) {
+ const gpx2 = context.layers().layer("data");
+ if (gpx2) {
+ gpx2.url(hash.gpx, ".gpx");
+ }
}
-
- timeout = window.setTimeout(function() {
- if (show) {
- showMenu();
- }
-
- context.surface()
- .on('dblclick.select', dblclick);
- }, 200);
-
- if (selectedIDs.length > 1) {
- var entities = iD.ui.SelectionList(context, selectedIDs);
- context.ui().sidebar.show(entities);
+ if (hash.offset) {
+ const offset = hash.offset.replace(/;/g, ",").split(",").map((n2) => !isNaN(n2) && n2);
+ if (offset.length === 2) {
+ background.offset(geoMetersToOffset(offset));
+ }
}
+ }).catch(() => {
+ });
};
+ return utilRebind(background, dispatch10, "on");
+ }
- mode.exit = function() {
- if (timeout) window.clearTimeout(timeout);
-
- if (inspector) wrap.call(inspector.close);
-
- behaviors.forEach(function(behavior) {
- context.uninstall(behavior);
- });
-
- keybinding.off();
- closeMenu();
- radialMenu = undefined;
-
- context.history()
- .on('undone.select', null)
- .on('redone.select', null);
-
- context.surface()
- .on('dblclick.select', null)
- .selectAll('.selected')
- .classed('selected', false);
-
- context.map().on('drawn.select', null);
- context.ui().sidebar.hide();
+ // modules/renderer/features.js
+ function rendererFeatures(context) {
+ var dispatch10 = dispatch_default("change", "redraw");
+ var features2 = utilRebind({}, dispatch10, "on");
+ var _deferred2 = /* @__PURE__ */ new Set();
+ var traffic_roads = {
+ "motorway": true,
+ "motorway_link": true,
+ "trunk": true,
+ "trunk_link": true,
+ "primary": true,
+ "primary_link": true,
+ "secondary": true,
+ "secondary_link": true,
+ "tertiary": true,
+ "tertiary_link": true,
+ "residential": true,
+ "unclassified": true,
+ "living_street": true
};
-
- return mode;
-};
-iD.operations = {};
-iD.operations.Circularize = function(selectedIDs, context) {
- var entityId = selectedIDs[0],
- entity = context.entity(entityId),
- extent = entity.extent(context.graph()),
- geometry = context.geometry(entityId),
- action = iD.actions.Circularize(entityId, context.projection);
-
- var operation = function() {
- var annotation = t('operations.circularize.annotation.' + geometry);
- context.perform(action, annotation);
+ var service_roads = {
+ "service": true,
+ "road": true,
+ "track": true
};
-
- operation.available = function() {
- return selectedIDs.length === 1 &&
- entity.type === 'way' &&
- _.uniq(entity.nodes).length > 1;
+ var paths = {
+ "path": true,
+ "footway": true,
+ "cycleway": true,
+ "bridleway": true,
+ "steps": true,
+ "pedestrian": true
};
-
- operation.disabled = function() {
- var reason;
- if (extent.percentContainedIn(context.extent()) < 0.8) {
- reason = 'too_large';
- } else if (context.hasHiddenConnections(entityId)) {
- reason = 'connected_to_hidden';
+ var past_futures = {
+ "proposed": true,
+ "construction": true,
+ "abandoned": true,
+ "dismantled": true,
+ "disused": true,
+ "razed": true,
+ "demolished": true,
+ "obliterated": true
+ };
+ var _cullFactor = 1;
+ var _cache4 = {};
+ var _rules = {};
+ var _stats = {};
+ var _keys = [];
+ var _hidden = [];
+ var _forceVisible = {};
+ function update() {
+ if (!window.mocha) {
+ var hash = utilStringQs(window.location.hash);
+ var disabled = features2.disabled();
+ if (disabled.length) {
+ hash.disable_features = disabled.join(",");
+ } else {
+ delete hash.disable_features;
+ }
+ window.location.replace("#" + utilQsString(hash, true));
+ corePreferences("disabled-features", disabled.join(","));
+ }
+ _hidden = features2.hidden();
+ dispatch10.call("change");
+ dispatch10.call("redraw");
+ }
+ function defineRule(k, filter2, max3) {
+ var isEnabled = true;
+ _keys.push(k);
+ _rules[k] = {
+ filter: filter2,
+ enabled: isEnabled,
+ count: 0,
+ currentMax: max3 || Infinity,
+ defaultMax: max3 || Infinity,
+ enable: function() {
+ this.enabled = true;
+ this.currentMax = this.defaultMax;
+ },
+ disable: function() {
+ this.enabled = false;
+ this.currentMax = 0;
+ },
+ hidden: function() {
+ return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
+ },
+ autoHidden: function() {
+ return this.hidden() && this.currentMax > 0;
+ }
+ };
+ }
+ defineRule("points", function isPoint(tags, geometry) {
+ return geometry === "point";
+ }, 200);
+ defineRule("traffic_roads", function isTrafficRoad(tags) {
+ return traffic_roads[tags.highway];
+ });
+ defineRule("service_roads", function isServiceRoad(tags) {
+ return service_roads[tags.highway];
+ });
+ defineRule("paths", function isPath(tags) {
+ return paths[tags.highway];
+ });
+ defineRule("buildings", function isBuilding(tags) {
+ return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
+ }, 250);
+ defineRule("building_parts", function isBuildingPart(tags) {
+ return tags["building:part"];
+ });
+ defineRule("indoor", function isIndoor(tags) {
+ return tags.indoor;
+ });
+ defineRule("landuse", function isLanduse(tags, geometry) {
+ return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
+ });
+ defineRule("boundaries", function isBoundary(tags) {
+ return !!tags.boundary && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway] || tags.waterway || tags.railway || tags.landuse || tags.natural || tags.building || tags.power);
+ });
+ defineRule("water", function isWater(tags) {
+ return !!tags.waterway || tags.natural === "water" || tags.natural === "coastline" || tags.natural === "bay" || tags.landuse === "pond" || tags.landuse === "basin" || tags.landuse === "reservoir" || tags.landuse === "salt_pond";
+ });
+ defineRule("rail", function isRail(tags) {
+ return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
+ });
+ defineRule("pistes", function isPiste(tags) {
+ return tags["piste:type"];
+ });
+ defineRule("aerialways", function isPiste(tags) {
+ return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
+ });
+ defineRule("power", function isPower(tags) {
+ return !!tags.power;
+ });
+ defineRule("past_future", function isPastFuture(tags) {
+ if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
+ return false;
+ }
+ var strings = Object.keys(tags);
+ for (var i2 = 0; i2 < strings.length; i2++) {
+ var s = strings[i2];
+ if (past_futures[s] || past_futures[tags[s]]) {
+ return true;
}
- return action.disabled(context.graph()) || reason;
+ }
+ return false;
+ });
+ defineRule("others", function isOther(tags, geometry) {
+ return geometry === "line" || geometry === "area";
+ });
+ features2.features = function() {
+ return _rules;
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.circularize.' + disable) :
- t('operations.circularize.description.' + geometry);
+ features2.keys = function() {
+ return _keys;
};
-
- operation.id = 'circularize';
- operation.keys = [t('operations.circularize.key')];
- operation.title = t('operations.circularize.title');
-
- return operation;
-};
-iD.operations.Continue = function(selectedIDs, context) {
- var graph = context.graph(),
- entities = selectedIDs.map(function(id) { return graph.entity(id); }),
- geometries = _.extend({line: [], vertex: []},
- _.groupBy(entities, function(entity) { return entity.geometry(graph); })),
- vertex = geometries.vertex[0];
-
- function candidateWays() {
- return graph.parentWays(vertex).filter(function(parent) {
- return parent.geometry(graph) === 'line' &&
- parent.affix(vertex.id) &&
- (geometries.line.length === 0 || geometries.line[0] === parent);
+ features2.enabled = function(k) {
+ if (!arguments.length) {
+ return _keys.filter(function(k2) {
+ return _rules[k2].enabled;
});
- }
-
- var operation = function() {
- var candidate = candidateWays()[0];
- context.enter(iD.modes.DrawLine(
- context,
- candidate.id,
- context.graph(),
- candidate.affix(vertex.id)));
+ }
+ return _rules[k] && _rules[k].enabled;
};
-
- operation.available = function() {
- return geometries.vertex.length === 1 && geometries.line.length <= 1 &&
- !context.features().hasHiddenConnections(vertex, context.graph());
+ features2.disabled = function(k) {
+ if (!arguments.length) {
+ return _keys.filter(function(k2) {
+ return !_rules[k2].enabled;
+ });
+ }
+ return _rules[k] && !_rules[k].enabled;
};
-
- operation.disabled = function() {
- var candidates = candidateWays();
- if (candidates.length === 0)
- return 'not_eligible';
- if (candidates.length > 1)
- return 'multiple';
+ features2.hidden = function(k) {
+ if (!arguments.length) {
+ return _keys.filter(function(k2) {
+ return _rules[k2].hidden();
+ });
+ }
+ return _rules[k] && _rules[k].hidden();
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.continue.' + disable) :
- t('operations.continue.description');
+ features2.autoHidden = function(k) {
+ if (!arguments.length) {
+ return _keys.filter(function(k2) {
+ return _rules[k2].autoHidden();
+ });
+ }
+ return _rules[k] && _rules[k].autoHidden();
};
-
- operation.id = 'continue';
- operation.keys = [t('operations.continue.key')];
- operation.title = t('operations.continue.title');
-
- return operation;
-};
-iD.operations.Delete = function(selectedIDs, context) {
- var action = iD.actions.DeleteMultiple(selectedIDs);
-
- var operation = function() {
- var annotation,
- nextSelectedID;
-
- if (selectedIDs.length > 1) {
- annotation = t('operations.delete.annotation.multiple', {n: selectedIDs.length});
-
- } else {
- var id = selectedIDs[0],
- entity = context.entity(id),
- geometry = context.geometry(id),
- parents = context.graph().parentWays(entity),
- parent = parents[0];
-
- annotation = t('operations.delete.annotation.' + geometry);
-
- // Select the next closest node in the way.
- if (geometry === 'vertex' && parents.length === 1 && parent.nodes.length > 2) {
- var nodes = parent.nodes,
- i = nodes.indexOf(id);
-
- if (i === 0) {
- i++;
- } else if (i === nodes.length - 1) {
- i--;
- } else {
- var a = iD.geo.sphericalDistance(entity.loc, context.entity(nodes[i - 1]).loc),
- b = iD.geo.sphericalDistance(entity.loc, context.entity(nodes[i + 1]).loc);
- i = a < b ? i - 1 : i + 1;
- }
-
- nextSelectedID = nodes[i];
- }
+ features2.enable = function(k) {
+ if (_rules[k] && !_rules[k].enabled) {
+ _rules[k].enable();
+ update();
+ }
+ };
+ features2.enableAll = function() {
+ var didEnable = false;
+ for (var k in _rules) {
+ if (!_rules[k].enabled) {
+ didEnable = true;
+ _rules[k].enable();
}
-
- if (nextSelectedID && context.hasEntity(nextSelectedID)) {
- context.enter(iD.modes.Select(context, [nextSelectedID]));
- } else {
- context.enter(iD.modes.Browse(context));
+ }
+ if (didEnable)
+ update();
+ };
+ features2.disable = function(k) {
+ if (_rules[k] && _rules[k].enabled) {
+ _rules[k].disable();
+ update();
+ }
+ };
+ features2.disableAll = function() {
+ var didDisable = false;
+ for (var k in _rules) {
+ if (_rules[k].enabled) {
+ didDisable = true;
+ _rules[k].disable();
}
-
- context.perform(
- action,
- annotation);
+ }
+ if (didDisable)
+ update();
};
-
- operation.available = function() {
- return true;
+ features2.toggle = function(k) {
+ if (_rules[k]) {
+ (function(f2) {
+ return f2.enabled ? f2.disable() : f2.enable();
+ })(_rules[k]);
+ update();
+ }
};
-
- operation.disabled = function() {
- var reason;
- if (_.some(selectedIDs, context.hasHiddenConnections)) {
- reason = 'connected_to_hidden';
+ features2.resetStats = function() {
+ for (var i2 = 0; i2 < _keys.length; i2++) {
+ _rules[_keys[i2]].count = 0;
+ }
+ dispatch10.call("change");
+ };
+ features2.gatherStats = function(d, resolver, dimensions) {
+ var needsRedraw = false;
+ var types = utilArrayGroupBy(d, "type");
+ var entities = [].concat(types.relation || [], types.way || [], types.node || []);
+ var currHidden, geometry, matches, i2, j2;
+ for (i2 = 0; i2 < _keys.length; i2++) {
+ _rules[_keys[i2]].count = 0;
+ }
+ _cullFactor = dimensions[0] * dimensions[1] / 1e6;
+ for (i2 = 0; i2 < entities.length; i2++) {
+ geometry = entities[i2].geometry(resolver);
+ matches = Object.keys(features2.getMatches(entities[i2], resolver, geometry));
+ for (j2 = 0; j2 < matches.length; j2++) {
+ _rules[matches[j2]].count++;
}
- return action.disabled(context.graph()) || reason;
+ }
+ currHidden = features2.hidden();
+ if (currHidden !== _hidden) {
+ _hidden = currHidden;
+ needsRedraw = true;
+ dispatch10.call("change");
+ }
+ return needsRedraw;
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.delete.' + disable) :
- t('operations.delete.description');
+ features2.stats = function() {
+ for (var i2 = 0; i2 < _keys.length; i2++) {
+ _stats[_keys[i2]] = _rules[_keys[i2]].count;
+ }
+ return _stats;
};
-
- operation.id = 'delete';
- operation.keys = [iD.ui.cmd('ââ«'), iD.ui.cmd('ââ¦')];
- operation.title = t('operations.delete.title');
-
- return operation;
-};
-iD.operations.Disconnect = function(selectedIDs, context) {
- var vertices = _.filter(selectedIDs, function vertex(entityId) {
- return context.geometry(entityId) === 'vertex';
- });
-
- var entityId = vertices[0],
- action = iD.actions.Disconnect(entityId);
-
- if (selectedIDs.length > 1) {
- action.limitWays(_.without(selectedIDs, entityId));
- }
-
- var operation = function() {
- context.perform(action, t('operations.disconnect.annotation'));
+ features2.clear = function(d) {
+ for (var i2 = 0; i2 < d.length; i2++) {
+ features2.clearEntity(d[i2]);
+ }
};
-
- operation.available = function() {
- return vertices.length === 1;
+ features2.clearEntity = function(entity) {
+ delete _cache4[osmEntity.key(entity)];
};
-
- operation.disabled = function() {
- var reason;
- if (_.some(selectedIDs, context.hasHiddenConnections)) {
- reason = 'connected_to_hidden';
- }
- return action.disabled(context.graph()) || reason;
+ features2.reset = function() {
+ Array.from(_deferred2).forEach(function(handle) {
+ window.cancelIdleCallback(handle);
+ _deferred2.delete(handle);
+ });
+ _cache4 = {};
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.disconnect.' + disable) :
- t('operations.disconnect.description');
+ function relationShouldBeChecked(relation) {
+ return relation.tags.type === "boundary";
+ }
+ features2.getMatches = function(entity, resolver, geometry) {
+ if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
+ return {};
+ var ent = osmEntity.key(entity);
+ if (!_cache4[ent]) {
+ _cache4[ent] = {};
+ }
+ if (!_cache4[ent].matches) {
+ var matches = {};
+ var hasMatch = false;
+ for (var i2 = 0; i2 < _keys.length; i2++) {
+ if (_keys[i2] === "others") {
+ if (hasMatch)
+ continue;
+ if (entity.type === "way") {
+ var parents = features2.getParents(entity, resolver, geometry);
+ if (parents.length === 1 && parents[0].isMultipolygon() || parents.length > 0 && parents.every(function(parent) {
+ return parent.tags.type === "boundary";
+ })) {
+ var pkey = osmEntity.key(parents[0]);
+ if (_cache4[pkey] && _cache4[pkey].matches) {
+ matches = Object.assign({}, _cache4[pkey].matches);
+ continue;
+ }
+ }
+ }
+ }
+ if (_rules[_keys[i2]].filter(entity.tags, geometry)) {
+ matches[_keys[i2]] = hasMatch = true;
+ }
+ }
+ _cache4[ent].matches = matches;
+ }
+ return _cache4[ent].matches;
};
-
- operation.id = 'disconnect';
- operation.keys = [t('operations.disconnect.key')];
- operation.title = t('operations.disconnect.title');
-
- return operation;
-};
-iD.operations.Merge = function(selectedIDs, context) {
- var join = iD.actions.Join(selectedIDs),
- merge = iD.actions.Merge(selectedIDs),
- mergePolygon = iD.actions.MergePolygon(selectedIDs);
-
- var operation = function() {
- var annotation = t('operations.merge.annotation', {n: selectedIDs.length}),
- action;
-
- if (!join.disabled(context.graph())) {
- action = join;
- } else if (!merge.disabled(context.graph())) {
- action = merge;
+ features2.getParents = function(entity, resolver, geometry) {
+ if (geometry === "point")
+ return [];
+ var ent = osmEntity.key(entity);
+ if (!_cache4[ent]) {
+ _cache4[ent] = {};
+ }
+ if (!_cache4[ent].parents) {
+ var parents = [];
+ if (geometry === "vertex") {
+ parents = resolver.parentWays(entity);
} else {
- action = mergePolygon;
+ parents = resolver.parentRelations(entity);
}
-
- context.perform(action, annotation);
- context.enter(iD.modes.Select(context, selectedIDs.filter(function(id) { return context.hasEntity(id); }))
- .suppressMenu(true));
+ _cache4[ent].parents = parents;
+ }
+ return _cache4[ent].parents;
};
-
- operation.available = function() {
- return selectedIDs.length >= 2;
+ features2.isHiddenPreset = function(preset, geometry) {
+ if (!_hidden.length)
+ return false;
+ if (!preset.tags)
+ return false;
+ var test = preset.setTags({}, geometry);
+ for (var key in _rules) {
+ if (_rules[key].filter(test, geometry)) {
+ if (_hidden.indexOf(key) !== -1) {
+ return key;
+ }
+ return false;
+ }
+ }
+ return false;
};
-
- operation.disabled = function() {
- return join.disabled(context.graph()) &&
- merge.disabled(context.graph()) &&
- mergePolygon.disabled(context.graph());
+ features2.isHiddenFeature = function(entity, resolver, geometry) {
+ if (!_hidden.length)
+ return false;
+ if (!entity.version)
+ return false;
+ if (_forceVisible[entity.id])
+ return false;
+ var matches = Object.keys(features2.getMatches(entity, resolver, geometry));
+ return matches.length && matches.every(function(k) {
+ return features2.hidden(k);
+ });
};
-
- operation.tooltip = function() {
- var j = join.disabled(context.graph()),
- m = merge.disabled(context.graph()),
- p = mergePolygon.disabled(context.graph());
-
- if (j === 'restriction' && m && p)
- return t('operations.merge.restriction', {relation: context.presets().item('type/restriction').name()});
-
- if (p === 'incomplete_relation' && j && m)
- return t('operations.merge.incomplete_relation');
-
- if (j && m && p)
- return t('operations.merge.' + j);
-
- return t('operations.merge.description');
+ features2.isHiddenChild = function(entity, resolver, geometry) {
+ if (!_hidden.length)
+ return false;
+ if (!entity.version || geometry === "point")
+ return false;
+ if (_forceVisible[entity.id])
+ return false;
+ var parents = features2.getParents(entity, resolver, geometry);
+ if (!parents.length)
+ return false;
+ for (var i2 = 0; i2 < parents.length; i2++) {
+ if (!features2.isHidden(parents[i2], resolver, parents[i2].geometry(resolver))) {
+ return false;
+ }
+ }
+ return true;
};
-
- operation.id = 'merge';
- operation.keys = [t('operations.merge.key')];
- operation.title = t('operations.merge.title');
-
- return operation;
-};
-iD.operations.Move = function(selectedIDs, context) {
- var extent = selectedIDs.reduce(function(extent, id) {
- return extent.extend(context.entity(id).extent(context.graph()));
- }, iD.geo.Extent());
-
- var operation = function() {
- context.enter(iD.modes.Move(context, selectedIDs));
+ features2.hasHiddenConnections = function(entity, resolver) {
+ if (!_hidden.length)
+ return false;
+ var childNodes, connections;
+ if (entity.type === "midpoint") {
+ childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
+ connections = [];
+ } else {
+ childNodes = entity.nodes ? resolver.childNodes(entity) : [];
+ connections = features2.getParents(entity, resolver, entity.geometry(resolver));
+ }
+ connections = childNodes.reduce(function(result, e) {
+ return resolver.isShared(e) ? utilArrayUnion(result, resolver.parentWays(e)) : result;
+ }, connections);
+ return connections.some(function(e) {
+ return features2.isHidden(e, resolver, e.geometry(resolver));
+ });
};
-
- operation.available = function() {
- return selectedIDs.length > 1 ||
- context.entity(selectedIDs[0]).type !== 'node';
+ features2.isHidden = function(entity, resolver, geometry) {
+ if (!_hidden.length)
+ return false;
+ if (!entity.version)
+ return false;
+ var fn = geometry === "vertex" ? features2.isHiddenChild : features2.isHiddenFeature;
+ return fn(entity, resolver, geometry);
};
-
- operation.disabled = function() {
- var reason;
- if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) {
- reason = 'too_large';
- } else if (_.some(selectedIDs, context.hasHiddenConnections)) {
- reason = 'connected_to_hidden';
+ features2.filter = function(d, resolver) {
+ if (!_hidden.length)
+ return d;
+ var result = [];
+ for (var i2 = 0; i2 < d.length; i2++) {
+ var entity = d[i2];
+ if (!features2.isHidden(entity, resolver, entity.geometry(resolver))) {
+ result.push(entity);
}
- return iD.actions.Move(selectedIDs).disabled(context.graph()) || reason;
- };
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.move.' + disable) :
- t('operations.move.description');
+ }
+ return result;
};
-
- operation.id = 'move';
- operation.keys = [t('operations.move.key')];
- operation.title = t('operations.move.title');
-
- return operation;
-};
-iD.operations.Orthogonalize = function(selectedIDs, context) {
- var entityId = selectedIDs[0],
- entity = context.entity(entityId),
- extent = entity.extent(context.graph()),
- geometry = context.geometry(entityId),
- action = iD.actions.Orthogonalize(entityId, context.projection);
-
- var operation = function() {
- var annotation = t('operations.orthogonalize.annotation.' + geometry);
- context.perform(action, annotation);
+ features2.forceVisible = function(entityIDs) {
+ if (!arguments.length)
+ return Object.keys(_forceVisible);
+ _forceVisible = {};
+ for (var i2 = 0; i2 < entityIDs.length; i2++) {
+ _forceVisible[entityIDs[i2]] = true;
+ var entity = context.hasEntity(entityIDs[i2]);
+ if (entity && entity.type === "relation") {
+ for (var j2 in entity.members) {
+ _forceVisible[entity.members[j2].id] = true;
+ }
+ }
+ }
+ return features2;
};
-
- operation.available = function() {
- return selectedIDs.length === 1 &&
- entity.type === 'way' &&
- entity.isClosed() &&
- _.uniq(entity.nodes).length > 2;
+ features2.init = function() {
+ var storage = corePreferences("disabled-features");
+ if (storage) {
+ var storageDisabled = storage.replace(/;/g, ",").split(",");
+ storageDisabled.forEach(features2.disable);
+ }
+ var hash = utilStringQs(window.location.hash);
+ if (hash.disable_features) {
+ var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
+ hashDisabled.forEach(features2.disable);
+ }
};
+ context.history().on("merge.features", function(newEntities) {
+ if (!newEntities)
+ return;
+ var handle = window.requestIdleCallback(function() {
+ var graph = context.graph();
+ var types = utilArrayGroupBy(newEntities, "type");
+ var entities = [].concat(types.relation || [], types.way || [], types.node || []);
+ for (var i2 = 0; i2 < entities.length; i2++) {
+ var geometry = entities[i2].geometry(graph);
+ features2.getMatches(entities[i2], graph, geometry);
+ }
+ });
+ _deferred2.add(handle);
+ });
+ return features2;
+ }
- operation.disabled = function() {
- var reason;
- if (extent.percentContainedIn(context.extent()) < 0.8) {
- reason = 'too_large';
- } else if (context.hasHiddenConnections(entityId)) {
- reason = 'connected_to_hidden';
+ // modules/svg/areas.js
+ var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
+
+ // modules/svg/helpers.js
+ function svgPassiveVertex(node, graph, activeID) {
+ if (!activeID)
+ return 1;
+ if (activeID === node.id)
+ return 0;
+ var parents = graph.parentWays(node);
+ var i2, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
+ for (i2 = 0; i2 < parents.length; i2++) {
+ nodes = parents[i2].nodes;
+ isClosed = parents[i2].isClosed();
+ for (j2 = 0; j2 < nodes.length; j2++) {
+ if (nodes[j2] === node.id) {
+ ix1 = j2 - 2;
+ ix2 = j2 - 1;
+ ix3 = j2 + 1;
+ ix4 = j2 + 2;
+ if (isClosed) {
+ max3 = nodes.length - 1;
+ if (ix1 < 0)
+ ix1 = max3 + ix1;
+ if (ix2 < 0)
+ ix2 = max3 + ix2;
+ if (ix3 > max3)
+ ix3 = ix3 - max3;
+ if (ix4 > max3)
+ ix4 = ix4 - max3;
+ }
+ if (nodes[ix1] === activeID)
+ return 0;
+ else if (nodes[ix2] === activeID)
+ return 2;
+ else if (nodes[ix3] === activeID)
+ return 2;
+ else if (nodes[ix4] === activeID)
+ return 0;
+ else if (isClosed && nodes.indexOf(activeID) !== -1)
+ return 0;
+ }
+ }
+ }
+ return 1;
+ }
+ function svgMarkerSegments(projection2, graph, dt, shouldReverse, bothDirections) {
+ return function(entity) {
+ var i2 = 0;
+ var offset = dt;
+ var segments = [];
+ var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
+ var coordinates = graph.childNodes(entity).map(function(n2) {
+ return n2.loc;
+ });
+ var a, b;
+ if (shouldReverse(entity)) {
+ coordinates.reverse();
+ }
+ stream_default({
+ type: "LineString",
+ coordinates
+ }, projection2.stream(clip({
+ lineStart: function() {
+ },
+ lineEnd: function() {
+ a = null;
+ },
+ point: function(x, y) {
+ b = [x, y];
+ if (a) {
+ var span = geoVecLength(a, b) - offset;
+ if (span >= 0) {
+ var heading = geoVecAngle(a, b);
+ var dx = dt * Math.cos(heading);
+ var dy = dt * Math.sin(heading);
+ var p = [
+ a[0] + offset * Math.cos(heading),
+ a[1] + offset * Math.sin(heading)
+ ];
+ var coord2 = [a, p];
+ for (span -= dt; span >= 0; span -= dt) {
+ p = geoVecAdd(p, [dx, dy]);
+ coord2.push(p);
+ }
+ coord2.push(b);
+ var segment = "";
+ var j2;
+ for (j2 = 0; j2 < coord2.length; j2++) {
+ segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
+ }
+ segments.push({ id: entity.id, index: i2++, d: segment });
+ if (bothDirections(entity)) {
+ segment = "";
+ for (j2 = coord2.length - 1; j2 >= 0; j2--) {
+ segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
+ }
+ segments.push({ id: entity.id, index: i2++, d: segment });
+ }
+ }
+ offset = -span;
+ }
+ a = b;
}
- return action.disabled(context.graph()) || reason;
+ })));
+ return segments;
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.orthogonalize.' + disable) :
- t('operations.orthogonalize.description.' + geometry);
+ }
+ function svgPath(projection2, graph, isArea) {
+ var cache = {};
+ var padding = isArea ? 65 : 5;
+ var viewport = projection2.clipExtent();
+ var paddedExtent = [
+ [viewport[0][0] - padding, viewport[0][1] - padding],
+ [viewport[1][0] + padding, viewport[1][1] + padding]
+ ];
+ var clip = identity_default2().clipExtent(paddedExtent).stream;
+ var project = projection2.stream;
+ var path = path_default().projection({ stream: function(output) {
+ return project(clip(output));
+ } });
+ var svgpath = function(entity) {
+ if (entity.id in cache) {
+ return cache[entity.id];
+ } else {
+ return cache[entity.id] = path(entity.asGeoJSON(graph));
+ }
};
-
- operation.id = 'orthogonalize';
- operation.keys = [t('operations.orthogonalize.key')];
- operation.title = t('operations.orthogonalize.title');
-
- return operation;
-};
-iD.operations.Reverse = function(selectedIDs, context) {
- var entityId = selectedIDs[0];
-
- var operation = function() {
- context.perform(
- iD.actions.Reverse(entityId),
- t('operations.reverse.annotation'));
+ svgpath.geojson = function(d) {
+ if (d.__featurehash__ !== void 0) {
+ if (d.__featurehash__ in cache) {
+ return cache[d.__featurehash__];
+ } else {
+ return cache[d.__featurehash__] = path(d);
+ }
+ } else {
+ return path(d);
+ }
};
-
- operation.available = function() {
- return selectedIDs.length === 1 &&
- context.geometry(entityId) === 'line';
+ return svgpath;
+ }
+ function svgPointTransform(projection2) {
+ var svgpoint = function(entity) {
+ var pt = projection2(entity.loc);
+ return "translate(" + pt[0] + "," + pt[1] + ")";
};
-
- operation.disabled = function() {
- return false;
+ svgpoint.geojson = function(d) {
+ return svgpoint(d.properties.entity);
};
-
- operation.tooltip = function() {
- return t('operations.reverse.description');
+ return svgpoint;
+ }
+ function svgRelationMemberTags(graph) {
+ return function(entity) {
+ var tags = entity.tags;
+ var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
+ graph.parentRelations(entity).forEach(function(relation) {
+ var type3 = relation.tags.type;
+ if (type3 === "multipolygon" && shouldCopyMultipolygonTags || type3 === "boundary") {
+ tags = Object.assign({}, relation.tags, tags);
+ }
+ });
+ return tags;
};
+ }
+ function svgSegmentWay(way, graph, activeID) {
+ if (activeID === void 0) {
+ return graph.transient(way, "waySegments", getWaySegments);
+ } else {
+ return getWaySegments();
+ }
+ function getWaySegments() {
+ var isActiveWay = way.nodes.indexOf(activeID) !== -1;
+ var features2 = { passive: [], active: [] };
+ var start2 = {};
+ var end = {};
+ var node, type3;
+ for (var i2 = 0; i2 < way.nodes.length; i2++) {
+ node = graph.entity(way.nodes[i2]);
+ type3 = svgPassiveVertex(node, graph, activeID);
+ end = { node, type: type3 };
+ if (start2.type !== void 0) {
+ if (start2.node.id === activeID || end.node.id === activeID) {
+ } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
+ pushActive(start2, end, i2);
+ } else if (start2.type === 0 && end.type === 0) {
+ pushActive(start2, end, i2);
+ } else {
+ pushPassive(start2, end, i2);
+ }
+ }
+ start2 = end;
+ }
+ return features2;
+ function pushActive(start3, end2, index) {
+ features2.active.push({
+ type: "Feature",
+ id: way.id + "-" + index + "-nope",
+ properties: {
+ nope: true,
+ target: true,
+ entity: way,
+ nodes: [start3.node, end2.node],
+ index
+ },
+ geometry: {
+ type: "LineString",
+ coordinates: [start3.node.loc, end2.node.loc]
+ }
+ });
+ }
+ function pushPassive(start3, end2, index) {
+ features2.passive.push({
+ type: "Feature",
+ id: way.id + "-" + index,
+ properties: {
+ target: true,
+ entity: way,
+ nodes: [start3.node, end2.node],
+ index
+ },
+ geometry: {
+ type: "LineString",
+ coordinates: [start3.node.loc, end2.node.loc]
+ }
+ });
+ }
+ }
+ }
- operation.id = 'reverse';
- operation.keys = [t('operations.reverse.key')];
- operation.title = t('operations.reverse.title');
-
- return operation;
-};
-iD.operations.Rotate = function(selectedIDs, context) {
- var entityId = selectedIDs[0],
- entity = context.entity(entityId),
- extent = entity.extent(context.graph()),
- geometry = context.geometry(entityId);
-
- var operation = function() {
- context.enter(iD.modes.RotateWay(context, entityId));
+ // modules/svg/tag_classes.js
+ function svgTagClasses() {
+ var primaries = [
+ "building",
+ "highway",
+ "railway",
+ "waterway",
+ "aeroway",
+ "aerialway",
+ "piste:type",
+ "boundary",
+ "power",
+ "amenity",
+ "natural",
+ "landuse",
+ "leisure",
+ "military",
+ "place",
+ "man_made",
+ "route",
+ "attraction",
+ "building:part",
+ "indoor"
+ ];
+ var statuses = [
+ "proposed",
+ "planned",
+ "construction",
+ "disused",
+ "abandoned",
+ "dismantled",
+ "razed",
+ "demolished",
+ "obliterated",
+ "intermittent"
+ ];
+ var secondaries = [
+ "oneway",
+ "bridge",
+ "tunnel",
+ "embankment",
+ "cutting",
+ "barrier",
+ "surface",
+ "tracktype",
+ "footway",
+ "crossing",
+ "service",
+ "sport",
+ "public_transport",
+ "location",
+ "parking",
+ "golf",
+ "type",
+ "leisure",
+ "man_made",
+ "indoor",
+ "construction",
+ "proposed"
+ ];
+ var _tags = function(entity) {
+ return entity.tags;
};
-
- operation.available = function() {
- if (selectedIDs.length !== 1 || entity.type !== 'way')
- return false;
- if (geometry === 'area')
- return true;
- if (entity.isClosed() &&
- context.graph().parentRelations(entity).some(function(r) { return r.isMultipolygon(); }))
- return true;
- return false;
+ var tagClasses = function(selection2) {
+ selection2.each(function tagClassesEach(entity) {
+ var value = this.className;
+ if (value.baseVal !== void 0) {
+ value = value.baseVal;
+ }
+ var t = _tags(entity);
+ var computed = tagClasses.getClassesString(t, value);
+ if (computed !== value) {
+ select_default2(this).attr("class", computed);
+ }
+ });
};
-
- operation.disabled = function() {
- if (extent.percentContainedIn(context.extent()) < 0.8) {
- return 'too_large';
- } else if (context.hasHiddenConnections(entityId)) {
- return 'connected_to_hidden';
+ tagClasses.getClassesString = function(t, value) {
+ var primary, status;
+ var i2, j2, k, v;
+ var overrideGeometry;
+ if (/\bstroke\b/.test(value)) {
+ if (!!t.barrier && t.barrier !== "no") {
+ overrideGeometry = "line";
+ }
+ }
+ var classes = value.trim().split(/\s+/).filter(function(klass) {
+ return klass.length && !/^tag-/.test(klass);
+ }).map(function(klass) {
+ return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
+ });
+ for (i2 = 0; i2 < primaries.length; i2++) {
+ k = primaries[i2];
+ v = t[k];
+ if (!v || v === "no")
+ continue;
+ if (k === "piste:type") {
+ k = "piste";
+ } else if (k === "building:part") {
+ k = "building_part";
+ }
+ primary = k;
+ if (statuses.indexOf(v) !== -1) {
+ status = v;
+ classes.push("tag-" + k);
} else {
- return false;
+ classes.push("tag-" + k);
+ classes.push("tag-" + k + "-" + v);
+ }
+ break;
+ }
+ if (!primary) {
+ for (i2 = 0; i2 < statuses.length; i2++) {
+ for (j2 = 0; j2 < primaries.length; j2++) {
+ k = statuses[i2] + ":" + primaries[j2];
+ v = t[k];
+ if (!v || v === "no")
+ continue;
+ status = statuses[i2];
+ break;
+ }
+ }
+ }
+ if (!status) {
+ for (i2 = 0; i2 < statuses.length; i2++) {
+ k = statuses[i2];
+ v = t[k];
+ if (!v || v === "no")
+ continue;
+ if (v === "yes") {
+ status = k;
+ } else if (primary && primary === v) {
+ status = k;
+ } else if (!primary && primaries.indexOf(v) !== -1) {
+ status = k;
+ primary = v;
+ classes.push("tag-" + v);
+ }
+ if (status)
+ break;
+ }
+ }
+ if (status) {
+ classes.push("tag-status");
+ classes.push("tag-status-" + status);
+ }
+ for (i2 = 0; i2 < secondaries.length; i2++) {
+ k = secondaries[i2];
+ v = t[k];
+ if (!v || v === "no" || k === primary)
+ continue;
+ classes.push("tag-" + k);
+ classes.push("tag-" + k + "-" + v);
+ }
+ if (primary === "highway" && !osmPathHighwayTagValues[t.highway] || primary === "aeroway") {
+ var surface = t.highway === "track" ? "unpaved" : "paved";
+ for (k in t) {
+ v = t[k];
+ if (k in osmPavedTags) {
+ surface = osmPavedTags[k][v] ? "paved" : "unpaved";
+ }
+ if (k in osmSemipavedTags && !!osmSemipavedTags[k][v]) {
+ surface = "semipaved";
+ }
}
+ classes.push("tag-" + surface);
+ }
+ var qid = t.wikidata || t["flag:wikidata"] || t["brand:wikidata"] || t["network:wikidata"] || t["operator:wikidata"];
+ if (qid) {
+ classes.push("tag-wikidata");
+ }
+ return classes.join(" ").trim();
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.rotate.' + disable) :
- t('operations.rotate.description');
+ tagClasses.tags = function(val) {
+ if (!arguments.length)
+ return _tags;
+ _tags = val;
+ return tagClasses;
};
+ return tagClasses;
+ }
- operation.id = 'rotate';
- operation.keys = [t('operations.rotate.key')];
- operation.title = t('operations.rotate.title');
+ // modules/svg/tag_pattern.js
+ var patterns = {
+ amenity: {
+ grave_yard: "cemetery",
+ fountain: "water_standing"
+ },
+ landuse: {
+ cemetery: [
+ { religion: "christian", pattern: "cemetery_christian" },
+ { religion: "buddhist", pattern: "cemetery_buddhist" },
+ { religion: "muslim", pattern: "cemetery_muslim" },
+ { religion: "jewish", pattern: "cemetery_jewish" },
+ { pattern: "cemetery" }
+ ],
+ construction: "construction",
+ farmland: "farmland",
+ farmyard: "farmyard",
+ forest: [
+ { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
+ { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
+ { leaf_type: "leafless", pattern: "forest_leafless" },
+ { pattern: "forest" }
+ ],
+ grave_yard: "cemetery",
+ grass: "grass",
+ landfill: "landfill",
+ meadow: "meadow",
+ military: "construction",
+ orchard: "orchard",
+ quarry: "quarry",
+ vineyard: "vineyard"
+ },
+ leisure: {
+ horse_riding: "farmyard"
+ },
+ natural: {
+ beach: "beach",
+ grassland: "grass",
+ sand: "beach",
+ scrub: "scrub",
+ water: [
+ { water: "pond", pattern: "pond" },
+ { water: "reservoir", pattern: "water_standing" },
+ { pattern: "waves" }
+ ],
+ wetland: [
+ { wetland: "marsh", pattern: "wetland_marsh" },
+ { wetland: "swamp", pattern: "wetland_swamp" },
+ { wetland: "bog", pattern: "wetland_bog" },
+ { wetland: "reedbed", pattern: "wetland_reedbed" },
+ { pattern: "wetland" }
+ ],
+ wood: [
+ { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
+ { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
+ { leaf_type: "leafless", pattern: "forest_leafless" },
+ { pattern: "forest" }
+ ]
+ },
+ golf: {
+ green: "golf_green",
+ tee: "grass",
+ fairway: "grass",
+ rough: "scrub"
+ },
+ surface: {
+ grass: "grass",
+ sand: "beach"
+ }
+ };
+ function svgTagPattern(tags) {
+ if (tags.building && tags.building !== "no") {
+ return null;
+ }
+ for (var tag in patterns) {
+ var entityValue = tags[tag];
+ if (!entityValue)
+ continue;
+ if (typeof patterns[tag] === "string") {
+ return "pattern-" + patterns[tag];
+ } else {
+ var values = patterns[tag];
+ for (var value in values) {
+ if (entityValue !== value)
+ continue;
+ var rules = values[value];
+ if (typeof rules === "string") {
+ return "pattern-" + rules;
+ }
+ for (var ruleKey in rules) {
+ var rule = rules[ruleKey];
+ var pass = true;
+ for (var criterion in rule) {
+ if (criterion !== "pattern") {
+ var v = tags[criterion];
+ if (!v || v !== rule[criterion]) {
+ pass = false;
+ break;
+ }
+ }
+ }
+ if (pass) {
+ return "pattern-" + rule.pattern;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
- return operation;
-};
-iD.operations.Split = function(selectedIDs, context) {
- var vertices = _.filter(selectedIDs, function vertex(entityId) {
- return context.geometry(entityId) === 'vertex';
- });
+ // modules/svg/areas.js
+ function svgAreas(projection2, context) {
+ function getPatternStyle(tags) {
+ var imageID = svgTagPattern(tags);
+ if (imageID) {
+ return 'url("#ideditor-' + imageID + '")';
+ }
+ return "";
+ }
+ function drawTargets(selection2, graph, entities, filter2) {
+ var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
+ var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
+ var getPath = svgPath(projection2).geojson;
+ var activeID = context.activeID();
+ var base = context.history().base();
+ var data = { targets: [], nopes: [] };
+ entities.forEach(function(way) {
+ var features2 = svgSegmentWay(way, graph, activeID);
+ data.targets.push.apply(data.targets, features2.passive);
+ data.nopes.push.apply(data.nopes, features2.active);
+ });
+ var targetData = data.targets.filter(getPath);
+ var targets = selection2.selectAll(".area.target-allowed").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(targetData, function key(d) {
+ return d.id;
+ });
+ targets.exit().remove();
+ var segmentWasEdited = function(d) {
+ var wayID = d.properties.entity.id;
+ if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
+ return false;
+ }
+ return d.properties.nodes.some(function(n2) {
+ return !base.entities[n2.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
+ });
+ };
+ targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
+ return "way area target target-allowed " + targetClass + d.id;
+ }).classed("segment-edited", segmentWasEdited);
+ var nopeData = data.nopes.filter(getPath);
+ var nopes = selection2.selectAll(".area.target-nope").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(nopeData, function key(d) {
+ return d.id;
+ });
+ nopes.exit().remove();
+ nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
+ return "way area target target-nope " + nopeClass + d.id;
+ }).classed("segment-edited", segmentWasEdited);
+ }
+ function drawAreas(selection2, graph, entities, filter2) {
+ var path = svgPath(projection2, graph, true);
+ var areas = {};
+ var multipolygon;
+ var base = context.history().base();
+ for (var i2 = 0; i2 < entities.length; i2++) {
+ var entity = entities[i2];
+ if (entity.geometry(graph) !== "area")
+ continue;
+ multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
+ if (multipolygon) {
+ areas[multipolygon.id] = {
+ entity: multipolygon.mergeTags(entity.tags),
+ area: Math.abs(entity.area(graph))
+ };
+ } else if (!areas[entity.id]) {
+ areas[entity.id] = {
+ entity,
+ area: Math.abs(entity.area(graph))
+ };
+ }
+ }
+ var fills = Object.values(areas).filter(function hasPath(a) {
+ return path(a.entity);
+ });
+ fills.sort(function areaSort(a, b) {
+ return b.area - a.area;
+ });
+ fills = fills.map(function(a) {
+ return a.entity;
+ });
+ var strokes = fills.filter(function(area) {
+ return area.type === "way";
+ });
+ var data = {
+ clip: fills,
+ shadow: strokes,
+ stroke: strokes,
+ fill: fills
+ };
+ var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
+ clipPaths.exit().remove();
+ var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
+ return "ideditor-" + entity2.id + "-clippath";
+ });
+ clipPathsEnter.append("path");
+ clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
+ var drawLayer = selection2.selectAll(".layer-osm.areas");
+ var touchLayer = selection2.selectAll(".layer-touch.areas");
+ var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
+ areagroup = areagroup.enter().append("g").attr("class", function(d) {
+ return "areagroup area-" + d;
+ }).merge(areagroup);
+ var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
+ return data[layer];
+ }, osmEntity.key);
+ paths.exit().remove();
+ var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
+ var bisect = bisector(function(node) {
+ return -node.__data__.area(graph);
+ }).left;
+ function sortedByArea(entity2) {
+ if (this._parent.__data__ === "fill") {
+ return fillpaths[bisect(fillpaths, -entity2.area(graph))];
+ }
+ }
+ paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
+ var layer = this.parentNode.__data__;
+ this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
+ if (layer === "fill") {
+ this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
+ this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
+ }
+ }).classed("added", function(d) {
+ return !base.entities[d.id];
+ }).classed("geometry-edited", function(d) {
+ return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d.id].nodes, base.entities[d.id].nodes);
+ }).classed("retagged", function(d) {
+ return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
+ }).call(svgTagClasses()).attr("d", path);
+ touchLayer.call(drawTargets, graph, data.stroke, filter2);
+ }
+ return drawAreas;
+ }
- var entityId = vertices[0],
- action = iD.actions.Split(entityId);
+ // modules/svg/data.js
+ var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
- if (selectedIDs.length > 1) {
- action.limitWays(_.without(selectedIDs, entityId));
+ // node_modules/@tmcw/togeojson/dist/togeojson.es.js
+ function nodeVal(x) {
+ if (x && x.normalize) {
+ x.normalize();
}
-
- var operation = function() {
- var annotation;
-
- var ways = action.ways(context.graph());
- if (ways.length === 1) {
- annotation = t('operations.split.annotation.' + context.geometry(ways[0].id));
+ return x && x.textContent || "";
+ }
+ function get1(x, y) {
+ const n2 = x.getElementsByTagName(y);
+ return n2.length ? n2[0] : null;
+ }
+ function getLineStyle(extensions) {
+ const style = {};
+ if (extensions) {
+ const lineStyle = get1(extensions, "line");
+ if (lineStyle) {
+ const color2 = nodeVal(get1(lineStyle, "color")), opacity = parseFloat(nodeVal(get1(lineStyle, "opacity"))), width = parseFloat(nodeVal(get1(lineStyle, "width")));
+ if (color2)
+ style.stroke = color2;
+ if (!isNaN(opacity))
+ style["stroke-opacity"] = opacity;
+ if (!isNaN(width))
+ style["stroke-width"] = width * 96 / 25.4;
+ }
+ }
+ return style;
+ }
+ function getExtensions(node) {
+ let values = [];
+ if (node !== null) {
+ for (let i2 = 0; i2 < node.childNodes.length; i2++) {
+ const child = node.childNodes[i2];
+ if (child.nodeType !== 1)
+ continue;
+ const name2 = ["heart", "gpxtpx:hr", "hr"].includes(child.nodeName) ? "heart" : child.nodeName;
+ if (name2 === "gpxtpx:TrackPointExtension") {
+ values = values.concat(getExtensions(child));
} else {
- annotation = t('operations.split.annotation.multiple', {n: ways.length});
+ const val = nodeVal(child);
+ values.push([name2, isNaN(val) ? val : parseFloat(val)]);
}
-
- var difference = context.perform(action, annotation);
- context.enter(iD.modes.Select(context, difference.extantIDs()));
+ }
+ }
+ return values;
+ }
+ function getMulti(x, ys) {
+ const o = {};
+ let n2;
+ let k;
+ for (k = 0; k < ys.length; k++) {
+ n2 = get1(x, ys[k]);
+ if (n2)
+ o[ys[k]] = nodeVal(n2);
+ }
+ return o;
+ }
+ function getProperties$1(node) {
+ const prop = getMulti(node, [
+ "name",
+ "cmt",
+ "desc",
+ "type",
+ "time",
+ "keywords"
+ ]);
+ const extensions = node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*");
+ for (let i2 = 0; i2 < extensions.length; i2++) {
+ const extension = extensions[i2];
+ if (extension.parentNode.parentNode === node) {
+ prop[extension.tagName.replace(":", "_")] = nodeVal(extension);
+ }
+ }
+ const links = node.getElementsByTagName("link");
+ if (links.length)
+ prop.links = [];
+ for (let i2 = 0; i2 < links.length; i2++) {
+ prop.links.push(Object.assign({ href: links[i2].getAttribute("href") }, getMulti(links[i2], ["text", "type"])));
+ }
+ return prop;
+ }
+ function coordPair$1(x) {
+ const ll = [
+ parseFloat(x.getAttribute("lon")),
+ parseFloat(x.getAttribute("lat"))
+ ];
+ const ele = get1(x, "ele");
+ const time = get1(x, "time");
+ if (ele) {
+ const e = parseFloat(nodeVal(ele));
+ if (!isNaN(e)) {
+ ll.push(e);
+ }
+ }
+ return {
+ coordinates: ll,
+ time: time ? nodeVal(time) : null,
+ extendedValues: getExtensions(get1(x, "extensions"))
};
-
- operation.available = function() {
- return vertices.length === 1;
+ }
+ function getRoute(node) {
+ const line = getPoints$1(node, "rtept");
+ if (!line)
+ return;
+ return {
+ type: "Feature",
+ properties: Object.assign(getProperties$1(node), getLineStyle(get1(node, "extensions")), { _gpxType: "rte" }),
+ geometry: {
+ type: "LineString",
+ coordinates: line.line
+ }
};
-
- operation.disabled = function() {
- var reason;
- if (_.some(selectedIDs, context.hasHiddenConnections)) {
- reason = 'connected_to_hidden';
- }
- return action.disabled(context.graph()) || reason;
+ }
+ function getPoints$1(node, pointname) {
+ const pts = node.getElementsByTagName(pointname);
+ if (pts.length < 2)
+ return;
+ const line = [];
+ const times = [];
+ const extendedValues = {};
+ for (let i2 = 0; i2 < pts.length; i2++) {
+ const c = coordPair$1(pts[i2]);
+ line.push(c.coordinates);
+ if (c.time)
+ times.push(c.time);
+ for (let j2 = 0; j2 < c.extendedValues.length; j2++) {
+ const [name2, val] = c.extendedValues[j2];
+ const plural = name2 === "heart" ? name2 : name2.replace("gpxtpx:", "") + "s";
+ if (!extendedValues[plural]) {
+ extendedValues[plural] = Array(pts.length).fill(null);
+ }
+ extendedValues[plural][i2] = val;
+ }
+ }
+ return {
+ line,
+ times,
+ extendedValues
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- if (disable) {
- return t('operations.split.' + disable);
- }
-
- var ways = action.ways(context.graph());
- if (ways.length === 1) {
- return t('operations.split.description.' + context.geometry(ways[0].id));
+ }
+ function getTrack(node) {
+ const segments = node.getElementsByTagName("trkseg");
+ const track = [];
+ const times = [];
+ const extractedLines = [];
+ for (let i2 = 0; i2 < segments.length; i2++) {
+ const line = getPoints$1(segments[i2], "trkpt");
+ if (line) {
+ extractedLines.push(line);
+ if (line.times && line.times.length)
+ times.push(line.times);
+ }
+ }
+ if (extractedLines.length === 0)
+ return;
+ const multi = extractedLines.length > 1;
+ const properties = Object.assign(getProperties$1(node), getLineStyle(get1(node, "extensions")), { _gpxType: "trk" }, times.length ? {
+ coordinateProperties: {
+ times: multi ? times : times[0]
+ }
+ } : {});
+ for (let i2 = 0; i2 < extractedLines.length; i2++) {
+ const line = extractedLines[i2];
+ track.push(line.line);
+ for (const [name2, val] of Object.entries(line.extendedValues)) {
+ if (!properties.coordinateProperties) {
+ properties.coordinateProperties = {};
+ }
+ const props = properties.coordinateProperties;
+ if (multi) {
+ if (!props[name2])
+ props[name2] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
+ props[name2][i2] = val;
} else {
- return t('operations.split.description.multiple');
+ props[name2] = val;
}
+ }
+ }
+ return {
+ type: "Feature",
+ properties,
+ geometry: multi ? {
+ type: "MultiLineString",
+ coordinates: track
+ } : {
+ type: "LineString",
+ coordinates: track[0]
+ }
};
-
- operation.id = 'split';
- operation.keys = [t('operations.split.key')];
- operation.title = t('operations.split.title');
-
- return operation;
-};
-iD.operations.Straighten = function(selectedIDs, context) {
- var entityId = selectedIDs[0],
- action = iD.actions.Straighten(entityId, context.projection);
-
- function operation() {
- var annotation = t('operations.straighten.annotation');
- context.perform(action, annotation);
+ }
+ function getPoint(node) {
+ return {
+ type: "Feature",
+ properties: Object.assign(getProperties$1(node), getMulti(node, ["sym"])),
+ geometry: {
+ type: "Point",
+ coordinates: coordPair$1(node).coordinates
+ }
+ };
+ }
+ function* gpxGen(doc) {
+ const tracks = doc.getElementsByTagName("trk");
+ const routes = doc.getElementsByTagName("rte");
+ const waypoints = doc.getElementsByTagName("wpt");
+ for (let i2 = 0; i2 < tracks.length; i2++) {
+ const feature3 = getTrack(tracks[i2]);
+ if (feature3)
+ yield feature3;
+ }
+ for (let i2 = 0; i2 < routes.length; i2++) {
+ const feature3 = getRoute(routes[i2]);
+ if (feature3)
+ yield feature3;
+ }
+ for (let i2 = 0; i2 < waypoints.length; i2++) {
+ yield getPoint(waypoints[i2]);
}
-
- operation.available = function() {
- var entity = context.entity(entityId);
- return selectedIDs.length === 1 &&
- entity.type === 'way' &&
- !entity.isClosed() &&
- _.uniq(entity.nodes).length > 2;
+ }
+ function gpx(doc) {
+ return {
+ type: "FeatureCollection",
+ features: Array.from(gpxGen(doc))
};
-
- operation.disabled = function() {
- var reason;
- if (context.hasHiddenConnections(entityId)) {
- reason = 'connected_to_hidden';
+ }
+ var removeSpace = /\s*/g;
+ var trimSpace = /^\s*|\s*$/g;
+ var splitSpace = /\s+/;
+ function okhash(x) {
+ if (!x || !x.length)
+ return 0;
+ let h = 0;
+ for (let i2 = 0; i2 < x.length; i2++) {
+ h = (h << 5) - h + x.charCodeAt(i2) | 0;
+ }
+ return h;
+ }
+ function coord1(v) {
+ return v.replace(removeSpace, "").split(",").map(parseFloat);
+ }
+ function coord(v) {
+ return v.replace(trimSpace, "").split(splitSpace).map(coord1);
+ }
+ function xml2str(node) {
+ if (node.xml !== void 0)
+ return node.xml;
+ if (node.tagName) {
+ let output = node.tagName;
+ for (let i2 = 0; i2 < node.attributes.length; i2++) {
+ output += node.attributes[i2].name + node.attributes[i2].value;
+ }
+ for (let i2 = 0; i2 < node.childNodes.length; i2++) {
+ output += xml2str(node.childNodes[i2]);
+ }
+ return output;
+ }
+ if (node.nodeName === "#text") {
+ return (node.nodeValue || node.value || "").trim();
+ }
+ if (node.nodeName === "#cdata-section") {
+ return node.nodeValue;
+ }
+ return "";
+ }
+ var geotypes = ["Polygon", "LineString", "Point", "Track", "gx:Track"];
+ function kmlColor(properties, elem, prefix) {
+ let v = nodeVal(get1(elem, "color")) || "";
+ const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
+ if (v.substr(0, 1) === "#") {
+ v = v.substr(1);
+ }
+ if (v.length === 6 || v.length === 3) {
+ properties[colorProp] = v;
+ } else if (v.length === 8) {
+ properties[prefix + "-opacity"] = parseInt(v.substr(0, 2), 16) / 255;
+ properties[colorProp] = "#" + v.substr(6, 2) + v.substr(4, 2) + v.substr(2, 2);
+ }
+ }
+ function numericProperty(properties, elem, source, target) {
+ const val = parseFloat(nodeVal(get1(elem, source)));
+ if (!isNaN(val))
+ properties[target] = val;
+ }
+ function gxCoords(root3) {
+ let elems = root3.getElementsByTagName("coord");
+ const coords = [];
+ const times = [];
+ if (elems.length === 0)
+ elems = root3.getElementsByTagName("gx:coord");
+ for (let i2 = 0; i2 < elems.length; i2++) {
+ coords.push(nodeVal(elems[i2]).split(" ").map(parseFloat));
+ }
+ const timeElems = root3.getElementsByTagName("when");
+ for (let j2 = 0; j2 < timeElems.length; j2++)
+ times.push(nodeVal(timeElems[j2]));
+ return {
+ coords,
+ times
+ };
+ }
+ function getGeometry(root3) {
+ let geomNode;
+ let geomNodes;
+ let i2;
+ let j2;
+ let k;
+ const geoms = [];
+ const coordTimes = [];
+ if (get1(root3, "MultiGeometry")) {
+ return getGeometry(get1(root3, "MultiGeometry"));
+ }
+ if (get1(root3, "MultiTrack")) {
+ return getGeometry(get1(root3, "MultiTrack"));
+ }
+ if (get1(root3, "gx:MultiTrack")) {
+ return getGeometry(get1(root3, "gx:MultiTrack"));
+ }
+ for (i2 = 0; i2 < geotypes.length; i2++) {
+ geomNodes = root3.getElementsByTagName(geotypes[i2]);
+ if (geomNodes) {
+ for (j2 = 0; j2 < geomNodes.length; j2++) {
+ geomNode = geomNodes[j2];
+ if (geotypes[i2] === "Point") {
+ geoms.push({
+ type: "Point",
+ coordinates: coord1(nodeVal(get1(geomNode, "coordinates")))
+ });
+ } else if (geotypes[i2] === "LineString") {
+ geoms.push({
+ type: "LineString",
+ coordinates: coord(nodeVal(get1(geomNode, "coordinates")))
+ });
+ } else if (geotypes[i2] === "Polygon") {
+ const rings = geomNode.getElementsByTagName("LinearRing"), coords = [];
+ for (k = 0; k < rings.length; k++) {
+ coords.push(coord(nodeVal(get1(rings[k], "coordinates"))));
+ }
+ geoms.push({
+ type: "Polygon",
+ coordinates: coords
+ });
+ } else if (geotypes[i2] === "Track" || geotypes[i2] === "gx:Track") {
+ const track = gxCoords(geomNode);
+ geoms.push({
+ type: "LineString",
+ coordinates: track.coords
+ });
+ if (track.times.length)
+ coordTimes.push(track.times);
+ }
}
- return action.disabled(context.graph()) || reason;
+ }
+ }
+ return {
+ geoms,
+ coordTimes
};
-
- operation.tooltip = function() {
- var disable = operation.disabled();
- return disable ?
- t('operations.straighten.' + disable) :
- t('operations.straighten.description');
+ }
+ function getPlacemark(root3, styleIndex, styleMapIndex, styleByHash) {
+ const geomsAndTimes = getGeometry(root3);
+ let i2;
+ const properties = {};
+ const name2 = nodeVal(get1(root3, "name"));
+ const address = nodeVal(get1(root3, "address"));
+ let styleUrl = nodeVal(get1(root3, "styleUrl"));
+ const description2 = nodeVal(get1(root3, "description"));
+ const timeSpan = get1(root3, "TimeSpan");
+ const timeStamp = get1(root3, "TimeStamp");
+ const extendedData = get1(root3, "ExtendedData");
+ let iconStyle = get1(root3, "IconStyle");
+ let labelStyle = get1(root3, "LabelStyle");
+ let lineStyle = get1(root3, "LineStyle");
+ let polyStyle = get1(root3, "PolyStyle");
+ const visibility = get1(root3, "visibility");
+ if (name2)
+ properties.name = name2;
+ if (address)
+ properties.address = address;
+ if (styleUrl) {
+ if (styleUrl[0] !== "#") {
+ styleUrl = "#" + styleUrl;
+ }
+ properties.styleUrl = styleUrl;
+ if (styleIndex[styleUrl]) {
+ properties.styleHash = styleIndex[styleUrl];
+ }
+ if (styleMapIndex[styleUrl]) {
+ properties.styleMapHash = styleMapIndex[styleUrl];
+ properties.styleHash = styleIndex[styleMapIndex[styleUrl].normal];
+ }
+ const style = styleByHash[properties.styleHash];
+ if (style) {
+ if (!iconStyle)
+ iconStyle = get1(style, "IconStyle");
+ if (!labelStyle)
+ labelStyle = get1(style, "LabelStyle");
+ if (!lineStyle)
+ lineStyle = get1(style, "LineStyle");
+ if (!polyStyle)
+ polyStyle = get1(style, "PolyStyle");
+ }
+ }
+ if (description2)
+ properties.description = description2;
+ if (timeSpan) {
+ const begin = nodeVal(get1(timeSpan, "begin"));
+ const end = nodeVal(get1(timeSpan, "end"));
+ properties.timespan = { begin, end };
+ }
+ if (timeStamp) {
+ properties.timestamp = nodeVal(get1(timeStamp, "when"));
+ }
+ if (iconStyle) {
+ kmlColor(properties, iconStyle, "icon");
+ numericProperty(properties, iconStyle, "scale", "icon-scale");
+ numericProperty(properties, iconStyle, "heading", "icon-heading");
+ const hotspot = get1(iconStyle, "hotSpot");
+ if (hotspot) {
+ const left = parseFloat(hotspot.getAttribute("x"));
+ const top = parseFloat(hotspot.getAttribute("y"));
+ if (!isNaN(left) && !isNaN(top))
+ properties["icon-offset"] = [left, top];
+ }
+ const icon2 = get1(iconStyle, "Icon");
+ if (icon2) {
+ const href = nodeVal(get1(icon2, "href"));
+ if (href)
+ properties.icon = href;
+ }
+ }
+ if (labelStyle) {
+ kmlColor(properties, labelStyle, "label");
+ numericProperty(properties, labelStyle, "scale", "label-scale");
+ }
+ if (lineStyle) {
+ kmlColor(properties, lineStyle, "stroke");
+ numericProperty(properties, lineStyle, "width", "stroke-width");
+ }
+ if (polyStyle) {
+ kmlColor(properties, polyStyle, "fill");
+ const fill = nodeVal(get1(polyStyle, "fill"));
+ const outline = nodeVal(get1(polyStyle, "outline"));
+ if (fill)
+ properties["fill-opacity"] = fill === "1" ? properties["fill-opacity"] || 1 : 0;
+ if (outline)
+ properties["stroke-opacity"] = outline === "1" ? properties["stroke-opacity"] || 1 : 0;
+ }
+ if (extendedData) {
+ const datas = extendedData.getElementsByTagName("Data"), simpleDatas = extendedData.getElementsByTagName("SimpleData");
+ for (i2 = 0; i2 < datas.length; i2++) {
+ properties[datas[i2].getAttribute("name")] = nodeVal(get1(datas[i2], "value"));
+ }
+ for (i2 = 0; i2 < simpleDatas.length; i2++) {
+ properties[simpleDatas[i2].getAttribute("name")] = nodeVal(simpleDatas[i2]);
+ }
+ }
+ if (visibility) {
+ properties.visibility = nodeVal(visibility);
+ }
+ if (geomsAndTimes.coordTimes.length) {
+ properties.coordinateProperties = {
+ times: geomsAndTimes.coordTimes.length === 1 ? geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes
+ };
+ }
+ const feature3 = {
+ type: "Feature",
+ geometry: geomsAndTimes.geoms.length === 0 ? null : geomsAndTimes.geoms.length === 1 ? geomsAndTimes.geoms[0] : {
+ type: "GeometryCollection",
+ geometries: geomsAndTimes.geoms
+ },
+ properties
};
-
- operation.id = 'straighten';
- operation.keys = [t('operations.straighten.key')];
- operation.title = t('operations.straighten.title');
-
- return operation;
-};
-iD.Connection = function(useHttps) {
- if (typeof useHttps !== 'boolean') {
- useHttps = window.location.protocol === 'https:';
- }
-
- var event = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'loaded'),
- protocol = useHttps ? 'https:' : 'http:',
- url = protocol + '//www.openstreetmap.org',
- connection = {},
- inflight = {},
- loadedTiles = {},
- tileZoom = 16,
- oauth = osmAuth({
- url: protocol + '//www.openstreetmap.org',
- oauth_consumer_key: '5A043yRSEugj4DJ5TljuapfnrflWDte8jTOcWLlT',
- oauth_secret: 'aB3jKq1TRsCOUrfOIZ6oQMEDmv2ptV76PA54NGLL',
- loading: authenticating,
- done: authenticated
- }),
- ndStr = 'nd',
- tagStr = 'tag',
- memberStr = 'member',
- nodeStr = 'node',
- wayStr = 'way',
- relationStr = 'relation',
- userDetails,
- off;
-
-
- connection.changesetURL = function(changesetId) {
- return url + '/changeset/' + changesetId;
+ if (root3.getAttribute("id"))
+ feature3.id = root3.getAttribute("id");
+ return feature3;
+ }
+ function* kmlGen(doc) {
+ const styleIndex = {};
+ const styleByHash = {};
+ const styleMapIndex = {};
+ const placemarks = doc.getElementsByTagName("Placemark");
+ const styles = doc.getElementsByTagName("Style");
+ const styleMaps = doc.getElementsByTagName("StyleMap");
+ for (let k = 0; k < styles.length; k++) {
+ const style = styles[k];
+ const hash = okhash(xml2str(style)).toString(16);
+ let id2 = style.getAttribute("id");
+ if (!id2 && style.parentNode.tagName.replace("gx:", "") === "CascadingStyle") {
+ id2 = style.parentNode.getAttribute("kml:id") || style.parentNode.getAttribute("id");
+ }
+ styleIndex["#" + id2] = hash;
+ styleByHash[hash] = style;
+ }
+ for (let l = 0; l < styleMaps.length; l++) {
+ styleIndex["#" + styleMaps[l].getAttribute("id")] = okhash(xml2str(styleMaps[l])).toString(16);
+ const pairs = styleMaps[l].getElementsByTagName("Pair");
+ const pairsMap = {};
+ for (let m = 0; m < pairs.length; m++) {
+ pairsMap[nodeVal(get1(pairs[m], "key"))] = nodeVal(get1(pairs[m], "styleUrl"));
+ }
+ styleMapIndex["#" + styleMaps[l].getAttribute("id")] = pairsMap;
+ }
+ for (let j2 = 0; j2 < placemarks.length; j2++) {
+ const feature3 = getPlacemark(placemarks[j2], styleIndex, styleMapIndex, styleByHash);
+ if (feature3)
+ yield feature3;
+ }
+ }
+ function kml(doc) {
+ return {
+ type: "FeatureCollection",
+ features: Array.from(kmlGen(doc))
};
+ }
- connection.changesetsURL = function(center, zoom) {
- var precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
- return url + '/history#map=' +
- Math.floor(zoom) + '/' +
- center[1].toFixed(precision) + '/' +
- center[0].toFixed(precision);
+ // modules/svg/data.js
+ var _initialized = false;
+ var _enabled = false;
+ var _geojson;
+ function svgData(projection2, context, dispatch10) {
+ var throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ var _showLabels = true;
+ var detected = utilDetect();
+ var layer = select_default2(null);
+ var _vtService;
+ var _fileList;
+ var _template;
+ var _src;
+ function init2() {
+ if (_initialized)
+ return;
+ _geojson = {};
+ _enabled = true;
+ function over(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ d3_event.dataTransfer.dropEffect = "copy";
+ }
+ context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ if (!detected.filedrop)
+ return;
+ drawData.fileList(d3_event.dataTransfer.files);
+ }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
+ _initialized = true;
+ }
+ function getService() {
+ if (services.vectorTile && !_vtService) {
+ _vtService = services.vectorTile;
+ _vtService.event.on("loadedData", throttledRedraw);
+ } else if (!services.vectorTile && _vtService) {
+ _vtService = null;
+ }
+ return _vtService;
+ }
+ function showLayer() {
+ layerOn();
+ layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
+ dispatch10.call("change");
+ });
+ }
+ function hideLayer() {
+ throttledRedraw.cancel();
+ layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
+ }
+ function layerOn() {
+ layer.style("display", "block");
+ }
+ function layerOff() {
+ layer.selectAll(".viewfield-group").remove();
+ layer.style("display", "none");
+ }
+ function ensureIDs(gj) {
+ if (!gj)
+ return null;
+ if (gj.type === "FeatureCollection") {
+ for (var i2 = 0; i2 < gj.features.length; i2++) {
+ ensureFeatureID(gj.features[i2]);
+ }
+ } else {
+ ensureFeatureID(gj);
+ }
+ return gj;
+ }
+ function ensureFeatureID(feature3) {
+ if (!feature3)
+ return;
+ feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
+ return feature3;
+ }
+ function getFeatures(gj) {
+ if (!gj)
+ return [];
+ if (gj.type === "FeatureCollection") {
+ return gj.features;
+ } else {
+ return [gj];
+ }
+ }
+ function featureKey(d) {
+ return d.__featurehash__;
+ }
+ function isPolygon(d) {
+ return d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon";
+ }
+ function clipPathID(d) {
+ return "ideditor-data-" + d.__featurehash__ + "-clippath";
+ }
+ function featureClasses(d) {
+ return [
+ "data" + d.__featurehash__,
+ d.geometry.type,
+ isPolygon(d) ? "area" : "",
+ d.__layerID__ || ""
+ ].filter(Boolean).join(" ");
+ }
+ function drawData(selection2) {
+ var vtService = getService();
+ var getPath = svgPath(projection2).geojson;
+ var getAreaPath = svgPath(projection2, null, true).geojson;
+ var hasData = drawData.hasData();
+ layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
+ layer.exit().remove();
+ layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
+ var surface = context.surface();
+ if (!surface || surface.empty())
+ return;
+ var geoData, polygonData;
+ if (_template && vtService) {
+ var sourceID = _template;
+ vtService.loadTiles(sourceID, _template, projection2);
+ geoData = vtService.data(sourceID, projection2);
+ } else {
+ geoData = getFeatures(_geojson);
+ }
+ geoData = geoData.filter(getPath);
+ polygonData = geoData.filter(isPolygon);
+ var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
+ clipPaths.exit().remove();
+ var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
+ clipPathsEnter.append("path");
+ clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
+ var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
+ datagroups = datagroups.enter().append("g").attr("class", function(d) {
+ return "datagroup datagroup-" + d;
+ }).merge(datagroups);
+ var pathData = {
+ fill: polygonData,
+ shadow: geoData,
+ stroke: geoData
+ };
+ var paths = datagroups.selectAll("path").data(function(layer2) {
+ return pathData[layer2];
+ }, featureKey);
+ paths.exit().remove();
+ paths = paths.enter().append("path").attr("class", function(d) {
+ var datagroup = this.parentNode.__data__;
+ return "pathdata " + datagroup + " " + featureClasses(d);
+ }).attr("clip-path", function(d) {
+ var datagroup = this.parentNode.__data__;
+ return datagroup === "fill" ? "url(#" + clipPathID(d) + ")" : null;
+ }).merge(paths).attr("d", function(d) {
+ var datagroup = this.parentNode.__data__;
+ return datagroup === "fill" ? getAreaPath(d) : getPath(d);
+ });
+ layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
+ function drawLabels(selection3, textClass, data) {
+ var labelPath = path_default(projection2);
+ var labelData = data.filter(function(d) {
+ return _showLabels && d.properties && (d.properties.desc || d.properties.name);
+ });
+ var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
+ labels.exit().remove();
+ labels = labels.enter().append("text").attr("class", function(d) {
+ return textClass + " " + featureClasses(d);
+ }).merge(labels).text(function(d) {
+ return d.properties.desc || d.properties.name;
+ }).attr("x", function(d) {
+ var centroid = labelPath.centroid(d);
+ return centroid[0] + 11;
+ }).attr("y", function(d) {
+ var centroid = labelPath.centroid(d);
+ return centroid[1];
+ });
+ }
+ }
+ function getExtension(fileName) {
+ if (!fileName)
+ return;
+ var re2 = /\.(gpx|kml|(geo)?json)$/i;
+ var match = fileName.toLowerCase().match(re2);
+ return match && match.length && match[0];
+ }
+ function xmlToDom(textdata) {
+ return new DOMParser().parseFromString(textdata, "text/xml");
+ }
+ function stringifyGeojsonProperties(feature3) {
+ const properties = feature3.properties;
+ for (const key in properties) {
+ const property = properties[key];
+ if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
+ properties[key] = property.toString();
+ } else if (property === null) {
+ properties[key] = "null";
+ } else if (typeof property === "object") {
+ properties[key] = JSON.stringify(property);
+ }
+ }
+ }
+ drawData.setFile = function(extension, data) {
+ _template = null;
+ _fileList = null;
+ _geojson = null;
+ _src = null;
+ var gj;
+ switch (extension) {
+ case ".gpx":
+ gj = gpx(xmlToDom(data));
+ break;
+ case ".kml":
+ gj = kml(xmlToDom(data));
+ break;
+ case ".geojson":
+ case ".json":
+ gj = JSON.parse(data);
+ if (gj.type === "FeatureCollection") {
+ gj.features.forEach(stringifyGeojsonProperties);
+ } else if (gj.type === "Feature") {
+ stringifyGeojsonProperties(gj);
+ }
+ break;
+ }
+ gj = gj || {};
+ if (Object.keys(gj).length) {
+ _geojson = ensureIDs(gj);
+ _src = extension + " data file";
+ this.fitZoom();
+ }
+ dispatch10.call("change");
+ return this;
};
-
- connection.entityURL = function(entity) {
- return url + '/' + entity.type + '/' + entity.osmId();
+ drawData.showLabels = function(val) {
+ if (!arguments.length)
+ return _showLabels;
+ _showLabels = val;
+ return this;
};
-
- connection.userURL = function(username) {
- return url + '/user/' + username;
+ drawData.enabled = function(val) {
+ if (!arguments.length)
+ return _enabled;
+ _enabled = val;
+ if (_enabled) {
+ showLayer();
+ } else {
+ hideLayer();
+ }
+ dispatch10.call("change");
+ return this;
};
-
- connection.loadFromURL = function(url, callback) {
- function done(err, dom) {
- return callback(err, parse(dom));
+ drawData.hasData = function() {
+ var gj = _geojson || {};
+ return !!(_template || Object.keys(gj).length);
+ };
+ drawData.template = function(val, src) {
+ if (!arguments.length)
+ return _template;
+ var osm = context.connection();
+ if (osm) {
+ var blocklists = osm.imageryBlocklists();
+ var fail = false;
+ var tested = 0;
+ var regex;
+ for (var i2 = 0; i2 < blocklists.length; i2++) {
+ regex = blocklists[i2];
+ fail = regex.test(val);
+ tested++;
+ if (fail)
+ break;
+ }
+ if (!tested) {
+ regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
+ fail = regex.test(val);
}
- return d3.xml(url).get(done);
+ }
+ _template = val;
+ _fileList = null;
+ _geojson = null;
+ _src = src || "vectortile:" + val.split(/[?#]/)[0];
+ dispatch10.call("change");
+ return this;
};
-
- connection.loadEntity = function(id, callback) {
- var type = iD.Entity.id.type(id),
- osmID = iD.Entity.id.toOSM(id);
-
- connection.loadFromURL(
- url + '/api/0.6/' + type + '/' + osmID + (type !== 'node' ? '/full' : ''),
- function(err, entities) {
- if (callback) callback(err, {data: entities});
- });
+ drawData.geojson = function(gj, src) {
+ if (!arguments.length)
+ return _geojson;
+ _template = null;
+ _fileList = null;
+ _geojson = null;
+ _src = null;
+ gj = gj || {};
+ if (Object.keys(gj).length) {
+ _geojson = ensureIDs(gj);
+ _src = src || "unknown.geojson";
+ }
+ dispatch10.call("change");
+ return this;
};
-
- connection.loadEntityVersion = function(id, version, callback) {
- var type = iD.Entity.id.type(id),
- osmID = iD.Entity.id.toOSM(id);
-
- connection.loadFromURL(
- url + '/api/0.6/' + type + '/' + osmID + '/' + version,
- function(err, entities) {
- if (callback) callback(err, {data: entities});
- });
+ drawData.fileList = function(fileList) {
+ if (!arguments.length)
+ return _fileList;
+ _template = null;
+ _fileList = fileList;
+ _geojson = null;
+ _src = null;
+ if (!fileList || !fileList.length)
+ return this;
+ var f2 = fileList[0];
+ var extension = getExtension(f2.name);
+ var reader = new FileReader();
+ reader.onload = function() {
+ return function(e) {
+ drawData.setFile(extension, e.target.result);
+ };
+ }(f2);
+ reader.readAsText(f2);
+ return this;
+ };
+ drawData.url = function(url, defaultExtension) {
+ _template = null;
+ _fileList = null;
+ _geojson = null;
+ _src = null;
+ var testUrl = url.split(/[?#]/)[0];
+ var extension = getExtension(testUrl) || defaultExtension;
+ if (extension) {
+ _template = null;
+ text_default3(url).then(function(data) {
+ drawData.setFile(extension, data);
+ }).catch(function() {
+ });
+ } else {
+ drawData.template(url);
+ }
+ return this;
+ };
+ drawData.getSrc = function() {
+ return _src || "";
};
+ drawData.fitZoom = function() {
+ var features2 = getFeatures(_geojson);
+ if (!features2.length)
+ return;
+ var map2 = context.map();
+ var viewport = map2.trimmedExtent().polygon();
+ var coords = features2.reduce(function(coords2, feature3) {
+ var geom = feature3.geometry;
+ if (!geom)
+ return coords2;
+ var c = geom.coordinates;
+ switch (geom.type) {
+ case "Point":
+ c = [c];
+ case "MultiPoint":
+ case "LineString":
+ break;
+ case "MultiPolygon":
+ c = utilArrayFlatten(c);
+ case "Polygon":
+ case "MultiLineString":
+ c = utilArrayFlatten(c);
+ break;
+ }
+ return utilArrayUnion(coords2, c);
+ }, []);
+ if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
+ var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
+ map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
+ }
+ return this;
+ };
+ init2();
+ return drawData;
+ }
- connection.loadMultiple = function(ids, callback) {
- _.each(_.groupBy(_.uniq(ids), iD.Entity.id.type), function(v, k) {
- var type = k + 's',
- osmIDs = _.map(v, iD.Entity.id.toOSM);
-
- _.each(_.chunk(osmIDs, 150), function(arr) {
- connection.loadFromURL(
- url + '/api/0.6/' + type + '?' + type + '=' + arr.join(),
- function(err, entities) {
- if (callback) callback(err, {data: entities});
- });
- });
+ // modules/svg/debug.js
+ function svgDebug(projection2, context) {
+ function drawDebug(selection2) {
+ const showTile = context.getDebug("tile");
+ const showCollision = context.getDebug("collision");
+ const showImagery = context.getDebug("imagery");
+ const showTouchTargets = context.getDebug("target");
+ const showDownloaded = context.getDebug("downloaded");
+ let debugData = [];
+ if (showTile) {
+ debugData.push({ class: "red", label: "tile" });
+ }
+ if (showCollision) {
+ debugData.push({ class: "yellow", label: "collision" });
+ }
+ if (showImagery) {
+ debugData.push({ class: "orange", label: "imagery" });
+ }
+ if (showTouchTargets) {
+ debugData.push({ class: "pink", label: "touchTargets" });
+ }
+ if (showDownloaded) {
+ debugData.push({ class: "purple", label: "downloaded" });
+ }
+ let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
+ legend.exit().remove();
+ legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
+ let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d) => d.label);
+ legendItems.exit().remove();
+ legendItems.enter().append("span").attr("class", (d) => `debug-legend-item ${d.class}`).text((d) => d.label);
+ let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
+ layer.exit().remove();
+ layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
+ const extent = context.map().extent();
+ _mainFileFetcher.get("imagery").then((d) => {
+ const hits = showImagery && d.query.bbox(extent.rectangle(), true) || [];
+ const features2 = hits.map((d2) => d2.features[d2.id]);
+ let imagery = layer.selectAll("path.debug-imagery").data(features2);
+ imagery.exit().remove();
+ imagery.enter().append("path").attr("class", "debug-imagery debug orange");
+ }).catch(() => {
+ });
+ const osm = context.connection();
+ let dataDownloaded = [];
+ if (osm && showDownloaded) {
+ const rtree = osm.caches("get").tile.rtree;
+ dataDownloaded = rtree.all().map((bbox) => {
+ return {
+ type: "Feature",
+ properties: { id: bbox.id },
+ geometry: {
+ type: "Polygon",
+ coordinates: [[
+ [bbox.minX, bbox.minY],
+ [bbox.minX, bbox.maxY],
+ [bbox.maxX, bbox.maxY],
+ [bbox.maxX, bbox.minY],
+ [bbox.minX, bbox.minY]
+ ]]
+ }
+ };
});
+ }
+ let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
+ downloaded.exit().remove();
+ downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
+ layer.selectAll("path").attr("d", svgPath(projection2).geojson);
+ }
+ drawDebug.enabled = function() {
+ if (!arguments.length) {
+ return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
+ } else {
+ return this;
+ }
};
+ return drawDebug;
+ }
- function authenticating() {
- event.authenticating();
+ // modules/svg/defs.js
+ function svgDefs(context) {
+ var _defsSelection = select_default2(null);
+ var _spritesheetIds = [
+ "iD-sprite",
+ "maki-sprite",
+ "temaki-sprite",
+ "fa-sprite",
+ "community-sprite"
+ ];
+ function drawDefs(selection2) {
+ _defsSelection = selection2.append("defs");
+ _defsSelection.append("marker").attr("id", "ideditor-oneway-marker").attr("viewBox", "0 0 10 5").attr("refX", 2.5).attr("refY", 2.5).attr("markerWidth", 2).attr("markerHeight", 2).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "oneway-marker-path").attr("d", "M 5,3 L 0,3 L 0,2 L 5,2 L 5,0 L 10,2.5 L 5,5 z").attr("stroke", "none").attr("fill", "#000").attr("opacity", "0.75");
+ function addSidedMarker(name2, color2, offset) {
+ _defsSelection.append("marker").attr("id", "ideditor-sided-marker-" + name2).attr("viewBox", "0 0 2 2").attr("refX", 1).attr("refY", -offset).attr("markerWidth", 1.5).attr("markerHeight", 1.5).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "sided-marker-path sided-marker-" + name2 + "-path").attr("d", "M 0,0 L 1,1 L 2,0 z").attr("stroke", "none").attr("fill", color2);
+ }
+ addSidedMarker("natural", "rgb(170, 170, 170)", 0);
+ addSidedMarker("coastline", "#77dede", 1);
+ addSidedMarker("waterway", "#77dede", 1);
+ addSidedMarker("barrier", "#ddd", 1);
+ addSidedMarker("man_made", "#fff", 0);
+ _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "#333").attr("fill-opacity", "0.75").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
+ _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker-wireframe").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "none").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
+ var patterns2 = _defsSelection.selectAll("pattern").data([
+ ["beach", "dots"],
+ ["construction", "construction"],
+ ["cemetery", "cemetery"],
+ ["cemetery_christian", "cemetery_christian"],
+ ["cemetery_buddhist", "cemetery_buddhist"],
+ ["cemetery_muslim", "cemetery_muslim"],
+ ["cemetery_jewish", "cemetery_jewish"],
+ ["farmland", "farmland"],
+ ["farmyard", "farmyard"],
+ ["forest", "forest"],
+ ["forest_broadleaved", "forest_broadleaved"],
+ ["forest_needleleaved", "forest_needleleaved"],
+ ["forest_leafless", "forest_leafless"],
+ ["golf_green", "grass"],
+ ["grass", "grass"],
+ ["landfill", "landfill"],
+ ["meadow", "grass"],
+ ["orchard", "orchard"],
+ ["pond", "pond"],
+ ["quarry", "quarry"],
+ ["scrub", "bushes"],
+ ["vineyard", "vineyard"],
+ ["water_standing", "lines"],
+ ["waves", "waves"],
+ ["wetland", "wetland"],
+ ["wetland_marsh", "wetland_marsh"],
+ ["wetland_swamp", "wetland_swamp"],
+ ["wetland_bog", "wetland_bog"],
+ ["wetland_reedbed", "wetland_reedbed"]
+ ]).enter().append("pattern").attr("id", function(d) {
+ return "ideditor-pattern-" + d[0];
+ }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
+ patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d) {
+ return "pattern-color-" + d[0];
+ });
+ patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d) {
+ return context.imagePath("pattern/" + d[1] + ".png");
+ });
+ _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d) {
+ return "ideditor-clip-square-" + d;
+ }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d) {
+ return d;
+ }).attr("height", function(d) {
+ return d;
+ });
+ addSprites(_spritesheetIds, true);
+ }
+ function addSprites(ids, overrideColors) {
+ _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
+ var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
+ spritesheets.enter().append("g").attr("class", function(d) {
+ return "spritesheet spritesheet-" + d;
+ }).each(function(d) {
+ var url = context.imagePath(d + ".svg");
+ var node = select_default2(this).node();
+ svg(url).then(function(svg2) {
+ node.appendChild(select_default2(svg2.documentElement).attr("id", "ideditor-" + d).node());
+ if (overrideColors && d !== "iD-sprite") {
+ select_default2(node).selectAll("path").attr("fill", "currentColor");
+ }
+ }).catch(function() {
+ });
+ });
+ spritesheets.exit().remove();
}
+ drawDefs.addSprites = addSprites;
+ return drawDefs;
+ }
- function authenticated() {
- event.authenticated();
+ // modules/svg/keepRight.js
+ var _layerEnabled = false;
+ var _qaService;
+ function svgKeepRight(projection2, context, dispatch10) {
+ const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
+ const minZoom3 = 12;
+ let touchLayer = select_default2(null);
+ let drawLayer = select_default2(null);
+ let layerVisible = false;
+ function markerPath(selection2, klass) {
+ selection2.attr("class", klass).attr("transform", "translate(-4, -24)").attr("d", "M11.6,6.2H7.1l1.4-5.1C8.6,0.6,8.1,0,7.5,0H2.2C1.7,0,1.3,0.3,1.3,0.8L0,10.2c-0.1,0.6,0.4,1.1,0.9,1.1h4.6l-1.8,7.6C3.6,19.4,4.1,20,4.7,20c0.3,0,0.6-0.2,0.8-0.5l6.9-11.9C12.7,7,12.3,6.2,11.6,6.2z");
+ }
+ function getService() {
+ if (services.keepRight && !_qaService) {
+ _qaService = services.keepRight;
+ _qaService.on("loaded", throttledRedraw);
+ } else if (!services.keepRight && _qaService) {
+ _qaService = null;
+ }
+ return _qaService;
}
-
- function getLoc(attrs) {
- var lon = attrs.lon && attrs.lon.value,
- lat = attrs.lat && attrs.lat.value;
- return [parseFloat(lon), parseFloat(lat)];
+ function editOn() {
+ if (!layerVisible) {
+ layerVisible = true;
+ drawLayer.style("display", "block");
+ }
}
-
- function getNodes(obj) {
- var elems = obj.getElementsByTagName(ndStr),
- nodes = new Array(elems.length);
- for (var i = 0, l = elems.length; i < l; i++) {
- nodes[i] = 'n' + elems[i].attributes.ref.value;
- }
- return nodes;
+ function editOff() {
+ if (layerVisible) {
+ layerVisible = false;
+ drawLayer.style("display", "none");
+ drawLayer.selectAll(".qaItem.keepRight").remove();
+ touchLayer.selectAll(".qaItem.keepRight").remove();
+ }
}
-
- function getTags(obj) {
- var elems = obj.getElementsByTagName(tagStr),
- tags = {};
- for (var i = 0, l = elems.length; i < l; i++) {
- var attrs = elems[i].attributes;
- tags[attrs.k.value] = attrs.v.value;
- }
- return tags;
+ function layerOn() {
+ editOn();
+ drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
}
-
- function getMembers(obj) {
- var elems = obj.getElementsByTagName(memberStr),
- members = new Array(elems.length);
- for (var i = 0, l = elems.length; i < l; i++) {
- var attrs = elems[i].attributes;
- members[i] = {
- id: attrs.type.value[0] + attrs.ref.value,
- type: attrs.type.value,
- role: attrs.role.value
- };
- }
- return members;
+ function layerOff() {
+ throttledRedraw.cancel();
+ drawLayer.interrupt();
+ touchLayer.selectAll(".qaItem.keepRight").remove();
+ drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
+ editOff();
+ dispatch10.call("change");
+ });
}
-
- function getVisible(attrs) {
- return (!attrs.visible || attrs.visible.value !== 'false');
+ function updateMarkers() {
+ if (!layerVisible || !_layerEnabled)
+ return;
+ const service = getService();
+ const selectedID = context.selectedErrorID();
+ const data = service ? service.getItems(projection2) : [];
+ const getTransform = svgPointTransform(projection2);
+ const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
+ markers.exit().remove();
+ const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`);
+ markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
+ markersEnter.append("path").call(markerPath, "shadow");
+ markersEnter.append("use").attr("class", "qaItem-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-bolt");
+ markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
+ if (touchLayer.empty())
+ return;
+ const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
+ const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d) => d.id);
+ targets.exit().remove();
+ targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
+ function sortY(a, b) {
+ return a.id === selectedID ? 1 : b.id === selectedID ? -1 : a.severity === "error" && b.severity !== "error" ? 1 : b.severity === "error" && a.severity !== "error" ? -1 : b.loc[1] - a.loc[1];
+ }
}
-
- var parsers = {
- node: function nodeData(obj) {
- var attrs = obj.attributes;
- return new iD.Node({
- id: iD.Entity.id.fromOSM(nodeStr, attrs.id.value),
- loc: getLoc(attrs),
- version: attrs.version.value,
- user: attrs.user && attrs.user.value,
- tags: getTags(obj),
- visible: getVisible(attrs)
- });
- },
-
- way: function wayData(obj) {
- var attrs = obj.attributes;
- return new iD.Way({
- id: iD.Entity.id.fromOSM(wayStr, attrs.id.value),
- version: attrs.version.value,
- user: attrs.user && attrs.user.value,
- tags: getTags(obj),
- nodes: getNodes(obj),
- visible: getVisible(attrs)
- });
- },
-
- relation: function relationData(obj) {
- var attrs = obj.attributes;
- return new iD.Relation({
- id: iD.Entity.id.fromOSM(relationStr, attrs.id.value),
- version: attrs.version.value,
- user: attrs.user && attrs.user.value,
- tags: getTags(obj),
- members: getMembers(obj),
- visible: getVisible(attrs)
- });
- }
- };
-
- function parse(dom) {
- if (!dom || !dom.childNodes) return;
-
- var root = dom.childNodes[0],
- children = root.childNodes,
- entities = [];
-
- for (var i = 0, l = children.length; i < l; i++) {
- var child = children[i],
- parser = parsers[child.nodeName];
- if (parser) {
- entities.push(parser(child));
- }
+ function drawKeepRight(selection2) {
+ const service = getService();
+ const surface = context.surface();
+ if (surface && !surface.empty()) {
+ touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
+ }
+ drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
+ drawLayer.exit().remove();
+ drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
+ if (_layerEnabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ service.loadIssues(projection2);
+ updateMarkers();
+ } else {
+ editOff();
}
-
- return entities;
+ }
}
-
- connection.authenticated = function() {
- return oauth.authenticated();
+ drawKeepRight.enabled = function(val) {
+ if (!arguments.length)
+ return _layerEnabled;
+ _layerEnabled = val;
+ if (_layerEnabled) {
+ layerOn();
+ } else {
+ layerOff();
+ if (context.selectedErrorID()) {
+ context.enter(modeBrowse(context));
+ }
+ }
+ dispatch10.call("change");
+ return this;
};
+ drawKeepRight.supported = () => !!getService();
+ return drawKeepRight;
+ }
- // Generate Changeset XML. Returns a string.
- connection.changesetJXON = function(tags) {
- return {
- osm: {
- changeset: {
- tag: _.map(tags, function(value, key) {
- return { '@k': key, '@v': value };
- }),
- '@version': 0.6,
- '@generator': 'iD'
- }
- }
- };
+ // modules/svg/geolocate.js
+ function svgGeolocate(projection2) {
+ var layer = select_default2(null);
+ var _position;
+ function init2() {
+ if (svgGeolocate.initialized)
+ return;
+ svgGeolocate.enabled = false;
+ svgGeolocate.initialized = true;
+ }
+ function showLayer() {
+ layer.style("display", "block");
+ }
+ function hideLayer() {
+ layer.transition().duration(250).style("opacity", 0);
+ }
+ function layerOn() {
+ layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
+ }
+ function layerOff() {
+ layer.style("display", "none");
+ }
+ function transform2(d) {
+ return svgPointTransform(projection2)(d);
+ }
+ function accuracy(accuracy2, loc) {
+ var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
+ return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
+ }
+ function update() {
+ var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
+ var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
+ groups.exit().remove();
+ var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
+ pointsEnter.append("circle").attr("class", "geolocate-radius").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("fill-opacity", "0.3").attr("r", "0");
+ pointsEnter.append("circle").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("stroke", "white").attr("stroke-width", "1.5").attr("r", "6");
+ groups.merge(pointsEnter).attr("transform", transform2);
+ layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
+ }
+ function drawLocation(selection2) {
+ var enabled = svgGeolocate.enabled;
+ layer = selection2.selectAll(".layer-geolocate").data([0]);
+ layer.exit().remove();
+ var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
+ layerEnter.append("g").attr("class", "geolocations");
+ layer = layerEnter.merge(layer);
+ if (enabled) {
+ update();
+ } else {
+ layerOff();
+ }
+ }
+ drawLocation.enabled = function(position, enabled) {
+ if (!arguments.length)
+ return svgGeolocate.enabled;
+ _position = position;
+ svgGeolocate.enabled = enabled;
+ if (svgGeolocate.enabled) {
+ showLayer();
+ layerOn();
+ } else {
+ hideLayer();
+ }
+ return this;
};
+ init2();
+ return drawLocation;
+ }
- // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
- // XML. Returns a string.
- connection.osmChangeJXON = function(changeset_id, changes) {
- function nest(x, order) {
- var groups = {};
- for (var i = 0; i < x.length; i++) {
- var tagName = Object.keys(x[i])[0];
- if (!groups[tagName]) groups[tagName] = [];
- groups[tagName].push(x[i][tagName]);
- }
- var ordered = {};
- order.forEach(function(o) {
- if (groups[o]) ordered[o] = groups[o];
- });
- return ordered;
+ // modules/svg/labels.js
+ var import_rbush7 = __toESM(require_rbush_min());
+ function svgLabels(projection2, context) {
+ var path = path_default(projection2);
+ var detected = utilDetect();
+ var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
+ var _rdrawn = new import_rbush7.default();
+ var _rskipped = new import_rbush7.default();
+ var _textWidthCache = {};
+ var _entitybboxes = {};
+ var labelStack = [
+ ["line", "aeroway", "*", 12],
+ ["line", "highway", "motorway", 12],
+ ["line", "highway", "trunk", 12],
+ ["line", "highway", "primary", 12],
+ ["line", "highway", "secondary", 12],
+ ["line", "highway", "tertiary", 12],
+ ["line", "highway", "*", 12],
+ ["line", "railway", "*", 12],
+ ["line", "waterway", "*", 12],
+ ["area", "aeroway", "*", 12],
+ ["area", "amenity", "*", 12],
+ ["area", "building", "*", 12],
+ ["area", "historic", "*", 12],
+ ["area", "leisure", "*", 12],
+ ["area", "man_made", "*", 12],
+ ["area", "natural", "*", 12],
+ ["area", "shop", "*", 12],
+ ["area", "tourism", "*", 12],
+ ["area", "camp_site", "*", 12],
+ ["point", "aeroway", "*", 10],
+ ["point", "amenity", "*", 10],
+ ["point", "building", "*", 10],
+ ["point", "historic", "*", 10],
+ ["point", "leisure", "*", 10],
+ ["point", "man_made", "*", 10],
+ ["point", "natural", "*", 10],
+ ["point", "shop", "*", 10],
+ ["point", "tourism", "*", 10],
+ ["point", "camp_site", "*", 10],
+ ["line", "name", "*", 12],
+ ["area", "name", "*", 12],
+ ["point", "name", "*", 10]
+ ];
+ function shouldSkipIcon(preset) {
+ var noIcons = ["building", "landuse", "natural"];
+ return noIcons.some(function(s) {
+ return preset.id.indexOf(s) >= 0;
+ });
+ }
+ function get3(array2, prop) {
+ return function(d, i2) {
+ return array2[i2][prop];
+ };
+ }
+ function textWidth(text2, size, elem) {
+ var c = _textWidthCache[size];
+ if (!c)
+ c = _textWidthCache[size] = {};
+ if (c[text2]) {
+ return c[text2];
+ } else if (elem) {
+ c[text2] = elem.getComputedTextLength();
+ return c[text2];
+ } else {
+ var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
+ if (str2 === null) {
+ return size / 3 * 2 * text2.length;
+ } else {
+ return size / 3 * (2 * text2.length + str2.length);
}
-
- function rep(entity) {
- return entity.asJXON(changeset_id);
+ }
+ }
+ function drawLinePaths(selection2, entities, filter2, classes, labels) {
+ var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
+ paths.exit().remove();
+ paths.enter().append("path").style("stroke-width", get3(labels, "font-size")).attr("id", function(d) {
+ return "ideditor-labelpath-" + d.id;
+ }).attr("class", classes).merge(paths).attr("d", get3(labels, "lineString"));
+ }
+ function drawLineLabels(selection2, entities, filter2, classes, labels) {
+ var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
+ texts.exit().remove();
+ texts.enter().append("text").attr("class", function(d, i2) {
+ return classes + " " + labels[i2].classes + " " + d.id;
+ }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
+ selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d) {
+ return "#ideditor-labelpath-" + d.id;
+ }).text(utilDisplayNameForPath);
+ }
+ function drawPointLabels(selection2, entities, filter2, classes, labels) {
+ var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
+ texts.exit().remove();
+ texts.enter().append("text").attr("class", function(d, i2) {
+ return classes + " " + labels[i2].classes + " " + d.id;
+ }).merge(texts).attr("x", get3(labels, "x")).attr("y", get3(labels, "y")).style("text-anchor", get3(labels, "textAnchor")).text(utilDisplayName).each(function(d, i2) {
+ textWidth(utilDisplayName(d), labels[i2].height, this);
+ });
+ }
+ function drawAreaLabels(selection2, entities, filter2, classes, labels) {
+ entities = entities.filter(hasText);
+ labels = labels.filter(hasText);
+ drawPointLabels(selection2, entities, filter2, classes, labels);
+ function hasText(d, i2) {
+ return labels[i2].hasOwnProperty("x") && labels[i2].hasOwnProperty("y");
+ }
+ }
+ function drawAreaIcons(selection2, entities, filter2, classes, labels) {
+ var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
+ icons.exit().remove();
+ icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get3(labels, "transform")).attr("xlink:href", function(d) {
+ var preset = _mainPresetIndex.match(d, context.graph());
+ var picon = preset && preset.icon;
+ return picon ? "#" + picon : "";
+ });
+ }
+ function drawCollisionBoxes(selection2, rtree, which) {
+ var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
+ var gj = [];
+ if (context.getDebug("collision")) {
+ gj = rtree.all().map(function(d) {
+ return { type: "Polygon", coordinates: [[
+ [d.minX, d.minY],
+ [d.maxX, d.minY],
+ [d.maxX, d.maxY],
+ [d.minX, d.maxY],
+ [d.minX, d.minY]
+ ]] };
+ });
+ }
+ var boxes = selection2.selectAll("." + which).data(gj);
+ boxes.exit().remove();
+ boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
+ }
+ function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
+ var wireframe = context.surface().classed("fill-wireframe");
+ var zoom = geoScaleToZoom(projection2.scale());
+ var labelable = [];
+ var renderNodeAs = {};
+ var i2, j2, k, entity, geometry;
+ for (i2 = 0; i2 < labelStack.length; i2++) {
+ labelable.push([]);
+ }
+ if (fullRedraw) {
+ _rdrawn.clear();
+ _rskipped.clear();
+ _entitybboxes = {};
+ } else {
+ for (i2 = 0; i2 < entities.length; i2++) {
+ entity = entities[i2];
+ var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
+ for (j2 = 0; j2 < toRemove.length; j2++) {
+ _rdrawn.remove(toRemove[j2]);
+ _rskipped.remove(toRemove[j2]);
+ }
}
-
- return {
- osmChange: {
- '@version': 0.6,
- '@generator': 'iD',
- 'create': nest(changes.created.map(rep), ['node', 'way', 'relation']),
- 'modify': nest(changes.modified.map(rep), ['node', 'way', 'relation']),
- 'delete': _.extend(nest(changes.deleted.map(rep), ['relation', 'way', 'node']), {'@if-unused': true})
+ }
+ for (i2 = 0; i2 < entities.length; i2++) {
+ entity = entities[i2];
+ geometry = entity.geometry(graph);
+ if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
+ var hasDirections = entity.directions(graph, projection2).length;
+ var markerPadding;
+ if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
+ renderNodeAs[entity.id] = "point";
+ markerPadding = 20;
+ } else {
+ renderNodeAs[entity.id] = "vertex";
+ markerPadding = 0;
+ }
+ var coord2 = projection2(entity.loc);
+ var nodePadding = 10;
+ var bbox = {
+ minX: coord2[0] - nodePadding,
+ minY: coord2[1] - nodePadding - markerPadding,
+ maxX: coord2[0] + nodePadding,
+ maxY: coord2[1] + nodePadding
+ };
+ doInsert(bbox, entity.id + "P");
+ }
+ if (geometry === "vertex") {
+ geometry = "point";
+ }
+ var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
+ var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
+ if (!icon2 && !utilDisplayName(entity))
+ continue;
+ for (k = 0; k < labelStack.length; k++) {
+ var matchGeom = labelStack[k][0];
+ var matchKey = labelStack[k][1];
+ var matchVal = labelStack[k][2];
+ var hasVal = entity.tags[matchKey];
+ if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
+ labelable[k].push(entity);
+ break;
+ }
+ }
+ }
+ var positions = {
+ point: [],
+ line: [],
+ area: []
+ };
+ var labelled = {
+ point: [],
+ line: [],
+ area: []
+ };
+ for (k = 0; k < labelable.length; k++) {
+ var fontSize = labelStack[k][3];
+ for (i2 = 0; i2 < labelable[k].length; i2++) {
+ entity = labelable[k][i2];
+ geometry = entity.geometry(graph);
+ var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
+ var name2 = getName(entity);
+ var width = name2 && textWidth(name2, fontSize);
+ var p = null;
+ if (geometry === "point" || geometry === "vertex") {
+ if (wireframe)
+ continue;
+ var renderAs = renderNodeAs[entity.id];
+ if (renderAs === "vertex" && zoom < 17)
+ continue;
+ p = getPointLabel(entity, width, fontSize, renderAs);
+ } else if (geometry === "line") {
+ p = getLineLabel(entity, width, fontSize);
+ } else if (geometry === "area") {
+ p = getAreaLabel(entity, width, fontSize);
+ }
+ if (p) {
+ if (geometry === "vertex") {
+ geometry = "point";
}
+ p.classes = geometry + " tag-" + labelStack[k][1];
+ positions[geometry].push(p);
+ labelled[geometry].push(entity);
+ }
+ }
+ }
+ function isInterestingVertex(entity2) {
+ var selectedIDs = context.selectedIDs();
+ return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
+ return selectedIDs.indexOf(parent.id) !== -1;
+ });
+ }
+ function getPointLabel(entity2, width2, height, geometry2) {
+ var y = geometry2 === "point" ? -12 : 0;
+ var pointOffsets = {
+ ltr: [15, y, "start"],
+ rtl: [-15, y, "end"]
};
- };
-
- connection.changesetTags = function(comment, imageryUsed) {
- var detected = iD.detect(),
- tags = {
- created_by: 'iD ' + iD.version,
- imagery_used: imageryUsed.join(';').substr(0, 255),
- host: (window.location.origin + window.location.pathname).substr(0, 255),
- locale: detected.locale
- };
-
- if (comment) {
- tags.comment = comment.substr(0, 255);
- }
-
- return tags;
- };
-
- connection.putChangeset = function(changes, comment, imageryUsed, callback) {
- oauth.xhr({
- method: 'PUT',
- path: '/api/0.6/changeset/create',
- options: { header: { 'Content-Type': 'text/xml' } },
- content: JXON.stringify(connection.changesetJXON(connection.changesetTags(comment, imageryUsed)))
- }, function(err, changeset_id) {
- if (err) return callback(err);
- oauth.xhr({
- method: 'POST',
- path: '/api/0.6/changeset/' + changeset_id + '/upload',
- options: { header: { 'Content-Type': 'text/xml' } },
- content: JXON.stringify(connection.osmChangeJXON(changeset_id, changes))
- }, function(err) {
- if (err) return callback(err);
- // POST was successful, safe to call the callback.
- // Still attempt to close changeset, but ignore response because #2667
- // Add delay to allow for postgres replication #1646 #2678
- window.setTimeout(function() { callback(null, changeset_id); }, 2500);
- oauth.xhr({
- method: 'PUT',
- path: '/api/0.6/changeset/' + changeset_id + '/close',
- options: { header: { 'Content-Type': 'text/xml' } }
- }, d3.functor(true));
- });
- });
- };
-
- connection.userDetails = function(callback) {
- if (userDetails) {
- callback(undefined, userDetails);
- return;
+ var textDirection = _mainLocalizer.textDirection();
+ var coord3 = projection2(entity2.loc);
+ var textPadding = 2;
+ var offset = pointOffsets[textDirection];
+ var p2 = {
+ height,
+ width: width2,
+ x: coord3[0] + offset[0],
+ y: coord3[1] + offset[1],
+ textAnchor: offset[2]
+ };
+ var bbox2;
+ if (textDirection === "rtl") {
+ bbox2 = {
+ minX: p2.x - width2 - textPadding,
+ minY: p2.y - height / 2 - textPadding,
+ maxX: p2.x + textPadding,
+ maxY: p2.y + height / 2 + textPadding
+ };
+ } else {
+ bbox2 = {
+ minX: p2.x - textPadding,
+ minY: p2.y - height / 2 - textPadding,
+ maxX: p2.x + width2 + textPadding,
+ maxY: p2.y + height / 2 + textPadding
+ };
}
-
- function done(err, user_details) {
- if (err) return callback(err);
-
- var u = user_details.getElementsByTagName('user')[0],
- img = u.getElementsByTagName('img'),
- image_url = '';
-
- if (img && img[0] && img[0].getAttribute('href')) {
- image_url = img[0].getAttribute('href');
+ if (tryInsert([bbox2], entity2.id, true)) {
+ return p2;
+ }
+ }
+ function getLineLabel(entity2, width2, height) {
+ var viewport = geoExtent(context.projection.clipExtent()).polygon();
+ var points = graph.childNodes(entity2).map(function(node) {
+ return projection2(node.loc);
+ });
+ var length = geoPathLength(points);
+ if (length < width2 + 20)
+ return;
+ var lineOffsets = [
+ 50,
+ 45,
+ 55,
+ 40,
+ 60,
+ 35,
+ 65,
+ 30,
+ 70,
+ 25,
+ 75,
+ 20,
+ 80,
+ 15,
+ 95,
+ 10,
+ 90,
+ 5,
+ 95
+ ];
+ var padding = 3;
+ for (var i3 = 0; i3 < lineOffsets.length; i3++) {
+ var offset = lineOffsets[i3];
+ var middle = offset / 100 * length;
+ var start2 = middle - width2 / 2;
+ if (start2 < 0 || start2 + width2 > length)
+ continue;
+ var sub = subpath(points, start2, start2 + width2);
+ if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
+ continue;
+ }
+ var isReverse = reverse(sub);
+ if (isReverse) {
+ sub = sub.reverse();
+ }
+ var bboxes = [];
+ var boxsize = (height + 2) / 2;
+ for (var j3 = 0; j3 < sub.length - 1; j3++) {
+ var a = sub[j3];
+ var b = sub[j3 + 1];
+ var num = Math.max(1, Math.floor(geoVecLength(a, b) / boxsize / 2));
+ for (var box = 0; box < num; box++) {
+ var p2 = geoVecInterp(a, b, box / num);
+ var x05 = p2[0] - boxsize - padding;
+ var y05 = p2[1] - boxsize - padding;
+ var x12 = p2[0] + boxsize + padding;
+ var y12 = p2[1] + boxsize + padding;
+ bboxes.push({
+ minX: Math.min(x05, x12),
+ minY: Math.min(y05, y12),
+ maxX: Math.max(x05, x12),
+ maxY: Math.max(y05, y12)
+ });
}
-
- userDetails = {
- display_name: u.attributes.display_name.value,
- image_url: image_url,
- id: u.attributes.id.value
+ }
+ if (tryInsert(bboxes, entity2.id, false)) {
+ return {
+ "font-size": height + 2,
+ lineString: lineString2(sub),
+ startOffset: offset + "%"
};
-
- callback(undefined, userDetails);
+ }
}
-
- oauth.xhr({ method: 'GET', path: '/api/0.6/user/details' }, done);
- };
-
- connection.userChangesets = function(callback) {
- connection.userDetails(function(err, user) {
- if (err) return callback(err);
-
- function done(changesets) {
- callback(undefined, Array.prototype.map.call(changesets.getElementsByTagName('changeset'),
- function (changeset) {
- return { tags: getTags(changeset) };
- }));
+ function reverse(p3) {
+ var angle2 = Math.atan2(p3[1][1] - p3[0][1], p3[1][0] - p3[0][0]);
+ return !(p3[0][0] < p3[p3.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
+ }
+ function lineString2(points2) {
+ return "M" + points2.join("L");
+ }
+ function subpath(points2, from, to) {
+ var sofar = 0;
+ var start3, end, i0, i1;
+ for (var i4 = 0; i4 < points2.length - 1; i4++) {
+ var a2 = points2[i4];
+ var b2 = points2[i4 + 1];
+ var current = geoVecLength(a2, b2);
+ var portion;
+ if (!start3 && sofar + current >= from) {
+ portion = (from - sofar) / current;
+ start3 = [
+ a2[0] + portion * (b2[0] - a2[0]),
+ a2[1] + portion * (b2[1] - a2[1])
+ ];
+ i0 = i4 + 1;
}
-
- d3.xml(url + '/api/0.6/changesets?user=' + user.id).get()
- .on('load', done)
- .on('error', callback);
- });
- };
-
- connection.status = function(callback) {
- function done(capabilities) {
- var apiStatus = capabilities.getElementsByTagName('status');
- callback(undefined, apiStatus[0].getAttribute('api'));
+ if (!end && sofar + current >= to) {
+ portion = (to - sofar) / current;
+ end = [
+ a2[0] + portion * (b2[0] - a2[0]),
+ a2[1] + portion * (b2[1] - a2[1])
+ ];
+ i1 = i4 + 1;
+ }
+ sofar += current;
+ }
+ var result = points2.slice(i0, i1);
+ result.unshift(start3);
+ result.push(end);
+ return result;
}
- d3.xml(url + '/api/capabilities').get()
- .on('load', done)
- .on('error', callback);
- };
-
- function abortRequest(i) { i.abort(); }
-
- connection.tileZoom = function(_) {
- if (!arguments.length) return tileZoom;
- tileZoom = _;
- return connection;
- };
-
- connection.loadTiles = function(projection, dimensions, callback) {
-
- if (off) return;
-
- var s = projection.scale() * 2 * Math.PI,
- z = Math.max(Math.log(s) / Math.log(2) - 8, 0),
- ts = 256 * Math.pow(2, z - tileZoom),
- origin = [
- s / 2 - projection.translate()[0],
- s / 2 - projection.translate()[1]];
-
- var tiles = d3.geo.tile()
- .scaleExtent([tileZoom, tileZoom])
- .scale(s)
- .size(dimensions)
- .translate(projection.translate())()
- .map(function(tile) {
- var x = tile[0] * ts - origin[0],
- y = tile[1] * ts - origin[1];
-
- return {
- id: tile.toString(),
- extent: iD.geo.Extent(
- projection.invert([x, y + ts]),
- projection.invert([x + ts, y]))
- };
- });
-
- function bboxUrl(tile) {
- return url + '/api/0.6/map?bbox=' + tile.extent.toParam();
+ }
+ function getAreaLabel(entity2, width2, height) {
+ var centroid = path.centroid(entity2.asGeoJSON(graph));
+ var extent = entity2.extent(graph);
+ var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
+ if (isNaN(centroid[0]) || areaWidth < 20)
+ return;
+ var preset2 = _mainPresetIndex.match(entity2, context.graph());
+ var picon = preset2 && preset2.icon;
+ var iconSize = 17;
+ var padding = 2;
+ var p2 = {};
+ if (picon) {
+ if (addIcon()) {
+ addLabel(iconSize + padding);
+ return p2;
+ }
+ } else {
+ if (addLabel(0)) {
+ return p2;
+ }
}
-
- _.filter(inflight, function(v, i) {
- var wanted = _.find(tiles, function(tile) {
- return i === tile.id;
- });
- if (!wanted) delete inflight[i];
- return !wanted;
- }).map(abortRequest);
-
- tiles.forEach(function(tile) {
- var id = tile.id;
-
- if (loadedTiles[id] || inflight[id]) return;
-
- if (_.isEmpty(inflight)) {
- event.loading();
+ function addIcon() {
+ var iconX = centroid[0] - iconSize / 2;
+ var iconY = centroid[1] - iconSize / 2;
+ var bbox2 = {
+ minX: iconX,
+ minY: iconY,
+ maxX: iconX + iconSize,
+ maxY: iconY + iconSize
+ };
+ if (tryInsert([bbox2], entity2.id + "I", true)) {
+ p2.transform = "translate(" + iconX + "," + iconY + ")";
+ return true;
+ }
+ return false;
+ }
+ function addLabel(yOffset) {
+ if (width2 && areaWidth >= width2 + 20) {
+ var labelX = centroid[0];
+ var labelY = centroid[1] + yOffset;
+ var bbox2 = {
+ minX: labelX - width2 / 2 - padding,
+ minY: labelY - height / 2 - padding,
+ maxX: labelX + width2 / 2 + padding,
+ maxY: labelY + height / 2 + padding
+ };
+ if (tryInsert([bbox2], entity2.id, true)) {
+ p2.x = labelX;
+ p2.y = labelY;
+ p2.textAnchor = "middle";
+ p2.height = height;
+ return true;
}
-
- inflight[id] = connection.loadFromURL(bboxUrl(tile), function(err, parsed) {
- loadedTiles[id] = true;
- delete inflight[id];
-
- if (callback) callback(err, _.extend({data: parsed}, tile));
-
- if (_.isEmpty(inflight)) {
- event.loaded();
- }
- });
+ }
+ return false;
+ }
+ }
+ function doInsert(bbox2, id2) {
+ bbox2.id = id2;
+ var oldbox = _entitybboxes[id2];
+ if (oldbox) {
+ _rdrawn.remove(oldbox);
+ }
+ _entitybboxes[id2] = bbox2;
+ _rdrawn.insert(bbox2);
+ }
+ function tryInsert(bboxes, id2, saveSkipped) {
+ var skipped = false;
+ for (var i3 = 0; i3 < bboxes.length; i3++) {
+ var bbox2 = bboxes[i3];
+ bbox2.id = id2;
+ if (bbox2.minX < 0 || bbox2.minY < 0 || bbox2.maxX > dimensions[0] || bbox2.maxY > dimensions[1]) {
+ skipped = true;
+ break;
+ }
+ if (_rdrawn.collides(bbox2)) {
+ skipped = true;
+ break;
+ }
+ }
+ _entitybboxes[id2] = bboxes;
+ if (skipped) {
+ if (saveSkipped) {
+ _rskipped.load(bboxes);
+ }
+ } else {
+ _rdrawn.load(bboxes);
+ }
+ return !skipped;
+ }
+ var layer = selection2.selectAll(".layer-osm.labels");
+ layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d) {
+ return "labels-group " + d;
+ });
+ var halo = layer.selectAll(".labels-group.halo");
+ var label = layer.selectAll(".labels-group.label");
+ var debug2 = layer.selectAll(".labels-group.debug");
+ drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
+ drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
+ drawLinePaths(layer, labelled.line, filter2, "", positions.line);
+ drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
+ drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
+ drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
+ drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
+ drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
+ drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
+ drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
+ drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
+ layer.call(filterLabels);
+ }
+ function filterLabels(selection2) {
+ var drawLayer = selection2.selectAll(".layer-osm.labels");
+ var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
+ layers.selectAll(".nolabel").classed("nolabel", false);
+ var mouse = context.map().mouse();
+ var graph = context.graph();
+ var selectedIDs = context.selectedIDs();
+ var ids = [];
+ var pad2, bbox;
+ if (mouse) {
+ pad2 = 20;
+ bbox = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
+ var nearMouse = _rdrawn.search(bbox).map(function(entity2) {
+ return entity2.id;
});
- };
-
- connection.switch = function(options) {
- url = options.url;
- oauth.options(_.extend({
- loading: authenticating,
- done: authenticated
- }, options));
- event.auth();
- connection.flush();
- return connection;
- };
-
- connection.toggle = function(_) {
- off = !_;
- return connection;
- };
-
- connection.flush = function() {
- userDetails = undefined;
- _.forEach(inflight, abortRequest);
- loadedTiles = {};
- inflight = {};
- return connection;
- };
-
- connection.loadedTiles = function(_) {
- if (!arguments.length) return loadedTiles;
- loadedTiles = _;
- return connection;
- };
-
- connection.logout = function() {
- userDetails = undefined;
- oauth.logout();
- event.auth();
- return connection;
- };
-
- connection.authenticate = function(callback) {
- userDetails = undefined;
- function done(err, res) {
- event.auth();
- if (callback) callback(err, res);
+ ids.push.apply(ids, nearMouse);
+ }
+ for (var i2 = 0; i2 < selectedIDs.length; i2++) {
+ var entity = graph.hasEntity(selectedIDs[i2]);
+ if (entity && entity.type === "node") {
+ ids.push(selectedIDs[i2]);
}
- return oauth.authenticate(done);
+ }
+ layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
+ var debug2 = selection2.selectAll(".labels-group.debug");
+ var gj = [];
+ if (context.getDebug("collision")) {
+ gj = bbox ? [{
+ type: "Polygon",
+ coordinates: [[
+ [bbox.minX, bbox.minY],
+ [bbox.maxX, bbox.minY],
+ [bbox.maxX, bbox.maxY],
+ [bbox.minX, bbox.maxY],
+ [bbox.minX, bbox.minY]
+ ]]
+ }] : [];
+ }
+ var box = debug2.selectAll(".debug-mouse").data(gj);
+ box.exit().remove();
+ box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
+ }
+ var throttleFilterLabels = throttle_default(filterLabels, 100);
+ drawLabels.observe = function(selection2) {
+ var listener = function() {
+ throttleFilterLabels(selection2);
+ };
+ selection2.on("mousemove.hidelabels", listener);
+ context.on("enter.hidelabels", listener);
};
+ drawLabels.off = function(selection2) {
+ throttleFilterLabels.cancel();
+ selection2.on("mousemove.hidelabels", null);
+ context.on("enter.hidelabels", null);
+ };
+ return drawLabels;
+ }
- return d3.rebind(connection, event, 'on');
-};
-/*
- iD.Difference represents the difference between two graphs.
- It knows how to calculate the set of entities that were
- created, modified, or deleted, and also contains the logic
- for recursively extending a difference to the complete set
- of entities that will require a redraw, taking into account
- child and parent relationships.
- */
-iD.Difference = function(base, head) {
- var changes = {}, length = 0;
-
- function changed(h, b) {
- return h !== b && !_.isEqual(_.omit(h, 'v'), _.omit(b, 'v'));
+ // modules/svg/improveOSM.js
+ var _layerEnabled2 = false;
+ var _qaService2;
+ function svgImproveOSM(projection2, context, dispatch10) {
+ const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
+ const minZoom3 = 12;
+ let touchLayer = select_default2(null);
+ let drawLayer = select_default2(null);
+ let layerVisible = false;
+ function markerPath(selection2, klass) {
+ selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
+ }
+ function getService() {
+ if (services.improveOSM && !_qaService2) {
+ _qaService2 = services.improveOSM;
+ _qaService2.on("loaded", throttledRedraw);
+ } else if (!services.improveOSM && _qaService2) {
+ _qaService2 = null;
+ }
+ return _qaService2;
+ }
+ function editOn() {
+ if (!layerVisible) {
+ layerVisible = true;
+ drawLayer.style("display", "block");
+ }
+ }
+ function editOff() {
+ if (layerVisible) {
+ layerVisible = false;
+ drawLayer.style("display", "none");
+ drawLayer.selectAll(".qaItem.improveOSM").remove();
+ touchLayer.selectAll(".qaItem.improveOSM").remove();
+ }
+ }
+ function layerOn() {
+ editOn();
+ drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
+ }
+ function layerOff() {
+ throttledRedraw.cancel();
+ drawLayer.interrupt();
+ touchLayer.selectAll(".qaItem.improveOSM").remove();
+ drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
+ editOff();
+ dispatch10.call("change");
+ });
+ }
+ function updateMarkers() {
+ if (!layerVisible || !_layerEnabled2)
+ return;
+ const service = getService();
+ const selectedID = context.selectedErrorID();
+ const data = service ? service.getItems(projection2) : [];
+ const getTransform = svgPointTransform(projection2);
+ const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
+ markers.exit().remove();
+ const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
+ markersEnter.append("polygon").call(markerPath, "shadow");
+ markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
+ markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
+ markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
+ markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
+ if (touchLayer.empty())
+ return;
+ const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
+ const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d) => d.id);
+ targets.exit().remove();
+ targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
+ function sortY(a, b) {
+ return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
+ }
}
-
- _.each(head.entities, function(h, id) {
- var b = base.entities[id];
- if (changed(h, b)) {
- changes[id] = {base: b, head: h};
- length++;
+ function drawImproveOSM(selection2) {
+ const service = getService();
+ const surface = context.surface();
+ if (surface && !surface.empty()) {
+ touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
+ }
+ drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
+ drawLayer.exit().remove();
+ drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
+ if (_layerEnabled2) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ service.loadIssues(projection2);
+ updateMarkers();
+ } else {
+ editOff();
}
- });
-
- _.each(base.entities, function(b, id) {
- var h = head.entities[id];
- if (!changes[id] && changed(h, b)) {
- changes[id] = {base: b, head: h};
- length++;
+ }
+ }
+ drawImproveOSM.enabled = function(val) {
+ if (!arguments.length)
+ return _layerEnabled2;
+ _layerEnabled2 = val;
+ if (_layerEnabled2) {
+ layerOn();
+ } else {
+ layerOff();
+ if (context.selectedErrorID()) {
+ context.enter(modeBrowse(context));
}
- });
-
- function addParents(parents, result) {
- for (var i = 0; i < parents.length; i++) {
- var parent = parents[i];
-
- if (parent.id in result)
- continue;
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ drawImproveOSM.supported = () => !!getService();
+ return drawImproveOSM;
+ }
- result[parent.id] = parent;
- addParents(head.parentRelations(parent), result);
+ // modules/svg/osmose.js
+ var _layerEnabled3 = false;
+ var _qaService3;
+ function svgOsmose(projection2, context, dispatch10) {
+ const throttledRedraw = throttle_default(() => dispatch10.call("change"), 1e3);
+ const minZoom3 = 12;
+ let touchLayer = select_default2(null);
+ let drawLayer = select_default2(null);
+ let layerVisible = false;
+ function markerPath(selection2, klass) {
+ selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
+ }
+ function getService() {
+ if (services.osmose && !_qaService3) {
+ _qaService3 = services.osmose;
+ _qaService3.on("loaded", throttledRedraw);
+ } else if (!services.osmose && _qaService3) {
+ _qaService3 = null;
+ }
+ return _qaService3;
+ }
+ function editOn() {
+ if (!layerVisible) {
+ layerVisible = true;
+ drawLayer.style("display", "block");
+ }
+ }
+ function editOff() {
+ if (layerVisible) {
+ layerVisible = false;
+ drawLayer.style("display", "none");
+ drawLayer.selectAll(".qaItem.osmose").remove();
+ touchLayer.selectAll(".qaItem.osmose").remove();
+ }
+ }
+ function layerOn() {
+ editOn();
+ drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch10.call("change"));
+ }
+ function layerOff() {
+ throttledRedraw.cancel();
+ drawLayer.interrupt();
+ touchLayer.selectAll(".qaItem.osmose").remove();
+ drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
+ editOff();
+ dispatch10.call("change");
+ });
+ }
+ function updateMarkers() {
+ if (!layerVisible || !_layerEnabled3)
+ return;
+ const service = getService();
+ const selectedID = context.selectedErrorID();
+ const data = service ? service.getItems(projection2) : [];
+ const getTransform = svgPointTransform(projection2);
+ const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
+ markers.exit().remove();
+ const markersEnter = markers.enter().append("g").attr("class", (d) => `qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
+ markersEnter.append("polygon").call(markerPath, "shadow");
+ markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
+ markersEnter.append("polygon").attr("fill", (d) => service.getColor(d.item)).call(markerPath, "qaItem-fill");
+ markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
+ markers.merge(markersEnter).sort(sortY).classed("selected", (d) => d.id === selectedID).attr("transform", getTransform);
+ if (touchLayer.empty())
+ return;
+ const fillClass = context.getDebug("target") ? "pink" : "nocolor";
+ const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d) => d.id);
+ targets.exit().remove();
+ targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d) => `qaItem ${d.service} target ${fillClass} itemId-${d.id}`).attr("transform", getTransform);
+ function sortY(a, b) {
+ return a.id === selectedID ? 1 : b.id === selectedID ? -1 : b.loc[1] - a.loc[1];
+ }
+ }
+ function drawOsmose(selection2) {
+ const service = getService();
+ const surface = context.surface();
+ if (surface && !surface.empty()) {
+ touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
+ }
+ drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
+ drawLayer.exit().remove();
+ drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
+ if (_layerEnabled3) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ service.loadIssues(projection2);
+ updateMarkers();
+ } else {
+ editOff();
}
+ }
}
-
- var difference = {};
-
- difference.length = function() {
- return length;
- };
-
- difference.changes = function() {
- return changes;
- };
-
- difference.extantIDs = function() {
- var result = [];
- _.each(changes, function(change, id) {
- if (change.head) result.push(id);
+ drawOsmose.enabled = function(val) {
+ if (!arguments.length)
+ return _layerEnabled3;
+ _layerEnabled3 = val;
+ if (_layerEnabled3) {
+ getService().loadStrings().then(layerOn).catch((err) => {
+ console.log(err);
});
- return result;
+ } else {
+ layerOff();
+ if (context.selectedErrorID()) {
+ context.enter(modeBrowse(context));
+ }
+ }
+ dispatch10.call("change");
+ return this;
};
+ drawOsmose.supported = () => !!getService();
+ return drawOsmose;
+ }
- difference.modified = function() {
- var result = [];
- _.each(changes, function(change) {
- if (change.base && change.head) result.push(change.head);
+ // modules/svg/streetside.js
+ function svgStreetside(projection2, context, dispatch10) {
+ var throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ var minZoom3 = 14;
+ var minMarkerZoom = 16;
+ var minViewfieldZoom = 18;
+ var layer = select_default2(null);
+ var _viewerYaw = 0;
+ var _selectedSequence = null;
+ var _streetside;
+ function init2() {
+ if (svgStreetside.initialized)
+ return;
+ svgStreetside.enabled = false;
+ svgStreetside.initialized = true;
+ }
+ function getService() {
+ if (services.streetside && !_streetside) {
+ _streetside = services.streetside;
+ _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
+ } else if (!services.streetside && _streetside) {
+ _streetside = null;
+ }
+ return _streetside;
+ }
+ function showLayer() {
+ var service = getService();
+ if (!service)
+ return;
+ editOn();
+ layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
+ dispatch10.call("change");
+ });
+ }
+ function hideLayer() {
+ throttledRedraw.cancel();
+ layer.transition().duration(250).style("opacity", 0).on("end", editOff);
+ }
+ function editOn() {
+ layer.style("display", "block");
+ }
+ function editOff() {
+ layer.selectAll(".viewfield-group").remove();
+ layer.style("display", "none");
+ }
+ function click(d3_event, d) {
+ var service = getService();
+ if (!service)
+ return;
+ if (d.sequenceKey !== _selectedSequence) {
+ _viewerYaw = 0;
+ }
+ _selectedSequence = d.sequenceKey;
+ service.ensureViewerLoaded(context).then(function() {
+ service.selectImage(context, d.key).yaw(_viewerYaw).showViewer(context);
+ });
+ context.map().centerEase(d.loc);
+ }
+ function mouseover(d3_event, d) {
+ var service = getService();
+ if (service)
+ service.setStyles(context, d);
+ }
+ function mouseout() {
+ var service = getService();
+ if (service)
+ service.setStyles(context, null);
+ }
+ function transform2(d) {
+ var t = svgPointTransform(projection2)(d);
+ var rot = d.ca + _viewerYaw;
+ if (rot) {
+ t += " rotate(" + Math.floor(rot) + ",0,0)";
+ }
+ return t;
+ }
+ function viewerChanged() {
+ var service = getService();
+ if (!service)
+ return;
+ var viewer = service.viewer();
+ if (!viewer)
+ return;
+ _viewerYaw = viewer.getYaw();
+ if (context.map().isTransformed())
+ return;
+ layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
+ }
+ function filterBubbles(bubbles) {
+ var fromDate = context.photos().fromDate();
+ var toDate = context.photos().toDate();
+ var usernames = context.photos().usernames();
+ if (fromDate) {
+ var fromTimestamp = new Date(fromDate).getTime();
+ bubbles = bubbles.filter(function(bubble) {
+ return new Date(bubble.captured_at).getTime() >= fromTimestamp;
});
- return result;
- };
-
- difference.created = function() {
- var result = [];
- _.each(changes, function(change) {
- if (!change.base && change.head) result.push(change.head);
+ }
+ if (toDate) {
+ var toTimestamp = new Date(toDate).getTime();
+ bubbles = bubbles.filter(function(bubble) {
+ return new Date(bubble.captured_at).getTime() <= toTimestamp;
});
- return result;
- };
-
- difference.deleted = function() {
- var result = [];
- _.each(changes, function(change) {
- if (change.base && !change.head) result.push(change.base);
+ }
+ if (usernames) {
+ bubbles = bubbles.filter(function(bubble) {
+ return usernames.indexOf(bubble.captured_by) !== -1;
});
- return result;
- };
-
- difference.summary = function() {
- var relevant = {};
-
- function addEntity(entity, graph, changeType) {
- relevant[entity.id] = {
- entity: entity,
- graph: graph,
- changeType: changeType
- };
+ }
+ return bubbles;
+ }
+ function filterSequences(sequences) {
+ var fromDate = context.photos().fromDate();
+ var toDate = context.photos().toDate();
+ var usernames = context.photos().usernames();
+ if (fromDate) {
+ var fromTimestamp = new Date(fromDate).getTime();
+ sequences = sequences.filter(function(sequences2) {
+ return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
+ });
+ }
+ if (toDate) {
+ var toTimestamp = new Date(toDate).getTime();
+ sequences = sequences.filter(function(sequences2) {
+ return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
+ });
+ }
+ if (usernames) {
+ sequences = sequences.filter(function(sequences2) {
+ return usernames.indexOf(sequences2.properties.captured_by) !== -1;
+ });
+ }
+ return sequences;
+ }
+ function update() {
+ var viewer = context.container().select(".photoviewer");
+ var selected = viewer.empty() ? void 0 : viewer.datum();
+ var z = ~~context.map().zoom();
+ var showMarkers = z >= minMarkerZoom;
+ var showViewfields = z >= minViewfieldZoom;
+ var service = getService();
+ var sequences = [];
+ var bubbles = [];
+ if (context.photos().showsPanoramic()) {
+ sequences = service ? service.sequences(projection2) : [];
+ bubbles = service && showMarkers ? service.bubbles(projection2) : [];
+ sequences = filterSequences(sequences);
+ bubbles = filterBubbles(bubbles);
+ }
+ var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
+ return d.properties.key;
+ });
+ traces.exit().remove();
+ traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
+ var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d) {
+ return d.key + (d.sequenceKey ? "v1" : "v0");
+ });
+ groups.exit().remove();
+ var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
+ groupsEnter.append("g").attr("class", "viewfield-scale");
+ var markers = groups.merge(groupsEnter).sort(function(a, b) {
+ return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
+ }).attr("transform", transform2).select(".viewfield-scale");
+ markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
+ var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
+ viewfields.exit().remove();
+ viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
+ function viewfieldPath() {
+ var d = this.parentNode.__data__;
+ if (d.pano) {
+ return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
+ } else {
+ return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
}
-
- function addParents(entity) {
- var parents = head.parentWays(entity);
- for (var j = parents.length - 1; j >= 0; j--) {
- var parent = parents[j];
- if (!(parent.id in relevant)) addEntity(parent, head, 'modified');
- }
+ }
+ }
+ function drawImages(selection2) {
+ var enabled = svgStreetside.enabled;
+ var service = getService();
+ layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
+ layer.exit().remove();
+ var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
+ layerEnter.append("g").attr("class", "sequences");
+ layerEnter.append("g").attr("class", "markers");
+ layer = layerEnter.merge(layer);
+ if (enabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ update();
+ service.loadBubbles(projection2);
+ } else {
+ editOff();
}
-
- _.each(changes, function(change) {
- if (change.head && change.head.geometry(head) !== 'vertex') {
- addEntity(change.head, head, change.base ? 'modified' : 'created');
-
- } else if (change.base && change.base.geometry(base) !== 'vertex') {
- addEntity(change.base, base, 'deleted');
-
- } else if (change.base && change.head) { // modified vertex
- var moved = !_.isEqual(change.base.loc, change.head.loc),
- retagged = !_.isEqual(change.base.tags, change.head.tags);
-
- if (moved) {
- addParents(change.head);
- }
-
- if (retagged || (moved && change.head.hasInterestingTags())) {
- addEntity(change.head, head, 'modified');
- }
-
- } else if (change.head && change.head.hasInterestingTags()) { // created vertex
- addEntity(change.head, head, 'created');
-
- } else if (change.base && change.base.hasInterestingTags()) { // deleted vertex
- addEntity(change.base, base, 'deleted');
- }
- });
-
- return d3.values(relevant);
+ }
+ }
+ drawImages.enabled = function(_) {
+ if (!arguments.length)
+ return svgStreetside.enabled;
+ svgStreetside.enabled = _;
+ if (svgStreetside.enabled) {
+ showLayer();
+ context.photos().on("change.streetside", update);
+ } else {
+ hideLayer();
+ context.photos().on("change.streetside", null);
+ }
+ dispatch10.call("change");
+ return this;
};
-
- difference.complete = function(extent) {
- var result = {}, id, change;
-
- for (id in changes) {
- change = changes[id];
-
- var h = change.head,
- b = change.base,
- entity = h || b;
-
- if (extent &&
- (!h || !h.intersects(extent, head)) &&
- (!b || !b.intersects(extent, base)))
- continue;
-
- result[id] = h;
-
- if (entity.type === 'way') {
- var nh = h ? h.nodes : [],
- nb = b ? b.nodes : [],
- diff, i;
-
- diff = _.difference(nh, nb);
- for (i = 0; i < diff.length; i++) {
- result[diff[i]] = head.hasEntity(diff[i]);
- }
-
- diff = _.difference(nb, nh);
- for (i = 0; i < diff.length; i++) {
- result[diff[i]] = head.hasEntity(diff[i]);
- }
- }
-
- addParents(head.parentWays(entity), result);
- addParents(head.parentRelations(entity), result);
- }
-
- return result;
+ drawImages.supported = function() {
+ return !!getService();
};
+ init2();
+ return drawImages;
+ }
- return difference;
-};
-iD.Entity = function(attrs) {
- // For prototypal inheritance.
- if (this instanceof iD.Entity) return;
-
- // Create the appropriate subtype.
- if (attrs && attrs.type) {
- return iD.Entity[attrs.type].apply(this, arguments);
- } else if (attrs && attrs.id) {
- return iD.Entity[iD.Entity.id.type(attrs.id)].apply(this, arguments);
+ // modules/svg/mapillary_images.js
+ function svgMapillaryImages(projection2, context, dispatch10) {
+ const throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ const minZoom3 = 12;
+ const minMarkerZoom = 16;
+ const minViewfieldZoom = 18;
+ let layer = select_default2(null);
+ let _mapillary;
+ function init2() {
+ if (svgMapillaryImages.initialized)
+ return;
+ svgMapillaryImages.enabled = false;
+ svgMapillaryImages.initialized = true;
+ }
+ function getService() {
+ if (services.mapillary && !_mapillary) {
+ _mapillary = services.mapillary;
+ _mapillary.event.on("loadedImages", throttledRedraw);
+ } else if (!services.mapillary && _mapillary) {
+ _mapillary = null;
+ }
+ return _mapillary;
}
-
- // Initialize a generic Entity (used only in tests).
- return (new iD.Entity()).initialize(arguments);
-};
-
-iD.Entity.id = function(type) {
- return iD.Entity.id.fromOSM(type, iD.Entity.id.next[type]--);
-};
-
-iD.Entity.id.next = {node: -1, way: -1, relation: -1};
-
-iD.Entity.id.fromOSM = function(type, id) {
- return type[0] + id;
-};
-
-iD.Entity.id.toOSM = function(id) {
- return id.slice(1);
-};
-
-iD.Entity.id.type = function(id) {
- return {'n': 'node', 'w': 'way', 'r': 'relation'}[id[0]];
-};
-
-// A function suitable for use as the second argument to d3.selection#data().
-iD.Entity.key = function(entity) {
- return entity.id + 'v' + (entity.v || 0);
-};
-
-iD.Entity.prototype = {
- tags: {},
-
- initialize: function(sources) {
- for (var i = 0; i < sources.length; ++i) {
- var source = sources[i];
- for (var prop in source) {
- if (Object.prototype.hasOwnProperty.call(source, prop)) {
- if (source[prop] === undefined) {
- delete this[prop];
- } else {
- this[prop] = source[prop];
- }
- }
- }
- }
-
- if (!this.id && this.type) {
- this.id = iD.Entity.id(this.type);
- }
- if (!this.hasOwnProperty('visible')) {
- this.visible = true;
- }
-
- if (iD.debug) {
- Object.freeze(this);
- Object.freeze(this.tags);
-
- if (this.loc) Object.freeze(this.loc);
- if (this.nodes) Object.freeze(this.nodes);
- if (this.members) Object.freeze(this.members);
- }
-
- return this;
- },
-
- copy: function(resolver, copies) {
- if (copies[this.id])
- return copies[this.id];
-
- var copy = iD.Entity(this, {id: undefined, user: undefined, version: undefined});
- copies[this.id] = copy;
-
- return copy;
- },
-
- osmId: function() {
- return iD.Entity.id.toOSM(this.id);
- },
-
- isNew: function() {
- return this.osmId() < 0;
- },
-
- update: function(attrs) {
- return iD.Entity(this, attrs, {v: 1 + (this.v || 0)});
- },
-
- mergeTags: function(tags) {
- var merged = _.clone(this.tags), changed = false;
- for (var k in tags) {
- var t1 = merged[k],
- t2 = tags[k];
- if (!t1) {
- changed = true;
- merged[k] = t2;
- } else if (t1 !== t2) {
- changed = true;
- merged[k] = _.union(t1.split(/;\s*/), t2.split(/;\s*/)).join(';');
- }
- }
- return changed ? this.update({tags: merged}) : this;
- },
-
- intersects: function(extent, resolver) {
- return this.extent(resolver).intersects(extent);
- },
-
- isUsed: function(resolver) {
- return _.without(Object.keys(this.tags), 'area').length > 0 ||
- resolver.parentRelations(this).length > 0;
- },
-
- hasInterestingTags: function() {
- return _.keys(this.tags).some(iD.interestingTag);
- },
-
- isHighwayIntersection: function() {
- return false;
- },
-
- deprecatedTags: function() {
- var tags = _.toPairs(this.tags);
- var deprecated = {};
-
- iD.data.deprecated.forEach(function(d) {
- var match = _.toPairs(d.old)[0];
- tags.forEach(function(t) {
- if (t[0] === match[0] &&
- (t[1] === match[1] || match[1] === '*')) {
- deprecated[t[0]] = t[1];
- }
- });
- });
-
- return deprecated;
+ function showLayer() {
+ const service = getService();
+ if (!service)
+ return;
+ editOn();
+ layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
+ dispatch10.call("change");
+ });
}
-};
-iD.Graph = function(other, mutable) {
- if (!(this instanceof iD.Graph)) return new iD.Graph(other, mutable);
-
- if (other instanceof iD.Graph) {
- var base = other.base();
- this.entities = _.assign(Object.create(base.entities), other.entities);
- this._parentWays = _.assign(Object.create(base.parentWays), other._parentWays);
- this._parentRels = _.assign(Object.create(base.parentRels), other._parentRels);
-
- } else {
- this.entities = Object.create({});
- this._parentWays = Object.create({});
- this._parentRels = Object.create({});
- this.rebase(other || [], [this]);
+ function hideLayer() {
+ throttledRedraw.cancel();
+ layer.transition().duration(250).style("opacity", 0).on("end", editOff);
}
-
- this.transients = {};
- this._childNodes = {};
- this.frozen = !mutable;
-};
-
-iD.Graph.prototype = {
- hasEntity: function(id) {
- return this.entities[id];
- },
-
- entity: function(id) {
- var entity = this.entities[id];
- if (!entity) {
- throw new Error('entity ' + id + ' not found');
- }
- return entity;
- },
-
- transient: function(entity, key, fn) {
- var id = entity.id,
- transients = this.transients[id] ||
- (this.transients[id] = {});
-
- if (transients[key] !== undefined) {
- return transients[key];
- }
-
- transients[key] = fn.call(entity);
-
- return transients[key];
- },
-
- parentWays: function(entity) {
- var parents = this._parentWays[entity.id],
- result = [];
-
- if (parents) {
- for (var i = 0; i < parents.length; i++) {
- result.push(this.entity(parents[i]));
- }
- }
- return result;
- },
-
- isPoi: function(entity) {
- var parentWays = this._parentWays[entity.id];
- return !parentWays || parentWays.length === 0;
- },
-
- isShared: function(entity) {
- var parentWays = this._parentWays[entity.id];
- return parentWays && parentWays.length > 1;
- },
-
- parentRelations: function(entity) {
- var parents = this._parentRels[entity.id],
- result = [];
-
- if (parents) {
- for (var i = 0; i < parents.length; i++) {
- result.push(this.entity(parents[i]));
- }
+ function editOn() {
+ layer.style("display", "block");
+ }
+ function editOff() {
+ layer.selectAll(".viewfield-group").remove();
+ layer.style("display", "none");
+ }
+ function click(d3_event, image) {
+ const service = getService();
+ if (!service)
+ return;
+ service.ensureViewerLoaded(context).then(function() {
+ service.selectImage(context, image.id).showViewer(context);
+ });
+ context.map().centerEase(image.loc);
+ }
+ function mouseover(d3_event, image) {
+ const service = getService();
+ if (service)
+ service.setStyles(context, image);
+ }
+ function mouseout() {
+ const service = getService();
+ if (service)
+ service.setStyles(context, null);
+ }
+ function transform2(d) {
+ let t = svgPointTransform(projection2)(d);
+ if (d.ca) {
+ t += " rotate(" + Math.floor(d.ca) + ",0,0)";
+ }
+ return t;
+ }
+ function filterImages(images) {
+ const showsPano = context.photos().showsPanoramic();
+ const showsFlat = context.photos().showsFlat();
+ const fromDate = context.photos().fromDate();
+ const toDate = context.photos().toDate();
+ if (!showsPano || !showsFlat) {
+ images = images.filter(function(image) {
+ if (image.is_pano)
+ return showsPano;
+ return showsFlat;
+ });
+ }
+ if (fromDate) {
+ images = images.filter(function(image) {
+ return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
+ });
+ }
+ if (toDate) {
+ images = images.filter(function(image) {
+ return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
+ });
+ }
+ return images;
+ }
+ function filterSequences(sequences) {
+ const showsPano = context.photos().showsPanoramic();
+ const showsFlat = context.photos().showsFlat();
+ const fromDate = context.photos().fromDate();
+ const toDate = context.photos().toDate();
+ if (!showsPano || !showsFlat) {
+ sequences = sequences.filter(function(sequence) {
+ if (sequence.properties.hasOwnProperty("is_pano")) {
+ if (sequence.properties.is_pano)
+ return showsPano;
+ return showsFlat;
+ }
+ return false;
+ });
+ }
+ if (fromDate) {
+ sequences = sequences.filter(function(sequence) {
+ return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
+ });
+ }
+ if (toDate) {
+ sequences = sequences.filter(function(sequence) {
+ return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
+ });
+ }
+ return sequences;
+ }
+ function update() {
+ const z = ~~context.map().zoom();
+ const showMarkers = z >= minMarkerZoom;
+ const showViewfields = z >= minViewfieldZoom;
+ const service = getService();
+ let sequences = service ? service.sequences(projection2) : [];
+ let images = service && showMarkers ? service.images(projection2) : [];
+ images = filterImages(images);
+ sequences = filterSequences(sequences, service);
+ service.filterViewer(context);
+ let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
+ return d.properties.id;
+ });
+ traces.exit().remove();
+ traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
+ const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
+ return d.id;
+ });
+ groups.exit().remove();
+ const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
+ groupsEnter.append("g").attr("class", "viewfield-scale");
+ const markers = groups.merge(groupsEnter).sort(function(a, b) {
+ return b.loc[1] - a.loc[1];
+ }).attr("transform", transform2).select(".viewfield-scale");
+ markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
+ const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
+ viewfields.exit().remove();
+ viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
+ return this.parentNode.__data__.is_pano;
+ }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
+ function viewfieldPath() {
+ if (this.parentNode.__data__.is_pano) {
+ return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
+ } else {
+ return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
}
- return result;
- },
-
- childNodes: function(entity) {
- if (this._childNodes[entity.id]) return this._childNodes[entity.id];
- if (!entity.nodes) return [];
-
- var nodes = [];
- for (var i = 0; i < entity.nodes.length; i++) {
- nodes[i] = this.entity(entity.nodes[i]);
+ }
+ }
+ function drawImages(selection2) {
+ const enabled = svgMapillaryImages.enabled;
+ const service = getService();
+ layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
+ layer.exit().remove();
+ const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
+ layerEnter.append("g").attr("class", "sequences");
+ layerEnter.append("g").attr("class", "markers");
+ layer = layerEnter.merge(layer);
+ if (enabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ update();
+ service.loadImages(projection2);
+ } else {
+ editOff();
}
+ }
+ }
+ drawImages.enabled = function(_) {
+ if (!arguments.length)
+ return svgMapillaryImages.enabled;
+ svgMapillaryImages.enabled = _;
+ if (svgMapillaryImages.enabled) {
+ showLayer();
+ context.photos().on("change.mapillary_images", update);
+ } else {
+ hideLayer();
+ context.photos().on("change.mapillary_images", null);
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ drawImages.supported = function() {
+ return !!getService();
+ };
+ init2();
+ return drawImages;
+ }
- if (iD.debug) Object.freeze(nodes);
-
- this._childNodes[entity.id] = nodes;
- return this._childNodes[entity.id];
- },
-
- base: function() {
- return {
- 'entities': iD.util.getPrototypeOf(this.entities),
- 'parentWays': iD.util.getPrototypeOf(this._parentWays),
- 'parentRels': iD.util.getPrototypeOf(this._parentRels)
- };
- },
-
- // Unlike other graph methods, rebase mutates in place. This is because it
- // is used only during the history operation that merges newly downloaded
- // data into each state. To external consumers, it should appear as if the
- // graph always contained the newly downloaded data.
- rebase: function(entities, stack, force) {
- var base = this.base(),
- i, j, k, id;
-
- for (i = 0; i < entities.length; i++) {
- var entity = entities[i];
-
- if (!entity.visible || (!force && base.entities[entity.id]))
- continue;
+ // modules/svg/mapillary_position.js
+ function svgMapillaryPosition(projection2, context) {
+ const throttledRedraw = throttle_default(function() {
+ update();
+ }, 1e3);
+ const minZoom3 = 12;
+ const minViewfieldZoom = 18;
+ let layer = select_default2(null);
+ let _mapillary;
+ let viewerCompassAngle;
+ function init2() {
+ if (svgMapillaryPosition.initialized)
+ return;
+ svgMapillaryPosition.initialized = true;
+ }
+ function getService() {
+ if (services.mapillary && !_mapillary) {
+ _mapillary = services.mapillary;
+ _mapillary.event.on("imageChanged", throttledRedraw);
+ _mapillary.event.on("bearingChanged", function(e) {
+ viewerCompassAngle = e.bearing;
+ if (context.map().isTransformed())
+ return;
+ layer.selectAll(".viewfield-group.currentView").filter(function(d) {
+ return d.is_pano;
+ }).attr("transform", transform2);
+ });
+ } else if (!services.mapillary && _mapillary) {
+ _mapillary = null;
+ }
+ return _mapillary;
+ }
+ function editOn() {
+ layer.style("display", "block");
+ }
+ function editOff() {
+ layer.selectAll(".viewfield-group").remove();
+ layer.style("display", "none");
+ }
+ function transform2(d) {
+ let t = svgPointTransform(projection2)(d);
+ if (d.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
+ t += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
+ } else if (d.ca) {
+ t += " rotate(" + Math.floor(d.ca) + ",0,0)";
+ }
+ return t;
+ }
+ function update() {
+ const z = ~~context.map().zoom();
+ const showViewfields = z >= minViewfieldZoom;
+ const service = getService();
+ const image = service && service.getActiveImage();
+ const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d) {
+ return d.id;
+ });
+ groups.exit().remove();
+ const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
+ groupsEnter.append("g").attr("class", "viewfield-scale");
+ const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
+ markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
+ const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
+ viewfields.exit().remove();
+ viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
+ }
+ function drawImages(selection2) {
+ const service = getService();
+ layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
+ layer.exit().remove();
+ const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
+ layerEnter.append("g").attr("class", "markers");
+ layer = layerEnter.merge(layer);
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ update();
+ } else {
+ editOff();
+ }
+ }
+ drawImages.enabled = function() {
+ update();
+ return this;
+ };
+ drawImages.supported = function() {
+ return !!getService();
+ };
+ init2();
+ return drawImages;
+ }
- // Merging data into the base graph
- base.entities[entity.id] = entity;
- this._updateCalculated(undefined, entity, base.parentWays, base.parentRels);
-
- // Restore provisionally-deleted nodes that are discovered to have an extant parent
- if (entity.type === 'way') {
- for (j = 0; j < entity.nodes.length; j++) {
- id = entity.nodes[j];
- for (k = 1; k < stack.length; k++) {
- var ents = stack[k].entities;
- if (ents.hasOwnProperty(id) && ents[id] === undefined) {
- delete ents[id];
- }
- }
- }
- }
+ // modules/svg/mapillary_signs.js
+ function svgMapillarySigns(projection2, context, dispatch10) {
+ const throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ const minZoom3 = 12;
+ let layer = select_default2(null);
+ let _mapillary;
+ function init2() {
+ if (svgMapillarySigns.initialized)
+ return;
+ svgMapillarySigns.enabled = false;
+ svgMapillarySigns.initialized = true;
+ }
+ function getService() {
+ if (services.mapillary && !_mapillary) {
+ _mapillary = services.mapillary;
+ _mapillary.event.on("loadedSigns", throttledRedraw);
+ } else if (!services.mapillary && _mapillary) {
+ _mapillary = null;
+ }
+ return _mapillary;
+ }
+ function showLayer() {
+ const service = getService();
+ if (!service)
+ return;
+ service.loadSignResources(context);
+ editOn();
+ }
+ function hideLayer() {
+ throttledRedraw.cancel();
+ editOff();
+ }
+ function editOn() {
+ layer.style("display", "block");
+ }
+ function editOff() {
+ layer.selectAll(".icon-sign").remove();
+ layer.style("display", "none");
+ }
+ function click(d3_event, d) {
+ const service = getService();
+ if (!service)
+ return;
+ context.map().centerEase(d.loc);
+ const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
+ service.getDetections(d.id).then((detections) => {
+ if (detections.length) {
+ const imageId = detections[0].image.id;
+ if (imageId === selectedImageId) {
+ service.highlightDetection(detections[0]).selectImage(context, imageId);
+ } else {
+ service.ensureViewerLoaded(context).then(function() {
+ service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
+ });
+ }
}
-
- for (i = 0; i < stack.length; i++) {
- stack[i]._updateRebased();
+ });
+ }
+ function filterData(detectedFeatures) {
+ var fromDate = context.photos().fromDate();
+ var toDate = context.photos().toDate();
+ if (fromDate) {
+ var fromTimestamp = new Date(fromDate).getTime();
+ detectedFeatures = detectedFeatures.filter(function(feature3) {
+ return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
+ });
+ }
+ if (toDate) {
+ var toTimestamp = new Date(toDate).getTime();
+ detectedFeatures = detectedFeatures.filter(function(feature3) {
+ return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
+ });
+ }
+ return detectedFeatures;
+ }
+ function update() {
+ const service = getService();
+ let data = service ? service.signs(projection2) : [];
+ data = filterData(data);
+ const transform2 = svgPointTransform(projection2);
+ const signs = layer.selectAll(".icon-sign").data(data, function(d) {
+ return d.id;
+ });
+ signs.exit().remove();
+ const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
+ enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
+ return "#" + d.value;
+ });
+ enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
+ signs.merge(enter).attr("transform", transform2);
+ }
+ function drawSigns(selection2) {
+ const enabled = svgMapillarySigns.enabled;
+ const service = getService();
+ layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
+ layer.exit().remove();
+ layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
+ if (enabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ update();
+ service.loadSigns(projection2);
+ service.showSignDetections(true);
+ } else {
+ editOff();
}
- },
+ } else if (service) {
+ service.showSignDetections(false);
+ }
+ }
+ drawSigns.enabled = function(_) {
+ if (!arguments.length)
+ return svgMapillarySigns.enabled;
+ svgMapillarySigns.enabled = _;
+ if (svgMapillarySigns.enabled) {
+ showLayer();
+ context.photos().on("change.mapillary_signs", update);
+ } else {
+ hideLayer();
+ context.photos().on("change.mapillary_signs", null);
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ drawSigns.supported = function() {
+ return !!getService();
+ };
+ init2();
+ return drawSigns;
+ }
- _updateRebased: function() {
- var base = this.base(),
- i, k, child, id, keys;
-
- keys = Object.keys(this._parentWays);
- for (i = 0; i < keys.length; i++) {
- child = keys[i];
- if (base.parentWays[child]) {
- for (k = 0; k < base.parentWays[child].length; k++) {
- id = base.parentWays[child][k];
- if (!this.entities.hasOwnProperty(id) && !_.includes(this._parentWays[child], id)) {
- this._parentWays[child].push(id);
- }
- }
- }
+ // modules/svg/mapillary_map_features.js
+ function svgMapillaryMapFeatures(projection2, context, dispatch10) {
+ const throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ const minZoom3 = 12;
+ let layer = select_default2(null);
+ let _mapillary;
+ function init2() {
+ if (svgMapillaryMapFeatures.initialized)
+ return;
+ svgMapillaryMapFeatures.enabled = false;
+ svgMapillaryMapFeatures.initialized = true;
+ }
+ function getService() {
+ if (services.mapillary && !_mapillary) {
+ _mapillary = services.mapillary;
+ _mapillary.event.on("loadedMapFeatures", throttledRedraw);
+ } else if (!services.mapillary && _mapillary) {
+ _mapillary = null;
+ }
+ return _mapillary;
+ }
+ function showLayer() {
+ const service = getService();
+ if (!service)
+ return;
+ service.loadObjectResources(context);
+ editOn();
+ }
+ function hideLayer() {
+ throttledRedraw.cancel();
+ editOff();
+ }
+ function editOn() {
+ layer.style("display", "block");
+ }
+ function editOff() {
+ layer.selectAll(".icon-map-feature").remove();
+ layer.style("display", "none");
+ }
+ function click(d3_event, d) {
+ const service = getService();
+ if (!service)
+ return;
+ context.map().centerEase(d.loc);
+ const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
+ service.getDetections(d.id).then((detections) => {
+ if (detections.length) {
+ const imageId = detections[0].image.id;
+ if (imageId === selectedImageId) {
+ service.highlightDetection(detections[0]).selectImage(context, imageId);
+ } else {
+ service.ensureViewerLoaded(context).then(function() {
+ service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
+ });
+ }
}
-
- keys = Object.keys(this._parentRels);
- for (i = 0; i < keys.length; i++) {
- child = keys[i];
- if (base.parentRels[child]) {
- for (k = 0; k < base.parentRels[child].length; k++) {
- id = base.parentRels[child][k];
- if (!this.entities.hasOwnProperty(id) && !_.includes(this._parentRels[child], id)) {
- this._parentRels[child].push(id);
- }
- }
- }
+ });
+ }
+ function filterData(detectedFeatures) {
+ const fromDate = context.photos().fromDate();
+ const toDate = context.photos().toDate();
+ if (fromDate) {
+ detectedFeatures = detectedFeatures.filter(function(feature3) {
+ return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
+ });
+ }
+ if (toDate) {
+ detectedFeatures = detectedFeatures.filter(function(feature3) {
+ return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
+ });
+ }
+ return detectedFeatures;
+ }
+ function update() {
+ const service = getService();
+ let data = service ? service.mapFeatures(projection2) : [];
+ data = filterData(data);
+ const transform2 = svgPointTransform(projection2);
+ const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d) {
+ return d.id;
+ });
+ mapFeatures.exit().remove();
+ const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
+ enter.append("title").text(function(d) {
+ var id2 = d.value.replace(/--/g, ".").replace(/-/g, "_");
+ return _t("mapillary_map_features." + id2);
+ });
+ enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d) {
+ if (d.value === "object--billboard") {
+ return "#object--sign--advertisement";
}
-
- this.transients = {};
-
- // this._childNodes is not updated, under the assumption that
- // ways are always downloaded with their child nodes.
- },
-
- // Updates calculated properties (parentWays, parentRels) for the specified change
- _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
-
- parentWays = parentWays || this._parentWays;
- parentRels = parentRels || this._parentRels;
-
- var type = entity && entity.type || oldentity && oldentity.type,
- removed, added, ways, rels, i;
-
-
- if (type === 'way') {
-
- // Update parentWays
- if (oldentity && entity) {
- removed = _.difference(oldentity.nodes, entity.nodes);
- added = _.difference(entity.nodes, oldentity.nodes);
- } else if (oldentity) {
- removed = oldentity.nodes;
- added = [];
- } else if (entity) {
- removed = [];
- added = entity.nodes;
- }
- for (i = 0; i < removed.length; i++) {
- parentWays[removed[i]] = _.without(parentWays[removed[i]], oldentity.id);
- }
- for (i = 0; i < added.length; i++) {
- ways = _.without(parentWays[added[i]], entity.id);
- ways.push(entity.id);
- parentWays[added[i]] = ways;
- }
-
- } else if (type === 'relation') {
-
- // Update parentRels
- if (oldentity && entity) {
- removed = _.difference(oldentity.members, entity.members);
- added = _.difference(entity.members, oldentity);
- } else if (oldentity) {
- removed = oldentity.members;
- added = [];
- } else if (entity) {
- removed = [];
- added = entity.members;
- }
- for (i = 0; i < removed.length; i++) {
- parentRels[removed[i].id] = _.without(parentRels[removed[i].id], oldentity.id);
- }
- for (i = 0; i < added.length; i++) {
- rels = _.without(parentRels[added[i].id], entity.id);
- rels.push(entity.id);
- parentRels[added[i].id] = rels;
- }
+ return "#" + d.value;
+ });
+ enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
+ mapFeatures.merge(enter).attr("transform", transform2);
+ }
+ function drawMapFeatures(selection2) {
+ const enabled = svgMapillaryMapFeatures.enabled;
+ const service = getService();
+ layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
+ layer.exit().remove();
+ layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
+ if (enabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ update();
+ service.loadMapFeatures(projection2);
+ service.showFeatureDetections(true);
+ } else {
+ editOff();
}
- },
-
- replace: function(entity) {
- if (this.entities[entity.id] === entity)
- return this;
+ } else if (service) {
+ service.showFeatureDetections(false);
+ }
+ }
+ drawMapFeatures.enabled = function(_) {
+ if (!arguments.length)
+ return svgMapillaryMapFeatures.enabled;
+ svgMapillaryMapFeatures.enabled = _;
+ if (svgMapillaryMapFeatures.enabled) {
+ showLayer();
+ context.photos().on("change.mapillary_map_features", update);
+ } else {
+ hideLayer();
+ context.photos().on("change.mapillary_map_features", null);
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ drawMapFeatures.supported = function() {
+ return !!getService();
+ };
+ init2();
+ return drawMapFeatures;
+ }
- return this.update(function() {
- this._updateCalculated(this.entities[entity.id], entity);
- this.entities[entity.id] = entity;
+ // modules/svg/kartaview_images.js
+ function svgKartaviewImages(projection2, context, dispatch10) {
+ var throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ var minZoom3 = 12;
+ var minMarkerZoom = 16;
+ var minViewfieldZoom = 18;
+ var layer = select_default2(null);
+ var _kartaview;
+ function init2() {
+ if (svgKartaviewImages.initialized)
+ return;
+ svgKartaviewImages.enabled = false;
+ svgKartaviewImages.initialized = true;
+ }
+ function getService() {
+ if (services.kartaview && !_kartaview) {
+ _kartaview = services.kartaview;
+ _kartaview.event.on("loadedImages", throttledRedraw);
+ } else if (!services.kartaview && _kartaview) {
+ _kartaview = null;
+ }
+ return _kartaview;
+ }
+ function showLayer() {
+ var service = getService();
+ if (!service)
+ return;
+ editOn();
+ layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
+ dispatch10.call("change");
+ });
+ }
+ function hideLayer() {
+ throttledRedraw.cancel();
+ layer.transition().duration(250).style("opacity", 0).on("end", editOff);
+ }
+ function editOn() {
+ layer.style("display", "block");
+ }
+ function editOff() {
+ layer.selectAll(".viewfield-group").remove();
+ layer.style("display", "none");
+ }
+ function click(d3_event, d) {
+ var service = getService();
+ if (!service)
+ return;
+ service.ensureViewerLoaded(context).then(function() {
+ service.selectImage(context, d.key).showViewer(context);
+ });
+ context.map().centerEase(d.loc);
+ }
+ function mouseover(d3_event, d) {
+ var service = getService();
+ if (service)
+ service.setStyles(context, d);
+ }
+ function mouseout() {
+ var service = getService();
+ if (service)
+ service.setStyles(context, null);
+ }
+ function transform2(d) {
+ var t = svgPointTransform(projection2)(d);
+ if (d.ca) {
+ t += " rotate(" + Math.floor(d.ca) + ",0,0)";
+ }
+ return t;
+ }
+ function filterImages(images) {
+ var fromDate = context.photos().fromDate();
+ var toDate = context.photos().toDate();
+ var usernames = context.photos().usernames();
+ if (fromDate) {
+ var fromTimestamp = new Date(fromDate).getTime();
+ images = images.filter(function(item) {
+ return new Date(item.captured_at).getTime() >= fromTimestamp;
});
- },
-
- remove: function(entity) {
- return this.update(function() {
- this._updateCalculated(entity, undefined);
- this.entities[entity.id] = undefined;
+ }
+ if (toDate) {
+ var toTimestamp = new Date(toDate).getTime();
+ images = images.filter(function(item) {
+ return new Date(item.captured_at).getTime() <= toTimestamp;
});
- },
-
- revert: function(id) {
- var baseEntity = this.base().entities[id],
- headEntity = this.entities[id];
-
- if (headEntity === baseEntity)
- return this;
-
- return this.update(function() {
- this._updateCalculated(headEntity, baseEntity);
- delete this.entities[id];
+ }
+ if (usernames) {
+ images = images.filter(function(item) {
+ return usernames.indexOf(item.captured_by) !== -1;
});
- },
-
- update: function() {
- var graph = this.frozen ? iD.Graph(this, true) : this;
-
- for (var i = 0; i < arguments.length; i++) {
- arguments[i].call(graph, graph);
- }
-
- if (this.frozen) graph.frozen = true;
-
- return graph;
- },
-
- // Obliterates any existing entities
- load: function(entities) {
- var base = this.base();
- this.entities = Object.create(base.entities);
-
- for (var i in entities) {
- this.entities[i] = entities[i];
- this._updateCalculated(base.entities[i], this.entities[i]);
+ }
+ return images;
+ }
+ function filterSequences(sequences) {
+ var fromDate = context.photos().fromDate();
+ var toDate = context.photos().toDate();
+ var usernames = context.photos().usernames();
+ if (fromDate) {
+ var fromTimestamp = new Date(fromDate).getTime();
+ sequences = sequences.filter(function(image) {
+ return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
+ });
+ }
+ if (toDate) {
+ var toTimestamp = new Date(toDate).getTime();
+ sequences = sequences.filter(function(image) {
+ return new Date(image.properties.captured_at).getTime() <= toTimestamp;
+ });
+ }
+ if (usernames) {
+ sequences = sequences.filter(function(image) {
+ return usernames.indexOf(image.properties.captured_by) !== -1;
+ });
+ }
+ return sequences;
+ }
+ function update() {
+ var viewer = context.container().select(".photoviewer");
+ var selected = viewer.empty() ? void 0 : viewer.datum();
+ var z = ~~context.map().zoom();
+ var showMarkers = z >= minMarkerZoom;
+ var showViewfields = z >= minViewfieldZoom;
+ var service = getService();
+ var sequences = [];
+ var images = [];
+ if (context.photos().showsFlat()) {
+ sequences = service ? service.sequences(projection2) : [];
+ images = service && showMarkers ? service.images(projection2) : [];
+ sequences = filterSequences(sequences);
+ images = filterImages(images);
+ }
+ var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d) {
+ return d.properties.key;
+ });
+ traces.exit().remove();
+ traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
+ var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d) {
+ return d.key;
+ });
+ groups.exit().remove();
+ var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
+ groupsEnter.append("g").attr("class", "viewfield-scale");
+ var markers = groups.merge(groupsEnter).sort(function(a, b) {
+ return a === selected ? 1 : b === selected ? -1 : b.loc[1] - a.loc[1];
+ }).attr("transform", transform2).select(".viewfield-scale");
+ markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
+ var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
+ viewfields.exit().remove();
+ viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
+ }
+ function drawImages(selection2) {
+ var enabled = svgKartaviewImages.enabled, service = getService();
+ layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
+ layer.exit().remove();
+ var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
+ layerEnter.append("g").attr("class", "sequences");
+ layerEnter.append("g").attr("class", "markers");
+ layer = layerEnter.merge(layer);
+ if (enabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ update();
+ service.loadImages(projection2);
+ } else {
+ editOff();
}
+ }
+ }
+ drawImages.enabled = function(_) {
+ if (!arguments.length)
+ return svgKartaviewImages.enabled;
+ svgKartaviewImages.enabled = _;
+ if (svgKartaviewImages.enabled) {
+ showLayer();
+ context.photos().on("change.kartaview_images", update);
+ } else {
+ hideLayer();
+ context.photos().on("change.kartaview_images", null);
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ drawImages.supported = function() {
+ return !!getService();
+ };
+ init2();
+ return drawImages;
+ }
- return this;
+ // modules/svg/osm.js
+ function svgOsm(projection2, context, dispatch10) {
+ var enabled = true;
+ function drawOsm(selection2) {
+ selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d) {
+ return "layer-osm " + d;
+ });
+ selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d) {
+ return "points-group " + d;
+ });
+ }
+ function showLayer() {
+ var layer = context.surface().selectAll(".data-layer.osm");
+ layer.interrupt();
+ layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
+ dispatch10.call("change");
+ });
+ }
+ function hideLayer() {
+ var layer = context.surface().selectAll(".data-layer.osm");
+ layer.interrupt();
+ layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
+ layer.classed("disabled", true);
+ dispatch10.call("change");
+ });
}
-};
-iD.History = function(context) {
- var stack, index, tree,
- imageryUsed = ['Bing'],
- dispatch = d3.dispatch('change', 'undone', 'redone'),
- lock = iD.util.SessionMutex('lock');
-
- function perform(actions) {
- actions = Array.prototype.slice.call(actions);
-
- var annotation;
+ drawOsm.enabled = function(val) {
+ if (!arguments.length)
+ return enabled;
+ enabled = val;
+ if (enabled) {
+ showLayer();
+ } else {
+ hideLayer();
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ return drawOsm;
+ }
- if (!_.isFunction(_.last(actions))) {
- annotation = actions.pop();
+ // modules/svg/notes.js
+ var _notesEnabled = false;
+ var _osmService;
+ function svgNotes(projection2, context, dispatch10) {
+ if (!dispatch10) {
+ dispatch10 = dispatch_default("change");
+ }
+ var throttledRedraw = throttle_default(function() {
+ dispatch10.call("change");
+ }, 1e3);
+ var minZoom3 = 12;
+ var touchLayer = select_default2(null);
+ var drawLayer = select_default2(null);
+ var _notesVisible = false;
+ function markerPath(selection2, klass) {
+ selection2.attr("class", klass).attr("transform", "translate(-8, -22)").attr("d", "m17.5,0l-15,0c-1.37,0 -2.5,1.12 -2.5,2.5l0,11.25c0,1.37 1.12,2.5 2.5,2.5l3.75,0l0,3.28c0,0.38 0.43,0.6 0.75,0.37l4.87,-3.65l5.62,0c1.37,0 2.5,-1.12 2.5,-2.5l0,-11.25c0,-1.37 -1.12,-2.5 -2.5,-2.5z");
+ }
+ function getService() {
+ if (services.osm && !_osmService) {
+ _osmService = services.osm;
+ _osmService.on("loadedNotes", throttledRedraw);
+ } else if (!services.osm && _osmService) {
+ _osmService = null;
+ }
+ return _osmService;
+ }
+ function editOn() {
+ if (!_notesVisible) {
+ _notesVisible = true;
+ drawLayer.style("display", "block");
+ }
+ }
+ function editOff() {
+ if (_notesVisible) {
+ _notesVisible = false;
+ drawLayer.style("display", "none");
+ drawLayer.selectAll(".note").remove();
+ touchLayer.selectAll(".note").remove();
+ }
+ }
+ function layerOn() {
+ editOn();
+ drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
+ dispatch10.call("change");
+ });
+ }
+ function layerOff() {
+ throttledRedraw.cancel();
+ drawLayer.interrupt();
+ touchLayer.selectAll(".note").remove();
+ drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
+ editOff();
+ dispatch10.call("change");
+ });
+ }
+ function updateMarkers() {
+ if (!_notesVisible || !_notesEnabled)
+ return;
+ var service = getService();
+ var selectedID = context.selectedNoteID();
+ var data = service ? service.notes(projection2) : [];
+ var getTransform = svgPointTransform(projection2);
+ var notes = drawLayer.selectAll(".note").data(data, function(d) {
+ return d.status + d.id;
+ });
+ notes.exit().remove();
+ var notesEnter = notes.enter().append("g").attr("class", function(d) {
+ return "note note-" + d.id + " " + d.status;
+ }).classed("new", function(d) {
+ return d.id < 0;
+ });
+ notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
+ notesEnter.append("path").call(markerPath, "shadow");
+ notesEnter.append("use").attr("class", "note-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-note");
+ notesEnter.selectAll(".icon-annotation").data(function(d) {
+ return [d];
+ }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d) {
+ if (d.id < 0)
+ return "#iD-icon-plus";
+ if (d.status === "open")
+ return "#iD-icon-close";
+ return "#iD-icon-apply";
+ });
+ notes.merge(notesEnter).sort(sortY).classed("selected", function(d) {
+ var mode = context.mode();
+ var isMoving = mode && mode.id === "drag-note";
+ return !isMoving && d.id === selectedID;
+ }).attr("transform", getTransform);
+ if (touchLayer.empty())
+ return;
+ var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
+ var targets = touchLayer.selectAll(".note").data(data, function(d) {
+ return d.id;
+ });
+ targets.exit().remove();
+ targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d) {
+ var newClass = d.id < 0 ? "new" : "";
+ return "note target note-" + d.id + " " + fillClass + newClass;
+ }).attr("transform", getTransform);
+ function sortY(a, b) {
+ if (a.id === selectedID)
+ return 1;
+ if (b.id === selectedID)
+ return -1;
+ return b.loc[1] - a.loc[1];
+ }
+ }
+ function drawNotes(selection2) {
+ var service = getService();
+ var surface = context.surface();
+ if (surface && !surface.empty()) {
+ touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
+ }
+ drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
+ drawLayer.exit().remove();
+ drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
+ if (_notesEnabled) {
+ if (service && ~~context.map().zoom() >= minZoom3) {
+ editOn();
+ service.loadNotes(projection2);
+ updateMarkers();
+ } else {
+ editOff();
}
-
- var graph = stack[index].graph;
- for (var i = 0; i < actions.length; i++) {
- graph = actions[i](graph);
+ }
+ }
+ drawNotes.enabled = function(val) {
+ if (!arguments.length)
+ return _notesEnabled;
+ _notesEnabled = val;
+ if (_notesEnabled) {
+ layerOn();
+ } else {
+ layerOff();
+ if (context.selectedNoteID()) {
+ context.enter(modeBrowse(context));
}
+ }
+ dispatch10.call("change");
+ return this;
+ };
+ return drawNotes;
+ }
- return {
- graph: graph,
- annotation: annotation,
- imageryUsed: imageryUsed
- };
+ // modules/svg/touch.js
+ function svgTouch() {
+ function drawTouch(selection2) {
+ selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d) {
+ return "layer-touch " + d;
+ });
}
+ return drawTouch;
+ }
- function change(previous) {
- var difference = iD.Difference(previous, history.graph());
- dispatch.change(difference);
- return difference;
+ // modules/util/dimensions.js
+ function refresh(selection2, node) {
+ var cr = node.getBoundingClientRect();
+ var prop = [cr.width, cr.height];
+ selection2.property("__dimensions__", prop);
+ return prop;
+ }
+ function utilGetDimensions(selection2, force) {
+ if (!selection2 || selection2.empty()) {
+ return [0, 0];
}
-
- // iD uses namespaced keys so multiple installations do not conflict
- function getKey(n) {
- return 'iD_' + window.location.origin + '_' + n;
+ var node = selection2.node(), cached = selection2.property("__dimensions__");
+ return !cached || force ? refresh(selection2, node) : cached;
+ }
+ function utilSetDimensions(selection2, dimensions) {
+ if (!selection2 || selection2.empty()) {
+ return selection2;
}
+ var node = selection2.node();
+ if (dimensions === null) {
+ refresh(selection2, node);
+ return selection2;
+ }
+ return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
+ }
- var history = {
- graph: function() {
- return stack[index].graph;
- },
-
- base: function() {
- return stack[0].graph;
- },
-
- merge: function(entities, extent) {
- stack[0].graph.rebase(entities, _.map(stack, 'graph'), false);
- tree.rebase(entities, false);
-
- dispatch.change(undefined, extent);
- },
-
- perform: function() {
- var previous = stack[index].graph;
-
- stack = stack.slice(0, index + 1);
- stack.push(perform(arguments));
- index++;
-
- return change(previous);
- },
-
- replace: function() {
- var previous = stack[index].graph;
-
- // assert(index == stack.length - 1)
- stack[index] = perform(arguments);
-
- return change(previous);
- },
-
- pop: function() {
- var previous = stack[index].graph;
-
- if (index > 0) {
- index--;
- stack.pop();
- return change(previous);
- }
- },
-
- // 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;
-
- // Pop to the next annotated state.
- while (index > 0) {
- index--;
- if (stack[index].annotation) break;
- }
-
- dispatch.undone();
- return change(previous);
- },
-
- redo: function() {
- var previous = stack[index].graph;
-
- while (index < stack.length - 1) {
- index++;
- if (stack[index].annotation) break;
- }
-
- dispatch.redone();
- return change(previous);
- },
-
- undoAnnotation: function() {
- var i = index;
- while (i >= 0) {
- if (stack[i].annotation) return stack[i].annotation;
- i--;
- }
- },
-
- redoAnnotation: function() {
- var i = index + 1;
- while (i <= stack.length - 1) {
- if (stack[i].annotation) return stack[i].annotation;
- i++;
- }
- },
-
- intersects: function(extent) {
- return tree.intersects(extent, stack[index].graph);
- },
-
- difference: function() {
- var base = stack[0].graph,
- head = stack[index].graph;
- return iD.Difference(base, head);
- },
-
- changes: function(action) {
- var base = stack[0].graph,
- head = stack[index].graph;
+ // modules/svg/layers.js
+ function svgLayers(projection2, context) {
+ var dispatch10 = dispatch_default("change");
+ var svg2 = select_default2(null);
+ var _layers = [
+ { id: "osm", layer: svgOsm(projection2, context, dispatch10) },
+ { id: "notes", layer: svgNotes(projection2, context, dispatch10) },
+ { id: "data", layer: svgData(projection2, context, dispatch10) },
+ { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch10) },
+ { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch10) },
+ { id: "osmose", layer: svgOsmose(projection2, context, dispatch10) },
+ { id: "streetside", layer: svgStreetside(projection2, context, dispatch10) },
+ { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch10) },
+ { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch10) },
+ { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch10) },
+ { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch10) },
+ { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch10) },
+ { id: "debug", layer: svgDebug(projection2, context, dispatch10) },
+ { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch10) },
+ { id: "touch", layer: svgTouch(projection2, context, dispatch10) }
+ ];
+ function drawLayers(selection2) {
+ svg2 = selection2.selectAll(".surface").data([0]);
+ svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
+ var defs = svg2.selectAll(".surface-defs").data([0]);
+ defs.enter().append("defs").attr("class", "surface-defs");
+ var groups = svg2.selectAll(".data-layer").data(_layers);
+ groups.exit().remove();
+ groups.enter().append("g").attr("class", function(d) {
+ return "data-layer " + d.id;
+ }).merge(groups).each(function(d) {
+ select_default2(this).call(d.layer);
+ });
+ }
+ drawLayers.all = function() {
+ return _layers;
+ };
+ drawLayers.layer = function(id2) {
+ var obj = _layers.find(function(o) {
+ return o.id === id2;
+ });
+ return obj && obj.layer;
+ };
+ drawLayers.only = function(what) {
+ var arr = [].concat(what);
+ var all = _layers.map(function(layer) {
+ return layer.id;
+ });
+ return drawLayers.remove(utilArrayDifference(all, arr));
+ };
+ drawLayers.remove = function(what) {
+ var arr = [].concat(what);
+ arr.forEach(function(id2) {
+ _layers = _layers.filter(function(o) {
+ return o.id !== id2;
+ });
+ });
+ dispatch10.call("change");
+ return this;
+ };
+ drawLayers.add = function(what) {
+ var arr = [].concat(what);
+ arr.forEach(function(obj) {
+ if ("id" in obj && "layer" in obj) {
+ _layers.push(obj);
+ }
+ });
+ dispatch10.call("change");
+ return this;
+ };
+ drawLayers.dimensions = function(val) {
+ if (!arguments.length)
+ return utilGetDimensions(svg2);
+ utilSetDimensions(svg2, val);
+ return this;
+ };
+ return utilRebind(drawLayers, dispatch10, "on");
+ }
- if (action) {
- head = action(head);
+ // modules/svg/lines.js
+ var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
+ function svgLines(projection2, context) {
+ var detected = utilDetect();
+ var highway_stack = {
+ motorway: 0,
+ motorway_link: 1,
+ trunk: 2,
+ trunk_link: 3,
+ primary: 4,
+ primary_link: 5,
+ secondary: 6,
+ tertiary: 7,
+ unclassified: 8,
+ residential: 9,
+ service: 10,
+ footway: 11
+ };
+ function drawTargets(selection2, graph, entities, filter2) {
+ var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
+ var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
+ var getPath = svgPath(projection2).geojson;
+ var activeID = context.activeID();
+ var base = context.history().base();
+ var data = { targets: [], nopes: [] };
+ entities.forEach(function(way) {
+ var features2 = svgSegmentWay(way, graph, activeID);
+ data.targets.push.apply(data.targets, features2.passive);
+ data.nopes.push.apply(data.nopes, features2.active);
+ });
+ var targetData = data.targets.filter(getPath);
+ var targets = selection2.selectAll(".line.target-allowed").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(targetData, function key(d) {
+ return d.id;
+ });
+ targets.exit().remove();
+ var segmentWasEdited = function(d) {
+ var wayID = d.properties.entity.id;
+ if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
+ return false;
+ }
+ return d.properties.nodes.some(function(n2) {
+ return !base.entities[n2.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n2.id].loc, base.entities[n2.id].loc);
+ });
+ };
+ targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d) {
+ return "way line target target-allowed " + targetClass + d.id;
+ }).classed("segment-edited", segmentWasEdited);
+ var nopeData = data.nopes.filter(getPath);
+ var nopes = selection2.selectAll(".line.target-nope").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(nopeData, function key(d) {
+ return d.id;
+ });
+ nopes.exit().remove();
+ nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d) {
+ return "way line target target-nope " + nopeClass + d.id;
+ }).classed("segment-edited", segmentWasEdited);
+ }
+ function drawLines(selection2, graph, entities, filter2) {
+ var base = context.history().base();
+ function waystack(a, b) {
+ var selected = context.selectedIDs();
+ var scoreA = selected.indexOf(a.id) !== -1 ? 20 : 0;
+ var scoreB = selected.indexOf(b.id) !== -1 ? 20 : 0;
+ if (a.tags.highway) {
+ scoreA -= highway_stack[a.tags.highway];
+ }
+ if (b.tags.highway) {
+ scoreB -= highway_stack[b.tags.highway];
+ }
+ return scoreA - scoreB;
+ }
+ function drawLineGroup(selection3, klass, isSelected) {
+ var mode = context.mode();
+ var isDrawing = mode && /^draw/.test(mode.id);
+ var selectedClass = !isDrawing && isSelected ? "selected " : "";
+ var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
+ lines.exit().remove();
+ lines.enter().append("path").attr("class", function(d) {
+ var prefix = "way line";
+ if (!d.hasInterestingTags()) {
+ var parentRelations = graph.parentRelations(d);
+ var parentMultipolygons = parentRelations.filter(function(relation) {
+ return relation.isMultipolygon();
+ });
+ if (parentMultipolygons.length > 0 && parentRelations.length === parentMultipolygons.length) {
+ prefix = "relation area";
}
-
- var difference = iD.Difference(base, head);
-
- return {
- modified: difference.modified(),
- created: difference.created(),
- deleted: difference.deleted()
- };
- },
-
- validate: function(changes) {
- return _(iD.validations)
- .map(function(fn) { return fn()(changes, stack[index].graph); })
- .flatten()
- .value();
- },
-
- hasChanges: function() {
- return this.difference().length() > 0;
- },
-
- imageryUsed: function(sources) {
- if (sources) {
- imageryUsed = sources;
- return history;
+ }
+ var oldMPClass = oldMultiPolygonOuters[d.id] ? "old-multipolygon " : "";
+ return prefix + " " + klass + " " + selectedClass + oldMPClass + d.id;
+ }).classed("added", function(d) {
+ return !base.entities[d.id];
+ }).classed("geometry-edited", function(d) {
+ return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d.id].nodes, base.entities[d.id].nodes);
+ }).classed("retagged", function(d) {
+ return graph.entities[d.id] && base.entities[d.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
+ }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
+ return selection3;
+ }
+ function getPathData(isSelected) {
+ return function() {
+ var layer = this.parentNode.__data__;
+ var data = pathdata[layer] || [];
+ return data.filter(function(d) {
+ if (isSelected) {
+ return context.selectedIDs().indexOf(d.id) !== -1;
} else {
- return _(stack.slice(1, index + 1))
- .map('imageryUsed')
- .flatten()
- .uniq()
- .without(undefined, 'Custom')
- .value();
+ return context.selectedIDs().indexOf(d.id) === -1;
}
- },
-
- reset: function() {
- stack = [{graph: iD.Graph()}];
- index = 0;
- tree = iD.Tree(stack[0].graph);
- dispatch.change();
- return history;
- },
-
- toJSON: function() {
- if (!this.hasChanges()) return;
-
- var allEntities = {},
- baseEntities = {},
- base = stack[0];
-
- var s = stack.map(function(i) {
- var modified = [], deleted = [];
-
- _.forEach(i.graph.entities, function(entity, id) {
- if (entity) {
- var key = iD.Entity.key(entity);
- allEntities[key] = entity;
- modified.push(key);
- } else {
- deleted.push(id);
- }
-
- // make sure that the originals of changed or deleted entities get merged
- // into the base of the stack after restoring the data from JSON.
- if (id in base.graph.entities) {
- baseEntities[id] = base.graph.entities[id];
- }
- // get originals of parent entities too
- _.forEach(base.graph._parentWays[id], function(parentId) {
- if (parentId in base.graph.entities) {
- baseEntities[parentId] = base.graph.entities[parentId];
- }
- });
- });
-
- var x = {};
-
- if (modified.length) x.modified = modified;
- if (deleted.length) x.deleted = deleted;
- if (i.imageryUsed) x.imageryUsed = i.imageryUsed;
- if (i.annotation) x.annotation = i.annotation;
-
- return x;
- });
-
- return JSON.stringify({
- version: 3,
- entities: _.values(allEntities),
- baseEntities: _.values(baseEntities),
- stack: s,
- nextIDs: iD.Entity.id.next,
- index: index
- });
- },
-
- fromJSON: function(json, loadChildNodes) {
- var h = JSON.parse(json),
- loadComplete = true;
-
- iD.Entity.id.next = h.nextIDs;
- index = h.index;
-
- if (h.version === 2 || h.version === 3) {
- var allEntities = {};
-
- h.entities.forEach(function(entity) {
- allEntities[iD.Entity.key(entity)] = iD.Entity(entity);
- });
+ });
+ };
+ }
+ function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
+ var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
+ markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
+ var markers = markergroup.selectAll("path").filter(filter2).data(function data() {
+ return groupdata[this.parentNode.__data__] || [];
+ }, function key(d) {
+ return [d.id, d.index];
+ });
+ markers.exit().remove();
+ markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d) {
+ return d.d;
+ });
+ if (detected.ie) {
+ markers.each(function() {
+ this.parentNode.insertBefore(this, this);
+ });
+ }
+ }
+ var getPath = svgPath(projection2, graph);
+ var ways = [];
+ var onewaydata = {};
+ var sideddata = {};
+ var oldMultiPolygonOuters = {};
+ for (var i2 = 0; i2 < entities.length; i2++) {
+ var entity = entities[i2];
+ var outer = osmOldMultipolygonOuterMember(entity, graph);
+ if (outer) {
+ ways.push(entity.mergeTags(outer.tags));
+ oldMultiPolygonOuters[outer.id] = true;
+ } else if (entity.geometry(graph) === "line") {
+ ways.push(entity);
+ }
+ }
+ ways = ways.filter(getPath);
+ var pathdata = utilArrayGroupBy(ways, function(way) {
+ return way.layer();
+ });
+ Object.keys(pathdata).forEach(function(k) {
+ var v = pathdata[k];
+ var onewayArr = v.filter(function(d) {
+ return d.isOneWay();
+ });
+ var onewaySegments = svgMarkerSegments(projection2, graph, 35, function shouldReverse(entity2) {
+ return entity2.tags.oneway === "-1";
+ }, function bothDirections(entity2) {
+ return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
+ });
+ onewaydata[k] = utilArrayFlatten(onewayArr.map(onewaySegments));
+ var sidedArr = v.filter(function(d) {
+ return d.isSided();
+ });
+ var sidedSegments = svgMarkerSegments(projection2, graph, 30, function shouldReverse() {
+ return false;
+ }, function bothDirections() {
+ return false;
+ });
+ sideddata[k] = utilArrayFlatten(sidedArr.map(sidedSegments));
+ });
+ var covered = selection2.selectAll(".layer-osm.covered");
+ var uncovered = selection2.selectAll(".layer-osm.lines");
+ var touchLayer = selection2.selectAll(".layer-touch.lines");
+ [covered, uncovered].forEach(function(selection3) {
+ var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
+ var layergroup = selection3.selectAll("g.layergroup").data(range3);
+ layergroup = layergroup.enter().append("g").attr("class", function(d) {
+ return "layergroup layer" + String(d);
+ }).merge(layergroup);
+ layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d) {
+ return "linegroup line-" + d;
+ });
+ layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
+ layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
+ layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
+ layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
+ layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
+ layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
+ addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
+ addMarkers(layergroup, "sided", "sidedgroup", sideddata, function marker(d) {
+ var category = graph.entity(d.id).sidednessIdentifier();
+ return "url(#ideditor-sided-marker-" + category + ")";
+ });
+ });
+ touchLayer.call(drawTargets, graph, ways, filter2);
+ }
+ return drawLines;
+ }
- 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 iD.Entity(d); });
- stack[0].graph.rebase(baseEntities, _.map(stack, 'graph'), true);
- tree.rebase(baseEntities, true);
-
- // When we restore a modified way, we also need to fetch any missing
- // childnodes that would normally have been downloaded with it.. #2142
- if (loadChildNodes) {
- var missing = _(baseEntities)
- .filter({ type: 'way' })
- .map('nodes')
- .flatten()
- .uniq()
- .reject(function(n) { return stack[0].graph.hasEntity(n); })
- .value();
-
- if (!_.isEmpty(missing)) {
- loadComplete = false;
- context.redrawEnable(false);
-
- var loading = iD.ui.Loading(context).blocking(true);
- context.container().call(loading);
-
- var childNodesLoaded = function(err, result) {
- if (!err) {
- var visible = _.groupBy(result.data, 'visible');
- if (!_.isEmpty(visible.true)) {
- missing = _.difference(missing, _.map(visible.true, 'id'));
- stack[0].graph.rebase(visible.true, _.map(stack, 'graph'), true);
- tree.rebase(visible.true, true);
- }
-
- // fetch older versions of nodes that were deleted..
- _.each(visible.false, function(entity) {
- context.connection()
- .loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
- });
- }
-
- if (err || _.isEmpty(missing)) {
- loading.close();
- context.redrawEnable(true);
- dispatch.change();
- }
- };
-
- context.connection().loadMultiple(missing, childNodesLoaded);
- }
- }
+ // modules/svg/midpoints.js
+ function svgMidpoints(projection2, context) {
+ var targetRadius = 8;
+ function drawTargets(selection2, graph, entities, filter2) {
+ var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
+ var getTransform = svgPointTransform(projection2).geojson;
+ var data = entities.map(function(midpoint) {
+ return {
+ type: "Feature",
+ id: midpoint.id,
+ properties: {
+ target: true,
+ entity: midpoint
+ },
+ geometry: {
+ type: "Point",
+ coordinates: midpoint.loc
+ }
+ };
+ });
+ var targets = selection2.selectAll(".midpoint.target").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(data, function key(d) {
+ return d.id;
+ });
+ targets.exit().remove();
+ targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d) {
+ return "node midpoint target " + fillClass + d.id;
+ }).attr("transform", getTransform);
+ }
+ function drawMidpoints(selection2, graph, entities, filter2, extent) {
+ var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
+ var touchLayer = selection2.selectAll(".layer-touch.points");
+ var mode = context.mode();
+ if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
+ drawLayer.selectAll(".midpoint").remove();
+ touchLayer.selectAll(".midpoint.target").remove();
+ return;
+ }
+ var poly = extent.polygon();
+ var midpoints = {};
+ for (var i2 = 0; i2 < entities.length; i2++) {
+ var entity = entities[i2];
+ if (entity.type !== "way")
+ continue;
+ if (!filter2(entity))
+ continue;
+ if (context.selectedIDs().indexOf(entity.id) < 0)
+ continue;
+ var nodes = graph.childNodes(entity);
+ for (var j2 = 0; j2 < nodes.length - 1; j2++) {
+ var a = nodes[j2];
+ var b = nodes[j2 + 1];
+ var id2 = [a.id, b.id].sort().join("-");
+ if (midpoints[id2]) {
+ midpoints[id2].parents.push(entity);
+ } else if (geoVecLength(projection2(a.loc), projection2(b.loc)) > 40) {
+ var point = geoVecInterp(a.loc, b.loc, 0.5);
+ var loc = null;
+ if (extent.intersects(point)) {
+ loc = point;
+ } else {
+ for (var k = 0; k < 4; k++) {
+ point = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]);
+ if (point && geoVecLength(projection2(a.loc), projection2(point)) > 20 && geoVecLength(projection2(b.loc), projection2(point)) > 20) {
+ loc = point;
+ break;
}
-
- stack = h.stack.map(function(d) {
- var entities = {}, entity;
-
- if (d.modified) {
- d.modified.forEach(function(key) {
- entity = allEntities[key];
- entities[entity.id] = entity;
- });
- }
-
- if (d.deleted) {
- d.deleted.forEach(function(id) {
- entities[id] = undefined;
- });
- }
-
- return {
- graph: iD.Graph(stack[0].graph).load(entities),
- annotation: d.annotation,
- imageryUsed: d.imageryUsed
- };
- });
-
- } else { // original version
- stack = h.stack.map(function(d) {
- var entities = {};
-
- for (var i in d.entities) {
- var entity = d.entities[i];
- entities[i] = entity === 'undefined' ? undefined : iD.Entity(entity);
- }
-
- d.graph = iD.Graph(stack[0].graph).load(entities);
- return d;
- });
+ }
}
-
- if (loadComplete) {
- dispatch.change();
+ if (loc) {
+ midpoints[id2] = {
+ type: "midpoint",
+ id: id2,
+ loc,
+ edge: [a.id, b.id],
+ parents: [entity]
+ };
}
+ }
+ }
+ }
+ function midpointFilter(d) {
+ if (midpoints[d.id])
+ return true;
+ for (var i3 = 0; i3 < d.parents.length; i3++) {
+ if (filter2(d.parents[i3])) {
+ return true;
+ }
+ }
+ return false;
+ }
+ var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d) {
+ return d.id;
+ });
+ groups.exit().remove();
+ var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
+ enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
+ enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
+ groups = groups.merge(enter).attr("transform", function(d) {
+ var translate = svgPointTransform(projection2);
+ var a2 = graph.entity(d.edge[0]);
+ var b2 = graph.entity(d.edge[1]);
+ var angle2 = geoAngle(a2, b2, projection2) * (180 / Math.PI);
+ return translate(d) + " rotate(" + angle2 + ")";
+ }).call(svgTagClasses().tags(function(d) {
+ return d.parents[0].tags;
+ }));
+ groups.select("polygon.shadow");
+ groups.select("polygon.fill");
+ touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
+ }
+ return drawMidpoints;
+ }
- return history;
- },
-
- save: function() {
- if (lock.locked()) context.storage(getKey('saved_history'), history.toJSON() || null);
- return history;
- },
-
- clearSaved: function() {
- context.debouncedSave.cancel();
- if (lock.locked()) context.storage(getKey('saved_history'), null);
- return history;
- },
-
- lock: function() {
- return lock.lock();
- },
-
- unlock: function() {
- lock.unlock();
- },
-
- // is iD not open in another window and it detects that
- // there's a history stored in localStorage that's recoverable?
- restorableChanges: function() {
- return lock.locked() && !!context.storage(getKey('saved_history'));
- },
-
- // load history from a version stored in localStorage
- restore: function() {
- if (!lock.locked()) return;
-
- var json = context.storage(getKey('saved_history'));
- if (json) history.fromJSON(json, true);
- },
-
- _getKey: getKey
-
- };
-
- history.reset();
-
- return d3.rebind(history, dispatch, 'on');
-};
-iD.Node = iD.Entity.node = function iD_Node() {
- if (!(this instanceof iD_Node)) {
- return (new iD_Node()).initialize(arguments);
- } else if (arguments.length) {
- this.initialize(arguments);
- }
-};
-
-iD.Node.prototype = Object.create(iD.Entity.prototype);
-
-_.extend(iD.Node.prototype, {
- type: 'node',
-
- extent: function() {
- return new iD.geo.Extent(this.loc);
- },
-
- geometry: function(graph) {
- return graph.transient(this, 'geometry', function() {
- return graph.isPoi(this) ? 'point' : 'vertex';
+ // modules/svg/points.js
+ var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
+ function svgPoints(projection2, context) {
+ function markerPath(selection2, klass) {
+ selection2.attr("class", klass).attr("transform", "translate(-8, -23)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
+ }
+ function sortY(a, b) {
+ return b.loc[1] - a.loc[1];
+ }
+ function fastEntityKey(d) {
+ var mode = context.mode();
+ var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
+ return isMoving ? d.id : osmEntity.key(d);
+ }
+ function drawTargets(selection2, graph, entities, filter2) {
+ var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
+ var getTransform = svgPointTransform(projection2).geojson;
+ var activeID = context.activeID();
+ var data = [];
+ entities.forEach(function(node) {
+ if (activeID === node.id)
+ return;
+ data.push({
+ type: "Feature",
+ id: node.id,
+ properties: {
+ target: true,
+ entity: node
+ },
+ geometry: node.asGeoJSON()
});
- },
+ });
+ var targets = selection2.selectAll(".point.target").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(data, function key(d) {
+ return d.id;
+ });
+ targets.exit().remove();
+ targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d) {
+ return "node point target " + fillClass + d.id;
+ }).attr("transform", getTransform);
+ }
+ function drawPoints(selection2, graph, entities, filter2) {
+ var wireframe = context.surface().classed("fill-wireframe");
+ var zoom = geoScaleToZoom(projection2.scale());
+ var base = context.history().base();
+ function renderAsPoint(entity) {
+ return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
+ }
+ var points = wireframe ? [] : entities.filter(renderAsPoint);
+ points.sort(sortY);
+ var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
+ var touchLayer = selection2.selectAll(".layer-touch.points");
+ var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
+ groups.exit().remove();
+ var enter = groups.enter().append("g").attr("class", function(d) {
+ return "node point " + d.id;
+ }).order();
+ enter.append("path").call(markerPath, "shadow");
+ enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
+ enter.append("path").call(markerPath, "stroke");
+ enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
+ groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d) {
+ return !base.entities[d.id];
+ }).classed("moved", function(d) {
+ return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
+ }).classed("retagged", function(d) {
+ return base.entities[d.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
+ }).call(svgTagClasses());
+ groups.select(".shadow");
+ groups.select(".stroke");
+ groups.select(".icon").attr("xlink:href", function(entity) {
+ var preset = _mainPresetIndex.match(entity, graph);
+ var picon = preset && preset.icon;
+ return picon ? "#" + picon : "";
+ });
+ touchLayer.call(drawTargets, graph, points, filter2);
+ }
+ return drawPoints;
+ }
- move: function(loc) {
- return this.update({loc: loc});
- },
+ // modules/svg/turns.js
+ function svgTurns(projection2, context) {
+ function icon2(turn) {
+ var u = turn.u ? "-u" : "";
+ if (turn.no)
+ return "#iD-turn-no" + u;
+ if (turn.only)
+ return "#iD-turn-only" + u;
+ return "#iD-turn-yes" + u;
+ }
+ function drawTurns(selection2, graph, turns) {
+ function turnTransform(d) {
+ var pxRadius = 50;
+ var toWay = graph.entity(d.to.way);
+ var toPoints = graph.childNodes(toWay).map(function(n2) {
+ return n2.loc;
+ }).map(projection2);
+ var toLength = geoPathLength(toPoints);
+ var mid = toLength / 2;
+ var toNode = graph.entity(d.to.node);
+ var toVertex = graph.entity(d.to.vertex);
+ var a = geoAngle(toVertex, toNode, projection2);
+ var o = projection2(toVertex.loc);
+ var r = d.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
+ return "translate(" + (r * Math.cos(a) + o[0]) + "," + (r * Math.sin(a) + o[1]) + ") rotate(" + a * 180 / Math.PI + ")";
+ }
+ var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
+ var touchLayer = selection2.selectAll(".layer-touch.turns");
+ var groups = drawLayer.selectAll("g.turn").data(turns, function(d) {
+ return d.key;
+ });
+ groups.exit().remove();
+ var groupsEnter = groups.enter().append("g").attr("class", function(d) {
+ return "turn " + d.key;
+ });
+ var turnsEnter = groupsEnter.filter(function(d) {
+ return !d.u;
+ });
+ turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
+ turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
+ var uEnter = groupsEnter.filter(function(d) {
+ return d.u;
+ });
+ uEnter.append("circle").attr("r", "16");
+ uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
+ groups = groups.merge(groupsEnter).attr("opacity", function(d) {
+ return d.direct === false ? "0.7" : null;
+ }).attr("transform", turnTransform);
+ groups.select("use").attr("xlink:href", icon2);
+ groups.select("rect");
+ groups.select("circle");
+ var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
+ groups = touchLayer.selectAll("g.turn").data(turns, function(d) {
+ return d.key;
+ });
+ groups.exit().remove();
+ groupsEnter = groups.enter().append("g").attr("class", function(d) {
+ return "turn " + d.key;
+ });
+ turnsEnter = groupsEnter.filter(function(d) {
+ return !d.u;
+ });
+ turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
+ uEnter = groupsEnter.filter(function(d) {
+ return d.u;
+ });
+ uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
+ groups = groups.merge(groupsEnter).attr("transform", turnTransform);
+ groups.select("rect");
+ groups.select("circle");
+ return this;
+ }
+ return drawTurns;
+ }
- isIntersection: function(resolver) {
- return resolver.transient(this, 'isIntersection', function() {
- return resolver.parentWays(this).filter(function(parent) {
- return (parent.tags.highway ||
- parent.tags.waterway ||
- parent.tags.railway ||
- parent.tags.aeroway) &&
- parent.geometry(resolver) === 'line';
- }).length > 1;
+ // modules/svg/vertices.js
+ var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
+ function svgVertices(projection2, context) {
+ var radiuses = {
+ shadow: [6, 7.5, 7.5, 12],
+ stroke: [2.5, 3.5, 3.5, 8],
+ fill: [1, 1.5, 1.5, 1.5]
+ };
+ var _currHoverTarget;
+ var _currPersistent = {};
+ var _currHover = {};
+ var _prevHover = {};
+ var _currSelected = {};
+ var _prevSelected = {};
+ var _radii = {};
+ function sortY(a, b) {
+ return b.loc[1] - a.loc[1];
+ }
+ function fastEntityKey(d) {
+ var mode = context.mode();
+ var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
+ return isMoving ? d.id : osmEntity.key(d);
+ }
+ function draw(selection2, graph, vertices, sets2, filter2) {
+ sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
+ var icons = {};
+ var directions = {};
+ var wireframe = context.surface().classed("fill-wireframe");
+ var zoom = geoScaleToZoom(projection2.scale());
+ var z = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
+ var activeID = context.activeID();
+ var base = context.history().base();
+ function getIcon(d) {
+ var entity = graph.entity(d.id);
+ if (entity.id in icons)
+ return icons[entity.id];
+ icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
+ return icons[entity.id];
+ }
+ function getDirections(entity) {
+ if (entity.id in directions)
+ return directions[entity.id];
+ var angles = entity.directions(graph, projection2);
+ directions[entity.id] = angles.length ? angles : false;
+ return angles;
+ }
+ function updateAttributes(selection3) {
+ ["shadow", "stroke", "fill"].forEach(function(klass) {
+ var rads = radiuses[klass];
+ selection3.selectAll("." + klass).each(function(entity) {
+ var i2 = z && getIcon(entity);
+ var r = rads[i2 ? 3 : z];
+ if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
+ r += 1.5;
+ }
+ if (klass === "shadow") {
+ _radii[entity.id] = r;
+ }
+ select_default2(this).attr("r", r).attr("visibility", i2 && klass === "fill" ? "hidden" : null);
+ });
});
- },
-
- isHighwayIntersection: function(resolver) {
- return resolver.transient(this, 'isHighwayIntersection', function() {
- return resolver.parentWays(this).filter(function(parent) {
- return parent.tags.highway && parent.geometry(resolver) === 'line';
- }).length > 1;
+ }
+ vertices.sort(sortY);
+ var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
+ groups.exit().remove();
+ var enter = groups.enter().append("g").attr("class", function(d) {
+ return "node vertex " + d.id;
+ }).order();
+ enter.append("circle").attr("class", "shadow");
+ enter.append("circle").attr("class", "stroke");
+ enter.filter(function(d) {
+ return d.hasInterestingTags();
+ }).append("circle").attr("class", "fill");
+ groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d) {
+ return d.id in sets2.selected;
+ }).classed("shared", function(d) {
+ return graph.isShared(d);
+ }).classed("endpoint", function(d) {
+ return d.isEndpoint(graph);
+ }).classed("added", function(d) {
+ return !base.entities[d.id];
+ }).classed("moved", function(d) {
+ return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].loc, base.entities[d.id].loc);
+ }).classed("retagged", function(d) {
+ return base.entities[d.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d.id].tags, base.entities[d.id].tags);
+ }).call(updateAttributes);
+ var iconUse = groups.selectAll(".icon").data(function data(d) {
+ return zoom >= 17 && getIcon(d) ? [d] : [];
+ }, fastEntityKey);
+ iconUse.exit().remove();
+ iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d) {
+ var picon = getIcon(d);
+ return picon ? "#" + picon : "";
+ });
+ var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d) {
+ return zoom >= 18 && getDirections(d) ? [d] : [];
+ }, fastEntityKey);
+ dgroups.exit().remove();
+ dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
+ var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d) {
+ return osmEntity.key(d);
+ });
+ viewfields.exit().remove();
+ viewfields.enter().append("path").attr("class", "viewfield").attr("d", "M0,0H0").merge(viewfields).attr("marker-start", "url(#ideditor-viewfield-marker" + (wireframe ? "-wireframe" : "") + ")").attr("transform", function(d) {
+ return "rotate(" + d + ")";
+ });
+ }
+ function drawTargets(selection2, graph, entities, filter2) {
+ var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
+ var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
+ var getTransform = svgPointTransform(projection2).geojson;
+ var activeID = context.activeID();
+ var data = { targets: [], nopes: [] };
+ entities.forEach(function(node) {
+ if (activeID === node.id)
+ return;
+ var vertexType = svgPassiveVertex(node, graph, activeID);
+ if (vertexType !== 0) {
+ data.targets.push({
+ type: "Feature",
+ id: node.id,
+ properties: {
+ target: true,
+ entity: node
+ },
+ geometry: node.asGeoJSON()
+ });
+ } else {
+ data.nopes.push({
+ type: "Feature",
+ id: node.id + "-nope",
+ properties: {
+ nope: true,
+ target: true,
+ entity: node
+ },
+ geometry: node.asGeoJSON()
+ });
+ }
+ });
+ var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(data.targets, function key(d) {
+ return d.id;
+ });
+ targets.exit().remove();
+ targets.enter().append("circle").attr("r", function(d) {
+ return _radii[d.id] || radiuses.shadow[3];
+ }).merge(targets).attr("class", function(d) {
+ return "node vertex target target-allowed " + targetClass + d.id;
+ }).attr("transform", getTransform);
+ var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d) {
+ return filter2(d.properties.entity);
+ }).data(data.nopes, function key(d) {
+ return d.id;
+ });
+ nopes.exit().remove();
+ nopes.enter().append("circle").attr("r", function(d) {
+ return _radii[d.properties.entity.id] || radiuses.shadow[3];
+ }).merge(nopes).attr("class", function(d) {
+ return "node vertex target target-nope " + nopeClass + d.id;
+ }).attr("transform", getTransform);
+ }
+ function renderAsVertex(entity, graph, wireframe, zoom) {
+ var geometry = entity.geometry(graph);
+ return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
+ }
+ function isEditedNode(node, base, head) {
+ var baseNode = base.entities[node.id];
+ var headNode = head.entities[node.id];
+ return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
+ }
+ function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
+ var results = {};
+ var seenIds = {};
+ function addChildVertices(entity) {
+ if (seenIds[entity.id])
+ return;
+ seenIds[entity.id] = true;
+ var geometry = entity.geometry(graph);
+ if (!context.features().isHiddenFeature(entity, graph, geometry)) {
+ var i2;
+ if (entity.type === "way") {
+ for (i2 = 0; i2 < entity.nodes.length; i2++) {
+ var child = graph.hasEntity(entity.nodes[i2]);
+ if (child) {
+ addChildVertices(child);
+ }
+ }
+ } else if (entity.type === "relation") {
+ for (i2 = 0; i2 < entity.members.length; i2++) {
+ var member = graph.hasEntity(entity.members[i2].id);
+ if (member) {
+ addChildVertices(member);
+ }
+ }
+ } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
+ results[entity.id] = entity;
+ }
+ }
+ }
+ ids.forEach(function(id2) {
+ var entity = graph.hasEntity(id2);
+ if (!entity)
+ return;
+ if (entity.type === "node") {
+ if (renderAsVertex(entity, graph, wireframe, zoom)) {
+ results[entity.id] = entity;
+ graph.parentWays(entity).forEach(function(entity2) {
+ addChildVertices(entity2);
+ });
+ }
+ } else {
+ addChildVertices(entity);
+ }
+ });
+ return results;
+ }
+ function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
+ var wireframe = context.surface().classed("fill-wireframe");
+ var visualDiff = context.surface().classed("highlight-edited");
+ var zoom = geoScaleToZoom(projection2.scale());
+ var mode = context.mode();
+ var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
+ var base = context.history().base();
+ var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
+ var touchLayer = selection2.selectAll(".layer-touch.points");
+ if (fullRedraw) {
+ _currPersistent = {};
+ _radii = {};
+ }
+ for (var i2 = 0; i2 < entities.length; i2++) {
+ var entity = entities[i2];
+ var geometry = entity.geometry(graph);
+ var keep = false;
+ if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
+ _currPersistent[entity.id] = entity;
+ keep = true;
+ } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
+ _currPersistent[entity.id] = entity;
+ keep = true;
+ }
+ if (!keep && !fullRedraw) {
+ delete _currPersistent[entity.id];
+ }
+ }
+ var sets2 = {
+ persistent: _currPersistent,
+ selected: _currSelected,
+ hovered: _currHover
+ };
+ var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
+ var filterRendered = function(d) {
+ return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter2(d);
+ };
+ drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
+ var filterTouch = function(d) {
+ return isMoving ? true : filterRendered(d);
+ };
+ touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
+ function currentVisible(which) {
+ return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
+ return entity2 && entity2.intersects(extent, graph);
});
- },
-
- asJXON: function(changeset_id) {
- var r = {
- node: {
- '@id': this.osmId(),
- '@lon': this.loc[0],
- '@lat': this.loc[1],
- '@version': (this.version || 0),
- tag: _.map(this.tags, function(v, k) {
- return { keyAttributes: { k: k, v: v } };
- })
+ }
+ }
+ drawVertices.drawSelected = function(selection2, graph, extent) {
+ var wireframe = context.surface().classed("fill-wireframe");
+ var zoom = geoScaleToZoom(projection2.scale());
+ _prevSelected = _currSelected || {};
+ if (context.map().isInWideSelection()) {
+ _currSelected = {};
+ context.selectedIDs().forEach(function(id2) {
+ var entity = graph.hasEntity(id2);
+ if (!entity)
+ return;
+ if (entity.type === "node") {
+ if (renderAsVertex(entity, graph, wireframe, zoom)) {
+ _currSelected[entity.id] = entity;
}
- };
- if (changeset_id) r.node['@changeset'] = changeset_id;
- return r;
- },
+ }
+ });
+ } else {
+ _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
+ }
+ var filter2 = function(d) {
+ return d.id in _prevSelected;
+ };
+ drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
+ };
+ drawVertices.drawHover = function(selection2, graph, target, extent) {
+ if (target === _currHoverTarget)
+ return;
+ var wireframe = context.surface().classed("fill-wireframe");
+ var zoom = geoScaleToZoom(projection2.scale());
+ _prevHover = _currHover || {};
+ _currHoverTarget = target;
+ var entity = target && target.properties && target.properties.entity;
+ if (entity) {
+ _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
+ } else {
+ _currHover = {};
+ }
+ var filter2 = function(d) {
+ return d.id in _prevHover;
+ };
+ drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
+ };
+ return drawVertices;
+ }
- asGeoJSON: function() {
- return {
- type: 'Point',
- coordinates: this.loc
+ // modules/util/bind_once.js
+ function utilBindOnce(target, type3, listener, capture) {
+ var typeOnce = type3 + ".once";
+ function one2() {
+ target.on(typeOnce, null);
+ listener.apply(this, arguments);
+ }
+ target.on(typeOnce, one2, capture);
+ return this;
+ }
+
+ // modules/util/zoom_pan.js
+ function defaultFilter3(d3_event) {
+ return !d3_event.ctrlKey && !d3_event.button;
+ }
+ function defaultExtent2() {
+ var e = this;
+ if (e instanceof SVGElement) {
+ e = e.ownerSVGElement || e;
+ if (e.hasAttribute("viewBox")) {
+ e = e.viewBox.baseVal;
+ return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
+ }
+ return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
+ }
+ return [[0, 0], [e.clientWidth, e.clientHeight]];
+ }
+ function defaultWheelDelta2(d3_event) {
+ return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
+ }
+ function defaultConstrain2(transform2, extent, translateExtent) {
+ var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
+ return transform2.translate(dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1));
+ }
+ function utilZoomPan() {
+ var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch10 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
+ function zoom(selection2) {
+ selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
+ select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
+ }
+ zoom.transform = function(collection, transform2, point) {
+ var selection2 = collection.selection ? collection.selection() : collection;
+ if (collection !== selection2) {
+ schedule(collection, transform2, point);
+ } else {
+ selection2.interrupt().each(function() {
+ gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
+ });
+ }
+ };
+ zoom.scaleBy = function(selection2, k, p) {
+ zoom.scaleTo(selection2, function() {
+ var k0 = _transform.k, k1 = typeof k === "function" ? k.apply(this, arguments) : k;
+ return k0 * k1;
+ }, p);
+ };
+ zoom.scaleTo = function(selection2, k, p) {
+ zoom.transform(selection2, function() {
+ var e = extent.apply(this, arguments), t0 = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t0.invert(p02), k1 = typeof k === "function" ? k.apply(this, arguments) : k;
+ return constrain(translate(scale(t0, k1), p02, p1), e, translateExtent);
+ }, p);
+ };
+ zoom.translateBy = function(selection2, x, y) {
+ zoom.transform(selection2, function() {
+ return constrain(_transform.translate(typeof x === "function" ? x.apply(this, arguments) : x, typeof y === "function" ? y.apply(this, arguments) : y), extent.apply(this, arguments), translateExtent);
+ });
+ };
+ zoom.translateTo = function(selection2, x, y, p) {
+ zoom.transform(selection2, function() {
+ var e = extent.apply(this, arguments), t = _transform, p02 = !p ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
+ return constrain(identity2.translate(p02[0], p02[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent);
+ }, p);
+ };
+ function scale(transform2, k) {
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
+ return k === transform2.k ? transform2 : new Transform(k, transform2.x, transform2.y);
+ }
+ function translate(transform2, p02, p1) {
+ var x = p02[0] - p1[0] * transform2.k, y = p02[1] - p1[1] * transform2.k;
+ return x === transform2.x && y === transform2.y ? transform2 : new Transform(transform2.k, x, y);
+ }
+ function centroid(extent2) {
+ return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
+ }
+ function schedule(transition2, transform2, point) {
+ transition2.on("start.zoom", function() {
+ gesture(this, arguments).start(null);
+ }).on("interrupt.zoom end.zoom", function() {
+ gesture(this, arguments).end(null);
+ }).tween("zoom", function() {
+ var that = this, args = arguments, g = gesture(that, args), e = extent.apply(that, args), p = !point ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point, w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = _transform, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i2 = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
+ return function(t) {
+ if (t === 1) {
+ t = b;
+ } else {
+ var l = i2(t);
+ var k = w / l[2];
+ t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
+ }
+ g.zoom(null, null, t);
};
+ });
}
-});
-iD.Relation = iD.Entity.relation = function iD_Relation() {
- if (!(this instanceof iD_Relation)) {
- return (new iD_Relation()).initialize(arguments);
- } else if (arguments.length) {
- this.initialize(arguments);
+ function gesture(that, args, clean2) {
+ return !clean2 && _activeGesture || new Gesture(that, args);
}
-};
-
-iD.Relation.prototype = Object.create(iD.Entity.prototype);
-
-iD.Relation.creationOrder = function(a, b) {
- var aId = parseInt(iD.Entity.id.toOSM(a.id), 10);
- var bId = parseInt(iD.Entity.id.toOSM(b.id), 10);
-
- if (aId < 0 || bId < 0) return aId - bId;
- return bId - aId;
-};
-
-_.extend(iD.Relation.prototype, {
- type: 'relation',
- members: [],
-
- copy: function(resolver, copies) {
- if (copies[this.id])
- return copies[this.id];
-
- var copy = iD.Entity.prototype.copy.call(this, resolver, copies);
+ function Gesture(that, args) {
+ this.that = that;
+ this.args = args;
+ this.active = 0;
+ this.extent = extent.apply(that, args);
+ }
+ Gesture.prototype = {
+ start: function(d3_event) {
+ if (++this.active === 1) {
+ _activeGesture = this;
+ dispatch10.call("start", this, d3_event);
+ }
+ return this;
+ },
+ zoom: function(d3_event, key, transform2) {
+ if (this.mouse && key !== "mouse")
+ this.mouse[1] = transform2.invert(this.mouse[0]);
+ if (this.pointer0 && key !== "touch")
+ this.pointer0[1] = transform2.invert(this.pointer0[0]);
+ if (this.pointer1 && key !== "touch")
+ this.pointer1[1] = transform2.invert(this.pointer1[0]);
+ _transform = transform2;
+ dispatch10.call("zoom", this, d3_event, key, transform2);
+ return this;
+ },
+ end: function(d3_event) {
+ if (--this.active === 0) {
+ _activeGesture = null;
+ dispatch10.call("end", this, d3_event);
+ }
+ return this;
+ }
+ };
+ function wheeled(d3_event) {
+ if (!filter2.apply(this, arguments))
+ return;
+ var g = gesture(this, arguments), t = _transform, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = utilFastMouse(this)(d3_event);
+ if (g.wheel) {
+ if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
+ g.mouse[1] = t.invert(g.mouse[0] = p);
+ }
+ clearTimeout(g.wheel);
+ } else {
+ g.mouse = [p, t.invert(p)];
+ interrupt_default(this);
+ g.start(d3_event);
+ }
+ d3_event.preventDefault();
+ d3_event.stopImmediatePropagation();
+ g.wheel = setTimeout(wheelidled, _wheelDelay);
+ g.zoom(d3_event, "mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
+ function wheelidled() {
+ g.wheel = null;
+ g.end(d3_event);
+ }
+ }
+ var _downPointerIDs = /* @__PURE__ */ new Set();
+ var _pointerLocGetter;
+ function pointerdown(d3_event) {
+ _downPointerIDs.add(d3_event.pointerId);
+ if (!filter2.apply(this, arguments))
+ return;
+ var g = gesture(this, arguments, _downPointerIDs.size === 1);
+ var started;
+ d3_event.stopImmediatePropagation();
+ _pointerLocGetter = utilFastMouse(this);
+ var loc = _pointerLocGetter(d3_event);
+ var p = [loc, _transform.invert(loc), d3_event.pointerId];
+ if (!g.pointer0) {
+ g.pointer0 = p;
+ started = true;
+ } else if (!g.pointer1 && g.pointer0[2] !== p[2]) {
+ g.pointer1 = p;
+ }
+ if (started) {
+ interrupt_default(this);
+ g.start(d3_event);
+ }
+ }
+ function pointermove(d3_event) {
+ if (!_downPointerIDs.has(d3_event.pointerId))
+ return;
+ if (!_activeGesture || !_pointerLocGetter)
+ return;
+ var g = gesture(this, arguments);
+ var isPointer0 = g.pointer0 && g.pointer0[2] === d3_event.pointerId;
+ var isPointer1 = !isPointer0 && g.pointer1 && g.pointer1[2] === d3_event.pointerId;
+ if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
+ if (g.pointer0)
+ _downPointerIDs.delete(g.pointer0[2]);
+ if (g.pointer1)
+ _downPointerIDs.delete(g.pointer1[2]);
+ g.end(d3_event);
+ return;
+ }
+ d3_event.preventDefault();
+ d3_event.stopImmediatePropagation();
+ var loc = _pointerLocGetter(d3_event);
+ var t, p, l;
+ if (isPointer0)
+ g.pointer0[0] = loc;
+ else if (isPointer1)
+ g.pointer1[0] = loc;
+ t = _transform;
+ if (g.pointer1) {
+ var p02 = g.pointer0[0], l0 = g.pointer0[1], p1 = g.pointer1[0], l1 = g.pointer1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
+ t = scale(t, Math.sqrt(dp / dl));
+ p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
+ l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
+ } else if (g.pointer0) {
+ p = g.pointer0[0];
+ l = g.pointer0[1];
+ } else {
+ return;
+ }
+ g.zoom(d3_event, "touch", constrain(translate(t, p, l), g.extent, translateExtent));
+ }
+ function pointerup(d3_event) {
+ if (!_downPointerIDs.has(d3_event.pointerId))
+ return;
+ _downPointerIDs.delete(d3_event.pointerId);
+ if (!_activeGesture)
+ return;
+ var g = gesture(this, arguments);
+ d3_event.stopImmediatePropagation();
+ if (g.pointer0 && g.pointer0[2] === d3_event.pointerId)
+ delete g.pointer0;
+ else if (g.pointer1 && g.pointer1[2] === d3_event.pointerId)
+ delete g.pointer1;
+ if (g.pointer1 && !g.pointer0) {
+ g.pointer0 = g.pointer1;
+ delete g.pointer1;
+ }
+ if (g.pointer0) {
+ g.pointer0[1] = _transform.invert(g.pointer0[0]);
+ } else {
+ g.end(d3_event);
+ }
+ }
+ zoom.wheelDelta = function(_) {
+ return arguments.length ? (wheelDelta = utilFunctor(+_), zoom) : wheelDelta;
+ };
+ zoom.filter = function(_) {
+ return arguments.length ? (filter2 = utilFunctor(!!_), zoom) : filter2;
+ };
+ zoom.extent = function(_) {
+ return arguments.length ? (extent = utilFunctor([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
+ };
+ zoom.scaleExtent = function(_) {
+ return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
+ };
+ zoom.translateExtent = function(_) {
+ return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
+ };
+ zoom.constrain = function(_) {
+ return arguments.length ? (constrain = _, zoom) : constrain;
+ };
+ zoom.interpolate = function(_) {
+ return arguments.length ? (interpolate = _, zoom) : interpolate;
+ };
+ zoom._transform = function(_) {
+ return arguments.length ? (_transform = _, zoom) : _transform;
+ };
+ return utilRebind(zoom, dispatch10, "on");
+ }
- var members = this.members.map(function(member) {
- return _.extend({}, member, {id: resolver.entity(member.id).copy(resolver, copies).id});
+ // modules/util/double_up.js
+ function utilDoubleUp() {
+ var dispatch10 = dispatch_default("doubleUp");
+ var _maxTimespan = 500;
+ var _maxDistance = 20;
+ var _pointer;
+ function pointerIsValidFor(loc) {
+ return new Date().getTime() - _pointer.startTime <= _maxTimespan && geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
+ }
+ function pointerdown(d3_event) {
+ if (d3_event.ctrlKey || d3_event.button === 2)
+ return;
+ var loc = [d3_event.clientX, d3_event.clientY];
+ if (_pointer && !pointerIsValidFor(loc)) {
+ _pointer = void 0;
+ }
+ if (!_pointer) {
+ _pointer = {
+ startLoc: loc,
+ startTime: new Date().getTime(),
+ upCount: 0,
+ pointerId: d3_event.pointerId
+ };
+ } else {
+ _pointer.pointerId = d3_event.pointerId;
+ }
+ }
+ function pointerup(d3_event) {
+ if (d3_event.ctrlKey || d3_event.button === 2)
+ return;
+ if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
+ return;
+ _pointer.upCount += 1;
+ if (_pointer.upCount === 2) {
+ var loc = [d3_event.clientX, d3_event.clientY];
+ if (pointerIsValidFor(loc)) {
+ var locInThis = utilFastMouse(this)(d3_event);
+ dispatch10.call("doubleUp", this, d3_event, locInThis);
+ }
+ _pointer = void 0;
+ }
+ }
+ function doubleUp(selection2) {
+ if ("PointerEvent" in window) {
+ selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
+ } else {
+ selection2.on("dblclick.doubleUp", function(d3_event) {
+ dispatch10.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
});
+ }
+ }
+ doubleUp.off = function(selection2) {
+ selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
+ };
+ return utilRebind(doubleUp, dispatch10, "on");
+ }
- copy = copy.update({members: members});
- copies[this.id] = copy;
-
- return copy;
- },
-
- extent: function(resolver, memo) {
- return resolver.transient(this, 'extent', function() {
- if (memo && memo[this.id]) return iD.geo.Extent();
- memo = memo || {};
- memo[this.id] = true;
-
- var extent = iD.geo.Extent();
- for (var i = 0; i < this.members.length; i++) {
- var member = resolver.hasEntity(this.members[i].id);
- if (member) {
- extent._extend(member.extent(resolver, memo));
- }
+ // modules/renderer/map.js
+ var TILESIZE = 256;
+ var minZoom2 = 2;
+ var maxZoom = 24;
+ var kMin = geoZoomToScale(minZoom2, TILESIZE);
+ var kMax = geoZoomToScale(maxZoom, TILESIZE);
+ function clamp(num, min3, max3) {
+ return Math.max(min3, Math.min(num, max3));
+ }
+ function rendererMap(context) {
+ var dispatch10 = dispatch_default("move", "drawn", "crossEditableZoom", "hitMinZoom", "changeHighlighting", "changeAreaFill");
+ var projection2 = context.projection;
+ var curtainProjection = context.curtainProjection;
+ var drawLayers;
+ var drawPoints;
+ var drawVertices;
+ var drawLines;
+ var drawAreas;
+ var drawMidpoints;
+ var drawLabels;
+ var _selection = select_default2(null);
+ var supersurface = select_default2(null);
+ var wrapper = select_default2(null);
+ var surface = select_default2(null);
+ var _dimensions = [1, 1];
+ var _dblClickZoomEnabled = true;
+ var _redrawEnabled = true;
+ var _gestureTransformStart;
+ var _transformStart = projection2.transform();
+ var _transformLast;
+ var _isTransformed = false;
+ var _minzoom = 0;
+ var _getMouseCoords;
+ var _lastPointerEvent;
+ var _lastWithinEditableZoom;
+ var _pointerDown = false;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
+ var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan).on("start.map", function(d3_event) {
+ _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
+ }).on("end.map", function() {
+ _pointerDown = false;
+ });
+ var _doubleUpHandler = utilDoubleUp();
+ var scheduleRedraw = throttle_default(redraw, 750);
+ function cancelPendingRedraw() {
+ scheduleRedraw.cancel();
+ }
+ function map2(selection2) {
+ _selection = selection2;
+ context.on("change.map", immediateRedraw);
+ var osm = context.connection();
+ if (osm) {
+ osm.on("change.map", immediateRedraw);
+ }
+ function didUndoOrRedo(targetTransform) {
+ var mode = context.mode().id;
+ if (mode !== "browse" && mode !== "select")
+ return;
+ if (targetTransform) {
+ map2.transformEase(targetTransform);
+ }
+ }
+ context.history().on("merge.map", function() {
+ scheduleRedraw();
+ }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
+ didUndoOrRedo(fromStack.transform);
+ }).on("redone.map", function(stack) {
+ didUndoOrRedo(stack.transform);
+ });
+ context.background().on("change.map", immediateRedraw);
+ context.features().on("redraw.map", immediateRedraw);
+ drawLayers.on("change.map", function() {
+ context.background().updateImagery();
+ immediateRedraw();
+ });
+ selection2.on("wheel.map mousewheel.map", function(d3_event) {
+ d3_event.preventDefault();
+ }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
+ map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
+ wrapper = supersurface.append("div").attr("class", "layer layer-data");
+ map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
+ surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
+ _lastPointerEvent = d3_event;
+ if (d3_event.button === 2) {
+ d3_event.stopPropagation();
+ }
+ }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
+ _lastPointerEvent = d3_event;
+ if (resetTransform()) {
+ immediateRedraw();
+ }
+ }).on(_pointerPrefix + "move.map", function(d3_event) {
+ _lastPointerEvent = d3_event;
+ }).on(_pointerPrefix + "over.vertices", function(d3_event) {
+ if (map2.editableDataEnabled() && !_isTransformed) {
+ var hover = d3_event.target.__data__;
+ surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
+ dispatch10.call("drawn", this, { full: false });
+ }
+ }).on(_pointerPrefix + "out.vertices", function(d3_event) {
+ if (map2.editableDataEnabled() && !_isTransformed) {
+ var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
+ surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
+ dispatch10.call("drawn", this, { full: false });
+ }
+ });
+ var detected = utilDetect();
+ if ("GestureEvent" in window && !detected.isMobileWebKit) {
+ surface.on("gesturestart.surface", function(d3_event) {
+ d3_event.preventDefault();
+ _gestureTransformStart = projection2.transform();
+ }).on("gesturechange.surface", gestureChange);
+ }
+ updateAreaFill();
+ _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
+ if (!_dblClickZoomEnabled)
+ return;
+ if (typeof d3_event.target.__data__ === "object" && !select_default2(d3_event.target).classed("fill"))
+ return;
+ var zoomOut2 = d3_event.shiftKey;
+ var t = projection2.transform();
+ var p1 = t.invert(p02);
+ t = t.scale(zoomOut2 ? 0.5 : 2);
+ t.x = p02[0] - p1[0] * t.k;
+ t.y = p02[1] - p1[1] * t.k;
+ map2.transformEase(t);
+ });
+ context.on("enter.map", function() {
+ if (!map2.editableDataEnabled(true))
+ return;
+ if (_isTransformed)
+ return;
+ var graph = context.graph();
+ var selectedAndParents = {};
+ context.selectedIDs().forEach(function(id2) {
+ var entity = graph.hasEntity(id2);
+ if (entity) {
+ selectedAndParents[entity.id] = entity;
+ if (entity.type === "node") {
+ graph.parentWays(entity).forEach(function(parent) {
+ selectedAndParents[parent.id] = parent;
+ });
}
- return extent;
+ }
});
- },
-
- geometry: function(graph) {
- return graph.transient(this, 'geometry', function() {
- return this.isMultipolygon() ? 'area' : 'relation';
+ var data = Object.values(selectedAndParents);
+ var filter2 = function(d) {
+ return d.id in selectedAndParents;
+ };
+ data = context.features().filter(data, graph);
+ surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
+ dispatch10.call("drawn", this, { full: false });
+ scheduleRedraw();
+ });
+ map2.dimensions(utilGetDimensions(selection2));
+ }
+ function zoomEventFilter(d3_event) {
+ if (d3_event.type === "mousedown") {
+ var hasOrphan = false;
+ var listeners = window.__on;
+ for (var i2 = 0; i2 < listeners.length; i2++) {
+ var listener = listeners[i2];
+ if (listener.name === "zoom" && listener.type === "mouseup") {
+ hasOrphan = true;
+ break;
+ }
+ }
+ if (hasOrphan) {
+ var event = window.CustomEvent;
+ if (event) {
+ event = new event("mouseup");
+ } else {
+ event = window.document.createEvent("Event");
+ event.initEvent("mouseup", false, false);
+ }
+ event.view = window;
+ window.dispatchEvent(event);
+ }
+ }
+ return d3_event.button !== 2;
+ }
+ function pxCenter() {
+ return [_dimensions[0] / 2, _dimensions[1] / 2];
+ }
+ function drawEditable(difference, extent) {
+ var mode = context.mode();
+ var graph = context.graph();
+ var features2 = context.features();
+ var all = context.history().intersects(map2.extent());
+ var fullRedraw = false;
+ var data;
+ var set3;
+ var filter2;
+ var applyFeatureLayerFilters = true;
+ if (map2.isInWideSelection()) {
+ data = [];
+ utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
+ var entity = context.hasEntity(id2);
+ if (entity)
+ data.push(entity);
+ });
+ fullRedraw = true;
+ filter2 = utilFunctor(true);
+ applyFeatureLayerFilters = false;
+ } else if (difference) {
+ var complete = difference.complete(map2.extent());
+ data = Object.values(complete).filter(Boolean);
+ set3 = new Set(Object.keys(complete));
+ filter2 = function(d) {
+ return set3.has(d.id);
+ };
+ features2.clear(data);
+ } else {
+ if (features2.gatherStats(all, graph, _dimensions)) {
+ extent = void 0;
+ }
+ if (extent) {
+ data = context.history().intersects(map2.extent().intersection(extent));
+ set3 = new Set(data.map(function(entity) {
+ return entity.id;
+ }));
+ filter2 = function(d) {
+ return set3.has(d.id);
+ };
+ } else {
+ data = all;
+ fullRedraw = true;
+ filter2 = utilFunctor(true);
+ }
+ }
+ if (applyFeatureLayerFilters) {
+ data = features2.filter(data, graph);
+ } else {
+ context.features().resetStats();
+ }
+ if (mode && mode.id === "select") {
+ surface.call(drawVertices.drawSelected, graph, map2.extent());
+ }
+ surface.call(drawVertices, graph, data, filter2, map2.extent(), fullRedraw).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent()).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw).call(drawPoints, graph, data, filter2);
+ dispatch10.call("drawn", this, { full: true });
+ }
+ map2.init = function() {
+ drawLayers = svgLayers(projection2, context);
+ drawPoints = svgPoints(projection2, context);
+ drawVertices = svgVertices(projection2, context);
+ drawLines = svgLines(projection2, context);
+ drawAreas = svgAreas(projection2, context);
+ drawMidpoints = svgMidpoints(projection2, context);
+ drawLabels = svgLabels(projection2, context);
+ };
+ function editOff() {
+ context.features().resetStats();
+ surface.selectAll(".layer-osm *").remove();
+ surface.selectAll(".layer-touch:not(.markers) *").remove();
+ var allowed = {
+ "browse": true,
+ "save": true,
+ "select-note": true,
+ "select-data": true,
+ "select-error": true
+ };
+ var mode = context.mode();
+ if (mode && !allowed[mode.id]) {
+ context.enter(modeBrowse(context));
+ }
+ dispatch10.call("drawn", this, { full: true });
+ }
+ function gestureChange(d3_event) {
+ var e = d3_event;
+ e.preventDefault();
+ var props = {
+ deltaMode: 0,
+ deltaY: 1,
+ clientX: e.clientX,
+ clientY: e.clientY,
+ screenX: e.screenX,
+ screenY: e.screenY,
+ x: e.x,
+ y: e.y
+ };
+ var e22 = new WheelEvent("wheel", props);
+ e22._scale = e.scale;
+ e22._rotation = e.rotation;
+ _selection.node().dispatchEvent(e22);
+ }
+ function zoomPan(event, key, transform2) {
+ var source = event && event.sourceEvent || event;
+ var eventTransform = transform2 || event && event.transform;
+ var x = eventTransform.x;
+ var y = eventTransform.y;
+ var k = eventTransform.k;
+ if (source && source.type === "wheel") {
+ if (_pointerDown)
+ return;
+ var detected = utilDetect();
+ var dX = source.deltaX;
+ var dY = source.deltaY;
+ var x2 = x;
+ var y2 = y;
+ var k2 = k;
+ var t0, p02, p1;
+ if (source.deltaMode === 1) {
+ var lines = Math.abs(source.deltaY);
+ var sign2 = source.deltaY > 0 ? 1 : -1;
+ dY = sign2 * clamp(Math.exp((lines - 1) * 0.75) * 4.000244140625, 4.000244140625, 350.000244140625);
+ if (detected.os !== "mac") {
+ dY *= 5;
+ }
+ t0 = _isTransformed ? _transformLast : _transformStart;
+ p02 = _getMouseCoords(source);
+ p1 = t0.invert(p02);
+ k2 = t0.k * Math.pow(2, -dY / 500);
+ k2 = clamp(k2, kMin, kMax);
+ x2 = p02[0] - p1[0] * k2;
+ y2 = p02[1] - p1[1] * k2;
+ } else if (source._scale) {
+ t0 = _gestureTransformStart;
+ p02 = _getMouseCoords(source);
+ p1 = t0.invert(p02);
+ k2 = t0.k * source._scale;
+ k2 = clamp(k2, kMin, kMax);
+ x2 = p02[0] - p1[0] * k2;
+ y2 = p02[1] - p1[1] * k2;
+ } else if (source.ctrlKey && !isInteger(dY)) {
+ dY *= 6;
+ t0 = _isTransformed ? _transformLast : _transformStart;
+ p02 = _getMouseCoords(source);
+ p1 = t0.invert(p02);
+ k2 = t0.k * Math.pow(2, -dY / 500);
+ k2 = clamp(k2, kMin, kMax);
+ x2 = p02[0] - p1[0] * k2;
+ y2 = p02[1] - p1[1] * k2;
+ } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
+ t0 = _isTransformed ? _transformLast : _transformStart;
+ p02 = _getMouseCoords(source);
+ p1 = t0.invert(p02);
+ k2 = t0.k * Math.pow(2, -dY / 500);
+ k2 = clamp(k2, kMin, kMax);
+ x2 = p02[0] - p1[0] * k2;
+ y2 = p02[1] - p1[1] * k2;
+ } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
+ p1 = projection2.translate();
+ x2 = p1[0] - dX;
+ y2 = p1[1] - dY;
+ k2 = projection2.scale();
+ k2 = clamp(k2, kMin, kMax);
+ }
+ if (x2 !== x || y2 !== y || k2 !== k) {
+ x = x2;
+ y = y2;
+ k = k2;
+ eventTransform = identity2.translate(x2, y2).scale(k2);
+ if (_zoomerPanner._transform) {
+ _zoomerPanner._transform(eventTransform);
+ } else {
+ _selection.node().__zoom = eventTransform;
+ }
+ }
+ }
+ if (_transformStart.x === x && _transformStart.y === y && _transformStart.k === k) {
+ return;
+ }
+ if (geoScaleToZoom(k, TILESIZE) < _minzoom) {
+ surface.interrupt();
+ dispatch10.call("hitMinZoom", this, map2);
+ setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
+ scheduleRedraw();
+ dispatch10.call("move", this, map2);
+ return;
+ }
+ projection2.transform(eventTransform);
+ var withinEditableZoom = map2.withinEditableZoom();
+ if (_lastWithinEditableZoom !== withinEditableZoom) {
+ if (_lastWithinEditableZoom !== void 0) {
+ dispatch10.call("crossEditableZoom", this, withinEditableZoom);
+ }
+ _lastWithinEditableZoom = withinEditableZoom;
+ }
+ var scale = k / _transformStart.k;
+ var tX = (x / scale - _transformStart.x) * scale;
+ var tY = (y / scale - _transformStart.y) * scale;
+ if (context.inIntro()) {
+ curtainProjection.transform({
+ x: x - tX,
+ y: y - tY,
+ k
+ });
+ }
+ if (source) {
+ _lastPointerEvent = event;
+ }
+ _isTransformed = true;
+ _transformLast = eventTransform;
+ utilSetTransform(supersurface, tX, tY, scale);
+ scheduleRedraw();
+ dispatch10.call("move", this, map2);
+ function isInteger(val) {
+ return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
+ }
+ }
+ function resetTransform() {
+ if (!_isTransformed)
+ return false;
+ utilSetTransform(supersurface, 0, 0);
+ _isTransformed = false;
+ if (context.inIntro()) {
+ curtainProjection.transform(projection2.transform());
+ }
+ return true;
+ }
+ function redraw(difference, extent) {
+ if (surface.empty() || !_redrawEnabled)
+ return;
+ if (resetTransform()) {
+ difference = extent = void 0;
+ }
+ var zoom = map2.zoom();
+ var z = String(~~zoom);
+ if (surface.attr("data-zoom") !== z) {
+ surface.attr("data-zoom", z);
+ }
+ var lat = map2.center()[1];
+ var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
+ surface.classed("low-zoom", zoom <= lowzoom(lat));
+ if (!difference) {
+ supersurface.call(context.background());
+ wrapper.call(drawLayers);
+ }
+ if (map2.editableDataEnabled() || map2.isInWideSelection()) {
+ context.loadTiles(projection2);
+ drawEditable(difference, extent);
+ } else {
+ editOff();
+ }
+ _transformStart = projection2.transform();
+ return map2;
+ }
+ var immediateRedraw = function(difference, extent) {
+ if (!difference && !extent)
+ cancelPendingRedraw();
+ redraw(difference, extent);
+ };
+ map2.lastPointerEvent = function() {
+ return _lastPointerEvent;
+ };
+ map2.mouse = function(d3_event) {
+ var event = d3_event || _lastPointerEvent;
+ if (event) {
+ var s;
+ while (s = event.sourceEvent) {
+ event = s;
+ }
+ return _getMouseCoords(event);
+ }
+ return null;
+ };
+ map2.mouseCoordinates = function() {
+ var coord2 = map2.mouse() || pxCenter();
+ return projection2.invert(coord2);
+ };
+ map2.dblclickZoomEnable = function(val) {
+ if (!arguments.length)
+ return _dblClickZoomEnabled;
+ _dblClickZoomEnabled = val;
+ return map2;
+ };
+ map2.redrawEnable = function(val) {
+ if (!arguments.length)
+ return _redrawEnabled;
+ _redrawEnabled = val;
+ return map2;
+ };
+ map2.isTransformed = function() {
+ return _isTransformed;
+ };
+ function setTransform(t2, duration, force) {
+ var t = projection2.transform();
+ if (!force && t2.k === t.k && t2.x === t.x && t2.y === t.y)
+ return false;
+ if (duration) {
+ _selection.transition().duration(duration).on("start", function() {
+ map2.startEase();
+ }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
+ } else {
+ projection2.transform(t2);
+ _transformStart = t2;
+ _selection.call(_zoomerPanner.transform, _transformStart);
+ }
+ return true;
+ }
+ function setCenterZoom(loc2, z2, duration, force) {
+ var c = map2.center();
+ var z = map2.zoom();
+ if (loc2[0] === c[0] && loc2[1] === c[1] && z2 === z && !force)
+ return false;
+ var proj = geoRawMercator().transform(projection2.transform());
+ var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
+ proj.scale(k2);
+ var t = proj.translate();
+ var point = proj(loc2);
+ var center = pxCenter();
+ t[0] += center[0] - point[0];
+ t[1] += center[1] - point[1];
+ return setTransform(identity2.translate(t[0], t[1]).scale(k2), duration, force);
+ }
+ map2.pan = function(delta, duration) {
+ var t = projection2.translate();
+ var k = projection2.scale();
+ t[0] += delta[0];
+ t[1] += delta[1];
+ if (duration) {
+ _selection.transition().duration(duration).on("start", function() {
+ map2.startEase();
+ }).call(_zoomerPanner.transform, identity2.translate(t[0], t[1]).scale(k));
+ } else {
+ projection2.translate(t);
+ _transformStart = projection2.transform();
+ _selection.call(_zoomerPanner.transform, _transformStart);
+ dispatch10.call("move", this, map2);
+ immediateRedraw();
+ }
+ return map2;
+ };
+ map2.dimensions = function(val) {
+ if (!arguments.length)
+ return _dimensions;
+ _dimensions = val;
+ drawLayers.dimensions(_dimensions);
+ context.background().dimensions(_dimensions);
+ projection2.clipExtent([[0, 0], _dimensions]);
+ _getMouseCoords = utilFastMouse(supersurface.node());
+ scheduleRedraw();
+ return map2;
+ };
+ function zoomIn(delta) {
+ setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
+ }
+ function zoomOut(delta) {
+ setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
+ }
+ map2.zoomIn = function() {
+ zoomIn(1);
+ };
+ map2.zoomInFurther = function() {
+ zoomIn(4);
+ };
+ map2.canZoomIn = function() {
+ return map2.zoom() < maxZoom;
+ };
+ map2.zoomOut = function() {
+ zoomOut(1);
+ };
+ map2.zoomOutFurther = function() {
+ zoomOut(4);
+ };
+ map2.canZoomOut = function() {
+ return map2.zoom() > minZoom2;
+ };
+ map2.center = function(loc2) {
+ if (!arguments.length) {
+ return projection2.invert(pxCenter());
+ }
+ if (setCenterZoom(loc2, map2.zoom())) {
+ dispatch10.call("move", this, map2);
+ }
+ scheduleRedraw();
+ return map2;
+ };
+ map2.unobscuredCenterZoomEase = function(loc, zoom) {
+ var offset = map2.unobscuredOffsetPx();
+ var proj = geoRawMercator().transform(projection2.transform());
+ proj.scale(geoZoomToScale(zoom, TILESIZE));
+ var locPx = proj(loc);
+ var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
+ var offsetLoc = proj.invert(offsetLocPx);
+ map2.centerZoomEase(offsetLoc, zoom);
+ };
+ map2.unobscuredOffsetPx = function() {
+ var openPane = context.container().select(".map-panes .map-pane.shown");
+ if (!openPane.empty()) {
+ return [openPane.node().offsetWidth / 2, 0];
+ }
+ return [0, 0];
+ };
+ map2.zoom = function(z2) {
+ if (!arguments.length) {
+ return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
+ }
+ if (z2 < _minzoom) {
+ surface.interrupt();
+ dispatch10.call("hitMinZoom", this, map2);
+ z2 = context.minEditableZoom();
+ }
+ if (setCenterZoom(map2.center(), z2)) {
+ dispatch10.call("move", this, map2);
+ }
+ scheduleRedraw();
+ return map2;
+ };
+ map2.centerZoom = function(loc2, z2) {
+ if (setCenterZoom(loc2, z2)) {
+ dispatch10.call("move", this, map2);
+ }
+ scheduleRedraw();
+ return map2;
+ };
+ map2.zoomTo = function(entity) {
+ var extent = entity.extent(context.graph());
+ if (!isFinite(extent.area()))
+ return map2;
+ var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
+ return map2.centerZoom(extent.center(), z2);
+ };
+ map2.centerEase = function(loc2, duration) {
+ duration = duration || 250;
+ setCenterZoom(loc2, map2.zoom(), duration);
+ return map2;
+ };
+ map2.zoomEase = function(z2, duration) {
+ duration = duration || 250;
+ setCenterZoom(map2.center(), z2, duration, false);
+ return map2;
+ };
+ map2.centerZoomEase = function(loc2, z2, duration) {
+ duration = duration || 250;
+ setCenterZoom(loc2, z2, duration, false);
+ return map2;
+ };
+ map2.transformEase = function(t2, duration) {
+ duration = duration || 250;
+ setTransform(t2, duration, false);
+ return map2;
+ };
+ map2.zoomToEase = function(obj, duration) {
+ var extent;
+ if (Array.isArray(obj)) {
+ obj.forEach(function(entity) {
+ var entityExtent = entity.extent(context.graph());
+ if (!extent) {
+ extent = entityExtent;
+ } else {
+ extent = extent.extend(entityExtent);
+ }
});
- },
-
- isDegenerate: function() {
- return this.members.length === 0;
- },
+ } else {
+ extent = obj.extent(context.graph());
+ }
+ if (!isFinite(extent.area()))
+ return map2;
+ var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
+ return map2.centerZoomEase(extent.center(), z2, duration);
+ };
+ map2.startEase = function() {
+ utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
+ map2.cancelEase();
+ });
+ return map2;
+ };
+ map2.cancelEase = function() {
+ _selection.interrupt();
+ return map2;
+ };
+ map2.extent = function(val) {
+ if (!arguments.length) {
+ return new geoExtent(projection2.invert([0, _dimensions[1]]), projection2.invert([_dimensions[0], 0]));
+ } else {
+ var extent = geoExtent(val);
+ map2.centerZoom(extent.center(), map2.extentZoom(extent));
+ }
+ };
+ map2.trimmedExtent = function(val) {
+ if (!arguments.length) {
+ var headerY = 71;
+ var footerY = 30;
+ var pad2 = 10;
+ return new geoExtent(projection2.invert([pad2, _dimensions[1] - footerY - pad2]), projection2.invert([_dimensions[0] - pad2, headerY + pad2]));
+ } else {
+ var extent = geoExtent(val);
+ map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
+ }
+ };
+ function calcExtentZoom(extent, dim) {
+ var tl = projection2([extent[0][0], extent[1][1]]);
+ var br = projection2([extent[1][0], extent[0][1]]);
+ var hFactor = (br[0] - tl[0]) / dim[0];
+ var vFactor = (br[1] - tl[1]) / dim[1];
+ var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
+ var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
+ var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
+ return newZoom;
+ }
+ map2.extentZoom = function(val) {
+ return calcExtentZoom(geoExtent(val), _dimensions);
+ };
+ map2.trimmedExtentZoom = function(val) {
+ var trimY = 120;
+ var trimX = 40;
+ var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
+ return calcExtentZoom(geoExtent(val), trimmed);
+ };
+ map2.withinEditableZoom = function() {
+ return map2.zoom() >= context.minEditableZoom();
+ };
+ map2.isInWideSelection = function() {
+ return !map2.withinEditableZoom() && context.selectedIDs().length;
+ };
+ map2.editableDataEnabled = function(skipZoomCheck) {
+ var layer = context.layers().layer("osm");
+ if (!layer || !layer.enabled())
+ return false;
+ return skipZoomCheck || map2.withinEditableZoom();
+ };
+ map2.notesEditable = function() {
+ var layer = context.layers().layer("notes");
+ if (!layer || !layer.enabled())
+ return false;
+ return map2.withinEditableZoom();
+ };
+ map2.minzoom = function(val) {
+ if (!arguments.length)
+ return _minzoom;
+ _minzoom = val;
+ return map2;
+ };
+ map2.toggleHighlightEdited = function() {
+ surface.classed("highlight-edited", !surface.classed("highlight-edited"));
+ map2.pan([0, 0]);
+ dispatch10.call("changeHighlighting", this);
+ };
+ map2.areaFillOptions = ["wireframe", "partial", "full"];
+ map2.activeAreaFill = function(val) {
+ if (!arguments.length)
+ return corePreferences("area-fill") || "partial";
+ corePreferences("area-fill", val);
+ if (val !== "wireframe") {
+ corePreferences("area-fill-toggle", val);
+ }
+ updateAreaFill();
+ map2.pan([0, 0]);
+ dispatch10.call("changeAreaFill", this);
+ return map2;
+ };
+ map2.toggleWireframe = function() {
+ var activeFill = map2.activeAreaFill();
+ if (activeFill === "wireframe") {
+ activeFill = corePreferences("area-fill-toggle") || "partial";
+ } else {
+ activeFill = "wireframe";
+ }
+ map2.activeAreaFill(activeFill);
+ };
+ function updateAreaFill() {
+ var activeFill = map2.activeAreaFill();
+ map2.areaFillOptions.forEach(function(opt) {
+ surface.classed("fill-" + opt, Boolean(opt === activeFill));
+ });
+ }
+ map2.layers = () => drawLayers;
+ map2.doubleUpHandler = function() {
+ return _doubleUpHandler;
+ };
+ return utilRebind(map2, dispatch10, "on");
+ }
- // Return an array of members, each extended with an 'index' property whose value
- // is the member index.
- indexedMembers: function() {
- var result = new Array(this.members.length);
- for (var i = 0; i < this.members.length; i++) {
- result[i] = _.extend({}, this.members[i], {index: i});
+ // modules/renderer/photos.js
+ function rendererPhotos(context) {
+ var dispatch10 = dispatch_default("change");
+ var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview"];
+ var _allPhotoTypes = ["flat", "panoramic"];
+ var _shownPhotoTypes = _allPhotoTypes.slice();
+ var _dateFilters = ["fromDate", "toDate"];
+ var _fromDate;
+ var _toDate;
+ var _usernames;
+ function photos() {
+ }
+ function updateStorage() {
+ if (window.mocha)
+ return;
+ var hash = utilStringQs(window.location.hash);
+ var enabled = context.layers().all().filter(function(d) {
+ return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
+ }).map(function(d) {
+ return d.id;
+ });
+ if (enabled.length) {
+ hash.photo_overlay = enabled.join(",");
+ } else {
+ delete hash.photo_overlay;
+ }
+ window.location.replace("#" + utilQsString(hash, true));
+ }
+ photos.overlayLayerIDs = function() {
+ return _layerIDs;
+ };
+ photos.allPhotoTypes = function() {
+ return _allPhotoTypes;
+ };
+ photos.dateFilters = function() {
+ return _dateFilters;
+ };
+ photos.dateFilterValue = function(val) {
+ return val === _dateFilters[0] ? _fromDate : _toDate;
+ };
+ photos.setDateFilter = function(type3, val, updateUrl) {
+ var date = val && new Date(val);
+ if (date && !isNaN(date)) {
+ val = date.toISOString().substr(0, 10);
+ } else {
+ val = null;
+ }
+ if (type3 === _dateFilters[0]) {
+ _fromDate = val;
+ if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
+ _toDate = _fromDate;
}
- return result;
- },
-
- // Return the first member with the given role. A copy of the member object
- // is returned, extended with an 'index' property whose value is the member index.
- memberByRole: function(role) {
- for (var i = 0; i < this.members.length; i++) {
- if (this.members[i].role === role) {
- return _.extend({}, this.members[i], {index: i});
- }
+ }
+ if (type3 === _dateFilters[1]) {
+ _toDate = val;
+ if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
+ _fromDate = _toDate;
}
- },
-
- // Return the first member with the given id. A copy of the member object
- // is returned, extended with an 'index' property whose value is the member index.
- memberById: function(id) {
- for (var i = 0; i < this.members.length; i++) {
- if (this.members[i].id === id) {
- return _.extend({}, this.members[i], {index: i});
- }
+ }
+ dispatch10.call("change", this);
+ if (updateUrl) {
+ var rangeString;
+ if (_fromDate || _toDate) {
+ rangeString = (_fromDate || "") + "_" + (_toDate || "");
}
- },
-
- // Return the first member with the given id and role. A copy of the member object
- // is returned, extended with an 'index' property whose value is the member index.
- memberByIdAndRole: function(id, role) {
- for (var i = 0; i < this.members.length; i++) {
- if (this.members[i].id === id && this.members[i].role === role) {
- return _.extend({}, this.members[i], {index: i});
- }
+ setUrlFilterValue("photo_dates", rangeString);
+ }
+ };
+ photos.setUsernameFilter = function(val, updateUrl) {
+ if (val && typeof val === "string")
+ val = val.replace(/;/g, ",").split(",");
+ if (val) {
+ val = val.map((d) => d.trim()).filter(Boolean);
+ if (!val.length) {
+ val = null;
}
- },
-
- addMember: function(member, index) {
- var members = this.members.slice();
- members.splice(index === undefined ? members.length : index, 0, member);
- return this.update({members: members});
- },
-
- updateMember: function(member, index) {
- var members = this.members.slice();
- members.splice(index, 1, _.extend({}, members[index], member));
- return this.update({members: members});
- },
-
- removeMember: function(index) {
- var members = this.members.slice();
- members.splice(index, 1);
- return this.update({members: members});
- },
-
- removeMembersWithID: function(id) {
- var members = _.reject(this.members, function(m) { return m.id === id; });
- return this.update({members: members});
- },
-
- // Wherever a member appears with id `needle.id`, replace it with a member
- // with id `replacement.id`, type `replacement.type`, and the original role,
- // unless a member already exists with that id and role. Return an updated
- // relation.
- replaceMember: function(needle, replacement) {
- if (!this.memberById(needle.id))
- return this;
-
- var members = [];
-
- for (var i = 0; i < this.members.length; i++) {
- var member = this.members[i];
- if (member.id !== needle.id) {
- members.push(member);
- } else if (!this.memberByIdAndRole(replacement.id, member.role)) {
- members.push({id: replacement.id, type: replacement.type, role: member.role});
- }
+ }
+ _usernames = val;
+ dispatch10.call("change", this);
+ if (updateUrl) {
+ var hashString;
+ if (_usernames) {
+ hashString = _usernames.join(",");
+ }
+ setUrlFilterValue("photo_username", hashString);
+ }
+ };
+ function setUrlFilterValue(property, val) {
+ if (!window.mocha) {
+ var hash = utilStringQs(window.location.hash);
+ if (val) {
+ if (hash[property] === val)
+ return;
+ hash[property] = val;
+ } else {
+ if (!(property in hash))
+ return;
+ delete hash[property];
}
-
- return this.update({members: members});
- },
-
- asJXON: function(changeset_id) {
- var r = {
- relation: {
- '@id': this.osmId(),
- '@version': this.version || 0,
- member: _.map(this.members, function(member) {
- return { keyAttributes: { type: member.type, role: member.role, ref: iD.Entity.id.toOSM(member.id) } };
- }),
- tag: _.map(this.tags, function(v, k) {
- return { keyAttributes: { k: k, v: v } };
- })
- }
- };
- if (changeset_id) r.relation['@changeset'] = changeset_id;
- return r;
- },
-
- asGeoJSON: function(resolver) {
- return resolver.transient(this, 'GeoJSON', function () {
- if (this.isMultipolygon()) {
- return {
- type: 'MultiPolygon',
- coordinates: this.multipolygon(resolver)
- };
- } else {
- return {
- type: 'FeatureCollection',
- properties: this.tags,
- features: this.members.map(function (member) {
- return _.extend({role: member.role}, resolver.entity(member.id).asGeoJSON(resolver));
- })
- };
- }
- });
- },
-
- area: function(resolver) {
- return resolver.transient(this, 'area', function() {
- return d3.geo.area(this.asGeoJSON(resolver));
+ window.location.replace("#" + utilQsString(hash, true));
+ }
+ }
+ function showsLayer(id2) {
+ var layer = context.layers().layer(id2);
+ return layer && layer.supported() && layer.enabled();
+ }
+ photos.shouldFilterByDate = function() {
+ return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside");
+ };
+ photos.shouldFilterByPhotoType = function() {
+ return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview");
+ };
+ photos.shouldFilterByUsername = function() {
+ return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
+ };
+ photos.showsPhotoType = function(val) {
+ if (!photos.shouldFilterByPhotoType())
+ return true;
+ return _shownPhotoTypes.indexOf(val) !== -1;
+ };
+ photos.showsFlat = function() {
+ return photos.showsPhotoType("flat");
+ };
+ photos.showsPanoramic = function() {
+ return photos.showsPhotoType("panoramic");
+ };
+ photos.fromDate = function() {
+ return _fromDate;
+ };
+ photos.toDate = function() {
+ return _toDate;
+ };
+ photos.togglePhotoType = function(val) {
+ var index = _shownPhotoTypes.indexOf(val);
+ if (index !== -1) {
+ _shownPhotoTypes.splice(index, 1);
+ } else {
+ _shownPhotoTypes.push(val);
+ }
+ dispatch10.call("change", this);
+ return photos;
+ };
+ photos.usernames = function() {
+ return _usernames;
+ };
+ photos.init = function() {
+ var hash = utilStringQs(window.location.hash);
+ if (hash.photo_dates) {
+ var parts = /^(.*)[â_](.*)$/g.exec(hash.photo_dates.trim());
+ this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
+ this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
+ }
+ if (hash.photo_username) {
+ this.setUsernameFilter(hash.photo_username, false);
+ }
+ if (hash.photo_overlay) {
+ var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
+ hashOverlayIDs.forEach(function(id2) {
+ if (id2 === "openstreetcam")
+ id2 = "kartaview";
+ var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
+ if (layer2 && !layer2.enabled())
+ layer2.enabled(true);
});
- },
-
- isMultipolygon: function() {
- return this.tags.type === 'multipolygon';
- },
-
- isComplete: function(resolver) {
- for (var i = 0; i < this.members.length; i++) {
- if (!resolver.hasEntity(this.members[i].id)) {
- return false;
- }
+ }
+ if (hash.photo) {
+ var photoIds = hash.photo.replace(/;/g, ",").split(",");
+ var photoId = photoIds.length && photoIds[0].trim();
+ var results = /(.*)\/(.*)/g.exec(photoId);
+ if (results && results.length >= 3) {
+ var serviceId = results[1];
+ if (serviceId === "openstreetcam")
+ serviceId = "kartaview";
+ var photoKey = results[2];
+ var service = services[serviceId];
+ if (service && service.ensureViewerLoaded) {
+ var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
+ if (layer && !layer.enabled())
+ layer.enabled(true);
+ var baselineTime = Date.now();
+ service.on("loadedImages.rendererPhotos", function() {
+ if (Date.now() - baselineTime > 45e3) {
+ service.on("loadedImages.rendererPhotos", null);
+ return;
+ }
+ if (!service.cachedImage(photoKey))
+ return;
+ service.on("loadedImages.rendererPhotos", null);
+ service.ensureViewerLoaded(context).then(function() {
+ service.selectImage(context, photoKey).showViewer(context);
+ });
+ });
+ }
}
- return true;
- },
-
- isRestriction: function() {
- return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
- },
-
- // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
- // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
- //
- // This corresponds to the structure needed for rendering a multipolygon path using a
- // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
- //
- // In the case of invalid geometries, this function will still return a result which
- // includes the nodes of all way members, but some Nds may be unclosed and some inner
- // rings not matched with the intended outer ring.
- //
- multipolygon: function(resolver) {
- var outers = this.members.filter(function(m) { return 'outer' === (m.role || 'outer'); }),
- inners = this.members.filter(function(m) { return 'inner' === m.role; });
-
- outers = iD.geo.joinWays(outers, resolver);
- inners = iD.geo.joinWays(inners, resolver);
-
- outers = outers.map(function(outer) { return _.map(outer.nodes, 'loc'); });
- inners = inners.map(function(inner) { return _.map(inner.nodes, 'loc'); });
+ }
+ context.layers().on("change.rendererPhotos", updateStorage);
+ };
+ return utilRebind(photos, dispatch10, "on");
+ }
- var result = outers.map(function(o) {
- // Heuristic for detecting counterclockwise winding order. Assumes
- // that OpenStreetMap polygons are not hemisphere-spanning.
- return [d3.geo.area({type: 'Polygon', coordinates: [o]}) > 2 * Math.PI ? o.reverse() : o];
+ // modules/ui/account.js
+ function uiAccount(context) {
+ const osm = context.connection();
+ function updateUserDetails(selection2) {
+ if (!osm)
+ return;
+ if (!osm.authenticated()) {
+ render(selection2, null);
+ } else {
+ osm.userDetails((err, user) => render(selection2, user));
+ }
+ }
+ function render(selection2, user) {
+ let userInfo = selection2.select(".userInfo");
+ let loginLogout = selection2.select(".loginLogout");
+ if (user) {
+ userInfo.html("").classed("hide", false);
+ let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
+ if (user.image_url) {
+ userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
+ } else {
+ userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
+ }
+ userLink.append("span").attr("class", "label").html(user.display_name);
+ loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e) => {
+ e.preventDefault();
+ osm.logout();
+ tryLogout();
});
+ } else {
+ userInfo.html("").classed("hide", true);
+ loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e) => {
+ e.preventDefault();
+ osm.authenticate();
+ });
+ }
+ }
+ function tryLogout() {
+ if (!osm)
+ return;
+ const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
+ const w = 600;
+ const h = 550;
+ const settings = [
+ ["width", w],
+ ["height", h],
+ ["left", window.screen.width / 2 - w / 2],
+ ["top", window.screen.height / 2 - h / 2]
+ ].map((x) => x.join("=")).join(",");
+ window.open(url, "_blank", settings);
+ }
+ return function(selection2) {
+ if (!osm)
+ return;
+ selection2.append("li").attr("class", "userInfo").classed("hide", true);
+ selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
+ osm.on("change.account", () => updateUserDetails(selection2));
+ updateUserDetails(selection2);
+ };
+ }
- function findOuter(inner) {
- var o, outer;
-
- for (o = 0; o < outers.length; o++) {
- outer = outers[o];
- if (iD.geo.polygonContainsPolygon(outer, inner))
- return o;
- }
-
- for (o = 0; o < outers.length; o++) {
- outer = outers[o];
- if (iD.geo.polygonIntersectsPolygon(outer, inner))
- return o;
- }
- }
+ // modules/ui/attribution.js
+ function uiAttribution(context) {
+ let _selection = select_default2(null);
+ function render(selection2, data, klass) {
+ let div = selection2.selectAll(`.${klass}`).data([0]);
+ div = div.enter().append("div").attr("class", klass).merge(div);
+ let attributions = div.selectAll(".attribution").data(data, (d) => d.id);
+ attributions.exit().remove();
+ attributions = attributions.enter().append("span").attr("class", "attribution").each((d, i2, nodes) => {
+ let attribution = select_default2(nodes[i2]);
+ if (d.terms_html) {
+ attribution.html(d.terms_html);
+ return;
+ }
+ if (d.terms_url) {
+ attribution = attribution.append("a").attr("href", d.terms_url).attr("target", "_blank");
+ }
+ const sourceID = d.id.replace(/\./g, "");
+ const terms_text = _t(`imagery.${sourceID}.attribution.text`, { default: d.terms_text || d.id || d.name() });
+ if (d.icon && !d.overlay) {
+ attribution.append("img").attr("class", "source-image").attr("src", d.icon);
+ }
+ attribution.append("span").attr("class", "attribution-text").text(terms_text);
+ }).merge(attributions);
+ let copyright = attributions.selectAll(".copyright-notice").data((d) => {
+ let notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
+ return notice ? [notice] : [];
+ });
+ copyright.exit().remove();
+ copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
+ copyright.text(String);
+ }
+ function update() {
+ let baselayer = context.background().baseLayerSource();
+ _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
+ const z = context.map().zoom();
+ let overlays = context.background().overlayLayerSources() || [];
+ _selection.call(render, overlays.filter((s) => s.validZoom(z)), "overlay-layer-attribution");
+ }
+ return function(selection2) {
+ _selection = selection2;
+ context.background().on("change.attribution", update);
+ context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
+ update();
+ };
+ }
- for (var i = 0; i < inners.length; i++) {
- var inner = inners[i];
+ // modules/ui/contributors.js
+ function uiContributors(context) {
+ var osm = context.connection(), debouncedUpdate = debounce_default(function() {
+ update();
+ }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
+ function update() {
+ if (!osm)
+ return;
+ var users = {}, entities = context.history().intersects(context.map().extent());
+ entities.forEach(function(entity) {
+ if (entity && entity.user)
+ users[entity.user] = true;
+ });
+ var u = Object.keys(users), subset = u.slice(0, u.length > limit ? limit - 1 : limit);
+ wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
+ var userList = select_default2(document.createElement("span"));
+ userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d) {
+ return osm.userURL(d);
+ }).attr("target", "_blank").text(String);
+ if (u.length > limit) {
+ var count = select_default2(document.createElement("span"));
+ var othersNum = u.length - limit + 1;
+ count.append("a").attr("target", "_blank").attr("href", function() {
+ return osm.changesetsURL(context.map().center(), context.map().zoom());
+ }).text(othersNum);
+ wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
+ } else {
+ wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
+ }
+ if (!u.length) {
+ hidden = true;
+ wrap2.transition().style("opacity", 0);
+ } else if (hidden) {
+ wrap2.transition().style("opacity", 1);
+ }
+ }
+ return function(selection2) {
+ if (!osm)
+ return;
+ wrap2 = selection2;
+ update();
+ osm.on("loaded.contributors", debouncedUpdate);
+ context.map().on("move.contributors", debouncedUpdate);
+ };
+ }
- if (d3.geo.area({type: 'Polygon', coordinates: [inner]}) < 2 * Math.PI) {
- inner = inner.reverse();
+ // modules/ui/popover.js
+ var _popoverID = 0;
+ function uiPopover(klass) {
+ var _id = _popoverID++;
+ var _anchorSelection = select_default2(null);
+ var popover = function(selection2) {
+ _anchorSelection = selection2;
+ selection2.each(setup);
+ };
+ var _animation = utilFunctor(false);
+ var _placement = utilFunctor("top");
+ var _alignment = utilFunctor("center");
+ var _scrollContainer = utilFunctor(select_default2(null));
+ var _content;
+ var _displayType = utilFunctor("");
+ var _hasArrow = utilFunctor(true);
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ popover.displayType = function(val) {
+ if (arguments.length) {
+ _displayType = utilFunctor(val);
+ return popover;
+ } else {
+ return _displayType;
+ }
+ };
+ popover.hasArrow = function(val) {
+ if (arguments.length) {
+ _hasArrow = utilFunctor(val);
+ return popover;
+ } else {
+ return _hasArrow;
+ }
+ };
+ popover.placement = function(val) {
+ if (arguments.length) {
+ _placement = utilFunctor(val);
+ return popover;
+ } else {
+ return _placement;
+ }
+ };
+ popover.alignment = function(val) {
+ if (arguments.length) {
+ _alignment = utilFunctor(val);
+ return popover;
+ } else {
+ return _alignment;
+ }
+ };
+ popover.scrollContainer = function(val) {
+ if (arguments.length) {
+ _scrollContainer = utilFunctor(val);
+ return popover;
+ } else {
+ return _scrollContainer;
+ }
+ };
+ popover.content = function(val) {
+ if (arguments.length) {
+ _content = val;
+ return popover;
+ } else {
+ return _content;
+ }
+ };
+ popover.isShown = function() {
+ var popoverSelection = _anchorSelection.select(".popover-" + _id);
+ return !popoverSelection.empty() && popoverSelection.classed("in");
+ };
+ popover.show = function() {
+ _anchorSelection.each(show);
+ };
+ popover.updateContent = function() {
+ _anchorSelection.each(updateContent);
+ };
+ popover.hide = function() {
+ _anchorSelection.each(hide);
+ };
+ popover.toggle = function() {
+ _anchorSelection.each(toggle);
+ };
+ popover.destroy = function(selection2, selector) {
+ selector = selector || ".popover-" + _id;
+ selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("click.popover", null).attr("title", function() {
+ return this.getAttribute("data-original-title") || this.getAttribute("title");
+ }).attr("data-original-title", null).selectAll(selector).remove();
+ };
+ popover.destroyAny = function(selection2) {
+ selection2.call(popover.destroy, ".popover");
+ };
+ function setup() {
+ var anchor = select_default2(this);
+ var animate = _animation.apply(this, arguments);
+ var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
+ var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
+ enter.append("div").attr("class", "popover-arrow");
+ enter.append("div").attr("class", "popover-inner");
+ popoverSelection = enter.merge(popoverSelection);
+ if (animate) {
+ popoverSelection.classed("fade", true);
+ }
+ var display = _displayType.apply(this, arguments);
+ if (display === "hover") {
+ var _lastNonMouseEnterTime;
+ anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
+ if (d3_event.pointerType) {
+ if (d3_event.pointerType !== "mouse") {
+ _lastNonMouseEnterTime = d3_event.timeStamp;
+ return;
+ } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
+ return;
}
-
- var o = findOuter(inners[i]);
- if (o !== undefined)
- result[o].push(inners[i]);
- else
- result.push([inners[i]]); // Invalid geometry
+ }
+ if (d3_event.buttons !== 0)
+ return;
+ show.apply(this, arguments);
+ }).on(_pointerPrefix + "leave.popover", function() {
+ hide.apply(this, arguments);
+ }).on("focus.popover", function() {
+ show.apply(this, arguments);
+ }).on("blur.popover", function() {
+ hide.apply(this, arguments);
+ });
+ } else if (display === "clickFocus") {
+ anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ }).on(_pointerPrefix + "up.popover", function(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ }).on("click.popover", toggle);
+ popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
+ anchor.each(function() {
+ hide.apply(this, arguments);
+ });
+ });
+ }
+ }
+ function show() {
+ var anchor = select_default2(this);
+ var popoverSelection = anchor.selectAll(".popover-" + _id);
+ if (popoverSelection.empty()) {
+ anchor.call(popover.destroy);
+ anchor.each(setup);
+ popoverSelection = anchor.selectAll(".popover-" + _id);
+ }
+ popoverSelection.classed("in", true);
+ var displayType = _displayType.apply(this, arguments);
+ if (displayType === "clickFocus") {
+ anchor.classed("active", true);
+ popoverSelection.node().focus();
+ }
+ anchor.each(updateContent);
+ }
+ function updateContent() {
+ var anchor = select_default2(this);
+ if (_content) {
+ anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
+ }
+ updatePosition.apply(this, arguments);
+ updatePosition.apply(this, arguments);
+ updatePosition.apply(this, arguments);
+ }
+ function updatePosition() {
+ var anchor = select_default2(this);
+ var popoverSelection = anchor.selectAll(".popover-" + _id);
+ var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
+ var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
+ var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
+ var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
+ var placement = _placement.apply(this, arguments);
+ popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
+ var alignment = _alignment.apply(this, arguments);
+ var alignFactor = 0.5;
+ if (alignment === "leading") {
+ alignFactor = 0;
+ } else if (alignment === "trailing") {
+ alignFactor = 1;
+ }
+ var anchorFrame = getFrame(anchor.node());
+ var popoverFrame = getFrame(popoverSelection.node());
+ var position;
+ switch (placement) {
+ case "top":
+ position = {
+ x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
+ y: anchorFrame.y - popoverFrame.h
+ };
+ break;
+ case "bottom":
+ position = {
+ x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
+ y: anchorFrame.y + anchorFrame.h
+ };
+ break;
+ case "left":
+ position = {
+ x: anchorFrame.x - popoverFrame.w,
+ y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
+ };
+ break;
+ case "right":
+ position = {
+ x: anchorFrame.x + anchorFrame.w,
+ y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
+ };
+ break;
+ }
+ if (position) {
+ if (scrollNode && (placement === "top" || placement === "bottom")) {
+ var initialPosX = position.x;
+ if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
+ position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
+ } else if (position.x < 10) {
+ position.x = 10;
+ }
+ var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
+ var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
+ arrow.style("left", ~~arrowPosX + "px");
}
-
- return result;
+ popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
+ } else {
+ popoverSelection.style("left", null).style("top", null);
+ }
+ function getFrame(node) {
+ var positionStyle = select_default2(node).style("position");
+ if (positionStyle === "absolute" || positionStyle === "static") {
+ return {
+ x: node.offsetLeft - scrollLeft,
+ y: node.offsetTop - scrollTop,
+ w: node.offsetWidth,
+ h: node.offsetHeight
+ };
+ } else {
+ return {
+ x: 0,
+ y: 0,
+ w: node.offsetWidth,
+ h: node.offsetHeight
+ };
+ }
+ }
+ }
+ function hide() {
+ var anchor = select_default2(this);
+ if (_displayType.apply(this, arguments) === "clickFocus") {
+ anchor.classed("active", false);
+ }
+ anchor.selectAll(".popover-" + _id).classed("in", false);
}
-});
-iD.oneWayTags = {
- 'aerialway': {
- 'chair_lift': true,
- 'mixed_lift': true,
- 't-bar': true,
- 'j-bar': true,
- 'platter': true,
- 'rope_tow': true,
- 'magic_carpet': true,
- 'yes': true
- },
- 'highway': {
- 'motorway': true,
- 'motorway_link': true
- },
- 'junction': {
- 'roundabout': true
- },
- 'man_made': {
- 'piste:halfpipe': true
- },
- 'piste:type': {
- 'downhill': true,
- 'sled': true,
- 'yes': true
- },
- 'waterway': {
- 'river': true,
- 'stream': true
- }
-};
-
-iD.pavedTags = {
- 'surface': {
- 'paved': true,
- 'asphalt': true,
- 'concrete': true
- },
- 'tracktype': {
- 'grade1': true
- }
-};
-
-iD.interestingTag = function (key) {
- return key !== 'attribution' &&
- key !== 'created_by' &&
- key !== 'source' &&
- key !== 'odbl' &&
- key.indexOf('tiger:') !== 0;
-
-};
-iD.Tree = function(head) {
- var rtree = rbush(),
- rectangles = {};
-
- function entityRectangle(entity) {
- var rect = entity.extent(head).rectangle();
- rect.id = entity.id;
- rectangles[entity.id] = rect;
- return rect;
+ function toggle() {
+ if (select_default2(this).select(".popover-" + _id).classed("in")) {
+ hide.apply(this, arguments);
+ } else {
+ show.apply(this, arguments);
+ }
}
+ return popover;
+ }
- function updateParents(entity, insertions, memo) {
- head.parentWays(entity).forEach(function(way) {
- if (rectangles[way.id]) {
- rtree.remove(rectangles[way.id]);
- insertions[way.id] = way;
- }
- updateParents(way, insertions, memo);
+ // modules/ui/tooltip.js
+ function uiTooltip(klass) {
+ var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
+ var _title = function() {
+ var title = this.getAttribute("data-original-title");
+ if (title) {
+ return title;
+ } else {
+ title = this.getAttribute("title");
+ this.removeAttribute("title");
+ this.setAttribute("data-original-title", title);
+ }
+ return title;
+ };
+ var _heading = utilFunctor(null);
+ var _keys = utilFunctor(null);
+ tooltip.title = function(val) {
+ if (!arguments.length)
+ return _title;
+ _title = utilFunctor(val);
+ return tooltip;
+ };
+ tooltip.heading = function(val) {
+ if (!arguments.length)
+ return _heading;
+ _heading = utilFunctor(val);
+ return tooltip;
+ };
+ tooltip.keys = function(val) {
+ if (!arguments.length)
+ return _keys;
+ _keys = utilFunctor(val);
+ return tooltip;
+ };
+ tooltip.content(function() {
+ var heading = _heading.apply(this, arguments);
+ var text2 = _title.apply(this, arguments);
+ var keys = _keys.apply(this, arguments);
+ return function(selection2) {
+ var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
+ headingSelect.exit().remove();
+ headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).html(heading);
+ var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
+ textSelect.exit().remove();
+ textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).html(text2);
+ var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys && keys.length ? [0] : []);
+ keyhintWrap.exit().remove();
+ var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
+ keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
+ keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
+ keyhintWrap.selectAll("kbd.shortcut").data(keys && keys.length ? keys : []).enter().append("kbd").attr("class", "shortcut").html(function(d) {
+ return d;
});
+ };
+ });
+ return tooltip;
+ }
- head.parentRelations(entity).forEach(function(relation) {
- if (memo[entity.id]) return;
- memo[entity.id] = true;
- if (rectangles[relation.id]) {
- rtree.remove(rectangles[relation.id]);
- insertions[relation.id] = relation;
- }
- updateParents(relation, insertions, memo);
+ // modules/ui/edit_menu.js
+ function uiEditMenu(context) {
+ var dispatch10 = dispatch_default("toggled");
+ var _menu = select_default2(null);
+ var _operations = [];
+ var _anchorLoc = [0, 0];
+ var _anchorLocLonLat = [0, 0];
+ var _triggerType = "";
+ var _vpTopMargin = 85;
+ var _vpBottomMargin = 45;
+ var _vpSideMargin = 35;
+ var _menuTop = false;
+ var _menuHeight;
+ var _menuWidth;
+ var _verticalPadding = 4;
+ var _tooltipWidth = 210;
+ var _menuSideMargin = 10;
+ var _tooltips = [];
+ var editMenu = function(selection2) {
+ var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
+ var ops = _operations.filter(function(op) {
+ return !isTouchMenu || !op.mouseOnly;
+ });
+ if (!ops.length)
+ return;
+ _tooltips = [];
+ _menuTop = isTouchMenu;
+ var showLabels = isTouchMenu;
+ var buttonHeight = showLabels ? 32 : 34;
+ if (showLabels) {
+ _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
+ return op.title.length;
+ })));
+ } else {
+ _menuWidth = 44;
+ }
+ _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
+ _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
+ var buttons = _menu.selectAll(".edit-menu-item").data(ops);
+ var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
+ return "edit-menu-item edit-menu-item-" + d.id;
+ }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
+ d3_event.stopPropagation();
+ }).on("mouseenter.highlight", function(d3_event, d) {
+ if (!d.relatedEntityIds || select_default2(this).classed("disabled"))
+ return;
+ utilHighlightEntities(d.relatedEntityIds(), true, context);
+ }).on("mouseleave.highlight", function(d3_event, d) {
+ if (!d.relatedEntityIds)
+ return;
+ utilHighlightEntities(d.relatedEntityIds(), false, context);
+ });
+ buttonsEnter.each(function(d) {
+ var tooltip = uiTooltip().heading(d.title).title(d.tooltip()).keys([d.keys[0]]);
+ _tooltips.push(tooltip);
+ select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d.icon && d.icon() || "#iD-operation-" + d.id, "operation"));
+ });
+ if (showLabels) {
+ buttonsEnter.append("span").attr("class", "label").html(function(d) {
+ return d.title;
});
+ }
+ buttonsEnter.merge(buttons).classed("disabled", function(d) {
+ return d.disabled();
+ });
+ updatePosition();
+ var initialScale = context.projection.scale();
+ context.map().on("move.edit-menu", function() {
+ if (initialScale !== context.projection.scale()) {
+ editMenu.close();
+ }
+ }).on("drawn.edit-menu", function(info) {
+ if (info.full)
+ updatePosition();
+ });
+ var lastPointerUpType;
+ function pointerup(d3_event) {
+ lastPointerUpType = d3_event.pointerType;
+ }
+ function click(d3_event, operation) {
+ d3_event.stopPropagation();
+ if (operation.relatedEntityIds) {
+ utilHighlightEntities(operation.relatedEntityIds(), false, context);
+ }
+ if (operation.disabled()) {
+ if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
+ context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip)();
+ }
+ } else {
+ if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
+ context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
+ }
+ operation();
+ editMenu.close();
+ }
+ lastPointerUpType = null;
+ }
+ dispatch10.call("toggled", this, true);
+ };
+ function updatePosition() {
+ if (!_menu || _menu.empty())
+ return;
+ var anchorLoc = context.projection(_anchorLocLonLat);
+ var viewport = context.surfaceRect();
+ if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
+ editMenu.close();
+ return;
+ }
+ var menuLeft = displayOnLeft(viewport);
+ var offset = [0, 0];
+ offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
+ if (_menuTop) {
+ if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
+ offset[1] = -anchorLoc[1] + _vpTopMargin;
+ } else {
+ offset[1] = -_menuHeight;
+ }
+ } else {
+ if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
+ offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
+ } else {
+ offset[1] = 0;
+ }
+ }
+ var origin = geoVecAdd(anchorLoc, offset);
+ _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
+ var tooltipSide = tooltipPosition(viewport, menuLeft);
+ _tooltips.forEach(function(tooltip) {
+ tooltip.placement(tooltipSide);
+ });
+ function displayOnLeft(viewport2) {
+ if (_mainLocalizer.textDirection() === "ltr") {
+ if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
+ return true;
+ }
+ return false;
+ } else {
+ if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
+ return false;
+ }
+ return true;
+ }
+ }
+ function tooltipPosition(viewport2, menuLeft2) {
+ if (_mainLocalizer.textDirection() === "ltr") {
+ if (menuLeft2) {
+ return "left";
+ }
+ if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
+ return "left";
+ }
+ return "right";
+ } else {
+ if (!menuLeft2) {
+ return "right";
+ }
+ if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
+ return "right";
+ }
+ return "left";
+ }
+ }
}
+ editMenu.close = function() {
+ context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
+ _menu.remove();
+ _tooltips = [];
+ dispatch10.call("toggled", this, false);
+ };
+ editMenu.anchorLoc = function(val) {
+ if (!arguments.length)
+ return _anchorLoc;
+ _anchorLoc = val;
+ _anchorLocLonLat = context.projection.invert(_anchorLoc);
+ return editMenu;
+ };
+ editMenu.triggerType = function(val) {
+ if (!arguments.length)
+ return _triggerType;
+ _triggerType = val;
+ return editMenu;
+ };
+ editMenu.operations = function(val) {
+ if (!arguments.length)
+ return _operations;
+ _operations = val;
+ return editMenu;
+ };
+ return utilRebind(editMenu, dispatch10, "on");
+ }
- var tree = {};
-
- tree.rebase = function(entities, force) {
- var insertions = {};
-
- for (var i = 0; i < entities.length; i++) {
- var entity = entities[i];
-
- if (!entity.visible)
- continue;
-
- if (head.entities.hasOwnProperty(entity.id) || rectangles[entity.id]) {
- if (!force) {
- continue;
- } else if (rectangles[entity.id]) {
- rtree.remove(rectangles[entity.id]);
- }
- }
-
- insertions[entity.id] = entity;
- updateParents(entity, insertions, {});
+ // modules/ui/feature_info.js
+ function uiFeatureInfo(context) {
+ function update(selection2) {
+ var features2 = context.features();
+ var stats = features2.stats();
+ var count = 0;
+ var hiddenList = features2.hidden().map(function(k) {
+ if (stats[k]) {
+ count += stats[k];
+ return _t.html("inspector.title_count", { title: { html: _t.html("feature." + k + ".description") }, count: stats[k] });
}
-
- rtree.load(_.map(insertions, entityRectangle));
-
- return tree;
+ return null;
+ }).filter(Boolean);
+ selection2.html("");
+ if (hiddenList.length) {
+ var tooltipBehavior = uiTooltip().placement("top").title(function() {
+ return hiddenList.join("
");
+ });
+ selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
+ tooltipBehavior.hide();
+ d3_event.preventDefault();
+ context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
+ });
+ }
+ selection2.classed("hide", !hiddenList.length);
+ }
+ return function(selection2) {
+ update(selection2);
+ context.features().on("change.feature_info", function() {
+ update(selection2);
+ });
};
+ }
- tree.intersects = function(extent, graph) {
- if (graph !== head) {
- var diff = iD.Difference(head, graph),
- insertions = {};
-
- head = graph;
-
- diff.deleted().forEach(function(entity) {
- rtree.remove(rectangles[entity.id]);
- delete rectangles[entity.id];
- });
+ // modules/ui/flash.js
+ function uiFlash(context) {
+ var _flashTimer;
+ var _duration = 2e3;
+ var _iconName = "#iD-icon-no";
+ var _iconClass = "disabled";
+ var _label = "";
+ function flash() {
+ if (_flashTimer) {
+ _flashTimer.stop();
+ }
+ context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
+ context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
+ var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
+ var contentEnter = content.enter().append("div").attr("class", "flash-content");
+ var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
+ iconEnter.append("circle").attr("r", 9);
+ iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
+ contentEnter.append("div").attr("class", "flash-text");
+ content = content.merge(contentEnter);
+ content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
+ content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
+ content.selectAll(".flash-text").attr("class", "flash-text").html(_label);
+ _flashTimer = timeout_default(function() {
+ _flashTimer = null;
+ context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
+ context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
+ }, _duration);
+ return content;
+ }
+ flash.duration = function(_) {
+ if (!arguments.length)
+ return _duration;
+ _duration = _;
+ return flash;
+ };
+ flash.label = function(_) {
+ if (!arguments.length)
+ return _label;
+ _label = _;
+ return flash;
+ };
+ flash.iconName = function(_) {
+ if (!arguments.length)
+ return _iconName;
+ _iconName = _;
+ return flash;
+ };
+ flash.iconClass = function(_) {
+ if (!arguments.length)
+ return _iconClass;
+ _iconClass = _;
+ return flash;
+ };
+ return flash;
+ }
- diff.modified().forEach(function(entity) {
- rtree.remove(rectangles[entity.id]);
- insertions[entity.id] = entity;
- updateParents(entity, insertions, {});
- });
+ // modules/ui/full_screen.js
+ function uiFullScreen(context) {
+ var element = context.container().node();
+ function getFullScreenFn() {
+ if (element.requestFullscreen) {
+ return element.requestFullscreen;
+ } else if (element.msRequestFullscreen) {
+ return element.msRequestFullscreen;
+ } else if (element.mozRequestFullScreen) {
+ return element.mozRequestFullScreen;
+ } else if (element.webkitRequestFullscreen) {
+ return element.webkitRequestFullscreen;
+ }
+ }
+ function getExitFullScreenFn() {
+ if (document.exitFullscreen) {
+ return document.exitFullscreen;
+ } else if (document.msExitFullscreen) {
+ return document.msExitFullscreen;
+ } else if (document.mozCancelFullScreen) {
+ return document.mozCancelFullScreen;
+ } else if (document.webkitExitFullscreen) {
+ return document.webkitExitFullscreen;
+ }
+ }
+ function isFullScreen() {
+ return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
+ }
+ function isSupported() {
+ return !!getFullScreenFn();
+ }
+ function fullScreen(d3_event) {
+ d3_event.preventDefault();
+ if (!isFullScreen()) {
+ getFullScreenFn().apply(element);
+ } else {
+ getExitFullScreenFn().apply(document);
+ }
+ }
+ return function() {
+ if (!isSupported())
+ return;
+ var detected = utilDetect();
+ var keys = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
+ context.keybinding().on(keys, fullScreen);
+ };
+ }
- diff.created().forEach(function(entity) {
- insertions[entity.id] = entity;
- });
+ // modules/ui/geolocate.js
+ function uiGeolocate(context) {
+ var _geolocationOptions = {
+ enableHighAccuracy: false,
+ timeout: 6e3
+ };
+ var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
+ var _layer = context.layers().layer("geolocate");
+ var _position;
+ var _extent;
+ var _timeoutID;
+ var _button = select_default2(null);
+ function click() {
+ if (context.inIntro())
+ return;
+ if (!_layer.enabled() && !_locating.isShown()) {
+ _timeoutID = setTimeout(error, 1e4);
+ context.container().call(_locating);
+ navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
+ } else {
+ _locating.close();
+ _layer.enabled(null, false);
+ updateButtonState();
+ }
+ }
+ function zoomTo() {
+ context.enter(modeBrowse(context));
+ var map2 = context.map();
+ _layer.enabled(_position, true);
+ updateButtonState();
+ map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
+ }
+ function success(geolocation) {
+ _position = geolocation;
+ var coords = _position.coords;
+ _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
+ zoomTo();
+ finish();
+ }
+ function error() {
+ if (_position) {
+ zoomTo();
+ } else {
+ context.ui().flash.label(_t.html("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
+ }
+ finish();
+ }
+ function finish() {
+ _locating.close();
+ if (_timeoutID) {
+ clearTimeout(_timeoutID);
+ }
+ _timeoutID = void 0;
+ }
+ function updateButtonState() {
+ _button.classed("active", _layer.enabled());
+ _button.attr("aria-pressed", _layer.enabled());
+ }
+ return function(selection2) {
+ if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
+ return;
+ _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(_t.html("geolocate.title")).keys([_t("geolocate.key")]));
+ context.keybinding().on(_t("geolocate.key"), click);
+ };
+ }
- rtree.load(_.map(insertions, entityRectangle));
+ // modules/ui/panels/background.js
+ function uiPanelBackground(context) {
+ var background = context.background();
+ var _currSourceName = null;
+ var _metadata = {};
+ var _metadataKeys = [
+ "zoom",
+ "vintage",
+ "source",
+ "description",
+ "resolution",
+ "accuracy"
+ ];
+ var debouncedRedraw = debounce_default(redraw, 250);
+ function redraw(selection2) {
+ var source = background.baseLayerSource();
+ if (!source)
+ return;
+ var isDG = source.id.match(/^DigitalGlobe/i) !== null;
+ var sourceLabel = source.label();
+ if (_currSourceName !== sourceLabel) {
+ _currSourceName = sourceLabel;
+ _metadata = {};
+ }
+ selection2.html("");
+ var list = selection2.append("ul").attr("class", "background-info");
+ list.append("li").html(_currSourceName);
+ _metadataKeys.forEach(function(k) {
+ if (isDG && k === "vintage")
+ return;
+ list.append("li").attr("class", "background-info-list-" + k).classed("hide", !_metadata[k]).call(_t.append("info_panels.background." + k, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k).text(_metadata[k]);
+ });
+ debouncedGetMetadata(selection2);
+ var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
+ selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.setDebug("tile", !context.getDebug("tile"));
+ selection2.call(redraw);
+ });
+ if (isDG) {
+ var key = source.id + "-vintage";
+ var sourceVintage = context.background().findSource(key);
+ var showsVintage = context.background().showsLayer(sourceVintage);
+ var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
+ selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.background().toggleOverlayLayer(sourceVintage);
+ selection2.call(redraw);
+ });
+ }
+ ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
+ if (source.id !== layerId) {
+ var key2 = layerId + "-vintage";
+ var sourceVintage2 = context.background().findSource(key2);
+ if (context.background().showsLayer(sourceVintage2)) {
+ context.background().toggleOverlayLayer(sourceVintage2);
+ }
}
-
- return rtree.search(extent.rectangle()).map(function(rect) {
- return head.entity(rect.id);
+ });
+ }
+ var debouncedGetMetadata = debounce_default(getMetadata, 250);
+ function getMetadata(selection2) {
+ var tile = context.container().select(".layer-background img.tile-center");
+ if (tile.empty())
+ return;
+ var sourceName = _currSourceName;
+ var d = tile.datum();
+ var zoom = d && d.length >= 3 && d[2] || Math.floor(context.map().zoom());
+ var center = context.map().center();
+ _metadata.zoom = String(zoom);
+ selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
+ if (!d || !d.length >= 3)
+ return;
+ background.baseLayerSource().getMetadata(center, d, function(err, result) {
+ if (err || _currSourceName !== sourceName)
+ return;
+ var vintage = result.vintage;
+ _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
+ selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
+ _metadataKeys.forEach(function(k) {
+ if (k === "zoom" || k === "vintage")
+ return;
+ var val = result[k];
+ _metadata[k] = val;
+ selection2.selectAll(".background-info-list-" + k).classed("hide", !val).selectAll(".background-info-span-" + k).text(val);
});
+ });
+ }
+ var panel = function(selection2) {
+ selection2.call(redraw);
+ context.map().on("drawn.info-background", function() {
+ selection2.call(debouncedRedraw);
+ }).on("move.info-background", function() {
+ selection2.call(debouncedGetMetadata);
+ });
+ };
+ panel.off = function() {
+ context.map().on("drawn.info-background", null).on("move.info-background", null);
};
+ panel.id = "background";
+ panel.label = _t.html("info_panels.background.title");
+ panel.key = _t("info_panels.background.key");
+ return panel;
+ }
- return tree;
-};
-iD.Way = iD.Entity.way = function iD_Way() {
- if (!(this instanceof iD_Way)) {
- return (new iD_Way()).initialize(arguments);
- } else if (arguments.length) {
- this.initialize(arguments);
+ // modules/ui/panels/history.js
+ function uiPanelHistory(context) {
+ var osm;
+ function displayTimestamp(timestamp) {
+ if (!timestamp)
+ return _t("info_panels.history.unknown");
+ var options2 = {
+ day: "numeric",
+ month: "short",
+ year: "numeric",
+ hour: "numeric",
+ minute: "numeric",
+ second: "numeric"
+ };
+ var d = new Date(timestamp);
+ if (isNaN(d.getTime()))
+ return _t("info_panels.history.unknown");
+ return d.toLocaleString(_mainLocalizer.localeCode(), options2);
+ }
+ function displayUser(selection2, userName) {
+ if (!userName) {
+ selection2.append("span").call(_t.append("info_panels.history.unknown"));
+ return;
+ }
+ selection2.append("span").attr("class", "user-name").text(userName);
+ var links = selection2.append("div").attr("class", "links");
+ if (osm) {
+ links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
+ }
+ links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
}
-};
-
-iD.Way.prototype = Object.create(iD.Entity.prototype);
-
-_.extend(iD.Way.prototype, {
- type: 'way',
- nodes: [],
-
- copy: function(resolver, copies) {
- if (copies[this.id])
- return copies[this.id];
-
- var copy = iD.Entity.prototype.copy.call(this, resolver, copies);
-
- var nodes = this.nodes.map(function(id) {
- return resolver.entity(id).copy(resolver, copies).id;
- });
-
- copy = copy.update({nodes: nodes});
- copies[this.id] = copy;
-
- return copy;
- },
-
- extent: function(resolver) {
- return resolver.transient(this, 'extent', function() {
- var extent = iD.geo.Extent();
- for (var i = 0; i < this.nodes.length; i++) {
- var node = resolver.hasEntity(this.nodes[i]);
- if (node) {
- extent._extend(node.extent());
- }
- }
- return extent;
+ function displayChangeset(selection2, changeset) {
+ if (!changeset) {
+ selection2.append("span").call(_t.append("info_panels.history.unknown"));
+ return;
+ }
+ selection2.append("span").attr("class", "changeset-id").text(changeset);
+ var links = selection2.append("div").attr("class", "links");
+ if (osm) {
+ links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
+ }
+ links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
+ links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
+ }
+ function redraw(selection2) {
+ var selectedNoteID = context.selectedNoteID();
+ osm = context.connection();
+ var selected, note, entity;
+ if (selectedNoteID && osm) {
+ selected = [_t.html("note.note") + " " + selectedNoteID];
+ note = osm.getNote(selectedNoteID);
+ } else {
+ selected = context.selectedIDs().filter(function(e) {
+ return context.hasEntity(e);
});
- },
-
- first: function() {
- return this.nodes[0];
- },
-
- last: function() {
- return this.nodes[this.nodes.length - 1];
- },
-
- contains: function(node) {
- return this.nodes.indexOf(node) >= 0;
- },
-
- affix: function(node) {
- if (this.nodes[0] === node) return 'prefix';
- if (this.nodes[this.nodes.length - 1] === node) return 'suffix';
- },
-
- layer: function() {
- // explicit layer tag, clamp between -10, 10..
- if (this.tags.layer !== undefined) {
- return Math.max(-10, Math.min(+(this.tags.layer), 10));
- }
-
- // implied layer tag..
- if (this.tags.location === 'overground') return 1;
- if (this.tags.location === 'underground') return -1;
- if (this.tags.location === 'underwater') return -10;
-
- if (this.tags.power === 'line') return 10;
- if (this.tags.power === 'minor_line') return 10;
- if (this.tags.aerialway) return 10;
- if (this.tags.bridge) return 1;
- if (this.tags.cutting) return -1;
- if (this.tags.tunnel) return -1;
- if (this.tags.waterway) return -1;
- if (this.tags.man_made === 'pipeline') return -10;
- if (this.tags.boundary) return -10;
- return 0;
- },
-
- isOneWay: function() {
- // explicit oneway tag..
- if (['yes', '1', '-1'].indexOf(this.tags.oneway) !== -1) { return true; }
- if (['no', '0'].indexOf(this.tags.oneway) !== -1) { return false; }
-
- // implied oneway tag..
- for (var key in this.tags) {
- if (key in iD.oneWayTags && (this.tags[key] in iD.oneWayTags[key]))
- return true;
+ if (selected.length) {
+ entity = context.entity(selected[0]);
}
- return false;
- },
-
- isClosed: function() {
- return this.nodes.length > 0 && this.first() === this.last();
- },
-
- isConvex: function(resolver) {
- if (!this.isClosed() || this.isDegenerate()) return null;
+ }
+ var singular = selected.length === 1 ? selected[0] : null;
+ selection2.html("");
+ if (singular) {
+ selection2.append("h4").attr("class", "history-heading").html(singular);
+ } else {
+ selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
+ }
+ if (!singular)
+ return;
+ if (entity) {
+ selection2.call(redrawEntity, entity);
+ } else if (note) {
+ selection2.call(redrawNote, note);
+ }
+ }
+ function redrawNote(selection2, note) {
+ if (!note || note.isNew()) {
+ selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
+ return;
+ }
+ var list = selection2.append("ul");
+ list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
+ if (note.comments.length) {
+ list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
+ list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
+ }
+ if (osm) {
+ selection2.append("a").attr("class", "view-history-on-osm").attr("target", "_blank").attr("href", osm.noteURL(note)).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("info_panels.history.note_link_text"));
+ }
+ }
+ function redrawEntity(selection2, entity) {
+ if (!entity || entity.isNew()) {
+ selection2.append("div").call(_t.append("info_panels.history.no_history"));
+ return;
+ }
+ var links = selection2.append("div").attr("class", "links");
+ if (osm) {
+ links.append("a").attr("class", "view-history-on-osm").attr("href", osm.historyURL(entity)).attr("target", "_blank").call(_t.append("info_panels.history.history_link"));
+ }
+ links.append("a").attr("class", "pewu-history-viewer-link").attr("href", "https://pewu.github.io/osm-history/#/" + entity.type + "/" + entity.osmId()).attr("target", "_blank").attr("tabindex", -1).text("PeWu");
+ var list = selection2.append("ul");
+ list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
+ list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
+ list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
+ list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
+ }
+ var panel = function(selection2) {
+ selection2.call(redraw);
+ context.map().on("drawn.info-history", function() {
+ selection2.call(redraw);
+ });
+ context.on("enter.info-history", function() {
+ selection2.call(redraw);
+ });
+ };
+ panel.off = function() {
+ context.map().on("drawn.info-history", null);
+ context.on("enter.info-history", null);
+ };
+ panel.id = "history";
+ panel.label = _t.html("info_panels.history.title");
+ panel.key = _t("info_panels.history.key");
+ return panel;
+ }
- var nodes = _.uniq(resolver.childNodes(this)),
- coords = _.map(nodes, 'loc'),
- curr = 0, prev = 0;
+ // modules/util/units.js
+ var OSM_PRECISION = 7;
+ function displayLength(m, isImperial) {
+ var d = m * (isImperial ? 3.28084 : 1);
+ var unit2;
+ if (isImperial) {
+ if (d >= 5280) {
+ d /= 5280;
+ unit2 = "miles";
+ } else {
+ unit2 = "feet";
+ }
+ } else {
+ if (d >= 1e3) {
+ d /= 1e3;
+ unit2 = "kilometers";
+ } else {
+ unit2 = "meters";
+ }
+ }
+ return _t("units." + unit2, {
+ quantity: d.toLocaleString(_mainLocalizer.localeCode(), {
+ maximumSignificantDigits: 4
+ })
+ });
+ }
+ function displayArea(m2, isImperial) {
+ var locale2 = _mainLocalizer.localeCode();
+ var d = m2 * (isImperial ? 10.7639111056 : 1);
+ var d1, d2, area;
+ var unit1 = "";
+ var unit2 = "";
+ if (isImperial) {
+ if (d >= 6969600) {
+ d1 = d / 27878400;
+ unit1 = "square_miles";
+ } else {
+ d1 = d;
+ unit1 = "square_feet";
+ }
+ if (d > 4356 && d < 4356e4) {
+ d2 = d / 43560;
+ unit2 = "acres";
+ }
+ } else {
+ if (d >= 25e4) {
+ d1 = d / 1e6;
+ unit1 = "square_kilometers";
+ } else {
+ d1 = d;
+ unit1 = "square_meters";
+ }
+ if (d > 1e3 && d < 1e7) {
+ d2 = d / 1e4;
+ unit2 = "hectares";
+ }
+ }
+ area = _t("units." + unit1, {
+ quantity: d1.toLocaleString(locale2, {
+ maximumSignificantDigits: 4
+ })
+ });
+ if (d2) {
+ return _t("units.area_pair", {
+ area1: area,
+ area2: _t("units." + unit2, {
+ quantity: d2.toLocaleString(locale2, {
+ maximumSignificantDigits: 2
+ })
+ })
+ });
+ } else {
+ return area;
+ }
+ }
+ function wrap(x, min3, max3) {
+ var d = max3 - min3;
+ return ((x - min3) % d + d) % d + min3;
+ }
+ function clamp2(x, min3, max3) {
+ return Math.max(min3, Math.min(x, max3));
+ }
+ function displayCoordinate(deg, pos, neg) {
+ var locale2 = _mainLocalizer.localeCode();
+ var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
+ var sec = (min3 - Math.floor(min3)) * 60;
+ var displayDegrees = _t("units.arcdegrees", {
+ quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
+ });
+ var displayCoordinate2;
+ if (Math.floor(sec) > 0) {
+ displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
+ quantity: Math.floor(min3).toLocaleString(locale2)
+ }) + _t("units.arcseconds", {
+ quantity: Math.round(sec).toLocaleString(locale2)
+ });
+ } else if (Math.floor(min3) > 0) {
+ displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
+ quantity: Math.round(min3).toLocaleString(locale2)
+ });
+ } else {
+ displayCoordinate2 = _t("units.arcdegrees", {
+ quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
+ });
+ }
+ if (deg === 0) {
+ return displayCoordinate2;
+ } else {
+ return _t("units.coordinate", {
+ coordinate: displayCoordinate2,
+ direction: _t("units." + (deg > 0 ? pos : neg))
+ });
+ }
+ }
+ function dmsCoordinatePair(coord2) {
+ return _t("units.coordinate_pair", {
+ latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
+ longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
+ });
+ }
+ function decimalCoordinatePair(coord2) {
+ return _t("units.coordinate_pair", {
+ latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
+ longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
+ });
+ }
- for (var i = 0; i < coords.length; i++) {
- var o = coords[(i+1) % coords.length],
- a = coords[i],
- b = coords[(i+2) % coords.length],
- res = iD.geo.cross(o, a, b);
+ // modules/ui/panels/location.js
+ function uiPanelLocation(context) {
+ var currLocation = "";
+ function redraw(selection2) {
+ selection2.html("");
+ var list = selection2.append("ul");
+ var coord2 = context.map().mouseCoordinates();
+ if (coord2.some(isNaN)) {
+ coord2 = context.map().center();
+ }
+ list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
+ selection2.append("div").attr("class", "location-info").text(currLocation || " ");
+ debouncedGetLocation(selection2, coord2);
+ }
+ var debouncedGetLocation = debounce_default(getLocation, 250);
+ function getLocation(selection2, coord2) {
+ if (!services.geocoder) {
+ currLocation = _t("info_panels.location.unknown_location");
+ selection2.selectAll(".location-info").text(currLocation);
+ } else {
+ services.geocoder.reverse(coord2, function(err, result) {
+ currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
+ selection2.selectAll(".location-info").text(currLocation);
+ });
+ }
+ }
+ var panel = function(selection2) {
+ selection2.call(redraw);
+ context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
+ selection2.call(redraw);
+ });
+ };
+ panel.off = function() {
+ context.surface().on(".info-location", null);
+ };
+ panel.id = "location";
+ panel.label = _t.html("info_panels.location.title");
+ panel.key = _t("info_panels.location.key");
+ return panel;
+ }
- curr = (res > 0) ? 1 : (res < 0) ? -1 : 0;
- if (curr === 0) {
- continue;
- } else if (prev && curr !== prev) {
- return false;
+ // modules/ui/panels/measurement.js
+ function uiPanelMeasurement(context) {
+ function radiansToMeters(r) {
+ return r * 63710071809e-4;
+ }
+ function steradiansToSqmeters(r) {
+ return r / (4 * Math.PI) * 510065621724e3;
+ }
+ function toLineString(feature3) {
+ if (feature3.type === "LineString")
+ return feature3;
+ var result = { type: "LineString", coordinates: [] };
+ if (feature3.type === "Polygon") {
+ result.coordinates = feature3.coordinates[0];
+ } else if (feature3.type === "MultiPolygon") {
+ result.coordinates = feature3.coordinates[0][0];
+ }
+ return result;
+ }
+ var _isImperial = !_mainLocalizer.usesMetric();
+ function redraw(selection2) {
+ var graph = context.graph();
+ var selectedNoteID = context.selectedNoteID();
+ var osm = services.osm;
+ var localeCode = _mainLocalizer.localeCode();
+ var heading;
+ var center, location, centroid;
+ var closed, geometry;
+ var totalNodeCount, length = 0, area = 0, distance;
+ if (selectedNoteID && osm) {
+ var note = osm.getNote(selectedNoteID);
+ heading = _t.html("note.note") + " " + selectedNoteID;
+ location = note.loc;
+ geometry = "note";
+ } else {
+ var selectedIDs = context.selectedIDs().filter(function(id2) {
+ return context.hasEntity(id2);
+ });
+ var selected = selectedIDs.map(function(id2) {
+ return context.entity(id2);
+ });
+ heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
+ if (selected.length) {
+ var extent = geoExtent();
+ for (var i2 in selected) {
+ var entity = selected[i2];
+ extent._extend(entity.extent(graph));
+ geometry = entity.geometry(graph);
+ if (geometry === "line" || geometry === "area") {
+ closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
+ var feature3 = entity.asGeoJSON(graph);
+ length += radiansToMeters(length_default(toLineString(feature3)));
+ centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
+ centroid = centroid && context.projection.invert(centroid);
+ if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
+ centroid = entity.extent(graph).center();
+ }
+ if (closed) {
+ area += steradiansToSqmeters(entity.area(graph));
+ }
}
- prev = curr;
+ }
+ if (selected.length > 1) {
+ geometry = null;
+ closed = null;
+ centroid = null;
+ }
+ if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
+ distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
+ }
+ if (selected.length === 1 && selected[0].type === "node") {
+ location = selected[0].loc;
+ } else {
+ totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
+ }
+ if (!location && !centroid) {
+ center = extent.center();
+ }
}
- return true;
- },
-
- isArea: function() {
- if (this.tags.area === 'yes')
- return true;
- if (!this.isClosed() || this.tags.area === 'no')
- return false;
- for (var key in this.tags)
- if (key in iD.areaKeys && !(this.tags[key] in iD.areaKeys[key]))
- return true;
- return false;
- },
+ }
+ selection2.html("");
+ if (heading) {
+ selection2.append("h4").attr("class", "measurement-heading").html(heading);
+ }
+ var list = selection2.append("ul");
+ var coordItem;
+ if (geometry) {
+ list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry));
+ }
+ if (totalNodeCount) {
+ list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
+ }
+ if (area) {
+ list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
+ }
+ if (length) {
+ list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
+ }
+ if (typeof distance === "number") {
+ list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
+ }
+ if (location) {
+ coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
+ coordItem.append("span").text(dmsCoordinatePair(location));
+ coordItem.append("span").text(decimalCoordinatePair(location));
+ }
+ if (centroid) {
+ coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
+ coordItem.append("span").text(dmsCoordinatePair(centroid));
+ coordItem.append("span").text(decimalCoordinatePair(centroid));
+ }
+ if (center) {
+ coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
+ coordItem.append("span").text(dmsCoordinatePair(center));
+ coordItem.append("span").text(decimalCoordinatePair(center));
+ }
+ if (length || area || typeof distance === "number") {
+ var toggle = _isImperial ? "imperial" : "metric";
+ selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ _isImperial = !_isImperial;
+ selection2.call(redraw);
+ });
+ }
+ }
+ var panel = function(selection2) {
+ selection2.call(redraw);
+ context.map().on("drawn.info-measurement", function() {
+ selection2.call(redraw);
+ });
+ context.on("enter.info-measurement", function() {
+ selection2.call(redraw);
+ });
+ };
+ panel.off = function() {
+ context.map().on("drawn.info-measurement", null);
+ context.on("enter.info-measurement", null);
+ };
+ panel.id = "measurement";
+ panel.label = _t.html("info_panels.measurement.title");
+ panel.key = _t("info_panels.measurement.key");
+ return panel;
+ }
- isDegenerate: function() {
- return _.uniq(this.nodes).length < (this.isArea() ? 3 : 2);
- },
+ // modules/ui/panels/index.js
+ var uiInfoPanels = {
+ background: uiPanelBackground,
+ history: uiPanelHistory,
+ location: uiPanelLocation,
+ measurement: uiPanelMeasurement
+ };
- areAdjacent: function(n1, n2) {
- for (var i = 0; i < this.nodes.length; i++) {
- if (this.nodes[i] === n1) {
- if (this.nodes[i - 1] === n2) return true;
- if (this.nodes[i + 1] === n2) return true;
- }
+ // modules/ui/info.js
+ function uiInfo(context) {
+ var ids = Object.keys(uiInfoPanels);
+ var wasActive = ["measurement"];
+ var panels = {};
+ var active = {};
+ ids.forEach(function(k) {
+ if (!panels[k]) {
+ panels[k] = uiInfoPanels[k](context);
+ active[k] = false;
+ }
+ });
+ function info(selection2) {
+ function redraw() {
+ var activeids = ids.filter(function(k) {
+ return active[k];
+ }).sort();
+ var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k) {
+ return k;
+ });
+ containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d) {
+ select_default2(this).call(panels[d].off).remove();
+ });
+ var enter = containers.enter().append("div").attr("class", function(d) {
+ return "fillD2 panel-container panel-container-" + d;
+ });
+ enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
+ var title = enter.append("div").attr("class", "panel-title fillD2");
+ title.append("h3").html(function(d) {
+ return panels[d].label;
+ });
+ title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d) {
+ d3_event.stopImmediatePropagation();
+ d3_event.preventDefault();
+ info.toggle(d);
+ }).call(svgIcon("#iD-icon-close"));
+ enter.append("div").attr("class", function(d) {
+ return "panel-content panel-content-" + d;
+ });
+ infoPanels.selectAll(".panel-content").each(function(d) {
+ select_default2(this).call(panels[d]);
+ });
+ }
+ info.toggle = function(which) {
+ var activeids = ids.filter(function(k) {
+ return active[k];
+ });
+ if (which) {
+ active[which] = !active[which];
+ if (activeids.length === 1 && activeids[0] === which) {
+ wasActive = [which];
+ }
+ context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
+ } else {
+ if (activeids.length) {
+ wasActive = activeids;
+ activeids.forEach(function(k) {
+ active[k] = false;
+ });
+ } else {
+ wasActive.forEach(function(k) {
+ active[k] = true;
+ });
+ }
}
- return false;
- },
-
- geometry: function(graph) {
- return graph.transient(this, 'geometry', function() {
- return this.isArea() ? 'area' : 'line';
+ redraw();
+ };
+ var infoPanels = selection2.selectAll(".info-panels").data([0]);
+ infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
+ redraw();
+ context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
+ d3_event.stopImmediatePropagation();
+ d3_event.preventDefault();
+ info.toggle();
+ });
+ ids.forEach(function(k) {
+ var key = _t("info_panels." + k + ".key", { default: null });
+ if (!key)
+ return;
+ context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
+ d3_event.stopImmediatePropagation();
+ d3_event.preventDefault();
+ info.toggle(k);
});
- },
-
- addNode: function(id, index) {
- var nodes = this.nodes.slice();
- nodes.splice(index === undefined ? nodes.length : index, 0, id);
- return this.update({nodes: nodes});
- },
-
- updateNode: function(id, index) {
- var nodes = this.nodes.slice();
- nodes.splice(index, 1, id);
- return this.update({nodes: nodes});
- },
-
- replaceNode: function(needle, replacement) {
- if (this.nodes.indexOf(needle) < 0)
- return this;
+ });
+ }
+ return info;
+ }
- var nodes = this.nodes.slice();
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i] === needle) {
- nodes[i] = replacement;
- }
+ // modules/ui/intro/helper.js
+ function pointBox(loc, context) {
+ var rect = context.surfaceRect();
+ var point = context.curtainProjection(loc);
+ return {
+ left: point[0] + rect.left - 40,
+ top: point[1] + rect.top - 60,
+ width: 80,
+ height: 90
+ };
+ }
+ function pad(locOrBox, padding, context) {
+ var box;
+ if (locOrBox instanceof Array) {
+ var rect = context.surfaceRect();
+ var point = context.curtainProjection(locOrBox);
+ box = {
+ left: point[0] + rect.left,
+ top: point[1] + rect.top
+ };
+ } else {
+ box = locOrBox;
+ }
+ return {
+ left: box.left - padding,
+ top: box.top - padding,
+ width: (box.width || 0) + 2 * padding,
+ height: (box.width || 0) + 2 * padding
+ };
+ }
+ function icon(name2, svgklass, useklass) {
+ return '";
+ }
+ var helpStringReplacements;
+ function helpHtml(id2, replacements) {
+ if (!helpStringReplacements) {
+ helpStringReplacements = {
+ point_icon: icon("#iD-icon-point", "inline"),
+ line_icon: icon("#iD-icon-line", "inline"),
+ area_icon: icon("#iD-icon-area", "inline"),
+ note_icon: icon("#iD-icon-note", "inline add-note"),
+ plus: icon("#iD-icon-plus", "inline"),
+ minus: icon("#iD-icon-minus", "inline"),
+ layers_icon: icon("#iD-icon-layers", "inline"),
+ data_icon: icon("#iD-icon-data", "inline"),
+ inspect: icon("#iD-icon-inspect", "inline"),
+ help_icon: icon("#iD-icon-help", "inline"),
+ undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
+ redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
+ save_icon: icon("#iD-icon-save", "inline"),
+ circularize_icon: icon("#iD-operation-circularize", "inline operation"),
+ continue_icon: icon("#iD-operation-continue", "inline operation"),
+ copy_icon: icon("#iD-operation-copy", "inline operation"),
+ delete_icon: icon("#iD-operation-delete", "inline operation"),
+ disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
+ downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
+ extract_icon: icon("#iD-operation-extract", "inline operation"),
+ merge_icon: icon("#iD-operation-merge", "inline operation"),
+ move_icon: icon("#iD-operation-move", "inline operation"),
+ orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
+ paste_icon: icon("#iD-operation-paste", "inline operation"),
+ reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
+ reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
+ reverse_icon: icon("#iD-operation-reverse", "inline operation"),
+ rotate_icon: icon("#iD-operation-rotate", "inline operation"),
+ split_icon: icon("#iD-operation-split", "inline operation"),
+ straighten_icon: icon("#iD-operation-straighten", "inline operation"),
+ leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
+ rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
+ mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
+ tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
+ doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
+ longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
+ touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
+ pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
+ shift: uiCmd.display("\u21E7"),
+ alt: uiCmd.display("\u2325"),
+ return: uiCmd.display("\u21B5"),
+ esc: _t.html("shortcuts.key.esc"),
+ space: _t.html("shortcuts.key.space"),
+ add_note_key: _t.html("modes.add_note.key"),
+ help_key: _t.html("help.key"),
+ shortcuts_key: _t.html("shortcuts.toggle.key"),
+ save: _t.html("save.title"),
+ undo: _t.html("undo.title"),
+ redo: _t.html("redo.title"),
+ upload: _t.html("commit.save"),
+ point: _t.html("modes.add_point.title"),
+ line: _t.html("modes.add_line.title"),
+ area: _t.html("modes.add_area.title"),
+ note: _t.html("modes.add_note.label"),
+ circularize: _t.html("operations.circularize.title"),
+ continue: _t.html("operations.continue.title"),
+ copy: _t.html("operations.copy.title"),
+ delete: _t.html("operations.delete.title"),
+ disconnect: _t.html("operations.disconnect.title"),
+ downgrade: _t.html("operations.downgrade.title"),
+ extract: _t.html("operations.extract.title"),
+ merge: _t.html("operations.merge.title"),
+ move: _t.html("operations.move.title"),
+ orthogonalize: _t.html("operations.orthogonalize.title"),
+ paste: _t.html("operations.paste.title"),
+ reflect_long: _t.html("operations.reflect.title.long"),
+ reflect_short: _t.html("operations.reflect.title.short"),
+ reverse: _t.html("operations.reverse.title"),
+ rotate: _t.html("operations.rotate.title"),
+ split: _t.html("operations.split.title"),
+ straighten: _t.html("operations.straighten.title"),
+ map_data: _t.html("map_data.title"),
+ osm_notes: _t.html("map_data.layers.notes.title"),
+ fields: _t.html("inspector.fields"),
+ tags: _t.html("inspector.tags"),
+ relations: _t.html("inspector.relations"),
+ new_relation: _t.html("inspector.new_relation"),
+ turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
+ background_settings: _t.html("background.description"),
+ imagery_offset: _t.html("background.fix_misalignment"),
+ start_the_walkthrough: _t.html("splash.walkthrough"),
+ help: _t.html("help.title"),
+ ok: _t.html("intro.ok")
+ };
+ for (var key in helpStringReplacements) {
+ helpStringReplacements[key] = { html: helpStringReplacements[key] };
+ }
+ }
+ var reps;
+ if (replacements) {
+ reps = Object.assign(replacements, helpStringReplacements);
+ } else {
+ reps = helpStringReplacements;
+ }
+ return _t.html(id2, reps).replace(/\`(.*?)\`/g, "$1");
+ }
+ function slugify(text2) {
+ return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
+ }
+ var missingStrings = {};
+ function checkKey(key, text2) {
+ if (_t(key, { default: void 0 }) === void 0) {
+ if (missingStrings.hasOwnProperty(key))
+ return;
+ missingStrings[key] = text2;
+ var missing = key + ": " + text2;
+ if (typeof console !== "undefined")
+ console.log(missing);
+ }
+ }
+ function localize(obj) {
+ var key;
+ var name2 = obj.tags && obj.tags.name;
+ if (name2) {
+ key = "intro.graph.name." + slugify(name2);
+ obj.tags.name = _t(key, { default: name2 });
+ checkKey(key, name2);
+ }
+ var street = obj.tags && obj.tags["addr:street"];
+ if (street) {
+ key = "intro.graph.name." + slugify(street);
+ obj.tags["addr:street"] = _t(key, { default: street });
+ checkKey(key, street);
+ var addrTags = [
+ "block_number",
+ "city",
+ "county",
+ "district",
+ "hamlet",
+ "neighbourhood",
+ "postcode",
+ "province",
+ "quarter",
+ "state",
+ "subdistrict",
+ "suburb"
+ ];
+ addrTags.forEach(function(k) {
+ var key2 = "intro.graph." + k;
+ var tag = "addr:" + k;
+ var val = obj.tags && obj.tags[tag];
+ var str2 = _t(key2, { default: val });
+ if (str2) {
+ if (str2.match(/^<.*>$/) !== null) {
+ delete obj.tags[tag];
+ } else {
+ obj.tags[tag] = str2;
+ }
}
- return this.update({nodes: nodes});
- },
+ });
+ }
+ return obj;
+ }
+ function isMostlySquare(points) {
+ var threshold = 15;
+ var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
+ var upperBound = Math.cos(threshold * Math.PI / 180);
+ for (var i2 = 0; i2 < points.length; i2++) {
+ var a = points[(i2 - 1 + points.length) % points.length];
+ var origin = points[i2];
+ var b = points[(i2 + 1) % points.length];
+ var dotp = geoVecNormalizedDot(a, b, origin);
+ var mag = Math.abs(dotp);
+ if (mag > lowerBound && mag < upperBound) {
+ return false;
+ }
+ }
+ return true;
+ }
+ function selectMenuItem(context, operation) {
+ return context.container().select(".edit-menu .edit-menu-item-" + operation);
+ }
+ function transitionTime(point1, point2) {
+ var distance = geoSphericalDistance(point1, point2);
+ if (distance === 0) {
+ return 0;
+ } else if (distance < 80) {
+ return 500;
+ } else {
+ return 1e3;
+ }
+ }
- removeNode: function(id) {
- var nodes = [];
+ // modules/ui/toggle.js
+ function uiToggle(show, callback) {
+ return function(selection2) {
+ selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
+ select_default2(this).classed("hide", !show).style("opacity", null);
+ if (callback)
+ callback.apply(this);
+ });
+ };
+ }
- for (var i = 0; i < this.nodes.length; i++) {
- var node = this.nodes[i];
- if (node !== id && nodes[nodes.length - 1] !== node) {
- nodes.push(node);
- }
+ // modules/ui/curtain.js
+ function uiCurtain(containerNode) {
+ var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
+ function curtain(selection2) {
+ surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
+ darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
+ select_default2(window).on("resize.curtain", resize);
+ tooltip = selection2.append("div").attr("class", "tooltip");
+ tooltip.append("div").attr("class", "popover-arrow");
+ tooltip.append("div").attr("class", "popover-inner");
+ resize();
+ function resize() {
+ surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
+ curtain.cut(darkness.datum());
+ }
+ }
+ curtain.reveal = function(box, html2, options2) {
+ options2 = options2 || {};
+ if (typeof box === "string") {
+ box = select_default2(box).node();
+ }
+ if (box && box.getBoundingClientRect) {
+ box = copyBox(box.getBoundingClientRect());
+ var containerRect = containerNode.getBoundingClientRect();
+ box.top -= containerRect.top;
+ box.left -= containerRect.left;
+ }
+ if (box && options2.padding) {
+ box.top -= options2.padding;
+ box.left -= options2.padding;
+ box.bottom += options2.padding;
+ box.right += options2.padding;
+ box.height += options2.padding * 2;
+ box.width += options2.padding * 2;
+ }
+ var tooltipBox;
+ if (options2.tooltipBox) {
+ tooltipBox = options2.tooltipBox;
+ if (typeof tooltipBox === "string") {
+ tooltipBox = select_default2(tooltipBox).node();
}
-
- // Preserve circularity
- if (this.nodes.length > 1 && this.first() === id && this.last() === id && nodes[nodes.length - 1] !== nodes[0]) {
- nodes.push(nodes[0]);
+ if (tooltipBox && tooltipBox.getBoundingClientRect) {
+ tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
}
-
- return this.update({nodes: nodes});
- },
-
- asJXON: function(changeset_id) {
- var r = {
- way: {
- '@id': this.osmId(),
- '@version': this.version || 0,
- nd: _.map(this.nodes, function(id) {
- return { keyAttributes: { ref: iD.Entity.id.toOSM(id) } };
- }),
- tag: _.map(this.tags, function(v, k) {
- return { keyAttributes: { k: k, v: v } };
- })
- }
- };
- if (changeset_id) r.way['@changeset'] = changeset_id;
- return r;
- },
-
- asGeoJSON: function(resolver) {
- return resolver.transient(this, 'GeoJSON', function() {
- var coordinates = _.map(resolver.childNodes(this), 'loc');
- if (this.isArea() && this.isClosed()) {
- return {
- type: 'Polygon',
- coordinates: [coordinates]
- };
+ } else {
+ tooltipBox = box;
+ }
+ if (tooltipBox && html2) {
+ if (html2.indexOf("**") !== -1) {
+ if (html2.indexOf(")(.+?)(\*\*)/, "$1$2$3");
+ } else {
+ html2 = html2.replace(/^(.+?)(\*\*)/, "$1$2");
+ }
+ html2 = html2.replace(/\*\*(.*?)\*\*/g, '$1');
+ }
+ html2 = html2.replace(/\*(.*?)\*/g, "$1");
+ html2 = html2.replace(/\{br\}/g, "
");
+ if (options2.buttonText && options2.buttonCallback) {
+ html2 += '";
+ }
+ var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
+ tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
+ if (options2.buttonText && options2.buttonCallback) {
+ var button = tooltip.selectAll(".button-section .button.action");
+ button.on("click", function(d3_event) {
+ d3_event.preventDefault();
+ options2.buttonCallback();
+ });
+ }
+ var tip = copyBox(tooltip.node().getBoundingClientRect()), w = containerNode.clientWidth, h = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
+ if (options2.tooltipClass === "intro-mouse") {
+ tip.height += 80;
+ }
+ if (tooltipBox.top + tooltipBox.height > h) {
+ tooltipBox.height -= tooltipBox.top + tooltipBox.height - h;
+ }
+ if (tooltipBox.left + tooltipBox.width > w) {
+ tooltipBox.width -= tooltipBox.left + tooltipBox.width - w;
+ }
+ if (tooltipBox.top + tooltipBox.height < 100) {
+ side = "bottom";
+ pos = [
+ tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
+ tooltipBox.top + tooltipBox.height
+ ];
+ } else if (tooltipBox.top > h - 140) {
+ side = "top";
+ pos = [
+ tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
+ tooltipBox.top - tip.height
+ ];
+ } else {
+ var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
+ if (_mainLocalizer.textDirection() === "rtl") {
+ if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
+ side = "right";
+ pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
} else {
- return {
- type: 'LineString',
- coordinates: coordinates
- };
- }
- });
- },
-
- area: function(resolver) {
- return resolver.transient(this, 'area', function() {
- var nodes = resolver.childNodes(this);
-
- var json = {
- type: 'Polygon',
- coordinates: [_.map(nodes, 'loc')]
- };
-
- if (!this.isClosed() && nodes.length) {
- json.coordinates[0].push(nodes[0].loc);
+ side = "left";
+ pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
}
-
- var area = d3.geo.area(json);
-
- // Heuristic for detecting counterclockwise winding order. Assumes
- // that OpenStreetMap polygons are not hemisphere-spanning.
- if (area > 2 * Math.PI) {
- json.coordinates[0] = json.coordinates[0].reverse();
- area = d3.geo.area(json);
+ } else {
+ if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) {
+ side = "left";
+ pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
+ } else {
+ side = "right";
+ pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
}
-
- return isNaN(area) ? 0 : area;
- });
+ }
+ }
+ if (options2.duration !== 0 || !tooltip.classed(side)) {
+ tooltip.call(uiToggle(true));
+ }
+ tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
+ var shiftY = 0;
+ if (side === "left" || side === "right") {
+ if (pos[1] < 60) {
+ shiftY = 60 - pos[1];
+ } else if (pos[1] + tip.height > h - 100) {
+ shiftY = h - pos[1] - tip.height - 100;
+ }
+ }
+ tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
+ } else {
+ tooltip.classed("in", false).call(uiToggle(false));
+ }
+ curtain.cut(box, options2.duration);
+ return tooltip;
+ };
+ curtain.cut = function(datum2, duration) {
+ darkness.datum(datum2).interrupt();
+ var selection2;
+ if (duration === 0) {
+ selection2 = darkness;
+ } else {
+ selection2 = darkness.transition().duration(duration || 600).ease(linear2);
+ }
+ selection2.attr("d", function(d) {
+ var containerWidth = containerNode.clientWidth;
+ var containerHeight = containerNode.clientHeight;
+ var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
+ if (!d)
+ return string;
+ return string + "M" + d.left + "," + d.top + "L" + d.left + "," + (d.top + d.height) + "L" + (d.left + d.width) + "," + (d.top + d.height) + "L" + (d.left + d.width) + "," + d.top + "Z";
+ });
+ };
+ curtain.remove = function() {
+ surface.remove();
+ tooltip.remove();
+ select_default2(window).on("resize.curtain", null);
+ };
+ function copyBox(src) {
+ return {
+ top: src.top,
+ right: src.right,
+ bottom: src.bottom,
+ left: src.left,
+ width: src.width,
+ height: src.height
+ };
}
-});
-iD.Background = function(context) {
- var dispatch = d3.dispatch('change'),
- baseLayer = iD.TileLayer(context).projection(context.projection),
- overlayLayers = [],
- backgroundSources;
+ return curtain;
+ }
+ // modules/ui/intro/welcome.js
+ function uiIntroWelcome(context, reveal) {
+ var dispatch10 = dispatch_default("done");
+ var chapter = {
+ title: "intro.welcome.title"
+ };
+ function welcome() {
+ context.map().centerZoom([-85.63591, 41.94285], 19);
+ reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.welcome"), { buttonText: _t.html("intro.ok"), buttonCallback: practice });
+ }
+ function practice() {
+ reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.practice"), { buttonText: _t.html("intro.ok"), buttonCallback: words });
+ }
+ function words() {
+ reveal(".intro-nav-wrap .chapter-welcome", helpHtml("intro.welcome.words"), { buttonText: _t.html("intro.ok"), buttonCallback: chapters });
+ }
+ function chapters() {
+ dispatch10.call("done");
+ reveal(".intro-nav-wrap .chapter-navigation", helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") }));
+ }
+ chapter.enter = function() {
+ welcome();
+ };
+ chapter.exit = function() {
+ context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
+ };
+ chapter.restart = function() {
+ chapter.exit();
+ chapter.enter();
+ };
+ return utilRebind(chapter, dispatch10, "on");
+ }
- function findSource(id) {
- return _.find(backgroundSources, function(d) {
- return d.id && d.id === id;
+ // modules/ui/intro/navigation.js
+ function uiIntroNavigation(context, reveal) {
+ var dispatch10 = dispatch_default("done");
+ var timeouts = [];
+ var hallId = "n2061";
+ var townHall = [-85.63591, 41.94285];
+ var springStreetId = "w397";
+ var springStreetEndId = "n1834";
+ var springStreet = [-85.63582, 41.94255];
+ var onewayField = _mainPresetIndex.field("oneway");
+ var maxspeedField = _mainPresetIndex.field("maxspeed");
+ var chapter = {
+ title: "intro.navigation.title"
+ };
+ function timeout2(f2, t) {
+ timeouts.push(window.setTimeout(f2, t));
+ }
+ function eventCancel(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ }
+ function isTownHallSelected() {
+ var ids = context.selectedIDs();
+ return ids.length === 1 && ids[0] === hallId;
+ }
+ function dragMap() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ var msec = transitionTime(townHall, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(townHall, 19, msec);
+ timeout2(function() {
+ var centerStart = context.map().center();
+ var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
+ var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
+ reveal(".surface", dragString);
+ context.map().on("drawn.intro", function() {
+ reveal(".surface", dragString, { duration: 0 });
+ });
+ context.map().on("move.intro", function() {
+ var centerNow = context.map().center();
+ if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
+ context.map().on("move.intro", null);
+ timeout2(function() {
+ continueTo(zoomMap);
+ }, 3e3);
+ }
});
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
}
-
-
- function background(selection) {
- var base = selection.selectAll('.layer-background')
- .data([0]);
-
- base.enter()
- .insert('div', '.layer-data')
- .attr('class', 'layer layer-background');
-
- base.call(baseLayer);
-
- var overlays = selection.selectAll('.layer-overlay')
- .data(overlayLayers, function(d) { return d.source().name(); });
-
- overlays.enter()
- .insert('div', '.layer-data')
- .attr('class', 'layer layer-overlay');
-
- overlays.each(function(layer) {
- d3.select(this).call(layer);
+ function zoomMap() {
+ var zoomStart = context.map().zoom();
+ var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
+ var zoomString = helpHtml("intro.navigation." + textId);
+ reveal(".surface", zoomString);
+ context.map().on("drawn.intro", function() {
+ reveal(".surface", zoomString, { duration: 0 });
+ });
+ context.map().on("move.intro", function() {
+ if (context.map().zoom() !== zoomStart) {
+ context.map().on("move.intro", null);
+ timeout2(function() {
+ continueTo(features2);
+ }, 3e3);
+ }
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
+ }
+ function features2() {
+ var onClick = function() {
+ continueTo(pointsLinesAreas);
+ };
+ reveal(".surface", helpHtml("intro.navigation.features"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.map().on("drawn.intro", function() {
+ reveal(".surface", helpHtml("intro.navigation.features"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ });
+ function continueTo(nextStep) {
+ context.map().on("drawn.intro", null);
+ nextStep();
+ }
+ }
+ function pointsLinesAreas() {
+ var onClick = function() {
+ continueTo(nodesWays);
+ };
+ reveal(".surface", helpHtml("intro.navigation.points_lines_areas"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.map().on("drawn.intro", function() {
+ reveal(".surface", helpHtml("intro.navigation.points_lines_areas"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ });
+ function continueTo(nextStep) {
+ context.map().on("drawn.intro", null);
+ nextStep();
+ }
+ }
+ function nodesWays() {
+ var onClick = function() {
+ continueTo(clickTownHall);
+ };
+ reveal(".surface", helpHtml("intro.navigation.nodes_ways"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.map().on("drawn.intro", function() {
+ reveal(".surface", helpHtml("intro.navigation.nodes_ways"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ });
+ function continueTo(nextStep) {
+ context.map().on("drawn.intro", null);
+ nextStep();
+ }
+ }
+ function clickTownHall() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ var entity = context.hasEntity(hallId);
+ if (!entity)
+ return;
+ reveal(null, null, { duration: 0 });
+ context.map().centerZoomEase(entity.loc, 19, 500);
+ timeout2(function() {
+ var entity2 = context.hasEntity(hallId);
+ if (!entity2)
+ return;
+ var box = pointBox(entity2.loc, context);
+ var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
+ reveal(box, helpHtml("intro.navigation." + textId));
+ context.map().on("move.intro drawn.intro", function() {
+ var entity3 = context.hasEntity(hallId);
+ if (!entity3)
+ return;
+ var box2 = pointBox(entity3.loc, context);
+ reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
});
-
- overlays.exit()
- .remove();
+ context.on("enter.intro", function() {
+ if (isTownHallSelected())
+ continueTo(selectedTownHall);
+ });
+ }, 550);
+ context.history().on("change.intro", function() {
+ if (!context.hasEntity(hallId)) {
+ continueTo(clickTownHall);
+ }
+ });
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
}
-
-
- background.updateImagery = function() {
- var b = background.baseLayerSource(),
- o = overlayLayers.map(function (d) { return d.source().id; }).join(','),
- meters = iD.geo.offsetToMeters(b.offset()),
- epsilon = 0.01,
- x = +meters[0].toFixed(2),
- y = +meters[1].toFixed(2),
- q = iD.util.stringQs(location.hash.substring(1));
-
- var id = b.id;
- if (id === 'custom') {
- id = 'custom:' + b.template;
+ function selectedTownHall() {
+ if (!isTownHallSelected())
+ return clickTownHall();
+ var entity = context.hasEntity(hallId);
+ if (!entity)
+ return clickTownHall();
+ var box = pointBox(entity.loc, context);
+ var onClick = function() {
+ continueTo(editorTownHall);
+ };
+ reveal(box, helpHtml("intro.navigation.selected_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.map().on("move.intro drawn.intro", function() {
+ var entity2 = context.hasEntity(hallId);
+ if (!entity2)
+ return;
+ var box2 = pointBox(entity2.loc, context);
+ reveal(box2, helpHtml("intro.navigation.selected_townhall"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ });
+ context.history().on("change.intro", function() {
+ if (!context.hasEntity(hallId)) {
+ continueTo(clickTownHall);
}
-
- if (id) {
- q.background = id;
- } else {
- delete q.background;
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function editorTownHall() {
+ if (!isTownHallSelected())
+ return clickTownHall();
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ var onClick = function() {
+ continueTo(presetTownHall);
+ };
+ reveal(".entity-editor-pane", helpHtml("intro.navigation.editor_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.on("exit.intro", function() {
+ continueTo(clickTownHall);
+ });
+ context.history().on("change.intro", function() {
+ if (!context.hasEntity(hallId)) {
+ continueTo(clickTownHall);
}
-
- if (o) {
- q.overlays = o;
- } else {
- delete q.overlays;
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ nextStep();
+ }
+ }
+ function presetTownHall() {
+ if (!isTownHallSelected())
+ return clickTownHall();
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ var entity = context.entity(context.selectedIDs()[0]);
+ var preset = _mainPresetIndex.match(entity, context.graph());
+ var onClick = function() {
+ continueTo(fieldsTownHall);
+ };
+ reveal(".entity-editor-pane .section-feature-type", helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.on("exit.intro", function() {
+ continueTo(clickTownHall);
+ });
+ context.history().on("change.intro", function() {
+ if (!context.hasEntity(hallId)) {
+ continueTo(clickTownHall);
}
-
- if (Math.abs(x) > epsilon || Math.abs(y) > epsilon) {
- q.offset = x + ',' + y;
- } else {
- delete q.offset;
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ nextStep();
+ }
+ }
+ function fieldsTownHall() {
+ if (!isTownHallSelected())
+ return clickTownHall();
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ var onClick = function() {
+ continueTo(closeTownHall);
+ };
+ reveal(".entity-editor-pane .section-preset-fields", helpHtml("intro.navigation.fields_townhall"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.on("exit.intro", function() {
+ continueTo(clickTownHall);
+ });
+ context.history().on("change.intro", function() {
+ if (!context.hasEntity(hallId)) {
+ continueTo(clickTownHall);
}
-
- location.replace('#' + iD.util.qsString(q, true));
-
- var imageryUsed = [b.imageryUsed()];
-
- overlayLayers.forEach(function (d) {
- var source = d.source();
- if (!source.isLocatorOverlay()) {
- imageryUsed.push(source.imageryUsed());
- }
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ nextStep();
+ }
+ }
+ function closeTownHall() {
+ if (!isTownHallSelected())
+ return clickTownHall();
+ var selector = ".entity-editor-pane button.close svg use";
+ var href = select_default2(selector).attr("href") || "#iD-icon-close";
+ reveal(".entity-editor-pane", helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } }));
+ context.on("exit.intro", function() {
+ continueTo(searchStreet);
+ });
+ context.history().on("change.intro", function() {
+ var selector2 = ".entity-editor-pane button.close svg use";
+ var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
+ reveal(".entity-editor-pane", helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }), { duration: 0 });
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function searchStreet() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ var msec = transitionTime(springStreet, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(springStreet, 19, msec);
+ timeout2(function() {
+ reveal(".search-header input", helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") }));
+ context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
+ }, msec + 100);
+ }
+ function checkSearchResult() {
+ var first = context.container().select(".feature-list-item:nth-child(0n+2)");
+ var firstName = first.select(".entity-name");
+ var name2 = _t("intro.graph.name.spring-street");
+ if (!firstName.empty() && firstName.html() === name2) {
+ reveal(first.node(), helpHtml("intro.navigation.choose_street", { name: name2 }), { duration: 300 });
+ context.on("exit.intro", function() {
+ continueTo(selectedStreet);
});
-
- var gpx = context.layers().layer('gpx');
- if (gpx && gpx.enabled() && gpx.hasGpx()) {
- imageryUsed.push('Local GPX');
+ context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
+ }
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
+ nextStep();
+ }
+ }
+ function selectedStreet() {
+ if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
+ return searchStreet();
+ }
+ var onClick = function() {
+ continueTo(editorStreet);
+ };
+ var entity = context.entity(springStreetEndId);
+ var box = pointBox(entity.loc, context);
+ box.height = 500;
+ reveal(box, helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }), { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ timeout2(function() {
+ context.map().on("move.intro drawn.intro", function() {
+ var entity2 = context.hasEntity(springStreetEndId);
+ if (!entity2)
+ return;
+ var box2 = pointBox(entity2.loc, context);
+ box2.height = 500;
+ reveal(box2, helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ });
+ }, 600);
+ context.on("enter.intro", function(mode) {
+ if (!context.hasEntity(springStreetId)) {
+ return continueTo(searchStreet);
}
-
- var mapillary_images = context.layers().layer('mapillary-images');
- if (mapillary_images && mapillary_images.enabled()) {
- imageryUsed.push('Mapillary Images');
+ var ids = context.selectedIDs();
+ if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
+ context.enter(modeSelect(context, [springStreetId]));
}
-
- var mapillary_signs = context.layers().layer('mapillary-signs');
- if (mapillary_signs && mapillary_signs.enabled()) {
- imageryUsed.push('Mapillary Signs');
+ });
+ context.history().on("change.intro", function() {
+ if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
+ timeout2(function() {
+ continueTo(searchStreet);
+ }, 300);
}
-
- context.history().imageryUsed(imageryUsed);
- };
-
- background.sources = function(extent) {
- return backgroundSources.filter(function(source) {
- return source.intersects(extent);
- });
- };
-
- background.dimensions = function(_) {
- baseLayer.dimensions(_);
-
- overlayLayers.forEach(function(layer) {
- layer.dimensions(_);
- });
- };
-
- background.baseLayerSource = function(d) {
- if (!arguments.length) return baseLayer.source();
- baseLayer.source(d);
- dispatch.change();
- background.updateImagery();
- return background;
- };
-
- background.bing = function() {
- background.baseLayerSource(findSource('Bing'));
- };
-
- background.showsLayer = function(d) {
- return d === baseLayer.source() ||
- (d.id === 'custom' && baseLayer.source().id === 'custom') ||
- overlayLayers.some(function(l) { return l.source() === d; });
- };
-
- background.overlayLayerSources = function() {
- return overlayLayers.map(function (l) { return l.source(); });
- };
-
- background.toggleOverlayLayer = function(d) {
- var layer;
-
- for (var i = 0; i < overlayLayers.length; i++) {
- layer = overlayLayers[i];
- if (layer.source() === d) {
- overlayLayers.splice(i, 1);
- dispatch.change();
- background.updateImagery();
- return;
- }
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function editorStreet() {
+ var selector = ".entity-editor-pane button.close svg use";
+ var href = select_default2(selector).attr("href") || "#iD-icon-close";
+ reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
+ button: { html: icon(href, "inline") },
+ field1: { html: onewayField.label() },
+ field2: { html: maxspeedField.label() }
+ }));
+ context.on("exit.intro", function() {
+ continueTo(play);
+ });
+ context.history().on("change.intro", function() {
+ var selector2 = ".entity-editor-pane button.close svg use";
+ var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
+ reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
+ button: { html: icon(href2, "inline") },
+ field1: { html: onewayField.label() },
+ field2: { html: maxspeedField.label() }
+ }), { duration: 0 });
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function play() {
+ dispatch10.call("done");
+ reveal(".ideditor", helpHtml("intro.navigation.play", { next: _t("intro.points.title") }), {
+ tooltipBox: ".intro-nav-wrap .chapter-point",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ reveal(".ideditor");
}
-
- layer = iD.TileLayer(context)
- .source(d)
- .projection(context.projection)
- .dimensions(baseLayer.dimensions());
-
- overlayLayers.push(layer);
- dispatch.change();
- background.updateImagery();
+ });
+ }
+ chapter.enter = function() {
+ dragMap();
};
-
- background.nudge = function(d, zoom) {
- baseLayer.source().nudge(d, zoom);
- dispatch.change();
- background.updateImagery();
- return background;
+ chapter.exit = function() {
+ timeouts.forEach(window.clearTimeout);
+ context.on("enter.intro exit.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
};
-
- background.offset = function(d) {
- if (!arguments.length) return baseLayer.source().offset();
- baseLayer.source().offset(d);
- dispatch.change();
- background.updateImagery();
- return background;
+ chapter.restart = function() {
+ chapter.exit();
+ chapter.enter();
};
+ return utilRebind(chapter, dispatch10, "on");
+ }
- background.load = function(imagery) {
- function parseMap(qmap) {
- if (!qmap) return false;
- var args = qmap.split('/').map(Number);
- if (args.length < 3 || args.some(isNaN)) return false;
- return iD.geo.Extent([args[1], args[2]]);
- }
-
- var q = iD.util.stringQs(location.hash.substring(1)),
- chosen = q.background || q.layer,
- extent = parseMap(q.map),
- best;
-
- backgroundSources = imagery.map(function(source) {
- if (source.type === 'bing') {
- return iD.BackgroundSource.Bing(source, dispatch);
- } else {
- return iD.BackgroundSource(source);
- }
+ // modules/ui/intro/point.js
+ function uiIntroPoint(context, reveal) {
+ var dispatch10 = dispatch_default("done");
+ var timeouts = [];
+ var intersection = [-85.63279, 41.94394];
+ var building = [-85.632422, 41.944045];
+ var cafePreset = _mainPresetIndex.item("amenity/cafe");
+ var _pointID = null;
+ var chapter = {
+ title: "intro.points.title"
+ };
+ function timeout2(f2, t) {
+ timeouts.push(window.setTimeout(f2, t));
+ }
+ function eventCancel(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ }
+ function addPoint() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ var msec = transitionTime(intersection, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(intersection, 19, msec);
+ timeout2(function() {
+ var tooltip = reveal("button.add-point", helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point"));
+ _pointID = null;
+ tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "add-point")
+ return;
+ continueTo(placePoint);
});
-
- backgroundSources.unshift(iD.BackgroundSource.None());
-
- if (!chosen && extent) {
- best = _.find(this.sources(extent), function(s) { return s.best(); });
- }
-
- if (chosen && chosen.indexOf('custom:') === 0) {
- background.baseLayerSource(iD.BackgroundSource.Custom(chosen.replace(/^custom:/, '')));
- } else {
- background.baseLayerSource(findSource(chosen) || best || findSource('Bing') || backgroundSources[1] || backgroundSources[0]);
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function placePoint() {
+ if (context.mode().id !== "add-point") {
+ return chapter.restart();
+ }
+ var pointBox2 = pad(building, 150, context);
+ var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
+ reveal(pointBox2, helpHtml("intro.points." + textId));
+ context.map().on("move.intro drawn.intro", function() {
+ pointBox2 = pad(building, 150, context);
+ reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select")
+ return chapter.restart();
+ _pointID = context.mode().selectedIDs()[0];
+ continueTo(searchPreset);
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function searchPreset() {
+ if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
+ return addPoint();
+ }
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
+ reveal(".preset-search-input", helpHtml("intro.points.search_cafe", { preset: cafePreset.name() }));
+ context.on("enter.intro", function(mode) {
+ if (!_pointID || !context.hasEntity(_pointID)) {
+ return continueTo(addPoint);
+ }
+ var ids = context.selectedIDs();
+ if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
+ context.enter(modeSelect(context, [_pointID]));
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
+ reveal(".preset-search-input", helpHtml("intro.points.search_cafe", { preset: cafePreset.name() }));
+ context.history().on("change.intro", null);
}
-
- var locator = _.find(backgroundSources, function(d) {
- return d.overlay && d.default;
- });
-
- if (locator) {
- background.toggleOverlayLayer(locator);
+ });
+ function checkPresetSearch() {
+ var first = context.container().select(".preset-list-item:first-child");
+ if (first.classed("preset-amenity-cafe")) {
+ context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
+ reveal(first.select(".preset-list-button").node(), helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }), { duration: 300 });
+ context.history().on("change.intro", function() {
+ continueTo(aboutFeatureEditor);
+ });
}
-
- var overlays = (q.overlays || '').split(',');
- overlays.forEach(function(overlay) {
- overlay = findSource(overlay);
- if (overlay) {
- background.toggleOverlayLayer(overlay);
- }
+ }
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
+ nextStep();
+ }
+ }
+ function aboutFeatureEditor() {
+ if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
+ return addPoint();
+ }
+ timeout2(function() {
+ reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
+ tooltipClass: "intro-points-describe",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(addName);
+ }
});
-
- if (q.gpx) {
- var gpx = context.layers().layer('gpx');
- if (gpx) {
- gpx.url(q.gpx);
- }
- }
-
- if (q.offset) {
- var offset = q.offset.replace(/;/g, ',').split(',').map(function(n) {
- return !isNaN(n) && n;
- });
-
- if (offset.length === 2) {
- background.offset(iD.geo.metersToOffset(offset));
+ }, 400);
+ context.on("exit.intro", function() {
+ continueTo(reselectPoint);
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function addName() {
+ if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
+ return addPoint();
+ }
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
+ timeout2(function() {
+ var entity = context.entity(_pointID);
+ if (entity.tags.name) {
+ var tooltip = reveal(".entity-editor-pane", addNameString, {
+ tooltipClass: "intro-points-describe",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(addCloseEditor);
}
+ });
+ tooltip.select(".instruction").style("display", "none");
+ } else {
+ reveal(".entity-editor-pane", addNameString, { tooltipClass: "intro-points-describe" });
}
- };
-
- return d3.rebind(background, dispatch, 'on');
-};
-iD.BackgroundSource = function(data) {
- var source = _.clone(data),
- offset = [0, 0],
- name = source.name,
- best = !!source.best;
-
- source.scaleExtent = data.scaleExtent || [0, 20];
- source.overzoom = data.overzoom !== false;
-
- source.offset = function(_) {
- if (!arguments.length) return offset;
- offset = _;
- return source;
- };
-
- source.nudge = function(_, zoomlevel) {
- offset[0] += _[0] / Math.pow(2, zoomlevel);
- offset[1] += _[1] / Math.pow(2, zoomlevel);
- return source;
- };
-
- source.name = function() {
- return name;
- };
-
- source.best = function() {
- return best;
- };
-
- source.area = function() {
- if (!data.polygon) return Number.MAX_VALUE; // worldwide
- var area = d3.geo.area({ type: 'MultiPolygon', coordinates: [ data.polygon ] });
- return isNaN(area) ? 0 : area;
- };
-
- source.imageryUsed = function() {
- return source.id || name;
- };
-
- source.url = function(coord) {
- return data.template
- .replace('{x}', coord[0])
- .replace('{y}', coord[1])
- // TMS-flipped y coordinate
- .replace(/\{[t-]y\}/, Math.pow(2, coord[2]) - coord[1] - 1)
- .replace(/\{z(oom)?\}/, coord[2])
- .replace(/\{switch:([^}]+)\}/, function(s, r) {
- var subdomains = r.split(',');
- return subdomains[(coord[0] + coord[1]) % subdomains.length];
- })
- .replace('{u}', function() {
- var u = '';
- for (var zoom = coord[2]; zoom > 0; zoom--) {
- var b = 0;
- var mask = 1 << (zoom - 1);
- if ((coord[0] & mask) !== 0) b++;
- if ((coord[1] & mask) !== 0) b += 2;
- u += b.toString();
- }
- return u;
- });
- };
-
- source.intersects = function(extent) {
- extent = extent.polygon();
- return !data.polygon || data.polygon.some(function(polygon) {
- return iD.geo.polygonIntersectsPolygon(polygon, extent, true);
- });
- };
-
- source.validZoom = function(z) {
- return source.scaleExtent[0] <= z &&
- (source.overzoom || source.scaleExtent[1] > z);
- };
-
- source.isLocatorOverlay = function() {
- return name === 'Locator Overlay';
- };
-
- source.copyrightNotices = function() {};
-
- return source;
-};
-
-iD.BackgroundSource.Bing = function(data, dispatch) {
- // http://msdn.microsoft.com/en-us/library/ff701716.aspx
- // http://msdn.microsoft.com/en-us/library/ff701701.aspx
-
- data.template = 'https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=587&mkt=en-gb&n=z';
-
- var bing = iD.BackgroundSource(data),
- key = 'Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU', // Same as P2 and JOSM
- url = 'https://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial?include=ImageryProviders&key=' +
- key + '&jsonp={callback}',
- providers = [];
-
- d3.jsonp(url, function(json) {
- providers = json.resourceSets[0].resources[0].imageryProviders.map(function(provider) {
- return {
- attribution: provider.attribution,
- areas: provider.coverageAreas.map(function(area) {
- return {
- zoom: [area.zoomMin, area.zoomMax],
- extent: iD.geo.Extent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
- };
- })
- };
+ }, 400);
+ context.history().on("change.intro", function() {
+ continueTo(addCloseEditor);
+ });
+ context.on("exit.intro", function() {
+ continueTo(reselectPoint);
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function addCloseEditor() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ var selector = ".entity-editor-pane button.close svg use";
+ var href = select_default2(selector).attr("href") || "#iD-icon-close";
+ context.on("exit.intro", function() {
+ continueTo(reselectPoint);
+ });
+ reveal(".entity-editor-pane", helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } }));
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function reselectPoint() {
+ if (!_pointID)
+ return chapter.restart();
+ var entity = context.hasEntity(_pointID);
+ if (!entity)
+ return chapter.restart();
+ var oldPreset = _mainPresetIndex.match(entity, context.graph());
+ context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
+ context.enter(modeBrowse(context));
+ var msec = transitionTime(entity.loc, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerEase(entity.loc, msec);
+ timeout2(function() {
+ var box = pointBox(entity.loc, context);
+ reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
+ timeout2(function() {
+ context.map().on("move.intro drawn.intro", function() {
+ var entity2 = context.hasEntity(_pointID);
+ if (!entity2)
+ return chapter.restart();
+ var box2 = pointBox(entity2.loc, context);
+ reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
+ });
+ }, 600);
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select")
+ return;
+ continueTo(updatePoint);
});
- dispatch.change();
- });
-
- bing.copyrightNotices = function(zoom, extent) {
- zoom = Math.min(zoom, 21);
- return providers.filter(function(provider) {
- return _.some(provider.areas, function(area) {
- return extent.intersects(area.extent) &&
- area.zoom[0] <= zoom &&
- area.zoom[1] >= zoom;
- });
- }).map(function(provider) {
- return provider.attribution;
- }).join(', ');
- };
-
- bing.logo = 'bing_maps.png';
- bing.terms_url = 'https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details';
-
- return bing;
-};
-
-iD.BackgroundSource.None = function() {
- var source = iD.BackgroundSource({id: 'none', template: ''});
-
- source.name = function() {
- return t('background.none');
- };
-
- source.imageryUsed = function() {
- return 'None';
- };
-
- source.area = function() {
- return -1;
- };
-
- return source;
-};
-
-iD.BackgroundSource.Custom = function(template) {
- var source = iD.BackgroundSource({id: 'custom', template: template});
-
- source.name = function() {
- return t('background.custom');
- };
-
- source.imageryUsed = function() {
- return 'Custom (' + template + ')';
- };
-
- source.area = function() {
- return -2;
- };
-
- return source;
-};
-iD.Features = function(context) {
- var traffic_roads = {
- 'motorway': true,
- 'motorway_link': true,
- 'trunk': true,
- 'trunk_link': true,
- 'primary': true,
- 'primary_link': true,
- 'secondary': true,
- 'secondary_link': true,
- 'tertiary': true,
- 'tertiary_link': true,
- 'residential': true,
- 'unclassified': true,
- 'living_street': true
- };
-
- var service_roads = {
- 'service': true,
- 'road': true,
- 'track': true
- };
-
- var paths = {
- 'path': true,
- 'footway': true,
- 'cycleway': true,
- 'bridleway': true,
- 'steps': true,
- 'pedestrian': true,
- 'corridor': true
- };
-
- var past_futures = {
- 'proposed': true,
- 'construction': true,
- 'abandoned': true,
- 'dismantled': true,
- 'disused': true,
- 'razed': true,
- 'demolished': true,
- 'obliterated': true
- };
-
- var dispatch = d3.dispatch('change', 'redraw'),
- _cullFactor = 1,
- _cache = {},
- _features = {},
- _stats = {},
- _keys = [],
- _hidden = [];
-
- function update() {
- _hidden = features.hidden();
- dispatch.change();
- dispatch.redraw();
- }
-
- function defineFeature(k, filter, max) {
- _keys.push(k);
- _features[k] = {
- filter: filter,
- enabled: true, // whether the user wants it enabled..
- count: 0,
- currentMax: (max || Infinity),
- defaultMax: (max || Infinity),
- enable: function() { this.enabled = true; this.currentMax = this.defaultMax; },
- disable: function() { this.enabled = false; this.currentMax = 0; },
- hidden: function() { return !context.editable() || this.count > this.currentMax * _cullFactor; },
- autoHidden: function() { return this.hidden() && this.currentMax > 0; }
- };
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
-
- defineFeature('points', function isPoint(entity, resolver, geometry) {
- return geometry === 'point';
- }, 200);
-
- defineFeature('traffic_roads', function isTrafficRoad(entity) {
- return traffic_roads[entity.tags.highway];
- });
-
- defineFeature('service_roads', function isServiceRoad(entity) {
- return service_roads[entity.tags.highway];
- });
-
- defineFeature('paths', function isPath(entity) {
- return paths[entity.tags.highway];
- });
-
- defineFeature('buildings', function isBuilding(entity) {
- return (
- !!entity.tags['building:part'] ||
- (!!entity.tags.building && entity.tags.building !== 'no') ||
- entity.tags.amenity === 'shelter' ||
- entity.tags.parking === 'multi-storey' ||
- entity.tags.parking === 'sheds' ||
- entity.tags.parking === 'carports' ||
- entity.tags.parking === 'garage_boxes'
- );
- }, 250);
-
- defineFeature('landuse', function isLanduse(entity, resolver, geometry) {
- return geometry === 'area' &&
- !_features.buildings.filter(entity) &&
- !_features.water.filter(entity);
- });
-
- defineFeature('boundaries', function isBoundary(entity) {
- return !!entity.tags.boundary;
- });
-
- defineFeature('water', function isWater(entity) {
- return (
- !!entity.tags.waterway ||
- entity.tags.natural === 'water' ||
- entity.tags.natural === 'coastline' ||
- entity.tags.natural === 'bay' ||
- entity.tags.landuse === 'pond' ||
- entity.tags.landuse === 'basin' ||
- entity.tags.landuse === 'reservoir' ||
- entity.tags.landuse === 'salt_pond'
- );
- });
-
- defineFeature('rail', function isRail(entity) {
- return (
- !!entity.tags.railway ||
- entity.tags.landuse === 'railway'
- ) && !(
- traffic_roads[entity.tags.highway] ||
- service_roads[entity.tags.highway] ||
- paths[entity.tags.highway]
- );
- });
-
- defineFeature('power', function isPower(entity) {
- return !!entity.tags.power;
- });
-
- // contains a past/future tag, but not in active use as a road/path/cycleway/etc..
- defineFeature('past_future', function isPastFuture(entity) {
- if (
- traffic_roads[entity.tags.highway] ||
- service_roads[entity.tags.highway] ||
- paths[entity.tags.highway]
- ) { return false; }
-
- var strings = Object.keys(entity.tags);
-
- for (var i = 0; i < strings.length; i++) {
- var s = strings[i];
- if (past_futures[s] || past_futures[entity.tags[s]]) { return true; }
+ function updatePoint() {
+ if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
+ return continueTo(reselectPoint);
+ }
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ context.on("exit.intro", function() {
+ continueTo(reselectPoint);
+ });
+ context.history().on("change.intro", function() {
+ continueTo(updateCloseEditor);
+ });
+ timeout2(function() {
+ reveal(".entity-editor-pane", helpHtml("intro.points.update"), { tooltipClass: "intro-points-describe" });
+ }, 400);
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function updateCloseEditor() {
+ if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
+ return continueTo(reselectPoint);
+ }
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ context.on("exit.intro", function() {
+ continueTo(rightClickPoint);
+ });
+ timeout2(function() {
+ reveal(".entity-editor-pane", helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } }));
+ }, 500);
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function rightClickPoint() {
+ if (!_pointID)
+ return chapter.restart();
+ var entity = context.hasEntity(_pointID);
+ if (!entity)
+ return chapter.restart();
+ context.enter(modeBrowse(context));
+ var box = pointBox(entity.loc, context);
+ var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
+ reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
+ timeout2(function() {
+ context.map().on("move.intro", function() {
+ var entity2 = context.hasEntity(_pointID);
+ if (!entity2)
+ return chapter.restart();
+ var box2 = pointBox(entity2.loc, context);
+ reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
+ });
+ }, 600);
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select")
+ return;
+ var ids = context.selectedIDs();
+ if (ids.length !== 1 || ids[0] !== _pointID)
+ return;
+ timeout2(function() {
+ var node = selectMenuItem(context, "delete").node();
+ if (!node)
+ return;
+ continueTo(enterDelete);
+ }, 50);
+ });
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.map().on("move.intro", null);
+ nextStep();
+ }
+ }
+ function enterDelete() {
+ if (!_pointID)
+ return chapter.restart();
+ var entity = context.hasEntity(_pointID);
+ if (!entity)
+ return chapter.restart();
+ var node = selectMenuItem(context, "delete").node();
+ if (!node) {
+ return continueTo(rightClickPoint);
+ }
+ reveal(".edit-menu", helpHtml("intro.points.delete"), { padding: 50 });
+ timeout2(function() {
+ context.map().on("move.intro", function() {
+ reveal(".edit-menu", helpHtml("intro.points.delete"), { duration: 0, padding: 50 });
+ });
+ }, 300);
+ context.on("exit.intro", function() {
+ if (!_pointID)
+ return chapter.restart();
+ var entity2 = context.hasEntity(_pointID);
+ if (entity2)
+ return continueTo(rightClickPoint);
+ });
+ context.history().on("change.intro", function(changed) {
+ if (changed.deleted().length) {
+ continueTo(undo);
}
- return false;
- });
-
- // Lines or areas that don't match another feature filter.
- // IMPORTANT: The 'others' feature must be the last one defined,
- // so that code in getMatches can skip this test if `hasMatch = true`
- defineFeature('others', function isOther(entity, resolver, geometry) {
- return (geometry === 'line' || geometry === 'area');
- });
-
-
- function features() {}
-
- features.features = function() {
- return _features;
- };
-
- features.keys = function() {
- return _keys;
- };
-
- features.enabled = function(k) {
- if (!arguments.length) {
- return _.filter(_keys, function(k) { return _features[k].enabled; });
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro", null);
+ context.history().on("change.intro", null);
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function undo() {
+ context.history().on("change.intro", function() {
+ continueTo(play);
+ });
+ reveal(".top-toolbar button.undo-button", helpHtml("intro.points.undo"));
+ function continueTo(nextStep) {
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function play() {
+ dispatch10.call("done");
+ reveal(".ideditor", helpHtml("intro.points.play", { next: _t("intro.areas.title") }), {
+ tooltipBox: ".intro-nav-wrap .chapter-area",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ reveal(".ideditor");
}
- return _features[k] && _features[k].enabled;
+ });
+ }
+ chapter.enter = function() {
+ addPoint();
};
-
- features.disabled = function(k) {
- if (!arguments.length) {
- return _.reject(_keys, function(k) { return _features[k].enabled; });
- }
- return _features[k] && !_features[k].enabled;
+ chapter.exit = function() {
+ timeouts.forEach(window.clearTimeout);
+ context.on("enter.intro exit.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
};
-
- features.hidden = function(k) {
- if (!arguments.length) {
- return _.filter(_keys, function(k) { return _features[k].hidden(); });
- }
- return _features[k] && _features[k].hidden();
+ chapter.restart = function() {
+ chapter.exit();
+ chapter.enter();
};
+ return utilRebind(chapter, dispatch10, "on");
+ }
- features.autoHidden = function(k) {
- if (!arguments.length) {
- return _.filter(_keys, function(k) { return _features[k].autoHidden(); });
+ // modules/ui/intro/area.js
+ function uiIntroArea(context, reveal) {
+ var dispatch10 = dispatch_default("done");
+ var playground = [-85.63552, 41.94159];
+ var playgroundPreset = _mainPresetIndex.item("leisure/playground");
+ var nameField = _mainPresetIndex.field("name");
+ var descriptionField = _mainPresetIndex.field("description");
+ var timeouts = [];
+ var _areaID;
+ var chapter = {
+ title: "intro.areas.title"
+ };
+ function timeout2(f2, t) {
+ timeouts.push(window.setTimeout(f2, t));
+ }
+ function eventCancel(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ }
+ function revealPlayground(center, text2, options2) {
+ var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
+ var box = pad(center, padding, context);
+ reveal(box, text2, options2);
+ }
+ function addArea() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ _areaID = null;
+ var msec = transitionTime(playground, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(playground, 19, msec);
+ timeout2(function() {
+ var tooltip = reveal("button.add-area", helpHtml("intro.areas.add_playground"));
+ tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "add-area")
+ return;
+ continueTo(startPlayground);
+ });
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function startPlayground() {
+ if (context.mode().id !== "add-area") {
+ return chapter.restart();
+ }
+ _areaID = null;
+ context.map().zoomEase(19.5, 500);
+ timeout2(function() {
+ var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
+ var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
+ revealPlayground(playground, startDrawString, { duration: 250 });
+ timeout2(function() {
+ context.map().on("move.intro drawn.intro", function() {
+ revealPlayground(playground, startDrawString, { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "draw-area")
+ return chapter.restart();
+ continueTo(continuePlayground);
+ });
+ }, 250);
+ }, 550);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function continuePlayground() {
+ if (context.mode().id !== "draw-area") {
+ return chapter.restart();
+ }
+ _areaID = null;
+ revealPlayground(playground, helpHtml("intro.areas.continue_playground"), { duration: 250 });
+ timeout2(function() {
+ context.map().on("move.intro drawn.intro", function() {
+ revealPlayground(playground, helpHtml("intro.areas.continue_playground"), { duration: 0 });
+ });
+ }, 250);
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "draw-area") {
+ var entity = context.hasEntity(context.selectedIDs()[0]);
+ if (entity && entity.nodes.length >= 6) {
+ return continueTo(finishPlayground);
+ } else {
+ return;
+ }
+ } else if (mode.id === "select") {
+ _areaID = context.selectedIDs()[0];
+ return continueTo(searchPresets);
+ } else {
+ return chapter.restart();
}
- return _features[k] && _features[k].autoHidden();
- };
-
- features.enable = function(k) {
- if (_features[k] && !_features[k].enabled) {
- _features[k].enable();
- update();
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function finishPlayground() {
+ if (context.mode().id !== "draw-area") {
+ return chapter.restart();
+ }
+ _areaID = null;
+ var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
+ revealPlayground(playground, finishString, { duration: 250 });
+ timeout2(function() {
+ context.map().on("move.intro drawn.intro", function() {
+ revealPlayground(playground, finishString, { duration: 0 });
+ });
+ }, 250);
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "draw-area") {
+ return;
+ } else if (mode.id === "select") {
+ _areaID = context.selectedIDs()[0];
+ return continueTo(searchPresets);
+ } else {
+ return chapter.restart();
}
- };
-
- features.disable = function(k) {
- if (_features[k] && _features[k].enabled) {
- _features[k].disable();
- update();
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function searchPresets() {
+ if (!_areaID || !context.hasEntity(_areaID)) {
+ return addArea();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
+ context.enter(modeSelect(context, [_areaID]));
+ }
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
+ reveal(".preset-search-input", helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() }));
+ }, 400);
+ context.on("enter.intro", function(mode) {
+ if (!_areaID || !context.hasEntity(_areaID)) {
+ return continueTo(addArea);
+ }
+ var ids2 = context.selectedIDs();
+ if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
+ context.enter(modeSelect(context, [_areaID]));
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
+ reveal(".preset-search-input", helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() }));
+ context.history().on("change.intro", null);
}
- };
-
- features.toggle = function(k) {
- if (_features[k]) {
- (function(f) { return f.enabled ? f.disable() : f.enable(); }(_features[k]));
- update();
+ });
+ function checkPresetSearch() {
+ var first = context.container().select(".preset-list-item:first-child");
+ if (first.classed("preset-leisure-playground")) {
+ reveal(first.select(".preset-list-button").node(), helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }), { duration: 300 });
+ context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
+ context.history().on("change.intro", function() {
+ continueTo(clickAddField);
+ });
}
- };
-
- features.resetStats = function() {
- _.each(_features, function(f) { f.count = 0; });
- dispatch.change();
- };
-
- features.gatherStats = function(d, resolver, dimensions) {
- var needsRedraw = false,
- type = _.groupBy(d, function(ent) { return ent.type; }),
- entities = [].concat(type.relation || [], type.way || [], type.node || []),
- currHidden, geometry, matches;
-
- _.each(_features, function(f) { f.count = 0; });
-
- // adjust the threshold for point/building culling based on viewport size..
- // a _cullFactor of 1 corresponds to a 1000x1000px viewport..
- _cullFactor = dimensions[0] * dimensions[1] / 1000000;
-
- for (var i = 0; i < entities.length; i++) {
- geometry = entities[i].geometry(resolver);
- if (!(geometry === 'vertex' || geometry === 'relation')) {
- matches = Object.keys(features.getMatches(entities[i], resolver, geometry));
- for (var j = 0; j < matches.length; j++) {
- _features[matches[j]].count++;
- }
+ }
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
+ nextStep();
+ }
+ }
+ function clickAddField() {
+ if (!_areaID || !context.hasEntity(_areaID)) {
+ return addArea();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
+ return searchPresets();
+ }
+ if (!context.container().select(".form-field-description").empty()) {
+ return continueTo(describePlayground);
+ }
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ var entity = context.entity(_areaID);
+ if (entity.tags.description) {
+ return continueTo(play);
+ }
+ var box = context.container().select(".more-fields").node().getBoundingClientRect();
+ if (box.top > 300) {
+ var pane = context.container().select(".entity-editor-pane .inspector-body");
+ var start2 = pane.node().scrollTop;
+ var end = start2 + (box.top - 300);
+ pane.transition().duration(250).tween("scroll.inspector", function() {
+ var node = this;
+ var i2 = number_default(start2, end);
+ return function(t) {
+ node.scrollTop = i2(t);
+ };
+ });
+ }
+ timeout2(function() {
+ reveal(".more-fields .combobox-input", helpHtml("intro.areas.add_field", {
+ name: { html: nameField.label() },
+ description: { html: descriptionField.label() }
+ }), { duration: 300 });
+ context.container().select(".more-fields .combobox-input").on("click.intro", function() {
+ var watcher;
+ watcher = window.setInterval(function() {
+ if (!context.container().select("div.combobox").empty()) {
+ window.clearInterval(watcher);
+ continueTo(chooseDescriptionField);
+ }
+ }, 300);
+ });
+ }, 300);
+ }, 400);
+ context.on("exit.intro", function() {
+ return continueTo(searchPresets);
+ });
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".more-fields .combobox-input").on("click.intro", null);
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function chooseDescriptionField() {
+ if (!_areaID || !context.hasEntity(_areaID)) {
+ return addArea();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
+ return searchPresets();
+ }
+ if (!context.container().select(".form-field-description").empty()) {
+ return continueTo(describePlayground);
+ }
+ if (context.container().select("div.combobox").empty()) {
+ return continueTo(clickAddField);
+ }
+ var watcher;
+ watcher = window.setInterval(function() {
+ if (context.container().select("div.combobox").empty()) {
+ window.clearInterval(watcher);
+ timeout2(function() {
+ if (context.container().select(".form-field-description").empty()) {
+ continueTo(retryChooseDescription);
+ } else {
+ continueTo(describePlayground);
}
+ }, 300);
}
-
- currHidden = features.hidden();
- if (currHidden !== _hidden) {
- _hidden = currHidden;
- needsRedraw = true;
- dispatch.change();
+ }, 300);
+ reveal("div.combobox", helpHtml("intro.areas.choose_field", { field: { html: descriptionField.label() } }), { duration: 300 });
+ context.on("exit.intro", function() {
+ return continueTo(searchPresets);
+ });
+ function continueTo(nextStep) {
+ if (watcher)
+ window.clearInterval(watcher);
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function describePlayground() {
+ if (!_areaID || !context.hasEntity(_areaID)) {
+ return addArea();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
+ return searchPresets();
+ }
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ if (context.container().select(".form-field-description").empty()) {
+ return continueTo(retryChooseDescription);
+ }
+ context.on("exit.intro", function() {
+ continueTo(play);
+ });
+ reveal(".entity-editor-pane", helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }), { duration: 300 });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function retryChooseDescription() {
+ if (!_areaID || !context.hasEntity(_areaID)) {
+ return addArea();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
+ return searchPresets();
+ }
+ context.container().select(".inspector-wrap .panewrap").style("right", "0%");
+ reveal(".entity-editor-pane", helpHtml("intro.areas.retry_add_field", { field: { html: descriptionField.label() } }), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(clickAddField);
}
-
- return needsRedraw;
- };
-
- features.stats = function() {
- _.each(_keys, function(k) { _stats[k] = _features[k].count; });
- return _stats;
- };
-
- features.clear = function(d) {
- for (var i = 0; i < d.length; i++) {
- features.clearEntity(d[i]);
+ });
+ context.on("exit.intro", function() {
+ return continueTo(searchPresets);
+ });
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function play() {
+ dispatch10.call("done");
+ reveal(".ideditor", helpHtml("intro.areas.play", { next: _t("intro.lines.title") }), {
+ tooltipBox: ".intro-nav-wrap .chapter-line",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ reveal(".ideditor");
}
+ });
+ }
+ chapter.enter = function() {
+ addArea();
};
-
- features.clearEntity = function(entity) {
- delete _cache[iD.Entity.key(entity)];
+ chapter.exit = function() {
+ timeouts.forEach(window.clearTimeout);
+ context.on("enter.intro exit.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
+ context.container().select(".more-fields .combobox-input").on("click.intro", null);
};
-
- features.reset = function() {
- _cache = {};
+ chapter.restart = function() {
+ chapter.exit();
+ chapter.enter();
};
+ return utilRebind(chapter, dispatch10, "on");
+ }
- features.getMatches = function(entity, resolver, geometry) {
- if (geometry === 'vertex' || geometry === 'relation') return {};
-
- var ent = iD.Entity.key(entity);
- if (!_cache[ent]) {
- _cache[ent] = {};
- }
-
- if (!_cache[ent].matches) {
- var matches = {},
- hasMatch = false;
-
- for (var i = 0; i < _keys.length; i++) {
- if (_keys[i] === 'others') {
- if (hasMatch) continue;
-
- // Multipolygon members:
- // If an entity...
- // 1. is a way that hasn't matched other "interesting" feature rules,
- // 2. and it belongs to a single parent multipolygon relation
- // ...then match whatever feature rules the parent multipolygon has matched.
- // see #2548, #2887
- //
- // IMPORTANT:
- // For this to work, getMatches must be called on relations before ways.
- //
- if (entity.type === 'way') {
- var parents = features.getParents(entity, resolver, geometry);
- if (parents.length === 1 && parents[0].isMultipolygon()) {
- var pkey = iD.Entity.key(parents[0]);
- if (_cache[pkey] && _cache[pkey].matches) {
- matches = _.clone(_cache[pkey].matches);
- continue;
- }
- }
- }
- }
-
- if (_features[_keys[i]].filter(entity, resolver, geometry)) {
- matches[_keys[i]] = hasMatch = true;
- }
- }
- _cache[ent].matches = matches;
+ // modules/ui/intro/line.js
+ function uiIntroLine(context, reveal) {
+ var dispatch10 = dispatch_default("done");
+ var timeouts = [];
+ var _tulipRoadID = null;
+ var flowerRoadID = "w646";
+ var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
+ var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
+ var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
+ var roadCategory = _mainPresetIndex.item("category-road_minor");
+ var residentialPreset = _mainPresetIndex.item("highway/residential");
+ var woodRoadID = "w525";
+ var woodRoadEndID = "n2862";
+ var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
+ var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
+ var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
+ var washingtonStreetID = "w522";
+ var twelfthAvenueID = "w1";
+ var eleventhAvenueEndID = "n3550";
+ var twelfthAvenueEndID = "n5";
+ var _washingtonSegmentID = null;
+ var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
+ var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
+ var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
+ var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
+ var chapter = {
+ title: "intro.lines.title"
+ };
+ function timeout2(f2, t) {
+ timeouts.push(window.setTimeout(f2, t));
+ }
+ function eventCancel(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ }
+ function addLine() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ var msec = transitionTime(tulipRoadStart, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
+ timeout2(function() {
+ var tooltip = reveal("button.add-line", helpHtml("intro.lines.add_line"));
+ tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "add-line")
+ return;
+ continueTo(startLine);
+ });
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function startLine() {
+ if (context.mode().id !== "add-line")
+ return chapter.restart();
+ _tulipRoadID = null;
+ var padding = 70 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(tulipRoadStart, padding, context);
+ box.height = box.height + 100;
+ var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
+ var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
+ reveal(box, startLineString);
+ context.map().on("move.intro drawn.intro", function() {
+ padding = 70 * Math.pow(2, context.map().zoom() - 18);
+ box = pad(tulipRoadStart, padding, context);
+ box.height = box.height + 100;
+ reveal(box, startLineString, { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "draw-line")
+ return chapter.restart();
+ continueTo(drawLine);
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function drawLine() {
+ if (context.mode().id !== "draw-line")
+ return chapter.restart();
+ _tulipRoadID = context.mode().selectedIDs()[0];
+ context.map().centerEase(tulipRoadMidpoint, 500);
+ timeout2(function() {
+ var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
+ var box = pad(tulipRoadMidpoint, padding, context);
+ box.height = box.height * 2;
+ reveal(box, helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }));
+ context.map().on("move.intro drawn.intro", function() {
+ padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
+ box = pad(tulipRoadMidpoint, padding, context);
+ box.height = box.height * 2;
+ reveal(box, helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }), { duration: 0 });
+ });
+ }, 550);
+ context.history().on("change.intro", function() {
+ if (isLineConnected()) {
+ continueTo(continueLine);
}
-
- return _cache[ent].matches;
- };
-
- features.getParents = function(entity, resolver, geometry) {
- if (geometry === 'point') return [];
-
- var ent = iD.Entity.key(entity);
- if (!_cache[ent]) {
- _cache[ent] = {};
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "draw-line") {
+ return;
+ } else if (mode.id === "select") {
+ continueTo(retryIntersect);
+ return;
+ } else {
+ return chapter.restart();
}
-
- if (!_cache[ent].parents) {
- var parents = [];
- if (geometry === 'vertex') {
- parents = resolver.parentWays(entity);
- } else { // 'line', 'area', 'relation'
- parents = resolver.parentRelations(entity);
- }
- _cache[ent].parents = parents;
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function isLineConnected() {
+ var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
+ if (!entity)
+ return false;
+ var drawNodes = context.graph().childNodes(entity);
+ return drawNodes.some(function(node) {
+ return context.graph().parentWays(node).some(function(parent) {
+ return parent.id === flowerRoadID;
+ });
+ });
+ }
+ function retryIntersect() {
+ select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
+ var box = pad(tulipRoadIntersection, 80, context);
+ reveal(box, helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") }));
+ timeout2(chapter.restart, 3e3);
+ }
+ function continueLine() {
+ if (context.mode().id !== "draw-line")
+ return chapter.restart();
+ var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
+ if (!entity)
+ return chapter.restart();
+ context.map().centerEase(tulipRoadIntersection, 500);
+ var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
+ reveal(".surface", continueLineText);
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "draw-line") {
+ return;
+ } else if (mode.id === "select") {
+ return continueTo(chooseCategoryRoad);
+ } else {
+ return chapter.restart();
}
- return _cache[ent].parents;
- };
-
- features.isHiddenFeature = function(entity, resolver, geometry) {
- if (!_hidden.length) return false;
- if (!entity.version) return false;
-
- var matches = features.getMatches(entity, resolver, geometry);
-
- for (var i = 0; i < _hidden.length; i++) {
- if (matches[_hidden[i]]) return true;
+ });
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function chooseCategoryRoad() {
+ if (context.mode().id !== "select")
+ return chapter.restart();
+ context.on("exit.intro", function() {
+ return chapter.restart();
+ });
+ var button = context.container().select(".preset-category-road_minor .preset-list-button");
+ if (button.empty())
+ return chapter.restart();
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ reveal(button.node(), helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() }));
+ button.on("click.intro", function() {
+ continueTo(choosePresetResidential);
+ });
+ }, 400);
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-list-button").on("click.intro", null);
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function choosePresetResidential() {
+ if (context.mode().id !== "select")
+ return chapter.restart();
+ context.on("exit.intro", function() {
+ return chapter.restart();
+ });
+ var subgrid = context.container().select(".preset-category-road_minor .subgrid");
+ if (subgrid.empty())
+ return chapter.restart();
+ subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
+ continueTo(retryPresetResidential);
+ });
+ subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
+ continueTo(nameRoad);
+ });
+ timeout2(function() {
+ reveal(subgrid.node(), helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }), { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 });
+ }, 300);
+ function continueTo(nextStep) {
+ context.container().select(".preset-list-button").on("click.intro", null);
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function retryPresetResidential() {
+ if (context.mode().id !== "select")
+ return chapter.restart();
+ context.on("exit.intro", function() {
+ return chapter.restart();
+ });
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ var button = context.container().select(".entity-editor-pane .preset-list-button");
+ reveal(button.node(), helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() }));
+ button.on("click.intro", function() {
+ continueTo(chooseCategoryRoad);
+ });
+ }, 500);
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-list-button").on("click.intro", null);
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function nameRoad() {
+ context.on("exit.intro", function() {
+ continueTo(didNameRoad);
+ });
+ timeout2(function() {
+ reveal(".entity-editor-pane", helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }), { tooltipClass: "intro-lines-name_road" });
+ }, 500);
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function didNameRoad() {
+ context.history().checkpoint("doneAddLine");
+ timeout2(function() {
+ reveal(".surface", helpHtml("intro.lines.did_name_road"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(updateLine);
+ }
+ });
+ }, 500);
+ function continueTo(nextStep) {
+ nextStep();
+ }
+ }
+ function updateLine() {
+ context.history().reset("doneAddLine");
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return chapter.restart();
+ }
+ var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
+ timeout2(function() {
+ var padding = 250 * Math.pow(2, context.map().zoom() - 19);
+ var box = pad(woodRoadDragMidpoint, padding, context);
+ var advance = function() {
+ continueTo(addNode);
+ };
+ reveal(box, helpHtml("intro.lines.update_line"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
+ var box2 = pad(woodRoadDragMidpoint, padding2, context);
+ reveal(box2, helpHtml("intro.lines.update_line"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ });
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
+ }
+ function addNode() {
+ context.history().reset("doneAddLine");
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return chapter.restart();
+ }
+ var padding = 40 * Math.pow(2, context.map().zoom() - 19);
+ var box = pad(woodRoadAddNode, padding, context);
+ var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
+ reveal(box, addNodeString);
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
+ var box2 = pad(woodRoadAddNode, padding2, context);
+ reveal(box2, addNodeString, { duration: 0 });
+ });
+ context.history().on("change.intro", function(changed) {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
}
- return false;
- };
-
- features.isHiddenChild = function(entity, resolver, geometry) {
- if (!_hidden.length) return false;
- if (!entity.version || geometry === 'point') return false;
-
- var parents = features.getParents(entity, resolver, geometry);
- if (!parents.length) return false;
-
- for (var i = 0; i < parents.length; i++) {
- if (!features.isHidden(parents[i], resolver, parents[i].geometry(resolver))) {
- return false;
- }
+ if (changed.created().length === 1) {
+ timeout2(function() {
+ continueTo(startDragEndpoint);
+ }, 500);
}
- return true;
- };
-
- features.hasHiddenConnections = function(entity, resolver) {
- if (!_hidden.length) return false;
- var childNodes, connections;
-
- if (entity.type === 'midpoint') {
- childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
- connections = [];
- } else {
- childNodes = entity.nodes ? resolver.childNodes(entity) : [];
- connections = features.getParents(entity, resolver, entity.geometry(resolver));
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select") {
+ continueTo(updateLine);
}
-
- // gather ways connected to child nodes..
- connections = _.reduce(childNodes, function(result, e) {
- return resolver.isShared(e) ? _.union(result, resolver.parentWays(e)) : result;
- }, connections);
-
- return connections.length ? _.some(connections, function(e) {
- return features.isHidden(e, resolver, e.geometry(resolver));
- }) : false;
- };
-
- features.isHidden = function(entity, resolver, geometry) {
- if (!_hidden.length) return false;
- if (!entity.version) return false;
-
- var fn = (geometry === 'vertex' ? features.isHiddenChild : features.isHiddenFeature);
- return fn(entity, resolver, geometry);
- };
-
- features.filter = function(d, resolver) {
- if (!_hidden.length) return d;
-
- var result = [];
- for (var i = 0; i < d.length; i++) {
- var entity = d[i];
- if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
- result.push(entity);
- }
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function startDragEndpoint() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding = 100 * Math.pow(2, context.map().zoom() - 19);
+ var box = pad(woodRoadDragEndpoint, padding, context);
+ var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
+ reveal(box, startDragString);
+ context.map().on("move.intro drawn.intro", function() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
+ var box2 = pad(woodRoadDragEndpoint, padding2, context);
+ reveal(box2, startDragString, { duration: 0 });
+ var entity = context.entity(woodRoadEndID);
+ if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
+ continueTo(finishDragEndpoint);
}
- return result;
- };
-
- return d3.rebind(features, dispatch, 'on');
-};
-iD.Map = function(context) {
- var dimensions = [1, 1],
- dispatch = d3.dispatch('move', 'drawn'),
- projection = context.projection,
- zoom = d3.behavior.zoom()
- .translate(projection.translate())
- .scale(projection.scale() * 2 * Math.PI)
- .scaleExtent([1024, 256 * Math.pow(2, 24)])
- .on('zoom', zoomPan),
- dblclickEnabled = true,
- redrawEnabled = true,
- transformStart,
- transformed = false,
- easing = false,
- minzoom = 0,
- drawLayers = iD.svg.Layers(projection, context),
- drawPoints = iD.svg.Points(projection, context),
- drawVertices = iD.svg.Vertices(projection, context),
- drawLines = iD.svg.Lines(projection),
- drawAreas = iD.svg.Areas(projection),
- drawMidpoints = iD.svg.Midpoints(projection, context),
- drawLabels = iD.svg.Labels(projection, context),
- supersurface,
- wrapper,
- surface,
- mouse,
- mousemove;
-
- function map(selection) {
- context
- .on('change.map', redraw);
- context.history()
- .on('change.map', redraw);
- context.background()
- .on('change.map', redraw);
- context.features()
- .on('redraw.map', redraw);
- drawLayers
- .on('change.map', function() {
- context.background().updateImagery();
- redraw();
- });
-
- selection
- .on('dblclick.map', dblClick)
- .call(zoom);
-
- supersurface = selection.append('div')
- .attr('id', 'supersurface')
- .call(iD.util.setTransform, 0, 0);
-
- // Need a wrapper div because Opera can't cope with an absolutely positioned
- // SVG element: http://bl.ocks.org/jfirebaugh/6fbfbd922552bf776c16
- wrapper = supersurface
- .append('div')
- .attr('class', 'layer layer-data');
-
- map.surface = surface = wrapper
- .call(drawLayers)
- .selectAll('.surface')
- .attr('id', 'surface');
-
- surface
- .on('mousedown.zoom', function() {
- if (d3.event.button === 2) {
- d3.event.stopPropagation();
- }
- }, true)
- .on('mouseup.zoom', function() {
- if (resetTransform()) redraw();
- })
- .on('mousemove.map', function() {
- mousemove = d3.event;
- })
- .on('mouseover.vertices', function() {
- if (map.editable() && !transformed) {
- var hover = d3.event.target.__data__;
- surface.call(drawVertices.drawHover, context.graph(), hover, map.extent(), map.zoom());
- dispatch.drawn({full: false});
- }
- })
- .on('mouseout.vertices', function() {
- if (map.editable() && !transformed) {
- var hover = d3.event.relatedTarget && d3.event.relatedTarget.__data__;
- surface.call(drawVertices.drawHover, context.graph(), hover, map.extent(), map.zoom());
- dispatch.drawn({full: false});
- }
- });
-
-
- supersurface
- .call(context.background());
-
-
- context.on('enter.map', function() {
- if (map.editable() && !transformed) {
- var all = context.intersects(map.extent()),
- filter = d3.functor(true),
- graph = context.graph();
-
- all = context.features().filter(all, graph);
- surface
- .call(drawVertices, graph, all, filter, map.extent(), map.zoom())
- .call(drawMidpoints, graph, all, filter, map.trimmedExtent());
- dispatch.drawn({full: false});
- }
- });
-
- map.dimensions(selection.dimensions());
-
- drawLabels.supersurface(supersurface);
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
}
-
- function pxCenter() {
- return [dimensions[0] / 2, dimensions[1] / 2];
+ function finishDragEndpoint() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding = 100 * Math.pow(2, context.map().zoom() - 19);
+ var box = pad(woodRoadDragEndpoint, padding, context);
+ var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
+ reveal(box, finishDragString);
+ context.map().on("move.intro drawn.intro", function() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
+ var box2 = pad(woodRoadDragEndpoint, padding2, context);
+ reveal(box2, finishDragString, { duration: 0 });
+ var entity = context.entity(woodRoadEndID);
+ if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
+ continueTo(startDragEndpoint);
+ }
+ });
+ context.on("enter.intro", function() {
+ continueTo(startDragMidpoint);
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
- function drawVector(difference, extent) {
- var graph = context.graph(),
- features = context.features(),
- all = context.intersects(map.extent()),
- data, filter;
-
- if (difference) {
- var complete = difference.complete(map.extent());
- data = _.compact(_.values(complete));
- filter = function(d) { return d.id in complete; };
- features.clear(data);
-
- } else {
- // force a full redraw if gatherStats detects that a feature
- // should be auto-hidden (e.g. points or buildings)..
- if (features.gatherStats(all, graph, dimensions)) {
- extent = undefined;
- }
-
- if (extent) {
- data = context.intersects(map.extent().intersection(extent));
- var set = d3.set(_.map(data, 'id'));
- filter = function(d) { return set.has(d.id); };
-
- } else {
- data = all;
- filter = d3.functor(true);
- }
+ function startDragMidpoint() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ if (context.selectedIDs().indexOf(woodRoadID) === -1) {
+ context.enter(modeSelect(context, [woodRoadID]));
+ }
+ var padding = 80 * Math.pow(2, context.map().zoom() - 19);
+ var box = pad(woodRoadDragMidpoint, padding, context);
+ reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
+ context.map().on("move.intro drawn.intro", function() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
+ var box2 = pad(woodRoadDragMidpoint, padding2, context);
+ reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
+ });
+ context.history().on("change.intro", function(changed) {
+ if (changed.created().length === 1) {
+ continueTo(continueDragMidpoint);
+ }
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select") {
+ context.enter(modeSelect(context, [woodRoadID]));
}
-
- data = features.filter(data, graph);
-
- surface
- .call(drawVertices, graph, data, filter, map.extent(), map.zoom())
- .call(drawLines, graph, data, filter)
- .call(drawAreas, graph, data, filter)
- .call(drawMidpoints, graph, data, filter, map.trimmedExtent())
- .call(drawLabels, graph, data, filter, dimensions, !difference && !extent)
- .call(drawPoints, graph, data, filter);
-
- dispatch.drawn({full: true});
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
- function editOff() {
- context.features().resetStats();
- surface.selectAll('.layer-osm *').remove();
- dispatch.drawn({full: true});
+ function continueDragMidpoint() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding = 100 * Math.pow(2, context.map().zoom() - 19);
+ var box = pad(woodRoadDragEndpoint, padding, context);
+ box.height += 400;
+ var advance = function() {
+ context.history().checkpoint("doneUpdateLine");
+ continueTo(deleteLines);
+ };
+ reveal(box, helpHtml("intro.lines.continue_drag_midpoint"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ context.map().on("move.intro drawn.intro", function() {
+ if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
+ return continueTo(updateLine);
+ }
+ var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
+ var box2 = pad(woodRoadDragEndpoint, padding2, context);
+ box2.height += 400;
+ reveal(box2, helpHtml("intro.lines.continue_drag_midpoint"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
}
-
- function dblClick() {
- if (!dblclickEnabled) {
- d3.event.preventDefault();
- d3.event.stopImmediatePropagation();
- }
+ function deleteLines() {
+ context.history().reset("doneUpdateLine");
+ context.enter(modeBrowse(context));
+ if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return chapter.restart();
+ }
+ var msec = transitionTime(deleteLinesLoc, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(deleteLinesLoc, 18, msec);
+ timeout2(function() {
+ var padding = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(deleteLinesLoc, padding, context);
+ box.top -= 200;
+ box.height += 400;
+ var advance = function() {
+ continueTo(rightClickIntersection);
+ };
+ reveal(box, helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box2 = pad(deleteLinesLoc, padding2, context);
+ box2.top -= 200;
+ box2.height += 400;
+ reveal(box2, helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ });
+ context.history().on("change.intro", function() {
+ timeout2(function() {
+ continueTo(deleteLines);
+ }, 500);
+ });
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
}
-
- function zoomPan() {
- if (Math.log(d3.event.scale) / Math.LN2 - 8 < minzoom) {
- surface.interrupt();
- iD.ui.flash(context.container())
- .select('.content')
- .text(t('cannot_zoom'));
- setZoom(context.minEditableZoom(), true);
- queueRedraw();
- dispatch.move(map);
+ function rightClickIntersection() {
+ context.history().reset("doneUpdateLine");
+ context.enter(modeBrowse(context));
+ context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
+ var rightClickString = helpHtml("intro.lines.split_street", {
+ street1: _t("intro.graph.name.11th-avenue"),
+ street2: _t("intro.graph.name.washington-street")
+ }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
+ timeout2(function() {
+ var padding = 60 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(eleventhAvenueEnd, padding, context);
+ reveal(box, rightClickString);
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
+ var box2 = pad(eleventhAvenueEnd, padding2, context);
+ reveal(box2, rightClickString, { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select")
return;
- }
-
- projection
- .translate(d3.event.translate)
- .scale(d3.event.scale / (2 * Math.PI));
-
- var scale = d3.event.scale / transformStart[0],
- tX = (d3.event.translate[0] / scale - transformStart[1][0]) * scale,
- tY = (d3.event.translate[1] / scale - transformStart[1][1]) * scale;
-
- transformed = true;
- iD.util.setTransform(supersurface, tX, tY, scale);
- queueRedraw();
-
- dispatch.move(map);
+ var ids = context.selectedIDs();
+ if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
+ return;
+ timeout2(function() {
+ var node = selectMenuItem(context, "split").node();
+ if (!node)
+ return;
+ continueTo(splitIntersection);
+ }, 50);
+ });
+ context.history().on("change.intro", function() {
+ timeout2(function() {
+ continueTo(deleteLines);
+ }, 300);
+ });
+ }, 600);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
}
-
- function resetTransform() {
- if (!transformed) return false;
-
- surface.selectAll('.radial-menu').interrupt().remove();
- iD.util.setTransform(supersurface, 0, 0);
- transformed = false;
- return true;
+ function splitIntersection() {
+ if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(deleteLines);
+ }
+ var node = selectMenuItem(context, "split").node();
+ if (!node) {
+ return continueTo(rightClickIntersection);
+ }
+ var wasChanged = false;
+ _washingtonSegmentID = null;
+ reveal(".edit-menu", helpHtml("intro.lines.split_intersection", { street: _t("intro.graph.name.washington-street") }), { padding: 50 });
+ context.map().on("move.intro drawn.intro", function() {
+ var node2 = selectMenuItem(context, "split").node();
+ if (!wasChanged && !node2) {
+ return continueTo(rightClickIntersection);
+ }
+ reveal(".edit-menu", helpHtml("intro.lines.split_intersection", { street: _t("intro.graph.name.washington-street") }), { duration: 0, padding: 50 });
+ });
+ context.history().on("change.intro", function(changed) {
+ wasChanged = true;
+ timeout2(function() {
+ if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
+ _washingtonSegmentID = changed.created()[0].id;
+ continueTo(didSplit);
+ } else {
+ _washingtonSegmentID = null;
+ continueTo(retrySplit);
+ }
+ }, 300);
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
}
-
- function redraw(difference, extent) {
- if (!surface || !redrawEnabled) return;
-
- clearTimeout(timeoutId);
-
- // If we are in the middle of a zoom/pan, we can't do differenced redraws.
- // It would result in artifacts where differenced entities are redrawn with
- // one transform and unchanged entities with another.
- if (resetTransform()) {
- difference = extent = undefined;
- }
-
- var zoom = String(~~map.zoom());
- if (surface.attr('data-zoom') !== zoom) {
- surface.attr('data-zoom', zoom)
- .classed('low-zoom', zoom <= 16);
+ function retrySplit() {
+ context.enter(modeBrowse(context));
+ context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
+ var advance = function() {
+ continueTo(rightClickIntersection);
+ };
+ var padding = 60 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(eleventhAvenueEnd, padding, context);
+ reveal(box, helpHtml("intro.lines.retry_split"), { buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
+ var box2 = pad(eleventhAvenueEnd, padding2, context);
+ reveal(box2, helpHtml("intro.lines.retry_split"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance });
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
+ }
+ function didSplit() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
+ }
+ var ids = context.selectedIDs();
+ var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
+ var street = _t("intro.graph.name.washington-street");
+ var padding = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(twelfthAvenue, padding, context);
+ box.width = box.width / 2;
+ reveal(box, helpHtml(string, { street1: street, street2: street }), { duration: 500 });
+ timeout2(function() {
+ context.map().centerZoomEase(twelfthAvenue, 18, 500);
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box2 = pad(twelfthAvenue, padding2, context);
+ box2.width = box2.width / 2;
+ reveal(box2, helpHtml(string, { street1: street, street2: street }), { duration: 0 });
+ });
+ }, 600);
+ context.on("enter.intro", function() {
+ var ids2 = context.selectedIDs();
+ if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
+ continueTo(multiSelect);
}
-
- if (!difference) {
- supersurface.call(context.background());
+ });
+ context.history().on("change.intro", function() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
}
-
- // OSM
- if (map.editable()) {
- context.loadTiles(projection, dimensions);
- drawVector(difference, extent);
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function multiSelect() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
+ }
+ var ids = context.selectedIDs();
+ var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
+ var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
+ if (hasWashington && hasTwelfth) {
+ return continueTo(multiRightClick);
+ } else if (!hasWashington && !hasTwelfth) {
+ return continueTo(didSplit);
+ }
+ context.map().centerZoomEase(twelfthAvenue, 18, 500);
+ timeout2(function() {
+ var selected, other, padding, box;
+ if (hasWashington) {
+ selected = _t("intro.graph.name.washington-street");
+ other = _t("intro.graph.name.12th-avenue");
+ padding = 60 * Math.pow(2, context.map().zoom() - 18);
+ box = pad(twelfthAvenueEnd, padding, context);
+ box.width *= 3;
} else {
- editOff();
+ selected = _t("intro.graph.name.12th-avenue");
+ other = _t("intro.graph.name.washington-street");
+ padding = 200 * Math.pow(2, context.map().zoom() - 18);
+ box = pad(twelfthAvenue, padding, context);
+ box.width /= 2;
+ }
+ reveal(box, helpHtml("intro.lines.multi_select", { selected, other1: other }) + " " + helpHtml("intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"), { selected, other2: other }));
+ context.map().on("move.intro drawn.intro", function() {
+ if (hasWashington) {
+ selected = _t("intro.graph.name.washington-street");
+ other = _t("intro.graph.name.12th-avenue");
+ padding = 60 * Math.pow(2, context.map().zoom() - 18);
+ box = pad(twelfthAvenueEnd, padding, context);
+ box.width *= 3;
+ } else {
+ selected = _t("intro.graph.name.12th-avenue");
+ other = _t("intro.graph.name.washington-street");
+ padding = 200 * Math.pow(2, context.map().zoom() - 18);
+ box = pad(twelfthAvenue, padding, context);
+ box.width /= 2;
+ }
+ reveal(box, helpHtml("intro.lines.multi_select", { selected, other1: other }) + " " + helpHtml("intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"), { selected, other2: other }), { duration: 0 });
+ });
+ context.on("enter.intro", function() {
+ continueTo(multiSelect);
+ });
+ context.history().on("change.intro", function() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
+ }
+ });
+ }, 600);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function multiRightClick() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
+ }
+ var padding = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(twelfthAvenue, padding, context);
+ var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
+ reveal(box, rightClickString);
+ context.map().on("move.intro drawn.intro", function() {
+ var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box2 = pad(twelfthAvenue, padding2, context);
+ reveal(box2, rightClickString, { duration: 0 });
+ });
+ context.ui().editMenu().on("toggled.intro", function(open) {
+ if (!open)
+ return;
+ timeout2(function() {
+ var ids = context.selectedIDs();
+ if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
+ var node = selectMenuItem(context, "delete").node();
+ if (!node)
+ return;
+ continueTo(multiDelete);
+ } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
+ return continueTo(multiSelect);
+ } else {
+ return continueTo(didSplit);
+ }
+ }, 300);
+ });
+ context.history().on("change.intro", function() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
}
-
- wrapper
- .call(drawLayers);
-
- transformStart = [
- projection.scale() * 2 * Math.PI,
- projection.translate().slice()];
-
- return map;
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.ui().editMenu().on("toggled.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
}
-
- var timeoutId;
- function queueRedraw() {
- timeoutId = setTimeout(function() { redraw(); }, 750);
+ function multiDelete() {
+ if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
+ return continueTo(rightClickIntersection);
+ }
+ var node = selectMenuItem(context, "delete").node();
+ if (!node)
+ return continueTo(multiRightClick);
+ reveal(".edit-menu", helpHtml("intro.lines.multi_delete"), { padding: 50 });
+ context.map().on("move.intro drawn.intro", function() {
+ reveal(".edit-menu", helpHtml("intro.lines.multi_delete"), { duration: 0, padding: 50 });
+ });
+ context.on("exit.intro", function() {
+ if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
+ return continueTo(multiSelect);
+ }
+ });
+ context.history().on("change.intro", function() {
+ if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
+ continueTo(retryDelete);
+ } else {
+ continueTo(play);
+ }
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("exit.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
}
-
- function pointLocation(p) {
- var translate = projection.translate(),
- scale = projection.scale() * 2 * Math.PI;
- return [(p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale];
+ function retryDelete() {
+ context.enter(modeBrowse(context));
+ var padding = 200 * Math.pow(2, context.map().zoom() - 18);
+ var box = pad(twelfthAvenue, padding, context);
+ reveal(box, helpHtml("intro.lines.retry_delete"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(multiSelect);
+ }
+ });
+ function continueTo(nextStep) {
+ nextStep();
+ }
}
-
- function locationPoint(l) {
- var translate = projection.translate(),
- scale = projection.scale() * 2 * Math.PI;
- return [l[0] * scale + translate[0], l[1] * scale + translate[1]];
+ function play() {
+ dispatch10.call("done");
+ reveal(".ideditor", helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }), {
+ tooltipBox: ".intro-nav-wrap .chapter-building",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ reveal(".ideditor");
+ }
+ });
}
-
- map.mouse = function() {
- var e = mousemove || d3.event, s;
- while ((s = e.sourceEvent)) e = s;
- return mouse(e);
- };
-
- map.mouseCoordinates = function() {
- return projection.invert(map.mouse());
+ chapter.enter = function() {
+ addLine();
};
-
- map.dblclickEnable = function(_) {
- if (!arguments.length) return dblclickEnabled;
- dblclickEnabled = _;
- return map;
+ chapter.exit = function() {
+ timeouts.forEach(window.clearTimeout);
+ select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
+ context.on("enter.intro exit.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-list-button").on("click.intro", null);
};
-
- map.redrawEnable = function(_) {
- if (!arguments.length) return redrawEnabled;
- redrawEnabled = _;
- return map;
+ chapter.restart = function() {
+ chapter.exit();
+ chapter.enter();
};
+ return utilRebind(chapter, dispatch10, "on");
+ }
- function interpolateZoom(_) {
- var k = projection.scale(),
- t = projection.translate();
-
- surface.node().__chart__ = {
- x: t[0],
- y: t[1],
- k: k * 2 * Math.PI
- };
-
- setZoom(_);
- projection.scale(k).translate(t); // undo setZoom projection changes
-
- zoom.event(surface.transition());
+ // modules/ui/intro/building.js
+ function uiIntroBuilding(context, reveal) {
+ var dispatch10 = dispatch_default("done");
+ var house = [-85.62815, 41.95638];
+ var tank = [-85.62732, 41.95347];
+ var buildingCatetory = _mainPresetIndex.item("category-building");
+ var housePreset = _mainPresetIndex.item("building/house");
+ var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
+ var timeouts = [];
+ var _houseID = null;
+ var _tankID = null;
+ var chapter = {
+ title: "intro.buildings.title"
+ };
+ function timeout2(f2, t) {
+ timeouts.push(window.setTimeout(f2, t));
+ }
+ function eventCancel(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ }
+ function revealHouse(center, text2, options2) {
+ var padding = 160 * Math.pow(2, context.map().zoom() - 20);
+ var box = pad(center, padding, context);
+ reveal(box, text2, options2);
+ }
+ function revealTank(center, text2, options2) {
+ var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
+ var box = pad(center, padding, context);
+ reveal(box, text2, options2);
+ }
+ function addHouse() {
+ context.enter(modeBrowse(context));
+ context.history().reset("initial");
+ _houseID = null;
+ var msec = transitionTime(house, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(house, 19, msec);
+ timeout2(function() {
+ var tooltip = reveal("button.add-area", helpHtml("intro.buildings.add_building"));
+ tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "add-area")
+ return;
+ continueTo(startHouse);
+ });
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
- function setZoom(_, force) {
- if (_ === map.zoom() && !force)
- return false;
- var scale = 256 * Math.pow(2, _),
- center = pxCenter(),
- l = pointLocation(center);
- scale = Math.max(1024, Math.min(256 * Math.pow(2, 24), scale));
- projection.scale(scale / (2 * Math.PI));
- zoom.scale(scale);
- var t = projection.translate();
- l = locationPoint(l);
- t[0] += center[0] - l[0];
- t[1] += center[1] - l[1];
- projection.translate(t);
- zoom.translate(projection.translate());
- return true;
+ function startHouse() {
+ if (context.mode().id !== "add-area") {
+ return continueTo(addHouse);
+ }
+ _houseID = null;
+ context.map().zoomEase(20, 500);
+ timeout2(function() {
+ var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
+ revealHouse(house, startString);
+ context.map().on("move.intro drawn.intro", function() {
+ revealHouse(house, startString, { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "draw-area")
+ return chapter.restart();
+ continueTo(continueHouse);
+ });
+ }, 550);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
- function setCenter(_) {
- var c = map.center();
- if (_[0] === c[0] && _[1] === c[1])
- return false;
- var t = projection.translate(),
- pxC = pxCenter(),
- ll = projection(_);
- projection.translate([
- t[0] - ll[0] + pxC[0],
- t[1] - ll[1] + pxC[1]]);
- zoom.translate(projection.translate());
- return true;
+ function continueHouse() {
+ if (context.mode().id !== "draw-area") {
+ return continueTo(addHouse);
+ }
+ _houseID = null;
+ var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
+ revealHouse(house, continueString);
+ context.map().on("move.intro drawn.intro", function() {
+ revealHouse(house, continueString, { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "draw-area") {
+ return;
+ } else if (mode.id === "select") {
+ var graph = context.graph();
+ var way = context.entity(context.selectedIDs()[0]);
+ var nodes = graph.childNodes(way);
+ var points = utilArrayUniq(nodes).map(function(n2) {
+ return context.projection(n2.loc);
+ });
+ if (isMostlySquare(points)) {
+ _houseID = way.id;
+ return continueTo(chooseCategoryBuilding);
+ } else {
+ return continueTo(retryHouse);
+ }
+ } else {
+ return chapter.restart();
+ }
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
- map.pan = function(d) {
- var t = projection.translate();
- t[0] += d[0];
- t[1] += d[1];
- projection.translate(t);
- zoom.translate(projection.translate());
- dispatch.move(map);
- return redraw();
- };
-
- map.dimensions = function(_) {
- if (!arguments.length) return dimensions;
- var center = map.center();
- dimensions = _;
- drawLayers.dimensions(dimensions);
- context.background().dimensions(dimensions);
- projection.clipExtent([[0, 0], dimensions]);
- mouse = iD.util.fastMouse(supersurface.node());
- setCenter(center);
- return redraw();
- };
-
- function zoomIn(integer) {
- interpolateZoom(~~map.zoom() + integer);
+ function retryHouse() {
+ var onClick = function() {
+ continueTo(addHouse);
+ };
+ revealHouse(house, helpHtml("intro.buildings.retry_building"), { buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ context.map().on("move.intro drawn.intro", function() {
+ revealHouse(house, helpHtml("intro.buildings.retry_building"), { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick });
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ nextStep();
+ }
}
-
- function zoomOut(integer) {
- interpolateZoom(~~map.zoom() - integer);
+ function chooseCategoryBuilding() {
+ if (!_houseID || !context.hasEntity(_houseID)) {
+ return addHouse();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
+ context.enter(modeSelect(context, [_houseID]));
+ }
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ var button = context.container().select(".preset-category-building .preset-list-button");
+ reveal(button.node(), helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() }));
+ button.on("click.intro", function() {
+ button.on("click.intro", null);
+ continueTo(choosePresetHouse);
+ });
+ }, 400);
+ context.on("enter.intro", function(mode) {
+ if (!_houseID || !context.hasEntity(_houseID)) {
+ return continueTo(addHouse);
+ }
+ var ids2 = context.selectedIDs();
+ if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
+ return continueTo(chooseCategoryBuilding);
+ }
+ });
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-list-button").on("click.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
}
-
- map.zoomIn = function() { zoomIn(1); };
- map.zoomInFurther = function() { zoomIn(4); };
-
- map.zoomOut = function() { zoomOut(1); };
- map.zoomOutFurther = function() { zoomOut(4); };
-
- map.center = function(loc) {
- if (!arguments.length) {
- return projection.invert(pxCenter());
+ function choosePresetHouse() {
+ if (!_houseID || !context.hasEntity(_houseID)) {
+ return addHouse();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
+ context.enter(modeSelect(context, [_houseID]));
+ }
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ var button = context.container().select(".preset-building-house .preset-list-button");
+ reveal(button.node(), helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }), { duration: 300 });
+ button.on("click.intro", function() {
+ button.on("click.intro", null);
+ continueTo(closeEditorHouse);
+ });
+ }, 400);
+ context.on("enter.intro", function(mode) {
+ if (!_houseID || !context.hasEntity(_houseID)) {
+ return continueTo(addHouse);
}
-
- if (setCenter(loc)) {
- dispatch.move(map);
+ var ids2 = context.selectedIDs();
+ if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
+ return continueTo(chooseCategoryBuilding);
}
-
- return redraw();
- };
-
- map.zoom = function(z) {
- if (!arguments.length) {
- return Math.max(Math.log(projection.scale() * 2 * Math.PI) / Math.LN2 - 8, 0);
+ });
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-list-button").on("click.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function closeEditorHouse() {
+ if (!_houseID || !context.hasEntity(_houseID)) {
+ return addHouse();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
+ context.enter(modeSelect(context, [_houseID]));
+ }
+ context.history().checkpoint("hasHouse");
+ context.on("exit.intro", function() {
+ continueTo(rightClickHouse);
+ });
+ timeout2(function() {
+ reveal(".entity-editor-pane", helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } }));
+ }, 500);
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function rightClickHouse() {
+ if (!_houseID)
+ return chapter.restart();
+ context.enter(modeBrowse(context));
+ context.history().reset("hasHouse");
+ var zoom = context.map().zoom();
+ if (zoom < 20) {
+ zoom = 20;
+ }
+ context.map().centerZoomEase(house, zoom, 500);
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select")
+ return;
+ var ids = context.selectedIDs();
+ if (ids.length !== 1 || ids[0] !== _houseID)
+ return;
+ timeout2(function() {
+ var node = selectMenuItem(context, "orthogonalize").node();
+ if (!node)
+ return;
+ continueTo(clickSquare);
+ }, 50);
+ });
+ context.map().on("move.intro drawn.intro", function() {
+ var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
+ revealHouse(house, rightclickString, { duration: 0 });
+ });
+ context.history().on("change.intro", function() {
+ continueTo(rightClickHouse);
+ });
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function clickSquare() {
+ if (!_houseID)
+ return chapter.restart();
+ var entity = context.hasEntity(_houseID);
+ if (!entity)
+ return continueTo(rightClickHouse);
+ var node = selectMenuItem(context, "orthogonalize").node();
+ if (!node) {
+ return continueTo(rightClickHouse);
+ }
+ var wasChanged = false;
+ reveal(".edit-menu", helpHtml("intro.buildings.square_building"), { padding: 50 });
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "browse") {
+ continueTo(rightClickHouse);
+ } else if (mode.id === "move" || mode.id === "rotate") {
+ continueTo(retryClickSquare);
}
-
- if (z < minzoom) {
- surface.interrupt();
- iD.ui.flash(context.container())
- .select('.content')
- .text(t('cannot_zoom'));
- z = context.minEditableZoom();
+ });
+ context.map().on("move.intro", function() {
+ var node2 = selectMenuItem(context, "orthogonalize").node();
+ if (!wasChanged && !node2) {
+ return continueTo(rightClickHouse);
}
-
- if (setZoom(z)) {
- dispatch.move(map);
+ reveal(".edit-menu", helpHtml("intro.buildings.square_building"), { duration: 0, padding: 50 });
+ });
+ context.history().on("change.intro", function() {
+ wasChanged = true;
+ context.history().on("change.intro", null);
+ timeout2(function() {
+ if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
+ continueTo(doneSquare);
+ } else {
+ continueTo(retryClickSquare);
+ }
+ }, 500);
+ });
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.map().on("move.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function retryClickSquare() {
+ context.enter(modeBrowse(context));
+ revealHouse(house, helpHtml("intro.buildings.retry_square"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(rightClickHouse);
}
-
- return redraw();
- };
-
- map.zoomTo = function(entity, zoomLimits) {
- var extent = entity.extent(context.graph());
- if (!isFinite(extent.area())) return;
-
- var zoom = map.trimmedExtentZoom(extent);
- zoomLimits = zoomLimits || [context.minEditableZoom(), 20];
- map.centerZoom(extent.center(), Math.min(Math.max(zoom, zoomLimits[0]), zoomLimits[1]));
- };
-
- map.centerZoom = function(loc, z) {
- var centered = setCenter(loc),
- zoomed = setZoom(z);
-
- if (centered || zoomed) {
- dispatch.move(map);
+ });
+ function continueTo(nextStep) {
+ nextStep();
+ }
+ }
+ function doneSquare() {
+ context.history().checkpoint("doneSquare");
+ revealHouse(house, helpHtml("intro.buildings.done_square"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(addTank);
}
-
- return redraw();
- };
-
- map.centerEase = function(loc2, duration) {
- duration = duration || 250;
-
- surface.one('mousedown.ease', function() {
- map.cancelEase();
+ });
+ function continueTo(nextStep) {
+ nextStep();
+ }
+ }
+ function addTank() {
+ context.enter(modeBrowse(context));
+ context.history().reset("doneSquare");
+ _tankID = null;
+ var msec = transitionTime(tank, context.map().center());
+ if (msec) {
+ reveal(null, null, { duration: 0 });
+ }
+ context.map().centerZoomEase(tank, 19.5, msec);
+ timeout2(function() {
+ reveal("button.add-area", helpHtml("intro.buildings.add_tank"));
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "add-area")
+ return;
+ continueTo(startTank);
});
-
- if (easing) {
- map.cancelEase();
- }
-
- var t1 = Date.now(),
- t2 = t1 + duration,
- loc1 = map.center(),
- ease = d3.ease('cubic-in-out');
-
- easing = true;
-
- d3.timer(function() {
- if (!easing) return true; // cancelled ease
-
- var tNow = Date.now();
- if (tNow > t2) {
- tNow = t2;
- easing = false;
- }
-
- var locNow = iD.geo.interp(loc1, loc2, ease((tNow - t1) / duration));
- setCenter(locNow);
-
- d3.event = {
- scale: zoom.scale(),
- translate: zoom.translate()
- };
-
- zoomPan();
- return !easing;
+ }, msec + 100);
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function startTank() {
+ if (context.mode().id !== "add-area") {
+ return continueTo(addTank);
+ }
+ _tankID = null;
+ timeout2(function() {
+ var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
+ revealTank(tank, startString);
+ context.map().on("move.intro drawn.intro", function() {
+ revealTank(tank, startString, { duration: 0 });
});
-
- return map;
- };
-
- map.cancelEase = function() {
- easing = false;
- d3.timer.flush();
- return map;
- };
-
- map.extent = function(_) {
- if (!arguments.length) {
- return new iD.geo.Extent(projection.invert([0, dimensions[1]]),
- projection.invert([dimensions[0], 0]));
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "draw-area")
+ return chapter.restart();
+ continueTo(continueTank);
+ });
+ }, 550);
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function continueTank() {
+ if (context.mode().id !== "draw-area") {
+ return continueTo(addTank);
+ }
+ _tankID = null;
+ var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
+ revealTank(tank, continueString);
+ context.map().on("move.intro drawn.intro", function() {
+ revealTank(tank, continueString, { duration: 0 });
+ });
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "draw-area") {
+ return;
+ } else if (mode.id === "select") {
+ _tankID = context.selectedIDs()[0];
+ return continueTo(searchPresetTank);
} else {
- var extent = iD.geo.Extent(_);
- map.centerZoom(extent.center(), map.extentZoom(extent));
+ return continueTo(addTank);
+ }
+ });
+ function continueTo(nextStep) {
+ context.map().on("move.intro drawn.intro", null);
+ context.on("enter.intro", null);
+ nextStep();
+ }
+ }
+ function searchPresetTank() {
+ if (!_tankID || !context.hasEntity(_tankID)) {
+ return addTank();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
+ context.enter(modeSelect(context, [_tankID]));
+ }
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ timeout2(function() {
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
+ reveal(".preset-search-input", helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() }));
+ }, 400);
+ context.on("enter.intro", function(mode) {
+ if (!_tankID || !context.hasEntity(_tankID)) {
+ return continueTo(addTank);
+ }
+ var ids2 = context.selectedIDs();
+ if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
+ context.enter(modeSelect(context, [_tankID]));
+ context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
+ context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
+ context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
+ reveal(".preset-search-input", helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() }));
+ context.history().on("change.intro", null);
+ }
+ });
+ function checkPresetSearch() {
+ var first = context.container().select(".preset-list-item:first-child");
+ if (first.classed("preset-man_made-storage_tank")) {
+ reveal(first.select(".preset-list-button").node(), helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }), { duration: 300 });
+ context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
+ context.history().on("change.intro", function() {
+ continueTo(closeEditorTank);
+ });
+ }
+ }
+ function continueTo(nextStep) {
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.on("enter.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
+ nextStep();
+ }
+ }
+ function closeEditorTank() {
+ if (!_tankID || !context.hasEntity(_tankID)) {
+ return addTank();
+ }
+ var ids = context.selectedIDs();
+ if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
+ context.enter(modeSelect(context, [_tankID]));
+ }
+ context.history().checkpoint("hasTank");
+ context.on("exit.intro", function() {
+ continueTo(rightClickTank);
+ });
+ timeout2(function() {
+ reveal(".entity-editor-pane", helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } }));
+ }, 500);
+ function continueTo(nextStep) {
+ context.on("exit.intro", null);
+ nextStep();
+ }
+ }
+ function rightClickTank() {
+ if (!_tankID)
+ return continueTo(addTank);
+ context.enter(modeBrowse(context));
+ context.history().reset("hasTank");
+ context.map().centerEase(tank, 500);
+ timeout2(function() {
+ context.on("enter.intro", function(mode) {
+ if (mode.id !== "select")
+ return;
+ var ids = context.selectedIDs();
+ if (ids.length !== 1 || ids[0] !== _tankID)
+ return;
+ timeout2(function() {
+ var node = selectMenuItem(context, "circularize").node();
+ if (!node)
+ return;
+ continueTo(clickCircle);
+ }, 50);
+ });
+ var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
+ revealTank(tank, rightclickString);
+ context.map().on("move.intro drawn.intro", function() {
+ revealTank(tank, rightclickString, { duration: 0 });
+ });
+ context.history().on("change.intro", function() {
+ continueTo(rightClickTank);
+ });
+ }, 600);
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function clickCircle() {
+ if (!_tankID)
+ return chapter.restart();
+ var entity = context.hasEntity(_tankID);
+ if (!entity)
+ return continueTo(rightClickTank);
+ var node = selectMenuItem(context, "circularize").node();
+ if (!node) {
+ return continueTo(rightClickTank);
+ }
+ var wasChanged = false;
+ reveal(".edit-menu", helpHtml("intro.buildings.circle_tank"), { padding: 50 });
+ context.on("enter.intro", function(mode) {
+ if (mode.id === "browse") {
+ continueTo(rightClickTank);
+ } else if (mode.id === "move" || mode.id === "rotate") {
+ continueTo(retryClickCircle);
+ }
+ });
+ context.map().on("move.intro", function() {
+ var node2 = selectMenuItem(context, "circularize").node();
+ if (!wasChanged && !node2) {
+ return continueTo(rightClickTank);
+ }
+ reveal(".edit-menu", helpHtml("intro.buildings.circle_tank"), { duration: 0, padding: 50 });
+ });
+ context.history().on("change.intro", function() {
+ wasChanged = true;
+ context.history().on("change.intro", null);
+ timeout2(function() {
+ if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
+ continueTo(play);
+ } else {
+ continueTo(retryClickCircle);
+ }
+ }, 500);
+ });
+ function continueTo(nextStep) {
+ context.on("enter.intro", null);
+ context.map().on("move.intro", null);
+ context.history().on("change.intro", null);
+ nextStep();
+ }
+ }
+ function retryClickCircle() {
+ context.enter(modeBrowse(context));
+ revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ continueTo(rightClickTank);
}
- };
-
- map.trimmedExtent = function(_) {
- if (!arguments.length) {
- var headerY = 60, footerY = 30, pad = 10;
- return new iD.geo.Extent(projection.invert([pad, dimensions[1] - footerY - pad]),
- projection.invert([dimensions[0] - pad, headerY + pad]));
- } else {
- var extent = iD.geo.Extent(_);
- map.centerZoom(extent.center(), map.trimmedExtentZoom(extent));
+ });
+ function continueTo(nextStep) {
+ nextStep();
+ }
+ }
+ function play() {
+ dispatch10.call("done");
+ reveal(".ideditor", helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }), {
+ tooltipBox: ".intro-nav-wrap .chapter-startEditing",
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ reveal(".ideditor");
}
- };
-
- function calcZoom(extent, dim) {
- var tl = projection([extent[0][0], extent[1][1]]),
- br = projection([extent[1][0], extent[0][1]]);
-
- // Calculate maximum zoom that fits extent
- var hFactor = (br[0] - tl[0]) / dim[0],
- vFactor = (br[1] - tl[1]) / dim[1],
- hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2,
- vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2,
- newZoom = map.zoom() - Math.max(hZoomDiff, vZoomDiff);
-
- return newZoom;
+ });
}
-
- map.extentZoom = function(_) {
- return calcZoom(iD.geo.Extent(_), dimensions);
+ chapter.enter = function() {
+ addHouse();
};
-
- map.trimmedExtentZoom = function(_) {
- var trimY = 120, trimX = 40,
- trimmed = [dimensions[0] - trimX, dimensions[1] - trimY];
- return calcZoom(iD.geo.Extent(_), trimmed);
+ chapter.exit = function() {
+ timeouts.forEach(window.clearTimeout);
+ context.on("enter.intro exit.intro", null);
+ context.map().on("move.intro drawn.intro", null);
+ context.history().on("change.intro", null);
+ context.container().select(".inspector-wrap").on("wheel.intro", null);
+ context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
+ context.container().select(".more-fields .combobox-input").on("click.intro", null);
};
-
- map.editable = function() {
- return map.zoom() >= context.minEditableZoom();
+ chapter.restart = function() {
+ chapter.exit();
+ chapter.enter();
};
+ return utilRebind(chapter, dispatch10, "on");
+ }
- map.minzoom = function(_) {
- if (!arguments.length) return minzoom;
- minzoom = _;
- return map;
+ // modules/ui/intro/start_editing.js
+ function uiIntroStartEditing(context, reveal) {
+ var dispatch10 = dispatch_default("done", "startEditing");
+ var modalSelection = select_default2(null);
+ var chapter = {
+ title: "intro.startediting.title"
};
-
- map.layers = drawLayers;
-
- return d3.rebind(map, dispatch, 'on');
-};
-iD.TileLayer = function(context) {
- var tileSize = 256,
- tile = d3.geo.tile(),
- projection,
- cache = {},
- tileOrigin,
- z,
- transformProp = iD.util.prefixCSSProperty('Transform'),
- source = d3.functor('');
-
-
- // blacklist overlay tiles around Null Island..
- function nearNullIsland(x, y, z) {
- if (z >= 7) {
- var center = Math.pow(2, z - 1),
- width = Math.pow(2, z - 6),
- min = center - (width / 2),
- max = center + (width / 2) - 1;
- return x >= min && x <= max && y >= min && y <= max;
+ function showHelp() {
+ reveal(".map-control.help-control", helpHtml("intro.startediting.help"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ shortcuts();
}
- return false;
+ });
}
-
- function tileSizeAtZoom(d, z) {
- var epsilon = 0.002;
- return ((tileSize * Math.pow(2, z - d[2])) / tileSize) + epsilon;
+ function shortcuts() {
+ reveal(".map-control.help-control", helpHtml("intro.startediting.shortcuts"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ showSave();
+ }
+ });
}
-
- function atZoom(t, distance) {
- var power = Math.pow(2, distance);
- return [
- Math.floor(t[0] * power),
- Math.floor(t[1] * power),
- t[2] + distance];
+ function showSave() {
+ context.container().selectAll(".shaded").remove();
+ reveal(".top-toolbar button.save", helpHtml("intro.startediting.save"), {
+ buttonText: _t.html("intro.ok"),
+ buttonCallback: function() {
+ showStart();
+ }
+ });
+ }
+ function showStart() {
+ context.container().selectAll(".shaded").remove();
+ modalSelection = uiModal(context.container());
+ modalSelection.select(".modal").attr("class", "modal-splash modal");
+ modalSelection.selectAll(".close").remove();
+ var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
+ modalSelection.remove();
+ });
+ startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
+ startbutton.append("h2").call(_t.append("intro.startediting.start"));
+ dispatch10.call("startEditing");
}
+ chapter.enter = function() {
+ showHelp();
+ };
+ chapter.exit = function() {
+ modalSelection.remove();
+ context.container().selectAll(".shaded").remove();
+ };
+ return utilRebind(chapter, dispatch10, "on");
+ }
- function lookUp(d) {
- for (var up = -1; up > -d[2]; up--) {
- var tile = atZoom(d, up);
- if (cache[source.url(tile)] !== false) {
- return tile;
- }
+ // modules/ui/intro/intro.js
+ var chapterUi = {
+ welcome: uiIntroWelcome,
+ navigation: uiIntroNavigation,
+ point: uiIntroPoint,
+ area: uiIntroArea,
+ line: uiIntroLine,
+ building: uiIntroBuilding,
+ startEditing: uiIntroStartEditing
+ };
+ var chapterFlow = [
+ "welcome",
+ "navigation",
+ "point",
+ "area",
+ "line",
+ "building",
+ "startEditing"
+ ];
+ function uiIntro(context) {
+ const INTRO_IMAGERY = "EsriWorldImageryClarity";
+ let _introGraph = {};
+ let _currChapter;
+ function intro(selection2) {
+ _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
+ for (let id2 in dataIntroGraph) {
+ if (!_introGraph[id2]) {
+ _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
+ }
}
+ selection2.call(startIntro);
+ }).catch(function() {
+ });
}
-
- function uniqueBy(a, n) {
- var o = [], seen = {};
- for (var i = 0; i < a.length; i++) {
- if (seen[a[i][n]] === undefined) {
- o.push(a[i]);
- seen[a[i][n]] = true;
- }
+ function startIntro(selection2) {
+ context.enter(modeBrowse(context));
+ let osm = context.connection();
+ let history = context.history().toJSON();
+ let hash = window.location.hash;
+ let center = context.map().center();
+ let zoom = context.map().zoom();
+ let background = context.background().baseLayerSource();
+ let overlays = context.background().overlayLayerSources();
+ let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
+ let caches = osm && osm.caches();
+ let baseEntities = context.history().graph().base().entities;
+ context.ui().sidebar.expand();
+ context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
+ context.inIntro(true);
+ if (osm) {
+ osm.toggle(false).reset();
+ }
+ context.history().reset();
+ context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
+ context.history().checkpoint("initial");
+ let imagery = context.background().findSource(INTRO_IMAGERY);
+ if (imagery) {
+ context.background().baseLayerSource(imagery);
+ } else {
+ context.background().bing();
+ }
+ overlays.forEach((d) => context.background().toggleOverlayLayer(d));
+ let layers = context.layers();
+ layers.all().forEach((item) => {
+ if (typeof item.layer.enabled === "function") {
+ item.layer.enabled(item.id === "osm");
}
- return o;
+ });
+ context.container().selectAll(".main-map .layer-background").style("opacity", 1);
+ let curtain = uiCurtain(context.container().node());
+ selection2.call(curtain);
+ corePreferences("walkthrough_started", "yes");
+ let storedProgress = corePreferences("walkthrough_progress") || "";
+ let progress = storedProgress.split(";").filter(Boolean);
+ let chapters = chapterFlow.map((chapter, i2) => {
+ let s = chapterUi[chapter](context, curtain.reveal).on("done", () => {
+ buttons.filter((d) => d.title === s.title).classed("finished", true);
+ if (i2 < chapterFlow.length - 1) {
+ const next = chapterFlow[i2 + 1];
+ context.container().select(`button.chapter-${next}`).classed("next", true);
+ }
+ progress.push(chapter);
+ corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
+ });
+ return s;
+ });
+ chapters[chapters.length - 1].on("startEditing", () => {
+ progress.push("startEditing");
+ corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
+ let incomplete = utilArrayDifference(chapterFlow, progress);
+ if (!incomplete.length) {
+ corePreferences("walkthrough_completed", "yes");
+ }
+ curtain.remove();
+ navwrap.remove();
+ context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
+ context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
+ if (osm) {
+ osm.toggle(true).reset().caches(caches);
+ }
+ context.history().reset().merge(Object.values(baseEntities));
+ context.background().baseLayerSource(background);
+ overlays.forEach((d) => context.background().toggleOverlayLayer(d));
+ if (history) {
+ context.history().fromJSON(history, false);
+ }
+ context.map().centerZoom(center, zoom);
+ window.location.replace(hash);
+ context.inIntro(false);
+ });
+ let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
+ navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
+ let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
+ let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d, i2) => `chapter chapter-${chapterFlow[i2]}`).on("click", enterChapter);
+ buttons.append("span").html((d) => _t.html(d.title));
+ buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
+ enterChapter(null, chapters[0]);
+ function enterChapter(d3_event, newChapter) {
+ if (_currChapter) {
+ _currChapter.exit();
+ }
+ context.enter(modeBrowse(context));
+ _currChapter = newChapter;
+ _currChapter.enter();
+ buttons.classed("next", false).classed("active", (d) => d.title === _currChapter.title);
+ }
}
+ return intro;
+ }
- function addSource(d) {
- d.push(source.url(d));
- return d;
+ // modules/ui/issues_info.js
+ function uiIssuesInfo(context) {
+ var warningsItem = {
+ id: "warnings",
+ count: 0,
+ iconID: "iD-icon-alert",
+ descriptionID: "issues.warnings_and_errors"
+ };
+ var resolvedItem = {
+ id: "resolved",
+ count: 0,
+ iconID: "iD-icon-apply",
+ descriptionID: "issues.user_resolved_issues"
+ };
+ function update(selection2) {
+ var shownItems = [];
+ var liveIssues = context.validator().getIssues({
+ what: corePreferences("validate-what") || "edited",
+ where: corePreferences("validate-where") || "all"
+ });
+ if (liveIssues.length) {
+ warningsItem.count = liveIssues.length;
+ shownItems.push(warningsItem);
+ }
+ if (corePreferences("validate-what") === "all") {
+ var resolvedIssues = context.validator().getResolvedIssues();
+ if (resolvedIssues.length) {
+ resolvedItem.count = resolvedIssues.length;
+ shownItems.push(resolvedItem);
+ }
+ }
+ var chips = selection2.selectAll(".chip").data(shownItems, function(d) {
+ return d.id;
+ });
+ chips.exit().remove();
+ var enter = chips.enter().append("a").attr("class", function(d) {
+ return "chip " + d.id + "-count";
+ }).attr("href", "#").each(function(d) {
+ var chipSelection = select_default2(this);
+ var tooltipBehavior = uiTooltip().placement("top").title(_t.html(d.descriptionID));
+ chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ tooltipBehavior.hide(select_default2(this));
+ context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
+ });
+ chipSelection.call(svgIcon("#" + d.iconID));
+ });
+ enter.append("span").attr("class", "count");
+ enter.merge(chips).selectAll("span.count").text(function(d) {
+ return d.count.toString();
+ });
}
+ return function(selection2) {
+ update(selection2);
+ context.validator().on("validated.infobox", function() {
+ update(selection2);
+ });
+ };
+ }
- // Update tiles based on current state of `projection`.
- function background(selection) {
- tile.scale(projection.scale() * 2 * Math.PI)
- .translate(projection.translate());
-
- tileOrigin = [
- projection.scale() * Math.PI - projection.translate()[0],
- projection.scale() * Math.PI - projection.translate()[1]];
-
- z = Math.max(Math.log(projection.scale() * 2 * Math.PI) / Math.log(2) - 8, 0);
-
- render(selection);
+ // modules/ui/map_in_map.js
+ function uiMapInMap(context) {
+ function mapInMap(selection2) {
+ var backgroundLayer = rendererTileLayer(context);
+ var overlayLayers = {};
+ var projection2 = geoRawMercator();
+ var dataLayer = svgData(projection2, context).showLabels(false);
+ var debugLayer = svgDebug(projection2, context);
+ var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
+ var wrap2 = select_default2(null);
+ var tiles = select_default2(null);
+ var viewport = select_default2(null);
+ var _isTransformed = false;
+ var _isHidden = true;
+ var _skipEvents = false;
+ var _gesture = null;
+ var _zDiff = 6;
+ var _dMini;
+ var _cMini;
+ var _tStart;
+ var _tCurr;
+ var _timeoutID;
+ function zoomStarted() {
+ if (_skipEvents)
+ return;
+ _tStart = _tCurr = projection2.transform();
+ _gesture = null;
+ }
+ function zoomed(d3_event) {
+ if (_skipEvents)
+ return;
+ var x = d3_event.transform.x;
+ var y = d3_event.transform.y;
+ var k = d3_event.transform.k;
+ var isZooming = k !== _tStart.k;
+ var isPanning = x !== _tStart.x || y !== _tStart.y;
+ if (!isZooming && !isPanning) {
+ return;
+ }
+ if (!_gesture) {
+ _gesture = isZooming ? "zoom" : "pan";
+ }
+ var tMini = projection2.transform();
+ var tX, tY, scale;
+ if (_gesture === "zoom") {
+ scale = k / tMini.k;
+ tX = (_cMini[0] / scale - _cMini[0]) * scale;
+ tY = (_cMini[1] / scale - _cMini[1]) * scale;
+ } else {
+ k = tMini.k;
+ scale = 1;
+ tX = x - tMini.x;
+ tY = y - tMini.y;
+ }
+ utilSetTransform(tiles, tX, tY, scale);
+ utilSetTransform(viewport, 0, 0, scale);
+ _isTransformed = true;
+ _tCurr = identity2.translate(x, y).scale(k);
+ var zMain = geoScaleToZoom(context.projection.scale());
+ var zMini = geoScaleToZoom(k);
+ _zDiff = zMain - zMini;
+ queueRedraw();
+ }
+ function zoomEnded() {
+ if (_skipEvents)
+ return;
+ if (_gesture !== "pan")
+ return;
+ updateProjection();
+ _gesture = null;
+ context.map().center(projection2.invert(_cMini));
+ }
+ function updateProjection() {
+ var loc = context.map().center();
+ var tMain = context.projection.transform();
+ var zMain = geoScaleToZoom(tMain.k);
+ var zMini = Math.max(zMain - _zDiff, 0.5);
+ var kMini = geoZoomToScale(zMini);
+ projection2.translate([tMain.x, tMain.y]).scale(kMini);
+ var point = projection2(loc);
+ var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
+ var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
+ var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
+ projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
+ _tCurr = projection2.transform();
+ if (_isTransformed) {
+ utilSetTransform(tiles, 0, 0);
+ utilSetTransform(viewport, 0, 0);
+ _isTransformed = false;
+ }
+ zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
+ _skipEvents = true;
+ wrap2.call(zoom.transform, _tCurr);
+ _skipEvents = false;
+ }
+ function redraw() {
+ clearTimeout(_timeoutID);
+ if (_isHidden)
+ return;
+ updateProjection();
+ var zMini = geoScaleToZoom(projection2.scale());
+ tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
+ tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
+ backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
+ var background = tiles.selectAll(".map-in-map-background").data([0]);
+ background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
+ var overlaySources = context.background().overlayLayerSources();
+ var activeOverlayLayers = [];
+ for (var i2 = 0; i2 < overlaySources.length; i2++) {
+ if (overlaySources[i2].validZoom(zMini)) {
+ if (!overlayLayers[i2])
+ overlayLayers[i2] = rendererTileLayer(context);
+ activeOverlayLayers.push(overlayLayers[i2].source(overlaySources[i2]).projection(projection2).dimensions(_dMini));
+ }
+ }
+ var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
+ overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
+ var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d) {
+ return d.source().name();
+ });
+ overlays.exit().remove();
+ overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
+ select_default2(this).call(layer);
+ });
+ var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
+ dataLayers.exit().remove();
+ dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
+ if (_gesture !== "pan") {
+ var getPath = path_default(projection2);
+ var bbox = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
+ viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
+ viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
+ var path = viewport.selectAll(".map-in-map-bbox").data([bbox]);
+ path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d) {
+ return getPath.area(d) < 30;
+ });
+ }
+ }
+ function queueRedraw() {
+ clearTimeout(_timeoutID);
+ _timeoutID = setTimeout(function() {
+ redraw();
+ }, 750);
+ }
+ function toggle(d3_event) {
+ if (d3_event)
+ d3_event.preventDefault();
+ _isHidden = !_isHidden;
+ context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
+ if (_isHidden) {
+ wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
+ selection2.selectAll(".map-in-map").style("display", "none");
+ });
+ } else {
+ wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
+ redraw();
+ });
+ }
+ }
+ uiMapInMap.toggle = toggle;
+ wrap2 = selection2.selectAll(".map-in-map").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
+ _dMini = [200, 150];
+ _cMini = geoVecScale(_dMini, 0.5);
+ context.map().on("drawn.map-in-map", function(drawn) {
+ if (drawn.full === true) {
+ redraw();
+ }
+ });
+ redraw();
+ context.keybinding().on(_t("background.minimap.key"), toggle);
}
+ return mapInMap;
+ }
- // Derive the tiles onscreen, remove those offscreen and position them.
- // Important that this part not depend on `projection` because it's
- // rentered when tiles load/error (see #644).
- function render(selection) {
- var requests = [];
- var showDebug = context.debugTile() && !source.overlay;
-
- if (source.validZoom(z)) {
- tile().forEach(function(d) {
- addSource(d);
- if (d[3] === '') return;
- if (typeof d[3] !== 'string') return; // Workaround for chrome crash https://github.com/openstreetmap/iD/issues/2295
- requests.push(d);
- if (cache[d[3]] === false && lookUp(d)) {
- requests.push(addSource(lookUp(d)));
- }
- });
+ // modules/ui/notice.js
+ function uiNotice(context) {
+ return function(selection2) {
+ var div = selection2.append("div").attr("class", "notice");
+ var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
+ context.map().zoomEase(context.minEditableZoom());
+ }).on("wheel", function(d3_event) {
+ var e22 = new WheelEvent(d3_event.type, d3_event);
+ context.surface().node().dispatchEvent(e22);
+ });
+ button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
+ function disableTooHigh() {
+ var canEdit = context.map().zoom() >= context.minEditableZoom();
+ div.style("display", canEdit ? "none" : "block");
+ }
+ context.map().on("move.notice", debounce_default(disableTooHigh, 500));
+ disableTooHigh();
+ };
+ }
- requests = uniqueBy(requests, 3).filter(function(r) {
- if (!!source.overlay && nearNullIsland(r[0], r[1], r[2])) {
- return false;
- }
- // don't re-request tiles which have failed in the past
- return cache[r[3]] !== false;
- });
+ // modules/ui/photoviewer.js
+ function uiPhotoviewer(context) {
+ var dispatch10 = dispatch_default("resize");
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function photoviewer(selection2) {
+ selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
+ if (services.streetside) {
+ services.streetside.hideViewer(context);
}
-
- var pixelOffset = [
- source.offset()[0] * Math.pow(2, z),
- source.offset()[1] * Math.pow(2, z)
- ];
-
- function load(d) {
- cache[d[3]] = true;
- d3.select(this)
- .on('error', null)
- .on('load', null)
- .classed('tile-loaded', true);
- render(selection);
- }
-
- function error(d) {
- cache[d[3]] = false;
- d3.select(this)
- .on('error', null)
- .on('load', null)
- .remove();
- render(selection);
- }
-
- function imageTransform(d) {
- var _ts = tileSize * Math.pow(2, z - d[2]);
- var scale = tileSizeAtZoom(d, z);
- return 'translate(' +
- ((d[0] * _ts) - tileOrigin[0] + pixelOffset[0]) + 'px,' +
- ((d[1] * _ts) - tileOrigin[1] + pixelOffset[1]) + 'px)' +
- 'scale(' + scale + ',' + scale + ')';
- }
-
- function debugTransform(d) {
- var _ts = tileSize * Math.pow(2, z - d[2]);
- var scale = tileSizeAtZoom(d, z);
- return 'translate(' +
- ((d[0] * _ts) - tileOrigin[0] + pixelOffset[0] + scale * (tileSize / 4)) + 'px,' +
- ((d[1] * _ts) - tileOrigin[1] + pixelOffset[1] + scale * (tileSize / 2)) + 'px)';
- }
-
- var image = selection
- .selectAll('img')
- .data(requests, function(d) { return d[3]; });
-
- image.exit()
- .style(transformProp, imageTransform)
- .classed('tile-removing', true)
- .each(function() {
- var tile = d3.select(this);
- window.setTimeout(function() {
- if (tile.classed('tile-removing')) {
- tile.remove();
- }
- }, 300);
- });
-
- image.enter().append('img')
- .attr('class', 'tile')
- .attr('src', function(d) { return d[3]; })
- .on('error', error)
- .on('load', load);
-
- image
- .style(transformProp, imageTransform)
- .classed('tile-debug', showDebug)
- .classed('tile-removing', false);
-
-
- var debug = selection.selectAll('.tile-label-debug')
- .data(showDebug ? requests : [], function(d) { return d[3]; });
-
- debug.exit()
- .remove();
-
- debug.enter()
- .append('div')
- .attr('class', 'tile-label-debug');
-
- debug
- .text(function(d) { return d[2] + ' / ' + d[0] + ' / ' + d[1]; })
- .style(transformProp, debugTransform);
+ if (services.mapillary) {
+ services.mapillary.hideViewer(context);
+ }
+ if (services.kartaview) {
+ services.kartaview.hideViewer(context);
+ }
+ }).append("div").call(svgIcon("#iD-icon-close"));
+ function preventDefault(d3_event) {
+ d3_event.preventDefault();
+ }
+ selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true, resizeOnY: true }));
+ selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnX: true }));
+ selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(_pointerPrefix + "down", buildResizeListener(selection2, "resize", dispatch10, { resizeOnY: true }));
+ function buildResizeListener(target, eventName, dispatch11, options2) {
+ var resizeOnX = !!options2.resizeOnX;
+ var resizeOnY = !!options2.resizeOnY;
+ var minHeight = options2.minHeight || 240;
+ var minWidth = options2.minWidth || 320;
+ var pointerId;
+ var startX;
+ var startY;
+ var startWidth;
+ var startHeight;
+ function startResize(d3_event) {
+ if (pointerId !== (d3_event.pointerId || "mouse"))
+ return;
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var mapSize = context.map().dimensions();
+ if (resizeOnX) {
+ var maxWidth = mapSize[0];
+ var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
+ target.style("width", newWidth + "px");
+ }
+ if (resizeOnY) {
+ var maxHeight = mapSize[1] - 90;
+ var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
+ target.style("height", newHeight + "px");
+ }
+ dispatch11.call(eventName, target, utilGetDimensions(target, true));
+ }
+ function clamp3(num, min3, max3) {
+ return Math.max(min3, Math.min(num, max3));
+ }
+ function stopResize(d3_event) {
+ if (pointerId !== (d3_event.pointerId || "mouse"))
+ return;
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ select_default2(window).on("." + eventName, null);
+ }
+ return function initResize(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ pointerId = d3_event.pointerId || "mouse";
+ startX = d3_event.clientX;
+ startY = d3_event.clientY;
+ var targetRect = target.node().getBoundingClientRect();
+ startWidth = targetRect.width;
+ startHeight = targetRect.height;
+ select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
+ if (_pointerPrefix === "pointer") {
+ select_default2(window).on("pointercancel." + eventName, stopResize, false);
+ }
+ };
+ }
}
-
- background.projection = function(_) {
- if (!arguments.length) return projection;
- projection = _;
- return background;
+ photoviewer.onMapResize = function() {
+ var photoviewer2 = context.container().select(".photoviewer");
+ var content = context.container().select(".main-content");
+ var mapDimensions = utilGetDimensions(content, true);
+ var photoDimensions = utilGetDimensions(photoviewer2, true);
+ if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
+ var setPhotoDimensions = [
+ Math.min(photoDimensions[0], mapDimensions[0]),
+ Math.min(photoDimensions[1], mapDimensions[1] - 90)
+ ];
+ photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
+ dispatch10.call("resize", photoviewer2, setPhotoDimensions);
+ }
};
+ return utilRebind(photoviewer, dispatch10, "on");
+ }
- background.dimensions = function(_) {
- if (!arguments.length) return tile.size();
- tile.size(_);
- return background;
+ // modules/ui/restore.js
+ function uiRestore(context) {
+ return function(selection2) {
+ if (!context.history().hasRestorableChanges())
+ return;
+ let modalSelection = uiModal(selection2, true);
+ modalSelection.select(".modal").attr("class", "modal fillL");
+ let introModal = modalSelection.select(".content");
+ introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
+ introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
+ let buttonWrap = introModal.append("div").attr("class", "modal-actions");
+ let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
+ context.history().restore();
+ modalSelection.remove();
+ });
+ restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
+ restore.append("div").call(_t.append("restore.restore"));
+ let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
+ context.history().clearSaved();
+ modalSelection.remove();
+ });
+ reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
+ reset.append("div").call(_t.append("restore.reset"));
+ restore.node().focus();
};
+ }
- background.source = function(_) {
- if (!arguments.length) return source;
- source = _;
- cache = {};
- tile.scaleExtent(source.scaleExtent);
- return background;
+ // modules/ui/scale.js
+ function uiScale(context) {
+ var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
+ function scaleDefs(loc1, loc2) {
+ var lat = (loc2[1] + loc1[1]) / 2, conversion = isImperial ? 3.28084 : 1, dist = geoLonToMeters(loc2[0] - loc1[0], lat) * conversion, scale = { dist: 0, px: 0, text: "" }, buckets, i2, val, dLon;
+ if (isImperial) {
+ buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
+ } else {
+ buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
+ }
+ for (i2 = 0; i2 < buckets.length; i2++) {
+ val = buckets[i2];
+ if (dist >= val) {
+ scale.dist = Math.floor(dist / val) * val;
+ break;
+ } else {
+ scale.dist = +dist.toFixed(2);
+ }
+ }
+ dLon = geoMetersToLon(scale.dist / conversion, lat);
+ scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
+ scale.text = displayLength(scale.dist / conversion, isImperial);
+ return scale;
+ }
+ function update(selection2) {
+ var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
+ selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
+ selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
+ }
+ return function(selection2) {
+ function switchUnits() {
+ isImperial = !isImperial;
+ selection2.call(update);
+ }
+ var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
+ scalegroup.append("path").attr("class", "scale-path");
+ selection2.append("div").attr("class", "scale-text");
+ selection2.call(update);
+ context.map().on("move.scale", function() {
+ update(selection2);
+ });
};
+ }
- return background;
-};
-iD.svg = {
- PointTransform: function(projection) {
- return function(entity) {
- // http://jsperf.com/short-array-join
- var pt = projection(entity.loc);
- return 'translate(' + pt[0] + ',' + pt[1] + ')';
- };
- },
-
- Path: function(projection, graph, polygon) {
- var cache = {},
- clip = d3.geo.clipExtent().extent(projection.clipExtent()).stream,
- project = projection.stream,
- path = d3.geo.path()
- .projection({stream: function(output) { return polygon ? project(output) : project(clip(output)); }});
-
- return function(entity) {
- if (entity.id in cache) {
- return cache[entity.id];
- } else {
- return cache[entity.id] = path(entity.asGeoJSON(graph));
- }
- };
- },
-
- OneWaySegments: function(projection, graph, dt) {
- return function(entity) {
- var a,
- b,
- i = 0,
- offset = dt,
- segments = [],
- clip = d3.geo.clipExtent().extent(projection.clipExtent()).stream,
- coordinates = graph.childNodes(entity).map(function(n) {
- return n.loc;
- });
-
- if (entity.tags.oneway === '-1') coordinates.reverse();
-
- d3.geo.stream({
- type: 'LineString',
- coordinates: coordinates
- }, projection.stream(clip({
- lineStart: function() {},
- lineEnd: function() {
- a = null;
- },
- point: function(x, y) {
- b = [x, y];
-
- if (a) {
- var span = iD.geo.euclideanDistance(a, b) - offset;
-
- if (span >= 0) {
- var angle = Math.atan2(b[1] - a[1], b[0] - a[0]),
- dx = dt * Math.cos(angle),
- dy = dt * Math.sin(angle),
- p = [a[0] + offset * Math.cos(angle),
- a[1] + offset * Math.sin(angle)];
-
- var segment = 'M' + a[0] + ',' + a[1] +
- 'L' + p[0] + ',' + p[1];
-
- for (span -= dt; span >= 0; span -= dt) {
- p[0] += dx;
- p[1] += dy;
- segment += 'L' + p[0] + ',' + p[1];
- }
-
- segment += 'L' + b[0] + ',' + b[1];
- segments.push({id: entity.id, index: i, d: segment});
- }
-
- offset = -span;
- i++;
- }
-
- a = b;
- }
- })));
-
- return segments;
- };
- },
-
- RelationMemberTags: function(graph) {
- return function(entity) {
- var tags = entity.tags;
- graph.parentRelations(entity).forEach(function(relation) {
- var type = relation.tags.type;
- if (type === 'multipolygon' || type === 'boundary') {
- tags = _.extend({}, relation.tags, tags);
- }
- });
- return tags;
- };
- }
-};
-iD.svg.Areas = function(projection) {
- // Patterns only work in Firefox when set directly on element.
- // (This is not a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=750632)
- var patterns = {
- wetland: 'wetland',
- beach: 'beach',
- scrub: 'scrub',
- construction: 'construction',
- military: 'construction',
- cemetery: 'cemetery',
- grave_yard: 'cemetery',
- meadow: 'meadow',
- farm: 'farmland',
- farmland: 'farmland',
- orchard: 'orchard'
- };
-
- var patternKeys = ['landuse', 'natural', 'amenity'];
-
- function setPattern(d) {
- for (var i = 0; i < patternKeys.length; i++) {
- if (patterns.hasOwnProperty(d.tags[patternKeys[i]])) {
- this.style.fill = this.style.stroke = 'url("#pattern-' + patterns[d.tags[patternKeys[i]]] + '")';
- return;
- }
- }
- this.style.fill = this.style.stroke = '';
+ // modules/ui/shortcuts.js
+ function uiShortcuts(context) {
+ var detected = utilDetect();
+ var _activeTab = 0;
+ var _modalSelection;
+ var _selection = select_default2(null);
+ var _dataShortcuts;
+ function shortcutsModal(_modalSelection2) {
+ _modalSelection2.select(".modal").classed("modal-shortcuts", true);
+ var content = _modalSelection2.select(".content");
+ content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
+ _mainFileFetcher.get("shortcuts").then(function(data) {
+ _dataShortcuts = data;
+ content.call(render);
+ }).catch(function() {
+ });
}
-
- return function drawAreas(surface, graph, entities, filter) {
- var path = iD.svg.Path(projection, graph, true),
- areas = {},
- multipolygon;
-
- for (var i = 0; i < entities.length; i++) {
- var entity = entities[i];
- if (entity.geometry(graph) !== 'area') continue;
-
- multipolygon = iD.geo.isSimpleMultipolygonOuterMember(entity, graph);
- if (multipolygon) {
- areas[multipolygon.id] = {
- entity: multipolygon.mergeTags(entity.tags),
- area: Math.abs(entity.area(graph))
- };
- } else if (!areas[entity.id]) {
- areas[entity.id] = {
- entity: entity,
- area: Math.abs(entity.area(graph))
- };
- }
+ function render(selection2) {
+ if (!_dataShortcuts)
+ return;
+ var wrapper = selection2.selectAll(".wrapper").data([0]);
+ var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
+ var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
+ var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
+ wrapper = wrapper.merge(wrapperEnter);
+ var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
+ var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d) {
+ d3_event.preventDefault();
+ var i2 = _dataShortcuts.indexOf(d);
+ _activeTab = i2;
+ render(selection2);
+ });
+ tabsEnter.append("span").html(function(d) {
+ return _t.html(d.text);
+ });
+ wrapper.selectAll(".tab").classed("active", function(d, i2) {
+ return i2 === _activeTab;
+ });
+ var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
+ var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d) {
+ return "shortcut-tab shortcut-tab-" + d.tab;
+ });
+ var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d) {
+ return d.columns;
+ }).enter().append("table").attr("class", "shortcut-column");
+ var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d) {
+ return d.rows;
+ }).enter().append("tr").attr("class", "shortcut-row");
+ var sectionRows = rowsEnter.filter(function(d) {
+ return !d.shortcuts;
+ });
+ sectionRows.append("td");
+ sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d) {
+ return _t.html(d.text);
+ });
+ var shortcutRows = rowsEnter.filter(function(d) {
+ return d.shortcuts;
+ });
+ var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
+ var modifierKeys = shortcutKeys.filter(function(d) {
+ return d.modifiers;
+ });
+ modifierKeys.selectAll("kbd.modifier").data(function(d) {
+ if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
+ return ["\u2318"];
+ } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
+ return [];
+ } else {
+ return d.modifiers;
}
-
- areas = d3.values(areas).filter(function hasPath(a) { return path(a.entity); });
- areas.sort(function areaSort(a, b) { return b.area - a.area; });
- areas = _.map(areas, 'entity');
-
- var strokes = areas.filter(function(area) {
- return area.type === 'way';
+ }).enter().each(function() {
+ var selection3 = select_default2(this);
+ selection3.append("kbd").attr("class", "modifier").text(function(d) {
+ return uiCmd.display(d);
});
-
- var data = {
- clip: areas,
- shadow: strokes,
- stroke: strokes,
- fill: areas
- };
-
- var clipPaths = surface.selectAll('defs').selectAll('.clipPath')
- .filter(filter)
- .data(data.clip, iD.Entity.key);
-
- clipPaths.enter()
- .append('clipPath')
- .attr('class', 'clipPath')
- .attr('id', function(entity) { return entity.id + '-clippath'; })
- .append('path');
-
- clipPaths.selectAll('path')
- .attr('d', path);
-
- clipPaths.exit()
- .remove();
-
- var areagroup = surface
- .selectAll('.layer-areas')
- .selectAll('g.areagroup')
- .data(['fill', 'shadow', 'stroke']);
-
- areagroup.enter()
- .append('g')
- .attr('class', function(d) { return 'layer areagroup area-' + d; });
-
- var paths = areagroup
- .selectAll('path')
- .filter(filter)
- .data(function(layer) { return data[layer]; }, iD.Entity.key);
-
- // Remove exiting areas first, so they aren't included in the `fills`
- // array used for sorting below (https://github.com/openstreetmap/iD/issues/1903).
- paths.exit()
- .remove();
-
- var fills = surface.selectAll('.area-fill path.area')[0];
-
- var bisect = d3.bisector(function(node) {
- return -node.__data__.area(graph);
- }).left;
-
- function sortedByArea(entity) {
- if (this.__data__ === 'fill') {
- return fills[bisect(fills, -entity.area(graph))];
- }
+ selection3.append("span").text("+");
+ });
+ shortcutKeys.selectAll("kbd.shortcut").data(function(d) {
+ var arr = d.shortcuts;
+ if (detected.os === "win" && d.text === "shortcuts.editing.commands.redo") {
+ arr = ["Y"];
+ } else if (detected.os !== "mac" && d.text === "shortcuts.browsing.display_options.fullscreen") {
+ arr = ["F11"];
+ }
+ arr = arr.map(function(s) {
+ return uiCmd.display(s.indexOf(".") !== -1 ? _t(s) : s);
+ });
+ return utilArrayUniq(arr).map(function(s) {
+ return {
+ shortcut: s,
+ separator: d.separator,
+ suffix: d.suffix
+ };
+ });
+ }).enter().each(function(d, i2, nodes) {
+ var selection3 = select_default2(this);
+ var click = d.shortcut.toLowerCase().match(/(.*).click/);
+ if (click && click[1]) {
+ selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
+ } else if (d.shortcut.toLowerCase() === "long-press") {
+ selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
+ } else if (d.shortcut.toLowerCase() === "tap") {
+ selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
+ } else {
+ selection3.append("kbd").attr("class", "shortcut").text(function(d2) {
+ return d2.shortcut;
+ });
}
-
- paths.enter()
- .insert('path', sortedByArea)
- .each(function(entity) {
- var layer = this.parentNode.__data__;
-
- this.setAttribute('class', entity.type + ' area ' + layer + ' ' + entity.id);
-
- if (layer === 'fill') {
- this.setAttribute('clip-path', 'url(#' + entity.id + '-clippath)');
- setPattern.apply(this, arguments);
- }
- })
- .call(iD.svg.TagClasses());
-
- paths
- .attr('d', path);
- };
-};
-/*
- A standalone SVG element that contains only a `defs` sub-element. To be
- used once globally, since defs IDs must be unique within a document.
-*/
-iD.svg.Defs = function(context) {
-
- function SVGSpriteDefinition(id, href) {
- return function(defs) {
- d3.xml(href, 'image/svg+xml', function(err, svg) {
- if (err) return;
- defs.node().appendChild(
- d3.select(svg.documentElement).attr('id', id).node()
- );
- });
- };
+ if (i2 < nodes.length - 1) {
+ selection3.append("span").html(d.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
+ } else if (i2 === nodes.length - 1 && d.suffix) {
+ selection3.append("span").text(d.suffix);
+ }
+ });
+ shortcutKeys.filter(function(d) {
+ return d.gesture;
+ }).each(function() {
+ var selection3 = select_default2(this);
+ selection3.append("span").text("+");
+ selection3.append("span").attr("class", "gesture").html(function(d) {
+ return _t.html(d.gesture);
+ });
+ });
+ shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d) {
+ return d.text ? _t.html(d.text) : "\xA0";
+ });
+ wrapper.selectAll(".shortcut-tab").style("display", function(d, i2) {
+ return i2 === _activeTab ? "flex" : "none";
+ });
}
+ return function(selection2, show) {
+ _selection = selection2;
+ if (show) {
+ _modalSelection = uiModal(selection2);
+ _modalSelection.call(shortcutsModal);
+ } else {
+ context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
+ if (context.container().selectAll(".modal-shortcuts").size()) {
+ if (_modalSelection) {
+ _modalSelection.close();
+ _modalSelection = null;
+ }
+ } else {
+ _modalSelection = uiModal(_selection);
+ _modalSelection.call(shortcutsModal);
+ }
+ });
+ }
+ };
+ }
- return function drawDefs(selection) {
- var defs = selection.append('defs');
-
- // marker
- defs.append('marker')
- .attr({
- id: 'oneway-marker',
- viewBox: '0 0 10 10',
- refY: 2.5,
- refX: 5,
- markerWidth: 2,
- markerHeight: 2,
- markerUnits: 'strokeWidth',
- orient: 'auto'
- })
- .append('path')
- .attr('class', 'oneway')
- .attr('d', 'M 5 3 L 0 3 L 0 2 L 5 2 L 5 0 L 10 2.5 L 5 5 z')
- .attr('stroke', 'none')
- .attr('fill', '#000')
- .attr('opacity', '0.5');
-
- // patterns
- var patterns = defs.selectAll('pattern')
- .data([
- // pattern name, pattern image name
- ['wetland', 'wetland'],
- ['construction', 'construction'],
- ['cemetery', 'cemetery'],
- ['orchard', 'orchard'],
- ['farmland', 'farmland'],
- ['beach', 'dots'],
- ['scrub', 'dots'],
- ['meadow', 'dots']
- ])
- .enter()
- .append('pattern')
- .attr({
- id: function (d) {
- return 'pattern-' + d[0];
- },
- width: 32,
- height: 32,
- patternUnits: 'userSpaceOnUse'
- });
-
- patterns.append('rect')
- .attr({
- x: 0,
- y: 0,
- width: 32,
- height: 32,
- 'class': function (d) {
- return 'pattern-color-' + d[0];
- }
- });
+ // modules/ui/data_header.js
+ function uiDataHeader() {
+ var _datum;
+ function dataHeader(selection2) {
+ var header = selection2.selectAll(".data-header").data(_datum ? [_datum] : [], function(d) {
+ return d.__featurehash__;
+ });
+ header.exit().remove();
+ var headerEnter = header.enter().append("div").attr("class", "data-header");
+ var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
+ iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
+ headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
+ }
+ dataHeader.datum = function(val) {
+ if (!arguments.length)
+ return _datum;
+ _datum = val;
+ return this;
+ };
+ return dataHeader;
+ }
- patterns.append('image')
- .attr({
- x: 0,
- y: 0,
- width: 32,
- height: 32
- })
- .attr('xlink:href', function (d) {
- return context.imagePath('pattern/' + d[1] + '.png');
+ // modules/ui/combobox.js
+ var _comboHideTimerID;
+ function uiCombobox(context, klass) {
+ var dispatch10 = dispatch_default("accept", "cancel");
+ var container = context.container();
+ var _suggestions = [];
+ var _data = [];
+ var _fetched = {};
+ var _selected = null;
+ var _canAutocomplete = true;
+ var _caseSensitive = false;
+ var _cancelFetch = false;
+ var _minItems = 2;
+ var _tDown = 0;
+ var _mouseEnterHandler, _mouseLeaveHandler;
+ var _fetcher = function(val, cb) {
+ cb(_data.filter(function(d) {
+ var terms = d.terms || [];
+ terms.push(d.value);
+ return terms.some(function(term) {
+ return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
+ });
+ }));
+ };
+ var combobox = function(input, attachTo) {
+ if (!input || input.empty())
+ return;
+ input.classed("combobox-input", true).on("focus.combo-input", focus).on("blur.combo-input", blur).on("keydown.combo-input", keydown).on("keyup.combo-input", keyup).on("input.combo-input", change).on("mousedown.combo-input", mousedown).each(function() {
+ var parent = this.parentNode;
+ var sibling = this.nextSibling;
+ select_default2(parent).selectAll(".combobox-caret").filter(function(d) {
+ return d === input.node();
+ }).data([input.node()]).enter().insert("div", function() {
+ return sibling;
+ }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
+ d3_event.preventDefault();
+ input.node().focus();
+ mousedown(d3_event);
+ }).on("mouseup.combo-caret", function(d3_event) {
+ d3_event.preventDefault();
+ mouseup(d3_event);
+ });
+ });
+ function mousedown(d3_event) {
+ if (d3_event.button !== 0)
+ return;
+ if (input.classed("disabled"))
+ return;
+ _tDown = +new Date();
+ var start2 = input.property("selectionStart");
+ var end = input.property("selectionEnd");
+ if (start2 !== end) {
+ var val = utilGetSetValue(input);
+ input.node().setSelectionRange(val.length, val.length);
+ return;
+ }
+ input.on("mouseup.combo-input", mouseup);
+ }
+ function mouseup(d3_event) {
+ input.on("mouseup.combo-input", null);
+ if (d3_event.button !== 0)
+ return;
+ if (input.classed("disabled"))
+ return;
+ if (input.node() !== document.activeElement)
+ return;
+ var start2 = input.property("selectionStart");
+ var end = input.property("selectionEnd");
+ if (start2 !== end)
+ return;
+ var combo = container.selectAll(".combobox");
+ if (combo.empty() || combo.datum() !== input.node()) {
+ var tOrig = _tDown;
+ window.setTimeout(function() {
+ if (tOrig !== _tDown)
+ return;
+ fetchComboData("", function() {
+ show();
+ render();
});
-
- // clip paths
- defs.selectAll()
- .data([12, 18, 20, 32, 45])
- .enter().append('clipPath')
- .attr('id', function (d) {
- return 'clip-square-' + d;
- })
- .append('rect')
- .attr('x', 0)
- .attr('y', 0)
- .attr('width', function (d) {
- return d;
- })
- .attr('height', function (d) {
- return d;
+ }, 250);
+ } else {
+ hide();
+ }
+ }
+ function focus() {
+ fetchComboData("");
+ }
+ function blur() {
+ _comboHideTimerID = window.setTimeout(hide, 75);
+ }
+ function show() {
+ hide();
+ container.insert("div", ":first-child").datum(input.node()).attr("class", "combobox" + (klass ? " combobox-" + klass : "")).style("position", "absolute").style("display", "block").style("left", "0px").on("mousedown.combo-container", function(d3_event) {
+ d3_event.preventDefault();
+ });
+ container.on("scroll.combo-scroll", render, true);
+ }
+ function hide() {
+ if (_comboHideTimerID) {
+ window.clearTimeout(_comboHideTimerID);
+ _comboHideTimerID = void 0;
+ }
+ container.selectAll(".combobox").remove();
+ container.on("scroll.combo-scroll", null);
+ }
+ function keydown(d3_event) {
+ var shown = !container.selectAll(".combobox").empty();
+ var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
+ switch (d3_event.keyCode) {
+ case 8:
+ case 46:
+ d3_event.stopPropagation();
+ _selected = null;
+ render();
+ input.on("input.combo-input", function() {
+ var start2 = input.property("selectionStart");
+ input.node().setSelectionRange(start2, start2);
+ input.on("input.combo-input", change);
});
-
- defs.call(SVGSpriteDefinition(
- 'iD-sprite',
- context.imagePath('iD-sprite.svg')));
-
- defs.call(SVGSpriteDefinition(
- 'maki-sprite',
- context.imagePath('maki-sprite.svg')));
+ break;
+ case 9:
+ accept(d3_event);
+ break;
+ case 13:
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ break;
+ case 38:
+ if (tagName === "textarea" && !shown)
+ return;
+ d3_event.preventDefault();
+ if (tagName === "input" && !shown) {
+ show();
+ }
+ nav(-1);
+ break;
+ case 40:
+ if (tagName === "textarea" && !shown)
+ return;
+ d3_event.preventDefault();
+ if (tagName === "input" && !shown) {
+ show();
+ }
+ nav(1);
+ break;
+ }
+ }
+ function keyup(d3_event) {
+ switch (d3_event.keyCode) {
+ case 27:
+ cancel();
+ break;
+ case 13:
+ accept(d3_event);
+ break;
+ }
+ }
+ function change() {
+ fetchComboData(value(), function() {
+ _selected = null;
+ var val = input.property("value");
+ if (_suggestions.length) {
+ if (input.property("selectionEnd") === val.length) {
+ _selected = tryAutocomplete();
+ }
+ if (!_selected) {
+ _selected = val;
+ }
+ }
+ if (val.length) {
+ var combo = container.selectAll(".combobox");
+ if (combo.empty()) {
+ show();
+ }
+ } else {
+ hide();
+ }
+ render();
+ });
+ }
+ function nav(dir) {
+ if (_suggestions.length) {
+ var index = -1;
+ for (var i2 = 0; i2 < _suggestions.length; i2++) {
+ if (_selected && _suggestions[i2].value === _selected) {
+ index = i2;
+ break;
+ }
+ }
+ index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
+ _selected = _suggestions[index].value;
+ input.property("value", _selected);
+ }
+ render();
+ ensureVisible();
+ }
+ function ensureVisible() {
+ var combo = container.selectAll(".combobox");
+ if (combo.empty())
+ return;
+ var containerRect = container.node().getBoundingClientRect();
+ var comboRect = combo.node().getBoundingClientRect();
+ if (comboRect.bottom > containerRect.bottom) {
+ var node = attachTo ? attachTo.node() : input.node();
+ node.scrollIntoView({ behavior: "instant", block: "center" });
+ render();
+ }
+ var selected = combo.selectAll(".combobox-option.selected").node();
+ if (selected) {
+ selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
+ }
+ }
+ function value() {
+ var value2 = input.property("value");
+ var start2 = input.property("selectionStart");
+ var end = input.property("selectionEnd");
+ if (start2 && end) {
+ value2 = value2.substring(0, start2);
+ }
+ return value2;
+ }
+ function fetchComboData(v, cb) {
+ _cancelFetch = false;
+ _fetcher.call(input, v, function(results) {
+ if (_cancelFetch)
+ return;
+ _suggestions = results;
+ results.forEach(function(d) {
+ _fetched[d.value] = d;
+ });
+ if (cb) {
+ cb();
+ }
+ });
+ }
+ function tryAutocomplete() {
+ if (!_canAutocomplete)
+ return;
+ var val = _caseSensitive ? value() : value().toLowerCase();
+ if (!val)
+ return;
+ if (!isNaN(parseFloat(val)) && isFinite(val))
+ return;
+ var bestIndex = -1;
+ for (var i2 = 0; i2 < _suggestions.length; i2++) {
+ var suggestion = _suggestions[i2].value;
+ var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
+ if (compare === val) {
+ bestIndex = i2;
+ break;
+ } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
+ bestIndex = i2;
+ }
+ }
+ if (bestIndex !== -1) {
+ var bestVal = _suggestions[bestIndex].value;
+ input.property("value", bestVal);
+ input.node().setSelectionRange(val.length, bestVal.length);
+ return bestVal;
+ }
+ }
+ function render() {
+ if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
+ hide();
+ return;
+ }
+ var shown = !container.selectAll(".combobox").empty();
+ if (!shown)
+ return;
+ var combo = container.selectAll(".combobox");
+ var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d) {
+ return d.value;
+ });
+ options2.exit().remove();
+ options2.enter().append("a").attr("class", function(d) {
+ return "combobox-option " + (d.klass || "");
+ }).attr("title", function(d) {
+ return d.title;
+ }).html(function(d) {
+ return d.display || d.value;
+ }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d) {
+ return d.value === _selected;
+ }).on("click.combo-option", accept).order();
+ var node = attachTo ? attachTo.node() : input.node();
+ var containerRect = container.node().getBoundingClientRect();
+ var rect = node.getBoundingClientRect();
+ combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
+ }
+ function accept(d3_event, d) {
+ _cancelFetch = true;
+ var thiz = input.node();
+ if (d) {
+ utilGetSetValue(input, d.value);
+ utilTriggerEvent(input, "change");
+ }
+ var val = utilGetSetValue(input);
+ thiz.setSelectionRange(val.length, val.length);
+ d = _fetched[val];
+ dispatch10.call("accept", thiz, d, val);
+ hide();
+ }
+ function cancel() {
+ _cancelFetch = true;
+ var thiz = input.node();
+ var val = utilGetSetValue(input);
+ var start2 = input.property("selectionStart");
+ var end = input.property("selectionEnd");
+ val = val.slice(0, start2) + val.slice(end);
+ utilGetSetValue(input, val);
+ thiz.setSelectionRange(val.length, val.length);
+ dispatch10.call("cancel", thiz);
+ hide();
+ }
};
-};
-iD.svg.Gpx = function(projection, context, dispatch) {
- var showLabels = true,
- layer;
-
- function init() {
- if (iD.svg.Gpx.initialized) return; // run once
+ combobox.canAutocomplete = function(val) {
+ if (!arguments.length)
+ return _canAutocomplete;
+ _canAutocomplete = val;
+ return combobox;
+ };
+ combobox.caseSensitive = function(val) {
+ if (!arguments.length)
+ return _caseSensitive;
+ _caseSensitive = val;
+ return combobox;
+ };
+ combobox.data = function(val) {
+ if (!arguments.length)
+ return _data;
+ _data = val;
+ return combobox;
+ };
+ combobox.fetcher = function(val) {
+ if (!arguments.length)
+ return _fetcher;
+ _fetcher = val;
+ return combobox;
+ };
+ combobox.minItems = function(val) {
+ if (!arguments.length)
+ return _minItems;
+ _minItems = val;
+ return combobox;
+ };
+ combobox.itemsMouseEnter = function(val) {
+ if (!arguments.length)
+ return _mouseEnterHandler;
+ _mouseEnterHandler = val;
+ return combobox;
+ };
+ combobox.itemsMouseLeave = function(val) {
+ if (!arguments.length)
+ return _mouseLeaveHandler;
+ _mouseLeaveHandler = val;
+ return combobox;
+ };
+ return utilRebind(combobox, dispatch10, "on");
+ }
+ uiCombobox.off = function(input, context) {
+ input.on("focus.combo-input", null).on("blur.combo-input", null).on("keydown.combo-input", null).on("keyup.combo-input", null).on("input.combo-input", null).on("mousedown.combo-input", null).on("mouseup.combo-input", null);
+ context.container().on("scroll.combo-scroll", null);
+ };
- iD.svg.Gpx.geojson = {};
- iD.svg.Gpx.enabled = true;
+ // modules/ui/disclosure.js
+ function uiDisclosure(context, key, expandedDefault) {
+ var dispatch10 = dispatch_default("toggled");
+ var _expanded;
+ var _label = utilFunctor("");
+ var _updatePreference = true;
+ var _content = function() {
+ };
+ var disclosure = function(selection2) {
+ if (_expanded === void 0 || _expanded === null) {
+ var preference = corePreferences("disclosure." + key + ".expanded");
+ _expanded = preference === null ? !!expandedDefault : preference === "true";
+ }
+ var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
+ var hideToggleEnter = hideToggle.enter().append("h3").append("a").attr("role", "button").attr("href", "#").attr("class", "hide-toggle hide-toggle-" + key).call(svgIcon("", "pre-text", "hide-toggle-icon"));
+ hideToggleEnter.append("span").attr("class", "hide-toggle-text");
+ hideToggle = hideToggleEnter.merge(hideToggle);
+ hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
+ hideToggle.selectAll(".hide-toggle-text").html(_label());
+ hideToggle.selectAll(".hide-toggle-icon").attr("xlink:href", _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward");
+ var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
+ if (_expanded) {
+ wrap2.call(_content);
+ }
+ function toggle(d3_event) {
+ d3_event.preventDefault();
+ _expanded = !_expanded;
+ if (_updatePreference) {
+ corePreferences("disclosure." + key + ".expanded", _expanded);
+ }
+ hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
+ hideToggle.selectAll(".hide-toggle-icon").attr("xlink:href", _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward");
+ wrap2.call(uiToggle(_expanded));
+ if (_expanded) {
+ wrap2.call(_content);
+ }
+ dispatch10.call("toggled", this, _expanded);
+ }
+ };
+ disclosure.label = function(val) {
+ if (!arguments.length)
+ return _label;
+ _label = utilFunctor(val);
+ return disclosure;
+ };
+ disclosure.expanded = function(val) {
+ if (!arguments.length)
+ return _expanded;
+ _expanded = val;
+ return disclosure;
+ };
+ disclosure.updatePreference = function(val) {
+ if (!arguments.length)
+ return _updatePreference;
+ _updatePreference = val;
+ return disclosure;
+ };
+ disclosure.content = function(val) {
+ if (!arguments.length)
+ return _content;
+ _content = val;
+ return disclosure;
+ };
+ return utilRebind(disclosure, dispatch10, "on");
+ }
- function over() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- d3.event.dataTransfer.dropEffect = 'copy';
+ // modules/ui/section.js
+ function uiSection(id2, context) {
+ var _classes = utilFunctor("");
+ var _shouldDisplay;
+ var _content;
+ var _disclosure;
+ var _label;
+ var _expandedByDefault = utilFunctor(true);
+ var _disclosureContent;
+ var _disclosureExpanded;
+ var _containerSelection = select_default2(null);
+ var section = {
+ id: id2
+ };
+ section.classes = function(val) {
+ if (!arguments.length)
+ return _classes;
+ _classes = utilFunctor(val);
+ return section;
+ };
+ section.label = function(val) {
+ if (!arguments.length)
+ return _label;
+ _label = utilFunctor(val);
+ return section;
+ };
+ section.expandedByDefault = function(val) {
+ if (!arguments.length)
+ return _expandedByDefault;
+ _expandedByDefault = utilFunctor(val);
+ return section;
+ };
+ section.shouldDisplay = function(val) {
+ if (!arguments.length)
+ return _shouldDisplay;
+ _shouldDisplay = utilFunctor(val);
+ return section;
+ };
+ section.content = function(val) {
+ if (!arguments.length)
+ return _content;
+ _content = val;
+ return section;
+ };
+ section.disclosureContent = function(val) {
+ if (!arguments.length)
+ return _disclosureContent;
+ _disclosureContent = val;
+ return section;
+ };
+ section.disclosureExpanded = function(val) {
+ if (!arguments.length)
+ return _disclosureExpanded;
+ _disclosureExpanded = val;
+ return section;
+ };
+ section.render = function(selection2) {
+ _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
+ var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
+ _containerSelection = sectionEnter.merge(_containerSelection);
+ _containerSelection.call(renderContent);
+ };
+ section.reRender = function() {
+ _containerSelection.call(renderContent);
+ };
+ section.selection = function() {
+ return _containerSelection;
+ };
+ section.disclosure = function() {
+ return _disclosure;
+ };
+ function renderContent(selection2) {
+ if (_shouldDisplay) {
+ var shouldDisplay = _shouldDisplay();
+ selection2.classed("hide", !shouldDisplay);
+ if (!shouldDisplay) {
+ selection2.html("");
+ return;
}
-
- d3.select('body')
- .attr('dropzone', 'copy')
- .on('drop.localgpx', function() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- if (!iD.detect().filedrop) return;
- drawGpx.files(d3.event.dataTransfer.files);
- })
- .on('dragenter.localgpx', over)
- .on('dragexit.localgpx', over)
- .on('dragover.localgpx', over);
-
- iD.svg.Gpx.initialized = true;
+ }
+ if (_disclosureContent) {
+ if (!_disclosure) {
+ _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
+ }
+ if (_disclosureExpanded !== void 0) {
+ _disclosure.expanded(_disclosureExpanded);
+ _disclosureExpanded = void 0;
+ }
+ selection2.call(_disclosure);
+ return;
+ }
+ if (_content) {
+ selection2.call(_content);
+ }
}
+ return section;
+ }
-
- function drawGpx(surface) {
- var geojson = iD.svg.Gpx.geojson,
- enabled = iD.svg.Gpx.enabled;
-
- layer = surface.selectAll('.layer-gpx')
- .data(enabled ? [0] : []);
-
- layer.enter()
- .append('g')
- .attr('class', 'layer-gpx');
-
- layer.exit()
- .remove();
-
-
- var paths = layer
- .selectAll('path')
- .data([geojson]);
-
- paths.enter()
- .append('path')
- .attr('class', 'gpx');
-
- paths.exit()
- .remove();
-
- var path = d3.geo.path()
- .projection(projection);
-
- paths
- .attr('d', path);
-
-
- var labels = layer.selectAll('text')
- .data(showLabels && geojson.features ? geojson.features : []);
-
- labels.enter()
- .append('text')
- .attr('class', 'gpx');
-
- labels.exit()
- .remove();
-
- labels
- .text(function(d) {
- return d.properties.desc || d.properties.name;
- })
- .attr('x', function(d) {
- var centroid = path.centroid(d);
- return centroid[0] + 7;
- })
- .attr('y', function(d) {
- var centroid = path.centroid(d);
- return centroid[1];
- });
-
+ // modules/ui/tag_reference.js
+ function uiTagReference(what) {
+ var wikibase = what.qid ? services.wikidata : services.osmWikibase;
+ var tagReference = {};
+ var _button = select_default2(null);
+ var _body = select_default2(null);
+ var _loaded;
+ var _showing;
+ function load() {
+ if (!wikibase)
+ return;
+ _button.classed("tag-reference-loading", true);
+ wikibase.getDocs(what, gotDocs);
+ }
+ function gotDocs(err, docs) {
+ _body.html("");
+ if (!docs || !docs.title) {
+ _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
+ done();
+ return;
+ }
+ if (docs.imageURL) {
+ _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
+ done();
+ }).on("error", function() {
+ select_default2(this).remove();
+ done();
+ });
+ } else {
+ done();
+ }
+ var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
+ if (docs.description) {
+ tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
+ } else {
+ tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
+ }
+ tagReferenceDescription.append("a").attr("class", "tag-reference-edit").attr("target", "_blank").attr("title", _t("inspector.edit_reference")).attr("href", docs.editURL).call(svgIcon("#iD-icon-edit", "inline"));
+ if (docs.wiki) {
+ _body.append("a").attr("class", "tag-reference-link").attr("target", "_blank").attr("href", docs.wiki.url).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append(docs.wiki.text));
+ }
+ if (what.key === "comment") {
+ _body.append("a").attr("class", "tag-reference-comment-link").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", _t("commit.about_changeset_comments_link")).append("span").call(_t.append("commit.about_changeset_comments"));
+ }
}
-
- function toDom(x) {
- return (new DOMParser()).parseFromString(x, 'text/xml');
+ function done() {
+ _loaded = true;
+ _button.classed("tag-reference-loading", false);
+ _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
+ _showing = true;
+ _button.selectAll("svg.icon use").each(function() {
+ var iconUse = select_default2(this);
+ if (iconUse.attr("href") === "#iD-icon-info") {
+ iconUse.attr("href", "#iD-icon-info-filled");
+ }
+ });
}
-
- drawGpx.showLabels = function(_) {
- if (!arguments.length) return showLabels;
- showLabels = _;
- return this;
+ function hide() {
+ _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
+ _body.classed("expanded", false);
+ });
+ _showing = false;
+ _button.selectAll("svg.icon use").each(function() {
+ var iconUse = select_default2(this);
+ if (iconUse.attr("href") === "#iD-icon-info-filled") {
+ iconUse.attr("href", "#iD-icon-info");
+ }
+ });
+ }
+ tagReference.button = function(selection2, klass, iconName) {
+ _button = selection2.selectAll(".tag-reference-button").data([0]);
+ _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
+ _button.on("click", function(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ this.blur();
+ if (_showing) {
+ hide();
+ } else if (_loaded) {
+ done();
+ } else {
+ load();
+ }
+ });
};
-
- drawGpx.enabled = function(_) {
- if (!arguments.length) return iD.svg.Gpx.enabled;
- iD.svg.Gpx.enabled = _;
- dispatch.change();
- return this;
+ tagReference.body = function(selection2) {
+ var itemID = what.qid || what.key + "-" + (what.value || "");
+ _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d) {
+ return d;
+ });
+ _body.exit().remove();
+ _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
+ if (_showing === false) {
+ hide();
+ }
};
-
- drawGpx.hasGpx = function() {
- var geojson = iD.svg.Gpx.geojson;
- return (!(_.isEmpty(geojson) || _.isEmpty(geojson.features)));
+ tagReference.showing = function(val) {
+ if (!arguments.length)
+ return _showing;
+ _showing = val;
+ return tagReference;
};
+ return tagReference;
+ }
- drawGpx.geojson = function(gj) {
- if (!arguments.length) return iD.svg.Gpx.geojson;
- if (_.isEmpty(gj) || _.isEmpty(gj.features)) return this;
- iD.svg.Gpx.geojson = gj;
- dispatch.change();
- return this;
+ // modules/ui/field_help.js
+ function uiFieldHelp(context, fieldName) {
+ var fieldHelp = {};
+ var _inspector = select_default2(null);
+ var _wrap = select_default2(null);
+ var _body = select_default2(null);
+ var fieldHelpKeys = {
+ restrictions: [
+ ["about", [
+ "about",
+ "from_via_to",
+ "maxdist",
+ "maxvia"
+ ]],
+ ["inspecting", [
+ "about",
+ "from_shadow",
+ "allow_shadow",
+ "restrict_shadow",
+ "only_shadow",
+ "restricted",
+ "only"
+ ]],
+ ["modifying", [
+ "about",
+ "indicators",
+ "allow_turn",
+ "restrict_turn",
+ "only_turn"
+ ]],
+ ["tips", [
+ "simple",
+ "simple_example",
+ "indirect",
+ "indirect_example",
+ "indirect_noedit"
+ ]]
+ ]
+ };
+ var fieldHelpHeadings = {};
+ var replacements = {
+ distField: { html: _t.html("restriction.controls.distance") },
+ viaField: { html: _t.html("restriction.controls.via") },
+ fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
+ allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
+ restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
+ onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
+ allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
+ restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
+ onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
+ };
+ var docs = fieldHelpKeys[fieldName].map(function(key) {
+ var helpkey = "help.field." + fieldName + "." + key[0];
+ var text2 = key[1].reduce(function(all, part) {
+ var subkey = helpkey + "." + part;
+ var depth = fieldHelpHeadings[subkey];
+ var hhh = depth ? Array(depth + 1).join("#") + " " : "";
+ return all + hhh + _t.html(subkey, replacements) + "\n\n";
+ }, "");
+ return {
+ key: helpkey,
+ title: _t.html(helpkey + ".title"),
+ html: marked(text2.trim())
+ };
+ });
+ function show() {
+ updatePosition();
+ _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
+ }
+ function hide() {
+ _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
+ _body.classed("hide", true);
+ });
+ }
+ function clickHelp(index) {
+ var d = docs[index];
+ var tkeys = fieldHelpKeys[fieldName][index][1];
+ _body.selectAll(".field-help-nav-item").classed("active", function(d2, i2) {
+ return i2 === index;
+ });
+ var content = _body.selectAll(".field-help-content").html(d.html);
+ content.selectAll("p").attr("class", function(d2, i2) {
+ return tkeys[i2];
+ });
+ if (d.key === "help.field.restrictions.inspecting") {
+ content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
+ } else if (d.key === "help.field.restrictions.modifying") {
+ content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
+ }
+ }
+ fieldHelp.button = function(selection2) {
+ if (_body.empty())
+ return;
+ var button = selection2.selectAll(".field-help-button").data([0]);
+ button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ if (_body.classed("hide")) {
+ show();
+ } else {
+ hide();
+ }
+ });
};
+ function updatePosition() {
+ var wrap2 = _wrap.node();
+ var inspector = _inspector.node();
+ var wRect = wrap2.getBoundingClientRect();
+ var iRect = inspector.getBoundingClientRect();
+ _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
+ }
+ fieldHelp.body = function(selection2) {
+ _wrap = selection2.selectAll(".form-field-input-wrap");
+ if (_wrap.empty())
+ return;
+ _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
+ if (_inspector.empty())
+ return;
+ _body = _inspector.selectAll(".field-help-body").data([0]);
+ var enter = _body.enter().append("div").attr("class", "field-help-body hide");
+ var titleEnter = enter.append("div").attr("class", "field-help-title cf");
+ titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
+ titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ hide();
+ }).call(svgIcon("#iD-icon-close"));
+ var navEnter = enter.append("div").attr("class", "field-help-nav cf");
+ var titles = docs.map(function(d) {
+ return d.title;
+ });
+ navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d) {
+ return d;
+ }).on("click", function(d3_event, d) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ clickHelp(titles.indexOf(d));
+ });
+ enter.append("div").attr("class", "field-help-content");
+ _body = _body.merge(enter);
+ clickHelp(0);
+ };
+ return fieldHelp;
+ }
- drawGpx.url = function(url) {
- d3.text(url, function(err, data) {
- if (!err) {
- drawGpx.geojson(toGeoJSON.gpx(toDom(data)));
+ // modules/ui/fields/check.js
+ function uiFieldCheck(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var options2 = field.options;
+ var values = [];
+ var texts = [];
+ var _tags;
+ var input = select_default2(null);
+ var text2 = select_default2(null);
+ var label = select_default2(null);
+ var reverser = select_default2(null);
+ var _impliedYes;
+ var _entityIDs = [];
+ var _value;
+ if (options2) {
+ for (var i2 in options2) {
+ var v = options2[i2];
+ values.push(v === "undefined" ? void 0 : v);
+ texts.push(field.t.html("options." + v, { "default": v }));
+ }
+ } else {
+ values = [void 0, "yes"];
+ texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
+ if (field.type !== "defaultCheck") {
+ values.push("no");
+ texts.push(_t.html("inspector.check.no"));
+ }
+ }
+ function checkImpliedYes() {
+ _impliedYes = field.id === "oneway_yes";
+ if (field.id === "oneway") {
+ var entity = context.entity(_entityIDs[0]);
+ for (var key in entity.tags) {
+ if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
+ _impliedYes = true;
+ texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
+ break;
+ }
+ }
+ }
+ }
+ function reverserHidden() {
+ if (!context.container().select("div.inspector-hover").empty())
+ return true;
+ return !(_value === "yes" || _impliedYes && !_value);
+ }
+ function reverserSetText(selection2) {
+ var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
+ if (reverserHidden() || !entity)
+ return selection2;
+ var first = entity.first();
+ var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
+ var pseudoDirection = first < last;
+ var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
+ selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
+ return selection2;
+ }
+ var check = function(selection2) {
+ checkImpliedYes();
+ label = selection2.selectAll(".form-field-input-wrap").data([0]);
+ var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
+ enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
+ enter.append("span").html(texts[0]).attr("class", "value");
+ if (field.type === "onewayCheck") {
+ enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
+ }
+ label = label.merge(enter);
+ input = label.selectAll("input");
+ text2 = label.selectAll("span.value");
+ input.on("click", function(d3_event) {
+ d3_event.stopPropagation();
+ var t = {};
+ if (Array.isArray(_tags[field.key])) {
+ if (values.indexOf("yes") !== -1) {
+ t[field.key] = "yes";
+ } else {
+ t[field.key] = values[0];
+ }
+ } else {
+ t[field.key] = values[(values.indexOf(_value) + 1) % values.length];
+ }
+ if (t[field.key] === "reversible" || t[field.key] === "alternating") {
+ t[field.key] = values[0];
+ }
+ dispatch10.call("change", this, t);
+ });
+ if (field.type === "onewayCheck") {
+ reverser = label.selectAll(".reverser");
+ reverser.call(reverserSetText).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ context.perform(function(graph) {
+ for (var i3 in _entityIDs) {
+ graph = actionReverse(_entityIDs[i3])(graph);
}
+ return graph;
+ }, _t("operations.reverse.annotation.line", { n: 1 }));
+ context.validator().validate();
+ select_default2(this).call(reverserSetText);
});
- return this;
+ }
};
-
- drawGpx.files = function(fileList) {
- if (!fileList.length) return this;
- var f = fileList[0],
- reader = new FileReader();
-
- reader.onload = function(e) {
- drawGpx.geojson(toGeoJSON.gpx(toDom(e.target.result))).fitZoom();
- };
-
- reader.readAsText(f);
- return this;
+ check.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return check;
};
-
- drawGpx.fitZoom = function() {
- if (!this.hasGpx()) return this;
- var geojson = iD.svg.Gpx.geojson;
-
- var map = context.map(),
- viewport = map.trimmedExtent().polygon(),
- coords = _.reduce(geojson.features, function(coords, feature) {
- var c = feature.geometry.coordinates;
- return _.union(coords, feature.geometry.type === 'Point' ? [c] : c);
- }, []);
-
- if (!iD.geo.polygonIntersectsPolygon(viewport, coords, true)) {
- var extent = iD.geo.Extent(d3.geo.bounds(geojson));
- map.centerZoom(extent.center(), map.trimmedExtentZoom(extent));
- }
-
- return this;
+ check.tags = function(tags) {
+ _tags = tags;
+ function isChecked(val) {
+ return val !== "no" && val !== "" && val !== void 0 && val !== null;
+ }
+ function textFor(val) {
+ if (val === "")
+ val = void 0;
+ var index = values.indexOf(val);
+ return index !== -1 ? texts[index] : '"' + val + '"';
+ }
+ checkImpliedYes();
+ var isMixed = Array.isArray(tags[field.key]);
+ _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
+ if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
+ _value = "yes";
+ }
+ input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
+ text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
+ label.classed("set", !!_value);
+ if (field.type === "onewayCheck") {
+ reverser.classed("hide", reverserHidden()).call(reverserSetText);
+ }
};
+ check.focus = function() {
+ input.node().focus();
+ };
+ return utilRebind(check, dispatch10, "on");
+ }
- init();
- return drawGpx;
-};
-iD.svg.Icon = function(name, svgklass, useklass) {
- return function drawIcon(selection) {
- selection.selectAll('svg')
- .data([0])
- .enter()
- .append('svg')
- .attr('class', 'icon ' + (svgklass || ''))
- .append('use')
- .attr('xlink:href', name)
- .attr('class', useklass);
- };
-};
-iD.svg.Labels = function(projection, context) {
- var path = d3.geo.path().projection(projection);
-
- // Replace with dict and iterate over entities tags instead?
- var label_stack = [
- ['line', 'aeroway'],
- ['line', 'highway'],
- ['line', 'railway'],
- ['line', 'waterway'],
- ['area', 'aeroway'],
- ['area', 'amenity'],
- ['area', 'building'],
- ['area', 'historic'],
- ['area', 'leisure'],
- ['area', 'man_made'],
- ['area', 'natural'],
- ['area', 'shop'],
- ['area', 'tourism'],
- ['point', 'aeroway'],
- ['point', 'amenity'],
- ['point', 'building'],
- ['point', 'historic'],
- ['point', 'leisure'],
- ['point', 'man_made'],
- ['point', 'natural'],
- ['point', 'shop'],
- ['point', 'tourism'],
- ['line', 'name'],
- ['area', 'name'],
- ['point', 'name']
- ];
-
- var default_size = 12;
-
- var font_sizes = label_stack.map(function(d) {
- var style = iD.util.getStyle('text.' + d[0] + '.tag-' + d[1]),
- m = style && style.cssText.match('font-size: ([0-9]{1,2})px;');
- if (m) return parseInt(m[1], 10);
-
- style = iD.util.getStyle('text.' + d[0]);
- m = style && style.cssText.match('font-size: ([0-9]{1,2})px;');
- if (m) return parseInt(m[1], 10);
-
- return default_size;
+ // modules/ui/fields/combo.js
+ function uiFieldCombo(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
+ var _isNetwork = field.type === "networkCombo";
+ var _isSemi = field.type === "semiCombo";
+ var _optarray = field.options;
+ var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
+ var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
+ var _snake_case = field.snake_case || field.snake_case === void 0;
+ var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(_isMulti || _isSemi ? 1 : 2);
+ var _container = select_default2(null);
+ var _inputWrap = select_default2(null);
+ var _input = select_default2(null);
+ var _comboData = [];
+ var _multiData = [];
+ var _entityIDs = [];
+ var _tags;
+ var _countryCode;
+ var _staticPlaceholder;
+ var _dataDeprecated = [];
+ _mainFileFetcher.get("deprecated").then(function(d) {
+ _dataDeprecated = d;
+ }).catch(function() {
});
-
- var iconSize = 18;
-
- var pointOffsets = [
- [15, -11, 'start'], // right
- [10, -11, 'start'], // unused right now
- [-15, -11, 'end']
- ];
-
- var lineOffsets = [50, 45, 55, 40, 60, 35, 65, 30, 70, 25,
- 75, 20, 80, 15, 95, 10, 90, 5, 95];
-
-
- var noIcons = ['building', 'landuse', 'natural'];
- function blacklisted(preset) {
- return _.some(noIcons, function(s) {
- return preset.id.indexOf(s) >= 0;
- });
+ if (_isMulti && field.key && /[^:]$/.test(field.key)) {
+ field.key += ":";
}
-
- function get(array, prop) {
- return function(d, i) { return array[i][prop]; };
+ function snake(s) {
+ return s.replace(/\s+/g, "_").toLowerCase();
}
-
- var textWidthCache = {};
-
- function textWidth(text, size, elem) {
- var c = textWidthCache[size];
- if (!c) c = textWidthCache[size] = {};
-
- if (c[text]) {
- return c[text];
-
- } else if (elem) {
- c[text] = elem.getComputedTextLength();
- return c[text];
-
- } else {
- var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
- if (str === null) {
- return size / 3 * 2 * text.length;
- } else {
- return size / 3 * (2 * text.length + str.length);
- }
- }
+ function clean2(s) {
+ return s.split(";").map(function(s2) {
+ return s2.trim();
+ }).join(";");
}
-
- function drawLineLabels(group, entities, filter, classes, labels) {
- var texts = group.selectAll('text.' + classes)
- .filter(filter)
- .data(entities, iD.Entity.key);
-
- texts.enter()
- .append('text')
- .attr('class', function(d, i) { return classes + ' ' + labels[i].classes + ' ' + d.id; })
- .append('textPath')
- .attr('class', 'textpath');
-
-
- texts.selectAll('.textpath')
- .filter(filter)
- .data(entities, iD.Entity.key)
- .attr({
- 'startOffset': '50%',
- 'xlink:href': function(d) { return '#labelpath-' + d.id; }
- })
- .text(iD.util.displayName);
-
- texts.exit().remove();
+ function tagValue(dval) {
+ dval = clean2(dval || "");
+ var found = _comboData.find(function(o) {
+ return o.key && clean2(o.value) === dval;
+ });
+ if (found)
+ return found.key;
+ if (field.type === "typeCombo" && !dval) {
+ return "yes";
+ }
+ return (_snake_case ? snake(dval) : dval) || void 0;
}
-
- function drawLinePaths(group, entities, filter, classes, labels) {
- var halos = group.selectAll('path')
- .filter(filter)
- .data(entities, iD.Entity.key);
-
- halos.enter()
- .append('path')
- .style('stroke-width', get(labels, 'font-size'))
- .attr('id', function(d) { return 'labelpath-' + d.id; })
- .attr('class', classes);
-
- halos.attr('d', get(labels, 'lineString'));
-
- halos.exit().remove();
+ function displayValue(tval) {
+ tval = tval || "";
+ if (field.hasTextForStringId("options." + tval)) {
+ return field.t("options." + tval, { default: tval });
+ }
+ if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
+ return "";
+ }
+ return tval;
}
-
- function drawPointLabels(group, entities, filter, classes, labels) {
- var texts = group.selectAll('text.' + classes)
- .filter(filter)
- .data(entities, iD.Entity.key);
-
- texts.enter()
- .append('text')
- .attr('class', function(d, i) { return classes + ' ' + labels[i].classes + ' ' + d.id; });
-
- texts.attr('x', get(labels, 'x'))
- .attr('y', get(labels, 'y'))
- .style('text-anchor', get(labels, 'textAnchor'))
- .text(iD.util.displayName)
- .each(function(d, i) { textWidth(iD.util.displayName(d), labels[i].height, this); });
-
- texts.exit().remove();
- return texts;
+ function objectDifference(a, b) {
+ return a.filter(function(d1) {
+ return !b.some(function(d2) {
+ return !d2.isMixed && d1.value === d2.value;
+ });
+ });
}
-
- function drawAreaLabels(group, entities, filter, classes, labels) {
- entities = entities.filter(hasText);
- labels = labels.filter(hasText);
- return drawPointLabels(group, entities, filter, classes, labels);
-
- function hasText(d, i) {
- return labels[i].hasOwnProperty('x') && labels[i].hasOwnProperty('y');
- }
+ function initCombo(selection2, attachTo) {
+ if (!_allowCustomValues) {
+ selection2.attr("readonly", "readonly");
+ }
+ if (_showTagInfoSuggestions && services.taginfo) {
+ selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
+ setTaginfoValues("", setPlaceholder);
+ } else {
+ selection2.call(_combobox, attachTo);
+ setStaticValues(setPlaceholder);
+ }
}
-
- function drawAreaIcons(group, entities, filter, classes, labels) {
- var icons = group.selectAll('use')
- .filter(filter)
- .data(entities, iD.Entity.key);
-
- icons.enter()
- .append('use')
- .attr('class', 'icon areaicon')
- .attr('width', '18px')
- .attr('height', '18px');
-
- icons.attr('transform', get(labels, 'transform'))
- .attr('xlink:href', function(d) {
- var icon = context.presets().match(d, context.graph()).icon;
- return '#' + icon + (icon === 'hairdresser' ? '-24': '-18'); // workaround: maki hairdresser-18 broken?
- });
-
-
- icons.exit().remove();
+ function setStaticValues(callback) {
+ if (!_optarray)
+ return;
+ _comboData = _optarray.map(function(v) {
+ return {
+ key: v,
+ value: field.t("options." + v, { default: v }),
+ title: v,
+ display: field.t.html("options." + v, { default: v }),
+ klass: field.hasTextForStringId("options." + v) ? "" : "raw-option"
+ };
+ });
+ _combobox.data(objectDifference(_comboData, _multiData));
+ if (callback)
+ callback(_comboData);
}
-
- function reverse(p) {
- var angle = Math.atan2(p[1][1] - p[0][1], p[1][0] - p[0][0]);
- return !(p[0][0] < p[p.length - 1][0] && angle < Math.PI/2 && angle > -Math.PI/2);
+ function setTaginfoValues(q, callback) {
+ var fn = _isMulti ? "multikeys" : "values";
+ var query = (_isMulti ? field.key : "") + q;
+ var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q.toLowerCase()) === 0;
+ if (hasCountryPrefix) {
+ query = _countryCode + ":";
+ }
+ var params = {
+ debounce: q !== "",
+ key: field.key,
+ query
+ };
+ if (_entityIDs.length) {
+ params.geometry = context.graph().geometry(_entityIDs[0]);
+ }
+ services.taginfo[fn](params, function(err, data) {
+ if (err)
+ return;
+ data = data.filter(function(d) {
+ if (field.type === "typeCombo" && d.value === "yes") {
+ return false;
+ }
+ return !d.count || d.count > 10;
+ });
+ var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
+ if (deprecatedValues) {
+ data = data.filter(function(d) {
+ return deprecatedValues.indexOf(d.value) === -1;
+ });
+ }
+ if (hasCountryPrefix) {
+ data = data.filter(function(d) {
+ return d.value.toLowerCase().indexOf(_countryCode + ":") === 0;
+ });
+ }
+ _container.classed("empty-combobox", data.length === 0);
+ _comboData = data.map(function(d) {
+ var k = d.value;
+ if (_isMulti)
+ k = k.replace(field.key, "");
+ var label = field.t("options." + k, { default: k });
+ return {
+ key: k,
+ value: label,
+ display: field.t.html("options." + k, { default: k }),
+ title: d.title || label,
+ klass: field.hasTextForStringId("options." + k) ? "" : "raw-option"
+ };
+ });
+ _comboData = objectDifference(_comboData, _multiData);
+ if (callback)
+ callback(_comboData);
+ });
}
-
- function lineString(nodes) {
- return 'M' + nodes.join('L');
+ function setPlaceholder(values) {
+ if (_isMulti || _isSemi) {
+ _staticPlaceholder = field.placeholder() || _t("inspector.add");
+ } else {
+ var vals = values.map(function(d) {
+ return d.value;
+ }).filter(function(s) {
+ return s.length < 20;
+ });
+ var placeholders = vals.length > 1 ? vals : values.map(function(d) {
+ return d.key;
+ });
+ _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
+ }
+ if (!/(â¦|\.\.\.)$/.test(_staticPlaceholder)) {
+ _staticPlaceholder += "\u2026";
+ }
+ var ph;
+ if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
+ ph = _t("inspector.multiple_values");
+ } else {
+ ph = _staticPlaceholder;
+ }
+ _container.selectAll("input").attr("placeholder", ph);
}
-
- function subpath(nodes, from, to) {
- function segmentLength(i) {
- var dx = nodes[i][0] - nodes[i + 1][0];
- var dy = nodes[i][1] - nodes[i + 1][1];
- return Math.sqrt(dx * dx + dy * dy);
- }
-
- var sofar = 0,
- start, end, i0, i1;
- for (var i = 0; i < nodes.length - 1; i++) {
- var current = segmentLength(i);
- var portion;
- if (!start && sofar + current >= from) {
- portion = (from - sofar) / current;
- start = [
- nodes[i][0] + portion * (nodes[i + 1][0] - nodes[i][0]),
- nodes[i][1] + portion * (nodes[i + 1][1] - nodes[i][1])
- ];
- i0 = i + 1;
- }
- if (!end && sofar + current >= to) {
- portion = (to - sofar) / current;
- end = [
- nodes[i][0] + portion * (nodes[i + 1][0] - nodes[i][0]),
- nodes[i][1] + portion * (nodes[i + 1][1] - nodes[i][1])
- ];
- i1 = i + 1;
+ function change() {
+ var t = {};
+ var val;
+ if (_isMulti || _isSemi) {
+ val = tagValue(utilGetSetValue(_input).replace(/,/g, ";")) || "";
+ _container.classed("active", false);
+ utilGetSetValue(_input, "");
+ var vals = val.split(";").filter(Boolean);
+ if (!vals.length)
+ return;
+ if (_isMulti) {
+ utilArrayUniq(vals).forEach(function(v) {
+ var key = (field.key || "") + v;
+ if (_tags) {
+ var old = _tags[key];
+ if (typeof old === "string" && old.toLowerCase() !== "no")
+ return;
}
- sofar += current;
-
+ key = context.cleanTagKey(key);
+ field.keys.push(key);
+ t[key] = "yes";
+ });
+ } else if (_isSemi) {
+ var arr = _multiData.map(function(d) {
+ return d.key;
+ });
+ arr = arr.concat(vals);
+ t[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
}
- var ret = nodes.slice(i0, i1);
- ret.unshift(start);
- ret.push(end);
- return ret;
-
- }
-
- function hideOnMouseover() {
- var layers = d3.select(this)
- .selectAll('.layer-label, .layer-halo');
-
- layers.selectAll('.proximate')
- .classed('proximate', false);
-
- var mouse = context.mouse(),
- pad = 50,
- rect = [mouse[0] - pad, mouse[1] - pad, mouse[0] + pad, mouse[1] + pad],
- ids = _.map(rtree.search(rect), 'id');
-
- if (!ids.length) return;
- layers.selectAll('.' + ids.join(', .'))
- .classed('proximate', true);
+ window.setTimeout(function() {
+ _input.node().focus();
+ }, 10);
+ } else {
+ var rawValue = utilGetSetValue(_input);
+ if (!rawValue && Array.isArray(_tags[field.key]))
+ return;
+ val = context.cleanTagValue(tagValue(rawValue));
+ t[field.key] = val || void 0;
+ }
+ dispatch10.call("change", this, t);
+ }
+ function removeMultikey(d3_event, d) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var t = {};
+ if (_isMulti) {
+ t[d.key] = void 0;
+ } else if (_isSemi) {
+ var arr = _multiData.map(function(md) {
+ return md.key === d.key ? null : md.key;
+ }).filter(Boolean);
+ arr = utilArrayUniq(arr);
+ t[field.key] = arr.length ? arr.join(";") : void 0;
+ }
+ dispatch10.call("change", this, t);
+ }
+ function combo(selection2) {
+ _container = selection2.selectAll(".form-field-input-wrap").data([0]);
+ var type3 = _isMulti || _isSemi ? "multicombo" : "combo";
+ _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type3).merge(_container);
+ if (_isMulti || _isSemi) {
+ _container = _container.selectAll(".chiplist").data([0]);
+ var listClass = "chiplist";
+ if (field.key === "destination" || field.key === "via") {
+ listClass += " full-line-chips";
+ }
+ _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
+ window.setTimeout(function() {
+ _input.node().focus();
+ }, 10);
+ }).merge(_container);
+ _inputWrap = _container.selectAll(".input-wrap").data([0]);
+ _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
+ _input = _inputWrap.selectAll("input").data([0]);
+ } else {
+ _input = _container.selectAll("input").data([0]);
+ }
+ _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, selection2).merge(_input);
+ if (_isNetwork) {
+ var extent = combinedEntityExtent();
+ var countryCode = extent && iso1A2Code(extent.center());
+ _countryCode = countryCode && countryCode.toLowerCase();
+ }
+ _input.on("change", change).on("blur", change);
+ _input.on("keydown.field", function(d3_event) {
+ switch (d3_event.keyCode) {
+ case 13:
+ _input.node().blur();
+ d3_event.stopPropagation();
+ break;
+ }
+ });
+ if (_isMulti || _isSemi) {
+ _combobox.on("accept", function() {
+ _input.node().blur();
+ _input.node().focus();
+ });
+ _input.on("focus", function() {
+ _container.classed("active", true);
+ });
+ }
}
-
- var rtree = rbush(),
- rectangles = {};
-
- function drawLabels(surface, graph, entities, filter, dimensions, fullRedraw) {
- var hidePoints = !surface.selectAll('.node.point').node();
-
- var labelable = [], i, k, entity;
- for (i = 0; i < label_stack.length; i++) labelable.push([]);
-
- if (fullRedraw) {
- rtree.clear();
- rectangles = {};
- } else {
- for (i = 0; i < entities.length; i++) {
- rtree.remove(rectangles[entities[i].id]);
- }
+ combo.tags = function(tags) {
+ _tags = tags;
+ if (_isMulti || _isSemi) {
+ _multiData = [];
+ var maxLength;
+ if (_isMulti) {
+ for (var k in tags) {
+ if (field.key && k.indexOf(field.key) !== 0)
+ continue;
+ if (!field.key && field.keys.indexOf(k) === -1)
+ continue;
+ var v = tags[k];
+ if (!v || typeof v === "string" && v.toLowerCase() === "no")
+ continue;
+ var suffix = field.key ? k.substr(field.key.length) : k;
+ _multiData.push({
+ key: k,
+ value: displayValue(suffix),
+ isMixed: Array.isArray(v)
+ });
+ }
+ if (field.key) {
+ field.keys = _multiData.map(function(d) {
+ return d.key;
+ });
+ maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
+ } else {
+ maxLength = context.maxCharsForTagKey();
+ }
+ } else if (_isSemi) {
+ var allValues = [];
+ var commonValues;
+ if (Array.isArray(tags[field.key])) {
+ tags[field.key].forEach(function(tagVal) {
+ var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
+ allValues = allValues.concat(thisVals);
+ if (!commonValues) {
+ commonValues = thisVals;
+ } else {
+ commonValues = commonValues.filter((value) => thisVals.includes(value));
+ }
+ });
+ allValues = utilArrayUniq(allValues).filter(Boolean);
+ } else {
+ allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
+ commonValues = allValues;
+ }
+ _multiData = allValues.map(function(v2) {
+ return {
+ key: v2,
+ value: displayValue(v2),
+ isMixed: !commonValues.includes(v2)
+ };
+ });
+ var currLength = utilUnicodeCharsCount(commonValues.join(";"));
+ maxLength = context.maxCharsForTagValue() - currLength;
+ if (currLength > 0) {
+ maxLength -= 1;
+ }
}
-
- // Split entities into groups specified by label_stack
- for (i = 0; i < entities.length; i++) {
- entity = entities[i];
- var geometry = entity.geometry(graph);
-
- if (geometry === 'vertex')
- continue;
- if (hidePoints && geometry === 'point')
- continue;
-
- var preset = geometry === 'area' && context.presets().match(entity, graph),
- icon = preset && !blacklisted(preset) && preset.icon;
-
- if (!icon && !iD.util.displayName(entity))
- continue;
-
- for (k = 0; k < label_stack.length; k++) {
- if (geometry === label_stack[k][0] && entity.tags[label_stack[k][1]]) {
- labelable[k].push(entity);
- break;
- }
- }
+ maxLength = Math.max(0, maxLength);
+ var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
+ var available = objectDifference(_comboData, _multiData);
+ _combobox.data(available);
+ var hideAdd = !_allowCustomValues && !available.length || maxLength <= 0;
+ _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
+ var chips = _container.selectAll(".chip").data(_multiData);
+ chips.exit().remove();
+ var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
+ enter.append("span");
+ enter.append("a");
+ chips = chips.merge(enter).order().classed("raw-value", function(d) {
+ var k2 = d.key;
+ if (_isMulti)
+ k2 = k2.replace(field.key, "");
+ return !field.hasTextForStringId("options." + k2);
+ }).classed("draggable", allowDragAndDrop).classed("mixed", function(d) {
+ return d.isMixed;
+ }).attr("title", function(d) {
+ return d.isMixed ? _t("inspector.unshared_value_tooltip") : null;
+ });
+ if (allowDragAndDrop) {
+ registerDragAndDrop(chips);
}
-
- var positions = {
- point: [],
- line: [],
- area: []
- };
-
- var labelled = {
- point: [],
- line: [],
- area: []
+ chips.select("span").text(function(d) {
+ return d.value;
+ });
+ chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
+ } else {
+ var isMixed = Array.isArray(tags[field.key]);
+ var mixedValues = isMixed && tags[field.key].map(function(val) {
+ return displayValue(val);
+ }).filter(Boolean);
+ var showsValue = !isMixed && tags[field.key] && !(field.type === "typeCombo" && tags[field.key] === "yes");
+ var isRawValue = showsValue && !field.hasTextForStringId("options." + tags[field.key]);
+ var isKnownValue = showsValue && !isRawValue;
+ var isReadOnly = !_allowCustomValues || isKnownValue;
+ utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
+ if (isReadOnly && isKnownValue && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var t = {};
+ t[field.key] = void 0;
+ dispatch10.call("change", this, t);
+ }
+ });
+ }
+ };
+ function registerDragAndDrop(selection2) {
+ var dragOrigin, targetIndex;
+ selection2.call(drag_default().on("start", function(d3_event) {
+ dragOrigin = {
+ x: d3_event.x,
+ y: d3_event.y
};
-
- // Try and find a valid label for labellable entities
- for (k = 0; k < labelable.length; k++) {
- var font_size = font_sizes[k];
- for (i = 0; i < labelable[k].length; i++) {
- entity = labelable[k][i];
- var name = iD.util.displayName(entity),
- width = name && textWidth(name, font_size),
- p;
- if (entity.geometry(graph) === 'point') {
- p = getPointLabel(entity, width, font_size);
- } else if (entity.geometry(graph) === 'line') {
- p = getLineLabel(entity, width, font_size);
- } else if (entity.geometry(graph) === 'area') {
- p = getAreaLabel(entity, width, font_size);
- }
- if (p) {
- p.classes = entity.geometry(graph) + ' tag-' + label_stack[k][1];
- positions[entity.geometry(graph)].push(p);
- labelled[entity.geometry(graph)].push(entity);
- }
+ targetIndex = null;
+ }).on("drag", function(d3_event) {
+ var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
+ if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
+ return;
+ var index = selection2.nodes().indexOf(this);
+ select_default2(this).classed("dragging", true);
+ targetIndex = null;
+ var targetIndexOffsetTop = null;
+ var draggedTagWidth = select_default2(this).node().offsetWidth;
+ if (field.key === "destination" || field.key === "via") {
+ _container.selectAll(".chip").style("transform", function(d2, index2) {
+ var node = select_default2(this).node();
+ if (index === index2) {
+ return "translate(" + x + "px, " + y + "px)";
+ } else if (index2 > index && d3_event.y > node.offsetTop) {
+ if (targetIndex === null || index2 > targetIndex) {
+ targetIndex = index2;
+ }
+ return "translateY(-100%)";
+ } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
+ if (targetIndex === null || index2 < targetIndex) {
+ targetIndex = index2;
+ }
+ return "translateY(100%)";
}
- }
-
- function getPointLabel(entity, width, height) {
- var coord = projection(entity.loc),
- m = 5, // margin
- offset = pointOffsets[0],
- p = {
- height: height,
- width: width,
- x: coord[0] + offset[0],
- y: coord[1] + offset[1],
- textAnchor: offset[2]
- };
- var rect = [p.x - m, p.y - m, p.x + width + m, p.y + height + m];
- if (tryInsert(rect, entity.id)) return p;
- }
-
-
- function getLineLabel(entity, width, height) {
- var nodes = _.map(graph.childNodes(entity), 'loc').map(projection),
- length = iD.geo.pathLength(nodes);
- if (length < width + 20) return;
-
- for (var i = 0; i < lineOffsets.length; i++) {
- var offset = lineOffsets[i],
- middle = offset / 100 * length,
- start = middle - width/2;
- if (start < 0 || start + width > length) continue;
- var sub = subpath(nodes, start, start + width),
- rev = reverse(sub),
- rect = [
- Math.min(sub[0][0], sub[sub.length - 1][0]) - 10,
- Math.min(sub[0][1], sub[sub.length - 1][1]) - 10,
- Math.max(sub[0][0], sub[sub.length - 1][0]) + 20,
- Math.max(sub[0][1], sub[sub.length - 1][1]) + 30
- ];
- if (rev) sub = sub.reverse();
- if (tryInsert(rect, entity.id)) return {
- 'font-size': height + 2,
- lineString: lineString(sub),
- startOffset: offset + '%'
- };
+ return null;
+ });
+ } else {
+ _container.selectAll(".chip").each(function(d2, index2) {
+ var node = select_default2(this).node();
+ if (index !== index2 && d3_event.x < node.offsetLeft + node.offsetWidth + 5 && d3_event.x > node.offsetLeft && d3_event.y < node.offsetTop + node.offsetHeight && d3_event.y > node.offsetTop) {
+ targetIndex = index2;
+ targetIndexOffsetTop = node.offsetTop;
}
- }
-
- function getAreaLabel(entity, width, height) {
- var centroid = path.centroid(entity.asGeoJSON(graph, true)),
- extent = entity.extent(graph),
- entitywidth = projection(extent[1])[0] - projection(extent[0])[0],
- rect;
-
- if (isNaN(centroid[0]) || entitywidth < 20) return;
-
- var iconX = centroid[0] - (iconSize/2),
- iconY = centroid[1] - (iconSize/2),
- textOffset = iconSize + 5;
-
- var p = {
- transform: 'translate(' + iconX + ',' + iconY + ')'
- };
-
- if (width && entitywidth >= width + 20) {
- p.x = centroid[0];
- p.y = centroid[1] + textOffset;
- p.textAnchor = 'middle';
- p.height = height;
- rect = [p.x - width/2, p.y, p.x + width/2, p.y + height + textOffset];
- } else {
- rect = [iconX, iconY, iconX + iconSize, iconY + iconSize];
+ }).style("transform", function(d2, index2) {
+ var node = select_default2(this).node();
+ if (index === index2) {
+ return "translate(" + x + "px, " + y + "px)";
}
-
- if (tryInsert(rect, entity.id)) return p;
-
- }
-
- function tryInsert(rect, id) {
- // Check that label is visible
- if (rect[0] < 0 || rect[1] < 0 || rect[2] > dimensions[0] ||
- rect[3] > dimensions[1]) return false;
- var v = rtree.search(rect).length === 0;
- if (v) {
- rect.id = id;
- rtree.insert(rect);
- rectangles[id] = rect;
- }
- return v;
- }
-
- var label = surface.selectAll('.layer-label'),
- halo = surface.selectAll('.layer-halo');
-
- // points
- drawPointLabels(label, labelled.point, filter, 'pointlabel', positions.point);
- drawPointLabels(halo, labelled.point, filter, 'pointlabel-halo', positions.point);
-
- // lines
- drawLinePaths(halo, labelled.line, filter, '', positions.line);
- drawLineLabels(label, labelled.line, filter, 'linelabel', positions.line);
- drawLineLabels(halo, labelled.line, filter, 'linelabel-halo', positions.line);
-
- // areas
- drawAreaLabels(label, labelled.area, filter, 'arealabel', positions.area);
- drawAreaLabels(halo, labelled.area, filter, 'arealabel-halo', positions.area);
- drawAreaIcons(label, labelled.area, filter, 'arealabel-icon', positions.area);
-
- // debug
- var showDebug = context.debugCollision();
- var debug = label.selectAll('.layer-label-debug')
- .data(showDebug ? [true] : []);
-
- debug.enter()
- .append('g')
- .attr('class', 'layer-label-debug');
-
- debug.exit()
- .remove();
-
- if (showDebug) {
- var gj = rtree.all().map(function(d) {
- return { type: 'Polygon', coordinates: [[
- [d[0], d[1]],
- [d[2], d[1]],
- [d[2], d[3]],
- [d[0], d[3]],
- [d[0], d[1]]
- ]]};
- });
-
- var debugboxes = debug.selectAll('.bbox').data(gj);
-
- debugboxes.enter()
- .append('path')
- .attr('class', 'bbox');
-
- debugboxes.exit()
- .remove();
-
- debugboxes
- .attr('d', d3.geo.path().projection(null));
+ if (node.offsetTop === targetIndexOffsetTop) {
+ if (index2 < index && index2 >= targetIndex) {
+ return "translateX(" + draggedTagWidth + "px)";
+ } else if (index2 > index && index2 <= targetIndex) {
+ return "translateX(-" + draggedTagWidth + "px)";
+ }
+ }
+ return null;
+ });
+ }
+ }).on("end", function() {
+ if (!select_default2(this).classed("dragging")) {
+ return;
+ }
+ var index = selection2.nodes().indexOf(this);
+ select_default2(this).classed("dragging", false);
+ _container.selectAll(".chip").style("transform", null);
+ if (typeof targetIndex === "number") {
+ var element = _multiData[index];
+ _multiData.splice(index, 1);
+ _multiData.splice(targetIndex, 0, element);
+ var t = {};
+ if (_multiData.length) {
+ t[field.key] = _multiData.map(function(element2) {
+ return element2.key;
+ }).join(";");
+ } else {
+ t[field.key] = void 0;
+ }
+ dispatch10.call("change", this, t);
}
+ dragOrigin = void 0;
+ targetIndex = void 0;
+ }));
}
-
- drawLabels.supersurface = function(supersurface) {
- supersurface
- .on('mousemove.hidelabels', hideOnMouseover)
- .on('mousedown.hidelabels', function () {
- supersurface.on('mousemove.hidelabels', null);
- })
- .on('mouseup.hidelabels', function () {
- supersurface.on('mousemove.hidelabels', hideOnMouseover);
- });
- };
-
- return drawLabels;
-};
-iD.svg.Layers = function(projection, context) {
- var dispatch = d3.dispatch('change'),
- svg = d3.select(null),
- layers = [
- { id: 'osm', layer: iD.svg.Osm(projection, context, dispatch) },
- { id: 'gpx', layer: iD.svg.Gpx(projection, context, dispatch) },
- { id: 'mapillary-images', layer: iD.svg.MapillaryImages(projection, context, dispatch) },
- { id: 'mapillary-signs', layer: iD.svg.MapillarySigns(projection, context, dispatch) }
- ];
-
-
- function drawLayers(selection) {
- svg = selection.selectAll('.surface')
- .data([0]);
-
- svg.enter()
- .append('svg')
- .attr('class', 'surface')
- .append('defs');
-
- var groups = svg.selectAll('.data-layer')
- .data(layers);
-
- groups.enter()
- .append('g')
- .attr('class', function(d) { return 'data-layer data-layer-' + d.id; });
-
- groups
- .each(function(d) { d3.select(this).call(d.layer); });
-
- groups.exit()
- .remove();
- }
-
- drawLayers.all = function() {
- return layers;
- };
-
- drawLayers.layer = function(id) {
- var obj = _.find(layers, function(o) {return o.id === id;});
- return obj && obj.layer;
- };
-
- drawLayers.only = function(what) {
- var arr = [].concat(what);
- drawLayers.remove(_.difference(_.map(layers, 'id'), arr));
- return this;
- };
-
- drawLayers.remove = function(what) {
- var arr = [].concat(what);
- arr.forEach(function(id) {
- layers = _.reject(layers, function(o) {return o.id === id;});
- });
- dispatch.change();
- return this;
+ combo.focus = function() {
+ _input.node().focus();
};
-
- drawLayers.add = function(what) {
- var arr = [].concat(what);
- arr.forEach(function(obj) {
- if ('id' in obj && 'layer' in obj) {
- layers.push(obj);
- }
- });
- dispatch.change();
- return this;
+ combo.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return combo;
};
+ function combinedEntityExtent() {
+ return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
+ }
+ return utilRebind(combo, dispatch10, "on");
+ }
- drawLayers.dimensions = function(_) {
- if (!arguments.length) return svg.dimensions();
- svg.dimensions(_);
- layers.forEach(function(obj) {
- if (obj.layer.dimensions) {
- obj.layer.dimensions(_);
- }
+ // modules/ui/fields/input.js
+ function uiFieldText(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var input = select_default2(null);
+ var outlinkButton = select_default2(null);
+ var wrap2 = select_default2(null);
+ var _entityIDs = [];
+ var _tags;
+ var _phoneFormats = {};
+ if (field.type === "tel") {
+ _mainFileFetcher.get("phone_formats").then(function(d) {
+ _phoneFormats = d;
+ updatePhonePlaceholder();
+ }).catch(function() {
+ });
+ }
+ function calcLocked() {
+ var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
+ var entity = context.graph().hasEntity(entityID);
+ if (!entity)
+ return false;
+ if (entity.tags.wikidata)
+ return true;
+ var preset = _mainPresetIndex.match(entity, context.graph());
+ var isSuggestion = preset && preset.suggestion;
+ var which = field.id;
+ return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
+ });
+ field.locked(isLocked);
+ }
+ function i2(selection2) {
+ calcLocked();
+ var isLocked = field.locked();
+ wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ input = wrap2.selectAll("input").data([0]);
+ input = input.enter().append("input").attr("type", field.type === "identifier" ? "text" : field.type).attr("id", field.domId).classed(field.type, true).call(utilNoAuto).merge(input);
+ input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
+ if (field.type === "tel") {
+ updatePhonePlaceholder();
+ } else if (field.type === "number") {
+ var rtl = _mainLocalizer.textDirection() === "rtl";
+ input.attr("type", "text");
+ var inc = field.increment;
+ var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
+ buttons.enter().append("button").attr("class", function(d) {
+ var which = d > 0 ? "increment" : "decrement";
+ return "form-field-button " + which;
+ }).attr("title", function(d) {
+ var which = d > 0 ? "increment" : "decrement";
+ return _t(`inspector.${which}`);
+ }).merge(buttons).on("click", function(d3_event, d) {
+ d3_event.preventDefault();
+ var raw_vals = input.node().value || "0";
+ var vals = raw_vals.split(";");
+ vals = vals.map(function(v) {
+ var num = parseFloat(v.trim(), 10);
+ return isFinite(num) ? clamped(num + d) : v.trim();
+ });
+ input.node().value = vals.join(";");
+ change()();
});
- return this;
- };
-
-
- return d3.rebind(drawLayers, dispatch, 'on');
-};
-iD.svg.Lines = function(projection) {
-
- var highway_stack = {
- motorway: 0,
- motorway_link: 1,
- trunk: 2,
- trunk_link: 3,
- primary: 4,
- primary_link: 5,
- secondary: 6,
- tertiary: 7,
- unclassified: 8,
- residential: 9,
- service: 10,
- footway: 11
- };
-
- function waystack(a, b) {
- var as = 0, bs = 0;
-
- if (a.tags.highway) { as -= highway_stack[a.tags.highway]; }
- if (b.tags.highway) { bs -= highway_stack[b.tags.highway]; }
- return as - bs;
+ } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
+ input.attr("type", "text");
+ outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
+ outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
+ var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
+ if (domainResults.length >= 2 && domainResults[1]) {
+ var domain2 = domainResults[1];
+ return _t("icons.view_on", { domain: domain2 });
+ }
+ return "";
+ }).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ var value = validIdentifierValueForLink();
+ if (value) {
+ var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
+ window.open(url, "_blank");
+ }
+ }).merge(outlinkButton);
+ } else if (field.type === "url") {
+ input.attr("type", "text");
+ outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
+ outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ const value = validIdentifierValueForLink();
+ if (value)
+ window.open(value, "_blank");
+ }).merge(outlinkButton);
+ } else if (field.key.split(":").includes("colour")) {
+ input.attr("type", "text");
+ updateColourPreview();
+ }
}
-
- return function drawLines(surface, graph, entities, filter) {
- var ways = [], pathdata = {}, onewaydata = {},
- getPath = iD.svg.Path(projection, graph);
-
- for (var i = 0; i < entities.length; i++) {
- var entity = entities[i],
- outer = iD.geo.simpleMultipolygonOuterMember(entity, graph);
- if (outer) {
- ways.push(entity.mergeTags(outer.tags));
- } else if (entity.geometry(graph) === 'line') {
- ways.push(entity);
- }
+ function isColourValid(colour) {
+ if (!colour.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
+ return false;
+ } else if (!CSS.supports("color", colour) || ["unset", "inherit", "initial", "revert"].includes(colour)) {
+ return false;
+ }
+ return true;
+ }
+ function updateColourPreview() {
+ wrap2.selectAll(".colour-preview").remove();
+ const colour = utilGetSetValue(input);
+ if (!isColourValid(colour) && colour !== "")
+ return;
+ var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
+ outlinkButton = wrap2.selectAll(".colour-preview").data([colour]);
+ colourSelector.enter().append("input").attr("type", "color").attr("class", "form-field-button colour-selector").attr("value", colour).on("input", debounce_default(function(d3_event) {
+ d3_event.preventDefault();
+ var colour2 = this.value;
+ if (!isColourValid(colour2))
+ return;
+ utilGetSetValue(input, this.value);
+ change()();
+ updateColourPreview();
+ }, 100));
+ outlinkButton = outlinkButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d) => d).attr("class", "colour-box");
+ if (colour === "") {
+ outlinkButton = outlinkButton.call(svgIcon("#iD-icon-edit"));
+ }
+ outlinkButton.on("click", () => wrap2.select(".colour-selector").node().click()).merge(outlinkButton);
+ }
+ function updatePhonePlaceholder() {
+ if (input.empty() || !Object.keys(_phoneFormats).length)
+ return;
+ var extent = combinedEntityExtent();
+ var countryCode = extent && iso1A2Code(extent.center());
+ var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
+ if (format2)
+ input.attr("placeholder", format2);
+ }
+ function validIdentifierValueForLink() {
+ const value = utilGetSetValue(input).trim();
+ if (field.type === "url" && value) {
+ try {
+ return new URL(value).href;
+ } catch (e) {
+ return null;
}
-
- ways = ways.filter(getPath);
-
- pathdata = _.groupBy(ways, function(way) { return way.layer(); });
-
- _.forOwn(pathdata, function(v, k) {
- onewaydata[k] = _(v)
- .filter(function(d) { return d.isOneWay(); })
- .map(iD.svg.OneWaySegments(projection, graph, 35))
- .flatten()
- .valueOf();
- });
-
- var layergroup = surface
- .selectAll('.layer-lines')
- .selectAll('g.layergroup')
- .data(d3.range(-10, 11));
-
- layergroup.enter()
- .append('g')
- .attr('class', function(d) { return 'layer layergroup layer' + String(d); });
-
-
- var linegroup = layergroup
- .selectAll('g.linegroup')
- .data(['shadow', 'casing', 'stroke']);
-
- linegroup.enter()
- .append('g')
- .attr('class', function(d) { return 'layer linegroup line-' + d; });
-
-
- var lines = linegroup
- .selectAll('path')
- .filter(filter)
- .data(
- function() { return pathdata[this.parentNode.parentNode.__data__] || []; },
- iD.Entity.key
- );
-
- // Optimization: call simple TagClasses only on enter selection. This
- // works because iD.Entity.key is defined to include the entity v attribute.
- lines.enter()
- .append('path')
- .attr('class', function(d) { return 'way line ' + this.parentNode.__data__ + ' ' + d.id; })
- .call(iD.svg.TagClasses());
-
- lines
- .sort(waystack)
- .attr('d', getPath)
- .call(iD.svg.TagClasses().tags(iD.svg.RelationMemberTags(graph)));
-
- lines.exit()
- .remove();
-
-
- var onewaygroup = layergroup
- .selectAll('g.onewaygroup')
- .data(['oneway']);
-
- onewaygroup.enter()
- .append('g')
- .attr('class', 'layer onewaygroup');
-
-
- var oneways = onewaygroup
- .selectAll('path')
- .filter(filter)
- .data(
- function() { return onewaydata[this.parentNode.parentNode.__data__] || []; },
- function(d) { return [d.id, d.index]; }
- );
-
- oneways.enter()
- .append('path')
- .attr('class', 'oneway')
- .attr('marker-mid', 'url(#oneway-marker)');
-
- oneways
- .attr('d', function(d) { return d.d; });
-
- if (iD.detect().ie) {
- oneways.each(function() { this.parentNode.insertBefore(this, this); });
+ }
+ if (field.type === "identifier" && field.pattern) {
+ return value && value.match(new RegExp(field.pattern))[0];
+ }
+ return null;
+ }
+ function clamped(num) {
+ if (field.minValue !== void 0) {
+ num = Math.max(num, field.minValue);
+ }
+ if (field.maxValue !== void 0) {
+ num = Math.min(num, field.maxValue);
+ }
+ return num;
+ }
+ function change(onInput) {
+ return function() {
+ var t = {};
+ var val = utilGetSetValue(input);
+ if (!onInput)
+ val = context.cleanTagValue(val);
+ if (!val && Array.isArray(_tags[field.key]))
+ return;
+ if (!onInput) {
+ if (field.type === "number" && val) {
+ var vals = val.split(";");
+ vals = vals.map(function(v) {
+ var num = parseFloat(v.trim(), 10);
+ return isFinite(num) ? clamped(num) : v.trim();
+ });
+ val = vals.join(";");
+ }
+ utilGetSetValue(input, val);
}
-
- oneways.exit()
- .remove();
-
+ t[field.key] = val || void 0;
+ dispatch10.call("change", this, t, onInput);
+ };
+ }
+ i2.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return i2;
+ };
+ i2.tags = function(tags) {
+ _tags = tags;
+ var isMixed = Array.isArray(tags[field.key]);
+ utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
+ if (field.key.split(":").includes("colour"))
+ updateColourPreview();
+ if (outlinkButton && !outlinkButton.empty()) {
+ var disabled = !validIdentifierValueForLink();
+ outlinkButton.classed("disabled", disabled);
+ }
};
-};
-iD.svg.MapillaryImages = function(projection, context, dispatch) {
- var debouncedRedraw = _.debounce(function () { dispatch.change(); }, 1000),
- minZoom = 12,
- layer = d3.select(null),
- _mapillary;
-
-
- function init() {
- if (iD.svg.MapillaryImages.initialized) return; // run once
- iD.svg.MapillaryImages.enabled = false;
- iD.svg.MapillaryImages.initialized = true;
+ i2.focus = function() {
+ var node = input.node();
+ if (node)
+ node.focus();
+ };
+ function combinedEntityExtent() {
+ return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
}
+ return utilRebind(i2, dispatch10, "on");
+ }
- function getMapillary() {
- if (iD.services.mapillary && !_mapillary) {
- _mapillary = iD.services.mapillary();
- _mapillary.on('loadedImages', debouncedRedraw);
- } else if (!iD.services.mapillary && _mapillary) {
- _mapillary = null;
+ // modules/ui/fields/access.js
+ function uiFieldAccess(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var items = select_default2(null);
+ var _tags;
+ function access(selection2) {
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ var list = wrap2.selectAll("ul").data([0]);
+ list = list.enter().append("ul").attr("class", "rows").merge(list);
+ items = list.selectAll("li").data(field.keys);
+ var enter = items.enter().append("li").attr("class", function(d) {
+ return "labeled-input preset-access-" + d;
+ });
+ enter.append("span").attr("class", "label preset-label-access").attr("for", function(d) {
+ return "preset-input-access-" + d;
+ }).html(function(d) {
+ return field.t.html("types." + d);
+ });
+ enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d) {
+ return "preset-input-access preset-input-access-" + d;
+ }).call(utilNoAuto).each(function(d) {
+ select_default2(this).call(uiCombobox(context, "access-" + d).data(access.options(d)));
+ });
+ items = items.merge(enter);
+ wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
+ }
+ function change(d3_event, d) {
+ var tag = {};
+ var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
+ if (!value && typeof _tags[d] !== "string")
+ return;
+ tag[d] = value || void 0;
+ dispatch10.call("change", this, tag);
+ }
+ access.options = function(type3) {
+ var options2 = [
+ "yes",
+ "no",
+ "designated",
+ "permissive",
+ "destination",
+ "customers",
+ "private",
+ "permit",
+ "unknown"
+ ];
+ if (type3 === "access") {
+ options2 = options2.filter((v) => v !== "yes" && v !== "designated");
+ }
+ if (type3 === "bicycle") {
+ options2.splice(options2.length - 4, 0, "dismount");
+ }
+ return options2.map(function(option) {
+ return {
+ title: field.t("options." + option + ".description"),
+ value: option
+ };
+ });
+ };
+ var placeholdersByHighway = {
+ footway: {
+ foot: "designated",
+ motor_vehicle: "no"
+ },
+ steps: {
+ foot: "yes",
+ motor_vehicle: "no",
+ bicycle: "no",
+ horse: "no"
+ },
+ pedestrian: {
+ foot: "yes",
+ motor_vehicle: "no"
+ },
+ cycleway: {
+ motor_vehicle: "no",
+ bicycle: "designated"
+ },
+ bridleway: {
+ motor_vehicle: "no",
+ horse: "designated"
+ },
+ path: {
+ foot: "yes",
+ motor_vehicle: "no",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ motorway: {
+ foot: "no",
+ motor_vehicle: "yes",
+ bicycle: "no",
+ horse: "no"
+ },
+ trunk: {
+ motor_vehicle: "yes"
+ },
+ primary: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ secondary: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ tertiary: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ residential: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ unclassified: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ service: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ motorway_link: {
+ foot: "no",
+ motor_vehicle: "yes",
+ bicycle: "no",
+ horse: "no"
+ },
+ trunk_link: {
+ motor_vehicle: "yes"
+ },
+ primary_link: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ secondary_link: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ tertiary_link: {
+ foot: "yes",
+ motor_vehicle: "yes",
+ bicycle: "yes",
+ horse: "yes"
+ },
+ construction: {
+ access: "no"
+ }
+ };
+ access.tags = function(tags) {
+ _tags = tags;
+ utilGetSetValue(items.selectAll(".preset-input-access"), function(d) {
+ return typeof tags[d] === "string" ? tags[d] : "";
+ }).classed("mixed", function(d) {
+ return tags[d] && Array.isArray(tags[d]);
+ }).attr("title", function(d) {
+ return tags[d] && Array.isArray(tags[d]) && tags[d].filter(Boolean).join("\n");
+ }).attr("placeholder", function(d) {
+ if (tags[d] && Array.isArray(tags[d])) {
+ return _t("inspector.multiple_values");
+ }
+ if (d === "bicycle" || d === "motor_vehicle") {
+ if (tags.vehicle && typeof tags.vehicle === "string") {
+ return tags.vehicle;
+ }
}
-
- return _mapillary;
- }
-
- function showLayer() {
- var mapillary = getMapillary();
- if (!mapillary) return;
-
- mapillary.loadViewer();
- editOn();
-
- layer
- .style('opacity', 0)
- .transition()
- .duration(500)
- .style('opacity', 1)
- .each('end', debouncedRedraw);
- }
-
- function hideLayer() {
- var mapillary = getMapillary();
- if (mapillary) {
- mapillary.hideViewer();
+ if (tags.access && typeof tags.access === "string") {
+ return tags.access;
}
-
- debouncedRedraw.cancel();
-
- layer
- .transition()
- .duration(500)
- .style('opacity', 0)
- .each('end', editOff);
- }
-
- function editOn() {
- layer.style('display', 'block');
- }
-
- function editOff() {
- layer.selectAll('.viewfield-group').remove();
- layer.style('display', 'none');
- }
-
- function click(d) {
- var mapillary = getMapillary();
- if (!mapillary) return;
-
- context.map().centerEase(d.loc);
-
- mapillary
- .setSelectedImage(d.key, true)
- .updateViewer(d.key, context)
- .showViewer();
- }
-
- function transform(d) {
- var t = iD.svg.PointTransform(projection)(d);
- if (d.ca) t += ' rotate(' + Math.floor(d.ca) + ',0,0)';
- return t;
- }
-
- function update() {
- var mapillary = getMapillary(),
- data = (mapillary ? mapillary.images(projection, layer.dimensions()) : []),
- imageKey = mapillary ? mapillary.getSelectedImage() : null;
-
- var markers = layer.selectAll('.viewfield-group')
- .data(data, function(d) { return d.key; });
-
- // Enter
- var enter = markers.enter()
- .append('g')
- .attr('class', 'viewfield-group')
- .classed('selected', function(d) { return d.key === imageKey; })
- .on('click', click);
-
- enter.append('path')
- .attr('class', 'viewfield')
- .attr('transform', 'scale(1.5,1.5),translate(-8, -13)')
- .attr('d', 'M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z');
-
- enter.append('circle')
- .attr('dx', '0')
- .attr('dy', '0')
- .attr('r', '6');
-
- // Exit
- markers.exit()
- .remove();
-
- // Update
- markers
- .attr('transform', transform);
- }
-
- function drawImages(selection) {
- var enabled = iD.svg.MapillaryImages.enabled,
- mapillary = getMapillary();
-
- layer = selection.selectAll('.layer-mapillary-images')
- .data(mapillary ? [0] : []);
-
- layer.enter()
- .append('g')
- .attr('class', 'layer-mapillary-images')
- .style('display', enabled ? 'block' : 'none');
-
- layer.exit()
- .remove();
-
- if (enabled) {
- if (mapillary && ~~context.map().zoom() >= minZoom) {
- editOn();
- update();
- mapillary.loadImages(projection, layer.dimensions());
- } else {
- editOff();
+ if (tags.highway) {
+ if (typeof tags.highway === "string") {
+ if (placeholdersByHighway[tags.highway] && placeholdersByHighway[tags.highway][d]) {
+ return placeholdersByHighway[tags.highway][d];
+ }
+ } else {
+ var impliedAccesses = tags.highway.filter(Boolean).map(function(highwayVal) {
+ return placeholdersByHighway[highwayVal] && placeholdersByHighway[highwayVal][d];
+ }).filter(Boolean);
+ if (impliedAccesses.length === tags.highway.length && new Set(impliedAccesses).size === 1) {
+ return impliedAccesses[0];
}
+ }
}
- }
-
- drawImages.enabled = function(_) {
- if (!arguments.length) return iD.svg.MapillaryImages.enabled;
- iD.svg.MapillaryImages.enabled = _;
- if (iD.svg.MapillaryImages.enabled) {
- showLayer();
- } else {
- hideLayer();
+ if (d === "access") {
+ return "yes";
}
- dispatch.change();
- return this;
- };
-
- drawImages.supported = function() {
- return !!getMapillary();
+ return field.placeholder();
+ });
};
-
- drawImages.dimensions = function(_) {
- if (!arguments.length) return layer.dimensions();
- layer.dimensions(_);
- return this;
+ access.focus = function() {
+ items.selectAll(".preset-input-access").node().focus();
};
+ return utilRebind(access, dispatch10, "on");
+ }
- init();
- return drawImages;
-};
-iD.svg.MapillarySigns = function(projection, context, dispatch) {
- var debouncedRedraw = _.debounce(function () { dispatch.change(); }, 1000),
- minZoom = 12,
- layer = d3.select(null),
- _mapillary;
-
-
- function init() {
- if (iD.svg.MapillarySigns.initialized) return; // run once
- iD.svg.MapillarySigns.enabled = false;
- iD.svg.MapillarySigns.initialized = true;
+ // modules/ui/fields/address.js
+ function uiFieldAddress(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var _selection = select_default2(null);
+ var _wrap = select_default2(null);
+ var addrField = _mainPresetIndex.field("address");
+ var _entityIDs = [];
+ var _tags;
+ var _countryCode;
+ var _addressFormats = [{
+ format: [
+ ["housenumber", "street"],
+ ["city", "postcode"]
+ ]
+ }];
+ _mainFileFetcher.get("address_formats").then(function(d) {
+ _addressFormats = d;
+ if (!_selection.empty()) {
+ _selection.call(address);
+ }
+ }).catch(function() {
+ });
+ function getNearStreets() {
+ var extent = combinedEntityExtent();
+ var l = extent.center();
+ var box = geoExtent(l).padByMeters(200);
+ var streets = context.history().intersects(box).filter(isAddressable).map(function(d) {
+ var loc = context.projection([
+ (extent[0][0] + extent[1][0]) / 2,
+ (extent[0][1] + extent[1][1]) / 2
+ ]);
+ var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
+ return {
+ title: d.tags.name,
+ value: d.tags.name,
+ dist: choice.distance
+ };
+ }).sort(function(a, b) {
+ return a.dist - b.dist;
+ });
+ return utilArrayUniqBy(streets, "value");
+ function isAddressable(d) {
+ return d.tags.highway && d.tags.name && d.type === "way";
+ }
}
-
- function getMapillary() {
- if (iD.services.mapillary && !_mapillary) {
- _mapillary = iD.services.mapillary().on('loadedSigns', debouncedRedraw);
- } else if (!iD.services.mapillary && _mapillary) {
- _mapillary = null;
+ function getNearCities() {
+ var extent = combinedEntityExtent();
+ var l = extent.center();
+ var box = geoExtent(l).padByMeters(200);
+ var cities = context.history().intersects(box).filter(isAddressable).map(function(d) {
+ return {
+ title: d.tags["addr:city"] || d.tags.name,
+ value: d.tags["addr:city"] || d.tags.name,
+ dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
+ };
+ }).sort(function(a, b) {
+ return a.dist - b.dist;
+ });
+ return utilArrayUniqBy(cities, "value");
+ function isAddressable(d) {
+ if (d.tags.name) {
+ if (d.tags.admin_level === "8" && d.tags.boundary === "administrative")
+ return true;
+ if (d.tags.border_type === "city")
+ return true;
+ if (d.tags.place === "city" || d.tags.place === "town" || d.tags.place === "village")
+ return true;
}
- return _mapillary;
- }
-
- function showLayer() {
- editOn();
- debouncedRedraw();
- }
-
- function hideLayer() {
- debouncedRedraw.cancel();
- editOff();
+ if (d.tags["addr:city"])
+ return true;
+ return false;
+ }
}
-
- function editOn() {
- layer.style('display', 'block');
+ function getNearValues(key) {
+ var extent = combinedEntityExtent();
+ var l = extent.center();
+ var box = geoExtent(l).padByMeters(200);
+ var results = context.history().intersects(box).filter(function hasTag(d) {
+ return _entityIDs.indexOf(d.id) === -1 && d.tags[key];
+ }).map(function(d) {
+ return {
+ title: d.tags[key],
+ value: d.tags[key],
+ dist: geoSphericalDistance(d.extent(context.graph()).center(), l)
+ };
+ }).sort(function(a, b) {
+ return a.dist - b.dist;
+ });
+ return utilArrayUniqBy(results, "value");
}
-
- function editOff() {
- layer.selectAll('.icon-sign').remove();
- layer.style('display', 'none');
+ function updateForCountryCode() {
+ if (!_countryCode)
+ return;
+ var addressFormat;
+ for (var i2 = 0; i2 < _addressFormats.length; i2++) {
+ var format2 = _addressFormats[i2];
+ if (!format2.countryCodes) {
+ addressFormat = format2;
+ } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
+ addressFormat = format2;
+ break;
+ }
+ }
+ var dropdowns = addressFormat.dropdowns || [
+ "city",
+ "county",
+ "country",
+ "district",
+ "hamlet",
+ "neighbourhood",
+ "place",
+ "postcode",
+ "province",
+ "quarter",
+ "state",
+ "street",
+ "subdistrict",
+ "suburb"
+ ];
+ var widths = addressFormat.widths || {
+ housenumber: 1 / 3,
+ street: 2 / 3,
+ city: 2 / 3,
+ state: 1 / 4,
+ postcode: 1 / 3
+ };
+ function row(r) {
+ var total = r.reduce(function(sum, key) {
+ return sum + (widths[key] || 0.5);
+ }, 0);
+ return r.map(function(key) {
+ return {
+ id: key,
+ width: (widths[key] || 0.5) / total
+ };
+ });
+ }
+ var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d) {
+ return d.toString();
+ });
+ rows.exit().remove();
+ rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d) {
+ return "addr-" + d.id;
+ }).call(utilNoAuto).each(addDropdown).style("width", function(d) {
+ return d.width * 100 + "%";
+ });
+ function addDropdown(d) {
+ if (dropdowns.indexOf(d.id) === -1)
+ return;
+ var nearValues = d.id === "street" ? getNearStreets : d.id === "city" ? getNearCities : getNearValues;
+ select_default2(this).call(uiCombobox(context, "address-" + d.id).minItems(1).caseSensitive(true).fetcher(function(value, callback) {
+ callback(nearValues("addr:" + d.id));
+ }));
+ }
+ _wrap.selectAll("input").on("blur", change()).on("change", change());
+ _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
+ if (_tags)
+ updateTags(_tags);
+ }
+ function address(selection2) {
+ _selection = selection2;
+ _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
+ _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
+ var extent = combinedEntityExtent();
+ if (extent) {
+ var countryCode;
+ if (context.inIntro()) {
+ countryCode = _t("intro.graph.countrycode");
+ } else {
+ var center = extent.center();
+ countryCode = iso1A2Code(center);
+ }
+ if (countryCode) {
+ _countryCode = countryCode.toLowerCase();
+ updateForCountryCode();
+ }
+ }
}
-
- function click(d) {
- var mapillary = getMapillary();
- if (!mapillary) return;
-
- context.map().centerEase(d.loc);
-
- mapillary
- .setSelectedImage(d.key, true)
- .updateViewer(d.key, context)
- .showViewer();
+ function change(onInput) {
+ return function() {
+ var tags = {};
+ _wrap.selectAll("input").each(function(subfield) {
+ var key = field.key + ":" + subfield.id;
+ var value = this.value;
+ if (!onInput)
+ value = context.cleanTagValue(value);
+ if (Array.isArray(_tags[key]) && !value)
+ return;
+ tags[key] = value || void 0;
+ });
+ dispatch10.call("change", this, tags, onInput);
+ };
}
-
- function update() {
- var mapillary = getMapillary(),
- data = (mapillary ? mapillary.signs(projection, layer.dimensions()) : []),
- imageKey = mapillary ? mapillary.getSelectedImage() : null;
-
- var signs = layer.selectAll('.icon-sign')
- .data(data, function(d) { return d.key; });
-
- // Enter
- var enter = signs.enter()
- .append('foreignObject')
- .attr('class', 'icon-sign')
- .attr('width', '32px') // for Firefox
- .attr('height', '32px') // for Firefox
- .classed('selected', function(d) { return d.key === imageKey; })
- .on('click', click);
-
- enter
- .append('xhtml:body')
- .html(mapillary.signHTML);
-
- // Exit
- signs.exit()
- .remove();
-
- // Update
- signs
- .attr('transform', iD.svg.PointTransform(projection));
- }
-
- function drawSigns(selection) {
- var enabled = iD.svg.MapillarySigns.enabled,
- mapillary = getMapillary();
-
- layer = selection.selectAll('.layer-mapillary-signs')
- .data(mapillary ? [0] : []);
-
- layer.enter()
- .append('g')
- .attr('class', 'layer-mapillary-signs')
- .style('display', enabled ? 'block' : 'none')
- .attr('transform', 'translate(-16, -16)'); // center signs on loc
-
- layer.exit()
- .remove();
-
- if (enabled) {
- if (mapillary && ~~context.map().zoom() >= minZoom) {
- editOn();
- update();
- mapillary.loadSigns(context, projection, layer.dimensions());
- } else {
- editOff();
- }
+ function updatePlaceholder(inputSelection) {
+ return inputSelection.attr("placeholder", function(subfield) {
+ if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
+ return _t("inspector.multiple_values");
}
- }
-
- drawSigns.enabled = function(_) {
- if (!arguments.length) return iD.svg.MapillarySigns.enabled;
- iD.svg.MapillarySigns.enabled = _;
- if (iD.svg.MapillarySigns.enabled) {
- showLayer();
- } else {
- hideLayer();
+ if (_countryCode) {
+ var localkey = subfield.id + "!" + _countryCode;
+ var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : subfield.id;
+ return addrField.t("placeholders." + tkey);
}
- dispatch.change();
- return this;
+ });
+ }
+ function updateTags(tags) {
+ utilGetSetValue(_wrap.selectAll("input"), function(subfield) {
+ var val = tags[field.key + ":" + subfield.id];
+ return typeof val === "string" ? val : "";
+ }).attr("title", function(subfield) {
+ var val = tags[field.key + ":" + subfield.id];
+ return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
+ }).classed("mixed", function(subfield) {
+ return Array.isArray(tags[field.key + ":" + subfield.id]);
+ }).call(updatePlaceholder);
+ }
+ function combinedEntityExtent() {
+ return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
+ }
+ address.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return address;
};
-
- drawSigns.supported = function() {
- var mapillary = getMapillary();
- return (mapillary && mapillary.signsSupported());
+ address.tags = function(tags) {
+ _tags = tags;
+ updateTags(tags);
};
-
- drawSigns.dimensions = function(_) {
- if (!arguments.length) return layer.dimensions();
- layer.dimensions(_);
- return this;
+ address.focus = function() {
+ var node = _wrap.selectAll("input").node();
+ if (node)
+ node.focus();
};
+ return utilRebind(address, dispatch10, "on");
+ }
- init();
- return drawSigns;
-};
-iD.svg.Midpoints = function(projection, context) {
- return function drawMidpoints(surface, graph, entities, filter, extent) {
- var poly = extent.polygon(),
- midpoints = {};
-
- for (var i = 0; i < entities.length; i++) {
- var entity = entities[i];
-
- if (entity.type !== 'way')
- continue;
- if (!filter(entity))
- continue;
- if (context.selectedIDs().indexOf(entity.id) < 0)
- continue;
-
- var nodes = graph.childNodes(entity);
- for (var j = 0; j < nodes.length - 1; j++) {
-
- var a = nodes[j],
- b = nodes[j + 1],
- id = [a.id, b.id].sort().join('-');
-
- if (midpoints[id]) {
- midpoints[id].parents.push(entity);
- } else {
- if (iD.geo.euclideanDistance(projection(a.loc), projection(b.loc)) > 40) {
- var point = iD.geo.interp(a.loc, b.loc, 0.5),
- loc = null;
-
- if (extent.intersects(point)) {
- loc = point;
- } else {
- for (var k = 0; k < 4; k++) {
- point = iD.geo.lineIntersection([a.loc, b.loc], [poly[k], poly[k+1]]);
- if (point &&
- iD.geo.euclideanDistance(projection(a.loc), projection(point)) > 20 &&
- iD.geo.euclideanDistance(projection(b.loc), projection(point)) > 20)
- {
- loc = point;
- break;
- }
- }
- }
-
- if (loc) {
- midpoints[id] = {
- type: 'midpoint',
- id: id,
- loc: loc,
- edge: [a.id, b.id],
- parents: [entity]
- };
- }
- }
- }
- }
+ // modules/ui/fields/cycleway.js
+ function uiFieldCycleway(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var items = select_default2(null);
+ var wrap2 = select_default2(null);
+ var _tags;
+ function cycleway(selection2) {
+ function stripcolon(s) {
+ return s.replace(":", "");
+ }
+ wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ var div = wrap2.selectAll("ul").data([0]);
+ div = div.enter().append("ul").attr("class", "rows").merge(div);
+ var keys = ["cycleway:left", "cycleway:right"];
+ items = div.selectAll("li").data(keys);
+ var enter = items.enter().append("li").attr("class", function(d) {
+ return "labeled-input preset-cycleway-" + stripcolon(d);
+ });
+ enter.append("span").attr("class", "label preset-label-cycleway").attr("for", function(d) {
+ return "preset-input-cycleway-" + stripcolon(d);
+ }).html(function(d) {
+ return field.t.html("types." + d);
+ });
+ enter.append("div").attr("class", "preset-input-cycleway-wrap").append("input").attr("type", "text").attr("class", function(d) {
+ return "preset-input-cycleway preset-input-" + stripcolon(d);
+ }).call(utilNoAuto).each(function(d) {
+ select_default2(this).call(uiCombobox(context, "cycleway-" + stripcolon(d)).data(cycleway.options(d)));
+ });
+ items = items.merge(enter);
+ wrap2.selectAll(".preset-input-cycleway").on("change", change).on("blur", change);
+ }
+ function change(d3_event, key) {
+ var newValue = context.cleanTagValue(utilGetSetValue(select_default2(this)));
+ if (!newValue && (Array.isArray(_tags.cycleway) || Array.isArray(_tags[key])))
+ return;
+ if (newValue === "none" || newValue === "") {
+ newValue = void 0;
+ }
+ var otherKey = key === "cycleway:left" ? "cycleway:right" : "cycleway:left";
+ var otherValue = typeof _tags.cycleway === "string" ? _tags.cycleway : _tags[otherKey];
+ if (otherValue && Array.isArray(otherValue)) {
+ otherValue = otherValue[0];
+ }
+ if (otherValue === "none" || otherValue === "") {
+ otherValue = void 0;
+ }
+ var tag = {};
+ if (newValue === otherValue) {
+ tag = {
+ cycleway: newValue,
+ "cycleway:left": void 0,
+ "cycleway:right": void 0
+ };
+ } else {
+ tag = {
+ cycleway: void 0
+ };
+ tag[key] = newValue;
+ tag[otherKey] = otherValue;
+ }
+ dispatch10.call("change", this, tag);
+ }
+ cycleway.options = function() {
+ return field.options.map(function(option) {
+ return {
+ title: field.t("options." + option + ".description"),
+ value: option
+ };
+ });
+ };
+ cycleway.tags = function(tags) {
+ _tags = tags;
+ var commonValue = typeof tags.cycleway === "string" && tags.cycleway;
+ utilGetSetValue(items.selectAll(".preset-input-cycleway"), function(d) {
+ if (commonValue)
+ return commonValue;
+ return !tags.cycleway && typeof tags[d] === "string" ? tags[d] : "";
+ }).attr("title", function(d) {
+ if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
+ var vals = [];
+ if (Array.isArray(tags.cycleway)) {
+ vals = vals.concat(tags.cycleway);
+ }
+ if (Array.isArray(tags[d])) {
+ vals = vals.concat(tags[d]);
+ }
+ return vals.filter(Boolean).join("\n");
}
-
- function midpointFilter(d) {
- if (midpoints[d.id])
- return true;
-
- for (var i = 0; i < d.parents.length; i++)
- if (filter(d.parents[i]))
- return true;
-
- return false;
+ return null;
+ }).attr("placeholder", function(d) {
+ if (Array.isArray(tags.cycleway) || Array.isArray(tags[d])) {
+ return _t("inspector.multiple_values");
}
-
- var groups = surface.selectAll('.layer-hit').selectAll('g.midpoint')
- .filter(midpointFilter)
- .data(_.values(midpoints), function(d) { return d.id; });
-
- var enter = groups.enter()
- .insert('g', ':first-child')
- .attr('class', 'midpoint');
-
- enter.append('polygon')
- .attr('points', '-6,8 10,0 -6,-8')
- .attr('class', 'shadow');
-
- enter.append('polygon')
- .attr('points', '-3,4 5,0 -3,-4')
- .attr('class', 'fill');
-
- groups
- .attr('transform', function(d) {
- var translate = iD.svg.PointTransform(projection),
- a = context.entity(d.edge[0]),
- b = context.entity(d.edge[1]),
- angle = Math.round(iD.geo.angle(a, b, projection) * (180 / Math.PI));
- return translate(d) + ' rotate(' + angle + ')';
- })
- .call(iD.svg.TagClasses().tags(
- function(d) { return d.parents[0].tags; }
- ));
-
- // Propagate data bindings.
- groups.select('polygon.shadow');
- groups.select('polygon.fill');
-
- groups.exit()
- .remove();
+ return field.placeholder();
+ }).classed("mixed", function(d) {
+ return Array.isArray(tags.cycleway) || Array.isArray(tags[d]);
+ });
};
-};
-iD.svg.Osm = function() {
- return function drawOsm(selection) {
- var layers = selection.selectAll('.layer-osm')
- .data(['areas', 'lines', 'hit', 'halo', 'label']);
-
- layers.enter().append('g')
- .attr('class', function(d) { return 'layer-osm layer-' + d; });
+ cycleway.focus = function() {
+ var node = wrap2.selectAll("input").node();
+ if (node)
+ node.focus();
};
-};
-iD.svg.Points = function(projection, context) {
- function markerPath(selection, klass) {
- selection
- .attr('class', klass)
- .attr('transform', 'translate(-8, -23)')
- .attr('d', 'M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z');
- }
+ return utilRebind(cycleway, dispatch10, "on");
+ }
- function sortY(a, b) {
- return b.loc[1] - a.loc[1];
+ // modules/ui/fields/lanes.js
+ function uiFieldLanes(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var LANE_WIDTH = 40;
+ var LANE_HEIGHT = 200;
+ var _entityIDs = [];
+ function lanes(selection2) {
+ var lanesData = context.entity(_entityIDs[0]).lanes();
+ if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
+ selection2.call(lanes.off);
+ return;
+ }
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ var surface = wrap2.selectAll(".surface").data([0]);
+ var d = utilGetDimensions(wrap2);
+ var freeSpace = d[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
+ surface = surface.enter().append("svg").attr("width", d[0]).attr("height", 300).attr("class", "surface").merge(surface);
+ var lanesSelection = surface.selectAll(".lanes").data([0]);
+ lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
+ lanesSelection.attr("transform", function() {
+ return "translate(" + freeSpace / 2 + ", 0)";
+ });
+ var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
+ lane.exit().remove();
+ var enter = lane.enter().append("g").attr("class", "lane");
+ enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
+ enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
+ enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
+ enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
+ lane = lane.merge(enter);
+ lane.attr("transform", function(d2) {
+ return "translate(" + LANE_WIDTH * d2.index * 1.5 + ", 0)";
+ });
+ lane.select(".forward").style("visibility", function(d2) {
+ return d2.direction === "forward" ? "visible" : "hidden";
+ });
+ lane.select(".bothways").style("visibility", function(d2) {
+ return d2.direction === "bothways" ? "visible" : "hidden";
+ });
+ lane.select(".backward").style("visibility", function(d2) {
+ return d2.direction === "backward" ? "visible" : "hidden";
+ });
}
-
- return function drawPoints(surface, graph, entities, filter) {
- var wireframe = surface.classed('fill-wireframe'),
- points = wireframe ? [] : _.filter(entities, function(e) {
- return e.geometry(graph) === 'point';
- });
-
- points.sort(sortY);
-
- var groups = surface.selectAll('.layer-hit').selectAll('g.point')
- .filter(filter)
- .data(points, iD.Entity.key);
-
- var group = groups.enter()
- .append('g')
- .attr('class', function(d) { return 'node point ' + d.id; })
- .order();
-
- group.append('path')
- .call(markerPath, 'shadow');
-
- group.append('path')
- .call(markerPath, 'stroke');
-
- group.append('use')
- .attr('transform', 'translate(-6, -20)')
- .attr('class', 'icon')
- .attr('width', '12px')
- .attr('height', '12px');
-
- groups.attr('transform', iD.svg.PointTransform(projection))
- .call(iD.svg.TagClasses());
-
- // Selecting the following implicitly
- // sets the data (point entity) on the element
- groups.select('.shadow');
- groups.select('.stroke');
- groups.select('.icon')
- .attr('xlink:href', function(entity) {
- var preset = context.presets().match(entity, graph);
- return preset.icon ? '#' + preset.icon + '-12' : '';
- });
-
- groups.exit()
- .remove();
- };
-};
-iD.svg.TagClasses = function() {
- var primaries = [
- 'building', 'highway', 'railway', 'waterway', 'aeroway',
- 'motorway', 'boundary', 'power', 'amenity', 'natural', 'landuse',
- 'leisure', 'place'
- ],
- statuses = [
- 'proposed', 'construction', 'disused', 'abandoned', 'dismantled',
- 'razed', 'demolished', 'obliterated'
- ],
- secondaries = [
- 'oneway', 'bridge', 'tunnel', 'embankment', 'cutting', 'barrier',
- 'surface', 'tracktype', 'crossing'
- ],
- tagClassRe = /^tag-/,
- tags = function(entity) { return entity.tags; };
-
-
- var tagClasses = function(selection) {
- selection.each(function tagClassesEach(entity) {
- var value = this.className,
- classes, primary, status;
-
- if (value.baseVal !== undefined) value = value.baseVal;
-
- classes = value.trim().split(/\s+/).filter(function(name) {
- return name.length && !tagClassRe.test(name);
- }).join(' ');
-
- var t = tags(entity), i, k, v;
-
- // pick at most one primary classification tag..
- for (i = 0; i < primaries.length; i++) {
- k = primaries[i];
- v = t[k];
- if (!v || v === 'no') continue;
-
- primary = k;
- if (statuses.indexOf(v) !== -1) { // e.g. `railway=abandoned`
- status = v;
- classes += ' tag-' + k;
- } else {
- classes += ' tag-' + k + ' tag-' + k + '-' + v;
- }
-
- break;
- }
-
- // add at most one status tag, only if relates to primary tag..
- if (!status) {
- for (i = 0; i < statuses.length; i++) {
- k = statuses[i];
- v = t[k];
- if (!v || v === 'no') continue;
-
- if (v === 'yes') { // e.g. `railway=rail + abandoned=yes`
- status = k;
- }
- else if (primary && primary === v) { // e.g. `railway=rail + abandoned=railway`
- status = k;
- } else if (!primary && primaries.indexOf(v) !== -1) { // e.g. `abandoned=railway`
- status = k;
- primary = v;
- classes += ' tag-' + v;
- } // else ignore e.g. `highway=path + abandoned=railway`
-
- if (status) break;
- }
- }
-
- if (status) {
- classes += ' tag-status tag-status-' + status;
- }
-
- // add any secondary (structure) tags
- for (i = 0; i < secondaries.length; i++) {
- k = secondaries[i];
- v = t[k];
- if (!v || v === 'no') continue;
- classes += ' tag-' + k + ' tag-' + k + '-' + v;
- }
-
- // For highways, look for surface tagging..
- if (primary === 'highway') {
- var paved = (t.highway !== 'track');
- for (k in t) {
- v = t[k];
- if (k in iD.pavedTags) {
- paved = !!iD.pavedTags[k][v];
- break;
- }
- }
- if (!paved) {
- classes += ' tag-unpaved';
- }
- }
-
- classes = classes.trim();
-
- if (classes !== value) {
- d3.select(this).attr('class', classes);
- }
- });
- };
-
- tagClasses.tags = function(_) {
- if (!arguments.length) return tags;
- tags = _;
- return tagClasses;
+ lanes.entityIDs = function(val) {
+ _entityIDs = val;
};
-
- return tagClasses;
-};
-iD.svg.Turns = function(projection) {
- return function drawTurns(surface, graph, turns) {
- function key(turn) {
- return [turn.from.node + turn.via.node + turn.to.node].join('-');
- }
-
- function icon(turn) {
- var u = turn.u ? '-u' : '';
- if (!turn.restriction)
- return '#turn-yes' + u;
- var restriction = graph.entity(turn.restriction).tags.restriction;
- return '#turn-' +
- (!turn.indirect_restriction && /^only_/.test(restriction) ? 'only' : 'no') + u;
- }
-
- var groups = surface.selectAll('.layer-hit').selectAll('g.turn')
- .data(turns, key);
-
- // Enter
- var enter = groups.enter().append('g')
- .attr('class', 'turn');
-
- var nEnter = enter.filter(function (turn) { return !turn.u; });
-
- nEnter.append('rect')
- .attr('transform', 'translate(-22, -12)')
- .attr('width', '44')
- .attr('height', '24');
-
- nEnter.append('use')
- .attr('transform', 'translate(-22, -12)')
- .attr('width', '44')
- .attr('height', '24');
-
-
- var uEnter = enter.filter(function (turn) { return turn.u; });
-
- uEnter.append('circle')
- .attr('r', '16');
-
- uEnter.append('use')
- .attr('transform', 'translate(-16, -16)')
- .attr('width', '32')
- .attr('height', '32');
-
-
- // Update
- groups
- .attr('transform', function (turn) {
- var v = graph.entity(turn.via.node),
- t = graph.entity(turn.to.node),
- a = iD.geo.angle(v, t, projection),
- p = projection(v.loc),
- r = turn.u ? 0 : 60;
-
- return 'translate(' + (r * Math.cos(a) + p[0]) + ',' + (r * Math.sin(a) + p[1]) + ') ' +
- 'rotate(' + a * 180 / Math.PI + ')';
- });
-
- groups.select('use')
- .attr('xlink:href', icon);
-
- groups.select('rect');
- groups.select('circle');
-
-
- // Exit
- groups.exit()
- .remove();
-
- return this;
+ lanes.tags = function() {
};
-};
-iD.svg.Vertices = function(projection, context) {
- var radiuses = {
- // z16-, z17, z18+, tagged
- shadow: [6, 7.5, 7.5, 11.5],
- stroke: [2.5, 3.5, 3.5, 7],
- fill: [1, 1.5, 1.5, 1.5]
+ lanes.focus = function() {
};
-
- var hover;
-
- function siblingAndChildVertices(ids, graph, extent) {
- var vertices = {};
-
- function addChildVertices(entity) {
- if (!context.features().isHiddenFeature(entity, graph, entity.geometry(graph))) {
- var i;
- if (entity.type === 'way') {
- for (i = 0; i < entity.nodes.length; i++) {
- addChildVertices(graph.entity(entity.nodes[i]));
- }
- } else if (entity.type === 'relation') {
- for (i = 0; i < entity.members.length; i++) {
- var member = context.hasEntity(entity.members[i].id);
- if (member) {
- addChildVertices(member);
- }
- }
- } else if (entity.intersects(extent, graph)) {
- vertices[entity.id] = entity;
- }
- }
- }
-
- ids.forEach(function(id) {
- var entity = context.hasEntity(id);
- if (entity && entity.type === 'node') {
- vertices[entity.id] = entity;
- context.graph().parentWays(entity).forEach(function(entity) {
- addChildVertices(entity);
- });
- } else if (entity) {
- addChildVertices(entity);
- }
+ lanes.off = function() {
+ };
+ return utilRebind(lanes, dispatch10, "on");
+ }
+ uiFieldLanes.supportsMultiselection = false;
+
+ // modules/ui/fields/localized.js
+ var _languagesArray = [];
+ function uiFieldLocalized(field, context) {
+ var dispatch10 = dispatch_default("change", "input");
+ var wikipedia = services.wikipedia;
+ var input = select_default2(null);
+ var localizedInputs = select_default2(null);
+ var _countryCode;
+ var _tags;
+ _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
+ });
+ var _territoryLanguages = {};
+ _mainFileFetcher.get("territory_languages").then(function(d) {
+ _territoryLanguages = d;
+ }).catch(function() {
+ });
+ var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
+ var _selection = select_default2(null);
+ var _multilingual = [];
+ var _buttonTip = uiTooltip().title(_t.html("translate.translate")).placement("left");
+ var _wikiTitles;
+ var _entityIDs = [];
+ function loadLanguagesArray(dataLanguages) {
+ if (_languagesArray.length !== 0)
+ return;
+ var replacements = {
+ sr: "sr-Cyrl",
+ "sr-Cyrl": false
+ };
+ for (var code in dataLanguages) {
+ if (replacements[code] === false)
+ continue;
+ var metaCode = code;
+ if (replacements[code])
+ metaCode = replacements[code];
+ _languagesArray.push({
+ localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
+ nativeName: dataLanguages[metaCode].nativeName,
+ code,
+ label: _mainLocalizer.languageName(metaCode)
});
-
- return vertices;
+ }
}
-
- function draw(selection, vertices, klass, graph, zoom) {
- var icons = {},
- z = (zoom < 17 ? 0 : zoom < 18 ? 1 : 2);
-
- var groups = selection
- .data(vertices, iD.Entity.key);
-
- function icon(entity) {
- if (entity.id in icons) return icons[entity.id];
- icons[entity.id] =
- entity.hasInterestingTags() &&
- context.presets().match(entity, graph).icon;
- return icons[entity.id];
+ function calcLocked() {
+ var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
+ var entity = context.graph().hasEntity(entityID);
+ if (!entity)
+ return false;
+ if (entity.tags.wikidata)
+ return true;
+ if (entity.tags["name:etymology:wikidata"])
+ return true;
+ var preset = _mainPresetIndex.match(entity, context.graph());
+ if (preset) {
+ var isSuggestion = preset.suggestion;
+ var fields = preset.fields();
+ var showsBrandField = fields.some(function(d) {
+ return d.id === "brand";
+ });
+ var showsOperatorField = fields.some(function(d) {
+ return d.id === "operator";
+ });
+ var setsName = preset.addTags.name;
+ var setsBrandWikidata = preset.addTags["brand:wikidata"];
+ var setsOperatorWikidata = preset.addTags["operator:wikidata"];
+ return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
}
-
- function setClass(klass) {
- return function(entity) {
- this.setAttribute('class', 'node vertex ' + klass + ' ' + entity.id);
- };
+ return false;
+ });
+ field.locked(isLocked);
+ }
+ function calcMultilingual(tags) {
+ var existingLangsOrdered = _multilingual.map(function(item2) {
+ return item2.lang;
+ });
+ var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
+ for (var k in tags) {
+ var m = k.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
+ if (m && m[1] === field.key && m[2]) {
+ var item = { lang: m[2], value: tags[k] };
+ if (existingLangs.has(item.lang)) {
+ _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
+ existingLangs.delete(item.lang);
+ } else {
+ _multilingual.push(item);
+ }
}
-
- function setAttributes(selection) {
- ['shadow','stroke','fill'].forEach(function(klass) {
- var rads = radiuses[klass];
- selection.selectAll('.' + klass)
- .each(function(entity) {
- var i = z && icon(entity),
- c = i ? 0.5 : 0,
- r = rads[i ? 3 : z];
- this.setAttribute('cx', c);
- this.setAttribute('cy', -c);
- this.setAttribute('r', r);
- if (i && klass === 'fill') {
- this.setAttribute('visibility', 'hidden');
- } else {
- this.removeAttribute('visibility');
- }
- });
- });
-
- selection.selectAll('use')
- .each(function() {
- if (z) {
- this.removeAttribute('visibility');
- } else {
- this.setAttribute('visibility', 'hidden');
- }
- });
+ }
+ _multilingual.forEach(function(item2) {
+ if (item2.lang && existingLangs.has(item2.lang)) {
+ item2.value = "";
}
-
- var enter = groups.enter()
- .append('g')
- .attr('class', function(d) { return 'node vertex ' + klass + ' ' + d.id; });
-
- enter.append('circle')
- .each(setClass('shadow'));
-
- enter.append('circle')
- .each(setClass('stroke'));
-
- // Vertices with icons get a `use`.
- enter.filter(function(d) { return icon(d); })
- .append('use')
- .attr('transform', 'translate(-6, -6)')
- .attr('xlink:href', function(d) { return '#' + icon(d) + '-12'; })
- .attr('width', '12px')
- .attr('height', '12px')
- .each(setClass('icon'));
-
- // Vertices with tags get a fill.
- enter.filter(function(d) { return d.hasInterestingTags(); })
- .append('circle')
- .each(setClass('fill'));
-
- groups
- .attr('transform', iD.svg.PointTransform(projection))
- .classed('shared', function(entity) { return graph.isShared(entity); })
- .call(setAttributes);
-
- groups.exit()
- .remove();
+ });
}
-
- function drawVertices(surface, graph, entities, filter, extent, zoom) {
- var selected = siblingAndChildVertices(context.selectedIDs(), graph, extent),
- wireframe = surface.classed('fill-wireframe'),
- vertices = [];
-
- for (var i = 0; i < entities.length; i++) {
- var entity = entities[i],
- geometry = entity.geometry(graph);
-
- if (wireframe && geometry === 'point') {
- vertices.push(entity);
- continue;
- }
-
- if (geometry !== 'vertex')
- continue;
-
- if (entity.id in selected ||
- entity.hasInterestingTags() ||
- entity.isIntersection(graph)) {
- vertices.push(entity);
- }
+ function localized(selection2) {
+ _selection = selection2;
+ calcLocked();
+ var isLocked = field.locked();
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ input = wrap2.selectAll(".localized-main").data([0]);
+ input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
+ input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
+ var translateButton = wrap2.selectAll(".localized-add").data([0]);
+ translateButton = translateButton.enter().append("button").attr("class", "localized-add form-field-button").attr("aria-label", _t("icons.plus")).call(svgIcon("#iD-icon-plus")).merge(translateButton);
+ translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
+ if (_tags && !_multilingual.length) {
+ calcMultilingual(_tags);
+ }
+ localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
+ localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
+ localizedInputs.call(renderMultilingual);
+ localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
+ selection2.selectAll(".combobox-caret").classed("nope", true);
+ function addNew(d3_event) {
+ d3_event.preventDefault();
+ if (field.locked())
+ return;
+ var defaultLang = _mainLocalizer.languageCode().toLowerCase();
+ var langExists = _multilingual.find(function(datum2) {
+ return datum2.lang === defaultLang;
+ });
+ var isLangEn = defaultLang.indexOf("en") > -1;
+ if (isLangEn || langExists) {
+ defaultLang = "";
+ langExists = _multilingual.find(function(datum2) {
+ return datum2.lang === defaultLang;
+ });
}
-
- surface.selectAll('.layer-hit').selectAll('g.vertex.vertex-persistent')
- .filter(filter)
- .call(draw, vertices, 'vertex-persistent', graph, zoom);
-
- drawHover(surface, graph, extent, zoom);
- }
-
- function drawHover(surface, graph, extent, zoom) {
- var hovered = hover ? siblingAndChildVertices([hover.id], graph, extent) : {};
-
- surface.selectAll('.layer-hit').selectAll('g.vertex.vertex-hover')
- .call(draw, d3.values(hovered), 'vertex-hover', graph, zoom);
- }
-
- drawVertices.drawHover = function(surface, graph, target, extent, zoom) {
- if (target === hover) return;
- hover = target;
- drawHover(surface, graph, extent, zoom);
- };
-
- return drawVertices;
-};
-iD.ui = function(context) {
- function render(container) {
- var map = context.map();
-
- if (iD.detect().opera) container.classed('opera', true);
-
- var hash = iD.behavior.Hash(context);
-
- hash();
-
- if (!hash.hadHash) {
- map.centerZoom([0, 0], 2);
+ if (!langExists) {
+ _multilingual.unshift({ lang: defaultLang, value: "" });
+ localizedInputs.call(renderMultilingual);
}
-
- container.append('svg')
- .attr('id', 'defs')
- .call(iD.svg.Defs(context));
-
- container.append('div')
- .attr('id', 'sidebar')
- .attr('class', 'col4')
- .call(ui.sidebar);
-
- var content = container.append('div')
- .attr('id', 'content');
-
- var bar = content.append('div')
- .attr('id', 'bar')
- .attr('class', 'fillD');
-
- content.append('div')
- .attr('id', 'map')
- .call(map);
-
- content
- .call(iD.ui.MapInMap(context));
-
- content.append('div')
- .call(iD.ui.Info(context));
-
- bar.append('div')
- .attr('class', 'spacer col4');
-
- var limiter = bar.append('div')
- .attr('class', 'limiter');
-
- limiter.append('div')
- .attr('class', 'button-wrap joined col3')
- .call(iD.ui.Modes(context), limiter);
-
- limiter.append('div')
- .attr('class', 'button-wrap joined col1')
- .call(iD.ui.UndoRedo(context));
-
- limiter.append('div')
- .attr('class', 'button-wrap col1')
- .call(iD.ui.Save(context));
-
- bar.append('div')
- .attr('class', 'full-screen')
- .call(iD.ui.FullScreen(context));
-
- bar.append('div')
- .attr('class', 'spinner')
- .call(iD.ui.Spinner(context));
-
- var controls = bar.append('div')
- .attr('class', 'map-controls');
-
- controls.append('div')
- .attr('class', 'map-control zoombuttons')
- .call(iD.ui.Zoom(context));
-
- controls.append('div')
- .attr('class', 'map-control geolocate-control')
- .call(iD.ui.Geolocate(context));
-
- controls.append('div')
- .attr('class', 'map-control background-control')
- .call(iD.ui.Background(context));
-
- controls.append('div')
- .attr('class', 'map-control map-data-control')
- .call(iD.ui.MapData(context));
-
- controls.append('div')
- .attr('class', 'map-control help-control')
- .call(iD.ui.Help(context));
-
- var about = content.append('div')
- .attr('id', 'about');
-
- about.append('div')
- .attr('id', 'attrib')
- .call(iD.ui.Attribution(context));
-
- var footer = about.append('div')
- .attr('id', 'footer')
- .attr('class', 'fillD');
-
- footer.append('div')
- .attr('class', 'api-status')
- .call(iD.ui.Status(context));
-
- footer.append('div')
- .attr('id', 'scale-block')
- .call(iD.ui.Scale(context));
-
- var aboutList = footer.append('div')
- .attr('id', 'info-block')
- .append('ul')
- .attr('id', 'about-list');
-
- if (!context.embed()) {
- aboutList.call(iD.ui.Account(context));
- }
-
- aboutList.append('li')
- .append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .attr('href', 'https://github.com/openstreetmap/iD')
- .text(iD.version);
-
- var issueLinks = aboutList.append('li');
-
- issueLinks.append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .attr('href', 'https://github.com/openstreetmap/iD/issues')
- .call(iD.svg.Icon('#icon-bug', 'light'))
- .call(bootstrap.tooltip()
- .title(t('report_a_bug'))
- .placement('top')
- );
-
- issueLinks.append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .attr('href', 'https://github.com/openstreetmap/iD/blob/master/CONTRIBUTING.md#translating')
- .call(iD.svg.Icon('#icon-translate', 'light'))
- .call(bootstrap.tooltip()
- .title(t('help_translate'))
- .placement('top')
- );
-
- aboutList.append('li')
- .attr('class', 'feature-warning')
- .attr('tabindex', -1)
- .call(iD.ui.FeatureInfo(context));
-
- aboutList.append('li')
- .attr('class', 'user-list')
- .attr('tabindex', -1)
- .call(iD.ui.Contributors(context));
-
- window.onbeforeunload = function() {
- return context.save();
- };
-
- window.onunload = function() {
- context.history().unlock();
+ }
+ function change(onInput) {
+ return function(d3_event) {
+ if (field.locked()) {
+ d3_event.preventDefault();
+ return;
+ }
+ var val = utilGetSetValue(select_default2(this));
+ if (!onInput)
+ val = context.cleanTagValue(val);
+ if (!val && Array.isArray(_tags[field.key]))
+ return;
+ var t = {};
+ t[field.key] = val || void 0;
+ dispatch10.call("change", this, t, onInput);
};
-
- var mapDimensions = map.dimensions();
-
- d3.select(window).on('resize.editor', function() {
- mapDimensions = content.dimensions(null);
- map.dimensions(mapDimensions);
- });
-
- function pan(d) {
- return function() {
- d3.event.preventDefault();
- if (!context.inIntro()) context.pan(d);
- };
- }
-
- // pan amount
- var pa = 10;
-
- var keybinding = d3.keybinding('main')
- .on('â«', function() { d3.event.preventDefault(); })
- .on('â', pan([pa, 0]))
- .on('â', pan([0, pa]))
- .on('â', pan([-pa, 0]))
- .on('â', pan([0, -pa]))
- .on('â§â', pan([mapDimensions[0], 0]))
- .on('â§â', pan([0, mapDimensions[1]]))
- .on('â§â', pan([-mapDimensions[0], 0]))
- .on('â§â', pan([0, -mapDimensions[1]]))
- .on(iD.ui.cmd('ââ'), pan([mapDimensions[0], 0]))
- .on(iD.ui.cmd('ââ'), pan([0, mapDimensions[1]]))
- .on(iD.ui.cmd('ââ'), pan([-mapDimensions[0], 0]))
- .on(iD.ui.cmd('ââ'), pan([0, -mapDimensions[1]]));
-
- d3.select(document)
- .call(keybinding);
-
- context.enter(iD.modes.Browse(context));
-
- context.container()
- .call(iD.ui.Splash(context))
- .call(iD.ui.Restore(context));
-
- var authenticating = iD.ui.Loading(context)
- .message(t('loading_auth'));
-
- context.connection()
- .on('authenticating.ui', function() {
- context.container()
- .call(authenticating);
- })
- .on('authenticated.ui', function() {
- authenticating.close();
- });
+ }
}
-
- function ui(container) {
- context.container(container);
- context.loadLocale(function() {
- render(container);
- });
+ function key(lang) {
+ return field.key + ":" + lang;
}
-
- ui.sidebar = iD.ui.Sidebar(context);
-
- return ui;
-};
-
-iD.ui.tooltipHtml = function(text, key) {
- var s = '' + text + '';
- if (key) {
- s += '' +
- ' ' + (t('tooltip_keyhint')) + ' ' +
- ' ' + key + '
';
+ function changeLang(d3_event, d) {
+ var tags = {};
+ var lang = utilGetSetValue(select_default2(this)).toLowerCase();
+ var language = _languagesArray.find(function(d2) {
+ return d2.label.toLowerCase() === lang || d2.localName && d2.localName.toLowerCase() === lang || d2.nativeName && d2.nativeName.toLowerCase() === lang;
+ });
+ if (language)
+ lang = language.code;
+ if (d.lang && d.lang !== lang) {
+ tags[key(d.lang)] = void 0;
+ }
+ var newKey = lang && context.cleanTagKey(key(lang));
+ var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
+ if (newKey && value) {
+ tags[newKey] = value;
+ } else if (newKey && _wikiTitles && _wikiTitles[d.lang]) {
+ tags[newKey] = _wikiTitles[d.lang];
+ }
+ d.lang = lang;
+ dispatch10.call("change", this, tags);
}
- return s;
-};
-iD.ui.Account = function(context) {
- var connection = context.connection();
-
- function update(selection) {
- if (!connection.authenticated()) {
- selection.selectAll('#userLink, #logoutLink')
- .classed('hide', true);
+ function changeValue(d3_event, d) {
+ if (!d.lang)
+ return;
+ var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
+ if (!value && Array.isArray(d.value))
+ return;
+ var t = {};
+ t[key(d.lang)] = value;
+ d.value = value;
+ dispatch10.call("change", this, t);
+ }
+ function fetchLanguages(value, cb) {
+ var v = value.toLowerCase();
+ var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
+ if (_countryCode && _territoryLanguages[_countryCode]) {
+ langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
+ }
+ var langItems = [];
+ langCodes.forEach(function(code) {
+ var langItem = _languagesArray.find(function(item) {
+ return item.code === code;
+ });
+ if (langItem)
+ langItems.push(langItem);
+ });
+ langItems = utilArrayUniq(langItems.concat(_languagesArray));
+ cb(langItems.filter(function(d) {
+ return d.label.toLowerCase().indexOf(v) >= 0 || d.localName && d.localName.toLowerCase().indexOf(v) >= 0 || d.nativeName && d.nativeName.toLowerCase().indexOf(v) >= 0 || d.code.toLowerCase().indexOf(v) >= 0;
+ }).map(function(d) {
+ return { value: d.label };
+ }));
+ }
+ function renderMultilingual(selection2) {
+ var entries = selection2.selectAll("div.entry").data(_multilingual, function(d) {
+ return d.lang;
+ });
+ entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
+ var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_, index) {
+ var wrap2 = select_default2(this);
+ var domId = utilUniqueDomId(index);
+ var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
+ var text2 = label.append("span").attr("class", "label-text");
+ text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
+ text2.append("span").attr("class", "label-textannotation");
+ label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d) {
+ if (field.locked())
return;
- }
-
- connection.userDetails(function(err, details) {
- var userLink = selection.select('#userLink'),
- logoutLink = selection.select('#logoutLink');
-
- userLink.html('');
- logoutLink.html('');
-
- if (err) return;
-
- selection.selectAll('#userLink, #logoutLink')
- .classed('hide', false);
-
- // Link
- userLink.append('a')
- .attr('href', connection.userURL(details.display_name))
- .attr('target', '_blank');
-
- // Add thumbnail or dont
- if (details.image_url) {
- userLink.append('img')
- .attr('class', 'icon pre-text user-icon')
- .attr('src', details.image_url);
- } else {
- userLink
- .call(iD.svg.Icon('#icon-avatar', 'pre-text light'));
- }
-
- // Add user name
- userLink.append('span')
- .attr('class', 'label')
- .text(details.display_name);
-
- logoutLink.append('a')
- .attr('class', 'logout')
- .attr('href', '#')
- .text(t('logout'))
- .on('click.logout', function() {
- d3.event.preventDefault();
- connection.logout();
- });
+ d3_event.preventDefault();
+ _multilingual.splice(_multilingual.indexOf(d), 1);
+ var langKey = d.lang && key(d.lang);
+ if (langKey && langKey in _tags) {
+ delete _tags[langKey];
+ var t = {};
+ t[langKey] = void 0;
+ dispatch10.call("change", this, t);
+ return;
+ }
+ renderMultilingual(selection2);
+ }).call(svgIcon("#iD-operation-delete"));
+ wrap2.append("input").attr("class", "localized-lang").attr("id", domId).attr("type", "text").attr("placeholder", _t("translate.localized_translation_language")).on("blur", changeLang).on("change", changeLang).call(langCombo);
+ wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
+ });
+ entriesEnter.style("margin-top", "0px").style("max-height", "0px").style("opacity", "0").transition().duration(200).style("margin-top", "10px").style("max-height", "240px").style("opacity", "1").on("end", function() {
+ select_default2(this).style("max-height", "").style("overflow", "visible");
+ });
+ entries = entries.merge(entriesEnter);
+ entries.order();
+ entries.classed("present", true);
+ utilGetSetValue(entries.select(".localized-lang"), function(d) {
+ var langItem = _languagesArray.find(function(item) {
+ return item.code === d.lang;
});
+ if (langItem)
+ return langItem.label;
+ return d.lang;
+ });
+ utilGetSetValue(entries.select(".localized-value"), function(d) {
+ return typeof d.value === "string" ? d.value : "";
+ }).attr("title", function(d) {
+ return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : null;
+ }).attr("placeholder", function(d) {
+ return Array.isArray(d.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
+ }).classed("mixed", function(d) {
+ return Array.isArray(d.value);
+ });
}
-
- return function(selection) {
- selection.append('li')
- .attr('id', 'logoutLink')
- .classed('hide', true);
-
- selection.append('li')
- .attr('id', 'userLink')
- .classed('hide', true);
-
- connection.on('auth.account', function() { update(selection); });
- update(selection);
+ localized.tags = function(tags) {
+ _tags = tags;
+ if (typeof tags.wikipedia === "string" && !_wikiTitles) {
+ _wikiTitles = {};
+ var wm = tags.wikipedia.match(/([^:]+):(.+)/);
+ if (wm && wm[0] && wm[1]) {
+ wikipedia.translations(wm[1], wm[2], function(err, d) {
+ if (err || !d)
+ return;
+ _wikiTitles = d;
+ });
+ }
+ }
+ var isMixed = Array.isArray(tags[field.key]);
+ utilGetSetValue(input, typeof tags[field.key] === "string" ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
+ calcMultilingual(tags);
+ _selection.call(localized);
};
-};
-iD.ui.Attribution = function(context) {
- var selection;
-
- function attribution(data, klass) {
- var div = selection.selectAll('.' + klass)
- .data([0]);
-
- div.enter()
- .append('div')
- .attr('class', klass);
-
- var background = div.selectAll('.attribution')
- .data(data, function(d) { return d.name(); });
-
- background.enter()
- .append('span')
- .attr('class', 'attribution')
- .each(function(d) {
- if (d.terms_html) {
- d3.select(this)
- .html(d.terms_html);
- return;
- }
-
- var source = d.terms_text || d.id || d.name();
-
- if (d.logo) {
- source = '
';
- }
-
- if (d.terms_url) {
- d3.select(this)
- .append('a')
- .attr('href', d.terms_url)
- .attr('target', '_blank')
- .html(source);
- } else {
- d3.select(this)
- .text(source);
- }
- });
-
- background.exit()
- .remove();
-
- var copyright = background.selectAll('.copyright-notice')
- .data(function(d) {
- var notice = d.copyrightNotices(context.map().zoom(), context.map().extent());
- return notice ? [notice] : [];
- });
-
- copyright.enter()
- .append('span')
- .attr('class', 'copyright-notice');
-
- copyright.text(String);
-
- copyright.exit()
- .remove();
+ localized.focus = function() {
+ input.node().focus();
+ };
+ localized.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ _multilingual = [];
+ loadCountryCode();
+ return localized;
+ };
+ function loadCountryCode() {
+ var extent = combinedEntityExtent();
+ var countryCode = extent && iso1A2Code(extent.center());
+ _countryCode = countryCode && countryCode.toLowerCase();
}
-
- function update() {
- attribution([context.background().baseLayerSource()], 'base-layer-attribution');
- attribution(context.background().overlayLayerSources().filter(function (s) {
- return s.validZoom(context.map().zoom());
- }), 'overlay-layer-attribution');
+ function combinedEntityExtent() {
+ return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
}
+ return utilRebind(localized, dispatch10, "on");
+ }
- return function(select) {
- selection = select;
-
- context.background()
- .on('change.attribution', update);
-
- context.map()
- .on('move.attribution', _.throttle(update, 400, {leading: false}));
-
- update();
- };
-};
-iD.ui.Background = function(context) {
- var key = 'B',
- opacities = [1, 0.75, 0.5, 0.25],
- directions = [
- ['right', [0.5, 0]],
- ['top', [0, -0.5]],
- ['left', [-0.5, 0]],
- ['bottom', [0, 0.5]]],
- opacityDefault = (context.storage('background-opacity') !== null) ?
- (+context.storage('background-opacity')) : 1.0,
- customTemplate = context.storage('background-custom-template') || '',
- previous;
-
- // Can be 0 from <1.3.0 use or due to issue #1923.
- if (opacityDefault === 0) opacityDefault = 1.0;
-
-
- function background(selection) {
-
- function sortSources(a, b) {
- return a.best() && !b.best() ? -1
- : b.best() && !a.best() ? 1
- : d3.descending(a.area(), b.area()) || d3.ascending(a.name(), b.name()) || 0;
- }
-
- function setOpacity(d) {
- var bg = context.container().selectAll('.layer-background')
- .transition()
- .style('opacity', d)
- .attr('data-opacity', d);
-
- if (!iD.detect().opera) {
- iD.util.setTransform(bg, 0, 0);
- }
-
- opacityList.selectAll('li')
- .classed('active', function(_) { return _ === d; });
-
- context.storage('background-opacity', d);
- }
-
- function setTooltips(selection) {
- selection.each(function(d) {
- var item = d3.select(this);
- if (d === previous) {
- item.call(bootstrap.tooltip()
- .html(true)
- .title(function() {
- var tip = '' + t('background.switch') + '
';
- return iD.ui.tooltipHtml(tip, iD.ui.cmd('âB'));
- })
- .placement('top')
- );
- } else if (d.description) {
- item.call(bootstrap.tooltip()
- .title(d.description)
- .placement('top')
- );
- } else {
- item.call(bootstrap.tooltip().destroy);
- }
- });
- }
-
- function selectLayer() {
- function active(d) {
- return context.background().showsLayer(d);
- }
-
- content.selectAll('.layer, .custom_layer')
- .classed('active', active)
- .classed('switch', function(d) { return d === previous; })
- .call(setTooltips)
- .selectAll('input')
- .property('checked', active);
+ // modules/ui/fields/roadheight.js
+ function uiFieldRoadheight(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var primaryUnitInput = select_default2(null);
+ var primaryInput = select_default2(null);
+ var secondaryInput = select_default2(null);
+ var secondaryUnitInput = select_default2(null);
+ var _entityIDs = [];
+ var _tags;
+ var _isImperial;
+ var primaryUnits = [
+ {
+ value: "m",
+ title: _t("inspector.roadheight.meter")
+ },
+ {
+ value: "ft",
+ title: _t("inspector.roadheight.foot")
+ }
+ ];
+ var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
+ function roadheight(selection2) {
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
+ primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
+ primaryInput.on("change", change).on("blur", change);
+ var loc = combinedEntityExtent().center();
+ _isImperial = roadHeightUnit(loc) === "ft";
+ primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
+ primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
+ primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
+ secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
+ secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
+ secondaryInput.on("change", change).on("blur", change);
+ secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
+ secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
+ function changeUnits() {
+ _isImperial = utilGetSetValue(primaryUnitInput) === "ft";
+ utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
+ setUnitSuggestions();
+ change();
+ }
+ }
+ function setUnitSuggestions() {
+ utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
+ }
+ function change() {
+ var tag = {};
+ var primaryValue = utilGetSetValue(primaryInput).trim();
+ var secondaryValue = utilGetSetValue(secondaryInput).trim();
+ if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
+ return;
+ if (!primaryValue && !secondaryValue) {
+ tag[field.key] = void 0;
+ } else if (isNaN(primaryValue) || isNaN(secondaryValue) || !_isImperial) {
+ tag[field.key] = context.cleanTagValue(primaryValue);
+ } else {
+ if (primaryValue !== "") {
+ primaryValue = context.cleanTagValue(primaryValue + "'");
}
-
- function clickSetSource(d) {
- previous = context.background().baseLayerSource();
- d3.event.preventDefault();
- context.background().baseLayerSource(d);
- selectLayer();
- document.activeElement.blur();
+ if (secondaryValue !== "") {
+ secondaryValue = context.cleanTagValue(secondaryValue + '"');
}
-
- function editCustom() {
- d3.event.preventDefault();
- var template = window.prompt(t('background.custom_prompt'), customTemplate);
- if (!template ||
- template.indexOf('google.com') !== -1 ||
- template.indexOf('googleapis.com') !== -1 ||
- template.indexOf('google.ru') !== -1) {
- selectLayer();
- return;
- }
- setCustom(template);
+ tag[field.key] = primaryValue + secondaryValue;
+ }
+ dispatch10.call("change", this, tag);
+ }
+ roadheight.tags = function(tags) {
+ _tags = tags;
+ var primaryValue = tags[field.key];
+ var secondaryValue;
+ var isMixed = Array.isArray(primaryValue);
+ if (!isMixed) {
+ if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
+ secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
+ if (secondaryValue !== null) {
+ secondaryValue = secondaryValue[1];
+ }
+ primaryValue = primaryValue.match(/(-?[\d.]+)'/);
+ if (primaryValue !== null) {
+ primaryValue = primaryValue[1];
+ }
+ _isImperial = true;
+ } else if (primaryValue) {
+ _isImperial = false;
}
+ }
+ setUnitSuggestions();
+ utilGetSetValue(primaryInput, typeof primaryValue === "string" ? primaryValue : "").attr("title", isMixed ? primaryValue.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _t("inspector.unknown")).classed("mixed", isMixed);
+ utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? "0" : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
+ secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
+ };
+ roadheight.focus = function() {
+ primaryInput.node().focus();
+ };
+ roadheight.entityIDs = function(val) {
+ _entityIDs = val;
+ };
+ function combinedEntityExtent() {
+ return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
+ }
+ return utilRebind(roadheight, dispatch10, "on");
+ }
- function setCustom(template) {
- context.background().baseLayerSource(iD.BackgroundSource.Custom(template));
- selectLayer();
- context.storage('background-custom-template', template);
+ // modules/ui/fields/roadspeed.js
+ function uiFieldRoadspeed(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var unitInput = select_default2(null);
+ var input = select_default2(null);
+ var _entityIDs = [];
+ var _tags;
+ var _isImperial;
+ var speedCombo = uiCombobox(context, "roadspeed");
+ var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
+ var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
+ var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
+ function roadspeed(selection2) {
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ input = wrap2.selectAll("input.roadspeed-number").data([0]);
+ input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
+ input.on("change", change).on("blur", change);
+ var loc = combinedEntityExtent().center();
+ _isImperial = roadSpeedUnit(loc) === "mph";
+ unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
+ unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
+ unitInput.on("blur", changeUnits).on("change", changeUnits);
+ function changeUnits() {
+ _isImperial = utilGetSetValue(unitInput) === "mph";
+ utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
+ setUnitSuggestions();
+ change();
+ }
+ }
+ function setUnitSuggestions() {
+ speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
+ utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
+ }
+ function comboValues(d) {
+ return {
+ value: d.toString(),
+ title: d.toString()
+ };
+ }
+ function change() {
+ var tag = {};
+ var value = utilGetSetValue(input).trim();
+ if (!value && Array.isArray(_tags[field.key]))
+ return;
+ if (!value) {
+ tag[field.key] = void 0;
+ } else if (isNaN(value) || !_isImperial) {
+ tag[field.key] = context.cleanTagValue(value);
+ } else {
+ tag[field.key] = context.cleanTagValue(value + " mph");
+ }
+ dispatch10.call("change", this, tag);
+ }
+ roadspeed.tags = function(tags) {
+ _tags = tags;
+ var value = tags[field.key];
+ var isMixed = Array.isArray(value);
+ if (!isMixed) {
+ if (value && value.indexOf("mph") >= 0) {
+ value = parseInt(value, 10).toString();
+ _isImperial = true;
+ } else if (value) {
+ _isImperial = false;
}
+ }
+ setUnitSuggestions();
+ utilGetSetValue(input, typeof value === "string" ? value : "").attr("title", isMixed ? value.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
+ };
+ roadspeed.focus = function() {
+ input.node().focus();
+ };
+ roadspeed.entityIDs = function(val) {
+ _entityIDs = val;
+ };
+ function combinedEntityExtent() {
+ return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
+ }
+ return utilRebind(roadspeed, dispatch10, "on");
+ }
- function clickSetOverlay(d) {
- d3.event.preventDefault();
- context.background().toggleOverlayLayer(d);
- selectLayer();
- document.activeElement.blur();
+ // modules/ui/fields/radio.js
+ function uiFieldRadio(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var placeholder = select_default2(null);
+ var wrap2 = select_default2(null);
+ var labels = select_default2(null);
+ var radios = select_default2(null);
+ var radioData = (field.options || field.keys).slice();
+ var typeField;
+ var layerField;
+ var _oldType = {};
+ var _entityIDs = [];
+ function selectedKey() {
+ var node = wrap2.selectAll(".form-field-input-radio label.active input");
+ return !node.empty() && node.datum();
+ }
+ function radio(selection2) {
+ selection2.classed("preset-radio", true);
+ wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
+ enter.append("span").attr("class", "placeholder");
+ wrap2 = wrap2.merge(enter);
+ placeholder = wrap2.selectAll(".placeholder");
+ labels = wrap2.selectAll("label").data(radioData);
+ enter = labels.enter().append("label");
+ enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d) {
+ return field.t("options." + d, { "default": d });
+ }).attr("checked", false);
+ enter.append("span").html(function(d) {
+ return field.t.html("options." + d, { "default": d });
+ });
+ labels = labels.merge(enter);
+ radios = labels.selectAll("input").on("change", changeRadio);
+ }
+ function structureExtras(selection2, tags) {
+ var selected = selectedKey() || tags.layer !== void 0;
+ var type3 = _mainPresetIndex.field(selected);
+ var layer = _mainPresetIndex.field("layer");
+ var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
+ var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
+ extrasWrap.exit().remove();
+ extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
+ var list = extrasWrap.selectAll("ul").data([0]);
+ list = list.enter().append("ul").attr("class", "rows").merge(list);
+ if (type3) {
+ if (!typeField || typeField.id !== selected) {
+ typeField = uiField(context, type3, _entityIDs, { wrap: false }).on("change", changeType);
+ }
+ typeField.tags(tags);
+ } else {
+ typeField = null;
+ }
+ var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d) {
+ return d.id;
+ });
+ typeItem.exit().remove();
+ var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
+ typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
+ typeEnter.append("div").attr("class", "structure-input-type-wrap");
+ typeItem = typeItem.merge(typeEnter);
+ if (typeField) {
+ typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
+ }
+ if (layer && showLayer) {
+ if (!layerField) {
+ layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
}
-
- function drawList(layerList, type, change, filter) {
- var sources = context.background()
- .sources(context.map().extent())
- .filter(filter);
-
- var layerLinks = layerList.selectAll('li.layer')
- .data(sources, function(d) { return d.name(); });
-
- var enter = layerLinks.enter()
- .insert('li', '.custom_layer')
- .attr('class', 'layer')
- .classed('best', function(d) { return d.best(); });
-
- enter.filter(function(d) { return d.best(); })
- .append('div')
- .attr('class', 'best')
- .call(bootstrap.tooltip()
- .title(t('background.best_imagery'))
- .placement('left'))
- .append('span')
- .html('★');
-
- var label = enter.append('label');
-
- label.append('input')
- .attr('type', type)
- .attr('name', 'layers')
- .on('change', change);
-
- label.append('span')
- .text(function(d) { return d.name(); });
-
-
- layerLinks.exit()
- .remove();
-
- layerList.selectAll('li.layer')
- .sort(sortSources)
- .style('display', layerList.selectAll('li.layer').data().length > 0 ? 'block' : 'none');
+ layerField.tags(tags);
+ field.keys = utilArrayUnion(field.keys, ["layer"]);
+ } else {
+ layerField = null;
+ field.keys = field.keys.filter(function(k) {
+ return k !== "layer";
+ });
+ }
+ var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
+ layerItem.exit().remove();
+ var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
+ layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
+ layerEnter.append("div").attr("class", "structure-input-layer-wrap");
+ layerItem = layerItem.merge(layerEnter);
+ if (layerField) {
+ layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
+ }
+ }
+ function changeType(t, onInput) {
+ var key = selectedKey();
+ if (!key)
+ return;
+ var val = t[key];
+ if (val !== "no") {
+ _oldType[key] = val;
+ }
+ if (field.type === "structureRadio") {
+ if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
+ t.layer = void 0;
}
-
- function update() {
- backgroundList.call(drawList, 'radio', clickSetSource, function(d) { return !d.overlay; });
- overlayList.call(drawList, 'checkbox', clickSetOverlay, function(d) { return d.overlay; });
-
- selectLayer();
-
- var source = context.background().baseLayerSource();
- if (source.id === 'custom') {
- customTemplate = source.template;
- }
-
- updateOffsetVal();
+ if (t.layer === void 0) {
+ if (key === "bridge" && val !== "no") {
+ t.layer = "1";
+ }
+ if (key === "tunnel" && val !== "no" && val !== "building_passage") {
+ t.layer = "-1";
+ }
}
-
- function updateOffsetVal() {
- var meters = iD.geo.offsetToMeters(context.background().offset()),
- x = +meters[0].toFixed(2),
- y = +meters[1].toFixed(2);
-
- d3.selectAll('.nudge-inner-rect')
- .select('input')
- .classed('error', false)
- .property('value', x + ', ' + y);
-
- d3.selectAll('.nudge-reset')
- .classed('disabled', function() {
- return (x === 0 && y === 0);
- });
+ }
+ dispatch10.call("change", this, t, onInput);
+ }
+ function changeLayer(t, onInput) {
+ if (t.layer === "0") {
+ t.layer = void 0;
+ }
+ dispatch10.call("change", this, t, onInput);
+ }
+ function changeRadio() {
+ var t = {};
+ var activeKey;
+ if (field.key) {
+ t[field.key] = void 0;
+ }
+ radios.each(function(d) {
+ var active = select_default2(this).property("checked");
+ if (active)
+ activeKey = d;
+ if (field.key) {
+ if (active)
+ t[field.key] = d;
+ } else {
+ var val = _oldType[activeKey] || "yes";
+ t[d] = active ? val : void 0;
}
-
- function resetOffset() {
- context.background().offset([0, 0]);
- updateOffsetVal();
+ });
+ if (field.type === "structureRadio") {
+ if (activeKey === "bridge") {
+ t.layer = "1";
+ } else if (activeKey === "tunnel" && t.tunnel !== "building_passage") {
+ t.layer = "-1";
+ } else {
+ t.layer = void 0;
}
-
- function nudge(d) {
- context.background().nudge(d, context.map().zoom());
- updateOffsetVal();
+ }
+ dispatch10.call("change", this, t);
+ }
+ radio.tags = function(tags) {
+ function isOptionChecked(d) {
+ if (field.key) {
+ return tags[field.key] === d;
}
-
- function buttonOffset(d) {
- var timeout = window.setTimeout(function() {
- interval = window.setInterval(nudge.bind(null, d), 100);
- }, 500),
- interval;
-
- d3.select(window).on('mouseup', function() {
- window.clearInterval(interval);
- window.clearTimeout(timeout);
- d3.select(window).on('mouseup', null);
- });
-
- nudge(d);
+ return !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
+ }
+ function isMixed(d) {
+ if (field.key) {
+ return Array.isArray(tags[field.key]) && tags[field.key].includes(d);
}
-
- function inputOffset() {
- var input = d3.select(this);
- var d = input.node().value;
-
- if (d === '') return resetOffset();
-
- d = d.replace(/;/g, ',').split(',').map(function(n) {
- // if n is NaN, it will always get mapped to false.
- return !isNaN(n) && n;
- });
-
- if (d.length !== 2 || !d[0] || !d[1]) {
- input.classed('error', true);
- return;
- }
-
- context.background().offset(iD.geo.metersToOffset(d));
- updateOffsetVal();
+ return Array.isArray(tags[d]);
+ }
+ radios.property("checked", function(d) {
+ return isOptionChecked(d) && (field.key || field.options.filter(isOptionChecked).length === 1);
+ });
+ labels.classed("active", function(d) {
+ if (field.key) {
+ return Array.isArray(tags[field.key]) && tags[field.key].includes(d) || tags[field.key] === d;
}
-
- function dragOffset() {
- var origin = [d3.event.clientX, d3.event.clientY];
-
- context.container()
- .append('div')
- .attr('class', 'nudge-surface');
-
- d3.select(window)
- .on('mousemove.offset', function() {
- var latest = [d3.event.clientX, d3.event.clientY];
- var d = [
- -(origin[0] - latest[0]) / 4,
- -(origin[1] - latest[1]) / 4
- ];
-
- origin = latest;
- nudge(d);
- })
- .on('mouseup.offset', function() {
- d3.selectAll('.nudge-surface')
- .remove();
-
- d3.select(window)
- .on('mousemove.offset', null)
- .on('mouseup.offset', null);
- });
-
- d3.event.preventDefault();
+ return Array.isArray(tags[d]) && tags[d].some((v) => typeof v === "string" && v.toLowerCase() !== "no") || !!(typeof tags[d] === "string" && tags[d].toLowerCase() !== "no");
+ }).classed("mixed", isMixed).attr("title", function(d) {
+ return isMixed(d) ? _t("inspector.unshared_value_tooltip") : null;
+ });
+ var selection2 = radios.filter(function() {
+ return this.checked;
+ });
+ if (selection2.empty()) {
+ placeholder.text("");
+ placeholder.call(_t.append("inspector.none"));
+ } else {
+ placeholder.text(selection2.attr("value"));
+ _oldType[selection2.datum()] = tags[selection2.datum()];
+ }
+ if (field.type === "structureRadio") {
+ if (!!tags.waterway && !_oldType.tunnel) {
+ _oldType.tunnel = "culvert";
}
+ wrap2.call(structureExtras, tags);
+ }
+ };
+ radio.focus = function() {
+ radios.node().focus();
+ };
+ radio.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ _oldType = {};
+ return radio;
+ };
+ radio.isAllowed = function() {
+ return _entityIDs.length === 1;
+ };
+ return utilRebind(radio, dispatch10, "on");
+ }
- function hide() {
- setVisible(false);
+ // modules/ui/fields/restrictions.js
+ function uiFieldRestrictions(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var breathe = behaviorBreathe(context);
+ corePreferences("turn-restriction-via-way", null);
+ var storedViaWay = corePreferences("turn-restriction-via-way0");
+ var storedDistance = corePreferences("turn-restriction-distance");
+ var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
+ var _maxDistance = storedDistance ? +storedDistance : 30;
+ var _initialized2 = false;
+ var _parent = select_default2(null);
+ var _container = select_default2(null);
+ var _oldTurns;
+ var _graph;
+ var _vertexID;
+ var _intersection;
+ var _fromWayID;
+ var _lastXPos;
+ function restrictions(selection2) {
+ _parent = selection2;
+ if (_vertexID && (context.graph() !== _graph || !_intersection)) {
+ _graph = context.graph();
+ _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
+ }
+ var isOK = _intersection && _intersection.vertices.length && _intersection.vertices.filter(function(vertex) {
+ return vertex.id === _vertexID;
+ }).length && _intersection.ways.length > 2 && _intersection.ways.filter(function(way) {
+ return way.__to;
+ }).length > 1;
+ select_default2(selection2.node().parentNode).classed("hide", !isOK);
+ if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
+ selection2.call(restrictions.off);
+ return;
+ }
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ var container = wrap2.selectAll(".restriction-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "restriction-container");
+ containerEnter.append("div").attr("class", "restriction-help");
+ _container = containerEnter.merge(container).call(renderViewer);
+ var controls = wrap2.selectAll(".restriction-controls").data([0]);
+ controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
+ }
+ function renderControls(selection2) {
+ var distControl = selection2.selectAll(".restriction-distance").data([0]);
+ distControl.exit().remove();
+ var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
+ distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
+ distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
+ distControlEnter.append("span").attr("class", "restriction-distance-text");
+ selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
+ var val = select_default2(this).property("value");
+ _maxDistance = +val;
+ _intersection = null;
+ _container.selectAll(".layer-osm .layer-turns *").remove();
+ corePreferences("turn-restriction-distance", _maxDistance);
+ _parent.call(restrictions);
+ });
+ selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
+ var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
+ viaControl.exit().remove();
+ var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
+ viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
+ viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
+ viaControlEnter.append("span").attr("class", "restriction-via-way-text");
+ selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
+ var val = select_default2(this).property("value");
+ _maxViaWay = +val;
+ _container.selectAll(".layer-osm .layer-turns *").remove();
+ corePreferences("turn-restriction-via-way0", _maxViaWay);
+ _parent.call(restrictions);
+ });
+ selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
+ }
+ function renderViewer(selection2) {
+ if (!_intersection)
+ return;
+ var vgraph = _intersection.graph;
+ var filter2 = utilFunctor(true);
+ var projection2 = geoRawMercator();
+ var sdims = utilGetDimensions(context.container().select(".sidebar"));
+ var d = [sdims[0] - 50, 370];
+ var c = geoVecScale(d, 0.5);
+ var z = 22;
+ projection2.scale(geoZoomToScale(z));
+ var extent = geoExtent();
+ for (var i2 = 0; i2 < _intersection.vertices.length; i2++) {
+ extent._extend(_intersection.vertices[i2].extent());
+ }
+ var padTop = 35;
+ if (_intersection.vertices.length > 1) {
+ var hPadding = Math.min(160, Math.max(110, d[0] * 0.4));
+ var vPadding = 160;
+ var tl = projection2([extent[0][0], extent[1][1]]);
+ var br = projection2([extent[1][0], extent[0][1]]);
+ var hFactor = (br[0] - tl[0]) / (d[0] - hPadding);
+ var vFactor = (br[1] - tl[1]) / (d[1] - vPadding - padTop);
+ var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
+ var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
+ z = z - Math.max(hZoomDiff, vZoomDiff);
+ projection2.scale(geoZoomToScale(z));
+ }
+ var extentCenter = projection2(extent.center());
+ extentCenter[1] = extentCenter[1] - padTop / 2;
+ projection2.translate(geoVecSubtract(c, extentCenter)).clipExtent([[0, 0], d]);
+ var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d);
+ var drawVertices = svgVertices(projection2, context);
+ var drawLines = svgLines(projection2, context);
+ var drawTurns = svgTurns(projection2, context);
+ var firstTime = selection2.selectAll(".surface").empty();
+ selection2.call(drawLayers);
+ var surface = selection2.selectAll(".surface").classed("tr", true);
+ if (firstTime) {
+ _initialized2 = true;
+ surface.call(breathe);
+ }
+ if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
+ _fromWayID = null;
+ _oldTurns = null;
+ }
+ surface.call(utilSetDimensions, d).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
+ surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
+ surface.selectAll(".selected").classed("selected", false);
+ surface.selectAll(".related").classed("related", false);
+ var way;
+ if (_fromWayID) {
+ way = vgraph.entity(_fromWayID);
+ surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
+ }
+ document.addEventListener("resizeWindow", function() {
+ utilSetDimensions(_container, null);
+ redraw(1);
+ }, false);
+ updateHints(null);
+ function click(d3_event) {
+ surface.call(breathe.off).call(breathe);
+ var datum2 = d3_event.target.__data__;
+ var entity = datum2 && datum2.properties && datum2.properties.entity;
+ if (entity) {
+ datum2 = entity;
+ }
+ if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
+ _fromWayID = datum2.id;
+ _oldTurns = null;
+ redraw();
+ } else if (datum2 instanceof osmTurn) {
+ var actions, extraActions, turns, i3;
+ var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
+ if (datum2.restrictionID && !datum2.direct) {
+ return;
+ } else if (datum2.restrictionID && !datum2.only) {
+ var seen = {};
+ var datumOnly = JSON.parse(JSON.stringify(datum2));
+ datumOnly.only = true;
+ restrictionType = restrictionType.replace(/^no/, "only");
+ turns = _intersection.turns(_fromWayID, 2);
+ extraActions = [];
+ _oldTurns = [];
+ for (i3 = 0; i3 < turns.length; i3++) {
+ var turn = turns[i3];
+ if (seen[turn.restrictionID])
+ continue;
+ if (turn.direct && turn.path[1] === datum2.path[1]) {
+ seen[turns[i3].restrictionID] = true;
+ turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
+ _oldTurns.push(turn);
+ extraActions.push(actionUnrestrictTurn(turn));
+ }
+ }
+ actions = _intersection.actions.concat(extraActions, [
+ actionRestrictTurn(datumOnly, restrictionType),
+ _t("operations.restriction.annotation.create")
+ ]);
+ } else if (datum2.restrictionID) {
+ turns = _oldTurns || [];
+ extraActions = [];
+ for (i3 = 0; i3 < turns.length; i3++) {
+ if (turns[i3].key !== datum2.key) {
+ extraActions.push(actionRestrictTurn(turns[i3], turns[i3].restrictionType));
+ }
+ }
+ _oldTurns = null;
+ actions = _intersection.actions.concat(extraActions, [
+ actionUnrestrictTurn(datum2),
+ _t("operations.restriction.annotation.delete")
+ ]);
+ } else {
+ actions = _intersection.actions.concat([
+ actionRestrictTurn(datum2, restrictionType),
+ _t("operations.restriction.annotation.create")
+ ]);
+ }
+ context.perform.apply(context, actions);
+ var s = surface.selectAll("." + datum2.key);
+ datum2 = s.empty() ? null : s.datum();
+ updateHints(datum2);
+ } else {
+ _fromWayID = null;
+ _oldTurns = null;
+ redraw();
}
-
- function toggle() {
- if (d3.event) d3.event.preventDefault();
- tooltip.hide(button);
- setVisible(!button.classed('active'));
+ }
+ function mouseover(d3_event) {
+ var datum2 = d3_event.target.__data__;
+ updateHints(datum2);
+ }
+ _lastXPos = _lastXPos || sdims[0];
+ function redraw(minChange) {
+ var xPos = -1;
+ if (minChange) {
+ xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
+ }
+ if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
+ if (context.hasEntity(_vertexID)) {
+ _lastXPos = xPos;
+ _container.call(renderViewer);
+ }
}
-
- function quickSwitch() {
- if (previous) {
- clickSetSource(previous);
+ }
+ function highlightPathsFrom(wayID) {
+ surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
+ surface.selectAll("." + wayID).classed("related", true);
+ if (wayID) {
+ var turns = _intersection.turns(wayID, _maxViaWay);
+ for (var i3 = 0; i3 < turns.length; i3++) {
+ var turn = turns[i3];
+ var ids = [turn.to.way];
+ var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
+ if (turn.only || turns.length === 1) {
+ if (turn.via.ways) {
+ ids = ids.concat(turn.via.ways);
+ }
+ } else if (turn.to.way === wayID) {
+ continue;
}
+ surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
+ }
}
-
- function setVisible(show) {
- if (show !== shown) {
- button.classed('active', show);
- shown = show;
-
- if (show) {
- selection.on('mousedown.background-inside', function() {
- return d3.event.stopPropagation();
- });
- content.style('display', 'block')
- .style('right', '-300px')
- .transition()
- .duration(200)
- .style('right', '0px');
- } else {
- content.style('display', 'block')
- .style('right', '0px')
- .transition()
- .duration(200)
- .style('right', '-300px')
- .each('end', function() {
- d3.select(this).style('display', 'none');
- });
- selection.on('mousedown.background-inside', null);
- }
+ }
+ function updateHints(datum2) {
+ var help = _container.selectAll(".restriction-help").html("");
+ var placeholders = {};
+ ["from", "via", "to"].forEach(function(k) {
+ placeholders[k] = { html: '' + _t("restriction.help." + k) + "" };
+ });
+ var entity = datum2 && datum2.properties && datum2.properties.entity;
+ if (entity) {
+ datum2 = entity;
+ }
+ if (_fromWayID) {
+ way = vgraph.entity(_fromWayID);
+ surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
+ }
+ if (datum2 instanceof osmWay && datum2.__from) {
+ way = datum2;
+ highlightPathsFrom(_fromWayID ? null : way.id);
+ surface.selectAll("." + way.id).classed("related", true);
+ var clickSelect = !_fromWayID || _fromWayID !== way.id;
+ help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
+ from: placeholders.from,
+ fromName: displayName(way.id, vgraph)
+ }));
+ } else if (datum2 instanceof osmTurn) {
+ var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
+ var turnType = restrictionType.replace(/^(only|no)\_/, "");
+ var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
+ var klass, turnText, nextText;
+ if (datum2.no) {
+ klass = "restrict";
+ turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
+ nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
+ } else if (datum2.only) {
+ klass = "only";
+ turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
+ nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
+ } else {
+ klass = "allow";
+ turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
+ nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
+ }
+ help.append("div").attr("class", "qualifier " + klass).html(turnText);
+ help.append("div").html(_t.html("restriction.help.from_name_to_name", {
+ from: placeholders.from,
+ fromName: displayName(datum2.from.way, vgraph),
+ to: placeholders.to,
+ toName: displayName(datum2.to.way, vgraph)
+ }));
+ if (datum2.via.ways && datum2.via.ways.length) {
+ var names = [];
+ for (var i3 = 0; i3 < datum2.via.ways.length; i3++) {
+ var prev = names[names.length - 1];
+ var curr = displayName(datum2.via.ways[i3], vgraph);
+ if (!prev || curr !== prev) {
+ names.push(curr);
+ }
}
+ help.append("div").html(_t.html("restriction.help.via_names", {
+ via: placeholders.via,
+ viaNames: names.join(", ")
+ }));
+ }
+ if (!indirect) {
+ help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
+ }
+ highlightPathsFrom(null);
+ var alongIDs = datum2.path.slice();
+ surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
+ } else {
+ highlightPathsFrom(null);
+ if (_fromWayID) {
+ help.append("div").html(_t.html("restriction.help.from_name", {
+ from: placeholders.from,
+ fromName: displayName(_fromWayID, vgraph)
+ }));
+ } else {
+ help.append("div").html(_t.html("restriction.help.select_from", {
+ from: placeholders.from
+ }));
+ }
}
-
-
- var content = selection.append('div')
- .attr('class', 'fillL map-overlay col3 content hide'),
- tooltip = bootstrap.tooltip()
- .placement('left')
- .html(true)
- .title(iD.ui.tooltipHtml(t('background.description'), key)),
- button = selection.append('button')
- .attr('tabindex', -1)
- .on('click', toggle)
- .call(iD.svg.Icon('#icon-layers', 'light'))
- .call(tooltip),
- shown = false;
-
-
- /* opacity switcher */
-
- var opa = content.append('div')
- .attr('class', 'opacity-options-wrapper');
-
- opa.append('h4')
- .text(t('background.title'));
-
- var opacityList = opa.append('ul')
- .attr('class', 'opacity-options');
-
- opacityList.selectAll('div.opacity')
- .data(opacities)
- .enter()
- .append('li')
- .attr('data-original-title', function(d) {
- return t('background.percent_brightness', { opacity: (d * 100) });
- })
- .on('click.set-opacity', setOpacity)
- .html('')
- .call(bootstrap.tooltip()
- .placement('left'))
- .append('div')
- .attr('class', 'opacity')
- .style('opacity', function(d) { return 1.25 - d; });
-
-
- /* background switcher */
-
- var backgroundList = content.append('ul')
- .attr('class', 'layer-list');
-
- var custom = backgroundList.append('li')
- .attr('class', 'custom_layer')
- .datum(iD.BackgroundSource.Custom());
-
- custom.append('button')
- .attr('class', 'layer-browse')
- .call(bootstrap.tooltip()
- .title(t('background.custom_button'))
- .placement('left'))
- .on('click', editCustom)
- .call(iD.svg.Icon('#icon-search'));
-
- var label = custom.append('label');
-
- label.append('input')
- .attr('type', 'radio')
- .attr('name', 'layers')
- .on('change', function () {
- if (customTemplate) {
- setCustom(customTemplate);
- } else {
- editCustom();
- }
- });
-
- label.append('span')
- .text(t('background.custom'));
-
- content.append('div')
- .attr('class', 'imagery-faq')
- .append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-out-link', 'inline'))
- .attr('href', 'https://github.com/openstreetmap/iD/blob/master/FAQ.md#how-can-i-report-an-issue-with-background-imagery')
- .append('span')
- .text(t('background.imagery_source_faq'));
-
- var overlayList = content.append('ul')
- .attr('class', 'layer-list');
-
- var controls = content.append('div')
- .attr('class', 'controls-list');
-
-
- /* minimap toggle */
-
- var minimapLabel = controls
- .append('label')
- .call(bootstrap.tooltip()
- .html(true)
- .title(iD.ui.tooltipHtml(t('background.minimap.tooltip'), '/'))
- .placement('top')
- );
-
- minimapLabel.classed('minimap-toggle', true)
- .append('input')
- .attr('type', 'checkbox')
- .on('change', function() {
- iD.ui.MapInMap.toggle();
- d3.event.preventDefault();
- });
-
- minimapLabel.append('span')
- .text(t('background.minimap.description'));
-
-
- /* imagery offset controls */
-
- var adjustments = content.append('div')
- .attr('class', 'adjustments');
-
- adjustments.append('a')
- .text(t('background.fix_misalignment'))
- .attr('href', '#')
- .classed('hide-toggle', true)
- .classed('expanded', false)
- .on('click', function() {
- var exp = d3.select(this).classed('expanded');
- nudgeContainer.style('display', exp ? 'none' : 'block');
- d3.select(this).classed('expanded', !exp);
- d3.event.preventDefault();
- });
-
- var nudgeContainer = adjustments.append('div')
- .attr('class', 'nudge-container cf')
- .style('display', 'none');
-
- nudgeContainer.append('div')
- .attr('class', 'nudge-instructions')
- .text(t('background.offset'));
-
- var nudgeRect = nudgeContainer.append('div')
- .attr('class', 'nudge-outer-rect')
- .on('mousedown', dragOffset);
-
- nudgeRect.append('div')
- .attr('class', 'nudge-inner-rect')
- .append('input')
- .on('change', inputOffset)
- .on('mousedown', function() {
- d3.event.stopPropagation();
- });
-
- nudgeContainer.append('div')
- .selectAll('button')
- .data(directions).enter()
- .append('button')
- .attr('class', function(d) { return d[0] + ' nudge'; })
- .on('mousedown', function(d) {
- buttonOffset(d[1]);
- });
-
- nudgeContainer.append('button')
- .attr('title', t('background.reset'))
- .attr('class', 'nudge-reset disabled')
- .on('click', resetOffset)
- .call(iD.svg.Icon('#icon-undo'));
-
- context.map()
- .on('move.background-update', _.debounce(update, 1000));
-
- context.background()
- .on('change.background-update', update);
-
-
- update();
- setOpacity(opacityDefault);
-
- var keybinding = d3.keybinding('background')
- .on(key, toggle)
- .on(iD.ui.cmd('âB'), quickSwitch)
- .on('F', hide)
- .on('H', hide);
-
- d3.select(document)
- .call(keybinding);
-
- context.surface().on('mousedown.background-outside', hide);
- context.container().on('mousedown.background-outside', hide);
- }
-
- return background;
-};
-// Translate a MacOS key command into the appropriate Windows/Linux equivalent.
-// For example, âZ -> Ctrl+Z
-iD.ui.cmd = function(code) {
- if (iD.detect().os === 'mac') {
- return code;
- }
-
- if (iD.detect().os === 'win') {
- if (code === 'ââ§Z') return 'Ctrl+Y';
+ }
}
-
- var result = '',
- replacements = {
- 'â': 'Ctrl',
- 'â§': 'Shift',
- 'â¥': 'Alt',
- 'â«': 'Backspace',
- 'â¦': 'Delete'
- };
-
- for (var i = 0; i < code.length; i++) {
- if (code[i] in replacements) {
- result += replacements[code[i]] + '+';
+ function displayMaxDistance(maxDist) {
+ return (selection2) => {
+ var isImperial = !_mainLocalizer.usesMetric();
+ var opts;
+ if (isImperial) {
+ var distToFeet = {
+ 20: 70,
+ 25: 85,
+ 30: 100,
+ 35: 115,
+ 40: 130,
+ 45: 145,
+ 50: 160
+ }[maxDist];
+ opts = { distance: _t("units.feet", { quantity: distToFeet }) };
} else {
- result += code[i];
+ opts = { distance: _t("units.meters", { quantity: maxDist }) };
}
+ return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
+ };
}
+ function displayMaxVia(maxVia) {
+ return (selection2) => {
+ selection2 = selection2.html("");
+ return maxVia === 0 ? selection2.call(_t.append("restriction.controls.via_node_only")) : maxVia === 1 ? selection2.call(_t.append("restriction.controls.via_up_to_one")) : selection2.call(_t.append("restriction.controls.via_up_to_two"));
+ };
+ }
+ function displayName(entityID, graph) {
+ var entity = graph.entity(entityID);
+ var name2 = utilDisplayName(entity) || "";
+ var matched = _mainPresetIndex.match(entity, graph);
+ var type3 = matched && matched.name() || utilDisplayType(entity.id);
+ return name2 || type3;
+ }
+ restrictions.entityIDs = function(val) {
+ _intersection = null;
+ _fromWayID = null;
+ _oldTurns = null;
+ _vertexID = val[0];
+ };
+ restrictions.tags = function() {
+ };
+ restrictions.focus = function() {
+ };
+ restrictions.off = function(selection2) {
+ if (!_initialized2)
+ return;
+ selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
+ select_default2(window).on("resize.restrictions", null);
+ };
+ return utilRebind(restrictions, dispatch10, "on");
+ }
+ uiFieldRestrictions.supportsMultiselection = false;
+
+ // modules/ui/fields/textarea.js
+ function uiFieldTextarea(field, context) {
+ var dispatch10 = dispatch_default("change");
+ var input = select_default2(null);
+ var _tags;
+ function textarea(selection2) {
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ input = wrap2.selectAll("textarea").data([0]);
+ input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
+ }
+ function change(onInput) {
+ return function() {
+ var val = utilGetSetValue(input);
+ if (!onInput)
+ val = context.cleanTagValue(val);
+ if (!val && Array.isArray(_tags[field.key]))
+ return;
+ var t = {};
+ t[field.key] = val || void 0;
+ dispatch10.call("change", this, t, onInput);
+ };
+ }
+ textarea.tags = function(tags) {
+ _tags = tags;
+ var isMixed = Array.isArray(tags[field.key]);
+ utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
+ };
+ textarea.focus = function() {
+ input.node().focus();
+ };
+ return utilRebind(textarea, dispatch10, "on");
+ }
- return result;
-};
-iD.ui.Commit = function(context) {
- var dispatch = d3.dispatch('cancel', 'save');
-
- function commit(selection) {
- var changes = context.history().changes(),
- summary = context.history().difference().summary();
-
- function zoomToEntity(change) {
- var entity = change.entity;
- if (change.changeType !== 'deleted' &&
- context.graph().entity(entity.id).geometry(context.graph()) !== 'vertex') {
- context.map().zoomTo(entity);
- context.surface().selectAll(
- iD.util.entityOrMemberSelector([entity.id], context.graph()))
- .classed('hover', true);
- }
- }
-
- var header = selection.append('div')
- .attr('class', 'header fillL');
-
- header.append('h3')
- .text(t('commit.title'));
-
- var body = selection.append('div')
- .attr('class', 'body');
-
-
- // Comment Section
- var commentSection = body.append('div')
- .attr('class', 'modal-section form-field commit-form');
-
- commentSection.append('label')
- .attr('class', 'form-label')
- .text(t('commit.message_label'));
-
- var commentField = commentSection.append('textarea')
- .attr('placeholder', t('commit.description_placeholder'))
- .attr('maxlength', 255)
- .property('value', context.storage('comment') || '')
- .on('input.save', checkComment)
- .on('change.save', checkComment)
- .on('blur.save', function() {
- context.storage('comment', this.value);
- });
-
- function checkComment() {
- d3.selectAll('.save-section .save-button')
- .attr('disabled', (this.value.length ? null : true));
-
- var googleWarning = clippyArea
- .html('')
- .selectAll('a')
- .data(this.value.match(/google/i) ? [true] : []);
-
- googleWarning.exit().remove();
-
- googleWarning.enter()
- .append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-alert', 'inline'))
- .attr('href', t('commit.google_warning_link'))
- .append('span')
- .text(t('commit.google_warning'));
+ // modules/ui/fields/wikidata.js
+ function uiFieldWikidata(field, context) {
+ var wikidata = services.wikidata;
+ var dispatch10 = dispatch_default("change");
+ var _selection = select_default2(null);
+ var _searchInput = select_default2(null);
+ var _qid = null;
+ var _wikidataEntity = null;
+ var _wikiURL = "";
+ var _entityIDs = [];
+ var _wikipediaKey = field.keys && field.keys.find(function(key) {
+ return key.includes("wikipedia");
+ }), _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
+ var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
+ function wiki(selection2) {
+ _selection = selection2;
+ var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
+ var list = wrap2.selectAll("ul").data([0]);
+ list = list.enter().append("ul").attr("class", "rows").merge(list);
+ var searchRow = list.selectAll("li.wikidata-search").data([0]);
+ var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
+ searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
+ var node = select_default2(this).node();
+ node.setSelectionRange(0, node.value.length);
+ }).on("blur", function() {
+ setLabelForEntity();
+ }).call(combobox.fetcher(fetchWikidataItems));
+ combobox.on("accept", function(d) {
+ if (d) {
+ _qid = d.id;
+ change();
+ }
+ }).on("cancel", function() {
+ setLabelForEntity();
+ });
+ searchRowEnter.append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikidata.org" })).call(svgIcon("#iD-icon-out-link")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ if (_wikiURL)
+ window.open(_wikiURL, "_blank");
+ });
+ searchRow = searchRow.merge(searchRowEnter);
+ _searchInput = searchRow.select("input");
+ var wikidataProperties = ["description", "identifier"];
+ var items = list.selectAll("li.labeled-input").data(wikidataProperties);
+ var enter = items.enter().append("li").attr("class", function(d) {
+ return "labeled-input preset-wikidata-" + d;
+ });
+ enter.append("span").attr("class", "label").html(function(d) {
+ return _t.html("wikidata." + d);
+ });
+ enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
+ enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ select_default2(this.parentNode).select("input").node().select();
+ document.execCommand("copy");
+ });
+ }
+ function fetchWikidataItems(q, callback) {
+ if (!q && _hintKey) {
+ for (var i2 in _entityIDs) {
+ var entity = context.hasEntity(_entityIDs[i2]);
+ if (entity.tags[_hintKey]) {
+ q = entity.tags[_hintKey];
+ break;
+ }
}
-
- commentField.node().select();
-
- context.connection().userChangesets(function (err, changesets) {
- if (err) return;
-
- var comments = [];
-
- for (var i = 0; i < changesets.length; i++) {
- if (changesets[i].tags.comment) {
- comments.push({
- title: changesets[i].tags.comment,
- value: changesets[i].tags.comment
- });
- }
- }
-
- commentField.call(d3.combobox().caseSensitive(true).data(comments));
- });
-
- var clippyArea = commentSection.append('div')
- .attr('class', 'clippy-area');
-
-
- var changeSetInfo = commentSection.append('div')
- .attr('class', 'changeset-info');
-
- changeSetInfo.append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-out-link', 'inline'))
- .attr('href', t('commit.about_changeset_comments_link'))
- .append('span')
- .text(t('commit.about_changeset_comments'));
-
- // Warnings
- var warnings = body.selectAll('div.warning-section')
- .data([context.history().validate(changes)])
- .enter()
- .append('div')
- .attr('class', 'modal-section warning-section fillL2')
- .style('display', function(d) { return _.isEmpty(d) ? 'none' : null; })
- .style('background', '#ffb');
-
- warnings.append('h3')
- .text(t('commit.warnings'));
-
- var warningLi = warnings.append('ul')
- .attr('class', 'changeset-list')
- .selectAll('li')
- .data(function(d) { return d; })
- .enter()
- .append('li')
- .style()
- .on('mouseover', mouseover)
- .on('mouseout', mouseout)
- .on('click', warningClick);
-
- warningLi
- .call(iD.svg.Icon('#icon-alert', 'pre-text'));
-
- warningLi
- .append('strong').text(function(d) {
- return d.message;
- });
-
- warningLi.filter(function(d) { return d.tooltip; })
- .call(bootstrap.tooltip()
- .title(function(d) { return d.tooltip; })
- .placement('top')
- );
-
-
- // Upload Explanation
- var saveSection = body.append('div')
- .attr('class','modal-section save-section fillL cf');
-
- var prose = saveSection.append('p')
- .attr('class', 'commit-info')
- .html(t('commit.upload_explanation'));
-
- context.connection().userDetails(function(err, user) {
- if (err) return;
-
- var userLink = d3.select(document.createElement('div'));
-
- if (user.image_url) {
- userLink.append('img')
- .attr('src', user.image_url)
- .attr('class', 'icon pre-text user-icon');
- }
-
- userLink.append('a')
- .attr('class','user-info')
- .text(user.display_name)
- .attr('href', context.connection().userURL(user.display_name))
- .attr('tabindex', -1)
- .attr('target', '_blank');
-
- prose.html(t('commit.upload_explanation_with_user', {user: userLink.html()}));
- });
-
-
- // Buttons
- var buttonSection = saveSection.append('div')
- .attr('class','buttons fillL cf');
-
- var cancelButton = buttonSection.append('button')
- .attr('class', 'secondary-action col5 button cancel-button')
- .on('click.cancel', function() { dispatch.cancel(); });
-
- cancelButton.append('span')
- .attr('class', 'label')
- .text(t('commit.cancel'));
-
- var saveButton = buttonSection.append('button')
- .attr('class', 'action col5 button save-button')
- .attr('disabled', function() {
- var n = d3.select('.commit-form textarea').node();
- return (n && n.value.length) ? null : true;
- })
- .on('click.save', function() {
- dispatch.save({
- comment: commentField.node().value
- });
- });
-
- saveButton.append('span')
- .attr('class', 'label')
- .text(t('commit.save'));
-
-
- // Changes
- var changeSection = body.selectAll('div.commit-section')
- .data([0])
- .enter()
- .append('div')
- .attr('class', 'commit-section modal-section fillL2');
-
- changeSection.append('h3')
- .text(t('commit.changes', {count: summary.length}));
-
- var li = changeSection.append('ul')
- .attr('class', 'changeset-list')
- .selectAll('li')
- .data(summary)
- .enter()
- .append('li')
- .on('mouseover', mouseover)
- .on('mouseout', mouseout)
- .on('click', zoomToEntity);
-
- li.each(function(d) {
- d3.select(this)
- .call(iD.svg.Icon('#icon-' + d.entity.geometry(d.graph), 'pre-text ' + d.changeType));
- });
-
- li.append('span')
- .attr('class', 'change-type')
- .text(function(d) {
- return t('commit.' + d.changeType) + ' ';
- });
-
- li.append('strong')
- .attr('class', 'entity-type')
- .text(function(d) {
- return context.presets().match(d.entity, d.graph).name();
- });
-
- li.append('span')
- .attr('class', 'entity-name')
- .text(function(d) {
- var name = iD.util.displayName(d.entity) || '',
- string = '';
- if (name !== '') string += ':';
- return string += ' ' + name;
+ }
+ wikidata.itemsForSearchQuery(q, function(err, data) {
+ if (err)
+ return;
+ for (var i3 in data) {
+ data[i3].value = data[i3].label + " (" + data[i3].id + ")";
+ data[i3].title = data[i3].description;
+ }
+ if (callback)
+ callback(data);
+ });
+ }
+ function change() {
+ var syncTags = {};
+ syncTags[field.key] = _qid;
+ dispatch10.call("change", this, syncTags);
+ var initGraph = context.graph();
+ var initEntityIDs = _entityIDs;
+ wikidata.entityByQID(_qid, function(err, entity) {
+ if (err)
+ return;
+ if (context.graph() !== initGraph)
+ return;
+ if (!entity.sitelinks)
+ return;
+ var langs = wikidata.languagesToQuery();
+ ["labels", "descriptions"].forEach(function(key) {
+ if (!entity[key])
+ return;
+ var valueLangs = Object.keys(entity[key]);
+ if (valueLangs.length === 0)
+ return;
+ var valueLang = valueLangs[0];
+ if (langs.indexOf(valueLang) === -1) {
+ langs.push(valueLang);
+ }
+ });
+ var newWikipediaValue;
+ if (_wikipediaKey) {
+ var foundPreferred;
+ for (var i2 in langs) {
+ var lang = langs[i2];
+ var siteID = lang.replace("-", "_") + "wiki";
+ if (entity.sitelinks[siteID]) {
+ foundPreferred = true;
+ newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
+ break;
+ }
+ }
+ if (!foundPreferred) {
+ var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
+ return site.endsWith("wiki");
});
-
- li.style('opacity', 0)
- .transition()
- .style('opacity', 1);
-
-
- function mouseover(d) {
- if (d.entity) {
- context.surface().selectAll(
- iD.util.entityOrMemberSelector([d.entity.id], context.graph())
- ).classed('hover', true);
+ if (wikiSiteKeys.length === 0) {
+ newWikipediaValue = null;
+ } else {
+ var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
+ var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
+ newWikipediaValue = wikiLang + ":" + wikiTitle;
}
+ }
}
-
- function mouseout() {
- context.surface().selectAll('.hover')
- .classed('hover', false);
+ if (newWikipediaValue) {
+ newWikipediaValue = context.cleanTagValue(newWikipediaValue);
}
-
- function warningClick(d) {
- if (d.entity) {
- context.map().zoomTo(d.entity);
- context.enter(
- iD.modes.Select(context, [d.entity.id])
- .suppressMenu(true));
- }
+ if (typeof newWikipediaValue === "undefined")
+ return;
+ var actions = initEntityIDs.map(function(entityID) {
+ var entity2 = context.hasEntity(entityID);
+ if (!entity2)
+ return null;
+ var currTags = Object.assign({}, entity2.tags);
+ if (newWikipediaValue === null) {
+ if (!currTags[_wikipediaKey])
+ return null;
+ delete currTags[_wikipediaKey];
+ } else {
+ currTags[_wikipediaKey] = newWikipediaValue;
+ }
+ return actionChangeTags(entityID, currTags);
+ }).filter(Boolean);
+ if (!actions.length)
+ return;
+ context.overwrite(function actionUpdateWikipediaTags(graph) {
+ actions.forEach(function(action) {
+ graph = action(graph);
+ });
+ return graph;
+ }, context.history().undoAnnotation());
+ });
+ }
+ function setLabelForEntity() {
+ var label = "";
+ if (_wikidataEntity) {
+ label = entityPropertyForDisplay(_wikidataEntity, "labels");
+ if (label.length === 0) {
+ label = _wikidataEntity.id.toString();
}
-
- // Call checkComment off the bat, in case a changeset
- // comment is recovered from localStorage
- commentField.trigger('input');
+ }
+ utilGetSetValue(_searchInput, label);
}
-
- return d3.rebind(commit, dispatch, 'on');
-};
-iD.ui.confirm = function(selection) {
- var modal = iD.ui.modal(selection);
-
- modal.select('.modal')
- .classed('modal-alert', true);
-
- var section = modal.select('.content');
-
- section.append('div')
- .attr('class', 'modal-section header');
-
- section.append('div')
- .attr('class', 'modal-section message-text');
-
- var buttons = section.append('div')
- .attr('class', 'modal-section buttons cf');
-
- modal.okButton = function() {
- buttons
- .append('button')
- .attr('class', 'action col4')
- .on('click.confirm', function() {
- modal.remove();
- })
- .text(t('confirm.okay'));
-
- return modal;
- };
-
- return modal;
-};
-iD.ui.Conflicts = function(context) {
- var dispatch = d3.dispatch('download', 'cancel', 'save'),
- list;
-
- function conflicts(selection) {
- var header = selection
- .append('div')
- .attr('class', 'header fillL');
-
- header
- .append('button')
- .attr('class', 'fr')
- .on('click', function() { dispatch.cancel(); })
- .call(iD.svg.Icon('#icon-close'));
-
- header
- .append('h3')
- .text(t('save.conflict.header'));
-
- var body = selection
- .append('div')
- .attr('class', 'body fillL');
-
- body
- .append('div')
- .attr('class', 'conflicts-help')
- .text(t('save.conflict.help'))
- .append('a')
- .attr('class', 'conflicts-download')
- .text(t('save.conflict.download_changes'))
- .on('click.download', function() { dispatch.download(); });
-
- body
- .append('div')
- .attr('class', 'conflict-container fillL3')
- .call(showConflict, 0);
-
- body
- .append('div')
- .attr('class', 'conflicts-done')
- .attr('opacity', 0)
- .style('display', 'none')
- .text(t('save.conflict.done'));
-
- var buttons = body
- .append('div')
- .attr('class','buttons col12 joined conflicts-buttons');
-
- buttons
- .append('button')
- .attr('disabled', list.length > 1)
- .attr('class', 'action conflicts-button col6')
- .text(t('save.title'))
- .on('click.try_again', function() { dispatch.save(); });
-
- buttons
- .append('button')
- .attr('class', 'secondary-action conflicts-button col6')
- .text(t('confirm.cancel'))
- .on('click.cancel', function() { dispatch.cancel(); });
- }
-
-
- function showConflict(selection, index) {
- if (index < 0 || index >= list.length) return;
-
- var parent = d3.select(selection.node().parentNode);
-
- // enable save button if this is the last conflict being reviewed..
- if (index === list.length - 1) {
- window.setTimeout(function() {
- parent.select('.conflicts-button')
- .attr('disabled', null);
-
- parent.select('.conflicts-done')
- .transition()
- .attr('opacity', 1)
- .style('display', 'block');
- }, 250);
- }
-
- var item = selection
- .selectAll('.conflict')
- .data([list[index]]);
-
- var enter = item.enter()
- .append('div')
- .attr('class', 'conflict');
-
- enter
- .append('h4')
- .attr('class', 'conflict-count')
- .text(t('save.conflict.count', { num: index + 1, total: list.length }));
-
- enter
- .append('a')
- .attr('class', 'conflict-description')
- .attr('href', '#')
- .text(function(d) { return d.name; })
- .on('click', function(d) {
- zoomToEntity(d.id);
- d3.event.preventDefault();
- });
-
- var details = enter
- .append('div')
- .attr('class', 'conflict-detail-container');
-
- details
- .append('ul')
- .attr('class', 'conflict-detail-list')
- .selectAll('li')
- .data(function(d) { return d.details || []; })
- .enter()
- .append('li')
- .attr('class', 'conflict-detail-item')
- .html(function(d) { return d; });
-
- details
- .append('div')
- .attr('class', 'conflict-choices')
- .call(addChoices);
-
- details
- .append('div')
- .attr('class', 'conflict-nav-buttons joined cf')
- .selectAll('button')
- .data(['previous', 'next'])
- .enter()
- .append('button')
- .text(function(d) { return t('save.conflict.' + d); })
- .attr('class', 'conflict-nav-button action col6')
- .attr('disabled', function(d, i) {
- return (i === 0 && index === 0) ||
- (i === 1 && index === list.length - 1) || null;
- })
- .on('click', function(d, i) {
- var container = parent.select('.conflict-container'),
- sign = (i === 0 ? -1 : 1);
-
- container
- .selectAll('.conflict')
- .remove();
-
- container
- .call(showConflict, index + sign);
-
- d3.event.preventDefault();
- });
-
- item.exit()
- .remove();
-
+ wiki.tags = function(tags) {
+ var isMixed = Array.isArray(tags[field.key]);
+ _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
+ _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
+ if (!/^Q[0-9]*$/.test(_qid)) {
+ unrecognized();
+ return;
+ }
+ _wikiURL = "https://wikidata.org/wiki/" + _qid;
+ wikidata.entityByQID(_qid, function(err, entity) {
+ if (err) {
+ unrecognized();
+ return;
+ }
+ _wikidataEntity = entity;
+ setLabelForEntity();
+ var description2 = entityPropertyForDisplay(entity, "descriptions");
+ _selection.select("button.wiki-link").classed("disabled", false);
+ _selection.select(".preset-wikidata-description").style("display", function() {
+ return description2.length > 0 ? "flex" : "none";
+ }).select("input").attr("value", description2);
+ _selection.select(".preset-wikidata-identifier").style("display", function() {
+ return entity.id ? "flex" : "none";
+ }).select("input").attr("value", entity.id);
+ });
+ function unrecognized() {
+ _wikidataEntity = null;
+ setLabelForEntity();
+ _selection.select(".preset-wikidata-description").style("display", "none");
+ _selection.select(".preset-wikidata-identifier").style("display", "none");
+ _selection.select("button.wiki-link").classed("disabled", true);
+ if (_qid && _qid !== "") {
+ _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
+ } else {
+ _wikiURL = "";
+ }
+ }
+ };
+ function entityPropertyForDisplay(wikidataEntity, propKey) {
+ if (!wikidataEntity[propKey])
+ return "";
+ var propObj = wikidataEntity[propKey];
+ var langKeys = Object.keys(propObj);
+ if (langKeys.length === 0)
+ return "";
+ var langs = wikidata.languagesToQuery();
+ for (var i2 in langs) {
+ var lang = langs[i2];
+ var valueObj = propObj[lang];
+ if (valueObj && valueObj.value && valueObj.value.length > 0)
+ return valueObj.value;
+ }
+ return propObj[langKeys[0]].value;
}
+ wiki.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return wiki;
+ };
+ wiki.focus = function() {
+ _searchInput.node().focus();
+ };
+ return utilRebind(wiki, dispatch10, "on");
+ }
- function addChoices(selection) {
- var choices = selection
- .append('ul')
- .attr('class', 'layer-list')
- .selectAll('li')
- .data(function(d) { return d.choices || []; });
-
- var enter = choices.enter()
- .append('li')
- .attr('class', 'layer');
-
- var label = enter
- .append('label');
-
- label
- .append('input')
- .attr('type', 'radio')
- .attr('name', function(d) { return d.id; })
- .on('change', function(d, i) {
- var ul = this.parentNode.parentNode.parentNode;
- ul.__data__.chosen = i;
- choose(ul, d);
- });
-
- label
- .append('span')
- .text(function(d) { return d.text; });
-
- choices
- .each(function(d, i) {
- var ul = this.parentNode;
- if (ul.__data__.chosen === i) choose(ul, d);
- });
+ // modules/ui/fields/wikipedia.js
+ function uiFieldWikipedia(field, context) {
+ const dispatch10 = dispatch_default("change");
+ const wikipedia = services.wikipedia;
+ const wikidata = services.wikidata;
+ let _langInput = select_default2(null);
+ let _titleInput = select_default2(null);
+ let _wikiURL = "";
+ let _entityIDs;
+ let _tags;
+ let _dataWikipedia = [];
+ _mainFileFetcher.get("wmf_sitematrix").then((d) => {
+ _dataWikipedia = d;
+ if (_tags)
+ updateForTags(_tags);
+ }).catch(() => {
+ });
+ const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
+ const v = value.toLowerCase();
+ callback(_dataWikipedia.filter((d) => {
+ return d[0].toLowerCase().indexOf(v) >= 0 || d[1].toLowerCase().indexOf(v) >= 0 || d[2].toLowerCase().indexOf(v) >= 0;
+ }).map((d) => ({ value: d[1] })));
+ });
+ const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
+ if (!value) {
+ value = "";
+ for (let i2 in _entityIDs) {
+ let entity = context.hasEntity(_entityIDs[i2]);
+ if (entity.tags.name) {
+ value = entity.tags.name;
+ break;
+ }
+ }
+ }
+ const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
+ searchfn(language()[2], value, (query, data) => {
+ callback(data.map((d) => ({ value: d })));
+ });
+ });
+ function wiki(selection2) {
+ let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
+ wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
+ let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
+ langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
+ _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
+ _langInput = _langInput.enter().append("input").attr("type", "text").attr("class", "wiki-lang").attr("placeholder", _t("translate.localized_translation_language")).call(utilNoAuto).call(langCombo).merge(_langInput);
+ _langInput.on("blur", changeLang).on("change", changeLang);
+ let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
+ titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
+ _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
+ _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
+ _titleInput.on("blur", function() {
+ change(true);
+ }).on("change", function() {
+ change(false);
+ });
+ let link2 = titleContainer.selectAll(".wiki-link").data([0]);
+ link2 = link2.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikipedia.org" })).call(svgIcon("#iD-icon-out-link")).merge(link2);
+ link2.on("click", (d3_event) => {
+ d3_event.preventDefault();
+ if (_wikiURL)
+ window.open(_wikiURL, "_blank");
+ });
}
-
- function choose(ul, datum) {
- if (d3.event) d3.event.preventDefault();
-
- d3.select(ul)
- .selectAll('li')
- .classed('active', function(d) { return d === datum; })
- .selectAll('input')
- .property('checked', function(d) { return d === datum; });
-
- var extent = iD.geo.Extent(),
- entity;
-
- entity = context.graph().hasEntity(datum.id);
- if (entity) extent._extend(entity.extent(context.graph()));
-
- datum.action();
-
- entity = context.graph().hasEntity(datum.id);
- if (entity) extent._extend(entity.extent(context.graph()));
-
- zoomToEntity(datum.id, extent);
+ function defaultLanguageInfo(skipEnglishFallback) {
+ const langCode = _mainLocalizer.languageCode().toLowerCase();
+ for (let i2 in _dataWikipedia) {
+ let d = _dataWikipedia[i2];
+ if (d[2] === langCode)
+ return d;
+ }
+ return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
+ }
+ function language(skipEnglishFallback) {
+ const value = utilGetSetValue(_langInput).toLowerCase();
+ for (let i2 in _dataWikipedia) {
+ let d = _dataWikipedia[i2];
+ if (d[0].toLowerCase() === value || d[1].toLowerCase() === value || d[2] === value)
+ return d;
+ }
+ return defaultLanguageInfo(skipEnglishFallback);
}
-
- function zoomToEntity(id, extent) {
- context.surface().selectAll('.hover')
- .classed('hover', false);
-
- var entity = context.graph().hasEntity(id);
- if (entity) {
- if (extent) {
- context.map().trimmedExtent(extent);
- } else {
- context.map().zoomTo(entity);
- }
- context.surface().selectAll(
- iD.util.entityOrMemberSelector([entity.id], context.graph()))
- .classed('hover', true);
+ function changeLang() {
+ utilGetSetValue(_langInput, language()[1]);
+ change(true);
+ }
+ function change(skipWikidata) {
+ let value = utilGetSetValue(_titleInput);
+ const m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
+ const langInfo = m && _dataWikipedia.find((d) => m[1] === d[2]);
+ let syncTags = {};
+ if (langInfo) {
+ const nativeLangName = langInfo[1];
+ value = decodeURIComponent(m[2]).replace(/_/g, " ");
+ if (m[3]) {
+ let anchor;
+ anchor = decodeURIComponent(m[3]);
+ value += "#" + anchor.replace(/_/g, " ");
+ }
+ value = value.slice(0, 1).toUpperCase() + value.slice(1);
+ utilGetSetValue(_langInput, nativeLangName);
+ utilGetSetValue(_titleInput, value);
+ }
+ if (value) {
+ syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
+ } else {
+ syncTags.wikipedia = void 0;
+ }
+ dispatch10.call("change", this, syncTags);
+ if (skipWikidata || !value || !language()[2])
+ return;
+ const initGraph = context.graph();
+ const initEntityIDs = _entityIDs;
+ wikidata.itemsByTitle(language()[2], value, (err, data) => {
+ if (err || !data || !Object.keys(data).length)
+ return;
+ if (context.graph() !== initGraph)
+ return;
+ const qids = Object.keys(data);
+ const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
+ let actions = initEntityIDs.map((entityID) => {
+ let entity = context.entity(entityID).tags;
+ let currTags = Object.assign({}, entity);
+ if (currTags.wikidata !== value2) {
+ currTags.wikidata = value2;
+ return actionChangeTags(entityID, currTags);
+ }
+ return null;
+ }).filter(Boolean);
+ if (!actions.length)
+ return;
+ context.overwrite(function actionUpdateWikidataTags(graph) {
+ actions.forEach(function(action) {
+ graph = action(graph);
+ });
+ return graph;
+ }, context.history().undoAnnotation());
+ });
+ }
+ wiki.tags = (tags) => {
+ _tags = tags;
+ updateForTags(tags);
+ };
+ function updateForTags(tags) {
+ const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
+ const m = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
+ const tagLang = m && m[1];
+ const tagArticleTitle = m && m[2];
+ let anchor = m && m[3];
+ const tagLangInfo = tagLang && _dataWikipedia.find((d) => tagLang === d[2]);
+ if (tagLangInfo) {
+ const nativeLangName = tagLangInfo[1];
+ utilGetSetValue(_langInput, nativeLangName);
+ utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
+ if (anchor) {
+ try {
+ anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
+ } catch (e) {
+ anchor = anchor.replace(/ /g, "_");
+ }
+ }
+ _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
+ } else {
+ utilGetSetValue(_titleInput, value);
+ if (value && value !== "") {
+ utilGetSetValue(_langInput, "");
+ const defaultLangInfo = defaultLanguageInfo();
+ _wikiURL = `https://${defaultLangInfo[2]}.wikipedia.org/w/index.php?fulltext=1&search=${value}`;
+ } else {
+ const shownOrDefaultLangInfo = language(true);
+ utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
+ _wikiURL = "";
}
+ }
}
-
-
- // The conflict list should be an array of objects like:
- // {
- // id: id,
- // name: entityName(local),
- // details: merge.conflicts(),
- // chosen: 1,
- // choices: [
- // choice(id, keepMine, forceLocal),
- // choice(id, keepTheirs, forceRemote)
- // ]
- // }
- conflicts.list = function(_) {
- if (!arguments.length) return list;
- list = _;
- return conflicts;
+ wiki.entityIDs = (val) => {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return wiki;
};
+ wiki.focus = () => {
+ _titleInput.node().focus();
+ };
+ return utilRebind(wiki, dispatch10, "on");
+ }
+ uiFieldWikipedia.supportsMultiselection = false;
+
+ // modules/ui/fields/index.js
+ var uiFields = {
+ access: uiFieldAccess,
+ address: uiFieldAddress,
+ check: uiFieldCheck,
+ combo: uiFieldCombo,
+ cycleway: uiFieldCycleway,
+ defaultCheck: uiFieldCheck,
+ email: uiFieldText,
+ identifier: uiFieldText,
+ lanes: uiFieldLanes,
+ localized: uiFieldLocalized,
+ roadheight: uiFieldRoadheight,
+ roadspeed: uiFieldRoadspeed,
+ manyCombo: uiFieldCombo,
+ multiCombo: uiFieldCombo,
+ networkCombo: uiFieldCombo,
+ number: uiFieldText,
+ onewayCheck: uiFieldCheck,
+ radio: uiFieldRadio,
+ restrictions: uiFieldRestrictions,
+ semiCombo: uiFieldCombo,
+ structureRadio: uiFieldRadio,
+ tel: uiFieldText,
+ text: uiFieldText,
+ textarea: uiFieldTextarea,
+ typeCombo: uiFieldCombo,
+ url: uiFieldText,
+ wikidata: uiFieldWikidata,
+ wikipedia: uiFieldWikipedia
+ };
- return d3.rebind(conflicts, dispatch, 'on');
-};
-iD.ui.Contributors = function(context) {
- var debouncedUpdate = _.debounce(function() { update(); }, 1000),
- limit = 4,
- hidden = false,
- wrap = d3.select(null);
-
- function update() {
- var users = {},
- entities = context.intersects(context.map().extent());
-
- entities.forEach(function(entity) {
- if (entity && entity.user) users[entity.user] = true;
- });
-
- var u = Object.keys(users),
- subset = u.slice(0, u.length > limit ? limit - 1 : limit);
-
- wrap.html('')
- .call(iD.svg.Icon('#icon-nearby', 'pre-text light'));
-
- var userList = d3.select(document.createElement('span'));
-
- userList.selectAll()
- .data(subset)
- .enter()
- .append('a')
- .attr('class', 'user-link')
- .attr('href', function(d) { return context.connection().userURL(d); })
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .text(String);
-
- if (u.length > limit) {
- var count = d3.select(document.createElement('span'));
-
- count.append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .attr('href', function() {
- return context.connection().changesetsURL(context.map().center(), context.map().zoom());
- })
- .text(u.length - limit + 1);
-
- wrap.append('span')
- .html(t('contributors.truncated_list', { users: userList.html(), count: count.html() }));
-
- } else {
- wrap.append('span')
- .html(t('contributors.list', { users: userList.html() }));
+ // modules/ui/field.js
+ function uiField(context, presetField2, entityIDs, options2) {
+ options2 = Object.assign({
+ show: true,
+ wrap: true,
+ remove: true,
+ revert: true,
+ info: true
+ }, options2);
+ var dispatch10 = dispatch_default("change", "revert");
+ var field = Object.assign({}, presetField2);
+ field.domId = utilUniqueDomId("form-field-" + field.safeid);
+ var _show = options2.show;
+ var _state = "";
+ var _tags = {};
+ var _entityExtent;
+ if (entityIDs && entityIDs.length) {
+ _entityExtent = entityIDs.reduce(function(extent, entityID) {
+ var entity = context.graph().entity(entityID);
+ return extent.extend(entity.extent(context.graph()));
+ }, geoExtent());
+ }
+ var _locked = false;
+ var _lockedTip = uiTooltip().title(_t.html("inspector.lock.suggestion", { label: field.label })).placement("bottom");
+ field.keys = field.keys || [field.key];
+ if (_show && !field.impl) {
+ createField();
+ }
+ function createField() {
+ field.impl = uiFields[field.type](field, context).on("change", function(t, onInput) {
+ dispatch10.call("change", field, t, onInput);
+ });
+ if (entityIDs) {
+ field.entityIDs = entityIDs;
+ if (field.impl.entityIDs) {
+ field.impl.entityIDs(entityIDs);
}
-
- if (!u.length) {
- hidden = true;
- wrap
- .transition()
- .style('opacity', 0);
-
- } else if (hidden) {
- wrap
- .transition()
- .style('opacity', 1);
+ }
+ }
+ function isModified() {
+ if (!entityIDs || !entityIDs.length)
+ return false;
+ return entityIDs.some(function(entityID) {
+ var original = context.graph().base().entities[entityID];
+ var latest = context.graph().entity(entityID);
+ return field.keys.some(function(key) {
+ return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
+ });
+ });
+ }
+ function tagsContainFieldKey() {
+ return field.keys.some(function(key) {
+ if (field.type === "multiCombo") {
+ for (var tagKey in _tags) {
+ if (tagKey.indexOf(key) === 0) {
+ return true;
+ }
+ }
+ return false;
}
+ return _tags[key] !== void 0;
+ });
}
-
- return function(selection) {
- wrap = selection;
- update();
-
- context.connection().on('loaded.contributors', debouncedUpdate);
- context.map().on('move.contributors', debouncedUpdate);
- };
-};
-iD.ui.Disclosure = function() {
- var dispatch = d3.dispatch('toggled'),
- title,
- expanded = false,
- content = function () {};
-
- var disclosure = function(selection) {
- var $link = selection.selectAll('.hide-toggle')
- .data([0]);
-
- $link.enter().append('a')
- .attr('href', '#')
- .attr('class', 'hide-toggle');
-
- $link.text(title)
- .on('click', toggle)
- .classed('expanded', expanded);
-
- var $body = selection.selectAll('div')
- .data([0]);
-
- $body.enter().append('div');
-
- $body.classed('hide', !expanded)
- .call(content);
-
- function toggle() {
- expanded = !expanded;
- $link.classed('expanded', expanded);
- $body.call(iD.ui.Toggle(expanded));
- dispatch.toggled(expanded);
+ function revert(d3_event, d) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ if (!entityIDs || _locked)
+ return;
+ dispatch10.call("revert", d, d.keys);
+ }
+ function remove2(d3_event, d) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ if (_locked)
+ return;
+ var t = {};
+ d.keys.forEach(function(key) {
+ t[key] = void 0;
+ });
+ dispatch10.call("change", d, t);
+ }
+ field.render = function(selection2) {
+ var container = selection2.selectAll(".form-field").data([field]);
+ var enter = container.enter().append("div").attr("class", function(d) {
+ return "form-field form-field-" + d.safeid;
+ }).classed("nowrap", !options2.wrap);
+ if (options2.wrap) {
+ var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d) {
+ return d.domId;
+ });
+ var textEnter = labelEnter.append("span").attr("class", "label-text");
+ textEnter.append("span").attr("class", "label-textvalue").html(function(d) {
+ return d.label();
+ });
+ textEnter.append("span").attr("class", "label-textannotation");
+ if (options2.remove) {
+ labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
+ }
+ if (options2.revert) {
+ labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
+ }
+ }
+ container = container.merge(enter);
+ container.select(".field-label > .remove-icon").on("click", remove2);
+ container.select(".field-label > .modified-icon").on("click", revert);
+ container.each(function(d) {
+ var selection3 = select_default2(this);
+ if (!d.impl) {
+ createField();
+ }
+ var reference, help;
+ if (options2.wrap && field.type === "restrictions") {
+ help = uiFieldHelp(context, "restrictions");
+ }
+ if (options2.wrap && options2.info) {
+ var referenceKey = d.key || "";
+ if (d.type === "multiCombo") {
+ referenceKey = referenceKey.replace(/:$/, "");
+ }
+ reference = uiTagReference(d.reference || { key: referenceKey }, context);
+ if (_state === "hover") {
+ reference.showing(false);
+ }
+ }
+ selection3.call(d.impl);
+ if (help) {
+ selection3.call(help.body).select(".field-label").call(help.button);
}
+ if (reference) {
+ selection3.call(reference.body).select(".field-label").call(reference.button);
+ }
+ d.impl.tags(_tags);
+ });
+ container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
+ var annotation = container.selectAll(".field-label .label-textannotation");
+ var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
+ icon2.exit().remove();
+ icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
+ container.call(_locked ? _lockedTip : _lockedTip.destroy);
+ };
+ field.state = function(val) {
+ if (!arguments.length)
+ return _state;
+ _state = val;
+ return field;
+ };
+ field.tags = function(val) {
+ if (!arguments.length)
+ return _tags;
+ _tags = val;
+ if (tagsContainFieldKey() && !_show) {
+ _show = true;
+ if (!field.impl) {
+ createField();
+ }
+ }
+ return field;
+ };
+ field.locked = function(val) {
+ if (!arguments.length)
+ return _locked;
+ _locked = val;
+ return field;
+ };
+ field.show = function() {
+ _show = true;
+ if (!field.impl) {
+ createField();
+ }
+ if (field.default && field.key && _tags[field.key] !== field.default) {
+ var t = {};
+ t[field.key] = field.default;
+ dispatch10.call("change", this, t);
+ }
};
-
- disclosure.title = function(_) {
- if (!arguments.length) return title;
- title = _;
- return disclosure;
+ field.isShown = function() {
+ return _show;
};
-
- disclosure.expanded = function(_) {
- if (!arguments.length) return expanded;
- expanded = _;
- return disclosure;
+ field.isAllowed = function() {
+ if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
+ return false;
+ if (field.geometry && !entityIDs.every(function(entityID) {
+ return field.matchGeometry(context.graph().geometry(entityID));
+ }))
+ return false;
+ if (entityIDs && _entityExtent && field.locationSetID) {
+ var validLocations = _mainLocations.locationsAt(_entityExtent.center());
+ if (!validLocations[field.locationSetID])
+ return false;
+ }
+ var prerequisiteTag = field.prerequisiteTag;
+ if (entityIDs && !tagsContainFieldKey() && prerequisiteTag) {
+ if (!entityIDs.every(function(entityID) {
+ var entity = context.graph().entity(entityID);
+ if (prerequisiteTag.key) {
+ var value = entity.tags[prerequisiteTag.key];
+ if (!value)
+ return false;
+ if (prerequisiteTag.valueNot) {
+ return prerequisiteTag.valueNot !== value;
+ }
+ if (prerequisiteTag.value) {
+ return prerequisiteTag.value === value;
+ }
+ } else if (prerequisiteTag.keyNot) {
+ if (entity.tags[prerequisiteTag.keyNot])
+ return false;
+ }
+ return true;
+ }))
+ return false;
+ }
+ return true;
};
-
- disclosure.content = function(_) {
- if (!arguments.length) return content;
- content = _;
- return disclosure;
+ field.focus = function() {
+ if (field.impl) {
+ field.impl.focus();
+ }
};
+ return utilRebind(field, dispatch10, "on");
+ }
- return d3.rebind(disclosure, dispatch, 'on');
-};
-iD.ui.EntityEditor = function(context) {
- var dispatch = d3.dispatch('choose'),
- state = 'select',
- coalesceChanges = false,
- modified = false,
- base,
- id,
- preset,
- reference;
-
- var presetEditor = iD.ui.preset(context)
- .on('change', changeTags);
- var rawTagEditor = iD.ui.RawTagEditor(context)
- .on('change', changeTags);
-
- function entityEditor(selection) {
- var entity = context.entity(id),
- tags = _.clone(entity.tags);
-
- var $header = selection.selectAll('.header')
- .data([0]);
-
- // Enter
- var $enter = $header.enter().append('div')
- .attr('class', 'header fillL cf');
-
- $enter.append('button')
- .attr('class', 'fl preset-reset preset-choose')
- .append('span')
- .html('◄');
-
- $enter.append('button')
- .attr('class', 'fr preset-close')
- .call(iD.svg.Icon(modified ? '#icon-apply' : '#icon-close'));
-
- $enter.append('h3');
-
- // Update
- $header.select('h3')
- .text(t('inspector.edit'));
-
- $header.select('.preset-close')
- .on('click', function() {
- context.enter(iD.modes.Browse(context));
- });
-
- var $body = selection.selectAll('.inspector-body')
- .data([0]);
-
- // Enter
- $enter = $body.enter().append('div')
- .attr('class', 'inspector-body');
-
- $enter.append('div')
- .attr('class', 'preset-list-item inspector-inner')
- .append('div')
- .attr('class', 'preset-list-button-wrap')
- .append('button')
- .attr('class', 'preset-list-button preset-reset')
- .call(bootstrap.tooltip()
- .title(t('inspector.back_tooltip'))
- .placement('bottom'))
- .append('div')
- .attr('class', 'label');
-
- $body.select('.preset-list-button-wrap')
- .call(reference.button);
-
- $body.select('.preset-list-item')
- .call(reference.body);
-
- $enter.append('div')
- .attr('class', 'inspector-border inspector-preset');
-
- $enter.append('div')
- .attr('class', 'inspector-border raw-tag-editor inspector-inner');
-
- $enter.append('div')
- .attr('class', 'inspector-border raw-member-editor inspector-inner');
-
- $enter.append('div')
- .attr('class', 'raw-membership-editor inspector-inner');
-
- selection.selectAll('.preset-reset')
- .on('click', function() {
- dispatch.choose(preset);
- });
+ // modules/ui/form_fields.js
+ function uiFormFields(context) {
+ var moreCombo = uiCombobox(context, "more-fields").minItems(1);
+ var _fieldsArr = [];
+ var _lastPlaceholder = "";
+ var _state = "";
+ var _klass = "";
+ function formFields(selection2) {
+ var allowedFields = _fieldsArr.filter(function(field) {
+ return field.isAllowed();
+ });
+ var shown = allowedFields.filter(function(field) {
+ return field.isShown();
+ });
+ var notShown = allowedFields.filter(function(field) {
+ return !field.isShown();
+ });
+ var container = selection2.selectAll(".form-fields-container").data([0]);
+ container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
+ var fields = container.selectAll(".wrap-form-field").data(shown, function(d) {
+ return d.id + (d.entityIDs ? d.entityIDs.join() : "");
+ });
+ fields.exit().remove();
+ var enter = fields.enter().append("div").attr("class", function(d) {
+ return "wrap-form-field wrap-form-field-" + d.safeid;
+ });
+ fields = fields.merge(enter);
+ fields.order().each(function(d) {
+ select_default2(this).call(d.render);
+ });
+ var titles = [];
+ var moreFields = notShown.map(function(field) {
+ var title = field.title();
+ titles.push(title);
+ var terms = field.terms();
+ if (field.key)
+ terms.push(field.key);
+ if (field.keys)
+ terms = terms.concat(field.keys);
+ return {
+ display: field.label(),
+ value: title,
+ title,
+ field,
+ terms
+ };
+ });
+ var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
+ var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
+ more.exit().remove();
+ var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
+ moreEnter.append("span").call(_t.append("inspector.add_fields"));
+ more = moreEnter.merge(more);
+ var input = more.selectAll(".value").data([0]);
+ input.exit().remove();
+ input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
+ input.call(utilGetSetValue, "").call(moreCombo.data(moreFields).on("accept", function(d) {
+ if (!d)
+ return;
+ var field = d.field;
+ field.show();
+ selection2.call(formFields);
+ field.focus();
+ }));
+ if (_lastPlaceholder !== placeholder) {
+ input.attr("placeholder", placeholder);
+ _lastPlaceholder = placeholder;
+ }
+ }
+ formFields.fieldsArr = function(val) {
+ if (!arguments.length)
+ return _fieldsArr;
+ _fieldsArr = val || [];
+ return formFields;
+ };
+ formFields.state = function(val) {
+ if (!arguments.length)
+ return _state;
+ _state = val;
+ return formFields;
+ };
+ formFields.klass = function(val) {
+ if (!arguments.length)
+ return _klass;
+ _klass = val;
+ return formFields;
+ };
+ return formFields;
+ }
- // Update
- $body.select('.preset-list-item button')
- .call(iD.ui.PresetIcon()
- .geometry(context.geometry(id))
- .preset(preset));
-
- $body.select('.preset-list-item .label')
- .text(preset.name());
-
- $body.select('.inspector-preset')
- .call(presetEditor
- .preset(preset)
- .entityID(id)
- .tags(tags)
- .state(state));
-
- $body.select('.raw-tag-editor')
- .call(rawTagEditor
- .preset(preset)
- .entityID(id)
- .tags(tags)
- .state(state));
-
- if (entity.type === 'relation') {
- $body.select('.raw-member-editor')
- .style('display', 'block')
- .call(iD.ui.RawMemberEditor(context)
- .entityID(id));
- } else {
- $body.select('.raw-member-editor')
- .style('display', 'none');
+ // modules/ui/changeset_editor.js
+ function uiChangesetEditor(context) {
+ var dispatch10 = dispatch_default("change");
+ var formFields = uiFormFields(context);
+ var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
+ var _fieldsArr;
+ var _tags;
+ var _changesetID;
+ function changesetEditor(selection2) {
+ render(selection2);
+ }
+ function render(selection2) {
+ var initial = false;
+ if (!_fieldsArr) {
+ initial = true;
+ var presets = _mainPresetIndex;
+ _fieldsArr = [
+ uiField(context, presets.field("comment"), null, { show: true, revert: false }),
+ uiField(context, presets.field("source"), null, { show: false, revert: false }),
+ uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
+ ];
+ _fieldsArr.forEach(function(field) {
+ field.on("change", function(t, onInput) {
+ dispatch10.call("change", field, void 0, t, onInput);
+ });
+ });
+ }
+ _fieldsArr.forEach(function(field) {
+ field.tags(_tags);
+ });
+ selection2.call(formFields.fieldsArr(_fieldsArr));
+ if (initial) {
+ var commentField = selection2.select(".form-field-comment textarea");
+ var commentNode = commentField.node();
+ if (commentNode) {
+ commentNode.focus();
+ commentNode.select();
+ }
+ utilTriggerEvent(commentField, "blur");
+ var osm = context.connection();
+ if (osm) {
+ osm.userChangesets(function(err, changesets) {
+ if (err)
+ return;
+ var comments = changesets.map(function(changeset) {
+ var comment = changeset.tags.comment;
+ return comment ? { title: comment, value: comment } : null;
+ }).filter(Boolean);
+ commentField.call(commentCombo.data(utilArrayUniqBy(comments, "title")));
+ });
}
+ }
+ var hasGoogle = _tags.comment.match(/google/i);
+ var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(hasGoogle ? [0] : []);
+ commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
+ var commentEnter = commentWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning comment-warning").style("opacity", 0);
+ commentEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-alert", "inline")).attr("href", _t("commit.google_warning_link")).append("span").call(_t.append("commit.google_warning"));
+ commentEnter.transition().duration(200).style("opacity", 1);
+ }
+ changesetEditor.tags = function(_) {
+ if (!arguments.length)
+ return _tags;
+ _tags = _;
+ return changesetEditor;
+ };
+ changesetEditor.changesetID = function(_) {
+ if (!arguments.length)
+ return _changesetID;
+ if (_changesetID === _)
+ return changesetEditor;
+ _changesetID = _;
+ _fieldsArr = null;
+ return changesetEditor;
+ };
+ return utilRebind(changesetEditor, dispatch10, "on");
+ }
- $body.select('.raw-membership-editor')
- .call(iD.ui.RawMembershipEditor(context)
- .entityID(id));
-
- function historyChanged() {
- if (state === 'hide') return;
-
- var entity = context.hasEntity(id),
- graph = context.graph();
- if (!entity) return;
+ // modules/ui/commit.js
+ var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
- entityEditor.preset(context.presets().match(entity, graph));
- entityEditor.modified(base !== graph);
- entityEditor(selection);
+ // modules/util/jxon.js
+ var JXON = new function() {
+ var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
+ function parseText(sValue) {
+ if (rIsNull.test(sValue)) {
+ return null;
+ }
+ if (rIsBool.test(sValue)) {
+ return sValue.toLowerCase() === "true";
+ }
+ if (isFinite(sValue)) {
+ return parseFloat(sValue);
+ }
+ if (isFinite(Date.parse(sValue))) {
+ return new Date(sValue);
+ }
+ return sValue;
+ }
+ function EmptyTree() {
+ }
+ EmptyTree.prototype.toString = function() {
+ return "null";
+ };
+ EmptyTree.prototype.valueOf = function() {
+ return null;
+ };
+ function objectify(vValue) {
+ return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
+ }
+ function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
+ var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
+ var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : true;
+ if (bChildren) {
+ for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
+ oNode = oParentNode.childNodes.item(nItem);
+ if (oNode.nodeType === 4) {
+ sCollectedTxt += oNode.nodeValue;
+ } else if (oNode.nodeType === 3) {
+ sCollectedTxt += oNode.nodeValue.trim();
+ } else if (oNode.nodeType === 1 && !oNode.prefix) {
+ aCache.push(oNode);
+ }
}
-
- context.history()
- .on('change.entity-editor', historyChanged);
- }
-
- function clean(o) {
-
- function cleanVal(k, v) {
- function keepSpaces(k) {
- var whitelist = ['opening_hours', 'service_times', 'collection_times',
- 'operating_times', 'smoking_hours', 'happy_hours'];
- return _.some(whitelist, function(s) { return k.indexOf(s) !== -1; });
- }
-
- var blacklist = ['description', 'note', 'fixme'];
- if (_.some(blacklist, function(s) { return k.indexOf(s) !== -1; })) return v;
-
- var cleaned = v.split(';')
- .map(function(s) { return s.trim(); })
- .join(keepSpaces(k) ? '; ' : ';');
-
- // The code below is not intended to validate websites and emails.
- // It is only intended to prevent obvious copy-paste errors. (#2323)
-
- // clean website- and email-like tags
- if (k.indexOf('website') !== -1 ||
- k.indexOf('email') !== -1 ||
- cleaned.indexOf('http') === 0) {
- cleaned = cleaned
- .replace(/[\u200B-\u200F\uFEFF]/g, ''); // strip LRM and other zero width chars
-
- }
-
- return cleaned;
+ }
+ var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
+ if (!bHighVerb && (bChildren || bAttributes)) {
+ vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
+ }
+ for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
+ sProp = aCache[nElId].nodeName.toLowerCase();
+ vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
+ if (vResult.hasOwnProperty(sProp)) {
+ if (vResult[sProp].constructor !== Array) {
+ vResult[sProp] = [vResult[sProp]];
+ }
+ vResult[sProp].push(vContent);
+ } else {
+ vResult[sProp] = vContent;
+ nLength++;
}
-
- var out = {}, k, v;
- for (k in o) {
- if (k && (v = o[k]) !== undefined) {
- out[k] = cleanVal(k, v);
- }
+ }
+ if (bAttributes) {
+ var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
+ for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
+ oAttrib = oParentNode.attributes.item(nAttrib);
+ oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
+ }
+ if (bNesteAttr) {
+ if (bFreeze) {
+ Object.freeze(oAttrParent);
+ }
+ vResult[sAttributesProp] = oAttrParent;
+ nLength -= nAttrLen - 1;
}
- return out;
- }
-
- // Tag changes that fire on input can all get coalesced into a single
- // history operation when the user leaves the field. #2342
- function changeTags(changed, onInput) {
- var entity = context.entity(id),
- annotation = t('operations.change_tags.annotation'),
- tags = _.extend({}, entity.tags, changed);
-
- if (!onInput) {
- tags = clean(tags);
+ }
+ if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
+ vResult[sValueProp] = vBuiltVal;
+ } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
+ vResult = vBuiltVal;
+ }
+ if (bFreeze && (bHighVerb || nLength > 0)) {
+ Object.freeze(vResult);
+ }
+ aCache.length = nLevelStart;
+ return vResult;
+ }
+ function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
+ var vValue, oChild;
+ if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
+ oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
+ } else if (oParentObj.constructor === Date) {
+ oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
+ }
+ for (var sName in oParentObj) {
+ vValue = oParentObj[sName];
+ if (isFinite(sName) || vValue instanceof Function) {
+ continue;
}
- if (!_.isEqual(entity.tags, tags)) {
- if (coalesceChanges) {
- context.overwrite(iD.actions.ChangeTags(id, tags), annotation);
- } else {
- context.perform(iD.actions.ChangeTags(id, tags), annotation);
- coalesceChanges = !!onInput;
- }
+ if (sName === sValueProp) {
+ if (vValue !== null && vValue !== true) {
+ oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
+ }
+ } else if (sName === sAttributesProp) {
+ for (var sAttrib in vValue) {
+ oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
+ }
+ } else if (sName.charAt(0) === sAttrPref) {
+ oParentEl.setAttribute(sName.slice(1), vValue);
+ } else if (vValue.constructor === Array) {
+ for (var nItem = 0; nItem < vValue.length; nItem++) {
+ oChild = oXMLDoc.createElement(sName);
+ loadObjTree(oXMLDoc, oChild, vValue[nItem]);
+ oParentEl.appendChild(oChild);
+ }
+ } else {
+ oChild = oXMLDoc.createElement(sName);
+ if (vValue instanceof Object) {
+ loadObjTree(oXMLDoc, oChild, vValue);
+ } else if (vValue !== null && vValue !== true) {
+ oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
+ }
+ oParentEl.appendChild(oChild);
}
+ }
}
-
- entityEditor.modified = function(_) {
- if (!arguments.length) return modified;
- modified = _;
- d3.selectAll('button.preset-close use')
- .attr('xlink:href', (modified ? '#icon-apply' : '#icon-close'));
+ this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
+ var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : 1;
+ return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
};
-
- entityEditor.state = function(_) {
- if (!arguments.length) return state;
- state = _;
- return entityEditor;
+ this.unbuild = function(oObjTree) {
+ var oNewDoc = document.implementation.createDocument("", "", null);
+ loadObjTree(oNewDoc, oNewDoc, oObjTree);
+ return oNewDoc;
};
-
- entityEditor.entityID = function(_) {
- if (!arguments.length) return id;
- id = _;
- base = context.graph();
- entityEditor.preset(context.presets().match(context.entity(id), base));
- entityEditor.modified(false);
- coalesceChanges = false;
- return entityEditor;
+ this.stringify = function(oObjTree) {
+ return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
};
+ }();
- entityEditor.preset = function(_) {
- if (!arguments.length) return preset;
- if (_ !== preset) {
- preset = _;
- reference = iD.ui.TagReference(preset.reference(context.geometry(id)), context)
- .showing(false);
+ // modules/ui/sections/changes.js
+ function uiSectionChanges(context) {
+ var _discardTags = {};
+ _mainFileFetcher.get("discarded").then(function(d) {
+ _discardTags = d;
+ }).catch(function() {
+ });
+ var section = uiSection("changes-list", context).label(function() {
+ var history = context.history();
+ var summary = history.difference().summary();
+ return _t.html("inspector.title_count", { title: { html: _t.html("commit.changes") }, count: summary.length });
+ }).disclosureContent(renderDisclosureContent);
+ function renderDisclosureContent(selection2) {
+ var history = context.history();
+ var summary = history.difference().summary();
+ var container = selection2.selectAll(".commit-section").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "commit-section");
+ containerEnter.append("ul").attr("class", "changeset-list");
+ container = containerEnter.merge(container);
+ var items = container.select("ul").selectAll("li").data(summary);
+ var itemsEnter = items.enter().append("li").attr("class", "change-item");
+ var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
+ buttons.each(function(d) {
+ select_default2(this).call(svgIcon("#iD-icon-" + d.entity.geometry(d.graph), "pre-text " + d.changeType));
+ });
+ buttons.append("span").attr("class", "change-type").html(function(d) {
+ return _t.html("commit." + d.changeType) + " ";
+ });
+ buttons.append("strong").attr("class", "entity-type").text(function(d) {
+ var matched = _mainPresetIndex.match(d.entity, d.graph);
+ return matched && matched.name() || utilDisplayType(d.entity.id);
+ });
+ buttons.append("span").attr("class", "entity-name").text(function(d) {
+ var name2 = utilDisplayName(d.entity) || "", string = "";
+ if (name2 !== "") {
+ string += ":";
}
- return entityEditor;
- };
-
- return d3.rebind(entityEditor, dispatch, 'on');
-};
-iD.ui.FeatureInfo = function(context) {
- function update(selection) {
- var features = context.features(),
- stats = features.stats(),
- count = 0,
- hiddenList = _.compact(_.map(features.hidden(), function(k) {
- if (stats[k]) {
- count += stats[k];
- return String(stats[k]) + ' ' + t('feature.' + k + '.description');
- }
- }));
-
- selection.html('');
-
- if (hiddenList.length) {
- var tooltip = bootstrap.tooltip()
- .placement('top')
- .html(true)
- .title(function() {
- return iD.ui.tooltipHtml(hiddenList.join('
'));
- });
-
- var warning = selection.append('a')
- .attr('href', '#')
- .attr('tabindex', -1)
- .html(t('feature_info.hidden_warning', { count: count }))
- .call(tooltip)
- .on('click', function() {
- tooltip.hide(warning);
- // open map data panel?
- d3.event.preventDefault();
- });
+ return string += " " + name2;
+ });
+ items = itemsEnter.merge(items);
+ var changeset = new osmChangeset().update({ id: void 0 });
+ var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
+ delete changeset.id;
+ var data = JXON.stringify(changeset.osmChangeJXON(changes));
+ var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
+ var fileName = "changes.osc";
+ var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
+ linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
+ linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
+ function mouseover(d) {
+ if (d.entity) {
+ context.surface().selectAll(utilEntityOrMemberSelector([d.entity.id], context.graph())).classed("hover", true);
}
-
- selection
- .classed('hide', !hiddenList.length);
+ }
+ function mouseout() {
+ context.surface().selectAll(".hover").classed("hover", false);
+ }
+ function click(d3_event, change) {
+ if (change.changeType !== "deleted") {
+ var entity = change.entity;
+ context.map().zoomToEase(entity);
+ context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
+ }
+ }
}
+ return section;
+ }
- return function(selection) {
- update(selection);
-
- context.features().on('change.feature_info', function() {
- update(selection);
+ // modules/ui/commit_warnings.js
+ function uiCommitWarnings(context) {
+ function commitWarnings(selection2) {
+ var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
+ for (var severity in issuesBySeverity) {
+ var issues = issuesBySeverity[severity];
+ if (severity !== "error") {
+ issues = issues.filter(function(issue) {
+ return issue.type !== "help_request";
+ });
+ }
+ var section = severity + "-section";
+ var issueItem = severity + "-item";
+ var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
+ container.exit().remove();
+ var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
+ containerEnter.append("h3").html(severity === "warning" ? _t.html("commit.warnings") : _t.html("commit.errors"));
+ containerEnter.append("ul").attr("class", "changeset-list");
+ container = containerEnter.merge(container);
+ var items = container.select("ul").selectAll("li").data(issues, function(d) {
+ return d.key;
});
- };
-};
-iD.ui.FeatureList = function(context) {
- var geocodeResults;
-
- function featureList(selection) {
- var header = selection.append('div')
- .attr('class', 'header fillL cf');
-
- header.append('h3')
- .text(t('inspector.feature_list'));
+ items.exit().remove();
+ var itemsEnter = items.enter().append("li").attr("class", issueItem);
+ var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d) {
+ if (d.entityIds) {
+ context.surface().selectAll(utilEntityOrMemberSelector(d.entityIds, context.graph())).classed("hover", true);
+ }
+ }).on("mouseout", function() {
+ context.surface().selectAll(".hover").classed("hover", false);
+ }).on("click", function(d3_event, d) {
+ context.validator().focusIssue(d);
+ });
+ buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
+ buttons.append("strong").attr("class", "issue-message");
+ buttons.filter(function(d) {
+ return d.tooltip;
+ }).call(uiTooltip().title(function(d) {
+ return d.tooltip;
+ }).placement("top"));
+ items = itemsEnter.merge(items);
+ items.selectAll(".issue-message").html(function(d) {
+ return d.message(context);
+ });
+ }
+ }
+ return commitWarnings;
+ }
- function keypress() {
- var q = search.property('value'),
- items = list.selectAll('.feature-list-item');
- if (d3.event.keyCode === 13 && q.length && items.size()) {
- click(items.datum());
- }
+ // modules/ui/commit.js
+ var readOnlyTags = [
+ /^changesets_count$/,
+ /^created_by$/,
+ /^ideditor:/,
+ /^imagery_used$/,
+ /^host$/,
+ /^locale$/,
+ /^warnings:/,
+ /^resolved:/,
+ /^closed:note$/,
+ /^closed:keepright$/,
+ /^closed:improveosm:/,
+ /^closed:osmose:/
+ ];
+ var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
+ function uiCommit(context) {
+ var dispatch10 = dispatch_default("cancel");
+ var _userDetails2;
+ var _selection;
+ var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
+ var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
+ var commitChanges = uiSectionChanges(context);
+ var commitWarnings = uiCommitWarnings(context);
+ function commit(selection2) {
+ _selection = selection2;
+ if (!context.changeset)
+ initChangeset();
+ loadDerivedChangesetTags();
+ selection2.call(render);
+ }
+ function initChangeset() {
+ var commentDate = +corePreferences("commentDate") || 0;
+ var currDate = Date.now();
+ var cutoff = 2 * 86400 * 1e3;
+ if (commentDate > currDate || currDate - commentDate > cutoff) {
+ corePreferences("comment", null);
+ corePreferences("hashtags", null);
+ corePreferences("source", null);
+ }
+ if (context.defaultChangesetComment()) {
+ corePreferences("comment", context.defaultChangesetComment());
+ corePreferences("commentDate", Date.now());
+ }
+ if (context.defaultChangesetSource()) {
+ corePreferences("source", context.defaultChangesetSource());
+ corePreferences("commentDate", Date.now());
+ }
+ if (context.defaultChangesetHashtags()) {
+ corePreferences("hashtags", context.defaultChangesetHashtags());
+ corePreferences("commentDate", Date.now());
+ }
+ var detected = utilDetect();
+ var tags = {
+ comment: corePreferences("comment") || "",
+ created_by: context.cleanTagValue("iD " + context.version),
+ host: context.cleanTagValue(detected.host),
+ locale: context.cleanTagValue(_mainLocalizer.localeCode())
+ };
+ findHashtags(tags, true);
+ var hashtags = corePreferences("hashtags");
+ if (hashtags) {
+ tags.hashtags = hashtags;
+ }
+ var source = corePreferences("source");
+ if (source) {
+ tags.source = source;
+ }
+ var photoOverlaysUsed = context.history().photoOverlaysUsed();
+ if (photoOverlaysUsed.length) {
+ var sources = (tags.source || "").split(";");
+ if (sources.indexOf("streetlevel imagery") === -1) {
+ sources.push("streetlevel imagery");
+ }
+ photoOverlaysUsed.forEach(function(photoOverlay) {
+ if (sources.indexOf(photoOverlay) === -1) {
+ sources.push(photoOverlay);
+ }
+ });
+ tags.source = context.cleanTagValue(sources.join(";"));
+ }
+ context.changeset = new osmChangeset({ tags });
+ }
+ function loadDerivedChangesetTags() {
+ var osm = context.connection();
+ if (!osm)
+ return;
+ var tags = Object.assign({}, context.changeset.tags);
+ var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
+ tags.imagery_used = imageryUsed || "None";
+ var osmClosed = osm.getClosedIDs();
+ var itemType;
+ if (osmClosed.length) {
+ tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
+ }
+ if (services.keepRight) {
+ var krClosed = services.keepRight.getClosedIDs();
+ if (krClosed.length) {
+ tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
}
-
- function inputevent() {
- geocodeResults = undefined;
- drawList();
+ }
+ if (services.improveOSM) {
+ var iOsmClosed = services.improveOSM.getClosedCounts();
+ for (itemType in iOsmClosed) {
+ tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
}
-
- var searchWrap = selection.append('div')
- .attr('class', 'search-header');
-
- var search = searchWrap.append('input')
- .attr('placeholder', t('inspector.search'))
- .attr('type', 'search')
- .on('keypress', keypress)
- .on('input', inputevent);
-
- searchWrap
- .call(iD.svg.Icon('#icon-search', 'pre-text'));
-
- var listWrap = selection.append('div')
- .attr('class', 'inspector-body');
-
- var list = listWrap.append('div')
- .attr('class', 'feature-list cf');
-
- context
- .on('exit.feature-list', clearSearch);
- context.map()
- .on('drawn.feature-list', mapDrawn);
-
- function clearSearch() {
- search.property('value', '');
- drawList();
+ }
+ if (services.osmose) {
+ var osmoseClosed = services.osmose.getClosedCounts();
+ for (itemType in osmoseClosed) {
+ tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
}
-
- function mapDrawn(e) {
- if (e.full) {
- drawList();
- }
+ }
+ for (var key in tags) {
+ if (key.match(/(^warnings:)|(^resolved:)/)) {
+ delete tags[key];
}
-
- function features() {
- var entities = {},
- result = [],
- graph = context.graph(),
- q = search.property('value').toLowerCase();
-
- if (!q) return result;
-
- var idMatch = q.match(/^([nwr])([0-9]+)$/);
-
- if (idMatch) {
- result.push({
- id: idMatch[0],
- geometry: idMatch[1] === 'n' ? 'point' : idMatch[1] === 'w' ? 'line' : 'relation',
- type: idMatch[1] === 'n' ? t('inspector.node') : idMatch[1] === 'w' ? t('inspector.way') : t('inspector.relation'),
- name: idMatch[2]
- });
- }
-
- var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
-
- if (locationMatch) {
- var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])];
- result.push({
- id: -1,
- geometry: 'point',
- type: t('inspector.location'),
- name: loc[0].toFixed(6) + ', ' + loc[1].toFixed(6),
- location: loc
- });
- }
-
- function addEntity(entity) {
- if (entity.id in entities || result.length > 200)
- return;
-
- entities[entity.id] = true;
-
- var name = iD.util.displayName(entity) || '';
- if (name.toLowerCase().indexOf(q) >= 0) {
- result.push({
- id: entity.id,
- entity: entity,
- geometry: context.geometry(entity.id),
- type: context.presets().match(entity, graph).name(),
- name: name
- });
- }
-
- graph.parentRelations(entity).forEach(function(parent) {
- addEntity(parent);
- });
- }
-
- var visible = context.surface().selectAll('.point, .line, .area')[0];
- for (var i = 0; i < visible.length && result.length <= 200; i++) {
- addEntity(visible[i].__data__);
+ }
+ function addIssueCounts(issues, prefix) {
+ var issuesByType = utilArrayGroupBy(issues, "type");
+ for (var issueType in issuesByType) {
+ var issuesOfType = issuesByType[issueType];
+ if (issuesOfType[0].subtype) {
+ var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
+ for (var issueSubtype in issuesBySubtype) {
+ var issuesOfSubtype = issuesBySubtype[issueSubtype];
+ tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
}
-
- (geocodeResults || []).forEach(function(d) {
- // https://github.com/openstreetmap/iD/issues/1890
- if (d.osm_type && d.osm_id) {
- result.push({
- id: iD.Entity.id.fromOSM(d.osm_type, d.osm_id),
- geometry: d.osm_type === 'relation' ? 'relation' : d.osm_type === 'way' ? 'line' : 'point',
- type: d.type !== 'yes' ? (d.type.charAt(0).toUpperCase() + d.type.slice(1)).replace('_', ' ')
- : (d.class.charAt(0).toUpperCase() + d.class.slice(1)).replace('_', ' '),
- name: d.display_name,
- extent: new iD.geo.Extent(
- [parseFloat(d.boundingbox[3]), parseFloat(d.boundingbox[0])],
- [parseFloat(d.boundingbox[2]), parseFloat(d.boundingbox[1])])
- });
- }
- });
-
- return result;
+ } else {
+ tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
+ }
}
-
- function drawList() {
- var value = search.property('value'),
- results = features();
-
- list.classed('filtered', value.length);
-
- var noResultsWorldwide = geocodeResults && geocodeResults.length === 0;
-
- var resultsIndicator = list.selectAll('.no-results-item')
- .data([0])
- .enter().append('button')
- .property('disabled', true)
- .attr('class', 'no-results-item')
- .call(iD.svg.Icon('#icon-alert', 'pre-text'));
-
- resultsIndicator.append('span')
- .attr('class', 'entity-name');
-
- list.selectAll('.no-results-item .entity-name')
- .text(noResultsWorldwide ? t('geocoder.no_results_worldwide') : t('geocoder.no_results_visible'));
-
- list.selectAll('.geocode-item')
- .data([0])
- .enter().append('button')
- .attr('class', 'geocode-item')
- .on('click', geocode)
- .append('div')
- .attr('class', 'label')
- .append('span')
- .attr('class', 'entity-name')
- .text(t('geocoder.search'));
-
- list.selectAll('.no-results-item')
- .style('display', (value.length && !results.length) ? 'block' : 'none');
-
- list.selectAll('.geocode-item')
- .style('display', (value && geocodeResults === undefined) ? 'block' : 'none');
-
- list.selectAll('.feature-list-item')
- .data([-1])
- .remove();
-
- var items = list.selectAll('.feature-list-item')
- .data(results, function(d) { return d.id; });
-
- var enter = items.enter()
- .insert('button', '.geocode-item')
- .attr('class', 'feature-list-item')
- .on('mouseover', mouseover)
- .on('mouseout', mouseout)
- .on('click', click);
-
- var label = enter
- .append('div')
- .attr('class', 'label');
-
- label.each(function(d) {
- d3.select(this)
- .call(iD.svg.Icon('#icon-' + d.geometry, 'pre-text'));
- });
-
- label.append('span')
- .attr('class', 'entity-type')
- .text(function(d) { return d.type; });
-
- label.append('span')
- .attr('class', 'entity-name')
- .text(function(d) { return d.name; });
-
- enter.style('opacity', 0)
- .transition()
- .style('opacity', 1);
-
- items.order();
-
- items.exit()
- .remove();
+ }
+ var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
+ return issue.type !== "help_request";
+ });
+ addIssueCounts(warnings, "warnings");
+ var resolvedIssues = context.validator().getResolvedIssues();
+ addIssueCounts(resolvedIssues, "resolved");
+ context.changeset = context.changeset.update({ tags });
+ }
+ function render(selection2) {
+ var osm = context.connection();
+ if (!osm)
+ return;
+ var header = selection2.selectAll(".header").data([0]);
+ var headerTitle = header.enter().append("div").attr("class", "header fillL");
+ headerTitle.append("div").append("h2").call(_t.append("commit.title"));
+ headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
+ dispatch10.call("cancel", this);
+ }).call(svgIcon("#iD-icon-close"));
+ var body = selection2.selectAll(".body").data([0]);
+ body = body.enter().append("div").attr("class", "body").merge(body);
+ var changesetSection = body.selectAll(".changeset-editor").data([0]);
+ changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
+ changesetSection.call(changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags));
+ body.call(commitWarnings);
+ var saveSection = body.selectAll(".save-section").data([0]);
+ saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
+ var prose = saveSection.selectAll(".commit-info").data([0]);
+ if (prose.enter().size()) {
+ _userDetails2 = null;
+ }
+ prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
+ osm.userDetails(function(err, user) {
+ if (err)
+ return;
+ if (_userDetails2 === user)
+ return;
+ _userDetails2 = user;
+ var userLink = select_default2(document.createElement("div"));
+ if (user.image_url) {
+ userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
+ }
+ userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
+ prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
+ });
+ var requestReview = saveSection.selectAll(".request-review").data([0]);
+ var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
+ var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
+ var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
+ if (!labelEnter.empty()) {
+ labelEnter.call(uiTooltip().title(_t.html("commit.request_review_info")).placement("top"));
+ }
+ labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
+ labelEnter.append("span").call(_t.append("commit.request_review"));
+ requestReview = requestReview.merge(requestReviewEnter);
+ var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
+ var buttonSection = saveSection.selectAll(".buttons").data([0]);
+ var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
+ buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
+ var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
+ uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
+ var uploadBlockerTooltipText = getUploadBlockerMessage();
+ buttonSection = buttonSection.merge(buttonEnter);
+ buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
+ dispatch10.call("cancel", this);
+ });
+ buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
+ if (!select_default2(this).classed("disabled")) {
+ this.blur();
+ for (var key in context.changeset.tags) {
+ if (!key)
+ delete context.changeset.tags[key];
+ }
+ context.uploader().save(context.changeset);
}
-
- function mouseover(d) {
- if (d.id === -1) return;
-
- context.surface().selectAll(iD.util.entityOrMemberSelector([d.id], context.graph()))
- .classed('hover', true);
+ });
+ uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
+ if (uploadBlockerTooltipText) {
+ buttonSection.selectAll(".save-button").call(uiTooltip().title(uploadBlockerTooltipText).placement("top"));
+ }
+ var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
+ tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
+ tagSection.call(rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render);
+ var changesSection = body.selectAll(".commit-changes-section").data([0]);
+ changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
+ changesSection.call(commitChanges.render);
+ function toggleRequestReview() {
+ var rr = requestReviewInput.property("checked");
+ updateChangeset({ review_requested: rr ? "yes" : void 0 });
+ tagSection.call(rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render);
+ }
+ }
+ function getUploadBlockerMessage() {
+ var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
+ if (errors.length) {
+ return _t("commit.outstanding_errors_message", { count: errors.length });
+ } else {
+ var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
+ if (!hasChangesetComment) {
+ return _t("commit.comment_needed_message");
}
-
- function mouseout() {
- context.surface().selectAll('.hover')
- .classed('hover', false);
+ }
+ return null;
+ }
+ function changeTags(_, changed, onInput) {
+ if (changed.hasOwnProperty("comment")) {
+ if (changed.comment === void 0) {
+ changed.comment = "";
}
-
- function click(d) {
- d3.event.preventDefault();
- if (d.location) {
- context.map().centerZoom([d.location[1], d.location[0]], 20);
- }
- else if (d.entity) {
- if (d.entity.type === 'node') {
- context.map().center(d.entity.loc);
- } else if (d.entity.type === 'way') {
- var center = context.projection(context.map().center()),
- edge = iD.geo.chooseEdge(context.childNodes(d.entity), center, context.projection);
- context.map().center(edge.loc);
- }
- context.enter(iD.modes.Select(context, [d.entity.id]).suppressMenu(true));
- } else {
- context.zoomToEntity(d.id);
- }
+ if (!onInput) {
+ corePreferences("comment", changed.comment);
+ corePreferences("commentDate", Date.now());
}
-
- function geocode() {
- var searchVal = encodeURIComponent(search.property('value'));
- d3.json('https://nominatim.openstreetmap.org/search/' + searchVal + '?limit=10&format=json', function(err, resp) {
- geocodeResults = resp || [];
- drawList();
- });
+ }
+ if (changed.hasOwnProperty("source")) {
+ if (changed.source === void 0) {
+ corePreferences("source", null);
+ } else if (!onInput) {
+ corePreferences("source", changed.source);
+ corePreferences("commentDate", Date.now());
}
+ }
+ updateChangeset(changed, onInput);
+ if (_selection) {
+ _selection.call(render);
+ }
}
-
- return featureList;
-};
-iD.ui.flash = function(selection) {
- var modal = iD.ui.modal(selection);
-
- modal.select('.modal').classed('modal-flash', true);
-
- modal.select('.content')
- .classed('modal-section', true)
- .append('div')
- .attr('class', 'description');
-
- modal.on('click.flash', function() { modal.remove(); });
-
- setTimeout(function() {
- modal.remove();
- return true;
- }, 1500);
-
- return modal;
-};
-iD.ui.FullScreen = function(context) {
- var element = context.container().node(),
- keybinding = d3.keybinding('full-screen');
- // button;
-
- function getFullScreenFn() {
- if (element.requestFullscreen) {
- return element.requestFullscreen;
- } else if (element.msRequestFullscreen) {
- return element.msRequestFullscreen;
- } else if (element.mozRequestFullScreen) {
- return element.mozRequestFullScreen;
- } else if (element.webkitRequestFullscreen) {
- return element.webkitRequestFullscreen;
+ function findHashtags(tags, commentOnly) {
+ var detectedHashtags = commentHashtags();
+ if (detectedHashtags.length) {
+ corePreferences("hashtags", null);
+ }
+ if (!detectedHashtags.length || !commentOnly) {
+ detectedHashtags = detectedHashtags.concat(hashtagHashtags());
+ }
+ var allLowerCase = /* @__PURE__ */ new Set();
+ return detectedHashtags.filter(function(hashtag) {
+ var lowerCase = hashtag.toLowerCase();
+ if (!allLowerCase.has(lowerCase)) {
+ allLowerCase.add(lowerCase);
+ return true;
}
+ return false;
+ });
+ function commentHashtags() {
+ var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
+ return matches || [];
+ }
+ function hashtagHashtags() {
+ var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s) {
+ if (s[0] !== "#") {
+ s = "#" + s;
+ }
+ var matched = s.match(hashtagRegex);
+ return matched && matched[0];
+ }).filter(Boolean);
+ return matches || [];
+ }
}
-
- function getExitFullScreenFn() {
- if (document.exitFullscreen) {
- return document.exitFullscreen;
- } else if (document.msExitFullscreen) {
- return document.msExitFullscreen;
- } else if (document.mozCancelFullScreen) {
- return document.mozCancelFullScreen;
- } else if (document.webkitExitFullscreen) {
- return document.webkitExitFullscreen;
+ function isReviewRequested(tags) {
+ var rr = tags.review_requested;
+ if (rr === void 0)
+ return false;
+ rr = rr.trim().toLowerCase();
+ return !(rr === "" || rr === "no");
+ }
+ function updateChangeset(changed, onInput) {
+ var tags = Object.assign({}, context.changeset.tags);
+ Object.keys(changed).forEach(function(k) {
+ var v = changed[k];
+ k = context.cleanTagKey(k);
+ if (readOnlyTags.indexOf(k) !== -1)
+ return;
+ if (v === void 0) {
+ delete tags[k];
+ } else if (onInput) {
+ tags[k] = v;
+ } else {
+ tags[k] = context.cleanTagValue(v);
}
- }
-
- function isFullScreen() {
- return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement ||
- document.msFullscreenElement;
- }
-
- function isSupported() {
- return !!getFullScreenFn();
- }
-
- function fullScreen() {
- d3.event.preventDefault();
- if (!isFullScreen()) {
- // button.classed('active', true);
- getFullScreenFn().apply(element);
+ });
+ if (!onInput) {
+ var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
+ var arr = findHashtags(tags, commentOnly);
+ if (arr.length) {
+ tags.hashtags = context.cleanTagValue(arr.join(";"));
+ corePreferences("hashtags", tags.hashtags);
} else {
- // button.classed('active', false);
- getExitFullScreenFn().apply(document);
+ delete tags.hashtags;
+ corePreferences("hashtags", null);
}
+ }
+ if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
+ var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
+ tags.changesets_count = String(changesetsCount);
+ if (changesetsCount <= 100) {
+ var s;
+ s = corePreferences("walkthrough_completed");
+ if (s) {
+ tags["ideditor:walkthrough_completed"] = s;
+ }
+ s = corePreferences("walkthrough_progress");
+ if (s) {
+ tags["ideditor:walkthrough_progress"] = s;
+ }
+ s = corePreferences("walkthrough_started");
+ if (s) {
+ tags["ideditor:walkthrough_started"] = s;
+ }
+ }
+ } else {
+ delete tags.changesets_count;
+ }
+ if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
+ context.changeset = context.changeset.update({ tags });
+ }
}
-
- return function() { // selection) {
- if (!isSupported())
- return;
-
- // var tooltip = bootstrap.tooltip()
- // .placement('left');
-
- // button = selection.append('button')
- // .attr('title', t('full_screen'))
- // .attr('tabindex', -1)
- // .on('click', fullScreen)
- // .call(tooltip);
-
- // button.append('span')
- // .attr('class', 'icon full-screen');
-
- keybinding
- .on('f11', fullScreen)
- .on(iD.ui.cmd('ââ§F'), fullScreen);
-
- d3.select(document)
- .call(keybinding);
+ commit.reset = function() {
+ context.changeset = null;
};
-};
-iD.ui.Geolocate = function(context) {
- var geoOptions = { enableHighAccuracy: false, timeout: 6000 /* 6sec */ },
- locating = iD.ui.Loading(context).message(t('geolocate.locating')).blocking(true),
- timeoutId;
+ return utilRebind(commit, dispatch10, "on");
+ }
- function click() {
- context.enter(iD.modes.Browse(context));
- context.container().call(locating);
- navigator.geolocation.getCurrentPosition(success, error, geoOptions);
+ // modules/ui/confirm.js
+ function uiConfirm(selection2) {
+ var modalSelection = uiModal(selection2);
+ modalSelection.select(".modal").classed("modal-alert", true);
+ var section = modalSelection.select(".content");
+ section.append("div").attr("class", "modal-section header");
+ section.append("div").attr("class", "modal-section message-text");
+ var buttons = section.append("div").attr("class", "modal-section buttons cf");
+ modalSelection.okButton = function() {
+ buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
+ modalSelection.remove();
+ }).call(_t.append("confirm.okay")).node().focus();
+ return modalSelection;
+ };
+ return modalSelection;
+ }
- // This timeout ensures that we still call finish() even if
- // the user declines to share their location in Firefox
- timeoutId = setTimeout(finish, 10000 /* 10sec */ );
+ // modules/ui/conflicts.js
+ function uiConflicts(context) {
+ var dispatch10 = dispatch_default("cancel", "save");
+ var keybinding = utilKeybinding("conflicts");
+ var _origChanges;
+ var _conflictList;
+ var _shownConflictIndex;
+ function keybindingOn() {
+ select_default2(document).call(keybinding.on("\u238B", cancel, true));
}
-
- function success(position) {
- var map = context.map(),
- extent = iD.geo.Extent([position.coords.longitude, position.coords.latitude])
- .padByMeters(position.coords.accuracy);
-
- map.centerZoom(extent.center(), Math.min(20, map.extentZoom(extent)));
- finish();
+ function keybindingOff() {
+ select_default2(document).call(keybinding.unbind);
}
-
- function error() {
- finish();
+ function tryAgain() {
+ keybindingOff();
+ dispatch10.call("save");
}
-
- function finish() {
- locating.close(); // unblock ui
- if (timeoutId) { clearTimeout(timeoutId); }
- timeoutId = undefined;
+ function cancel() {
+ keybindingOff();
+ dispatch10.call("cancel");
+ }
+ function conflicts(selection2) {
+ keybindingOn();
+ var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
+ headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
+ headerEnter.append("h2").call(_t.append("save.conflict.header"));
+ var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
+ var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
+ var changeset = new osmChangeset();
+ delete changeset.id;
+ var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
+ var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
+ var fileName = "changes.osc";
+ var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
+ linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
+ linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
+ bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
+ bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
+ var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
+ buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
+ buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
+ }
+ function showConflict(selection2, index) {
+ index = utilWrap(index, _conflictList.length);
+ _shownConflictIndex = index;
+ var parent = select_default2(selection2.node().parentNode);
+ if (index === _conflictList.length - 1) {
+ window.setTimeout(function() {
+ parent.select(".conflicts-button").attr("disabled", null);
+ parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
+ }, 250);
+ }
+ var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
+ conflict.exit().remove();
+ var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
+ conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
+ conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d) {
+ return d.name;
+ }).on("click", function(d3_event, d) {
+ d3_event.preventDefault();
+ zoomToEntity(d.id);
+ });
+ var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
+ details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d) {
+ return d.details || [];
+ }).enter().append("li").attr("class", "conflict-detail-item").html(function(d) {
+ return d;
+ });
+ details.append("div").attr("class", "conflict-choices").call(addChoices);
+ details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").html(function(d) {
+ return _t.html("save.conflict." + d);
+ }).attr("class", "conflict-nav-button action col6").attr("disabled", function(d, i2) {
+ return i2 === 0 && index === 0 || i2 === 1 && index === _conflictList.length - 1 || null;
+ }).on("click", function(d3_event, d) {
+ d3_event.preventDefault();
+ var container = parent.selectAll(".conflict-container");
+ var sign2 = d === "previous" ? -1 : 1;
+ container.selectAll(".conflict").remove();
+ container.call(showConflict, index + sign2);
+ });
}
-
- return function(selection) {
- if (!navigator.geolocation) return;
-
- selection.append('button')
- .attr('tabindex', -1)
- .attr('title', t('geolocate.title'))
- .on('click', click)
- .call(iD.svg.Icon('#icon-geolocate', 'light'))
- .call(bootstrap.tooltip()
- .placement('left'));
- };
-};
-iD.ui.Help = function(context) {
- var key = 'H';
-
- var docKeys = [
- 'help.help',
- 'help.editing_saving',
- 'help.roads',
- 'help.gps',
- 'help.imagery',
- 'help.addresses',
- 'help.inspector',
- 'help.buildings',
- 'help.relations'];
-
- var docs = docKeys.map(function(key) {
- var text = t(key);
- return {
- title: text.split('\n')[0].replace('#', '').trim(),
- html: marked(text.split('\n').slice(1).join('\n'))
- };
- });
-
- function help(selection) {
-
- function hide() {
- setVisible(false);
- }
-
- function toggle() {
- if (d3.event) d3.event.preventDefault();
- tooltip.hide(button);
- setVisible(!button.classed('active'));
- }
-
- function setVisible(show) {
- if (show !== shown) {
- button.classed('active', show);
- shown = show;
-
- if (show) {
- selection.on('mousedown.help-inside', function() {
- return d3.event.stopPropagation();
- });
- pane.style('display', 'block')
- .style('right', '-500px')
- .transition()
- .duration(200)
- .style('right', '0px');
- } else {
- pane.style('right', '0px')
- .transition()
- .duration(200)
- .style('right', '-500px')
- .each('end', function() {
- d3.select(this).style('display', 'none');
- });
- selection.on('mousedown.help-inside', null);
- }
- }
- }
-
- function clickHelp(d, i) {
- pane.property('scrollTop', 0);
- doctitle.html(d.title);
- body.html(d.html);
- body.selectAll('a')
- .attr('target', '_blank');
- menuItems.classed('selected', function(m) {
- return m.title === d.title;
- });
-
- nav.html('');
-
- if (i > 0) {
- var prevLink = nav.append('a')
- .attr('class', 'previous')
- .on('click', function() {
- clickHelp(docs[i - 1], i - 1);
- });
- prevLink.append('span').html('◄ ' + docs[i - 1].title);
- }
- if (i < docs.length - 1) {
- var nextLink = nav.append('a')
- .attr('class', 'next')
- .on('click', function() {
- clickHelp(docs[i + 1], i + 1);
- });
- nextLink.append('span').html(docs[i + 1].title + ' ►');
- }
- }
-
- function clickWalkthrough() {
- d3.select(document.body).call(iD.ui.intro(context));
- setVisible(false);
- }
-
-
- var pane = selection.append('div')
- .attr('class', 'help-wrap map-overlay fillL col5 content hide'),
- tooltip = bootstrap.tooltip()
- .placement('left')
- .html(true)
- .title(iD.ui.tooltipHtml(t('help.title'), key)),
- button = selection.append('button')
- .attr('tabindex', -1)
- .on('click', toggle)
- .call(iD.svg.Icon('#icon-help', 'light'))
- .call(tooltip),
- shown = false;
-
-
- var toc = pane.append('ul')
- .attr('class', 'toc');
-
- var menuItems = toc.selectAll('li')
- .data(docs)
- .enter()
- .append('li')
- .append('a')
- .html(function(d) { return d.title; })
- .on('click', clickHelp);
-
- toc.append('li')
- .attr('class','walkthrough')
- .append('a')
- .text(t('splash.walkthrough'))
- .on('click', clickWalkthrough);
-
- var content = pane.append('div')
- .attr('class', 'left-content');
-
- var doctitle = content.append('h2')
- .text(t('help.title'));
-
- var body = content.append('div')
- .attr('class', 'body');
-
- var nav = content.append('div')
- .attr('class', 'nav');
-
- clickHelp(docs[0], 0);
-
- var keybinding = d3.keybinding('help')
- .on(key, toggle)
- .on('B', hide)
- .on('F', hide);
-
- d3.select(document)
- .call(keybinding);
-
- context.surface().on('mousedown.help-outside', hide);
- context.container().on('mousedown.help-outside', hide);
+ function addChoices(selection2) {
+ var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d) {
+ return d.choices || [];
+ });
+ var choicesEnter = choices.enter().append("li").attr("class", "layer");
+ var labelEnter = choicesEnter.append("label");
+ labelEnter.append("input").attr("type", "radio").attr("name", function(d) {
+ return d.id;
+ }).on("change", function(d3_event, d) {
+ var ul = this.parentNode.parentNode.parentNode;
+ ul.__data__.chosen = d.id;
+ choose(d3_event, ul, d);
+ });
+ labelEnter.append("span").text(function(d) {
+ return d.text;
+ });
+ choicesEnter.merge(choices).each(function(d) {
+ var ul = this.parentNode;
+ if (ul.__data__.chosen === d.id) {
+ choose(null, ul, d);
+ }
+ });
}
-
- return help;
-};
-iD.ui.Info = function(context) {
- var key = iD.ui.cmd('âI'),
- imperial = (iD.detect().locale.toLowerCase() === 'en-us'),
- hidden = true;
-
- function info(selection) {
- function radiansToMeters(r) {
- // using WGS84 authalic radius (6371007.1809 m)
- return r * 6371007.1809;
+ function choose(d3_event, ul, datum2) {
+ if (d3_event)
+ d3_event.preventDefault();
+ select_default2(ul).selectAll("li").classed("active", function(d) {
+ return d === datum2;
+ }).selectAll("input").property("checked", function(d) {
+ return d === datum2;
+ });
+ var extent = geoExtent();
+ var entity;
+ entity = context.graph().hasEntity(datum2.id);
+ if (entity)
+ extent._extend(entity.extent(context.graph()));
+ datum2.action();
+ entity = context.graph().hasEntity(datum2.id);
+ if (entity)
+ extent._extend(entity.extent(context.graph()));
+ zoomToEntity(datum2.id, extent);
+ }
+ function zoomToEntity(id2, extent) {
+ context.surface().selectAll(".hover").classed("hover", false);
+ var entity = context.graph().hasEntity(id2);
+ if (entity) {
+ if (extent) {
+ context.map().trimmedExtent(extent);
+ } else {
+ context.map().zoomToEase(entity);
}
+ context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
+ }
+ }
+ conflicts.conflictList = function(_) {
+ if (!arguments.length)
+ return _conflictList;
+ _conflictList = _;
+ return conflicts;
+ };
+ conflicts.origChanges = function(_) {
+ if (!arguments.length)
+ return _origChanges;
+ _origChanges = _;
+ return conflicts;
+ };
+ conflicts.shownEntityIds = function() {
+ if (_conflictList && typeof _shownConflictIndex === "number") {
+ return [_conflictList[_shownConflictIndex].id];
+ }
+ return [];
+ };
+ return utilRebind(conflicts, dispatch10, "on");
+ }
- function steradiansToSqmeters(r) {
- // http://gis.stackexchange.com/a/124857/40446
- return r / 12.56637 * 510065621724000;
+ // modules/ui/entity_editor.js
+ var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
+
+ // modules/ui/sections/entity_issues.js
+ function uiSectionEntityIssues(context) {
+ var preference = corePreferences("entity-issues.reference.expanded");
+ var _expanded = preference === null ? true : preference === "true";
+ var _entityIDs = [];
+ var _issues = [];
+ var _activeIssueID;
+ var section = uiSection("entity-issues", context).shouldDisplay(function() {
+ return _issues.length > 0;
+ }).label(function() {
+ return _t.html("inspector.title_count", { title: { html: _t.html("issues.list_title") }, count: _issues.length });
+ }).disclosureContent(renderDisclosureContent);
+ context.validator().on("validated.entity_issues", function() {
+ reloadIssues();
+ section.reRender();
+ }).on("focusedIssue.entity_issues", function(issue) {
+ makeActiveIssue(issue.id);
+ });
+ function reloadIssues() {
+ _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
+ }
+ function makeActiveIssue(issueID) {
+ _activeIssueID = issueID;
+ section.selection().selectAll(".issue-container").classed("active", function(d) {
+ return d.id === _activeIssueID;
+ });
+ }
+ function renderDisclosureContent(selection2) {
+ selection2.classed("grouped-items-area", true);
+ _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
+ var containers = selection2.selectAll(".issue-container").data(_issues, function(d) {
+ return d.key;
+ });
+ containers.exit().remove();
+ var containersEnter = containers.enter().append("div").attr("class", "issue-container");
+ var itemsEnter = containersEnter.append("div").attr("class", function(d) {
+ return "issue severity-" + d.severity;
+ }).on("mouseover.highlight", function(d3_event, d) {
+ var ids = d.entityIds.filter(function(e) {
+ return _entityIDs.indexOf(e) === -1;
+ });
+ utilHighlightEntities(ids, true, context);
+ }).on("mouseout.highlight", function(d3_event, d) {
+ var ids = d.entityIds.filter(function(e) {
+ return _entityIDs.indexOf(e) === -1;
+ });
+ utilHighlightEntities(ids, false, context);
+ });
+ var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
+ var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d) {
+ makeActiveIssue(d.id);
+ var extent = d.extent(context.graph());
+ if (extent) {
+ var setZoom = Math.max(context.map().zoom(), 19);
+ context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
}
-
- function toLineString(feature) {
- if (feature.type === 'LineString') return feature;
-
- var result = { type: 'LineString', coordinates: [] };
- if (feature.type === 'Polygon') {
- result.coordinates = feature.coordinates[0];
- } else if (feature.type === 'MultiPolygon') {
- result.coordinates = feature.coordinates[0][0];
- }
-
- return result;
+ });
+ textEnter.each(function(d) {
+ var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
+ select_default2(this).call(svgIcon(iconName, "issue-icon"));
+ });
+ textEnter.append("span").attr("class", "issue-message");
+ var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
+ infoButton.on("click", function(d3_event) {
+ d3_event.stopPropagation();
+ d3_event.preventDefault();
+ this.blur();
+ var container = select_default2(this.parentNode.parentNode.parentNode);
+ var info = container.selectAll(".issue-info");
+ var isExpanded = info.classed("expanded");
+ _expanded = !isExpanded;
+ corePreferences("entity-issues.reference.expanded", _expanded);
+ if (isExpanded) {
+ info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
+ info.classed("expanded", false);
+ });
+ } else {
+ info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
+ info.style("max-height", null);
+ });
}
-
- function displayLength(m) {
- var d = m * (imperial ? 3.28084 : 1),
- p, unit;
-
- if (imperial) {
- if (d >= 5280) {
- d /= 5280;
- unit = 'mi';
- } else {
- unit = 'ft';
- }
- } else {
- if (d >= 1000) {
- d /= 1000;
- unit = 'km';
- } else {
- unit = 'm';
- }
- }
-
- // drop unnecessary precision
- p = d > 1000 ? 0 : d > 100 ? 1 : 2;
-
- return String(d.toFixed(p)) + ' ' + unit;
+ });
+ itemsEnter.append("ul").attr("class", "issue-fix-list");
+ containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d) {
+ if (typeof d.reference === "function") {
+ select_default2(this).call(d.reference);
+ } else {
+ select_default2(this).call(_t.append("inspector.no_documentation_key"));
}
-
- function displayArea(m2) {
- var d = m2 * (imperial ? 10.7639111056 : 1),
- d1, d2, p1, p2, unit1, unit2;
-
- if (imperial) {
- if (d >= 6969600) { // > 0.25mi² show mi²
- d1 = d / 27878400;
- unit1 = 'mi²';
- } else {
- d1 = d;
- unit1 = 'ft²';
- }
-
- if (d > 4356 && d < 43560000) { // 0.1 - 1000 acres
- d2 = d / 43560;
- unit2 = 'ac';
- }
-
- } else {
- if (d >= 250000) { // > 0.25km² show km²
- d1 = d / 1000000;
- unit1 = 'km²';
- } else {
- d1 = d;
- unit1 = 'm²';
- }
-
- if (d > 1000 && d < 10000000) { // 0.1 - 1000 hectares
- d2 = d / 10000;
- unit2 = 'ha';
- }
- }
-
- // drop unnecessary precision
- p1 = d1 > 1000 ? 0 : d1 > 100 ? 1 : 2;
- p2 = d2 > 1000 ? 0 : d2 > 100 ? 1 : 2;
-
- return String(d1.toFixed(p1)) + ' ' + unit1 +
- (d2 ? ' (' + String(d2.toFixed(p2)) + ' ' + unit2 + ')' : '');
+ });
+ containers = containers.merge(containersEnter).classed("active", function(d) {
+ return d.id === _activeIssueID;
+ });
+ containers.selectAll(".issue-message").html(function(d) {
+ return d.message(context);
+ });
+ var fixLists = containers.selectAll(".issue-fix-list");
+ var fixes = fixLists.selectAll(".issue-fix-item").data(function(d) {
+ return d.fixes ? d.fixes(context) : [];
+ }, function(fix) {
+ return fix.id;
+ });
+ fixes.exit().remove();
+ var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
+ var buttons = fixesEnter.append("button").on("click", function(d3_event, d) {
+ if (select_default2(this).attr("disabled") || !d.onClick)
+ return;
+ if (d.issue.dateLastRanFix && new Date() - d.issue.dateLastRanFix < 1e3)
+ return;
+ d.issue.dateLastRanFix = new Date();
+ utilHighlightEntities(d.issue.entityIds.concat(d.entityIds), false, context);
+ new Promise(function(resolve, reject) {
+ d.onClick(context, resolve, reject);
+ if (d.onClick.length <= 1) {
+ resolve();
+ }
+ }).then(function() {
+ context.validator().validate();
+ });
+ }).on("mouseover.highlight", function(d3_event, d) {
+ utilHighlightEntities(d.entityIds, true, context);
+ }).on("mouseout.highlight", function(d3_event, d) {
+ utilHighlightEntities(d.entityIds, false, context);
+ });
+ buttons.each(function(d) {
+ var iconName = d.icon || "iD-icon-wrench";
+ if (iconName.startsWith("maki")) {
+ iconName += "-15";
}
-
-
- function redraw() {
- if (hidden) return;
-
- var resolver = context.graph(),
- selected = _.filter(context.selectedIDs(), function(e) { return context.hasEntity(e); }),
- singular = selected.length === 1 ? selected[0] : null,
- extent = iD.geo.Extent(),
- entity;
-
- wrap.html('');
- wrap.append('h4')
- .attr('class', 'infobox-heading fillD')
- .text(singular || t('infobox.selected', { n: selected.length }));
-
- if (!selected.length) return;
-
- var center;
- for (var i = 0; i < selected.length; i++) {
- entity = context.entity(selected[i]);
- extent._extend(entity.extent(resolver));
- }
- center = extent.center();
-
-
- var list = wrap.append('ul');
-
- // multiple wrap, just display extent center..
- if (!singular) {
- list.append('li')
- .text(t('infobox.center') + ': ' + center[0].toFixed(5) + ', ' + center[1].toFixed(5));
- return;
- }
-
- // single wrap, display details..
- if (!entity) return;
- var geometry = entity.geometry(resolver);
-
- if (geometry === 'line' || geometry === 'area') {
- var closed = (entity.type === 'relation') || (entity.isClosed() && !entity.isDegenerate()),
- feature = entity.asGeoJSON(resolver),
- length = radiansToMeters(d3.geo.length(toLineString(feature))),
- lengthLabel = t('infobox.' + (closed ? 'perimeter' : 'length')),
- centroid = d3.geo.centroid(feature);
-
- list.append('li')
- .text(t('infobox.geometry') + ': ' +
- (closed ? t('infobox.closed') + ' ' : '') + t('geometry.' + geometry) );
-
- if (closed) {
- var area = steradiansToSqmeters(entity.area(resolver));
- list.append('li')
- .text(t('infobox.area') + ': ' + displayArea(area));
- }
-
- list.append('li')
- .text(lengthLabel + ': ' + displayLength(length));
-
- list.append('li')
- .text(t('infobox.centroid') + ': ' + centroid[0].toFixed(5) + ', ' + centroid[1].toFixed(5));
-
-
- var toggle = imperial ? 'imperial' : 'metric';
- wrap.append('a')
- .text(t('infobox.' + toggle))
- .attr('href', '#')
- .attr('class', 'button')
- .on('click', function() {
- d3.event.preventDefault();
- imperial = !imperial;
- redraw();
- });
-
- } else {
- var centerLabel = t('infobox.' + (entity.type === 'node' ? 'location' : 'center'));
-
- list.append('li')
- .text(t('infobox.geometry') + ': ' + t('geometry.' + geometry));
-
- list.append('li')
- .text(centerLabel + ': ' + center[0].toFixed(5) + ', ' + center[1].toFixed(5));
- }
+ select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
+ });
+ buttons.append("span").attr("class", "fix-message").html(function(d) {
+ return d.title;
+ });
+ fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d) {
+ return d.onClick;
+ }).attr("disabled", function(d) {
+ return d.onClick ? null : "true";
+ }).attr("title", function(d) {
+ if (d.disabledReason) {
+ return d.disabledReason;
}
+ return null;
+ });
+ }
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
+ _entityIDs = val;
+ _activeIssueID = null;
+ reloadIssues();
+ }
+ return section;
+ };
+ return section;
+ }
-
- function toggle() {
- if (d3.event) d3.event.preventDefault();
-
- hidden = !hidden;
-
- if (hidden) {
- wrap
- .style('display', 'block')
- .style('opacity', 1)
- .transition()
- .duration(200)
- .style('opacity', 0)
- .each('end', function() {
- d3.select(this).style('display', 'none');
- });
- } else {
- wrap
- .style('display', 'block')
- .style('opacity', 0)
- .transition()
- .duration(200)
- .style('opacity', 1);
-
- redraw();
- }
+ // modules/ui/preset_icon.js
+ function uiPresetIcon() {
+ let _preset;
+ let _geometry;
+ function presetIcon(selection2) {
+ selection2.each(render);
+ }
+ function getIcon(p, geom) {
+ if (p.icon)
+ return p.icon;
+ if (geom === "line")
+ return "iD-other-line";
+ if (geom === "vertex")
+ return p.isFallback() ? "" : "temaki-vertex";
+ return "maki-marker-stroked";
+ }
+ function renderPointBorder(container, drawPoint) {
+ let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
+ pointBorder.exit().remove();
+ let pointBorderEnter = pointBorder.enter();
+ const w = 40;
+ const h = 40;
+ pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`).append("path").attr("transform", "translate(11.5, 8)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
+ pointBorder = pointBorderEnter.merge(pointBorder);
+ }
+ function renderCategoryBorder(container, category) {
+ let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
+ categoryBorder.exit().remove();
+ let categoryBorderEnter = categoryBorder.enter();
+ const d = 60;
+ let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d).attr("height", d).attr("viewBox", `0 0 ${d} ${d}`);
+ svgEnter.append("path").attr("class", "area").attr("d", "M9.5,7.5 L25.5,7.5 L28.5,12.5 L49.5,12.5 C51.709139,12.5 53.5,14.290861 53.5,16.5 L53.5,43.5 C53.5,45.709139 51.709139,47.5 49.5,47.5 L10.5,47.5 C8.290861,47.5 6.5,45.709139 6.5,43.5 L6.5,12.5 L9.5,7.5 Z");
+ categoryBorder = categoryBorderEnter.merge(categoryBorder);
+ if (category) {
+ categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
+ }
+ }
+ function renderCircleFill(container, drawVertex) {
+ let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
+ vertexFill.exit().remove();
+ let vertexFillEnter = vertexFill.enter();
+ const w = 60;
+ const h = 60;
+ const d = 40;
+ vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`).append("circle").attr("cx", w / 2).attr("cy", h / 2).attr("r", d / 2);
+ vertexFill = vertexFillEnter.merge(vertexFill);
+ }
+ function renderSquareFill(container, drawArea, tagClasses) {
+ let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
+ fill.exit().remove();
+ let fillEnter = fill.enter();
+ const d = 60;
+ const w = d;
+ const h = d;
+ const l = d * 2 / 3;
+ const c1 = (w - l) / 2;
+ const c2 = c1 + l;
+ fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
+ ["fill", "stroke"].forEach((klass) => {
+ fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
+ });
+ const rVertex = 2.5;
+ [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
+ fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
+ });
+ const rMidpoint = 1.25;
+ [[c1, w / 2], [c2, w / 2], [h / 2, c1], [h / 2, c2]].forEach((point) => {
+ fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
+ });
+ fill = fillEnter.merge(fill);
+ fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
+ fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
+ }
+ function renderLine(container, drawLine, tagClasses) {
+ let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
+ line.exit().remove();
+ let lineEnter = line.enter();
+ const d = 60;
+ const w = d;
+ const h = d;
+ const y = Math.round(d * 0.72);
+ const l = Math.round(d * 0.6);
+ const r = 2.5;
+ const x12 = (w - l) / 2;
+ const x2 = x12 + l;
+ lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
+ ["casing", "stroke"].forEach((klass) => {
+ lineEnter.append("path").attr("d", `M${x12} ${y} L${x2} ${y}`).attr("class", `line ${klass}`);
+ });
+ [[x12 - 1, y], [x2 + 1, y]].forEach((point) => {
+ lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
+ });
+ line = lineEnter.merge(line);
+ line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
+ line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
+ }
+ function renderRoute(container, drawRoute, p) {
+ let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
+ route.exit().remove();
+ let routeEnter = route.enter();
+ const d = 60;
+ const w = d;
+ const h = d;
+ const y12 = Math.round(d * 0.8);
+ const y2 = Math.round(d * 0.68);
+ const l = Math.round(d * 0.6);
+ const r = 2;
+ const x12 = (w - l) / 2;
+ const x2 = x12 + l / 3;
+ const x3 = x2 + l / 3;
+ const x4 = x3 + l / 3;
+ routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w).attr("height", h).attr("viewBox", `0 0 ${w} ${h}`);
+ ["casing", "stroke"].forEach((klass) => {
+ routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
+ routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
+ routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
+ });
+ [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
+ routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r);
+ });
+ route = routeEnter.merge(route);
+ if (drawRoute) {
+ let routeType = p.tags.type === "waterway" ? "waterway" : p.tags.route;
+ const segmentPresetIDs = routeSegments[routeType];
+ for (let i2 in segmentPresetIDs) {
+ const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i2]);
+ const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
+ route.selectAll(`path.stroke.segment${i2}`).attr("class", `segment${i2} line stroke ${segmentTagClasses}`);
+ route.selectAll(`path.casing.segment${i2}`).attr("class", `segment${i2} line casing ${segmentTagClasses}`);
}
-
-
- var wrap = selection.selectAll('.infobox')
- .data([0]);
-
- wrap.enter()
- .append('div')
- .attr('class', 'infobox fillD2')
- .style('display', (hidden ? 'none' : 'block'));
-
- context.map()
- .on('drawn.info', redraw);
-
- redraw();
-
- var keybinding = d3.keybinding('info')
- .on(key, toggle);
-
- d3.select(document)
- .call(keybinding);
+ }
}
-
- return info;
-};
-iD.ui.Inspector = function(context) {
- var presetList = iD.ui.PresetList(context),
- entityEditor = iD.ui.EntityEditor(context),
- state = 'select',
- entityID,
- newFeature = false;
-
- function inspector(selection) {
- presetList
- .entityID(entityID)
- .autofocus(newFeature)
- .on('choose', setPreset);
-
- entityEditor
- .state(state)
- .entityID(entityID)
- .on('choose', showList);
-
- var $wrap = selection.selectAll('.panewrap')
- .data([0]);
-
- var $enter = $wrap.enter().append('div')
- .attr('class', 'panewrap');
-
- $enter.append('div')
- .attr('class', 'preset-list-pane pane');
-
- $enter.append('div')
- .attr('class', 'entity-editor-pane pane');
-
- var $presetPane = $wrap.select('.preset-list-pane');
- var $editorPane = $wrap.select('.entity-editor-pane');
-
- var graph = context.graph(),
- entity = context.entity(entityID),
- showEditor = state === 'hover' ||
- entity.isUsed(graph) ||
- entity.isHighwayIntersection(graph);
-
- if (showEditor) {
- $wrap.style('right', '0%');
- $editorPane.call(entityEditor);
- } else {
- $wrap.style('right', '-100%');
- $presetPane.call(presetList);
+ function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
+ const isMaki = picon && /^maki-/.test(picon);
+ const isTemaki = picon && /^temaki-/.test(picon);
+ const isFa = picon && /^fa[srb]-/.test(picon);
+ const isiDIcon = picon && !(isMaki || isTemaki || isFa);
+ let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
+ icon2.exit().remove();
+ icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
+ icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
+ icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
+ icon2.selectAll("use").attr("href", "#" + picon);
+ }
+ function renderImageIcon(container, imageURL) {
+ let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
+ imageIcon.exit().remove();
+ imageIcon = imageIcon.enter().append("img").attr("class", "image-icon").on("load", () => container.classed("showing-img", true)).on("error", () => container.classed("showing-img", false)).merge(imageIcon);
+ imageIcon.attr("src", imageURL);
+ }
+ const routeSegments = {
+ bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
+ bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
+ trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
+ detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
+ ferry: ["route/ferry", "route/ferry", "route/ferry"],
+ foot: ["highway/footway", "highway/footway", "highway/footway"],
+ hiking: ["highway/path", "highway/path", "highway/path"],
+ horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
+ light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
+ monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
+ mtb: ["highway/path", "highway/track", "highway/bridleway"],
+ pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
+ piste: ["piste/downhill", "piste/hike", "piste/nordic"],
+ power: ["power/line", "power/line", "power/line"],
+ road: ["highway/secondary", "highway/primary", "highway/trunk"],
+ subway: ["railway/subway", "railway/subway", "railway/subway"],
+ train: ["railway/rail", "railway/rail", "railway/rail"],
+ tram: ["railway/tram", "railway/tram", "railway/tram"],
+ waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
+ };
+ function render() {
+ let p = _preset.apply(this, arguments);
+ let geom = _geometry ? _geometry.apply(this, arguments) : null;
+ if (geom === "relation" && p.tags && (p.tags.type === "route" && p.tags.route && routeSegments[p.tags.route] || p.tags.type === "waterway")) {
+ geom = "route";
+ }
+ const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
+ const isFallback = p.isFallback && p.isFallback();
+ const imageURL = showThirdPartyIcons === "true" && p.imageURL;
+ const picon = getIcon(p, geom);
+ const isCategory = !p.setTags;
+ const drawPoint = false;
+ const drawVertex = picon !== null && geom === "vertex" && !isFallback;
+ const drawLine = picon && geom === "line" && !isFallback && !isCategory;
+ const drawArea = picon && geom === "area" && !isFallback && !isCategory;
+ const drawRoute = picon && geom === "route";
+ const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
+ let tags = !isCategory ? p.setTags({}, geom) : {};
+ for (let k in tags) {
+ if (tags[k] === "*") {
+ tags[k] = "yes";
}
+ }
+ let tagClasses = svgTagClasses().getClassesString(tags, "");
+ let selection2 = select_default2(this);
+ let container = selection2.selectAll(".preset-icon-container").data([0]);
+ container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
+ container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
+ renderCategoryBorder(container, isCategory && p);
+ renderPointBorder(container, drawPoint);
+ renderCircleFill(container, drawVertex);
+ renderSquareFill(container, drawArea, tagClasses);
+ renderLine(container, drawLine, tagClasses);
+ renderRoute(container, drawRoute, p);
+ renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
+ renderImageIcon(container, imageURL);
+ }
+ presetIcon.preset = function(val) {
+ if (!arguments.length)
+ return _preset;
+ _preset = utilFunctor(val);
+ return presetIcon;
+ };
+ presetIcon.geometry = function(val) {
+ if (!arguments.length)
+ return _geometry;
+ _geometry = utilFunctor(val);
+ return presetIcon;
+ };
+ return presetIcon;
+ }
- var $footer = selection.selectAll('.footer')
- .data([0]);
-
- $footer.enter().append('div')
- .attr('class', 'footer');
-
- selection.select('.footer')
- .call(iD.ui.ViewOnOSM(context)
- .entityID(entityID));
-
- function showList(preset) {
- $wrap.transition()
- .styleTween('right', function() { return d3.interpolate('0%', '-100%'); });
-
- $presetPane.call(presetList
- .preset(preset)
- .autofocus(true));
+ // modules/ui/sections/feature_type.js
+ function uiSectionFeatureType(context) {
+ var dispatch10 = dispatch_default("choose");
+ var _entityIDs = [];
+ var _presets = [];
+ var _tagReference;
+ var section = uiSection("feature-type", context).label(_t.html("inspector.feature_type")).disclosureContent(renderDisclosureContent);
+ function renderDisclosureContent(selection2) {
+ selection2.classed("preset-list-item", true);
+ selection2.classed("mixed-types", _presets.length > 1);
+ var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
+ var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(uiTooltip().title(_t.html("inspector.back_tooltip")).placement("bottom"));
+ presetButton.append("div").attr("class", "preset-icon-container");
+ presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
+ presetButtonWrap.append("div").attr("class", "accessory-buttons");
+ var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
+ tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
+ if (_tagReference) {
+ selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
+ tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
+ }
+ selection2.selectAll(".preset-reset").on("click", function() {
+ dispatch10.call("choose", this, _presets);
+ }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ });
+ var geometries = entityGeometries();
+ selection2.select(".preset-list-item button").call(uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point")));
+ var names = _presets.length === 1 ? [
+ _presets[0].nameLabel(),
+ _presets[0].subtitleLabel()
+ ].filter(Boolean) : [_t("inspector.multiple_types")];
+ var label = selection2.select(".label-inner");
+ var nameparts = label.selectAll(".namepart").data(names, function(d) {
+ return d;
+ });
+ nameparts.exit().remove();
+ nameparts.enter().append("div").attr("class", "namepart").html(function(d) {
+ return d;
+ });
+ }
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return section;
+ };
+ section.presets = function(val) {
+ if (!arguments.length)
+ return _presets;
+ if (!utilArrayIdentical(val, _presets)) {
+ _presets = val;
+ if (_presets.length === 1) {
+ _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
}
+ }
+ return section;
+ };
+ function entityGeometries() {
+ var counts = {};
+ for (var i2 in _entityIDs) {
+ var geometry = context.graph().geometry(_entityIDs[i2]);
+ if (!counts[geometry])
+ counts[geometry] = 0;
+ counts[geometry] += 1;
+ }
+ return Object.keys(counts).sort(function(geom1, geom2) {
+ return counts[geom2] - counts[geom1];
+ });
+ }
+ return utilRebind(section, dispatch10, "on");
+ }
- function setPreset(preset) {
- $wrap.transition()
- .styleTween('right', function() { return d3.interpolate('-100%', '0%'); });
-
- $editorPane.call(entityEditor
- .preset(preset));
+ // modules/ui/sections/preset_fields.js
+ function uiSectionPresetFields(context) {
+ var section = uiSection("preset-fields", context).label(_t.html("inspector.fields")).disclosureContent(renderDisclosureContent);
+ var dispatch10 = dispatch_default("change", "revert");
+ var formFields = uiFormFields(context);
+ var _state;
+ var _fieldsArr;
+ var _presets = [];
+ var _tags;
+ var _entityIDs;
+ function renderDisclosureContent(selection2) {
+ if (!_fieldsArr) {
+ var graph = context.graph();
+ var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
+ geoms[graph.entity(entityID).geometry(graph)] = true;
+ return geoms;
+ }, {}));
+ var presetsManager = _mainPresetIndex;
+ var allFields = [];
+ var allMoreFields = [];
+ var sharedTotalFields;
+ _presets.forEach(function(preset) {
+ var fields = preset.fields();
+ var moreFields = preset.moreFields();
+ allFields = utilArrayUnion(allFields, fields);
+ allMoreFields = utilArrayUnion(allMoreFields, moreFields);
+ if (!sharedTotalFields) {
+ sharedTotalFields = utilArrayUnion(fields, moreFields);
+ } else {
+ sharedTotalFields = sharedTotalFields.filter(function(field) {
+ return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
+ });
+ }
+ });
+ var sharedFields = allFields.filter(function(field) {
+ return sharedTotalFields.indexOf(field) !== -1;
+ });
+ var sharedMoreFields = allMoreFields.filter(function(field) {
+ return sharedTotalFields.indexOf(field) !== -1;
+ });
+ _fieldsArr = [];
+ sharedFields.forEach(function(field) {
+ if (field.matchAllGeometry(geometries)) {
+ _fieldsArr.push(uiField(context, field, _entityIDs));
+ }
+ });
+ var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
+ if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
+ _fieldsArr.push(uiField(context, presetsManager.field("restrictions"), _entityIDs));
+ }
+ var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
+ additionalFields.sort(function(field1, field2) {
+ return field1.label().localeCompare(field2.label(), _mainLocalizer.localeCode());
+ });
+ additionalFields.forEach(function(field) {
+ if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
+ _fieldsArr.push(uiField(context, field, _entityIDs, { show: false }));
+ }
+ });
+ _fieldsArr.forEach(function(field) {
+ field.on("change", function(t, onInput) {
+ dispatch10.call("change", field, _entityIDs, t, onInput);
+ }).on("revert", function(keys) {
+ dispatch10.call("revert", field, keys);
+ });
+ });
+ }
+ _fieldsArr.forEach(function(field) {
+ field.state(_state).tags(_tags);
+ });
+ selection2.call(formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area"));
+ selection2.selectAll(".wrap-form-field input").on("keydown", function(d3_event) {
+ if (d3_event.keyCode === 13 && context.container().select(".combobox").empty()) {
+ context.enter(modeBrowse(context));
}
+ });
}
-
- inspector.state = function(_) {
- if (!arguments.length) return state;
- state = _;
- entityEditor.state(state);
- return inspector;
+ section.presets = function(val) {
+ if (!arguments.length)
+ return _presets;
+ if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
+ _presets = val;
+ _fieldsArr = null;
+ }
+ return section;
+ };
+ section.state = function(val) {
+ if (!arguments.length)
+ return _state;
+ _state = val;
+ return section;
+ };
+ section.tags = function(val) {
+ if (!arguments.length)
+ return _tags;
+ _tags = val;
+ return section;
+ };
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
+ _entityIDs = val;
+ _fieldsArr = null;
+ }
+ return section;
};
+ return utilRebind(section, dispatch10, "on");
+ }
- inspector.entityID = function(_) {
- if (!arguments.length) return entityID;
- entityID = _;
- return inspector;
+ // modules/ui/sections/raw_member_editor.js
+ function uiSectionRawMemberEditor(context) {
+ var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
+ if (!_entityIDs || _entityIDs.length !== 1)
+ return false;
+ var entity = context.hasEntity(_entityIDs[0]);
+ return entity && entity.type === "relation";
+ }).label(function() {
+ var entity = context.hasEntity(_entityIDs[0]);
+ if (!entity)
+ return "";
+ var gt = entity.members.length > _maxMembers ? ">" : "";
+ var count = gt + entity.members.slice(0, _maxMembers).length;
+ return _t.html("inspector.title_count", { title: { html: _t.html("inspector.members") }, count });
+ }).disclosureContent(renderDisclosureContent);
+ var taginfo = services.taginfo;
+ var _entityIDs;
+ var _maxMembers = 1e3;
+ function downloadMember(d3_event, d) {
+ d3_event.preventDefault();
+ select_default2(this.parentNode).classed("tag-reference-loading", true);
+ context.loadEntity(d.id, function() {
+ section.reRender();
+ });
+ }
+ function zoomToMember(d3_event, d) {
+ d3_event.preventDefault();
+ var entity = context.entity(d.id);
+ context.map().zoomToEase(entity);
+ utilHighlightEntities([d.id], true, context);
+ }
+ function selectMember(d3_event, d) {
+ d3_event.preventDefault();
+ utilHighlightEntities([d.id], false, context);
+ var entity = context.entity(d.id);
+ var mapExtent = context.map().extent();
+ if (!entity.intersects(mapExtent, context.graph())) {
+ context.map().zoomToEase(entity);
+ }
+ context.enter(modeSelect(context, [d.id]));
+ }
+ function changeRole(d3_event, d) {
+ var oldRole = d.role;
+ var newRole = context.cleanRelationRole(select_default2(this).property("value"));
+ if (oldRole !== newRole) {
+ var member = { id: d.id, type: d.type, role: newRole };
+ context.perform(actionChangeMember(d.relation.id, member, d.index), _t("operations.change_role.annotation", {
+ n: 1
+ }));
+ context.validator().validate();
+ }
+ }
+ function deleteMember(d3_event, d) {
+ utilHighlightEntities([d.id], false, context);
+ context.perform(actionDeleteMember(d.relation.id, d.index), _t("operations.delete_member.annotation", {
+ n: 1
+ }));
+ if (!context.hasEntity(d.relation.id)) {
+ context.enter(modeBrowse(context));
+ } else {
+ context.validator().validate();
+ }
+ }
+ function renderDisclosureContent(selection2) {
+ var entityID = _entityIDs[0];
+ var memberships = [];
+ var entity = context.entity(entityID);
+ entity.members.slice(0, _maxMembers).forEach(function(member, index) {
+ memberships.push({
+ index,
+ id: member.id,
+ type: member.type,
+ role: member.role,
+ relation: entity,
+ member: context.hasEntity(member.id),
+ domId: utilUniqueDomId(entityID + "-member-" + index)
+ });
+ });
+ var list = selection2.selectAll(".member-list").data([0]);
+ list = list.enter().append("ul").attr("class", "member-list").merge(list);
+ var items = list.selectAll("li").data(memberships, function(d) {
+ return osmEntity.key(d.relation) + "," + d.index + "," + (d.member ? osmEntity.key(d.member) : "incomplete");
+ });
+ items.exit().each(unbind).remove();
+ var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d) {
+ return !d.member;
+ });
+ itemsEnter.each(function(d) {
+ var item = select_default2(this);
+ var label = item.append("label").attr("class", "field-label").attr("for", d.domId);
+ if (d.member) {
+ item.on("mouseover", function() {
+ utilHighlightEntities([d.id], true, context);
+ }).on("mouseout", function() {
+ utilHighlightEntities([d.id], false, context);
+ });
+ var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
+ labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
+ var matched = _mainPresetIndex.match(d2.member, context.graph());
+ return matched && matched.name() || utilDisplayType(d2.member.id);
+ });
+ labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
+ return utilDisplayName(d2.member);
+ });
+ label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
+ label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
+ } else {
+ var labelText = label.append("span").attr("class", "label-text");
+ labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d.type, { id: d.id }));
+ labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d.id }));
+ label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
+ }
+ });
+ var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
+ wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
+ return d.domId;
+ }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
+ if (taginfo) {
+ wrapEnter.each(bindTypeahead);
+ }
+ items = items.merge(itemsEnter).order();
+ items.select("input.member-role").property("value", function(d) {
+ return d.role;
+ }).on("blur", changeRole).on("change", changeRole);
+ items.select("button.member-delete").on("click", deleteMember);
+ var dragOrigin, targetIndex;
+ items.call(drag_default().on("start", function(d3_event) {
+ dragOrigin = {
+ x: d3_event.x,
+ y: d3_event.y
+ };
+ targetIndex = null;
+ }).on("drag", function(d3_event) {
+ var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y;
+ if (!select_default2(this).classed("dragging") && Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5)
+ return;
+ var index = items.nodes().indexOf(this);
+ select_default2(this).classed("dragging", true);
+ targetIndex = null;
+ selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
+ var node = select_default2(this).node();
+ if (index === index2) {
+ return "translate(" + x + "px, " + y + "px)";
+ } else if (index2 > index && d3_event.y > node.offsetTop) {
+ if (targetIndex === null || index2 > targetIndex) {
+ targetIndex = index2;
+ }
+ return "translateY(-100%)";
+ } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
+ if (targetIndex === null || index2 < targetIndex) {
+ targetIndex = index2;
+ }
+ return "translateY(100%)";
+ }
+ return null;
+ });
+ }).on("end", function(d3_event, d) {
+ if (!select_default2(this).classed("dragging"))
+ return;
+ var index = items.nodes().indexOf(this);
+ select_default2(this).classed("dragging", false);
+ selection2.selectAll("li.member-row").style("transform", null);
+ if (targetIndex !== null) {
+ context.perform(actionMoveMember(d.relation.id, index, targetIndex), _t("operations.reorder_members.annotation"));
+ context.validator().validate();
+ }
+ }));
+ function bindTypeahead(d) {
+ var row = select_default2(this);
+ var role = row.selectAll("input.member-role");
+ var origValue = role.property("value");
+ function sort(value, data) {
+ var sameletter = [];
+ var other = [];
+ for (var i2 = 0; i2 < data.length; i2++) {
+ if (data[i2].value.substring(0, value.length) === value) {
+ sameletter.push(data[i2]);
+ } else {
+ other.push(data[i2]);
+ }
+ }
+ return sameletter.concat(other);
+ }
+ role.call(uiCombobox(context, "member-role").fetcher(function(role2, callback) {
+ var geometry;
+ if (d.member) {
+ geometry = context.graph().geometry(d.member.id);
+ } else if (d.type === "relation") {
+ geometry = "relation";
+ } else if (d.type === "way") {
+ geometry = "line";
+ } else {
+ geometry = "point";
+ }
+ var rtype = entity.tags.type;
+ taginfo.roles({
+ debounce: true,
+ rtype: rtype || "",
+ geometry,
+ query: role2
+ }, function(err, data) {
+ if (!err)
+ callback(sort(role2, data));
+ });
+ }).on("cancel", function() {
+ role.property("value", origValue);
+ }));
+ }
+ function unbind() {
+ var row = select_default2(this);
+ row.selectAll("input.member-role").call(uiCombobox.off, context);
+ }
+ }
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return section;
};
+ return section;
+ }
- inspector.newFeature = function(_) {
- if (!arguments.length) return newFeature;
- newFeature = _;
- return inspector;
+ // modules/actions/delete_members.js
+ function actionDeleteMembers(relationId, memberIndexes) {
+ return function(graph) {
+ memberIndexes.sort((a, b) => b - a);
+ for (var i2 in memberIndexes) {
+ graph = actionDeleteMember(relationId, memberIndexes[i2])(graph);
+ }
+ return graph;
};
+ }
- return inspector;
-};
-iD.ui.intro = function(context) {
- var step;
-
- function intro(selection) {
-
- function localizedName(id) {
- var features = {
- n2140018997: 'city_hall',
- n367813436: 'fire_department',
- w203988286: 'memory_isle_park',
- w203972937: 'riverwalk_trail',
- w203972938: 'riverwalk_trail',
- w203972940: 'riverwalk_trail',
- w41785752: 'w_michigan_ave',
- w134150789: 'w_michigan_ave',
- w134150795: 'w_michigan_ave',
- w134150800: 'w_michigan_ave',
- w134150811: 'w_michigan_ave',
- w134150802: 'e_michigan_ave',
- w134150836: 'e_michigan_ave',
- w41074896: 'e_michigan_ave',
- w17965834: 'spring_st',
- w203986457: 'scidmore_park',
- w203049587: 'petting_zoo',
- w17967397: 'n_andrews_st',
- w17967315: 's_andrews_st',
- w17967326: 'n_constantine_st',
- w17966400: 's_constantine_st',
- w170848823: 'rocky_river',
- w170848824: 'rocky_river',
- w170848331: 'rocky_river',
- w17967752: 'railroad_dr',
- w17965998: 'conrail_rr',
- w134150845: 'conrail_rr',
- w170989131: 'st_joseph_river',
- w143497377: 'n_main_st',
- w134150801: 's_main_st',
- w134150830: 's_main_st',
- w17966462: 's_main_st',
- w17967734: 'water_st',
- w17964996: 'foster_st',
- w170848330: 'portage_river',
- w17965351: 'flower_st',
- w17965502: 'elm_st',
- w17965402: 'walnut_st',
- w17964793: 'morris_ave',
- w17967444: 'east_st',
- w17966984: 'portage_ave'
- };
- return features[id] && t('intro.graph.' + features[id]);
+ // modules/ui/sections/raw_membership_editor.js
+ function uiSectionRawMembershipEditor(context) {
+ var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
+ return _entityIDs && _entityIDs.length;
+ }).label(function() {
+ var parents = getSharedParentRelations();
+ var gt = parents.length > _maxMemberships ? ">" : "";
+ var count = gt + parents.slice(0, _maxMemberships).length;
+ return _t.html("inspector.title_count", { title: { html: _t.html("inspector.relations") }, count });
+ }).disclosureContent(renderDisclosureContent);
+ var taginfo = services.taginfo;
+ var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d) {
+ if (d.relation)
+ utilHighlightEntities([d.relation.id], true, context);
+ }).itemsMouseLeave(function(d3_event, d) {
+ if (d.relation)
+ utilHighlightEntities([d.relation.id], false, context);
+ });
+ var _inChange = false;
+ var _entityIDs = [];
+ var _showBlank;
+ var _maxMemberships = 1e3;
+ function getSharedParentRelations() {
+ var parents = [];
+ for (var i2 = 0; i2 < _entityIDs.length; i2++) {
+ var entity = context.graph().hasEntity(_entityIDs[i2]);
+ if (!entity)
+ continue;
+ if (i2 === 0) {
+ parents = context.graph().parentRelations(entity);
+ } else {
+ parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
}
-
- context.enter(iD.modes.Browse(context));
-
- // Save current map state
- var history = context.history().toJSON(),
- hash = window.location.hash,
- center = context.map().center(),
- zoom = context.map().zoom(),
- background = context.background().baseLayerSource(),
- opacity = d3.selectAll('#map .layer-background').style('opacity'),
- loadedTiles = context.connection().loadedTiles(),
- baseEntities = context.history().graph().base().entities,
- introGraph, name;
-
- // Block saving
- context.inIntro(true);
-
- // Load semi-real data used in intro
- context.connection().toggle(false).flush();
- context.history().reset();
-
- introGraph = JSON.parse(iD.introGraph);
- for (var key in introGraph) {
- introGraph[key] = iD.Entity(introGraph[key]);
- name = localizedName(key);
- if (name) {
- introGraph[key].tags.name = name;
+ if (!parents.length)
+ break;
+ }
+ return parents;
+ }
+ function getMemberships() {
+ var memberships = [];
+ var relations = getSharedParentRelations().slice(0, _maxMemberships);
+ var isMultiselect = _entityIDs.length > 1;
+ var i2, relation, membership, index, member, indexedMember;
+ for (i2 = 0; i2 < relations.length; i2++) {
+ relation = relations[i2];
+ membership = {
+ relation,
+ members: [],
+ hash: osmEntity.key(relation)
+ };
+ for (index = 0; index < relation.members.length; index++) {
+ member = relation.members[index];
+ if (_entityIDs.indexOf(member.id) !== -1) {
+ indexedMember = Object.assign({}, member, { index });
+ membership.members.push(indexedMember);
+ membership.hash += "," + index.toString();
+ if (!isMultiselect) {
+ memberships.push(membership);
+ membership = {
+ relation,
+ members: [],
+ hash: osmEntity.key(relation)
+ };
}
+ }
}
- context.history().merge(d3.values(iD.Graph().load(introGraph).entities));
- context.background().bing();
-
- d3.selectAll('#map .layer-background').style('opacity', 1);
-
- var curtain = d3.curtain();
- selection.call(curtain);
-
- function reveal(box, text, options) {
- options = options || {};
- if (text) curtain.reveal(box, text, options.tooltipClass, options.duration);
- else curtain.reveal(box, '', '', options.duration);
- }
-
- var steps = ['navigation', 'point', 'area', 'line', 'startEditing'].map(function(step, i) {
- var s = iD.ui.intro[step](context, reveal)
- .on('done', function() {
- entered.filter(function(d) {
- return d.title === s.title;
- }).classed('finished', true);
- enter(steps[i + 1]);
- });
- return s;
+ if (membership.members.length)
+ memberships.push(membership);
+ }
+ memberships.forEach(function(membership2) {
+ membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
+ var roles = [];
+ membership2.members.forEach(function(member2) {
+ if (roles.indexOf(member2.role) === -1)
+ roles.push(member2.role);
+ });
+ membership2.role = roles.length === 1 ? roles[0] : roles;
+ });
+ return memberships;
+ }
+ function selectRelation(d3_event, d) {
+ d3_event.preventDefault();
+ utilHighlightEntities([d.relation.id], false, context);
+ context.enter(modeSelect(context, [d.relation.id]));
+ }
+ function zoomToRelation(d3_event, d) {
+ d3_event.preventDefault();
+ var entity = context.entity(d.relation.id);
+ context.map().zoomToEase(entity);
+ utilHighlightEntities([d.relation.id], true, context);
+ }
+ function changeRole(d3_event, d) {
+ if (d === 0)
+ return;
+ if (_inChange)
+ return;
+ var newRole = context.cleanRelationRole(select_default2(this).property("value"));
+ if (!newRole.trim() && typeof d.role !== "string")
+ return;
+ var membersToUpdate = d.members.filter(function(member) {
+ return member.role !== newRole;
+ });
+ if (membersToUpdate.length) {
+ _inChange = true;
+ context.perform(function actionChangeMemberRoles(graph) {
+ membersToUpdate.forEach(function(member) {
+ var newMember = Object.assign({}, member, { role: newRole });
+ delete newMember.index;
+ graph = actionChangeMember(d.relation.id, newMember, member.index)(graph);
+ });
+ return graph;
+ }, _t("operations.change_role.annotation", {
+ n: membersToUpdate.length
+ }));
+ context.validator().validate();
+ }
+ _inChange = false;
+ }
+ function addMembership(d, role) {
+ this.blur();
+ _showBlank = false;
+ function actionAddMembers(relationId, ids, role2) {
+ return function(graph) {
+ for (var i2 in ids) {
+ var member = { id: ids[i2], type: graph.entity(ids[i2]).type, role: role2 };
+ graph = actionAddMember(relationId, member)(graph);
+ }
+ return graph;
+ };
+ }
+ if (d.relation) {
+ context.perform(actionAddMembers(d.relation.id, _entityIDs, role), _t("operations.add_member.annotation", {
+ n: _entityIDs.length
+ }));
+ context.validator().validate();
+ } else {
+ var relation = osmRelation();
+ context.perform(actionAddEntity(relation), actionAddMembers(relation.id, _entityIDs, role), _t("operations.add.annotation.relation"));
+ context.enter(modeSelect(context, [relation.id]).newFeature(true));
+ }
+ }
+ function deleteMembership(d3_event, d) {
+ this.blur();
+ if (d === 0)
+ return;
+ utilHighlightEntities([d.relation.id], false, context);
+ var indexes = d.members.map(function(member) {
+ return member.index;
+ });
+ context.perform(actionDeleteMembers(d.relation.id, indexes), _t("operations.delete_member.annotation", {
+ n: _entityIDs.length
+ }));
+ context.validator().validate();
+ }
+ function fetchNearbyRelations(q, callback) {
+ var newRelation = {
+ relation: null,
+ value: _t("inspector.new_relation"),
+ display: _t.html("inspector.new_relation")
+ };
+ var entityID = _entityIDs[0];
+ var result = [];
+ var graph = context.graph();
+ function baseDisplayLabel(entity) {
+ var matched = _mainPresetIndex.match(entity, graph);
+ var presetName = matched && matched.name() || _t("inspector.relation");
+ var entityName = utilDisplayName(entity) || "";
+ return presetName + " " + entityName;
+ }
+ var explicitRelation = q && context.hasEntity(q.toLowerCase());
+ if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
+ result.push({
+ relation: explicitRelation,
+ value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
});
-
- steps[steps.length - 1].on('startEditing', function() {
- curtain.remove();
- navwrap.remove();
- d3.selectAll('#map .layer-background').style('opacity', opacity);
- context.connection().toggle(true).flush().loadedTiles(loadedTiles);
- context.history().reset().merge(d3.values(baseEntities));
- context.background().baseLayerSource(background);
- if (history) context.history().fromJSON(history, false);
- context.map().centerZoom(center, zoom);
- window.location.replace(hash);
- context.inIntro(false);
+ } else {
+ context.history().intersects(context.map().extent()).forEach(function(entity) {
+ if (entity.type !== "relation" || entity.id === entityID)
+ return;
+ var value = baseDisplayLabel(entity);
+ if (q && (value + " " + entity.id).toLowerCase().indexOf(q.toLowerCase()) === -1)
+ return;
+ result.push({ relation: entity, value });
});
-
- var navwrap = selection.append('div').attr('class', 'intro-nav-wrap fillD');
-
- var buttonwrap = navwrap.append('div')
- .attr('class', 'joined')
- .selectAll('button.step');
-
- var entered = buttonwrap
- .data(steps)
- .enter()
- .append('button')
- .attr('class', 'step')
- .on('click', enter);
-
- entered
- .call(iD.svg.Icon('#icon-apply', 'pre-text'));
-
- entered
- .append('label')
- .text(function(d) { return t(d.title); });
-
- enter(steps[0]);
-
- function enter (newStep) {
- if (step) { step.exit(); }
-
- context.enter(iD.modes.Browse(context));
-
- step = newStep;
- step.enter();
-
- entered.classed('active', function(d) {
- return d.title === step.title;
- });
+ result.sort(function(a, b) {
+ return osmRelation.creationOrder(a.relation, b.relation);
+ });
+ var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v) {
+ return v.length > 1;
+ });
+ dupeGroups.forEach(function(group) {
+ group.forEach(function(obj) {
+ obj.value += " " + obj.relation.id;
+ });
+ });
+ }
+ result.forEach(function(obj) {
+ obj.title = obj.value;
+ });
+ result.unshift(newRelation);
+ callback(result);
+ }
+ function renderDisclosureContent(selection2) {
+ var memberships = getMemberships();
+ var list = selection2.selectAll(".member-list").data([0]);
+ list = list.enter().append("ul").attr("class", "member-list").merge(list);
+ var items = list.selectAll("li.member-row-normal").data(memberships, function(d) {
+ return d.hash;
+ });
+ items.exit().each(unbind).remove();
+ var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
+ itemsEnter.on("mouseover", function(d3_event, d) {
+ utilHighlightEntities([d.relation.id], true, context);
+ }).on("mouseout", function(d3_event, d) {
+ utilHighlightEntities([d.relation.id], false, context);
+ });
+ var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d) {
+ return d.domId;
+ });
+ var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
+ labelLink.append("span").attr("class", "member-entity-type").text(function(d) {
+ var matched = _mainPresetIndex.match(d.relation, context.graph());
+ return matched && matched.name() || _t.html("inspector.relation");
+ });
+ labelLink.append("span").attr("class", "member-entity-name").text(function(d) {
+ return utilDisplayName(d.relation);
+ });
+ labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
+ labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
+ var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
+ wrapEnter.append("input").attr("class", "member-role").attr("id", function(d) {
+ return d.domId;
+ }).property("type", "text").property("value", function(d) {
+ return typeof d.role === "string" ? d.role : "";
+ }).attr("title", function(d) {
+ return Array.isArray(d.role) ? d.role.filter(Boolean).join("\n") : d.role;
+ }).attr("placeholder", function(d) {
+ return Array.isArray(d.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
+ }).classed("mixed", function(d) {
+ return Array.isArray(d.role);
+ }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
+ if (taginfo) {
+ wrapEnter.each(bindTypeahead);
+ }
+ var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
+ newMembership.exit().remove();
+ var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
+ var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
+ newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
+ newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
+ list.selectAll(".member-row-new").remove();
+ });
+ var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
+ newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
+ newMembership = newMembership.merge(newMembershipEnter);
+ newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity));
+ var addRow = selection2.selectAll(".add-row").data([0]);
+ var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
+ var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
+ addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
+ addRelationButton.call(uiTooltip().title(_t.html("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
+ addRowEnter.append("div").attr("class", "space-value");
+ addRowEnter.append("div").attr("class", "space-buttons");
+ addRow = addRow.merge(addRowEnter);
+ addRow.select(".add-relation").on("click", function() {
+ _showBlank = true;
+ section.reRender();
+ list.selectAll(".member-entity-input").node().focus();
+ });
+ function acceptEntity(d) {
+ if (!d) {
+ cancelEntity();
+ return;
+ }
+ if (d.relation)
+ utilHighlightEntities([d.relation.id], false, context);
+ var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
+ addMembership(d, role);
+ }
+ function cancelEntity() {
+ var input = newMembership.selectAll(".member-entity-input");
+ input.property("value", "");
+ context.surface().selectAll(".highlighted").classed("highlighted", false);
+ }
+ function bindTypeahead(d) {
+ var row = select_default2(this);
+ var role = row.selectAll("input.member-role");
+ var origValue = role.property("value");
+ function sort(value, data) {
+ var sameletter = [];
+ var other = [];
+ for (var i2 = 0; i2 < data.length; i2++) {
+ if (data[i2].value.substring(0, value.length) === value) {
+ sameletter.push(data[i2]);
+ } else {
+ other.push(data[i2]);
+ }
+ }
+ return sameletter.concat(other);
}
-
- }
- return intro;
-};
-
-iD.ui.intro.pointBox = function(point, context) {
- var rect = context.surfaceRect();
- point = context.projection(point);
- return {
- left: point[0] + rect.left - 30,
- top: point[1] + rect.top - 50,
- width: 60,
- height: 70
- };
-};
-
-iD.ui.intro.pad = function(box, padding, context) {
- if (box instanceof Array) {
- var rect = context.surfaceRect();
- box = context.projection(box);
- box = {
- left: box[0] + rect.left,
- top: box[1] + rect.top
- };
+ role.call(uiCombobox(context, "member-role").fetcher(function(role2, callback) {
+ var rtype = d.relation.tags.type;
+ taginfo.roles({
+ debounce: true,
+ rtype: rtype || "",
+ geometry: context.graph().geometry(_entityIDs[0]),
+ query: role2
+ }, function(err, data) {
+ if (!err)
+ callback(sort(role2, data));
+ });
+ }).on("cancel", function() {
+ role.property("value", origValue);
+ }));
+ }
+ function unbind() {
+ var row = select_default2(this);
+ row.selectAll("input.member-role").call(uiCombobox.off, context);
+ }
}
- return {
- left: box.left - padding,
- top: box.top - padding,
- width: (box.width || 0) + 2 * padding,
- height: (box.width || 0) + 2 * padding
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ _showBlank = false;
+ return section;
};
-};
-
-iD.ui.intro.icon = function(name, svgklass) {
- return '';
-};
-iD.ui.Lasso = function(context) {
- var group, polygon;
-
- lasso.coordinates = [];
-
- function lasso(selection) {
-
- context.container().classed('lasso', true);
-
- group = selection.append('g')
- .attr('class', 'lasso hide');
-
- polygon = group.append('path')
- .attr('class', 'lasso-path');
-
- group.call(iD.ui.Toggle(true));
+ return section;
+ }
+ // modules/ui/sections/selection_list.js
+ function uiSectionSelectionList(context) {
+ var _selectedIDs = [];
+ var section = uiSection("selected-features", context).shouldDisplay(function() {
+ return _selectedIDs.length > 1;
+ }).label(function() {
+ return _t.html("inspector.title_count", { title: { html: _t.html("inspector.features") }, count: _selectedIDs.length });
+ }).disclosureContent(renderDisclosureContent);
+ context.history().on("change.selectionList", function(difference) {
+ if (difference) {
+ section.reRender();
+ }
+ });
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _selectedIDs;
+ _selectedIDs = val;
+ return section;
+ };
+ function selectEntity(d3_event, entity) {
+ context.enter(modeSelect(context, [entity.id]));
+ }
+ function deselectEntity(d3_event, entity) {
+ var selectedIDs = _selectedIDs.slice();
+ var index = selectedIDs.indexOf(entity.id);
+ if (index > -1) {
+ selectedIDs.splice(index, 1);
+ context.enter(modeSelect(context, selectedIDs));
+ }
}
-
- function draw() {
- if (polygon) {
- polygon.data([lasso.coordinates])
- .attr('d', function(d) { return 'M' + d.join(' L') + ' Z'; });
- }
+ function renderDisclosureContent(selection2) {
+ var list = selection2.selectAll(".feature-list").data([0]);
+ list = list.enter().append("ul").attr("class", "feature-list").merge(list);
+ var entities = _selectedIDs.map(function(id2) {
+ return context.hasEntity(id2);
+ }).filter(Boolean);
+ var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
+ items.exit().remove();
+ var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d) {
+ select_default2(this).on("mouseover", function() {
+ utilHighlightEntities([d.id], true, context);
+ }).on("mouseout", function() {
+ utilHighlightEntities([d.id], false, context);
+ });
+ });
+ var label = enter.append("button").attr("class", "label").on("click", selectEntity);
+ label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
+ label.append("span").attr("class", "entity-type");
+ label.append("span").attr("class", "entity-name");
+ enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
+ items = items.merge(enter);
+ items.selectAll(".entity-geom-icon use").attr("href", function() {
+ var entity = this.parentNode.parentNode.__data__;
+ return "#iD-icon-" + entity.geometry(context.graph());
+ });
+ items.selectAll(".entity-type").text(function(entity) {
+ return _mainPresetIndex.match(entity, context.graph()).name();
+ });
+ items.selectAll(".entity-name").text(function(d) {
+ var entity = context.entity(d.id);
+ return utilDisplayName(entity);
+ });
}
+ return section;
+ }
- lasso.extent = function () {
- return lasso.coordinates.reduce(function(extent, point) {
- return extent.extend(iD.geo.Extent(point));
- }, iD.geo.Extent());
- };
-
- lasso.p = function(_) {
- if (!arguments.length) return lasso;
- lasso.coordinates.push(_);
- draw();
- return lasso;
- };
-
- lasso.close = function() {
- if (group) {
- group.call(iD.ui.Toggle(false, function() {
- d3.select(this).remove();
- }));
- }
- context.container().classed('lasso', false);
- };
-
- return lasso;
-};
-iD.ui.Loading = function(context) {
- var message = '',
- blocking = false,
- modal;
-
- var loading = function(selection) {
- modal = iD.ui.modal(selection, blocking);
-
- var loadertext = modal.select('.content')
- .classed('loading-modal', true)
- .append('div')
- .attr('class', 'modal-section fillL');
-
- loadertext.append('img')
- .attr('class', 'loader')
- .attr('src', context.imagePath('loader-white.gif'));
-
- loadertext.append('h3')
- .text(message);
-
- modal.select('button.close')
- .attr('class', 'hide');
-
- return loading;
- };
-
- loading.message = function(_) {
- if (!arguments.length) return message;
- message = _;
- return loading;
- };
-
- loading.blocking = function(_) {
- if (!arguments.length) return blocking;
- blocking = _;
- return loading;
- };
-
- loading.close = function() {
- modal.remove();
- };
-
- return loading;
-};
-iD.ui.MapData = function(context) {
- var key = 'F',
- features = context.features().keys(),
- layers = context.layers(),
- fills = ['wireframe', 'partial', 'full'],
- fillDefault = context.storage('area-fill') || 'partial',
- fillSelected = fillDefault;
-
-
- function map_data(selection) {
-
- function showsFeature(d) {
- return context.features().enabled(d);
+ // modules/ui/entity_editor.js
+ function uiEntityEditor(context) {
+ var dispatch10 = dispatch_default("choose");
+ var _state = "select";
+ var _coalesceChanges = false;
+ var _modified = false;
+ var _base;
+ var _entityIDs;
+ var _activePresets = [];
+ var _newFeature;
+ var _sections;
+ function entityEditor(selection2) {
+ var combinedTags = utilCombinedTags(_entityIDs, context.graph());
+ var header = selection2.selectAll(".header").data([0]);
+ var headerEnter = header.enter().append("div").attr("class", "header fillL");
+ var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
+ headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t(`icons.${direction}`)).call(svgIcon(`#iD-icon-${direction}`));
+ headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
+ context.enter(modeBrowse(context));
+ }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
+ headerEnter.append("h2");
+ header = header.merge(headerEnter);
+ header.selectAll("h2").html(_entityIDs.length === 1 ? _t.html("inspector.edit") : _t.html("inspector.edit_features"));
+ header.selectAll(".preset-reset").on("click", function() {
+ dispatch10.call("choose", this, _activePresets);
+ });
+ var body = selection2.selectAll(".inspector-body").data([0]);
+ var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
+ body = body.merge(bodyEnter);
+ if (!_sections) {
+ _sections = [
+ uiSectionSelectionList(context),
+ uiSectionFeatureType(context).on("choose", function(presets) {
+ dispatch10.call("choose", this, presets);
+ }),
+ uiSectionEntityIssues(context),
+ uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
+ uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
+ uiSectionRawMemberEditor(context),
+ uiSectionRawMembershipEditor(context)
+ ];
+ }
+ _sections.forEach(function(section) {
+ if (section.entityIDs) {
+ section.entityIDs(_entityIDs);
}
-
- function autoHiddenFeature(d) {
- return context.features().autoHidden(d);
+ if (section.presets) {
+ section.presets(_activePresets);
}
-
- function clickFeature(d) {
- context.features().toggle(d);
- update();
+ if (section.tags) {
+ section.tags(combinedTags);
}
-
- function showsFill(d) {
- return fillSelected === d;
+ if (section.state) {
+ section.state(_state);
}
-
- function setFill(d) {
- _.each(fills, function(opt) {
- context.surface().classed('fill-' + opt, Boolean(opt === d));
- });
-
- fillSelected = d;
- if (d !== 'wireframe') {
- fillDefault = d;
- context.storage('area-fill', d);
- }
- update();
+ body.call(section.render);
+ });
+ context.history().on("change.entity-editor", historyChanged);
+ function historyChanged(difference) {
+ if (selection2.selectAll(".entity-editor").empty())
+ return;
+ if (_state === "hide")
+ return;
+ var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
+ if (!significant)
+ return;
+ _entityIDs = _entityIDs.filter(context.hasEntity);
+ if (!_entityIDs.length)
+ return;
+ var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
+ loadActivePresets();
+ var graph = context.graph();
+ entityEditor.modified(_base !== graph);
+ entityEditor(selection2);
+ if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
+ context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
}
-
- function showsLayer(which) {
- var layer = layers.layer(which);
- if (layer) {
- return layer.enabled();
- }
- return false;
+ }
+ }
+ function changeTags(entityIDs, changed, onInput) {
+ var actions = [];
+ for (var i2 in entityIDs) {
+ var entityID = entityIDs[i2];
+ var entity = context.entity(entityID);
+ var tags = Object.assign({}, entity.tags);
+ for (var k in changed) {
+ if (!k)
+ continue;
+ var v = changed[k];
+ if (typeof v === "object") {
+ tags[k] = tags[v.oldKey];
+ } else if (v !== void 0 || tags.hasOwnProperty(k)) {
+ tags[k] = v;
+ }
}
-
- function setLayer(which, enabled) {
- var layer = layers.layer(which);
- if (layer) {
- layer.enabled(enabled);
- update();
- }
+ if (!onInput) {
+ tags = utilCleanTags(tags);
}
-
- function toggleLayer(which) {
- setLayer(which, !showsLayer(which));
+ if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
+ actions.push(actionChangeTags(entityID, tags));
}
-
- function clickGpx() {
- toggleLayer('gpx');
+ }
+ if (actions.length) {
+ var combinedAction = function(graph) {
+ actions.forEach(function(action) {
+ graph = action(graph);
+ });
+ return graph;
+ };
+ var annotation = _t("operations.change_tags.annotation");
+ if (_coalesceChanges) {
+ context.overwrite(combinedAction, annotation);
+ } else {
+ context.perform(combinedAction, annotation);
+ _coalesceChanges = !!onInput;
}
-
- function clickMapillaryImages() {
- toggleLayer('mapillary-images');
- if (!showsLayer('mapillary-images')) {
- setLayer('mapillary-signs', false);
- }
+ }
+ if (!onInput) {
+ context.validator().validate();
+ }
+ }
+ function revertTags(keys) {
+ var actions = [];
+ for (var i2 in _entityIDs) {
+ var entityID = _entityIDs[i2];
+ var original = context.graph().base().entities[entityID];
+ var changed = {};
+ for (var j2 in keys) {
+ var key = keys[j2];
+ changed[key] = original ? original.tags[key] : void 0;
+ }
+ var entity = context.entity(entityID);
+ var tags = Object.assign({}, entity.tags);
+ for (var k in changed) {
+ if (!k)
+ continue;
+ var v = changed[k];
+ if (v !== void 0 || tags.hasOwnProperty(k)) {
+ tags[k] = v;
+ }
}
-
- function clickMapillarySigns() {
- toggleLayer('mapillary-signs');
+ tags = utilCleanTags(tags);
+ if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
+ actions.push(actionChangeTags(entityID, tags));
}
-
-
- function drawMapillaryItems(selection) {
- var mapillaryImages = layers.layer('mapillary-images'),
- mapillarySigns = layers.layer('mapillary-signs'),
- supportsMapillaryImages = mapillaryImages && mapillaryImages.supported(),
- supportsMapillarySigns = mapillarySigns && mapillarySigns.supported(),
- showsMapillaryImages = supportsMapillaryImages && mapillaryImages.enabled(),
- showsMapillarySigns = supportsMapillarySigns && mapillarySigns.enabled();
-
- var mapillaryList = selection
- .selectAll('.layer-list-mapillary')
- .data([0]);
-
- // Enter
- mapillaryList
- .enter()
- .append('ul')
- .attr('class', 'layer-list layer-list-mapillary');
-
- var mapillaryImageLayerItem = mapillaryList
- .selectAll('.list-item-mapillary-images')
- .data(supportsMapillaryImages ? [0] : []);
-
- var enterImages = mapillaryImageLayerItem.enter()
- .append('li')
- .attr('class', 'list-item-mapillary-images');
-
- var labelImages = enterImages.append('label')
- .call(bootstrap.tooltip()
- .title(t('mapillary_images.tooltip'))
- .placement('top'));
-
- labelImages.append('input')
- .attr('type', 'checkbox')
- .on('change', clickMapillaryImages);
-
- labelImages.append('span')
- .text(t('mapillary_images.title'));
-
-
- var mapillarySignLayerItem = mapillaryList
- .selectAll('.list-item-mapillary-signs')
- .data(supportsMapillarySigns ? [0] : []);
-
- var enterSigns = mapillarySignLayerItem.enter()
- .append('li')
- .attr('class', 'list-item-mapillary-signs');
-
- var labelSigns = enterSigns.append('label')
- .call(bootstrap.tooltip()
- .title(t('mapillary_signs.tooltip'))
- .placement('top'));
-
- labelSigns.append('input')
- .attr('type', 'checkbox')
- .on('change', clickMapillarySigns);
-
- labelSigns.append('span')
- .text(t('mapillary_signs.title'));
-
- // Update
- mapillaryImageLayerItem
- .classed('active', showsMapillaryImages)
- .selectAll('input')
- .property('checked', showsMapillaryImages);
-
- mapillarySignLayerItem
- .classed('active', showsMapillarySigns)
- .selectAll('input')
- .property('disabled', !showsMapillaryImages)
- .property('checked', showsMapillarySigns);
-
- mapillarySignLayerItem
- .selectAll('label')
- .classed('deemphasize', !showsMapillaryImages);
-
- // Exit
- mapillaryImageLayerItem.exit()
- .remove();
- mapillarySignLayerItem.exit()
- .remove();
- }
-
-
- function drawGpxItem(selection) {
- var gpx = layers.layer('gpx'),
- hasGpx = gpx && gpx.hasGpx(),
- showsGpx = hasGpx && gpx.enabled();
-
- var gpxLayerItem = selection
- .selectAll('.layer-list-gpx')
- .data(gpx ? [0] : []);
-
- // Enter
- var enter = gpxLayerItem.enter()
- .append('ul')
- .attr('class', 'layer-list layer-list-gpx')
- .append('li')
- .classed('list-item-gpx', true);
-
- enter.append('button')
- .attr('class', 'list-item-gpx-extent')
- .call(bootstrap.tooltip()
- .title(t('gpx.zoom'))
- .placement('left'))
- .on('click', function() {
- d3.event.preventDefault();
- d3.event.stopPropagation();
- gpx.fitZoom();
- })
- .call(iD.svg.Icon('#icon-search'));
-
- enter.append('button')
- .attr('class', 'list-item-gpx-browse')
- .call(bootstrap.tooltip()
- .title(t('gpx.browse'))
- .placement('left'))
- .on('click', function() {
- d3.select(document.createElement('input'))
- .attr('type', 'file')
- .on('change', function() {
- gpx.files(d3.event.target.files);
- })
- .node().click();
- })
- .call(iD.svg.Icon('#icon-geolocate'));
-
- var labelGpx = enter.append('label')
- .call(bootstrap.tooltip()
- .title(t('gpx.drag_drop'))
- .placement('top'));
-
- labelGpx.append('input')
- .attr('type', 'checkbox')
- .on('change', clickGpx);
-
- labelGpx.append('span')
- .text(t('gpx.local_layer'));
-
- // Update
- gpxLayerItem
- .classed('active', showsGpx)
- .selectAll('input')
- .property('disabled', !hasGpx)
- .property('checked', showsGpx);
-
- gpxLayerItem
- .selectAll('label')
- .classed('deemphasize', !hasGpx);
-
- // Exit
- gpxLayerItem.exit()
- .remove();
- }
-
-
- function drawList(selection, data, type, name, change, active) {
- var items = selection.selectAll('li')
- .data(data);
-
- // Enter
- var enter = items.enter()
- .append('li')
- .attr('class', 'layer')
- .call(bootstrap.tooltip()
- .html(true)
- .title(function(d) {
- var tip = t(name + '.' + d + '.tooltip'),
- key = (d === 'wireframe' ? 'W' : null);
-
- if (name === 'feature' && autoHiddenFeature(d)) {
- tip += '' + t('map_data.autohidden') + '
';
- }
- return iD.ui.tooltipHtml(tip, key);
- })
- .placement('top')
- );
-
- var label = enter.append('label');
-
- label.append('input')
- .attr('type', type)
- .attr('name', name)
- .on('change', change);
-
- label.append('span')
- .text(function(d) { return t(name + '.' + d + '.description'); });
-
- // Update
- items
- .classed('active', active)
- .selectAll('input')
- .property('checked', active)
- .property('indeterminate', function(d) {
- return (name === 'feature' && autoHiddenFeature(d));
- });
-
- // Exit
- items.exit()
- .remove();
+ }
+ if (actions.length) {
+ var combinedAction = function(graph) {
+ actions.forEach(function(action) {
+ graph = action(graph);
+ });
+ return graph;
+ };
+ var annotation = _t("operations.change_tags.annotation");
+ if (_coalesceChanges) {
+ context.overwrite(combinedAction, annotation);
+ } else {
+ context.perform(combinedAction, annotation);
+ _coalesceChanges = false;
}
+ }
+ context.validator().validate();
+ }
+ entityEditor.modified = function(val) {
+ if (!arguments.length)
+ return _modified;
+ _modified = val;
+ return entityEditor;
+ };
+ entityEditor.state = function(val) {
+ if (!arguments.length)
+ return _state;
+ _state = val;
+ return entityEditor;
+ };
+ entityEditor.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _base = context.graph();
+ _coalesceChanges = false;
+ if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
+ return entityEditor;
+ _entityIDs = val;
+ loadActivePresets(true);
+ return entityEditor.modified(false);
+ };
+ entityEditor.newFeature = function(val) {
+ if (!arguments.length)
+ return _newFeature;
+ _newFeature = val;
+ return entityEditor;
+ };
+ function loadActivePresets(isForNewSelection) {
+ var graph = context.graph();
+ var counts = {};
+ for (var i2 in _entityIDs) {
+ var entity = graph.hasEntity(_entityIDs[i2]);
+ if (!entity)
+ return;
+ var match = _mainPresetIndex.match(entity, graph);
+ if (!counts[match.id])
+ counts[match.id] = 0;
+ counts[match.id] += 1;
+ }
+ var matches = Object.keys(counts).sort(function(p1, p2) {
+ return counts[p2] - counts[p1];
+ }).map(function(pID) {
+ return _mainPresetIndex.item(pID);
+ });
+ if (!isForNewSelection) {
+ var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
+ if (weakPreset && matches.length === 1 && matches[0].isFallback())
+ return;
+ }
+ entityEditor.presets(matches);
+ }
+ entityEditor.presets = function(val) {
+ if (!arguments.length)
+ return _activePresets;
+ if (!utilArrayIdentical(val, _activePresets)) {
+ _activePresets = val;
+ }
+ return entityEditor;
+ };
+ return utilRebind(entityEditor, dispatch10, "on");
+ }
-
- function update() {
- dataLayerContainer.call(drawMapillaryItems);
- dataLayerContainer.call(drawGpxItem);
-
- fillList.call(drawList, fills, 'radio', 'area_fill', setFill, showsFill);
-
- featureList.call(drawList, features, 'checkbox', 'feature', clickFeature, showsFeature);
+ // modules/ui/feature_list.js
+ var sexagesimal = __toESM(require_sexagesimal());
+ function uiFeatureList(context) {
+ var _geocodeResults;
+ function featureList(selection2) {
+ var header = selection2.append("div").attr("class", "header fillL");
+ header.append("h2").call(_t.append("inspector.feature_list"));
+ var searchWrap = selection2.append("div").attr("class", "search-header");
+ searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
+ var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
+ var listWrap = selection2.append("div").attr("class", "inspector-body");
+ var list = listWrap.append("div").attr("class", "feature-list");
+ context.on("exit.feature-list", clearSearch);
+ context.map().on("drawn.feature-list", mapDrawn);
+ context.keybinding().on(uiCmd("\u2318F"), focusSearch);
+ function focusSearch(d3_event) {
+ var mode = context.mode() && context.mode().id;
+ if (mode !== "browse")
+ return;
+ d3_event.preventDefault();
+ search.node().focus();
+ }
+ function keydown(d3_event) {
+ if (d3_event.keyCode === 27) {
+ search.node().blur();
}
-
- function hidePanel() {
- setVisible(false);
+ }
+ function keypress(d3_event) {
+ var q = search.property("value"), items = list.selectAll(".feature-list-item");
+ if (d3_event.keyCode === 13 && q.length && items.size()) {
+ click(d3_event, items.datum());
}
-
- function togglePanel() {
- if (d3.event) d3.event.preventDefault();
- tooltip.hide(button);
- setVisible(!button.classed('active'));
+ }
+ function inputevent() {
+ _geocodeResults = void 0;
+ drawList();
+ }
+ function clearSearch() {
+ search.property("value", "");
+ drawList();
+ }
+ function mapDrawn(e) {
+ if (e.full) {
+ drawList();
}
-
- function toggleWireframe() {
- if (d3.event) {
- d3.event.preventDefault();
- d3.event.stopPropagation();
+ }
+ function features2() {
+ var result = [];
+ var graph = context.graph();
+ var visibleCenter = context.map().extent().center();
+ var q = search.property("value").toLowerCase();
+ if (!q)
+ return result;
+ var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
+ if (locationMatch) {
+ var loc = [parseFloat(locationMatch[0]), parseFloat(locationMatch[1])];
+ result.push({
+ id: -1,
+ geometry: "point",
+ type: _t("inspector.location"),
+ name: dmsCoordinatePair([loc[1], loc[0]]),
+ location: loc
+ });
+ }
+ var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
+ if (idMatch) {
+ var elemType = idMatch[1].charAt(0);
+ var elemId = idMatch[2];
+ result.push({
+ id: elemType + elemId,
+ geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
+ type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
+ name: elemId
+ });
+ }
+ var allEntities = graph.entities;
+ var localResults = [];
+ for (var id2 in allEntities) {
+ var entity = allEntities[id2];
+ if (!entity)
+ continue;
+ var name2 = utilDisplayName(entity) || "";
+ if (name2.toLowerCase().indexOf(q) < 0)
+ continue;
+ var matched = _mainPresetIndex.match(entity, graph);
+ var type3 = matched && matched.name() || utilDisplayType(entity.id);
+ var extent = entity.extent(graph);
+ var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
+ localResults.push({
+ id: entity.id,
+ entity,
+ geometry: entity.geometry(graph),
+ type: type3,
+ name: name2,
+ distance
+ });
+ if (localResults.length > 100)
+ break;
+ }
+ localResults = localResults.sort(function byDistance(a, b) {
+ return a.distance - b.distance;
+ });
+ result = result.concat(localResults);
+ (_geocodeResults || []).forEach(function(d) {
+ if (d.osm_type && d.osm_id) {
+ var id3 = osmEntity.id.fromOSM(d.osm_type, d.osm_id);
+ var tags = {};
+ tags[d.class] = d.type;
+ var attrs = { id: id3, type: d.osm_type, tags };
+ if (d.osm_type === "way") {
+ attrs.nodes = ["a", "a"];
}
- setFill((fillSelected === 'wireframe' ? fillDefault : 'wireframe'));
- context.map().pan([0,0]); // trigger a redraw
+ var tempEntity = osmEntity(attrs);
+ var tempGraph = coreGraph([tempEntity]);
+ var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
+ var type4 = matched2 && matched2.name() || utilDisplayType(id3);
+ result.push({
+ id: tempEntity.id,
+ geometry: tempEntity.geometry(tempGraph),
+ type: type4,
+ name: d.display_name,
+ extent: new geoExtent([parseFloat(d.boundingbox[3]), parseFloat(d.boundingbox[0])], [parseFloat(d.boundingbox[2]), parseFloat(d.boundingbox[1])])
+ });
+ }
+ });
+ if (q.match(/^[0-9]+$/)) {
+ result.push({
+ id: "n" + q,
+ geometry: "point",
+ type: _t("inspector.node"),
+ name: q
+ });
+ result.push({
+ id: "w" + q,
+ geometry: "line",
+ type: _t("inspector.way"),
+ name: q
+ });
+ result.push({
+ id: "r" + q,
+ geometry: "relation",
+ type: _t("inspector.relation"),
+ name: q
+ });
}
-
- function setVisible(show) {
- if (show !== shown) {
- button.classed('active', show);
- shown = show;
-
- if (show) {
- update();
- selection.on('mousedown.map_data-inside', function() {
- return d3.event.stopPropagation();
- });
- content.style('display', 'block')
- .style('right', '-300px')
- .transition()
- .duration(200)
- .style('right', '0px');
- } else {
- content.style('display', 'block')
- .style('right', '0px')
- .transition()
- .duration(200)
- .style('right', '-300px')
- .each('end', function() {
- d3.select(this).style('display', 'none');
- });
- selection.on('mousedown.map_data-inside', null);
- }
- }
+ return result;
+ }
+ function drawList() {
+ var value = search.property("value");
+ var results = features2();
+ list.classed("filtered", value.length);
+ var resultsIndicator = list.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
+ resultsIndicator.append("span").attr("class", "entity-name");
+ list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
+ if (services.geocoder) {
+ list.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
+ }
+ list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
+ list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
+ list.selectAll(".feature-list-item").data([-1]).remove();
+ var items = list.selectAll(".feature-list-item").data(results, function(d) {
+ return d.id;
+ });
+ var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
+ var label = enter.append("div").attr("class", "label");
+ label.each(function(d) {
+ select_default2(this).call(svgIcon("#iD-icon-" + d.geometry, "pre-text"));
+ });
+ label.append("span").attr("class", "entity-type").text(function(d) {
+ return d.type;
+ });
+ label.append("span").attr("class", "entity-name").text(function(d) {
+ return d.name;
+ });
+ enter.style("opacity", 0).transition().style("opacity", 1);
+ items.order();
+ items.exit().remove();
+ }
+ function mouseover(d3_event, d) {
+ if (d.id === -1)
+ return;
+ utilHighlightEntities([d.id], true, context);
+ }
+ function mouseout(d3_event, d) {
+ if (d.id === -1)
+ return;
+ utilHighlightEntities([d.id], false, context);
+ }
+ function click(d3_event, d) {
+ d3_event.preventDefault();
+ if (d.location) {
+ context.map().centerZoomEase([d.location[1], d.location[0]], 19);
+ } else if (d.entity) {
+ utilHighlightEntities([d.id], false, context);
+ context.enter(modeSelect(context, [d.entity.id]));
+ context.map().zoomToEase(d.entity);
+ } else {
+ context.zoomToEntity(d.id);
}
-
-
- var content = selection.append('div')
- .attr('class', 'fillL map-overlay col3 content hide'),
- tooltip = bootstrap.tooltip()
- .placement('left')
- .html(true)
- .title(iD.ui.tooltipHtml(t('map_data.description'), key)),
- button = selection.append('button')
- .attr('tabindex', -1)
- .on('click', togglePanel)
- .call(iD.svg.Icon('#icon-data', 'light'))
- .call(tooltip),
- shown = false;
-
- content.append('h4')
- .text(t('map_data.title'));
-
-
- // data layers
- content.append('a')
- .text(t('map_data.data_layers'))
- .attr('href', '#')
- .classed('hide-toggle', true)
- .classed('expanded', true)
- .on('click', function() {
- var exp = d3.select(this).classed('expanded');
- dataLayerContainer.style('display', exp ? 'none' : 'block');
- d3.select(this).classed('expanded', !exp);
- d3.event.preventDefault();
- });
-
- var dataLayerContainer = content.append('div')
- .attr('class', 'data-data-layers')
- .style('display', 'block');
-
-
- // area fills
- content.append('a')
- .text(t('map_data.fill_area'))
- .attr('href', '#')
- .classed('hide-toggle', true)
- .classed('expanded', false)
- .on('click', function() {
- var exp = d3.select(this).classed('expanded');
- fillContainer.style('display', exp ? 'none' : 'block');
- d3.select(this).classed('expanded', !exp);
- d3.event.preventDefault();
- });
-
- var fillContainer = content.append('div')
- .attr('class', 'data-area-fills')
- .style('display', 'none');
-
- var fillList = fillContainer.append('ul')
- .attr('class', 'layer-list layer-fill-list');
-
-
- // feature filters
- content.append('a')
- .text(t('map_data.map_features'))
- .attr('href', '#')
- .classed('hide-toggle', true)
- .classed('expanded', false)
- .on('click', function() {
- var exp = d3.select(this).classed('expanded');
- featureContainer.style('display', exp ? 'none' : 'block');
- d3.select(this).classed('expanded', !exp);
- d3.event.preventDefault();
- });
-
- var featureContainer = content.append('div')
- .attr('class', 'data-feature-filters')
- .style('display', 'none');
-
- var featureList = featureContainer.append('ul')
- .attr('class', 'layer-list layer-feature-list');
-
-
- context.features()
- .on('change.map_data-update', update);
-
- setFill(fillDefault);
-
- var keybinding = d3.keybinding('features')
- .on(key, togglePanel)
- .on('W', toggleWireframe)
- .on('B', hidePanel)
- .on('H', hidePanel);
-
- d3.select(document)
- .call(keybinding);
-
- context.surface().on('mousedown.map_data-outside', hidePanel);
- context.container().on('mousedown.map_data-outside', hidePanel);
+ }
+ function geocoderSearch() {
+ services.geocoder.search(search.property("value"), function(err, resp) {
+ _geocodeResults = resp || [];
+ drawList();
+ });
+ }
}
+ return featureList;
+ }
- return map_data;
-};
-iD.ui.MapInMap = function(context) {
- var key = '/';
-
- function map_in_map(selection) {
- var backgroundLayer = iD.TileLayer(context),
- overlayLayers = {},
- projection = iD.geo.RawMercator(),
- gpxLayer = iD.svg.Gpx(projection, context).showLabels(false),
- zoom = d3.behavior.zoom()
- .scaleExtent([ztok(0.5), ztok(24)])
- .on('zoom', zoomPan),
- transformed = false,
- panning = false,
- hidden = true,
- zDiff = 6, // by default, minimap renders at (main zoom - 6)
- tStart, tLast, tCurr, kLast, kCurr, tiles, svg, timeoutId;
-
- function ztok(z) { return 256 * Math.pow(2, z); }
- function ktoz(k) { return Math.log(k) / Math.LN2 - 8; }
-
-
- function startMouse() {
- context.surface().on('mouseup.map-in-map-outside', endMouse);
- context.container().on('mouseup.map-in-map-outside', endMouse);
-
- tStart = tLast = tCurr = projection.translate();
- panning = true;
- }
-
-
- function zoomPan() {
- var e = d3.event.sourceEvent,
- t = d3.event.translate,
- k = d3.event.scale,
- zMain = ktoz(context.projection.scale() * 2 * Math.PI),
- zMini = ktoz(k);
+ // modules/ui/improveOSM_comments.js
+ function uiImproveOsmComments() {
+ let _qaItem;
+ function issueComments(selection2) {
+ let comments = selection2.selectAll(".comments-container").data([0]);
+ comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
+ services.improveOSM.getComments(_qaItem).then((d) => {
+ if (!d.comments)
+ return;
+ const commentEnter = comments.selectAll(".comment").data(d.comments).enter().append("div").attr("class", "comment");
+ commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
+ const mainEnter = commentEnter.append("div").attr("class", "comment-main");
+ const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
+ metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
+ const osm = services.osm;
+ let selection3 = select_default2(this);
+ if (osm && d2.username) {
+ selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.username)).attr("target", "_blank");
+ }
+ selection3.text((d4) => d4.username);
+ });
+ metadataEnter.append("div").attr("class", "comment-date").html((d2) => _t.html("note.status.commented", { when: localeDateString2(d2.timestamp) }));
+ mainEnter.append("div").attr("class", "comment-text").append("p").text((d2) => d2.text);
+ }).catch((err) => {
+ console.log(err);
+ });
+ }
+ function localeDateString2(s) {
+ if (!s)
+ return null;
+ const options2 = { day: "numeric", month: "short", year: "numeric" };
+ const d = new Date(s * 1e3);
+ if (isNaN(d.getTime()))
+ return null;
+ return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
+ }
+ issueComments.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return issueComments;
+ };
+ return issueComments;
+ }
- // restrict minimap zoom to < (main zoom - 3)
- if (zMini > zMain - 3) {
- zMini = zMain - 3;
- zoom.scale(kCurr).translate(tCurr); // restore last good values
+ // modules/ui/improveOSM_details.js
+ function uiImproveOsmDetails(context) {
+ let _qaItem;
+ function issueDetail(d) {
+ if (d.desc)
+ return d.desc;
+ const issueKey = d.issueKey;
+ d.replacements = d.replacements || {};
+ d.replacements.default = { html: _t.html("inspector.unknown") };
+ return _t.html(`QA.improveOSM.error_types.${issueKey}.description`, d.replacements);
+ }
+ function improveOsmDetails(selection2) {
+ const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ details.exit().remove();
+ const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
+ const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
+ descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
+ let relatedEntities = [];
+ descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
+ const link2 = select_default2(this);
+ const isObjectLink = link2.classed("error_object_link");
+ const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
+ const entity = context.hasEntity(entityID);
+ relatedEntities.push(entityID);
+ link2.on("mouseenter", () => {
+ utilHighlightEntities([entityID], true, context);
+ }).on("mouseleave", () => {
+ utilHighlightEntities([entityID], false, context);
+ }).on("click", (d3_event) => {
+ d3_event.preventDefault();
+ utilHighlightEntities([entityID], false, context);
+ const osmlayer = context.layers().layer("osm");
+ if (!osmlayer.enabled()) {
+ osmlayer.enabled(true);
+ }
+ context.map().centerZoom(_qaItem.loc, 20);
+ if (entity) {
+ context.enter(modeSelect(context, [entityID]));
+ } else {
+ context.loadEntity(entityID, (err, result) => {
+ if (err)
return;
- }
-
- tCurr = t;
- kCurr = k;
- zDiff = zMain - zMini;
-
- var scale = kCurr / kLast,
- tX = (tCurr[0] / scale - tLast[0]) * scale,
- tY = (tCurr[1] / scale - tLast[1]) * scale;
-
- iD.util.setTransform(tiles, tX, tY, scale);
- iD.util.setTransform(svg, 0, 0, scale);
- transformed = true;
+ const entity2 = result.data.find((e) => e.id === entityID);
+ if (entity2)
+ context.enter(modeSelect(context, [entityID]));
+ });
+ }
+ });
+ if (entity) {
+ let name2 = utilDisplayName(entity);
+ if (!name2 && !isObjectLink) {
+ const preset = _mainPresetIndex.match(entity, context.graph());
+ name2 = preset && !preset.isFallback() && preset.name();
+ }
+ if (name2) {
+ this.innerText = name2;
+ }
+ }
+ });
+ context.features().forceVisible(relatedEntities);
+ context.map().pan([0, 0]);
+ }
+ improveOsmDetails.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return improveOsmDetails;
+ };
+ return improveOsmDetails;
+ }
- queueRedraw();
+ // modules/ui/improveOSM_header.js
+ function uiImproveOsmHeader() {
+ let _qaItem;
+ function issueTitle(d) {
+ const issueKey = d.issueKey;
+ d.replacements = d.replacements || {};
+ d.replacements.default = { html: _t.html("inspector.unknown") };
+ return _t.html(`QA.improveOSM.error_types.${issueKey}.title`, d.replacements);
+ }
+ function improveOsmHeader(selection2) {
+ const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ header.exit().remove();
+ const headerEnter = header.enter().append("div").attr("class", "qa-header");
+ const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
+ svgEnter.append("polygon").attr("fill", "currentColor").attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
+ svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
+ headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
+ }
+ improveOsmHeader.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return improveOsmHeader;
+ };
+ return improveOsmHeader;
+ }
- e.preventDefault();
- e.stopPropagation();
+ // modules/ui/improveOSM_editor.js
+ function uiImproveOsmEditor(context) {
+ const dispatch10 = dispatch_default("change");
+ const qaDetails = uiImproveOsmDetails(context);
+ const qaComments = uiImproveOsmComments(context);
+ const qaHeader = uiImproveOsmHeader(context);
+ let _qaItem;
+ function improveOsmEditor(selection2) {
+ const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
+ headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
+ headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
+ let body = selection2.selectAll(".body").data([0]);
+ body = body.enter().append("div").attr("class", "body").merge(body);
+ const editor = body.selectAll(".qa-editor").data([0]);
+ editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(qaComments.issue(_qaItem)).call(improveOsmSaveSection);
+ }
+ function improveOsmSaveSection(selection2) {
+ const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
+ const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
+ let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ saveSection.exit().remove();
+ const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
+ saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
+ saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d) => d.newComment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
+ saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
+ function changeInput() {
+ const input = select_default2(this);
+ let val = input.property("value").trim();
+ if (val === "") {
+ val = void 0;
+ }
+ _qaItem = _qaItem.update({ newComment: val });
+ const qaService = services.improveOSM;
+ if (qaService) {
+ qaService.replaceItem(_qaItem);
+ }
+ saveSection.call(qaSaveButtons);
+ }
+ }
+ function qaSaveButtons(selection2) {
+ const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
+ let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
+ buttonSection.exit().remove();
+ const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
+ buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
+ buttonEnter.append("button").attr("class", "button close-button action");
+ buttonEnter.append("button").attr("class", "button ignore-button action");
+ buttonSection = buttonSection.merge(buttonEnter);
+ buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
+ this.blur();
+ const qaService = services.improveOSM;
+ if (qaService) {
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
}
-
-
- function endMouse() {
- context.surface().on('mouseup.map-in-map-outside', null);
- context.container().on('mouseup.map-in-map-outside', null);
-
- updateProjection();
- panning = false;
-
- if (tCurr[0] !== tStart[0] && tCurr[1] !== tStart[1]) {
- var dMini = wrap.dimensions(),
- cMini = [ dMini[0] / 2, dMini[1] / 2 ];
-
- context.map().center(projection.invert(cMini));
- }
+ });
+ buttonSection.select(".close-button").html((d) => {
+ const andComment = d.newComment ? "_comment" : "";
+ return _t.html(`QA.keepRight.close${andComment}`);
+ }).on("click.close", function(d3_event, d) {
+ this.blur();
+ const qaService = services.improveOSM;
+ if (qaService) {
+ d.newStatus = "SOLVED";
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
}
-
-
- function updateProjection() {
- var loc = context.map().center(),
- dMini = wrap.dimensions(),
- cMini = [ dMini[0] / 2, dMini[1] / 2 ],
- tMain = context.projection.translate(),
- kMain = context.projection.scale(),
- zMain = ktoz(kMain * 2 * Math.PI),
- zMini = Math.max(zMain - zDiff, 0.5),
- kMini = ztok(zMini);
-
- projection
- .translate(tMain)
- .scale(kMini / (2 * Math.PI));
-
- var s = projection(loc),
- mouse = panning ? [ tCurr[0] - tStart[0], tCurr[1] - tStart[1] ] : [0, 0],
- tMini = [
- cMini[0] - s[0] + tMain[0] + mouse[0],
- cMini[1] - s[1] + tMain[1] + mouse[1]
- ];
-
- projection
- .translate(tMini)
- .clipExtent([[0, 0], dMini]);
-
- zoom
- .center(cMini)
- .translate(tMini)
- .scale(kMini);
-
- tLast = tCurr = tMini;
- kLast = kCurr = kMini;
-
- if (transformed) {
- iD.util.setTransform(tiles, 0, 0);
- iD.util.setTransform(svg, 0, 0);
- transformed = false;
- }
+ });
+ buttonSection.select(".ignore-button").html((d) => {
+ const andComment = d.newComment ? "_comment" : "";
+ return _t.html(`QA.keepRight.ignore${andComment}`);
+ }).on("click.ignore", function(d3_event, d) {
+ this.blur();
+ const qaService = services.improveOSM;
+ if (qaService) {
+ d.newStatus = "INVALID";
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
}
+ });
+ }
+ improveOsmEditor.error = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return improveOsmEditor;
+ };
+ return utilRebind(improveOsmEditor, dispatch10, "on");
+ }
-
- function redraw() {
- if (hidden) return;
-
- updateProjection();
-
- var dMini = wrap.dimensions(),
- zMini = ktoz(projection.scale() * 2 * Math.PI);
-
- // setup tile container
- tiles = wrap
- .selectAll('.map-in-map-tiles')
- .data([0]);
-
- tiles
- .enter()
- .append('div')
- .attr('class', 'map-in-map-tiles');
-
- // redraw background
- backgroundLayer
- .source(context.background().baseLayerSource())
- .projection(projection)
- .dimensions(dMini);
-
- var background = tiles
- .selectAll('.map-in-map-background')
- .data([0]);
-
- background.enter()
- .append('div')
- .attr('class', 'map-in-map-background');
-
- background
- .call(backgroundLayer);
-
-
- // redraw overlay
- var overlaySources = context.background().overlayLayerSources();
- var activeOverlayLayers = [];
- for (var i = 0; i < overlaySources.length; i++) {
- if (overlaySources[i].validZoom(zMini)) {
- if (!overlayLayers[i]) overlayLayers[i] = iD.TileLayer(context);
- activeOverlayLayers.push(overlayLayers[i]
- .source(overlaySources[i])
- .projection(projection)
- .dimensions(dMini));
- }
+ // modules/ui/preset_list.js
+ function uiPresetList(context) {
+ var dispatch10 = dispatch_default("cancel", "choose");
+ var _entityIDs;
+ var _currLoc;
+ var _currentPresets;
+ var _autofocus = false;
+ function presetList(selection2) {
+ if (!_entityIDs)
+ return;
+ var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
+ selection2.html("");
+ var messagewrap = selection2.append("div").attr("class", "header fillL");
+ var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
+ var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
+ messagewrap.append("button").attr("class", "preset-choose").attr("title", direction).on("click", function() {
+ dispatch10.call("cancel", this);
+ }).call(svgIcon(`#iD-icon-${direction}`));
+ function initialKeydown(d3_event) {
+ if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ operationDelete(context, _entityIDs)();
+ } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ context.undo();
+ } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
+ select_default2(this).on("keydown", keydown);
+ keydown.call(this, d3_event);
+ }
+ }
+ function keydown(d3_event) {
+ if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && search.node().selectionStart === search.property("value").length) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var buttons = list.selectAll(".preset-list-button");
+ if (!buttons.empty())
+ buttons.nodes()[0].focus();
+ }
+ }
+ function keypress(d3_event) {
+ var value = search.property("value");
+ if (d3_event.keyCode === 13 && value.length) {
+ list.selectAll(".preset-list-item:first-child").each(function(d) {
+ d.choose.call(this);
+ });
+ }
+ }
+ function inputevent() {
+ var value = search.property("value");
+ list.classed("filtered", value.length);
+ var results, messageText;
+ if (value.length) {
+ results = presets.search(value, entityGeometries()[0], _currLoc);
+ messageText = _t.html("inspector.results", {
+ n: results.collection.length,
+ search: value
+ });
+ } else {
+ results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc);
+ messageText = _t.html("inspector.choose");
+ }
+ list.call(drawList, results);
+ message.html(messageText);
+ }
+ var searchWrap = selection2.append("div").attr("class", "search-header");
+ searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
+ var search = searchWrap.append("input").attr("class", "preset-search-input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keydown", initialKeydown).on("keypress", keypress).on("input", debounce_default(inputevent));
+ if (_autofocus) {
+ search.node().focus();
+ setTimeout(function() {
+ search.node().focus();
+ }, 0);
+ }
+ var listWrap = selection2.append("div").attr("class", "inspector-body");
+ var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc));
+ context.features().on("change.preset-list", updateForFeatureHiddenState);
+ }
+ function drawList(list, presets) {
+ presets = presets.matchAllGeometry(entityGeometries());
+ var collection = presets.collection.reduce(function(collection2, preset) {
+ if (!preset)
+ return collection2;
+ if (preset.members) {
+ if (preset.members.collection.filter(function(preset2) {
+ return preset2.addable();
+ }).length > 1) {
+ collection2.push(CategoryItem(preset));
+ }
+ } else if (preset.addable()) {
+ collection2.push(PresetItem(preset));
+ }
+ return collection2;
+ }, []);
+ var items = list.selectAll(".preset-list-item").data(collection, function(d) {
+ return d.preset.id;
+ });
+ items.order();
+ items.exit().remove();
+ items.enter().append("div").attr("class", function(item) {
+ return "preset-list-item preset-" + item.preset.id.replace("/", "-");
+ }).classed("current", function(item) {
+ return _currentPresets.indexOf(item.preset) !== -1;
+ }).each(function(item) {
+ select_default2(this).call(item);
+ }).style("opacity", 0).transition().style("opacity", 1);
+ updateForFeatureHiddenState();
+ }
+ function itemKeydown(d3_event) {
+ var item = select_default2(this.closest(".preset-list-item"));
+ var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
+ if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var nextItem = select_default2(item.node().nextElementSibling);
+ if (nextItem.empty()) {
+ if (!parentItem.empty()) {
+ nextItem = select_default2(parentItem.node().nextElementSibling);
+ }
+ } else if (select_default2(this).classed("expanded")) {
+ nextItem = item.select(".subgrid .preset-list-item:first-child");
+ }
+ if (!nextItem.empty()) {
+ nextItem.select(".preset-list-button").node().focus();
+ }
+ } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var previousItem = select_default2(item.node().previousElementSibling);
+ if (previousItem.empty()) {
+ if (!parentItem.empty()) {
+ previousItem = parentItem;
+ }
+ } else if (previousItem.select(".preset-list-button").classed("expanded")) {
+ previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
+ }
+ if (!previousItem.empty()) {
+ previousItem.select(".preset-list-button").node().focus();
+ } else {
+ var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
+ search.node().focus();
+ }
+ } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ if (!parentItem.empty()) {
+ parentItem.select(".preset-list-button").node().focus();
+ }
+ } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ item.datum().choose.call(select_default2(this).node());
+ }
+ }
+ function CategoryItem(preset) {
+ var box, sublist, shown = false;
+ function item(selection2) {
+ var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
+ function click() {
+ var isExpanded = select_default2(this).classed("expanded");
+ var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
+ select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
+ select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
+ item.choose();
+ }
+ var geometries = entityGeometries();
+ var button = wrap2.append("button").attr("class", "preset-list-button").attr("title", _t("icons.expand")).classed("expanded", false).call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", click).on("keydown", function(d3_event) {
+ if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ if (!select_default2(this).classed("expanded")) {
+ click.call(this, d3_event);
}
-
- var overlay = tiles
- .selectAll('.map-in-map-overlay')
- .data([0]);
-
- overlay.enter()
- .append('div')
- .attr('class', 'map-in-map-overlay');
-
- var overlays = overlay
- .selectAll('div')
- .data(activeOverlayLayers, function(d) { return d.source().name(); });
-
- overlays.enter().append('div');
- overlays.each(function(layer) {
- d3.select(this).call(layer);
- });
-
- overlays.exit()
- .remove();
-
-
- var gpx = tiles
- .selectAll('.map-in-map-gpx')
- .data(gpxLayer.enabled() ? [0] : []);
-
- gpx.enter()
- .append('svg')
- .attr('class', 'map-in-map-gpx');
-
- gpx.exit()
- .remove();
-
- gpx.call(gpxLayer);
-
-
- // redraw bounding box
- if (!panning) {
- var getPath = d3.geo.path().projection(projection),
- bbox = { type: 'Polygon', coordinates: [context.map().extent().polygon()] };
-
- svg = wrap.selectAll('.map-in-map-svg')
- .data([0]);
-
- svg.enter()
- .append('svg')
- .attr('class', 'map-in-map-svg');
-
- var path = svg.selectAll('.map-in-map-bbox')
- .data([bbox]);
-
- path.enter()
- .append('path')
- .attr('class', 'map-in-map-bbox');
-
- path
- .attr('d', getPath)
- .classed('thick', function(d) { return getPath.area(d) < 30; });
+ } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ if (select_default2(this).classed("expanded")) {
+ click.call(this, d3_event);
}
+ } else {
+ itemKeydown.call(this, d3_event);
+ }
+ });
+ var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
+ label.append("div").attr("class", "namepart").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline")).append("span").html(function() {
+ return preset.nameLabel() + "…";
+ });
+ box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
+ box.append("div").attr("class", "arrow");
+ sublist = box.append("div").attr("class", "preset-list fillL3");
+ }
+ item.choose = function() {
+ if (!box || !sublist)
+ return;
+ if (shown) {
+ shown = false;
+ box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
+ } else {
+ shown = true;
+ var members = preset.members.matchAllGeometry(entityGeometries());
+ sublist.call(drawList, members);
+ box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
}
-
-
- function queueRedraw() {
- clearTimeout(timeoutId);
- timeoutId = setTimeout(function() { redraw(); }, 300);
+ };
+ item.preset = preset;
+ return item;
+ }
+ function PresetItem(preset) {
+ function item(selection2) {
+ var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
+ var geometries = entityGeometries();
+ var button = wrap2.append("button").attr("class", "preset-list-button").call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", item.choose).on("keydown", itemKeydown);
+ var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
+ var nameparts = [
+ preset.nameLabel(),
+ preset.subtitleLabel()
+ ].filter(Boolean);
+ label.selectAll(".namepart").data(nameparts).enter().append("div").attr("class", "namepart").html(function(d) {
+ return d;
+ });
+ wrap2.call(item.reference.button);
+ selection2.call(item.reference.body);
+ }
+ item.choose = function() {
+ if (select_default2(this).classed("disabled"))
+ return;
+ if (!context.inIntro()) {
+ _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
+ }
+ context.perform(function(graph) {
+ for (var i2 in _entityIDs) {
+ var entityID = _entityIDs[i2];
+ var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
+ graph = actionChangePreset(entityID, oldPreset, preset)(graph);
+ }
+ return graph;
+ }, _t("operations.change_tags.annotation"));
+ context.validator().validate();
+ dispatch10.call("choose", this, preset);
+ };
+ item.help = function(d3_event) {
+ d3_event.stopPropagation();
+ item.reference.toggle();
+ };
+ item.preset = preset;
+ item.reference = uiTagReference(preset.reference(), context);
+ return item;
+ }
+ function updateForFeatureHiddenState() {
+ if (!_entityIDs.every(context.hasEntity))
+ return;
+ var geometries = entityGeometries();
+ var button = context.container().selectAll(".preset-list .preset-list-button");
+ button.call(uiTooltip().destroyAny);
+ button.each(function(item, index) {
+ var hiddenPresetFeaturesId;
+ for (var i2 in geometries) {
+ hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i2]);
+ if (hiddenPresetFeaturesId)
+ break;
+ }
+ var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
+ select_default2(this).classed("disabled", isHiddenPreset);
+ if (isHiddenPreset) {
+ var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
+ select_default2(this).call(uiTooltip().title(_t.html("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
+ features: { html: _t.html("feature." + hiddenPresetFeaturesId + ".description") }
+ })).placement(index < 2 ? "bottom" : "top"));
}
+ });
+ }
+ presetList.autofocus = function(val) {
+ if (!arguments.length)
+ return _autofocus;
+ _autofocus = val;
+ return presetList;
+ };
+ presetList.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ _currLoc = null;
+ if (_entityIDs && _entityIDs.length) {
+ const extent = _entityIDs.reduce(function(extent2, entityID) {
+ var entity = context.graph().entity(entityID);
+ return extent2.extend(entity.extent(context.graph()));
+ }, geoExtent());
+ _currLoc = extent.center();
+ var presets = _entityIDs.map(function(entityID) {
+ return _mainPresetIndex.match(context.entity(entityID), context.graph());
+ });
+ presetList.presets(presets);
+ }
+ return presetList;
+ };
+ presetList.presets = function(val) {
+ if (!arguments.length)
+ return _currentPresets;
+ _currentPresets = val;
+ return presetList;
+ };
+ function entityGeometries() {
+ var counts = {};
+ for (var i2 in _entityIDs) {
+ var entityID = _entityIDs[i2];
+ var entity = context.entity(entityID);
+ var geometry = entity.geometry(context.graph());
+ if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
+ geometry = "point";
+ }
+ if (!counts[geometry])
+ counts[geometry] = 0;
+ counts[geometry] += 1;
+ }
+ return Object.keys(counts).sort(function(geom1, geom2) {
+ return counts[geom2] - counts[geom1];
+ });
+ }
+ return utilRebind(presetList, dispatch10, "on");
+ }
+ // modules/ui/view_on_osm.js
+ function uiViewOnOSM(context) {
+ var _what;
+ function viewOnOSM(selection2) {
+ var url;
+ if (_what instanceof osmEntity) {
+ url = context.connection().entityURL(_what);
+ } else if (_what instanceof osmNote) {
+ url = context.connection().noteURL(_what);
+ }
+ var data = !_what || _what.isNew() ? [] : [_what];
+ var link2 = selection2.selectAll(".view-on-osm").data(data, function(d) {
+ return d.id;
+ });
+ link2.exit().remove();
+ var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
+ linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
+ }
+ viewOnOSM.what = function(_) {
+ if (!arguments.length)
+ return _what;
+ _what = _;
+ return viewOnOSM;
+ };
+ return viewOnOSM;
+ }
- function toggle() {
- if (d3.event) d3.event.preventDefault();
-
- hidden = !hidden;
-
- var label = d3.select('.minimap-toggle');
- label.classed('active', !hidden)
- .select('input').property('checked', !hidden);
-
- if (hidden) {
- wrap
- .style('display', 'block')
- .style('opacity', 1)
- .transition()
- .duration(200)
- .style('opacity', 0)
- .each('end', function() {
- d3.select(this).style('display', 'none');
- });
- } else {
- wrap
- .style('display', 'block')
- .style('opacity', 0)
- .transition()
- .duration(200)
- .style('opacity', 1);
-
- redraw();
- }
+ // modules/ui/inspector.js
+ function uiInspector(context) {
+ var presetList = uiPresetList(context);
+ var entityEditor = uiEntityEditor(context);
+ var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
+ var _state = "select";
+ var _entityIDs;
+ var _newFeature = false;
+ function inspector(selection2) {
+ presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
+ inspector.setPreset();
+ });
+ entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
+ wrap2 = selection2.selectAll(".panewrap").data([0]);
+ var enter = wrap2.enter().append("div").attr("class", "panewrap");
+ enter.append("div").attr("class", "preset-list-pane pane");
+ enter.append("div").attr("class", "entity-editor-pane pane");
+ wrap2 = wrap2.merge(enter);
+ presetPane = wrap2.selectAll(".preset-list-pane");
+ editorPane = wrap2.selectAll(".entity-editor-pane");
+ function shouldDefaultToPresetList() {
+ if (_state !== "select")
+ return false;
+ if (_entityIDs.length !== 1)
+ return false;
+ var entityID = _entityIDs[0];
+ var entity = context.hasEntity(entityID);
+ if (!entity)
+ return false;
+ if (entity.hasNonGeometryTags())
+ return false;
+ if (_newFeature)
+ return true;
+ if (entity.geometry(context.graph()) !== "vertex")
+ return false;
+ if (context.graph().parentRelations(entity).length)
+ return false;
+ if (context.validator().getEntityIssues(entityID).length)
+ return false;
+ if (entity.isHighwayIntersection(context.graph()))
+ return false;
+ return true;
+ }
+ if (shouldDefaultToPresetList()) {
+ wrap2.style("right", "-100%");
+ editorPane.classed("hide", true);
+ presetPane.classed("hide", false).call(presetList);
+ } else {
+ wrap2.style("right", "0%");
+ presetPane.classed("hide", true);
+ editorPane.classed("hide", false).call(entityEditor);
+ }
+ var footer = selection2.selectAll(".footer").data([0]);
+ footer = footer.enter().append("div").attr("class", "footer").merge(footer);
+ footer.call(uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0])));
+ }
+ inspector.showList = function(presets) {
+ presetPane.classed("hide", false);
+ wrap2.transition().styleTween("right", function() {
+ return value_default("0%", "-100%");
+ }).on("end", function() {
+ editorPane.classed("hide", true);
+ });
+ if (presets) {
+ presetList.presets(presets);
+ }
+ presetPane.call(presetList.autofocus(true));
+ };
+ inspector.setPreset = function(preset) {
+ if (preset && preset.id === "type/multipolygon") {
+ presetPane.call(presetList.autofocus(true));
+ } else {
+ editorPane.classed("hide", false);
+ wrap2.transition().styleTween("right", function() {
+ return value_default("-100%", "0%");
+ }).on("end", function() {
+ presetPane.classed("hide", true);
+ });
+ if (preset) {
+ entityEditor.presets([preset]);
}
+ editorPane.call(entityEditor);
+ }
+ };
+ inspector.state = function(val) {
+ if (!arguments.length)
+ return _state;
+ _state = val;
+ entityEditor.state(_state);
+ context.container().selectAll(".field-help-body").remove();
+ return inspector;
+ };
+ inspector.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ _entityIDs = val;
+ return inspector;
+ };
+ inspector.newFeature = function(val) {
+ if (!arguments.length)
+ return _newFeature;
+ _newFeature = val;
+ return inspector;
+ };
+ return inspector;
+ }
- iD.ui.MapInMap.toggle = toggle;
-
- var wrap = selection.selectAll('.map-in-map')
- .data([0]);
-
- wrap.enter()
- .append('div')
- .attr('class', 'map-in-map')
- .style('display', (hidden ? 'none' : 'block'))
- .on('mousedown.map-in-map', startMouse)
- .on('mouseup.map-in-map', endMouse)
- .call(zoom)
- .on('dblclick.zoom', null);
-
- context.map()
- .on('drawn.map-in-map', function(drawn) {
- if (drawn.full === true) redraw();
+ // modules/ui/keepRight_details.js
+ function uiKeepRightDetails(context) {
+ let _qaItem;
+ function issueDetail(d) {
+ const { itemType, parentIssueType } = d;
+ const unknown = { html: _t.html("inspector.unknown") };
+ let replacements = d.replacements || {};
+ replacements.default = unknown;
+ if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
+ return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
+ } else {
+ return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
+ }
+ }
+ function keepRightDetails(selection2) {
+ const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ details.exit().remove();
+ const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
+ const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
+ descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
+ let relatedEntities = [];
+ descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
+ const link2 = select_default2(this);
+ const isObjectLink = link2.classed("error_object_link");
+ const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
+ const entity = context.hasEntity(entityID);
+ relatedEntities.push(entityID);
+ link2.on("mouseenter", () => {
+ utilHighlightEntities([entityID], true, context);
+ }).on("mouseleave", () => {
+ utilHighlightEntities([entityID], false, context);
+ }).on("click", (d3_event) => {
+ d3_event.preventDefault();
+ utilHighlightEntities([entityID], false, context);
+ const osmlayer = context.layers().layer("osm");
+ if (!osmlayer.enabled()) {
+ osmlayer.enabled(true);
+ }
+ context.map().centerZoomEase(_qaItem.loc, 20);
+ if (entity) {
+ context.enter(modeSelect(context, [entityID]));
+ } else {
+ context.loadEntity(entityID, (err, result) => {
+ if (err)
+ return;
+ const entity2 = result.data.find((e) => e.id === entityID);
+ if (entity2)
+ context.enter(modeSelect(context, [entityID]));
});
-
- redraw();
-
- var keybinding = d3.keybinding('map-in-map')
- .on(key, toggle);
-
- d3.select(document)
- .call(keybinding);
+ }
+ });
+ if (entity) {
+ let name2 = utilDisplayName(entity);
+ if (!name2 && !isObjectLink) {
+ const preset = _mainPresetIndex.match(entity, context.graph());
+ name2 = preset && !preset.isFallback() && preset.name();
+ }
+ if (name2) {
+ this.innerText = name2;
+ }
+ }
+ });
+ context.features().forceVisible(relatedEntities);
+ context.map().pan([0, 0]);
}
+ keepRightDetails.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return keepRightDetails;
+ };
+ return keepRightDetails;
+ }
- return map_in_map;
-};
-iD.ui.modal = function(selection, blocking) {
- var keybinding = d3.keybinding('modal');
- var previous = selection.select('div.modal');
- var animate = previous.empty();
-
- previous.transition()
- .duration(200)
- .style('opacity', 0)
- .remove();
-
- var shaded = selection
- .append('div')
- .attr('class', 'shaded')
- .style('opacity', 0);
+ // modules/ui/keepRight_header.js
+ function uiKeepRightHeader() {
+ let _qaItem;
+ function issueTitle(d) {
+ const { itemType, parentIssueType } = d;
+ const unknown = _t.html("inspector.unknown");
+ let replacements = d.replacements || {};
+ replacements.default = { html: unknown };
+ if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
+ return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
+ } else {
+ return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
+ }
+ }
+ function keepRightHeader(selection2) {
+ const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ header.exit().remove();
+ const headerEnter = header.enter().append("div").attr("class", "qa-header");
+ const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0);
+ iconEnter.append("div").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.parentIssueType}`).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
+ headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
+ }
+ keepRightHeader.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return keepRightHeader;
+ };
+ return keepRightHeader;
+ }
- shaded.close = function() {
- shaded
- .transition()
- .duration(200)
- .style('opacity',0)
- .remove();
- modal
- .transition()
- .duration(200)
- .style('top','0px');
+ // modules/ui/view_on_keepRight.js
+ function uiViewOnKeepRight() {
+ let _qaItem;
+ function viewOnKeepRight(selection2) {
+ let url;
+ if (services.keepRight && _qaItem instanceof QAItem) {
+ url = services.keepRight.issueURL(_qaItem);
+ }
+ const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
+ link2.exit().remove();
+ const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d) => d).call(svgIcon("#iD-icon-out-link", "inline"));
+ linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
+ }
+ viewOnKeepRight.what = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return viewOnKeepRight;
+ };
+ return viewOnKeepRight;
+ }
- keybinding.off();
+ // modules/ui/keepRight_editor.js
+ function uiKeepRightEditor(context) {
+ const dispatch10 = dispatch_default("change");
+ const qaDetails = uiKeepRightDetails(context);
+ const qaHeader = uiKeepRightHeader(context);
+ let _qaItem;
+ function keepRightEditor(selection2) {
+ const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
+ headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
+ headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
+ let body = selection2.selectAll(".body").data([0]);
+ body = body.enter().append("div").attr("class", "body").merge(body);
+ const editor = body.selectAll(".qa-editor").data([0]);
+ editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
+ const footer = selection2.selectAll(".footer").data([0]);
+ footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
+ }
+ function keepRightSaveSection(selection2) {
+ const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
+ const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
+ let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ saveSection.exit().remove();
+ const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
+ saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
+ saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d) => d.newComment || d.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
+ saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
+ function changeInput() {
+ const input = select_default2(this);
+ let val = input.property("value").trim();
+ if (val === _qaItem.comment) {
+ val = void 0;
+ }
+ _qaItem = _qaItem.update({ newComment: val });
+ const qaService = services.keepRight;
+ if (qaService) {
+ qaService.replaceItem(_qaItem);
+ }
+ saveSection.call(qaSaveButtons);
+ }
+ }
+ function qaSaveButtons(selection2) {
+ const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
+ let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
+ buttonSection.exit().remove();
+ const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
+ buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
+ buttonEnter.append("button").attr("class", "button close-button action");
+ buttonEnter.append("button").attr("class", "button ignore-button action");
+ buttonSection = buttonSection.merge(buttonEnter);
+ buttonSection.select(".comment-button").attr("disabled", (d) => d.newComment ? null : true).on("click.comment", function(d3_event, d) {
+ this.blur();
+ const qaService = services.keepRight;
+ if (qaService) {
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
+ }
+ });
+ buttonSection.select(".close-button").html((d) => {
+ const andComment = d.newComment ? "_comment" : "";
+ return _t.html(`QA.keepRight.close${andComment}`);
+ }).on("click.close", function(d3_event, d) {
+ this.blur();
+ const qaService = services.keepRight;
+ if (qaService) {
+ d.newStatus = "ignore_t";
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
+ }
+ });
+ buttonSection.select(".ignore-button").html((d) => {
+ const andComment = d.newComment ? "_comment" : "";
+ return _t.html(`QA.keepRight.ignore${andComment}`);
+ }).on("click.ignore", function(d3_event, d) {
+ this.blur();
+ const qaService = services.keepRight;
+ if (qaService) {
+ d.newStatus = "ignore";
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
+ }
+ });
+ }
+ keepRightEditor.error = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return keepRightEditor;
};
+ return utilRebind(keepRightEditor, dispatch10, "on");
+ }
-
- var modal = shaded.append('div')
- .attr('class', 'modal fillL col6');
-
- if (!blocking) {
- shaded.on('click.remove-modal', function() {
- if (d3.event.target === this) {
- shaded.close();
- }
+ // modules/ui/lasso.js
+ function uiLasso(context) {
+ var group, polygon2;
+ lasso.coordinates = [];
+ function lasso(selection2) {
+ context.container().classed("lasso", true);
+ group = selection2.append("g").attr("class", "lasso hide");
+ polygon2 = group.append("path").attr("class", "lasso-path");
+ group.call(uiToggle(true));
+ }
+ function draw() {
+ if (polygon2) {
+ polygon2.data([lasso.coordinates]).attr("d", function(d) {
+ return "M" + d.join(" L") + " Z";
});
-
- modal.append('button')
- .attr('class', 'close')
- .on('click', shaded.close)
- .call(iD.svg.Icon('#icon-close'));
-
- keybinding
- .on('â«', shaded.close)
- .on('â', shaded.close);
-
- d3.select(document).call(keybinding);
+ }
}
+ lasso.extent = function() {
+ return lasso.coordinates.reduce(function(extent, point) {
+ return extent.extend(geoExtent(point));
+ }, geoExtent());
+ };
+ lasso.p = function(_) {
+ if (!arguments.length)
+ return lasso;
+ lasso.coordinates.push(_);
+ draw();
+ return lasso;
+ };
+ lasso.close = function() {
+ if (group) {
+ group.call(uiToggle(false, function() {
+ select_default2(this).remove();
+ }));
+ }
+ context.container().classed("lasso", false);
+ };
+ return lasso;
+ }
- modal.append('div')
- .attr('class', 'content');
+ // modules/ui/note_comments.js
+ function uiNoteComments() {
+ var _note;
+ function noteComments(selection2) {
+ if (_note.isNew())
+ return;
+ var comments = selection2.selectAll(".comments-container").data([0]);
+ comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
+ var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
+ commentEnter.append("div").attr("class", function(d) {
+ return "comment-avatar user-" + d.uid;
+ }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
+ var mainEnter = commentEnter.append("div").attr("class", "comment-main");
+ var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
+ metadataEnter.append("div").attr("class", "comment-author").each(function(d) {
+ var selection3 = select_default2(this);
+ var osm = services.osm;
+ if (osm && d.user) {
+ selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d.user)).attr("target", "_blank");
+ }
+ if (d.user) {
+ selection3.text(d.user);
+ } else {
+ selection3.call(_t.append("note.anonymous"));
+ }
+ });
+ metadataEnter.append("div").attr("class", "comment-date").html(function(d) {
+ return _t.html("note.status." + d.action, { when: localeDateString2(d.date) });
+ });
+ mainEnter.append("div").attr("class", "comment-text").html(function(d) {
+ return d.html;
+ }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
+ comments.call(replaceAvatars);
+ }
+ function replaceAvatars(selection2) {
+ var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
+ var osm = services.osm;
+ if (showThirdPartyIcons !== "true" || !osm)
+ return;
+ var uids = {};
+ _note.comments.forEach(function(d) {
+ if (d.uid)
+ uids[d.uid] = true;
+ });
+ Object.keys(uids).forEach(function(uid) {
+ osm.loadUser(uid, function(err, user) {
+ if (!user || !user.image_url)
+ return;
+ selection2.selectAll(".comment-avatar.user-" + uid).html("").append("img").attr("class", "icon comment-avatar-icon").attr("src", user.image_url).attr("alt", user.display_name);
+ });
+ });
+ }
+ function localeDateString2(s) {
+ if (!s)
+ return null;
+ var options2 = { day: "numeric", month: "short", year: "numeric" };
+ s = s.replace(/-/g, "/");
+ var d = new Date(s);
+ if (isNaN(d.getTime()))
+ return null;
+ return d.toLocaleDateString(_mainLocalizer.localeCode(), options2);
+ }
+ noteComments.note = function(val) {
+ if (!arguments.length)
+ return _note;
+ _note = val;
+ return noteComments;
+ };
+ return noteComments;
+ }
- if (animate) {
- shaded.transition().style('opacity', 1);
- } else {
- shaded.style('opacity', 1);
+ // modules/ui/note_header.js
+ function uiNoteHeader() {
+ var _note;
+ function noteHeader(selection2) {
+ var header = selection2.selectAll(".note-header").data(_note ? [_note] : [], function(d) {
+ return d.status + d.id;
+ });
+ header.exit().remove();
+ var headerEnter = header.enter().append("div").attr("class", "note-header");
+ var iconEnter = headerEnter.append("div").attr("class", function(d) {
+ return "note-header-icon " + d.status;
+ }).classed("new", function(d) {
+ return d.id < 0;
+ });
+ iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
+ iconEnter.each(function(d) {
+ var statusIcon;
+ if (d.id < 0) {
+ statusIcon = "#iD-icon-plus";
+ } else if (d.status === "open") {
+ statusIcon = "#iD-icon-close";
+ } else {
+ statusIcon = "#iD-icon-apply";
+ }
+ iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
+ });
+ headerEnter.append("div").attr("class", "note-header-label").html(function(d) {
+ if (_note.isNew()) {
+ return _t.html("note.new");
+ }
+ return _t.html("note.note") + " " + d.id + " " + (d.status === "closed" ? _t.html("note.closed") : "");
+ });
}
+ noteHeader.note = function(val) {
+ if (!arguments.length)
+ return _note;
+ _note = val;
+ return noteHeader;
+ };
+ return noteHeader;
+ }
- return shaded;
-};
-iD.ui.Modes = function(context) {
- var modes = [
- iD.modes.AddPoint(context),
- iD.modes.AddLine(context),
- iD.modes.AddArea(context)];
+ // modules/ui/note_report.js
+ function uiNoteReport() {
+ var _note;
+ function noteReport(selection2) {
+ var url;
+ if (services.osm && _note instanceof osmNote && !_note.isNew()) {
+ url = services.osm.noteReportURL(_note);
+ }
+ var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
+ link2.exit().remove();
+ var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d) {
+ return d;
+ }).call(svgIcon("#iD-icon-out-link", "inline"));
+ linkEnter.append("span").call(_t.append("note.report"));
+ }
+ noteReport.note = function(val) {
+ if (!arguments.length)
+ return _note;
+ _note = val;
+ return noteReport;
+ };
+ return noteReport;
+ }
- function editable() {
- return context.editable() && context.mode().id !== 'save';
+ // modules/ui/note_editor.js
+ function uiNoteEditor(context) {
+ var dispatch10 = dispatch_default("change");
+ var noteComments = uiNoteComments(context);
+ var noteHeader = uiNoteHeader();
+ var _note;
+ var _newNote;
+ function noteEditor(selection2) {
+ var header = selection2.selectAll(".header").data([0]);
+ var headerEnter = header.enter().append("div").attr("class", "header fillL");
+ headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
+ context.enter(modeBrowse(context));
+ }).call(svgIcon("#iD-icon-close"));
+ headerEnter.append("h2").call(_t.append("note.title"));
+ var body = selection2.selectAll(".body").data([0]);
+ body = body.enter().append("div").attr("class", "body").merge(body);
+ var editor = body.selectAll(".note-editor").data([0]);
+ editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
+ var footer = selection2.selectAll(".footer").data([0]);
+ footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
+ var osm = services.osm;
+ if (osm) {
+ osm.on("change.note-save", function() {
+ selection2.call(noteEditor);
+ });
+ }
+ }
+ function noteSaveSection(selection2) {
+ var isSelected = _note && _note.id === context.selectedNoteID();
+ var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d) {
+ return d.status + d.id;
+ });
+ noteSave.exit().remove();
+ var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
+ noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
+ return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
+ });
+ var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d) {
+ return d.newComment;
+ }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
+ if (!commentTextarea.empty() && _newNote) {
+ commentTextarea.node().focus();
+ }
+ noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
+ function keydown(d3_event) {
+ if (!(d3_event.keyCode === 13 && d3_event.metaKey))
+ return;
+ var osm = services.osm;
+ if (!osm)
+ return;
+ var hasAuth = osm.authenticated();
+ if (!hasAuth)
+ return;
+ if (!_note.newComment)
+ return;
+ d3_event.preventDefault();
+ select_default2(this).on("keydown.note-input", null);
+ window.setTimeout(function() {
+ if (_note.isNew()) {
+ noteSave.selectAll(".save-button").node().focus();
+ clickSave(_note);
+ } else {
+ noteSave.selectAll(".comment-button").node().focus();
+ clickComment(_note);
+ }
+ }, 10);
+ }
+ function changeInput() {
+ var input = select_default2(this);
+ var val = input.property("value").trim() || void 0;
+ _note = _note.update({ newComment: val });
+ var osm = services.osm;
+ if (osm) {
+ osm.replaceNote(_note);
+ }
+ noteSave.call(noteSaveButtons);
+ }
+ }
+ function userDetails(selection2) {
+ var detailSection = selection2.selectAll(".detail-section").data([0]);
+ detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
+ var osm = services.osm;
+ if (!osm)
+ return;
+ var hasAuth = osm.authenticated();
+ var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
+ authWarning.exit().transition().duration(200).style("opacity", 0).remove();
+ var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
+ authEnter.call(svgIcon("#iD-icon-alert", "inline"));
+ authEnter.append("span").call(_t.append("note.login"));
+ authEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.note-login", function(d3_event) {
+ d3_event.preventDefault();
+ osm.authenticate();
+ });
+ authEnter.transition().duration(200).style("opacity", 1);
+ var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
+ prose.exit().remove();
+ prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
+ osm.userDetails(function(err, user) {
+ if (err)
+ return;
+ var userLink = select_default2(document.createElement("div"));
+ if (user.image_url) {
+ userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
+ }
+ userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
+ prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
+ });
+ }
+ function noteSaveButtons(selection2) {
+ var osm = services.osm;
+ var hasAuth = osm && osm.authenticated();
+ var isSelected = _note && _note.id === context.selectedNoteID();
+ var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d) {
+ return d.status + d.id;
+ });
+ buttonSection.exit().remove();
+ var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
+ if (_note.isNew()) {
+ buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
+ buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
+ } else {
+ buttonEnter.append("button").attr("class", "button status-button action");
+ buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
+ }
+ buttonSection = buttonSection.merge(buttonEnter);
+ buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
+ buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
+ buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d) {
+ var action = d.status === "open" ? "close" : "open";
+ var andComment = d.newComment ? "_comment" : "";
+ return _t.html("note." + action + andComment);
+ }).on("click.status", clickStatus);
+ buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
+ function isSaveDisabled(d) {
+ return hasAuth && d.status === "open" && d.newComment ? null : true;
+ }
}
-
- return function(selection) {
- var buttons = selection.selectAll('button.add-button')
- .data(modes);
-
- buttons.enter().append('button')
- .attr('tabindex', -1)
- .attr('class', function(mode) { return mode.id + ' add-button col4'; })
- .on('click.mode-buttons', function(mode) {
- if (mode.id === context.mode().id) {
- context.enter(iD.modes.Browse(context));
- } else {
- context.enter(mode);
- }
- })
- .call(bootstrap.tooltip()
- .placement('bottom')
- .html(true)
- .title(function(mode) {
- return iD.ui.tooltipHtml(mode.description, mode.key);
- }));
-
- context.map()
- .on('move.modes', _.debounce(update, 500));
-
- context
- .on('enter.modes', update);
-
- buttons.each(function(d) {
- d3.select(this)
- .call(iD.svg.Icon('#icon-' + d.button, 'pre-text'));
+ function clickCancel(d3_event, d) {
+ this.blur();
+ var osm = services.osm;
+ if (osm) {
+ osm.removeNote(d);
+ }
+ context.enter(modeBrowse(context));
+ dispatch10.call("change");
+ }
+ function clickSave(d3_event, d) {
+ this.blur();
+ var osm = services.osm;
+ if (osm) {
+ osm.postNoteCreate(d, function(err, note) {
+ dispatch10.call("change", note);
});
-
- buttons.append('span')
- .attr('class', 'label')
- .text(function(mode) { return mode.title; });
-
- context.on('enter.editor', function(entered) {
- buttons.classed('active', function(mode) { return entered.button === mode.button; });
- context.container()
- .classed('mode-' + entered.id, true);
+ }
+ }
+ function clickStatus(d3_event, d) {
+ this.blur();
+ var osm = services.osm;
+ if (osm) {
+ var setStatus = d.status === "open" ? "closed" : "open";
+ osm.postNoteUpdate(d, setStatus, function(err, note) {
+ dispatch10.call("change", note);
});
-
- context.on('exit.editor', function(exited) {
- context.container()
- .classed('mode-' + exited.id, false);
+ }
+ }
+ function clickComment(d3_event, d) {
+ this.blur();
+ var osm = services.osm;
+ if (osm) {
+ osm.postNoteUpdate(d, d.status, function(err, note) {
+ dispatch10.call("change", note);
});
+ }
+ }
+ noteEditor.note = function(val) {
+ if (!arguments.length)
+ return _note;
+ _note = val;
+ return noteEditor;
+ };
+ noteEditor.newNote = function(val) {
+ if (!arguments.length)
+ return _newNote;
+ _newNote = val;
+ return noteEditor;
+ };
+ return utilRebind(noteEditor, dispatch10, "on");
+ }
- var keybinding = d3.keybinding('mode-buttons');
+ // modules/ui/source_switch.js
+ function uiSourceSwitch(context) {
+ var keys;
+ function click(d3_event) {
+ d3_event.preventDefault();
+ var osm = context.connection();
+ if (!osm)
+ return;
+ if (context.inIntro())
+ return;
+ if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
+ return;
+ var isLive = select_default2(this).classed("live");
+ isLive = !isLive;
+ context.enter(modeBrowse(context));
+ context.history().clearSaved();
+ context.flush();
+ select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
+ osm.switch(isLive ? keys[0] : keys[1]);
+ }
+ var sourceSwitch = function(selection2) {
+ selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
+ };
+ sourceSwitch.keys = function(_) {
+ if (!arguments.length)
+ return keys;
+ keys = _;
+ return sourceSwitch;
+ };
+ return sourceSwitch;
+ }
- modes.forEach(function(m) {
- keybinding.on(m.key, function() { if (editable()) context.enter(m); });
+ // modules/ui/spinner.js
+ function uiSpinner(context) {
+ var osm = context.connection();
+ return function(selection2) {
+ var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
+ if (osm) {
+ osm.on("loading.spinner", function() {
+ img.transition().style("opacity", 1);
+ }).on("loaded.spinner", function() {
+ img.transition().style("opacity", 0);
});
-
- d3.select(document)
- .call(keybinding);
-
- function update() {
- buttons.property('disabled', !editable());
- }
+ }
};
-};
-iD.ui.Notice = function(context) {
- return function(selection) {
- var div = selection.append('div')
- .attr('class', 'notice');
+ }
- var button = div.append('button')
- .attr('class', 'zoom-to notice')
- .on('click', function() { context.map().zoom(context.minEditableZoom()); });
+ // modules/ui/sections/privacy.js
+ function uiSectionPrivacy(context) {
+ let section = uiSection("preferences-third-party", context).label(_t.html("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
+ function renderDisclosureContent(selection2) {
+ selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
+ let thirdPartyIconsEnter = selection2.select(".privacy-options-list").selectAll(".privacy-third-party-icons-item").data([corePreferences("preferences.privacy.thirdpartyicons") || "true"]).enter().append("li").attr("class", "privacy-third-party-icons-item").append("label").call(uiTooltip().title(_t.html("preferences.privacy.third_party_icons.tooltip")).placement("bottom"));
+ thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d) => {
+ d3_event.preventDefault();
+ corePreferences("preferences.privacy.thirdpartyicons", d === "true" ? "false" : "true");
+ });
+ thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
+ selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d) => d === "true").select("input").property("checked", (d) => d === "true");
+ selection2.selectAll(".privacy-link").data([0]).enter().append("div").attr("class", "privacy-link").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/release/PRIVACY.md").append("span").call(_t.append("preferences.privacy.privacy_link"));
+ }
+ corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
+ return section;
+ }
- button
- .call(iD.svg.Icon('#icon-plus', 'pre-text'))
- .append('span')
- .attr('class', 'label')
- .text(t('zoom_in_edit'));
+ // modules/ui/splash.js
+ function uiSplash(context) {
+ return (selection2) => {
+ if (context.history().hasRestorableChanges())
+ return;
+ let updateMessage = "";
+ const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
+ let showSplash = !corePreferences("sawSplash");
+ if (sawPrivacyVersion !== context.privacyVersion) {
+ updateMessage = _t("splash.privacy_update");
+ showSplash = true;
+ }
+ if (!showSplash)
+ return;
+ corePreferences("sawSplash", true);
+ corePreferences("sawPrivacyVersion", context.privacyVersion);
+ _mainFileFetcher.get("intro_graph");
+ let modalSelection = uiModal(selection2);
+ modalSelection.select(".modal").attr("class", "modal-splash modal");
+ let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
+ introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
+ let modalSection = introModal.append("div").attr("class", "modal-section");
+ modalSection.append("p").html(_t.html("splash.text", {
+ version: context.version,
+ website: { html: '' + _t.html("splash.changelog") + "" },
+ github: { html: 'github.com' }
+ }));
+ modalSection.append("p").html(_t.html("splash.privacy", {
+ updateMessage,
+ privacyLink: { html: '' + _t("splash.privacy_policy") + "" }
+ }));
+ uiSectionPrivacy(context).label(_t.html("splash.privacy_settings")).render(modalSection);
+ let buttonWrap = introModal.append("div").attr("class", "modal-actions");
+ let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
+ context.container().call(uiIntro(context));
+ modalSelection.close();
+ });
+ walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
+ walkthrough.append("div").call(_t.append("splash.walkthrough"));
+ let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
+ startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
+ startEditing.append("div").call(_t.append("splash.start"));
+ modalSelection.select("button.close").attr("class", "hide");
+ };
+ }
- function disableTooHigh() {
- div.style('display', context.editable() ? 'none' : 'block');
+ // modules/ui/status.js
+ function uiStatus(context) {
+ var osm = context.connection();
+ return function(selection2) {
+ if (!osm)
+ return;
+ function update(err, apiStatus) {
+ selection2.html("");
+ if (err) {
+ if (apiStatus === "connectionSwitched") {
+ return;
+ } else if (apiStatus === "rateLimited") {
+ selection2.call(_t.append("osm_api_status.message.rateLimit")).append("a").attr("href", "#").attr("class", "api-status-login").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.login", function(d3_event) {
+ d3_event.preventDefault();
+ osm.authenticate();
+ });
+ } else {
+ var throttledRetry = throttle_default(function() {
+ context.loadTiles(context.projection);
+ osm.reloadApiStatus();
+ }, 2e3);
+ selection2.call(_t.append("osm_api_status.message.error", { suffix: " " })).append("a").attr("href", "#").call(_t.append("osm_api_status.retry")).on("click.retry", function(d3_event) {
+ d3_event.preventDefault();
+ throttledRetry();
+ });
+ }
+ } else if (apiStatus === "readonly") {
+ selection2.call(_t.append("osm_api_status.message.readonly"));
+ } else if (apiStatus === "offline") {
+ selection2.call(_t.append("osm_api_status.message.offline"));
}
-
- context.map()
- .on('move.notice', _.debounce(disableTooHigh, 500));
-
- disableTooHigh();
+ selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
+ }
+ osm.on("apiStatusChange.uiStatus", update);
+ context.history().on("storage_error", () => {
+ selection2.selectAll("span.local-storage-full").remove();
+ selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
+ selection2.classed("error", true);
+ });
+ window.setInterval(function() {
+ osm.reloadApiStatus();
+ }, 9e4);
+ osm.reloadApiStatus();
};
-};
-iD.ui.PresetIcon = function() {
- var preset, geometry;
+ }
- function presetIcon(selection) {
- selection.each(render);
- }
+ // node_modules/osm-community-index/lib/simplify.js
+ var import_diacritics3 = __toESM(require_diacritics(), 1);
+ function simplify2(str2) {
+ if (typeof str2 !== "string")
+ return "";
+ return import_diacritics3.default.remove(str2.replace(/&/g, "and").replace(/Ä°/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`â\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u200b-\u200f\u2016\u2017\u2020-\u2027\u2030-\u2038\u203b-\u203e\u2041-\u2043\u2047-\u2051\u2053\u2055-\u205e\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00\u2e01\u2e06-\u2e08\u2e0b\u2e0e-\u2e16\u2e18\u2e19\u2e1b\u2e1e\u2e1f\u2e2a-\u2e2e\u2e30-\u2e39\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase());
+ }
- function render() {
- var selection = d3.select(this),
- p = preset.apply(this, arguments),
- geom = geometry.apply(this, arguments),
- icon = p.icon || (geom === 'line' ? 'other-line' : 'marker-stroked'),
- maki = iD.data.featureIcons.hasOwnProperty(icon + '-24');
-
- if (icon === 'dentist') maki = true; // workaround for dentist icon missing in `maki-sprite.json`
-
- function tag_classes(p) {
- var s = '';
- for (var i in p.tags) {
- s += ' tag-' + i;
- if (p.tags[i] !== '*') {
- s += ' tag-' + i + '-' + p.tags[i];
- }
+ // node_modules/osm-community-index/lib/resolve_strings.js
+ function resolveStrings(item, defaults2, localizerFn) {
+ let itemStrings = Object.assign({}, item.strings);
+ let defaultStrings = Object.assign({}, defaults2[item.type]);
+ const anyToken = new RegExp(/(\{\w+\})/, "gi");
+ if (localizerFn) {
+ if (itemStrings.community) {
+ const communityID = simplify2(itemStrings.community);
+ itemStrings.community = localizerFn(`_communities.${communityID}`);
+ }
+ ["name", "description", "extendedDescription"].forEach((prop) => {
+ if (defaultStrings[prop])
+ defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
+ if (itemStrings[prop])
+ itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
+ });
+ }
+ let replacements = {
+ account: item.account,
+ community: itemStrings.community,
+ signupUrl: itemStrings.signupUrl,
+ url: itemStrings.url
+ };
+ if (!replacements.signupUrl) {
+ replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
+ }
+ if (!replacements.url) {
+ replacements.url = resolve(itemStrings.url || defaultStrings.url);
+ }
+ let resolved = {
+ name: resolve(itemStrings.name || defaultStrings.name),
+ url: resolve(itemStrings.url || defaultStrings.url),
+ signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
+ description: resolve(itemStrings.description || defaultStrings.description),
+ extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
+ };
+ resolved.nameHTML = linkify(resolved.url, resolved.name);
+ resolved.urlHTML = linkify(resolved.url);
+ resolved.signupUrlHTML = linkify(resolved.signupUrl);
+ resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
+ resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
+ return resolved;
+ function resolve(s, addLinks) {
+ if (!s)
+ return void 0;
+ let result = s;
+ for (let key in replacements) {
+ const token = `{${key}}`;
+ const regex = new RegExp(token, "g");
+ if (regex.test(result)) {
+ let replacement = replacements[key];
+ if (!replacement) {
+ throw new Error(`Cannot resolve token: ${token}`);
+ } else {
+ if (addLinks && (key === "signupUrl" || key === "url")) {
+ replacement = linkify(replacement);
}
- return s;
+ result = result.replace(regex, replacement);
+ }
}
+ }
+ const leftovers = result.match(anyToken);
+ if (leftovers) {
+ throw new Error(`Cannot resolve tokens: ${leftovers}`);
+ }
+ if (addLinks && item.type === "reddit") {
+ result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
+ }
+ return result;
+ }
+ function linkify(url, text2) {
+ if (!url)
+ return void 0;
+ text2 = text2 || url;
+ return `${text2}`;
+ }
+ }
- var $fill = selection.selectAll('.preset-icon-fill')
- .data([0]);
-
- $fill.enter().append('div');
-
- $fill.attr('class', function() {
- return 'preset-icon-fill preset-icon-fill-' + geom + tag_classes(p);
+ // modules/ui/success.js
+ var _oci = null;
+ function uiSuccess(context) {
+ const MAXEVENTS = 2;
+ const dispatch10 = dispatch_default("cancel");
+ let _changeset2;
+ let _location;
+ ensureOSMCommunityIndex();
+ function ensureOSMCommunityIndex() {
+ const data = _mainFileFetcher;
+ return Promise.all([
+ data.get("oci_features"),
+ data.get("oci_resources"),
+ data.get("oci_defaults")
+ ]).then((vals) => {
+ if (_oci)
+ return _oci;
+ if (vals[0] && Array.isArray(vals[0].features)) {
+ _mainLocations.mergeCustomGeoJSON(vals[0]);
+ }
+ let ociResources = Object.values(vals[1].resources);
+ if (ociResources.length) {
+ return _mainLocations.mergeLocationSets(ociResources).then(() => {
+ _oci = {
+ resources: ociResources,
+ defaults: vals[2].defaults
+ };
+ return _oci;
+ });
+ } else {
+ _oci = {
+ resources: [],
+ defaults: vals[2].defaults
+ };
+ return _oci;
+ }
+ });
+ }
+ function parseEventDate(when) {
+ if (!when)
+ return;
+ let raw = when.trim();
+ if (!raw)
+ return;
+ if (!/Z$/.test(raw)) {
+ raw += "Z";
+ }
+ const parsed = new Date(raw);
+ return new Date(parsed.toUTCString().substr(0, 25));
+ }
+ function success(selection2) {
+ let header = selection2.append("div").attr("class", "header fillL");
+ header.append("h2").call(_t.append("success.just_edited"));
+ header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch10.call("cancel")).call(svgIcon("#iD-icon-close"));
+ let body = selection2.append("div").attr("class", "body save-success fillL");
+ let summary = body.append("div").attr("class", "save-summary");
+ summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
+ summary.append("p").call(_t.append("success.help_html")).append("a").attr("class", "link-out").attr("target", "_blank").attr("href", _t("success.help_link_url")).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("success.help_link_text"));
+ let osm = context.connection();
+ if (!osm)
+ return;
+ let changesetURL = osm.changesetURL(_changeset2.id);
+ let table = summary.append("table").attr("class", "summary-table");
+ let row = table.append("tr").attr("class", "summary-row");
+ row.append("td").attr("class", "cell-icon summary-icon").append("a").attr("target", "_blank").attr("href", changesetURL).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-logo-osm");
+ let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
+ summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
+ summaryDetail.append("div").html(_t.html("success.changeset_id", {
+ changeset_id: { html: `${_changeset2.id}` }
+ }));
+ ensureOSMCommunityIndex().then((oci) => {
+ const loc = context.map().center();
+ const validLocations = _mainLocations.locationsAt(loc);
+ let communities = [];
+ oci.resources.forEach((resource) => {
+ let area = validLocations[resource.locationSetID];
+ if (!area)
+ return;
+ const localizer = (stringID) => _t.html(`community.${stringID}`);
+ resource.resolved = resolveStrings(resource, oci.defaults, localizer);
+ communities.push({
+ area,
+ order: resource.order || 0,
+ resource
+ });
});
-
- var $frame = selection.selectAll('.preset-icon-frame')
- .data([0]);
-
- $frame.enter()
- .append('div')
- .call(iD.svg.Icon('#preset-icon-frame'));
-
- $frame.attr('class', function() {
- return 'preset-icon-frame ' + (geom === 'area' ? '' : 'hide');
+ communities.sort((a, b) => a.area - b.area || b.order - a.order);
+ body.call(showCommunityLinks, communities.map((c) => c.resource));
+ });
+ }
+ function showCommunityLinks(selection2, resources) {
+ let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
+ communityLinks.append("h3").call(_t.append("success.like_osm"));
+ let table = communityLinks.append("table").attr("class", "community-table");
+ let row = table.selectAll(".community-row").data(resources);
+ let rowEnter = row.enter().append("tr").attr("class", "community-row");
+ rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d) => d.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d) => `#community-${d.type}`);
+ let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
+ communityDetail.each(showCommunityDetails);
+ communityLinks.append("div").attr("class", "community-missing").call(_t.append("success.missing")).append("a").attr("class", "link-out").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmlab/osm-community-index/issues").append("span").call(_t.append("success.tell_us"));
+ }
+ function showCommunityDetails(d) {
+ let selection2 = select_default2(this);
+ let communityID = d.id;
+ selection2.append("div").attr("class", "community-name").html(d.resolved.nameHTML);
+ selection2.append("div").attr("class", "community-description").html(d.resolved.descriptionHTML);
+ if (d.resolved.extendedDescriptionHTML || d.languageCodes && d.languageCodes.length) {
+ selection2.append("div").call(uiDisclosure(context, `community-more-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.more")).content(showMore));
+ }
+ let nextEvents = (d.events || []).map((event) => {
+ event.date = parseEventDate(event.when);
+ return event;
+ }).filter((event) => {
+ const t = event.date.getTime();
+ const now3 = new Date().setHours(0, 0, 0, 0);
+ return !isNaN(t) && t >= now3;
+ }).sort((a, b) => {
+ return a.date < b.date ? -1 : a.date > b.date ? 1 : 0;
+ }).slice(0, MAXEVENTS);
+ if (nextEvents.length) {
+ selection2.append("div").call(uiDisclosure(context, `community-events-${d.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
+ }
+ function showMore(selection3) {
+ let more = selection3.selectAll(".community-more").data([0]);
+ let moreEnter = more.enter().append("div").attr("class", "community-more");
+ if (d.resolved.extendedDescriptionHTML) {
+ moreEnter.append("div").attr("class", "community-extended-description").html(d.resolved.extendedDescriptionHTML);
+ }
+ if (d.languageCodes && d.languageCodes.length) {
+ const languageList = d.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
+ moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
+ }
+ }
+ function showNextEvents(selection3) {
+ let events = selection3.append("div").attr("class", "community-events");
+ let item = events.selectAll(".community-event").data(nextEvents);
+ let itemEnter = item.enter().append("div").attr("class", "community-event");
+ itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d2) => d2.url).text((d2) => {
+ let name2 = d2.name;
+ if (d2.i18n && d2.id) {
+ name2 = _t(`community.${communityID}.events.${d2.id}.name`, { default: name2 });
+ }
+ return name2;
});
-
-
- var $icon = selection.selectAll('.preset-icon')
- .data([0]);
-
- $icon.enter()
- .append('div')
- .attr('class', 'preset-icon')
- .call(iD.svg.Icon(''));
-
- $icon
- .attr('class', 'preset-icon preset-icon-' + (maki ? '32' : (geom === 'area' ? '44' : '60')));
-
- $icon.selectAll('svg')
- .attr('class', function() {
- return 'icon ' + icon + tag_classes(p);
- });
-
- $icon.selectAll('use') // workaround: maki parking-24 broken?
- .attr('href', '#' + icon + (maki ? ( icon === 'parking' ? '-18' : '-24') : ''));
+ itemEnter.append("div").attr("class", "community-event-when").text((d2) => {
+ let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
+ if (d2.date.getHours() || d2.date.getMinutes()) {
+ options2.hour = "numeric";
+ options2.minute = "numeric";
+ }
+ return d2.date.toLocaleString(_mainLocalizer.localeCode(), options2);
+ });
+ itemEnter.append("div").attr("class", "community-event-where").text((d2) => {
+ let where = d2.where;
+ if (d2.i18n && d2.id) {
+ where = _t(`community.${communityID}.events.${d2.id}.where`, { default: where });
+ }
+ return where;
+ });
+ itemEnter.append("div").attr("class", "community-event-description").text((d2) => {
+ let description2 = d2.description;
+ if (d2.i18n && d2.id) {
+ description2 = _t(`community.${communityID}.events.${d2.id}.description`, { default: description2 });
+ }
+ return description2;
+ });
+ }
}
-
- presetIcon.preset = function(_) {
- if (!arguments.length) return preset;
- preset = d3.functor(_);
- return presetIcon;
+ success.changeset = function(val) {
+ if (!arguments.length)
+ return _changeset2;
+ _changeset2 = val;
+ return success;
};
-
- presetIcon.geometry = function(_) {
- if (!arguments.length) return geometry;
- geometry = d3.functor(_);
- return presetIcon;
+ success.location = function(val) {
+ if (!arguments.length)
+ return _location;
+ _location = val;
+ return success;
};
+ return utilRebind(success, dispatch10, "on");
+ }
- return presetIcon;
-};
-iD.ui.preset = function(context) {
- var event = d3.dispatch('change'),
- state,
- fields,
- preset,
- tags,
- id;
-
- function UIField(field, entity, show) {
- field = _.clone(field);
-
- field.input = iD.ui.preset[field.type](field, context)
- .on('change', event.change);
-
- if (field.input.entity) field.input.entity(entity);
-
- field.keys = field.keys || [field.key];
-
- field.show = show;
-
- field.shown = function() {
- return field.id === 'name' || field.show || _.some(field.keys, function(key) { return !!tags[key]; });
- };
-
- field.modified = function() {
- var original = context.graph().base().entities[entity.id];
- return _.some(field.keys, function(key) {
- return original ? tags[key] !== original.tags[key] : tags[key];
- });
- };
-
- field.revert = function() {
- var original = context.graph().base().entities[entity.id],
- t = {};
- field.keys.forEach(function(key) {
- t[key] = original ? original.tags[key] : undefined;
- });
- return t;
- };
-
- field.present = function() {
- return _.some(field.keys, function(key) {
- return tags[key];
- });
- };
-
- field.remove = function() {
- var t = {};
- field.keys.forEach(function(key) {
- t[key] = undefined;
- });
- return t;
- };
-
- return field;
+ // modules/ui/version.js
+ var sawVersion = null;
+ var isNewVersion = false;
+ var isNewUser = false;
+ function uiVersion(context) {
+ var currVersion = context.version;
+ var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
+ if (sawVersion === null && matchedVersion !== null) {
+ if (corePreferences("sawVersion")) {
+ isNewUser = false;
+ isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
+ } else {
+ isNewUser = true;
+ isNewVersion = true;
+ }
+ corePreferences("sawVersion", currVersion);
+ sawVersion = currVersion;
}
+ return function(selection2) {
+ selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
+ if (isNewVersion && !isNewUser) {
+ selection2.append("a").attr("class", "badge").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/release/CHANGELOG.md#whats-new").call(svgIcon("#maki-gift-11")).call(uiTooltip().title(_t.html("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap")));
+ }
+ };
+ }
- function fieldKey(field) {
- return field.id;
+ // modules/ui/zoom.js
+ function uiZoom(context) {
+ var zooms = [{
+ id: "zoom-in",
+ icon: "iD-icon-plus",
+ title: _t.html("zoom.in"),
+ action: zoomIn,
+ disabled: function() {
+ return !context.map().canZoomIn();
+ },
+ disabledTitle: _t.html("zoom.disabled.in"),
+ key: "+"
+ }, {
+ id: "zoom-out",
+ icon: "iD-icon-minus",
+ title: _t.html("zoom.out"),
+ action: zoomOut,
+ disabled: function() {
+ return !context.map().canZoomOut();
+ },
+ disabledTitle: _t.html("zoom.disabled.out"),
+ key: "-"
+ }];
+ function zoomIn(d3_event) {
+ if (d3_event.shiftKey)
+ return;
+ d3_event.preventDefault();
+ context.map().zoomIn();
}
+ function zoomOut(d3_event) {
+ if (d3_event.shiftKey)
+ return;
+ d3_event.preventDefault();
+ context.map().zoomOut();
+ }
+ function zoomInFurther(d3_event) {
+ if (d3_event.shiftKey)
+ return;
+ d3_event.preventDefault();
+ context.map().zoomInFurther();
+ }
+ function zoomOutFurther(d3_event) {
+ if (d3_event.shiftKey)
+ return;
+ d3_event.preventDefault();
+ context.map().zoomOutFurther();
+ }
+ return function(selection2) {
+ var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d) {
+ if (d.disabled()) {
+ return d.disabledTitle;
+ }
+ return d.title;
+ }).keys(function(d) {
+ return [d.key];
+ });
+ var lastPointerUpType;
+ var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d) {
+ return d.id;
+ }).on("pointerup.editor", function(d3_event) {
+ lastPointerUpType = d3_event.pointerType;
+ }).on("click.editor", function(d3_event, d) {
+ if (!d.disabled()) {
+ d.action(d3_event);
+ } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
+ context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass("disabled").label(d.disabledTitle)();
+ }
+ lastPointerUpType = null;
+ }).call(tooltipBehavior);
+ buttons.each(function(d) {
+ select_default2(this).call(svgIcon("#" + d.icon, "light"));
+ });
+ utilKeybinding.plusKeys.forEach(function(key) {
+ context.keybinding().on([key], zoomIn);
+ context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
+ });
+ utilKeybinding.minusKeys.forEach(function(key) {
+ context.keybinding().on([key], zoomOut);
+ context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
+ });
+ function updateButtonStates() {
+ buttons.classed("disabled", function(d) {
+ return d.disabled();
+ }).each(function() {
+ var selection3 = select_default2(this);
+ if (!selection3.select(".tooltip.in").empty()) {
+ selection3.call(tooltipBehavior.updateContent);
+ }
+ });
+ }
+ updateButtonStates();
+ context.map().on("move.uiZoom", updateButtonStates);
+ };
+ }
- function presets(selection) {
- selection.call(iD.ui.Disclosure()
- .title(t('inspector.all_fields'))
- .expanded(context.storage('preset_fields.expanded') !== 'false')
- .on('toggled', toggled)
- .content(content));
-
- function toggled(expanded) {
- context.storage('preset_fields.expanded', expanded);
+ // modules/ui/sections/raw_tag_editor.js
+ function uiSectionRawTagEditor(id2, context) {
+ var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
+ var count = Object.keys(_tags).filter(function(d) {
+ return d;
+ }).length;
+ return _t.html("inspector.title_count", { title: { html: _t.html("inspector.tags") }, count });
+ }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
+ var taginfo = services.taginfo;
+ var dispatch10 = dispatch_default("change");
+ var availableViews = [
+ { id: "list", icon: "#fas-th-list" },
+ { id: "text", icon: "#fas-i-cursor" }
+ ];
+ var _tagView = corePreferences("raw-tag-editor-view") || "list";
+ var _readOnlyTags = [];
+ var _orderedKeys = [];
+ var _showBlank = false;
+ var _pendingChange = null;
+ var _state;
+ var _presets;
+ var _tags;
+ var _entityIDs;
+ var _didInteract = false;
+ function interacted() {
+ _didInteract = true;
+ }
+ function renderDisclosureContent(wrap2) {
+ _orderedKeys = _orderedKeys.filter(function(key) {
+ return _tags[key] !== void 0;
+ });
+ var all = Object.keys(_tags).sort();
+ var missingKeys = utilArrayDifference(all, _orderedKeys);
+ for (var i2 in missingKeys) {
+ _orderedKeys.push(missingKeys[i2]);
+ }
+ var rowData = _orderedKeys.map(function(key, i3) {
+ return { index: i3, key, value: _tags[key] };
+ });
+ if (!rowData.length || _showBlank) {
+ _showBlank = false;
+ rowData.push({ index: rowData.length, key: "", value: "" });
+ }
+ var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
+ options2.exit().remove();
+ var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
+ var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d) {
+ return d.id;
+ }).enter();
+ optionEnter.append("button").attr("class", function(d) {
+ return "raw-tag-option raw-tag-option-" + d.id + (_tagView === d.id ? " selected" : "");
+ }).attr("aria-selected", function(d) {
+ return _tagView === d.id;
+ }).attr("role", "tab").attr("title", function(d) {
+ return _t("icons." + d.id);
+ }).on("click", function(d3_event, d) {
+ _tagView = d.id;
+ corePreferences("raw-tag-editor-view", d.id);
+ wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
+ return datum2 === d;
+ }).attr("aria-selected", function(datum2) {
+ return datum2 === d;
+ });
+ wrap2.selectAll(".tag-text").classed("hide", d.id !== "text").each(setTextareaHeight);
+ wrap2.selectAll(".tag-list, .add-row").classed("hide", d.id !== "list");
+ }).each(function(d) {
+ select_default2(this).call(svgIcon(d.icon));
+ });
+ var textData = rowsToText(rowData);
+ var textarea = wrap2.selectAll(".tag-text").data([0]);
+ textarea = textarea.enter().append("textarea").attr("class", "tag-text" + (_tagView !== "text" ? " hide" : "")).call(utilNoAuto).attr("placeholder", _t("inspector.key_value")).attr("spellcheck", "false").merge(textarea);
+ textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
+ var list = wrap2.selectAll(".tag-list").data([0]);
+ list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
+ var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
+ addRowEnter.append("button").attr("class", "add-tag").attr("aria-label", _t("inspector.add_to_tag")).call(svgIcon("#iD-icon-plus", "light")).call(uiTooltip().title(_t.html("inspector.add_to_tag")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left")).on("click", addTag);
+ addRowEnter.append("div").attr("class", "space-value");
+ addRowEnter.append("div").attr("class", "space-buttons");
+ var items = list.selectAll(".tag-row").data(rowData, function(d) {
+ return d.key;
+ });
+ items.exit().each(unbind).remove();
+ var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
+ var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
+ innerWrap.append("div").attr("class", "key-wrap").append("input").property("type", "text").attr("class", "key").call(utilNoAuto).on("focus", interacted).on("blur", keyChange).on("change", keyChange);
+ innerWrap.append("div").attr("class", "value-wrap").append("input").property("type", "text").attr("class", "value").call(utilNoAuto).on("focus", interacted).on("blur", valueChange).on("change", valueChange).on("keydown.push-more", pushMore);
+ innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
+ items = items.merge(itemsEnter).sort(function(a, b) {
+ return a.index - b.index;
+ });
+ items.each(function(d) {
+ var row = select_default2(this);
+ var key = row.select("input.key");
+ var value = row.select("input.value");
+ if (_entityIDs && taginfo && _state !== "hover") {
+ bindTypeahead(key, value);
+ }
+ var referenceOptions = { key: d.key };
+ if (typeof d.value === "string") {
+ referenceOptions.value = d.value;
+ }
+ var reference = uiTagReference(referenceOptions, context);
+ if (_state === "hover") {
+ reference.showing(false);
+ }
+ row.select(".inner-wrap").call(reference.button);
+ row.call(reference.body);
+ row.select("button.remove");
+ });
+ items.selectAll("input.key").attr("title", function(d) {
+ return d.key;
+ }).call(utilGetSetValue, function(d) {
+ return d.key;
+ }).attr("readonly", function(d) {
+ return isReadOnly(d) || null;
+ });
+ items.selectAll("input.value").attr("title", function(d) {
+ return Array.isArray(d.value) ? d.value.filter(Boolean).join("\n") : d.value;
+ }).classed("mixed", function(d) {
+ return Array.isArray(d.value);
+ }).attr("placeholder", function(d) {
+ return typeof d.value === "string" ? null : _t("inspector.multiple_values");
+ }).call(utilGetSetValue, function(d) {
+ return typeof d.value === "string" ? d.value : "";
+ }).attr("readonly", function(d) {
+ return isReadOnly(d) || null;
+ });
+ items.selectAll("button.remove").on(("PointerEvent" in window ? "pointer" : "mouse") + "down", removeTag);
+ }
+ function isReadOnly(d) {
+ for (var i2 = 0; i2 < _readOnlyTags.length; i2++) {
+ if (d.key.match(_readOnlyTags[i2]) !== null) {
+ return true;
}
+ }
+ return false;
}
-
- function content(selection) {
- if (!fields) {
- var entity = context.entity(id),
- geometry = context.geometry(id);
-
- fields = [UIField(context.presets().field('name'), entity)];
-
- preset.fields.forEach(function(field) {
- if (field.matchGeometry(geometry)) {
- fields.push(UIField(field, entity, true));
- }
- });
-
- if (entity.isHighwayIntersection(context.graph())) {
- fields.push(UIField(context.presets().field('restrictions'), entity, true));
- }
-
- context.presets().universal().forEach(function(field) {
- if (preset.fields.indexOf(field) < 0) {
- fields.push(UIField(field, entity));
- }
- });
+ function setTextareaHeight() {
+ if (_tagView !== "text")
+ return;
+ var selection2 = select_default2(this);
+ var matches = selection2.node().value.match(/\n/g);
+ var lineCount = 2 + Number(matches && matches.length);
+ var lineHeight = 20;
+ selection2.style("height", lineCount * lineHeight + "px");
+ }
+ function stringify3(s) {
+ return JSON.stringify(s).slice(1, -1);
+ }
+ function unstringify(s) {
+ var leading = "";
+ var trailing = "";
+ if (s.length < 1 || s.charAt(0) !== '"') {
+ leading = '"';
+ }
+ if (s.length < 2 || s.charAt(s.length - 1) !== '"' || s.charAt(s.length - 1) === '"' && s.charAt(s.length - 2) === "\\") {
+ trailing = '"';
+ }
+ return JSON.parse(leading + s + trailing);
+ }
+ function rowsToText(rows) {
+ var str2 = rows.filter(function(row) {
+ return row.key && row.key.trim() !== "";
+ }).map(function(row) {
+ var rawVal = row.value;
+ if (typeof rawVal !== "string")
+ rawVal = "*";
+ var val = rawVal ? stringify3(rawVal) : "";
+ return stringify3(row.key) + "=" + val;
+ }).join("\n");
+ if (_state !== "hover" && str2.length) {
+ return str2 + "\n";
+ }
+ return str2;
+ }
+ function textChanged() {
+ var newText = this.value.trim();
+ var newTags = {};
+ newText.split("\n").forEach(function(row) {
+ var m = row.match(/^\s*([^=]+)=(.*)$/);
+ if (m !== null) {
+ var k = context.cleanTagKey(unstringify(m[1].trim()));
+ var v = context.cleanTagValue(unstringify(m[2].trim()));
+ newTags[k] = v;
}
-
- var shown = fields.filter(function(field) { return field.shown(); }),
- notShown = fields.filter(function(field) { return !field.shown(); });
-
- var $form = selection.selectAll('.preset-form')
- .data([0]);
-
- $form.enter().append('div')
- .attr('class', 'preset-form inspector-inner fillL3');
-
- var $fields = $form.selectAll('.form-field')
- .data(shown, fieldKey);
-
- // Enter
-
- var $enter = $fields.enter()
- .append('div')
- .attr('class', function(field) {
- return 'form-field form-field-' + field.id;
- });
-
- var $label = $enter.append('label')
- .attr('class', 'form-label')
- .attr('for', function(field) { return 'preset-input-' + field.id; })
- .text(function(field) { return field.label(); });
-
- var wrap = $label.append('div')
- .attr('class', 'form-label-button-wrap');
-
- wrap.append('button')
- .attr('class', 'remove-icon')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#operation-delete'));
-
- wrap.append('button')
- .attr('class', 'modified-icon')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-undo'));
-
- // Update
-
- $fields.select('.form-label-button-wrap .remove-icon')
- .on('click', remove);
-
- $fields.select('.modified-icon')
- .on('click', revert);
-
- $fields
- .order()
- .classed('modified', function(field) {
- return field.modified();
- })
- .classed('present', function(field) {
- return field.present();
- })
- .each(function(field) {
- var reference = iD.ui.TagReference(field.reference || {key: field.key}, context);
-
- if (state === 'hover') {
- reference.showing(false);
- }
-
- d3.select(this)
- .call(field.input)
- .selectAll('input')
- .on('keydown', function() {
- // if user presses enter, and combobox is not active, accept edits..
- if (d3.event.keyCode === 13 && d3.select('.combobox').empty()) {
- context.enter(iD.modes.Browse(context));
- }
- })
- .call(reference.body)
- .select('.form-label-button-wrap')
- .call(reference.button);
-
- field.input.tags(tags);
- });
-
- $fields.exit()
- .remove();
-
- notShown = notShown.map(function(field) {
+ });
+ var tagDiff = utilTagDiff(_tags, newTags);
+ if (!tagDiff.length)
+ return;
+ _pendingChange = _pendingChange || {};
+ tagDiff.forEach(function(change) {
+ if (isReadOnly({ key: change.key }))
+ return;
+ if (change.newVal === "*" && typeof change.oldVal !== "string")
+ return;
+ if (change.type === "-") {
+ _pendingChange[change.key] = void 0;
+ } else if (change.type === "+") {
+ _pendingChange[change.key] = change.newVal || "";
+ }
+ });
+ if (Object.keys(_pendingChange).length === 0) {
+ _pendingChange = null;
+ return;
+ }
+ scheduleChange();
+ }
+ function pushMore(d3_event) {
+ if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
+ addTag();
+ }
+ }
+ function bindTypeahead(key, value) {
+ if (isReadOnly(key.datum()))
+ return;
+ if (Array.isArray(value.datum().value)) {
+ value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
+ var keyString = utilGetSetValue(key);
+ if (!_tags[keyString])
+ return;
+ var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
return {
- title: field.label(),
- value: field.label(),
- field: field
+ value: tagValue,
+ title: tagValue
};
+ });
+ callback(data);
+ }));
+ return;
+ }
+ var geometry = context.graph().geometry(_entityIDs[0]);
+ key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
+ taginfo.keys({
+ debounce: true,
+ geometry,
+ query: value2
+ }, function(err, data) {
+ if (!err) {
+ var filtered = data.filter(function(d) {
+ return _tags[d.value] === void 0;
+ });
+ callback(sort(value2, filtered));
+ }
});
-
- var $more = selection.selectAll('.more-fields')
- .data((notShown.length > 0) ? [0] : []);
-
- $more.enter().append('div')
- .attr('class', 'more-fields')
- .append('label')
- .text(t('inspector.add_fields'));
-
- var $input = $more.selectAll('.value')
- .data([0]);
-
- $input.enter().append('input')
- .attr('class', 'value')
- .attr('type', 'text');
-
- $input.value('')
- .attr('placeholder', function() {
- var placeholder = [];
- for (var field in notShown) {
- placeholder.push(notShown[field].title);
- }
- return placeholder.slice(0,3).join(', ') + ((placeholder.length > 3) ? 'â¦' : '');
- })
- .call(d3.combobox().data(notShown)
- .minItems(1)
- .on('accept', show));
-
- $more.exit()
- .remove();
-
- $input.exit()
- .remove();
-
- function show(field) {
- field = field.field;
- field.show = true;
- content(selection);
- field.input.focus();
- }
-
- function revert(field) {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- event.change(field.revert());
- }
-
- function remove(field) {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- event.change(field.remove());
+ }));
+ value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
+ taginfo.values({
+ debounce: true,
+ key: utilGetSetValue(key),
+ geometry,
+ query: value2
+ }, function(err, data) {
+ if (!err)
+ callback(sort(value2, data));
+ });
+ }));
+ function sort(value2, data) {
+ var sameletter = [];
+ var other = [];
+ for (var i2 = 0; i2 < data.length; i2++) {
+ if (data[i2].value.substring(0, value2.length) === value2) {
+ sameletter.push(data[i2]);
+ } else {
+ other.push(data[i2]);
+ }
}
+ return sameletter.concat(other);
+ }
}
-
- presets.preset = function(_) {
- if (!arguments.length) return preset;
- if (preset && preset.id === _.id) return presets;
- preset = _;
- fields = null;
- return presets;
- };
-
- presets.state = function(_) {
- if (!arguments.length) return state;
- state = _;
- return presets;
+ function unbind() {
+ var row = select_default2(this);
+ row.selectAll("input.key").call(uiCombobox.off, context);
+ row.selectAll("input.value").call(uiCombobox.off, context);
+ }
+ function keyChange(d3_event, d) {
+ if (select_default2(this).attr("readonly"))
+ return;
+ var kOld = d.key;
+ if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
+ return;
+ var kNew = context.cleanTagKey(this.value.trim());
+ if (isReadOnly({ key: kNew })) {
+ this.value = kOld;
+ return;
+ }
+ if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
+ this.value = kOld;
+ section.selection().selectAll(".tag-list input.value").each(function(d2) {
+ if (d2.key === kNew) {
+ var input = select_default2(this).node();
+ input.focus();
+ input.select();
+ }
+ });
+ return;
+ }
+ _pendingChange = _pendingChange || {};
+ if (kOld) {
+ if (kOld === kNew)
+ return;
+ _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
+ _pendingChange[kOld] = void 0;
+ } else {
+ let row = this.parentNode.parentNode;
+ let inputVal = select_default2(row).selectAll("input.value");
+ let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
+ _pendingChange[kNew] = vNew;
+ utilGetSetValue(inputVal, vNew);
+ }
+ var existingKeyIndex = _orderedKeys.indexOf(kOld);
+ if (existingKeyIndex !== -1)
+ _orderedKeys[existingKeyIndex] = kNew;
+ d.key = kNew;
+ this.value = kNew;
+ scheduleChange();
+ }
+ function valueChange(d3_event, d) {
+ if (isReadOnly(d))
+ return;
+ if (typeof d.value !== "string" && !this.value)
+ return;
+ if (_pendingChange && _pendingChange.hasOwnProperty(d.key) && _pendingChange[d.key] === void 0)
+ return;
+ _pendingChange = _pendingChange || {};
+ _pendingChange[d.key] = context.cleanTagValue(this.value);
+ scheduleChange();
+ }
+ function removeTag(d3_event, d) {
+ if (isReadOnly(d))
+ return;
+ if (d.key === "") {
+ _showBlank = false;
+ section.reRender();
+ } else {
+ _orderedKeys = _orderedKeys.filter(function(key) {
+ return key !== d.key;
+ });
+ _pendingChange = _pendingChange || {};
+ _pendingChange[d.key] = void 0;
+ scheduleChange();
+ }
+ }
+ function addTag() {
+ window.setTimeout(function() {
+ _showBlank = true;
+ section.reRender();
+ section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
+ }, 20);
+ }
+ function scheduleChange() {
+ var entityIDs = _entityIDs;
+ window.setTimeout(function() {
+ if (!_pendingChange)
+ return;
+ dispatch10.call("change", this, entityIDs, _pendingChange);
+ _pendingChange = null;
+ }, 10);
+ }
+ section.state = function(val) {
+ if (!arguments.length)
+ return _state;
+ if (_state !== val) {
+ _orderedKeys = [];
+ _state = val;
+ }
+ return section;
+ };
+ section.presets = function(val) {
+ if (!arguments.length)
+ return _presets;
+ _presets = val;
+ if (_presets && _presets.length && _presets[0].isFallback()) {
+ section.disclosureExpanded(true);
+ } else if (!_didInteract) {
+ section.disclosureExpanded(null);
+ }
+ return section;
+ };
+ section.tags = function(val) {
+ if (!arguments.length)
+ return _tags;
+ _tags = val;
+ return section;
+ };
+ section.entityIDs = function(val) {
+ if (!arguments.length)
+ return _entityIDs;
+ if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
+ _entityIDs = val;
+ _orderedKeys = [];
+ }
+ return section;
};
-
- presets.tags = function(_) {
- if (!arguments.length) return tags;
- tags = _;
- // Don't reset fields here.
- return presets;
+ section.readOnlyTags = function(val) {
+ if (!arguments.length)
+ return _readOnlyTags;
+ _readOnlyTags = val;
+ return section;
};
+ return utilRebind(section, dispatch10, "on");
+ }
- presets.entityID = function(_) {
- if (!arguments.length) return id;
- if (id === _) return presets;
- id = _;
- fields = null;
- return presets;
+ // modules/ui/data_editor.js
+ function uiDataEditor(context) {
+ var dataHeader = uiDataHeader();
+ var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
+ var _datum;
+ function dataEditor(selection2) {
+ var header = selection2.selectAll(".header").data([0]);
+ var headerEnter = header.enter().append("div").attr("class", "header fillL");
+ headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
+ context.enter(modeBrowse(context));
+ }).call(svgIcon("#iD-icon-close"));
+ headerEnter.append("h2").call(_t.append("map_data.title"));
+ var body = selection2.selectAll(".body").data([0]);
+ body = body.enter().append("div").attr("class", "body").merge(body);
+ var editor = body.selectAll(".data-editor").data([0]);
+ editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
+ var rte = body.selectAll(".raw-tag-editor").data([0]);
+ rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
+ }
+ dataEditor.datum = function(val) {
+ if (!arguments.length)
+ return _datum;
+ _datum = val;
+ return this;
};
+ return dataEditor;
+ }
- return d3.rebind(presets, event, 'on');
-};
-iD.ui.PresetList = function(context) {
- var event = d3.dispatch('choose'),
- id,
- currentPreset,
- autofocus = false;
-
- function presetList(selection) {
- var geometry = context.geometry(id),
- presets = context.presets().matchGeometry(geometry);
-
- selection.html('');
-
- var messagewrap = selection.append('div')
- .attr('class', 'header fillL cf');
-
- var message = messagewrap.append('h3')
- .text(t('inspector.choose'));
-
- if (context.entity(id).isUsed(context.graph())) {
- messagewrap.append('button')
- .attr('class', 'preset-choose')
- .on('click', function() { event.choose(currentPreset); })
- .append('span')
- .html('►');
- } else {
- messagewrap.append('button')
- .attr('class', 'close')
- .on('click', function() {
- context.enter(iD.modes.Browse(context));
- })
- .call(iD.svg.Icon('#icon-close'));
- }
-
- function keydown() {
- // hack to let delete shortcut work when search is autofocused
- if (search.property('value').length === 0 &&
- (d3.event.keyCode === d3.keybinding.keyCodes['â«'] ||
- d3.event.keyCode === d3.keybinding.keyCodes['â¦'])) {
- d3.event.preventDefault();
- d3.event.stopPropagation();
- iD.operations.Delete([id], context)();
- } else if (search.property('value').length === 0 &&
- (d3.event.ctrlKey || d3.event.metaKey) &&
- d3.event.keyCode === d3.keybinding.keyCodes.z) {
- d3.event.preventDefault();
- d3.event.stopPropagation();
- context.undo();
- } else if (!d3.event.ctrlKey && !d3.event.metaKey) {
- d3.select(this).on('keydown', null);
- }
- }
-
- function keypress() {
- // enter
- var value = search.property('value');
- if (d3.event.keyCode === 13 && value.length) {
- list.selectAll('.preset-list-item:first-child').datum().choose();
- }
- }
-
- function inputevent() {
- var value = search.property('value');
- list.classed('filtered', value.length);
- if (value.length) {
- var results = presets.search(value, geometry);
- message.text(t('inspector.results', {
- n: results.collection.length,
- search: value
- }));
- list.call(drawList, results);
+ // modules/ui/osmose_details.js
+ function uiOsmoseDetails(context) {
+ let _qaItem;
+ function issueString(d, type3) {
+ if (!d)
+ return "";
+ const s = services.osmose.getStrings(d.itemType);
+ return type3 in s ? s[type3] : "";
+ }
+ function osmoseDetails(selection2) {
+ const details = selection2.selectAll(".error-details").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ details.exit().remove();
+ const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
+ if (issueString(_qaItem, "detail")) {
+ const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ div.append("h4").call(_t.append("QA.keepRight.detail_description"));
+ div.append("p").attr("class", "qa-details-description-text").html((d) => issueString(d, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
+ }
+ const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ if (issueString(_qaItem, "fix")) {
+ const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ div.append("h4").call(_t.append("QA.osmose.fix_title"));
+ div.append("p").html((d) => issueString(d, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
+ }
+ if (issueString(_qaItem, "trap")) {
+ const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
+ div.append("h4").call(_t.append("QA.osmose.trap_title"));
+ div.append("p").html((d) => issueString(d, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
+ }
+ const thisItem = _qaItem;
+ services.osmose.loadIssueDetail(_qaItem).then((d) => {
+ if (!d.elems || d.elems.length === 0)
+ return;
+ if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty())
+ return;
+ if (d.detail) {
+ detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
+ detailsDiv.append("p").html((d2) => d2.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
+ }
+ elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
+ elemsDiv.append("ul").selectAll("li").data(d.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d2) => d2).each(function() {
+ const link2 = select_default2(this);
+ const entityID = this.textContent;
+ const entity = context.hasEntity(entityID);
+ link2.on("mouseenter", () => {
+ utilHighlightEntities([entityID], true, context);
+ }).on("mouseleave", () => {
+ utilHighlightEntities([entityID], false, context);
+ }).on("click", (d3_event) => {
+ d3_event.preventDefault();
+ utilHighlightEntities([entityID], false, context);
+ const osmlayer = context.layers().layer("osm");
+ if (!osmlayer.enabled()) {
+ osmlayer.enabled(true);
+ }
+ context.map().centerZoom(d.loc, 20);
+ if (entity) {
+ context.enter(modeSelect(context, [entityID]));
} else {
- list.call(drawList, context.presets().defaults(geometry, 36));
- message.text(t('inspector.choose'));
+ context.loadEntity(entityID, (err, result) => {
+ if (err)
+ return;
+ const entity2 = result.data.find((e) => e.id === entityID);
+ if (entity2)
+ context.enter(modeSelect(context, [entityID]));
+ });
}
- }
-
- var searchWrap = selection.append('div')
- .attr('class', 'search-header');
-
- var search = searchWrap.append('input')
- .attr('class', 'preset-search-input')
- .attr('placeholder', t('inspector.search'))
- .attr('type', 'search')
- .on('keydown', keydown)
- .on('keypress', keypress)
- .on('input', inputevent);
-
- searchWrap
- .call(iD.svg.Icon('#icon-search', 'pre-text'));
-
- if (autofocus) {
- search.node().focus();
- }
-
- var listWrap = selection.append('div')
- .attr('class', 'inspector-body');
-
- var list = listWrap.append('div')
- .attr('class', 'preset-list fillL cf')
- .call(drawList, context.presets().defaults(geometry, 36));
- }
-
- function drawList(list, presets) {
- var collection = presets.collection.map(function(preset) {
- return preset.members ? CategoryItem(preset) : PresetItem(preset);
+ });
+ if (entity) {
+ let name2 = utilDisplayName(entity);
+ if (!name2) {
+ const preset = _mainPresetIndex.match(entity, context.graph());
+ name2 = preset && !preset.isFallback() && preset.name();
+ }
+ if (name2) {
+ this.innerText = name2;
+ }
+ }
});
-
- var items = list.selectAll('.preset-list-item')
- .data(collection, function(d) { return d.preset.id; });
-
- items.enter().append('div')
- .attr('class', function(item) { return 'preset-list-item preset-' + item.preset.id.replace('/', '-'); })
- .classed('current', function(item) { return item.preset === currentPreset; })
- .each(function(item) {
- d3.select(this).call(item);
- })
- .style('opacity', 0)
- .transition()
- .style('opacity', 1);
-
- items.order();
-
- items.exit()
- .remove();
+ context.features().forceVisible(d.elems);
+ context.map().pan([0, 0]);
+ }).catch((err) => {
+ console.log(err);
+ });
}
+ osmoseDetails.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return osmoseDetails;
+ };
+ return osmoseDetails;
+ }
- function CategoryItem(preset) {
- var box, sublist, shown = false;
-
- function item(selection) {
- var wrap = selection.append('div')
- .attr('class', 'preset-list-button-wrap category col12');
-
- wrap.append('button')
- .attr('class', 'preset-list-button')
- .classed('expanded', false)
- .call(iD.ui.PresetIcon()
- .geometry(context.geometry(id))
- .preset(preset))
- .on('click', function() {
- var isExpanded = d3.select(this).classed('expanded');
- var triangle = isExpanded ? 'ⶠ' : '⼠';
- d3.select(this).classed('expanded', !isExpanded);
- d3.select(this).selectAll('.label').text(triangle + preset.name());
- item.choose();
- })
- .append('div')
- .attr('class', 'label')
- .text(function() {
- return 'ⶠ' + preset.name();
- });
-
- box = selection.append('div')
- .attr('class', 'subgrid col12')
- .style('max-height', '0px')
- .style('opacity', 0);
+ // modules/ui/osmose_header.js
+ function uiOsmoseHeader() {
+ let _qaItem;
+ function issueTitle(d) {
+ const unknown = _t("inspector.unknown");
+ if (!d)
+ return unknown;
+ const s = services.osmose.getStrings(d.itemType);
+ return "title" in s ? s.title : unknown;
+ }
+ function osmoseHeader(selection2) {
+ const header = selection2.selectAll(".qa-header").data(_qaItem ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ header.exit().remove();
+ const headerEnter = header.enter().append("div").attr("class", "qa-header");
+ const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d) => d.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d) => `preset-icon-28 qaItem ${d.service} itemId-${d.id} itemType-${d.itemType}`);
+ svgEnter.append("polygon").attr("fill", (d) => services.osmose.getColor(d.item)).attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
+ svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d) => d.icon ? "#" + d.icon : "");
+ headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
+ }
+ osmoseHeader.issue = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return osmoseHeader;
+ };
+ return osmoseHeader;
+ }
- box.append('div')
- .attr('class', 'arrow');
+ // modules/ui/view_on_osmose.js
+ function uiViewOnOsmose() {
+ let _qaItem;
+ function viewOnOsmose(selection2) {
+ let url;
+ if (services.osmose && _qaItem instanceof QAItem) {
+ url = services.osmose.itemURL(_qaItem);
+ }
+ const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
+ link2.exit().remove();
+ const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d) => d).call(svgIcon("#iD-icon-out-link", "inline"));
+ linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
+ }
+ viewOnOsmose.what = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return viewOnOsmose;
+ };
+ return viewOnOsmose;
+ }
- sublist = box.append('div')
- .attr('class', 'preset-list fillL3 cf fl');
+ // modules/ui/osmose_editor.js
+ function uiOsmoseEditor(context) {
+ const dispatch10 = dispatch_default("change");
+ const qaDetails = uiOsmoseDetails(context);
+ const qaHeader = uiOsmoseHeader(context);
+ let _qaItem;
+ function osmoseEditor(selection2) {
+ const header = selection2.selectAll(".header").data([0]);
+ const headerEnter = header.enter().append("div").attr("class", "header fillL");
+ headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
+ headerEnter.append("h2").call(_t.append("QA.osmose.title"));
+ let body = selection2.selectAll(".body").data([0]);
+ body = body.enter().append("div").attr("class", "body").merge(body);
+ let editor = body.selectAll(".qa-editor").data([0]);
+ editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
+ const footer = selection2.selectAll(".footer").data([0]);
+ footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
+ }
+ function osmoseSaveSection(selection2) {
+ const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
+ const isShown = _qaItem && isSelected;
+ let saveSection = selection2.selectAll(".qa-save").data(isShown ? [_qaItem] : [], (d) => `${d.id}-${d.status || 0}`);
+ saveSection.exit().remove();
+ const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
+ saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
+ }
+ function qaSaveButtons(selection2) {
+ const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
+ let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d) => d.status + d.id);
+ buttonSection.exit().remove();
+ const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
+ buttonEnter.append("button").attr("class", "button close-button action");
+ buttonEnter.append("button").attr("class", "button ignore-button action");
+ buttonSection = buttonSection.merge(buttonEnter);
+ buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d) {
+ this.blur();
+ const qaService = services.osmose;
+ if (qaService) {
+ d.newStatus = "done";
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
}
-
- item.choose = function() {
- if (!box || !sublist) return;
-
- if (shown) {
- shown = false;
- box.transition()
- .duration(200)
- .style('opacity', '0')
- .style('max-height', '0px')
- .style('padding-bottom', '0px');
- } else {
- shown = true;
- sublist.call(drawList, preset.members);
- box.transition()
- .duration(200)
- .style('opacity', '1')
- .style('max-height', 200 + preset.members.collection.length * 80 + 'px')
- .style('padding-bottom', '20px');
- }
- };
-
- item.preset = preset;
-
- return item;
- }
-
- function PresetItem(preset) {
- function item(selection) {
- var wrap = selection.append('div')
- .attr('class', 'preset-list-button-wrap col12');
-
- wrap.append('button')
- .attr('class', 'preset-list-button')
- .call(iD.ui.PresetIcon()
- .geometry(context.geometry(id))
- .preset(preset))
- .on('click', item.choose)
- .append('div')
- .attr('class', 'label')
- .text(preset.name());
-
- wrap.call(item.reference.button);
- selection.call(item.reference.body);
+ });
+ buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d) {
+ this.blur();
+ const qaService = services.osmose;
+ if (qaService) {
+ d.newStatus = "false";
+ qaService.postUpdate(d, (err, item) => dispatch10.call("change", item));
}
-
- item.choose = function() {
- context.presets().choose(preset);
-
- context.perform(
- iD.actions.ChangePreset(id, currentPreset, preset),
- t('operations.change_tags.annotation'));
-
- event.choose(preset);
- };
-
- item.help = function() {
- d3.event.stopPropagation();
- item.reference.toggle();
- };
-
- item.preset = preset;
- item.reference = iD.ui.TagReference(preset.reference(context.geometry(id)), context);
-
- return item;
+ });
}
-
- presetList.autofocus = function(_) {
- if (!arguments.length) return autofocus;
- autofocus = _;
- return presetList;
- };
-
- presetList.entityID = function(_) {
- if (!arguments.length) return id;
- id = _;
- presetList.preset(context.presets().match(context.entity(id), context.graph()));
- return presetList;
- };
-
- presetList.preset = function(_) {
- if (!arguments.length) return currentPreset;
- currentPreset = _;
- return presetList;
+ osmoseEditor.error = function(val) {
+ if (!arguments.length)
+ return _qaItem;
+ _qaItem = val;
+ return osmoseEditor;
};
+ return utilRebind(osmoseEditor, dispatch10, "on");
+ }
- return d3.rebind(presetList, event, 'on');
-};
-iD.ui.RadialMenu = function(context, operations) {
- var menu,
- center = [0, 0],
- tooltip;
-
- var radialMenu = function(selection) {
- if (!operations.length)
+ // modules/ui/sidebar.js
+ function uiSidebar(context) {
+ var inspector = uiInspector(context);
+ var dataEditor = uiDataEditor(context);
+ var noteEditor = uiNoteEditor(context);
+ var improveOsmEditor = uiImproveOsmEditor(context);
+ var keepRightEditor = uiKeepRightEditor(context);
+ var osmoseEditor = uiOsmoseEditor(context);
+ var _current;
+ var _wasData = false;
+ var _wasNote = false;
+ var _wasQaItem = false;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function sidebar(selection2) {
+ var container = context.container();
+ var minWidth = 240;
+ var sidebarWidth;
+ var containerWidth;
+ var dragOffset;
+ selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
+ var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
+ var downPointerId, lastClientX, containerLocGetter;
+ function pointerdown(d3_event) {
+ if (downPointerId)
+ return;
+ if ("button" in d3_event && d3_event.button !== 0)
+ return;
+ downPointerId = d3_event.pointerId || "mouse";
+ lastClientX = d3_event.clientX;
+ containerLocGetter = utilFastMouse(container.node());
+ dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
+ sidebarWidth = selection2.node().getBoundingClientRect().width;
+ containerWidth = container.node().getBoundingClientRect().width;
+ var widthPct = sidebarWidth / containerWidth * 100;
+ selection2.style("width", widthPct + "%").style("max-width", "85%");
+ resizer.classed("dragging", true);
+ select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
+ d3_event2.preventDefault();
+ }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
+ }
+ function pointermove(d3_event) {
+ if (downPointerId !== (d3_event.pointerId || "mouse"))
+ return;
+ d3_event.preventDefault();
+ var dx = d3_event.clientX - lastClientX;
+ lastClientX = d3_event.clientX;
+ var isRTL = _mainLocalizer.textDirection() === "rtl";
+ var scaleX = isRTL ? 0 : 1;
+ var xMarginProperty = isRTL ? "margin-right" : "margin-left";
+ var x = containerLocGetter(d3_event)[0] - dragOffset;
+ sidebarWidth = isRTL ? containerWidth - x : x;
+ var isCollapsed = selection2.classed("collapsed");
+ var shouldCollapse = sidebarWidth < minWidth;
+ selection2.classed("collapsed", shouldCollapse);
+ if (shouldCollapse) {
+ if (!isCollapsed) {
+ selection2.style(xMarginProperty, "-400px").style("width", "400px");
+ context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
+ }
+ } else {
+ var widthPct = sidebarWidth / containerWidth * 100;
+ selection2.style(xMarginProperty, null).style("width", widthPct + "%");
+ if (isCollapsed) {
+ context.ui().onResize([-sidebarWidth * scaleX, 0]);
+ } else {
+ context.ui().onResize([-dx * scaleX, 0]);
+ }
+ }
+ }
+ function pointerup(d3_event) {
+ if (downPointerId !== (d3_event.pointerId || "mouse"))
+ return;
+ downPointerId = null;
+ resizer.classed("dragging", false);
+ select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
+ }
+ var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
+ var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
+ var hoverModeSelect = function(targets) {
+ context.container().selectAll(".feature-list-item button").classed("hover", false);
+ if (context.selectedIDs().length > 1 && targets && targets.length) {
+ var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
+ return targets.indexOf(node) !== -1;
+ });
+ if (!elements.empty()) {
+ elements.classed("hover", true);
+ }
+ }
+ };
+ sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
+ function hover(targets) {
+ var datum2 = targets && targets.length && targets[0];
+ if (datum2 && datum2.__featurehash__) {
+ _wasData = true;
+ sidebar.show(dataEditor.datum(datum2));
+ selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
+ } else if (datum2 instanceof osmNote) {
+ if (context.mode().id === "drag-note")
return;
-
- selection.node().parentNode.focus();
-
- function click(operation) {
- d3.event.stopPropagation();
- if (operation.disabled())
- return;
- operation();
- radialMenu.close();
- }
-
- menu = selection.append('g')
- .attr('class', 'radial-menu')
- .attr('transform', 'translate(' + center + ')')
- .attr('opacity', 0);
-
- menu.transition()
- .attr('opacity', 1);
-
- var r = 50,
- a = Math.PI / 4,
- a0 = -Math.PI / 4,
- a1 = a0 + (operations.length - 1) * a;
-
- menu.append('path')
- .attr('class', 'radial-menu-background')
- .attr('d', 'M' + r * Math.sin(a0) + ',' +
- r * Math.cos(a0) +
- ' A' + r + ',' + r + ' 0 ' + (operations.length > 5 ? '1' : '0') + ',0 ' +
- (r * Math.sin(a1) + 1e-3) + ',' +
- (r * Math.cos(a1) + 1e-3)) // Force positive-length path (#1305)
- .attr('stroke-width', 50)
- .attr('stroke-linecap', 'round');
-
- var button = menu.selectAll()
- .data(operations)
- .enter()
- .append('g')
- .attr('class', function(d) { return 'radial-menu-item radial-menu-item-' + d.id; })
- .classed('disabled', function(d) { return d.disabled(); })
- .attr('transform', function(d, i) {
- return 'translate(' + iD.geo.roundCoords([
- r * Math.sin(a0 + i * a),
- r * Math.cos(a0 + i * a)]).join(',') + ')';
- });
-
- button.append('circle')
- .attr('r', 15)
- .on('click', click)
- .on('mousedown', mousedown)
- .on('mouseover', mouseover)
- .on('mouseout', mouseout);
-
- button.append('use')
- .attr('transform', 'translate(-10,-10)')
- .attr('width', '20')
- .attr('height', '20')
- .attr('xlink:href', function(d) { return '#operation-' + d.id; });
-
- tooltip = d3.select(document.body)
- .append('div')
- .attr('class', 'tooltip-inner radial-menu-tooltip');
-
- function mousedown() {
- d3.event.stopPropagation(); // https://github.com/openstreetmap/iD/issues/1869
- }
-
- function mouseover(d, i) {
- var rect = context.surfaceRect(),
- angle = a0 + i * a,
- top = rect.top + (r + 25) * Math.cos(angle) + center[1] + 'px',
- left = rect.left + (r + 25) * Math.sin(angle) + center[0] + 'px',
- bottom = rect.height - (r + 25) * Math.cos(angle) - center[1] + 'px',
- right = rect.width - (r + 25) * Math.sin(angle) - center[0] + 'px';
-
- tooltip
- .style('top', null)
- .style('left', null)
- .style('bottom', null)
- .style('right', null)
- .style('display', 'block')
- .html(iD.ui.tooltipHtml(d.tooltip(), d.keys[0]));
-
- if (i === 0) {
- tooltip
- .style('right', right)
- .style('top', top);
- } else if (i >= 4) {
- tooltip
- .style('left', left)
- .style('bottom', bottom);
- } else {
- tooltip
- .style('left', left)
- .style('top', top);
- }
+ _wasNote = true;
+ var osm = services.osm;
+ if (osm) {
+ datum2 = osm.getNote(datum2.id);
+ }
+ sidebar.show(noteEditor.note(datum2));
+ selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
+ } else if (datum2 instanceof QAItem) {
+ _wasQaItem = true;
+ var errService = services[datum2.service];
+ if (errService) {
+ datum2 = errService.getError(datum2.id);
+ }
+ var errEditor;
+ if (datum2.service === "keepRight") {
+ errEditor = keepRightEditor;
+ } else if (datum2.service === "osmose") {
+ errEditor = osmoseEditor;
+ } else {
+ errEditor = improveOsmEditor;
+ }
+ context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d) {
+ return d.id === datum2.id;
+ });
+ sidebar.show(errEditor.error(datum2));
+ selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
+ } else if (!_current && datum2 instanceof osmEntity) {
+ featureListWrap.classed("inspector-hidden", true);
+ inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
+ if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
+ inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
+ inspectorWrap.call(inspector);
+ }
+ } else if (!_current) {
+ featureListWrap.classed("inspector-hidden", false);
+ inspectorWrap.classed("inspector-hidden", true);
+ inspector.state("hide");
+ } else if (_wasData || _wasNote || _wasQaItem) {
+ _wasNote = false;
+ _wasData = false;
+ _wasQaItem = false;
+ context.container().selectAll(".note").classed("hover", false);
+ context.container().selectAll(".qaItem").classed("hover", false);
+ sidebar.hide();
}
-
- function mouseout() {
- tooltip.style('display', 'none');
+ }
+ sidebar.hover = throttle_default(hover, 200);
+ sidebar.intersects = function(extent) {
+ var rect = selection2.node().getBoundingClientRect();
+ return extent.intersects([
+ context.projection.invert([0, rect.height]),
+ context.projection.invert([rect.width, 0])
+ ]);
+ };
+ sidebar.select = function(ids, newFeature) {
+ sidebar.hide();
+ if (ids && ids.length) {
+ var entity = ids.length === 1 && context.entity(ids[0]);
+ if (entity && newFeature && selection2.classed("collapsed")) {
+ var extent = entity.extent(context.graph());
+ sidebar.expand(sidebar.intersects(extent));
+ }
+ featureListWrap.classed("inspector-hidden", true);
+ inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
+ inspector.state("select").entityIDs(ids).newFeature(newFeature);
+ inspectorWrap.call(inspector);
+ } else {
+ inspector.state("hide");
}
- };
-
- radialMenu.close = function() {
- if (menu) {
- menu
- .style('pointer-events', 'none')
- .transition()
- .attr('opacity', 0)
- .remove();
+ };
+ sidebar.showPresetList = function() {
+ inspector.showList();
+ };
+ sidebar.show = function(component, element) {
+ featureListWrap.classed("inspector-hidden", true);
+ inspectorWrap.classed("inspector-hidden", true);
+ if (_current)
+ _current.remove();
+ _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
+ };
+ sidebar.hide = function() {
+ featureListWrap.classed("inspector-hidden", false);
+ inspectorWrap.classed("inspector-hidden", true);
+ if (_current)
+ _current.remove();
+ _current = null;
+ };
+ sidebar.expand = function(moveMap) {
+ if (selection2.classed("collapsed")) {
+ sidebar.toggle(moveMap);
}
-
- if (tooltip) {
- tooltip.remove();
+ };
+ sidebar.collapse = function(moveMap) {
+ if (!selection2.classed("collapsed")) {
+ sidebar.toggle(moveMap);
+ }
+ };
+ sidebar.toggle = function(moveMap) {
+ if (context.inIntro())
+ return;
+ var isCollapsed = selection2.classed("collapsed");
+ var isCollapsing = !isCollapsed;
+ var isRTL = _mainLocalizer.textDirection() === "rtl";
+ var scaleX = isRTL ? 0 : 1;
+ var xMarginProperty = isRTL ? "margin-right" : "margin-left";
+ sidebarWidth = selection2.node().getBoundingClientRect().width;
+ selection2.style("width", sidebarWidth + "px");
+ var startMargin, endMargin, lastMargin;
+ if (isCollapsing) {
+ startMargin = lastMargin = 0;
+ endMargin = -sidebarWidth;
+ } else {
+ startMargin = lastMargin = -sidebarWidth;
+ endMargin = 0;
+ }
+ if (!isCollapsing) {
+ selection2.classed("collapsed", isCollapsing);
+ }
+ selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
+ var i2 = number_default(startMargin, endMargin);
+ return function(t) {
+ var dx = lastMargin - Math.round(i2(t));
+ lastMargin = lastMargin - dx;
+ context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
+ };
+ }).on("end", function() {
+ if (isCollapsing) {
+ selection2.classed("collapsed", isCollapsing);
+ }
+ if (!isCollapsing) {
+ var containerWidth2 = container.node().getBoundingClientRect().width;
+ var widthPct = sidebarWidth / containerWidth2 * 100;
+ selection2.style(xMarginProperty, null).style("width", widthPct + "%");
+ }
+ });
+ };
+ resizer.on("dblclick", function(d3_event) {
+ d3_event.preventDefault();
+ if (d3_event.sourceEvent) {
+ d3_event.sourceEvent.preventDefault();
+ }
+ sidebar.toggle();
+ });
+ context.map().on("crossEditableZoom.sidebar", function(within) {
+ if (!within && !selection2.select(".inspector-hover").empty()) {
+ hover([]);
}
+ });
+ }
+ sidebar.showPresetList = function() {
};
-
- radialMenu.center = function(_) {
- if (!arguments.length) return center;
- center = _;
- return radialMenu;
+ sidebar.hover = function() {
+ };
+ sidebar.hover.cancel = function() {
};
+ sidebar.intersects = function() {
+ };
+ sidebar.select = function() {
+ };
+ sidebar.show = function() {
+ };
+ sidebar.hide = function() {
+ };
+ sidebar.expand = function() {
+ };
+ sidebar.collapse = function() {
+ };
+ sidebar.toggle = function() {
+ };
+ return sidebar;
+ }
- return radialMenu;
-};
-iD.ui.RawMemberEditor = function(context) {
- var id;
+ // modules/modes/draw_area.js
+ function modeDrawArea(context, wayID, startGraph, button) {
+ var mode = {
+ button,
+ id: "draw-area"
+ };
+ var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
+ context.ui().flash.iconName("#iD-icon-no").label(_t.html("self_intersection.error.areas"))();
+ });
+ mode.wayID = wayID;
+ mode.enter = function() {
+ context.install(behavior);
+ };
+ mode.exit = function() {
+ context.uninstall(behavior);
+ };
+ mode.selectedIDs = function() {
+ return [wayID];
+ };
+ mode.activeID = function() {
+ return behavior && behavior.activeID() || [];
+ };
+ return mode;
+ }
- function selectMember(d) {
- d3.event.preventDefault();
- context.enter(iD.modes.Select(context, [d.id]));
+ // modules/modes/add_area.js
+ function modeAddArea(context, mode) {
+ mode.id = "add-area";
+ var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
+ var defaultTags = { area: "yes" };
+ if (mode.preset)
+ defaultTags = mode.preset.setTags(defaultTags, "area");
+ function actionClose(wayId) {
+ return function(graph) {
+ return graph.replace(graph.entity(wayId).close());
+ };
}
-
- function changeRole(d) {
- var role = d3.select(this).property('value');
- var member = {id: d.id, type: d.type, role: role};
- context.perform(
- iD.actions.ChangeMember(d.relation.id, member, d.index),
- t('operations.change_role.annotation'));
+ function start2(loc) {
+ var startGraph = context.graph();
+ var node = osmNode({ loc });
+ var way = osmWay({ tags: defaultTags });
+ context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id));
+ context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
}
-
- function deleteMember(d) {
- context.perform(
- iD.actions.DeleteMember(d.relation.id, d.index),
- t('operations.delete_member.annotation'));
-
- if (!context.hasEntity(d.relation.id)) {
- context.enter(iD.modes.Browse(context));
- }
+ function startFromWay(loc, edge) {
+ var startGraph = context.graph();
+ var node = osmNode({ loc });
+ var way = osmWay({ tags: defaultTags });
+ context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id), actionAddMidpoint({ loc, edge }, node));
+ context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
}
+ function startFromNode(node) {
+ var startGraph = context.graph();
+ var way = osmWay({ tags: defaultTags });
+ context.perform(actionAddEntity(way), actionAddVertex(way.id, node.id), actionClose(way.id));
+ context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
+ }
+ mode.enter = function() {
+ context.install(behavior);
+ };
+ mode.exit = function() {
+ context.uninstall(behavior);
+ };
+ return mode;
+ }
- function rawMemberEditor(selection) {
- var entity = context.entity(id),
- memberships = [];
-
- entity.members.forEach(function(member, index) {
- memberships.push({
- index: index,
- id: member.id,
- type: member.type,
- role: member.role,
- relation: entity,
- member: context.hasEntity(member.id)
- });
- });
+ // modules/modes/add_line.js
+ function modeAddLine(context, mode) {
+ mode.id = "add-line";
+ var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
+ var defaultTags = {};
+ if (mode.preset)
+ defaultTags = mode.preset.setTags(defaultTags, "line");
+ function start2(loc) {
+ var startGraph = context.graph();
+ var node = osmNode({ loc });
+ var way = osmWay({ tags: defaultTags });
+ context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id));
+ context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
+ }
+ function startFromWay(loc, edge) {
+ var startGraph = context.graph();
+ var node = osmNode({ loc });
+ var way = osmWay({ tags: defaultTags });
+ context.perform(actionAddEntity(node), actionAddEntity(way), actionAddVertex(way.id, node.id), actionAddMidpoint({ loc, edge }, node));
+ context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
+ }
+ function startFromNode(node) {
+ var startGraph = context.graph();
+ var way = osmWay({ tags: defaultTags });
+ context.perform(actionAddEntity(way), actionAddVertex(way.id, node.id));
+ context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
+ }
+ mode.enter = function() {
+ context.install(behavior);
+ };
+ mode.exit = function() {
+ context.uninstall(behavior);
+ };
+ return mode;
+ }
- selection.call(iD.ui.Disclosure()
- .title(t('inspector.all_members') + ' (' + memberships.length + ')')
- .expanded(true)
- .on('toggled', toggled)
- .content(content));
+ // modules/modes/add_point.js
+ function modeAddPoint(context, mode) {
+ mode.id = "add-point";
+ var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
+ var defaultTags = {};
+ if (mode.preset)
+ defaultTags = mode.preset.setTags(defaultTags, "point");
+ function add(loc) {
+ var node = osmNode({ loc, tags: defaultTags });
+ context.perform(actionAddEntity(node), _t("operations.add.annotation.point"));
+ enterSelectMode(node);
+ }
+ function addWay(loc, edge) {
+ var node = osmNode({ tags: defaultTags });
+ context.perform(actionAddMidpoint({ loc, edge }, node), _t("operations.add.annotation.vertex"));
+ enterSelectMode(node);
+ }
+ function enterSelectMode(node) {
+ context.enter(modeSelect(context, [node.id]).newFeature(true));
+ }
+ function addNode(node) {
+ if (Object.keys(defaultTags).length === 0) {
+ enterSelectMode(node);
+ return;
+ }
+ var tags = Object.assign({}, node.tags);
+ for (var key in defaultTags) {
+ tags[key] = defaultTags[key];
+ }
+ context.perform(actionChangeTags(node.id, tags), _t("operations.add.annotation.point"));
+ enterSelectMode(node);
+ }
+ function cancel() {
+ context.enter(modeBrowse(context));
+ }
+ mode.enter = function() {
+ context.install(behavior);
+ };
+ mode.exit = function() {
+ context.uninstall(behavior);
+ };
+ return mode;
+ }
- function toggled(expanded) {
- if (expanded) {
- selection.node().parentNode.scrollTop += 200;
- }
+ // modules/modes/select_note.js
+ function modeSelectNote(context, selectedNoteID) {
+ var mode = {
+ id: "select-note",
+ button: "browse"
+ };
+ var _keybinding = utilKeybinding("select-note");
+ var _noteEditor = uiNoteEditor(context).on("change", function() {
+ context.map().pan([0, 0]);
+ var note = checkSelectedID();
+ if (!note)
+ return;
+ context.ui().sidebar.show(_noteEditor.note(note));
+ });
+ var _behaviors = [
+ behaviorBreathe(context),
+ behaviorHover(context),
+ behaviorSelect(context),
+ behaviorLasso(context),
+ modeDragNode(context).behavior,
+ modeDragNote(context).behavior
+ ];
+ var _newFeature = false;
+ function checkSelectedID() {
+ if (!services.osm)
+ return;
+ var note = services.osm.getNote(selectedNoteID);
+ if (!note) {
+ context.enter(modeBrowse(context));
+ }
+ return note;
+ }
+ function selectNote(d3_event, drawn) {
+ if (!checkSelectedID())
+ return;
+ var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
+ if (selection2.empty()) {
+ var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
+ if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
+ context.enter(modeBrowse(context));
}
+ } else {
+ selection2.classed("selected", true);
+ context.selectedNoteID(selectedNoteID);
+ }
+ }
+ function esc() {
+ if (context.container().select(".combobox").size())
+ return;
+ context.enter(modeBrowse(context));
+ }
+ mode.zoomToSelected = function() {
+ if (!services.osm)
+ return;
+ var note = services.osm.getNote(selectedNoteID);
+ if (note) {
+ context.map().centerZoomEase(note.loc, 20);
+ }
+ };
+ mode.newFeature = function(val) {
+ if (!arguments.length)
+ return _newFeature;
+ _newFeature = val;
+ return mode;
+ };
+ mode.enter = function() {
+ var note = checkSelectedID();
+ if (!note)
+ return;
+ _behaviors.forEach(context.install);
+ _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
+ select_default2(document).call(_keybinding);
+ selectNote();
+ var sidebar = context.ui().sidebar;
+ sidebar.show(_noteEditor.note(note).newNote(_newFeature));
+ sidebar.expand(sidebar.intersects(note.extent()));
+ context.map().on("drawn.select", selectNote);
+ };
+ mode.exit = function() {
+ _behaviors.forEach(context.uninstall);
+ select_default2(document).call(_keybinding.unbind);
+ context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
+ context.map().on("drawn.select", null);
+ context.ui().sidebar.hide();
+ context.selectedNoteID(null);
+ };
+ return mode;
+ }
- function content($wrap) {
- var $list = $wrap.selectAll('.member-list')
- .data([0]);
-
- $list.enter().append('ul')
- .attr('class', 'member-list');
-
- var $items = $list.selectAll('li')
- .data(memberships, function(d) {
- return iD.Entity.key(d.relation) + ',' + d.index + ',' +
- (d.member ? iD.Entity.key(d.member) : 'incomplete');
- });
-
- var $enter = $items.enter().append('li')
- .attr('class', 'member-row form-field')
- .classed('member-incomplete', function(d) { return !d.member; });
-
- $enter.each(function(d) {
- if (d.member) {
- var $label = d3.select(this).append('label')
- .attr('class', 'form-label')
- .append('a')
- .attr('href', '#')
- .on('click', selectMember);
-
- $label.append('span')
- .attr('class', 'member-entity-type')
- .text(function(d) { return context.presets().match(d.member, context.graph()).name(); });
-
- $label.append('span')
- .attr('class', 'member-entity-name')
- .text(function(d) { return iD.util.displayName(d.member); });
-
- } else {
- d3.select(this).append('label')
- .attr('class', 'form-label')
- .text(t('inspector.incomplete'));
- }
- });
-
- $enter.append('input')
- .attr('class', 'member-role')
- .property('type', 'text')
- .attr('maxlength', 255)
- .attr('placeholder', t('inspector.role'))
- .property('value', function(d) { return d.role; })
- .on('change', changeRole);
-
- $enter.append('button')
- .attr('tabindex', -1)
- .attr('class', 'remove button-input-action member-delete minor')
- .on('click', deleteMember)
- .call(iD.svg.Icon('#operation-delete'));
-
- $items.exit()
- .remove();
- }
+ // modules/modes/add_note.js
+ function modeAddNote(context) {
+ var mode = {
+ id: "add-note",
+ button: "note",
+ description: _t.html("modes.add_note.description"),
+ key: _t("modes.add_note.key")
+ };
+ var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
+ function add(loc) {
+ var osm = services.osm;
+ if (!osm)
+ return;
+ var note = osmNote({ loc, status: "open", comments: [] });
+ osm.replaceNote(note);
+ context.map().pan([0, 0]);
+ context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
}
-
- rawMemberEditor.entityID = function(_) {
- if (!arguments.length) return id;
- id = _;
- return rawMemberEditor;
+ function cancel() {
+ context.enter(modeBrowse(context));
+ }
+ mode.enter = function() {
+ context.install(behavior);
};
+ mode.exit = function() {
+ context.uninstall(behavior);
+ };
+ return mode;
+ }
- return rawMemberEditor;
-};
-iD.ui.RawMembershipEditor = function(context) {
- var id, showBlank;
-
- function selectRelation(d) {
- d3.event.preventDefault();
- context.enter(iD.modes.Select(context, [d.relation.id]));
+ // modules/modes/save.js
+ function modeSave(context) {
+ var mode = { id: "save" };
+ var keybinding = utilKeybinding("modeSave");
+ var commit = uiCommit(context).on("cancel", cancel);
+ var _conflictsUi;
+ var _location;
+ var _success;
+ var uploader = context.uploader().on("saveStarted.modeSave", function() {
+ keybindingOff();
+ }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
+ cancel();
+ }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
+ function cancel() {
+ context.enter(modeBrowse(context));
+ }
+ function showProgress(num, total) {
+ var modal = context.container().select(".loading-modal .modal-section");
+ var progress = modal.selectAll(".progress").data([0]);
+ progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
+ }
+ function showConflicts(changeset, conflicts, origChanges) {
+ var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
+ context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
+ _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
+ context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
+ selection2.remove();
+ keybindingOn();
+ uploader.cancelConflictResolution();
+ }).on("save", function() {
+ context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
+ selection2.remove();
+ uploader.processResolvedConflicts(changeset);
+ });
+ selection2.call(_conflictsUi);
+ }
+ function showErrors(errors) {
+ keybindingOn();
+ var selection2 = uiConfirm(context.container());
+ selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
+ addErrors(selection2, errors);
+ selection2.okButton();
+ }
+ function addErrors(selection2, data) {
+ var message = selection2.select(".modal-section.message-text");
+ var items = message.selectAll(".error-container").data(data);
+ var enter = items.enter().append("div").attr("class", "error-container");
+ enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d) {
+ return d.msg || _t("save.unknown_error_details");
+ }).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ var error = select_default2(this);
+ var detail = select_default2(this.nextElementSibling);
+ var exp2 = error.classed("expanded");
+ detail.style("display", exp2 ? "none" : "block");
+ error.classed("expanded", !exp2);
+ });
+ var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
+ details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d) {
+ return d.details || [];
+ }).enter().append("li").attr("class", "error-detail-item").text(function(d) {
+ return d;
+ });
+ items.exit().remove();
}
-
- function changeRole(d) {
- var role = d3.select(this).property('value');
- context.perform(
- iD.actions.ChangeMember(d.relation.id, _.extend({}, d.member, {role: role}), d.index),
- t('operations.change_role.annotation'));
+ function showSuccess(changeset) {
+ commit.reset();
+ var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
+ context.ui().sidebar.hide();
+ });
+ context.enter(modeBrowse(context).sidebar(ui));
}
-
- function addMembership(d, role) {
- showBlank = false;
-
- if (d.relation) {
- context.perform(
- iD.actions.AddMember(d.relation.id, {id: id, type: context.entity(id).type, role: role}),
- t('operations.add_member.annotation'));
-
- } else {
- var relation = iD.Relation();
-
- context.perform(
- iD.actions.AddEntity(relation),
- iD.actions.AddMember(relation.id, {id: id, type: context.entity(id).type, role: role}),
- t('operations.add.annotation.relation'));
-
- context.enter(iD.modes.Select(context, [relation.id]));
- }
+ function keybindingOn() {
+ select_default2(document).call(keybinding.on("\u238B", cancel, true));
}
-
- function deleteMembership(d) {
- context.perform(
- iD.actions.DeleteMember(d.relation.id, d.index),
- t('operations.delete_member.annotation'));
+ function keybindingOff() {
+ select_default2(document).call(keybinding.unbind);
}
-
- function relations(q) {
- var newRelation = {
- relation: null,
- value: t('inspector.new_relation')
- },
- result = [],
- graph = context.graph();
-
- context.intersects(context.extent()).forEach(function(entity) {
- if (entity.type !== 'relation' || entity.id === id)
- return;
-
- var presetName = context.presets().match(entity, graph).name(),
- entityName = iD.util.displayName(entity) || '';
-
- var value = presetName + ' ' + entityName;
- if (q && value.toLowerCase().indexOf(q.toLowerCase()) === -1)
- return;
-
- result.push({
- relation: entity,
- value: value
- });
+ function prepareForSuccess() {
+ _success = uiSuccess(context);
+ _location = null;
+ if (!services.geocoder)
+ return;
+ services.geocoder.reverse(context.map().center(), function(err, result) {
+ if (err || !result || !result.address)
+ return;
+ var addr = result.address;
+ var place = addr && (addr.town || addr.city || addr.county) || "";
+ var region = addr && (addr.state || addr.country) || "";
+ var separator = place && region ? _t("success.thank_you_where.separator") : "";
+ _location = _t("success.thank_you_where.format", { place, separator, region });
+ });
+ }
+ mode.selectedIDs = function() {
+ return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
+ };
+ mode.enter = function() {
+ context.ui().sidebar.expand();
+ function done() {
+ context.ui().sidebar.show(commit);
+ }
+ keybindingOn();
+ context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
+ var osm = context.connection();
+ if (!osm) {
+ cancel();
+ return;
+ }
+ if (osm.authenticated()) {
+ done();
+ } else {
+ osm.authenticate(function(err) {
+ if (err) {
+ cancel();
+ } else {
+ done();
+ }
});
+ }
+ };
+ mode.exit = function() {
+ keybindingOff();
+ context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
+ context.ui().sidebar.hide();
+ };
+ return mode;
+ }
- result.sort(function(a, b) {
- return iD.Relation.creationOrder(a.relation, b.relation);
+ // modules/modes/select_error.js
+ function modeSelectError(context, selectedErrorID, selectedErrorService) {
+ var mode = {
+ id: "select-error",
+ button: "browse"
+ };
+ var keybinding = utilKeybinding("select-error");
+ var errorService = services[selectedErrorService];
+ var errorEditor;
+ switch (selectedErrorService) {
+ case "improveOSM":
+ errorEditor = uiImproveOsmEditor(context).on("change", function() {
+ context.map().pan([0, 0]);
+ var error = checkSelectedID();
+ if (!error)
+ return;
+ context.ui().sidebar.show(errorEditor.error(error));
});
-
- // Dedupe identical names by appending relation id - see #2891
- var dupeGroups = _(result)
- .groupBy('value')
- .filter(function(v) { return v.length > 1; })
- .value();
-
- dupeGroups.forEach(function(group) {
- group.forEach(function(obj) {
- obj.value += ' ' + obj.relation.id;
- });
+ break;
+ case "keepRight":
+ errorEditor = uiKeepRightEditor(context).on("change", function() {
+ context.map().pan([0, 0]);
+ var error = checkSelectedID();
+ if (!error)
+ return;
+ context.ui().sidebar.show(errorEditor.error(error));
});
-
- result.unshift(newRelation);
-
- return result;
- }
-
- function rawMembershipEditor(selection) {
- var entity = context.entity(id),
- memberships = [];
-
- context.graph().parentRelations(entity).forEach(function(relation) {
- relation.members.forEach(function(member, index) {
- if (member.id === entity.id) {
- memberships.push({relation: relation, member: member, index: index});
- }
- });
+ break;
+ case "osmose":
+ errorEditor = uiOsmoseEditor(context).on("change", function() {
+ context.map().pan([0, 0]);
+ var error = checkSelectedID();
+ if (!error)
+ return;
+ context.ui().sidebar.show(errorEditor.error(error));
});
-
- selection.call(iD.ui.Disclosure()
- .title(t('inspector.all_relations') + ' (' + memberships.length + ')')
- .expanded(true)
- .on('toggled', toggled)
- .content(content));
-
- function toggled(expanded) {
- if (expanded) {
- selection.node().parentNode.scrollTop += 200;
- }
- }
-
- function content($wrap) {
- var $list = $wrap.selectAll('.member-list')
- .data([0]);
-
- $list.enter().append('ul')
- .attr('class', 'member-list');
-
- var $items = $list.selectAll('li.member-row-normal')
- .data(memberships, function(d) { return iD.Entity.key(d.relation) + ',' + d.index; });
-
- var $enter = $items.enter().append('li')
- .attr('class', 'member-row member-row-normal form-field');
-
- var $label = $enter.append('label')
- .attr('class', 'form-label')
- .append('a')
- .attr('href', '#')
- .on('click', selectRelation);
-
- $label.append('span')
- .attr('class', 'member-entity-type')
- .text(function(d) { return context.presets().match(d.relation, context.graph()).name(); });
-
- $label.append('span')
- .attr('class', 'member-entity-name')
- .text(function(d) { return iD.util.displayName(d.relation); });
-
- $enter.append('input')
- .attr('class', 'member-role')
- .property('type', 'text')
- .attr('maxlength', 255)
- .attr('placeholder', t('inspector.role'))
- .property('value', function(d) { return d.member.role; })
- .on('change', changeRole);
-
- $enter.append('button')
- .attr('tabindex', -1)
- .attr('class', 'remove button-input-action member-delete minor')
- .on('click', deleteMembership)
- .call(iD.svg.Icon('#operation-delete'));
-
- $items.exit()
- .remove();
-
- if (showBlank) {
- var $new = $list.selectAll('.member-row-new')
- .data([0]);
-
- $enter = $new.enter().append('li')
- .attr('class', 'member-row member-row-new form-field');
-
- $enter.append('input')
- .attr('type', 'text')
- .attr('class', 'member-entity-input')
- .call(d3.combobox()
- .minItems(1)
- .fetcher(function(value, callback) {
- callback(relations(value));
- })
- .on('accept', function(d) {
- addMembership(d, $new.select('.member-role').property('value'));
- }));
-
- $enter.append('input')
- .attr('class', 'member-role')
- .property('type', 'text')
- .attr('maxlength', 255)
- .attr('placeholder', t('inspector.role'))
- .on('change', changeRole);
-
- $enter.append('button')
- .attr('tabindex', -1)
- .attr('class', 'remove button-input-action member-delete minor')
- .on('click', deleteMembership)
- .call(iD.svg.Icon('#operation-delete'));
-
- } else {
- $list.selectAll('.member-row-new')
- .remove();
- }
-
- var $add = $wrap.selectAll('.add-relation')
- .data([0]);
-
- $add.enter()
- .append('button')
- .attr('class', 'add-relation')
- .call(iD.svg.Icon('#icon-plus', 'light'));
-
- $wrap.selectAll('.add-relation')
- .on('click', function() {
- showBlank = true;
- content($wrap);
- $list.selectAll('.member-entity-input').node().focus();
- });
- }
+ break;
}
-
- rawMembershipEditor.entityID = function(_) {
- if (!arguments.length) return id;
- id = _;
- return rawMembershipEditor;
- };
-
- return rawMembershipEditor;
-};
-iD.ui.RawTagEditor = function(context) {
- var event = d3.dispatch('change'),
- showBlank = false,
- state,
- preset,
- tags,
- id;
-
- function rawTagEditor(selection) {
- var count = Object.keys(tags).filter(function(d) { return d; }).length;
-
- selection.call(iD.ui.Disclosure()
- .title(t('inspector.all_tags') + ' (' + count + ')')
- .expanded(context.storage('raw_tag_editor.expanded') === 'true' || preset.isFallback())
- .on('toggled', toggled)
- .content(content));
-
- function toggled(expanded) {
- context.storage('raw_tag_editor.expanded', expanded);
- if (expanded) {
- selection.node().parentNode.scrollTop += 200;
- }
- }
+ var behaviors = [
+ behaviorBreathe(context),
+ behaviorHover(context),
+ behaviorSelect(context),
+ behaviorLasso(context),
+ modeDragNode(context).behavior,
+ modeDragNote(context).behavior
+ ];
+ function checkSelectedID() {
+ if (!errorService)
+ return;
+ var error = errorService.getError(selectedErrorID);
+ if (!error) {
+ context.enter(modeBrowse(context));
+ }
+ return error;
}
-
- function content($wrap) {
- var entries = d3.entries(tags);
-
- if (!entries.length || showBlank) {
- showBlank = false;
- entries.push({key: '', value: ''});
- }
-
- var $list = $wrap.selectAll('.tag-list')
- .data([0]);
-
- $list.enter().append('ul')
- .attr('class', 'tag-list');
-
- var $newTag = $wrap.selectAll('.add-tag')
- .data([0]);
-
- $newTag.enter()
- .append('button')
- .attr('class', 'add-tag')
- .call(iD.svg.Icon('#icon-plus', 'light'));
-
- $newTag.on('click', addTag);
-
- var $items = $list.selectAll('li')
- .data(entries, function(d) { return d.key; });
-
- // Enter
-
- var $enter = $items.enter().append('li')
- .attr('class', 'tag-row cf');
-
- $enter.append('div')
- .attr('class', 'key-wrap')
- .append('input')
- .property('type', 'text')
- .attr('class', 'key')
- .attr('maxlength', 255);
-
- $enter.append('div')
- .attr('class', 'input-wrap-position')
- .append('input')
- .property('type', 'text')
- .attr('class', 'value')
- .attr('maxlength', 255);
-
- $enter.append('button')
- .attr('tabindex', -1)
- .attr('class', 'remove minor')
- .call(iD.svg.Icon('#operation-delete'));
-
- if (context.taginfo()) {
- $enter.each(bindTypeahead);
- }
-
- // Update
-
- $items.order();
-
- $items.each(function(tag) {
- var isRelation = (context.entity(id).type === 'relation'),
- reference;
- if (isRelation && tag.key === 'type')
- reference = iD.ui.TagReference({rtype: tag.value}, context);
- else
- reference = iD.ui.TagReference({key: tag.key, value: tag.value}, context);
-
- if (state === 'hover') {
- reference.showing(false);
- }
-
- d3.select(this)
- .call(reference.button)
- .call(reference.body);
- });
-
- $items.select('input.key')
- .attr('title', function(d) { return d.key; })
- .value(function(d) { return d.key; })
- .on('blur', keyChange)
- .on('change', keyChange);
-
- $items.select('input.value')
- .attr('title', function(d) { return d.value; })
- .value(function(d) { return d.value; })
- .on('blur', valueChange)
- .on('change', valueChange)
- .on('keydown.push-more', pushMore);
-
- $items.select('button.remove')
- .on('click', removeTag);
-
- $items.exit()
- .each(unbind)
- .remove();
-
- function pushMore() {
- if (d3.event.keyCode === 9 && !d3.event.shiftKey &&
- $list.selectAll('li:last-child input.value').node() === this) {
- addTag();
- }
- }
-
- function bindTypeahead() {
- var row = d3.select(this),
- key = row.selectAll('input.key'),
- value = row.selectAll('input.value');
-
- function sort(value, data) {
- var sameletter = [],
- other = [];
- for (var i = 0; i < data.length; i++) {
- if (data[i].value.substring(0, value.length) === value) {
- sameletter.push(data[i]);
- } else {
- other.push(data[i]);
- }
- }
- return sameletter.concat(other);
- }
-
- key.call(d3.combobox()
- .fetcher(function(value, callback) {
- context.taginfo().keys({
- debounce: true,
- geometry: context.geometry(id),
- query: value
- }, function(err, data) {
- if (!err) callback(sort(value, data));
- });
- }));
-
- value.call(d3.combobox()
- .fetcher(function(value, callback) {
- context.taginfo().values({
- debounce: true,
- key: key.value(),
- geometry: context.geometry(id),
- query: value
- }, function(err, data) {
- if (!err) callback(sort(value, data));
- });
- }));
- }
-
- function unbind() {
- var row = d3.select(this);
-
- row.selectAll('input.key')
- .call(d3.combobox.off);
-
- row.selectAll('input.value')
- .call(d3.combobox.off);
- }
-
- function keyChange(d) {
- var kOld = d.key,
- kNew = this.value.trim(),
- tag = {};
-
- if (kNew && kNew !== kOld) {
- var match = kNew.match(/^(.*?)(?:_(\d+))?$/),
- base = match[1],
- suffix = +(match[2] || 1);
- while (tags[kNew]) { // rename key if already in use
- kNew = base + '_' + suffix++;
- }
- }
- tag[kOld] = undefined;
- tag[kNew] = d.value;
- d.key = kNew; // Maintain DOM identity through the subsequent update.
- this.value = kNew;
- event.change(tag);
- }
-
- function valueChange(d) {
- var tag = {};
- tag[d.key] = this.value;
- event.change(tag);
- }
-
- function removeTag(d) {
- var tag = {};
- tag[d.key] = undefined;
- event.change(tag);
- d3.select(this.parentNode).remove();
- }
-
- function addTag() {
- // Wrapped in a setTimeout in case it's being called from a blur
- // handler. Without the setTimeout, the call to `content` would
- // wipe out the pending value change.
- setTimeout(function() {
- showBlank = true;
- content($wrap);
- $list.selectAll('li:last-child input.key').node().focus();
- }, 0);
+ mode.zoomToSelected = function() {
+ if (!errorService)
+ return;
+ var error = errorService.getError(selectedErrorID);
+ if (error) {
+ context.map().centerZoomEase(error.loc, 20);
+ }
+ };
+ mode.enter = function() {
+ var error = checkSelectedID();
+ if (!error)
+ return;
+ behaviors.forEach(context.install);
+ keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
+ select_default2(document).call(keybinding);
+ selectError();
+ var sidebar = context.ui().sidebar;
+ sidebar.show(errorEditor.error(error));
+ context.map().on("drawn.select-error", selectError);
+ function selectError(d3_event, drawn) {
+ if (!checkSelectedID())
+ return;
+ var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
+ if (selection2.empty()) {
+ var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
+ if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
+ context.enter(modeBrowse(context));
+ }
+ } else {
+ selection2.classed("selected", true);
+ context.selectedErrorID(selectedErrorID);
}
- }
-
- rawTagEditor.state = function(_) {
- if (!arguments.length) return state;
- state = _;
- return rawTagEditor;
+ }
+ function esc() {
+ if (context.container().select(".combobox").size())
+ return;
+ context.enter(modeBrowse(context));
+ }
};
-
- rawTagEditor.preset = function(_) {
- if (!arguments.length) return preset;
- preset = _;
- return rawTagEditor;
+ mode.exit = function() {
+ behaviors.forEach(context.uninstall);
+ select_default2(document).call(keybinding.unbind);
+ context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
+ context.map().on("drawn.select-error", null);
+ context.ui().sidebar.hide();
+ context.selectedErrorID(null);
+ context.features().forceVisible([]);
};
+ return mode;
+ }
- rawTagEditor.tags = function(_) {
- if (!arguments.length) return tags;
- tags = _;
- return rawTagEditor;
+ // modules/ui/tools/modes.js
+ function uiToolDrawModes(context) {
+ var tool = {
+ id: "old_modes",
+ label: _t.html("toolbar.add_feature")
};
-
- rawTagEditor.entityID = function(_) {
- if (!arguments.length) return id;
- id = _;
- return rawTagEditor;
+ var modes = [
+ modeAddPoint(context, {
+ title: _t.html("modes.add_point.title"),
+ button: "point",
+ description: _t.html("modes.add_point.description"),
+ preset: _mainPresetIndex.item("point"),
+ key: "1"
+ }),
+ modeAddLine(context, {
+ title: _t.html("modes.add_line.title"),
+ button: "line",
+ description: _t.html("modes.add_line.description"),
+ preset: _mainPresetIndex.item("line"),
+ key: "2"
+ }),
+ modeAddArea(context, {
+ title: _t.html("modes.add_area.title"),
+ button: "area",
+ description: _t.html("modes.add_area.description"),
+ preset: _mainPresetIndex.item("area"),
+ key: "3"
+ })
+ ];
+ function enabled(_mode) {
+ return osmEditable();
+ }
+ function osmEditable() {
+ return context.editable();
+ }
+ modes.forEach(function(mode) {
+ context.keybinding().on(mode.key, function() {
+ if (!enabled(mode))
+ return;
+ if (mode.id === context.mode().id) {
+ context.enter(modeBrowse(context));
+ } else {
+ context.enter(mode);
+ }
+ });
+ });
+ tool.render = function(selection2) {
+ var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
+ var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
+ context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
+ context.on("enter.modes", update);
+ update();
+ function update() {
+ var buttons = wrap2.selectAll("button.add-button").data(modes, function(d) {
+ return d.id;
+ });
+ buttons.exit().remove();
+ var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
+ return d.id + " add-button bar-button";
+ }).on("click.mode-buttons", function(d3_event, d) {
+ if (!enabled(d))
+ return;
+ var currMode = context.mode().id;
+ if (/^draw/.test(currMode))
+ return;
+ if (d.id === currMode) {
+ context.enter(modeBrowse(context));
+ } else {
+ context.enter(d);
+ }
+ }).call(uiTooltip().placement("bottom").title(function(d) {
+ return d.description;
+ }).keys(function(d) {
+ return [d.key];
+ }).scrollContainer(context.container().select(".top-toolbar")));
+ buttonsEnter.each(function(d) {
+ select_default2(this).call(svgIcon("#iD-icon-" + d.button));
+ });
+ buttonsEnter.append("span").attr("class", "label").html(function(mode) {
+ return mode.title;
+ });
+ if (buttons.enter().size() || buttons.exit().size()) {
+ context.ui().checkOverflow(".top-toolbar", true);
+ }
+ buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d) {
+ return !enabled(d);
+ }).classed("disabled", function(d) {
+ return !enabled(d);
+ }).attr("aria-pressed", function(d) {
+ return context.mode() && context.mode().button === d.button;
+ }).classed("active", function(d) {
+ return context.mode() && context.mode().button === d.button;
+ });
+ }
};
+ return tool;
+ }
- return d3.rebind(rawTagEditor, event, 'on');
-};
-iD.ui.Restore = function(context) {
- return function(selection) {
- if (!context.history().lock() || !context.history().restorableChanges())
+ // modules/ui/tools/notes.js
+ function uiToolNotes(context) {
+ var tool = {
+ id: "notes",
+ label: _t.html("modes.add_note.label")
+ };
+ var mode = modeAddNote(context);
+ function enabled() {
+ return notesEnabled() && notesEditable();
+ }
+ function notesEnabled() {
+ var noteLayer = context.layers().layer("notes");
+ return noteLayer && noteLayer.enabled();
+ }
+ function notesEditable() {
+ var mode2 = context.mode();
+ return context.map().notesEditable() && mode2 && mode2.id !== "save";
+ }
+ context.keybinding().on(mode.key, function() {
+ if (!enabled())
+ return;
+ if (mode.id === context.mode().id) {
+ context.enter(modeBrowse(context));
+ } else {
+ context.enter(mode);
+ }
+ });
+ tool.render = function(selection2) {
+ var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
+ context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
+ context.on("enter.notes", update);
+ update();
+ function update() {
+ var showNotes = notesEnabled();
+ var data = showNotes ? [mode] : [];
+ var buttons = selection2.selectAll("button.add-button").data(data, function(d) {
+ return d.id;
+ });
+ buttons.exit().remove();
+ var buttonsEnter = buttons.enter().append("button").attr("class", function(d) {
+ return d.id + " add-button bar-button";
+ }).on("click.notes", function(d3_event, d) {
+ if (!enabled())
return;
-
- var modal = iD.ui.modal(selection, true);
-
- modal.select('.modal')
- .attr('class', 'modal fillL col6');
-
- var introModal = modal.select('.content');
-
- introModal.attr('class','cf');
-
- introModal.append('div')
- .attr('class', 'modal-section')
- .append('h3')
- .text(t('restore.heading'));
-
- introModal.append('div')
- .attr('class','modal-section')
- .append('p')
- .text(t('restore.description'));
-
- var buttonWrap = introModal.append('div')
- .attr('class', 'modal-actions cf');
-
- var restore = buttonWrap.append('button')
- .attr('class', 'restore col6')
- .text(t('restore.restore'))
- .on('click', function() {
- context.history().restore();
- modal.remove();
- });
-
- buttonWrap.append('button')
- .attr('class', 'reset col6')
- .text(t('restore.reset'))
- .on('click', function() {
- context.history().clearSaved();
- modal.remove();
- });
-
- restore.node().focus();
+ var currMode = context.mode().id;
+ if (/^draw/.test(currMode))
+ return;
+ if (d.id === currMode) {
+ context.enter(modeBrowse(context));
+ } else {
+ context.enter(d);
+ }
+ }).call(uiTooltip().placement("bottom").title(function(d) {
+ return d.description;
+ }).keys(function(d) {
+ return [d.key];
+ }).scrollContainer(context.container().select(".top-toolbar")));
+ buttonsEnter.each(function(d) {
+ select_default2(this).call(svgIcon(d.icon || "#iD-icon-" + d.button));
+ });
+ if (buttons.enter().size() || buttons.exit().size()) {
+ context.ui().checkOverflow(".top-toolbar", true);
+ }
+ buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
+ return !enabled();
+ }).attr("aria-disabled", function() {
+ return !enabled();
+ }).classed("active", function(d) {
+ return context.mode() && context.mode().button === d.button;
+ }).attr("aria-pressed", function(d) {
+ return context.mode() && context.mode().button === d.button;
+ });
+ }
};
-};
-iD.ui.Save = function(context) {
- var history = context.history(),
- key = iD.ui.cmd('âS');
-
+ tool.uninstall = function() {
+ context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
+ context.map().on("move.notes", null).on("drawn.notes", null);
+ };
+ return tool;
+ }
- function saving() {
- return context.mode().id === 'save';
+ // modules/ui/tools/save.js
+ function uiToolSave(context) {
+ var tool = {
+ id: "save",
+ label: _t.html("save.title")
+ };
+ var button = null;
+ var tooltipBehavior = null;
+ var history = context.history();
+ var key = uiCmd("\u2318S");
+ var _numChanges = 0;
+ function isSaving() {
+ var mode = context.mode();
+ return mode && mode.id === "save";
+ }
+ function isDisabled() {
+ return _numChanges === 0 || isSaving();
+ }
+ function save(d3_event) {
+ d3_event.preventDefault();
+ if (!context.inIntro() && !isSaving() && history.hasChanges()) {
+ context.enter(modeSave(context));
+ }
}
-
- function save() {
- d3.event.preventDefault();
- if (!context.inIntro() && !saving() && history.hasChanges()) {
- context.enter(iD.modes.Save(context));
- }
+ function bgColor(numChanges) {
+ var step;
+ if (numChanges === 0) {
+ return null;
+ } else if (numChanges <= 50) {
+ step = numChanges / 50;
+ return rgb_default("#fff", "#ff8")(step);
+ } else {
+ step = Math.min((numChanges - 50) / 50, 1);
+ return rgb_default("#ff8", "#f88")(step);
+ }
}
-
- function getBackground(numChanges) {
- var step;
- if (numChanges === 0) {
- return null;
- } else if (numChanges <= 50) {
- step = numChanges / 50;
- return d3.interpolateRgb('#fff', '#ff8')(step); // white -> yellow
- } else {
- step = Math.min((numChanges - 50) / 50, 1.0);
- return d3.interpolateRgb('#ff8', '#f88')(step); // yellow -> red
- }
+ function updateCount() {
+ var val = history.difference().summary().length;
+ if (val === _numChanges)
+ return;
+ _numChanges = val;
+ if (tooltipBehavior) {
+ tooltipBehavior.title(_t.html(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
+ }
+ if (button) {
+ button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
+ button.select("span.count").text(_numChanges);
+ }
}
+ tool.render = function(selection2) {
+ tooltipBehavior = uiTooltip().placement("bottom").title(_t.html("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
+ var lastPointerUpType;
+ button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
+ lastPointerUpType = d3_event.pointerType;
+ }).on("click", function(d3_event) {
+ save(d3_event);
+ if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
+ context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.html("save.no_changes"))();
+ }
+ lastPointerUpType = null;
+ }).call(tooltipBehavior);
+ button.call(svgIcon("#iD-icon-save"));
+ button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
+ updateCount();
+ context.keybinding().on(key, save, true);
+ context.history().on("change.save", updateCount);
+ context.on("enter.save", function() {
+ if (button) {
+ button.classed("disabled", isDisabled());
+ if (isSaving()) {
+ button.call(tooltipBehavior.hide);
+ }
+ }
+ });
+ };
+ tool.uninstall = function() {
+ context.keybinding().off(key, true);
+ context.history().on("change.save", null);
+ context.on("enter.save", null);
+ button = null;
+ tooltipBehavior = null;
+ };
+ return tool;
+ }
- return function(selection) {
- var tooltip = bootstrap.tooltip()
- .placement('bottom')
- .html(true)
- .title(iD.ui.tooltipHtml(t('save.no_changes'), key));
-
- var button = selection.append('button')
- .attr('class', 'save col12 disabled')
- .attr('tabindex', -1)
- .on('click', save)
- .call(tooltip);
-
- button.append('span')
- .attr('class', 'label')
- .text(t('save.title'));
-
- button.append('span')
- .attr('class', 'count')
- .text('0');
-
- var keybinding = d3.keybinding('undo-redo')
- .on(key, save, true);
-
- d3.select(document)
- .call(keybinding);
-
- var numChanges = 0;
-
- context.history().on('change.save', function() {
- var _ = history.difference().summary().length;
- if (_ === numChanges)
- return;
- numChanges = _;
-
- tooltip.title(iD.ui.tooltipHtml(t(numChanges > 0 ?
- 'save.help' : 'save.no_changes'), key));
-
- var background = getBackground(numChanges);
-
- button
- .classed('disabled', numChanges === 0)
- .classed('has-count', numChanges > 0)
- .style('background', background);
-
- button.select('span.count')
- .text(numChanges)
- .style('background', background)
- .style('border-color', background);
- });
+ // modules/ui/tools/sidebar_toggle.js
+ function uiToolSidebarToggle(context) {
+ var tool = {
+ id: "sidebar_toggle",
+ label: _t.html("toolbar.inspect")
+ };
+ tool.render = function(selection2) {
+ selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
+ context.ui().sidebar.toggle();
+ }).call(uiTooltip().placement("bottom").title(_t.html("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
+ };
+ return tool;
+ }
- context.on('enter.save', function() {
- button.property('disabled', saving());
- if (saving()) button.call(tooltip.hide);
+ // modules/ui/tools/undo_redo.js
+ function uiToolUndoRedo(context) {
+ var tool = {
+ id: "undo_redo",
+ label: _t.html("toolbar.undo_redo")
+ };
+ var commands = [{
+ id: "undo",
+ cmd: uiCmd("\u2318Z"),
+ action: function() {
+ context.undo();
+ },
+ annotation: function() {
+ return context.history().undoAnnotation();
+ },
+ icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
+ }, {
+ id: "redo",
+ cmd: uiCmd("\u2318\u21E7Z"),
+ action: function() {
+ context.redo();
+ },
+ annotation: function() {
+ return context.history().redoAnnotation();
+ },
+ icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
+ }];
+ function editable() {
+ return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(true);
+ }
+ tool.render = function(selection2) {
+ var tooltipBehavior = uiTooltip().placement("bottom").title(function(d) {
+ return d.annotation() ? _t.html(d.id + ".tooltip", { action: d.annotation() }) : _t.html(d.id + ".nothing");
+ }).keys(function(d) {
+ return [d.cmd];
+ }).scrollContainer(context.container().select(".top-toolbar"));
+ var lastPointerUpType;
+ var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d) {
+ return "disabled " + d.id + "-button bar-button";
+ }).on("pointerup", function(d3_event) {
+ lastPointerUpType = d3_event.pointerType;
+ }).on("click", function(d3_event, d) {
+ d3_event.preventDefault();
+ var annotation = d.annotation();
+ if (editable() && annotation) {
+ d.action();
+ }
+ if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
+ var text2 = annotation ? _t.html(d.id + ".tooltip", { action: annotation }) : _t.html(d.id + ".nothing");
+ context.ui().flash.duration(2e3).iconName("#" + d.icon).iconClass(annotation ? "" : "disabled").label(text2)();
+ }
+ lastPointerUpType = null;
+ }).call(tooltipBehavior);
+ buttons.each(function(d) {
+ select_default2(this).call(svgIcon("#" + d.icon));
+ });
+ context.keybinding().on(commands[0].cmd, function(d3_event) {
+ d3_event.preventDefault();
+ if (editable())
+ commands[0].action();
+ }).on(commands[1].cmd, function(d3_event) {
+ d3_event.preventDefault();
+ if (editable())
+ commands[1].action();
+ });
+ var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
+ context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
+ context.history().on("change.undo_redo", function(difference) {
+ if (difference)
+ update();
+ });
+ context.on("enter.undo_redo", update);
+ function update() {
+ buttons.classed("disabled", function(d) {
+ return !editable() || !d.annotation();
+ }).each(function() {
+ var selection3 = select_default2(this);
+ if (!selection3.select(".tooltip.in").empty()) {
+ selection3.call(tooltipBehavior.updateContent);
+ }
});
+ }
};
-};
-iD.ui.Scale = function(context) {
- var projection = context.projection,
- imperial = (iD.detect().locale.toLowerCase() === 'en-us'),
- maxLength = 180,
- tickHeight = 8;
-
- function scaleDefs(loc1, loc2) {
- var lat = (loc2[1] + loc1[1]) / 2,
- conversion = (imperial ? 3.28084 : 1),
- dist = iD.geo.lonToMeters(loc2[0] - loc1[0], lat) * conversion,
- scale = { dist: 0, px: 0, text: '' },
- buckets, i, val, dLon;
-
- if (imperial) {
- buckets = [5280000, 528000, 52800, 5280, 500, 50, 5, 1];
- } else {
- buckets = [5000000, 500000, 50000, 5000, 500, 50, 5, 1];
- }
+ tool.uninstall = function() {
+ context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
+ context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
+ context.history().on("change.undo_redo", null);
+ context.on("enter.undo_redo", null);
+ };
+ return tool;
+ }
- // determine a user-friendly endpoint for the scale
- for (i = 0; i < buckets.length; i++) {
- val = buckets[i];
- if (dist >= val) {
- scale.dist = Math.floor(dist / val) * val;
- break;
- }
+ // modules/ui/top_toolbar.js
+ function uiTopToolbar(context) {
+ var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
+ function notesEnabled() {
+ var noteLayer = context.layers().layer("notes");
+ return noteLayer && noteLayer.enabled();
+ }
+ function topToolbar(bar) {
+ bar.on("wheel.topToolbar", function(d3_event) {
+ if (!d3_event.deltaX) {
+ bar.node().scrollLeft += d3_event.deltaY;
}
-
- dLon = iD.geo.metersToLon(scale.dist / conversion, lat);
- scale.px = Math.round(projection([loc1[0] + dLon, loc1[1]])[0]);
-
- if (imperial) {
- if (scale.dist >= 5280) {
- scale.dist /= 5280;
- scale.text = String(scale.dist) + ' mi';
- } else {
- scale.text = String(scale.dist) + ' ft';
- }
- } else {
- if (scale.dist >= 1000) {
- scale.dist /= 1000;
- scale.text = String(scale.dist) + ' km';
- } else {
- scale.text = String(scale.dist) + ' m';
- }
+ });
+ var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
+ context.layers().on("change.topToolbar", debouncedUpdate);
+ update();
+ function update() {
+ var tools = [
+ sidebarToggle,
+ "spacer",
+ modes
+ ];
+ tools.push("spacer");
+ if (notesEnabled()) {
+ tools = tools.concat([notes, "spacer"]);
}
-
- return scale;
+ tools = tools.concat([undoRedo, save]);
+ var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d) {
+ return d.id || d;
+ });
+ toolbarItems.exit().each(function(d) {
+ if (d.uninstall) {
+ d.uninstall();
+ }
+ }).remove();
+ var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d) {
+ var classes = "toolbar-item " + (d.id || d).replace("_", "-");
+ if (d.klass)
+ classes += " " + d.klass;
+ return classes;
+ });
+ var actionableItems = itemsEnter.filter(function(d) {
+ return d !== "spacer";
+ });
+ actionableItems.append("div").attr("class", "item-content").each(function(d) {
+ select_default2(this).call(d.render, bar);
+ });
+ actionableItems.append("div").attr("class", "item-label").html(function(d) {
+ return d.label;
+ });
+ }
}
+ return topToolbar;
+ }
- function update(selection) {
- // choose loc1, loc2 along bottom of viewport (near where the scale will be drawn)
- var dims = context.map().dimensions(),
- loc1 = projection.invert([0, dims[1]]),
- loc2 = projection.invert([maxLength, dims[1]]),
- scale = scaleDefs(loc1, loc2);
-
- selection.select('#scalepath')
- .attr('d', 'M0.5,0.5v' + tickHeight + 'h' + scale.px + 'v-' + tickHeight);
-
- selection.select('#scaletext')
- .attr('x', scale.px + 8)
- .attr('y', tickHeight)
- .text(scale.text);
+ // modules/ui/zoom_to_selection.js
+ function uiZoomToSelection(context) {
+ function isDisabled() {
+ var mode = context.mode();
+ return !mode || !mode.zoomToSelected;
}
-
-
- return function(selection) {
- function switchUnits() {
- imperial = !imperial;
- selection.call(update);
+ var _lastPointerUpType;
+ function pointerup(d3_event) {
+ _lastPointerUpType = d3_event.pointerType;
+ }
+ function click(d3_event) {
+ d3_event.preventDefault();
+ if (isDisabled()) {
+ if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
+ context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.html("inspector.zoom_to.no_selection"))();
}
+ } else {
+ var mode = context.mode();
+ if (mode && mode.zoomToSelected) {
+ mode.zoomToSelected();
+ }
+ }
+ _lastPointerUpType = null;
+ }
+ return function(selection2) {
+ var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
+ if (isDisabled()) {
+ return _t.html("inspector.zoom_to.no_selection");
+ }
+ return _t.html("inspector.zoom_to.title");
+ }).keys([_t("inspector.zoom_to.key")]);
+ var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
+ function setEnabledState() {
+ button.classed("disabled", isDisabled());
+ if (!button.select(".tooltip.in").empty()) {
+ button.call(tooltipBehavior.updateContent);
+ }
+ }
+ context.on("enter.uiZoomToSelection", setEnabledState);
+ setEnabledState();
+ };
+ }
- var g = selection.append('svg')
- .attr('id', 'scale')
- .on('click', switchUnits)
- .append('g')
- .attr('transform', 'translate(10,11)');
-
- g.append('path').attr('id', 'scalepath');
- g.append('text').attr('id', 'scaletext');
-
- selection.call(update);
-
- context.map().on('move.scale', function() {
- update(selection);
+ // modules/ui/pane.js
+ function uiPane(id2, context) {
+ var _key;
+ var _label = "";
+ var _description = "";
+ var _iconName = "";
+ var _sections;
+ var _paneSelection = select_default2(null);
+ var _paneTooltip;
+ var pane = {
+ id: id2
+ };
+ pane.label = function(val) {
+ if (!arguments.length)
+ return _label;
+ _label = val;
+ return pane;
+ };
+ pane.key = function(val) {
+ if (!arguments.length)
+ return _key;
+ _key = val;
+ return pane;
+ };
+ pane.description = function(val) {
+ if (!arguments.length)
+ return _description;
+ _description = val;
+ return pane;
+ };
+ pane.iconName = function(val) {
+ if (!arguments.length)
+ return _iconName;
+ _iconName = val;
+ return pane;
+ };
+ pane.sections = function(val) {
+ if (!arguments.length)
+ return _sections;
+ _sections = val;
+ return pane;
+ };
+ pane.selection = function() {
+ return _paneSelection;
+ };
+ function hidePane() {
+ context.ui().togglePanes();
+ }
+ pane.togglePane = function(d3_event) {
+ if (d3_event)
+ d3_event.preventDefault();
+ _paneTooltip.hide();
+ context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
+ };
+ pane.renderToggleButton = function(selection2) {
+ if (!_paneTooltip) {
+ _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(_description).keys([_key]);
+ }
+ selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
+ };
+ pane.renderContent = function(selection2) {
+ if (_sections) {
+ _sections.forEach(function(section) {
+ selection2.call(section.render);
});
+ }
+ };
+ pane.renderPane = function(selection2) {
+ _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
+ var heading = _paneSelection.append("div").attr("class", "pane-heading");
+ heading.append("h2").html(_label);
+ heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
+ _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
+ if (_key) {
+ context.keybinding().on(_key, pane.togglePane);
+ }
};
-};
-iD.ui.SelectionList = function(context, selectedIDs) {
+ return pane;
+ }
- function selectEntity(entity) {
- context.enter(iD.modes.Select(context, [entity.id]).suppressMenu(true));
+ // modules/ui/sections/background_display_options.js
+ function uiSectionBackgroundDisplayOptions(context) {
+ var section = uiSection("background-display-options", context).label(_t.html("background.display_options")).disclosureContent(renderDisclosureContent);
+ var _storedOpacity = corePreferences("background-opacity");
+ var _minVal = 0;
+ var _maxVal = 3;
+ var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
+ var _options = {
+ brightness: _storedOpacity !== null ? +_storedOpacity : 1,
+ contrast: 1,
+ saturation: 1,
+ sharpness: 1
+ };
+ function clamp3(x, min3, max3) {
+ return Math.max(min3, Math.min(x, max3));
+ }
+ function updateValue(d, val) {
+ val = clamp3(val, _minVal, _maxVal);
+ _options[d] = val;
+ context.background()[d](val);
+ if (d === "brightness") {
+ corePreferences("background-opacity", val);
+ }
+ section.reRender();
}
-
-
- function selectionList(selection) {
- selection.classed('selection-list-pane', true);
-
- var header = selection.append('div')
- .attr('class', 'header fillL cf');
-
- header.append('h3')
- .text(t('inspector.multiselect'));
-
- var listWrap = selection.append('div')
- .attr('class', 'inspector-body');
-
- var list = listWrap.append('div')
- .attr('class', 'feature-list cf');
-
- context.history().on('change.selection-list', drawList);
- drawList();
-
- function drawList() {
- var entities = selectedIDs
- .map(function(id) { return context.hasEntity(id); })
- .filter(function(entity) { return entity; });
-
- var items = list.selectAll('.feature-list-item')
- .data(entities, iD.Entity.key);
-
- var enter = items.enter().append('button')
- .attr('class', 'feature-list-item')
- .on('click', selectEntity);
-
- // Enter
- var label = enter.append('div')
- .attr('class', 'label')
- .call(iD.svg.Icon('', 'pre-text'));
-
- label.append('span')
- .attr('class', 'entity-type');
-
- label.append('span')
- .attr('class', 'entity-name');
-
- // Update
- items.selectAll('use')
- .attr('href', function() {
- var entity = this.parentNode.parentNode.__data__;
- return '#icon-' + context.geometry(entity.id);
- });
-
- items.selectAll('.entity-type')
- .text(function(entity) { return context.presets().match(entity, context.graph()).name(); });
-
- items.selectAll('.entity-name')
- .text(function(entity) { return iD.util.displayName(entity); });
-
- // Exit
- items.exit()
- .remove();
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".display-options-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
+ var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d) {
+ return "display-control display-control-" + d;
+ });
+ slidersEnter.html(function(d) {
+ return _t.html("background." + d);
+ }).append("span").attr("class", function(d) {
+ return "display-option-value display-option-value-" + d;
+ });
+ var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
+ sildersControlEnter.append("input").attr("class", function(d) {
+ return "display-option-input display-option-input-" + d;
+ }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d) {
+ var val = select_default2(this).property("value");
+ if (!val && d3_event && d3_event.target) {
+ val = d3_event.target.value;
+ }
+ updateValue(d, val);
+ });
+ sildersControlEnter.append("button").attr("title", function(d) {
+ return `${_t("background.reset")} ${_t("background." + d)}`;
+ }).attr("class", function(d) {
+ return "display-option-reset display-option-reset-" + d;
+ }).on("click", function(d3_event, d) {
+ if (d3_event.button !== 0)
+ return;
+ updateValue(d, 1);
+ }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
+ containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ for (var i2 = 0; i2 < _sliders.length; i2++) {
+ updateValue(_sliders[i2], 1);
}
+ });
+ container = containerEnter.merge(container);
+ container.selectAll(".display-option-input").property("value", function(d) {
+ return _options[d];
+ });
+ container.selectAll(".display-option-value").text(function(d) {
+ return Math.floor(_options[d] * 100) + "%";
+ });
+ container.selectAll(".display-option-reset").classed("disabled", function(d) {
+ return _options[d] === 1;
+ });
+ if (containerEnter.size() && _options.brightness !== 1) {
+ context.background().brightness(_options.brightness);
+ }
}
+ return section;
+ }
- return selectionList;
-
-};
-iD.ui.Sidebar = function(context) {
- var inspector = iD.ui.Inspector(context),
- current;
-
- function sidebar(selection) {
- var featureListWrap = selection.append('div')
- .attr('class', 'feature-list-pane')
- .call(iD.ui.FeatureList(context));
-
- selection.call(iD.ui.Notice(context));
-
- var inspectorWrap = selection.append('div')
- .attr('class', 'inspector-hidden inspector-wrap fr');
-
- function hover(id) {
- if (!current && context.hasEntity(id)) {
- featureListWrap.classed('inspector-hidden', true);
- inspectorWrap.classed('inspector-hidden', false)
- .classed('inspector-hover', true);
-
- if (inspector.entityID() !== id || inspector.state() !== 'hover') {
- inspector
- .state('hover')
- .entityID(id);
+ // modules/ui/settings/custom_background.js
+ function uiSettingsCustomBackground() {
+ var dispatch10 = dispatch_default("change");
+ function render(selection2) {
+ var _origSettings = {
+ template: corePreferences("background-custom-template")
+ };
+ var _currSettings = {
+ template: corePreferences("background-custom-template")
+ };
+ var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
+ var modal = uiConfirm(selection2).okButton();
+ modal.classed("settings-modal settings-custom-background", true);
+ modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
+ var textSection = modal.select(".modal-section.message-text");
+ var instructions = `${_t.html("settings.custom_background.instructions.info")}
+
+#### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
+* ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
+
+#### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
+* ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
+
+#### ${_t.html("settings.custom_background.instructions.example")}
+\`${example}\``;
+ textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
+ textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
+ var buttonSection = modal.select(".modal-section.buttons");
+ buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
+ buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
+ buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
+ function isSaveDisabled() {
+ return null;
+ }
+ function clickCancel() {
+ textSection.select(".field-template").property("value", _origSettings.template);
+ corePreferences("background-custom-template", _origSettings.template);
+ this.blur();
+ modal.close();
+ }
+ function clickSave() {
+ _currSettings.template = textSection.select(".field-template").property("value");
+ corePreferences("background-custom-template", _currSettings.template);
+ this.blur();
+ modal.close();
+ dispatch10.call("change", this, _currSettings);
+ }
+ }
+ return utilRebind(render, dispatch10, "on");
+ }
- inspectorWrap.call(inspector);
- }
- } else if (!current) {
- featureListWrap.classed('inspector-hidden', false);
- inspectorWrap.classed('inspector-hidden', true);
- inspector.state('hide');
- }
+ // modules/ui/sections/background_list.js
+ function uiSectionBackgroundList(context) {
+ var _backgroundList = select_default2(null);
+ var _customSource = context.background().findSource("custom");
+ var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
+ var section = uiSection("background-list", context).label(_t.html("background.backgrounds")).disclosureContent(renderDisclosureContent);
+ function previousBackgroundID() {
+ return corePreferences("background-last-used-toggle");
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-background-list").data([0]);
+ _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
+ var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
+ var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(uiTooltip().title(_t.html("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top"));
+ minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ uiMapInMap.toggle();
+ });
+ minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
+ var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top"));
+ panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("background");
+ });
+ panelLabelEnter.append("span").call(_t.append("background.panel.description"));
+ var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top"));
+ locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("location");
+ });
+ locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
+ selection2.selectAll(".imagery-faq").data([0]).enter().append("div").attr("class", "imagery-faq").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/develop/FAQ.md#how-can-i-report-an-issue-with-background-imagery").append("span").call(_t.append("background.imagery_problem_faq"));
+ _backgroundList.call(drawListItems, "radio", function(d3_event, d) {
+ chooseBackground(d);
+ }, function(d) {
+ return !d.isHidden() && !d.overlay;
+ });
+ }
+ function setTooltips(selection2) {
+ selection2.each(function(d, i2, nodes) {
+ var item = select_default2(this).select("label");
+ var span = item.select("span");
+ var placement = i2 < nodes.length / 2 ? "bottom" : "top";
+ var description2 = d.description();
+ var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
+ item.call(uiTooltip().destroyAny);
+ if (d.id === previousBackgroundID()) {
+ item.call(uiTooltip().placement(placement).title("" + _t.html("background.switch") + "
").keys([uiCmd("\u2318" + _t("background.key"))]));
+ } else if (description2 || isOverflowing) {
+ item.call(uiTooltip().placement(placement).title(description2 || d.label()));
}
-
- sidebar.hover = _.throttle(hover, 200);
-
- sidebar.select = function(id, newFeature) {
- if (!current && id) {
- featureListWrap.classed('inspector-hidden', true);
- inspectorWrap.classed('inspector-hidden', false)
- .classed('inspector-hover', false);
-
- if (inspector.entityID() !== id || inspector.state() !== 'select') {
- inspector
- .state('select')
- .entityID(id)
- .newFeature(newFeature);
-
- inspectorWrap.call(inspector);
- }
- } else if (!current) {
- featureListWrap.classed('inspector-hidden', false);
- inspectorWrap.classed('inspector-hidden', true);
- inspector.state('hide');
- }
- };
-
- sidebar.show = function(component) {
- featureListWrap.classed('inspector-hidden', true);
- inspectorWrap.classed('inspector-hidden', true);
- if (current) current.remove();
- current = selection.append('div')
- .attr('class', 'sidebar-component')
- .call(component);
- };
-
- sidebar.hide = function() {
- featureListWrap.classed('inspector-hidden', false);
- inspectorWrap.classed('inspector-hidden', true);
- if (current) current.remove();
- current = null;
- };
+ });
}
+ function drawListItems(layerList, type3, change, filter2) {
+ var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a, b) {
+ return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
+ });
+ var layerLinks = layerList.selectAll("li").data(sources, function(d, i2) {
+ return d.id + "---" + i2;
+ });
+ layerLinks.exit().remove();
+ var enter = layerLinks.enter().append("li").classed("layer-custom", function(d) {
+ return d.id === "custom";
+ }).classed("best", function(d) {
+ return d.best();
+ });
+ var label = enter.append("label");
+ label.append("input").attr("type", type3).attr("name", "background-layer").attr("value", function(d) {
+ return d.id;
+ }).on("change", change);
+ label.append("span").html(function(d) {
+ return d.label();
+ });
+ enter.filter(function(d) {
+ return d.id === "custom";
+ }).append("button").attr("class", "layer-browse").call(uiTooltip().title(_t.html("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ editCustom();
+ }).call(svgIcon("#iD-icon-more"));
+ enter.filter(function(d) {
+ return d.best();
+ }).append("div").attr("class", "best").call(uiTooltip().title(_t.html("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).append("span").html("★");
+ layerList.call(updateLayerSelections);
+ }
+ function updateLayerSelections(selection2) {
+ function active(d) {
+ return context.background().showsLayer(d);
+ }
+ selection2.selectAll("li").classed("active", active).classed("switch", function(d) {
+ return d.id === previousBackgroundID();
+ }).call(setTooltips).selectAll("input").property("checked", active);
+ }
+ function chooseBackground(d) {
+ if (d.id === "custom" && !d.template()) {
+ return editCustom();
+ }
+ var previousBackground = context.background().baseLayerSource();
+ corePreferences("background-last-used-toggle", previousBackground.id);
+ corePreferences("background-last-used", d.id);
+ context.background().baseLayerSource(d);
+ }
+ function customChanged(d) {
+ if (d && d.template) {
+ _customSource.template(d.template);
+ chooseBackground(_customSource);
+ } else {
+ _customSource.template("");
+ chooseBackground(context.background().findSource("none"));
+ }
+ }
+ function editCustom() {
+ context.container().call(_settingsCustomBackground);
+ }
+ context.background().on("change.background_list", function() {
+ _backgroundList.call(updateLayerSelections);
+ });
+ context.map().on("move.background_list", debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3));
+ return section;
+ }
- sidebar.hover = function() {};
- sidebar.hover.cancel = function() {};
- sidebar.select = function() {};
- sidebar.show = function() {};
- sidebar.hide = function() {};
-
- return sidebar;
-};
-iD.ui.SourceSwitch = function(context) {
- var keys;
-
- function click() {
- d3.event.preventDefault();
-
- if (context.history().hasChanges() &&
- !window.confirm(t('source_switch.lose_changes'))) return;
-
- var live = d3.select(this)
- .classed('live');
-
- context.connection()
- .switch(live ? keys[1] : keys[0]);
-
- context.enter(iD.modes.Browse(context));
- context.flush();
+ // modules/ui/sections/background_offset.js
+ function uiSectionBackgroundOffset(context) {
+ var section = uiSection("background-offset", context).label(_t.html("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ var _directions = [
+ ["top", [0, -0.5]],
+ ["left", [-0.5, 0]],
+ ["right", [0.5, 0]],
+ ["bottom", [0, 0.5]]
+ ];
+ function updateValue() {
+ var meters = geoOffsetToMeters(context.background().offset());
+ var x = +meters[0].toFixed(2);
+ var y = +meters[1].toFixed(2);
+ context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x + ", " + y);
+ context.container().selectAll(".nudge-reset").classed("disabled", function() {
+ return x === 0 && y === 0;
+ });
+ }
+ function resetOffset() {
+ context.background().offset([0, 0]);
+ updateValue();
+ }
+ function nudge(d) {
+ context.background().nudge(d, context.map().zoom());
+ updateValue();
+ }
+ function inputOffset() {
+ var input = select_default2(this);
+ var d = input.node().value;
+ if (d === "")
+ return resetOffset();
+ d = d.replace(/;/g, ",").split(",").map(function(n2) {
+ return !isNaN(n2) && n2;
+ });
+ if (d.length !== 2 || !d[0] || !d[1]) {
+ input.classed("error", true);
+ return;
+ }
+ context.background().offset(geoMetersToOffset(d));
+ updateValue();
+ }
+ function dragOffset(d3_event) {
+ if (d3_event.button !== 0)
+ return;
+ var origin = [d3_event.clientX, d3_event.clientY];
+ var pointerId = d3_event.pointerId || "mouse";
+ context.container().append("div").attr("class", "nudge-surface");
+ select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
+ if (_pointerPrefix === "pointer") {
+ select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
+ }
+ function pointermove(d3_event2) {
+ if (pointerId !== (d3_event2.pointerId || "mouse"))
+ return;
+ var latest = [d3_event2.clientX, d3_event2.clientY];
+ var d = [
+ -(origin[0] - latest[0]) / 4,
+ -(origin[1] - latest[1]) / 4
+ ];
+ origin = latest;
+ nudge(d);
+ }
+ function pointerup(d3_event2) {
+ if (pointerId !== (d3_event2.pointerId || "mouse"))
+ return;
+ if (d3_event2.button !== 0)
+ return;
+ context.container().selectAll(".nudge-surface").remove();
+ select_default2(window).on(".drag-bg-offset", null);
+ }
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".nudge-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "nudge-container");
+ containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
+ var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
+ var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
+ nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
+ nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d) {
+ return _t(`background.nudge.${d[0]}`);
+ }).attr("class", function(d) {
+ return d[0] + " nudge";
+ }).on("click", function(d3_event, d) {
+ nudge(d[1]);
+ });
+ nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ resetOffset();
+ }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
+ updateValue();
+ }
+ context.background().on("change.backgroundOffset-update", updateValue);
+ return section;
+ }
- d3.select(this)
- .text(live ? t('source_switch.dev') : t('source_switch.live'))
- .classed('live', !live);
+ // modules/ui/sections/overlay_list.js
+ function uiSectionOverlayList(context) {
+ var section = uiSection("overlay-list", context).label(_t.html("background.overlays")).disclosureContent(renderDisclosureContent);
+ var _overlayList = select_default2(null);
+ function setTooltips(selection2) {
+ selection2.each(function(d, i2, nodes) {
+ var item = select_default2(this).select("label");
+ var span = item.select("span");
+ var placement = i2 < nodes.length / 2 ? "bottom" : "top";
+ var description2 = d.description();
+ var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
+ item.call(uiTooltip().destroyAny);
+ if (description2 || isOverflowing) {
+ item.call(uiTooltip().placement(placement).title(description2 || d.name()));
+ }
+ });
+ }
+ function updateLayerSelections(selection2) {
+ function active(d) {
+ return context.background().showsLayer(d);
+ }
+ selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
+ }
+ function chooseOverlay(d3_event, d) {
+ d3_event.preventDefault();
+ context.background().toggleOverlayLayer(d);
+ _overlayList.call(updateLayerSelections);
+ document.activeElement.blur();
+ }
+ function drawListItems(layerList, type3, change, filter2) {
+ var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
+ var layerLinks = layerList.selectAll("li").data(sources, function(d) {
+ return d.name();
+ });
+ layerLinks.exit().remove();
+ var enter = layerLinks.enter().append("li");
+ var label = enter.append("label");
+ label.append("input").attr("type", type3).attr("name", "layers").on("change", change);
+ label.append("span").html(function(d) {
+ return d.label();
+ });
+ layerList.selectAll("li").sort(sortSources);
+ layerList.call(updateLayerSelections);
+ function sortSources(a, b) {
+ return a.best() && !b.best() ? -1 : b.best() && !a.best() ? 1 : descending(a.area(), b.area()) || ascending(a.name(), b.name()) || 0;
+ }
+ }
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-overlay-list").data([0]);
+ _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
+ _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d) {
+ return !d.isHidden() && d.overlay;
+ });
}
+ context.map().on("move.overlay_list", debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3));
+ return section;
+ }
- var sourceSwitch = function(selection) {
- selection.append('a')
- .attr('href', '#')
- .text(t('source_switch.live'))
- .classed('live', true)
- .attr('tabindex', -1)
- .on('click', click);
- };
+ // modules/ui/panes/background.js
+ function uiPaneBackground(context) {
+ var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.html("background.title")).description(_t.html("background.description")).iconName("iD-icon-layers").sections([
+ uiSectionBackgroundList(context),
+ uiSectionOverlayList(context),
+ uiSectionBackgroundDisplayOptions(context),
+ uiSectionBackgroundOffset(context)
+ ]);
+ return backgroundPane;
+ }
- sourceSwitch.keys = function(_) {
- if (!arguments.length) return keys;
- keys = _;
- return sourceSwitch;
+ // modules/ui/panes/help.js
+ function uiPaneHelp(context) {
+ var docKeys = [
+ ["help", [
+ "welcome",
+ "open_data_h",
+ "open_data",
+ "before_start_h",
+ "before_start",
+ "open_source_h",
+ "open_source",
+ "open_source_help"
+ ]],
+ ["overview", [
+ "navigation_h",
+ "navigation_drag",
+ "navigation_zoom",
+ "features_h",
+ "features",
+ "nodes_ways"
+ ]],
+ ["editing", [
+ "select_h",
+ "select_left_click",
+ "select_right_click",
+ "select_space",
+ "multiselect_h",
+ "multiselect",
+ "multiselect_shift_click",
+ "multiselect_lasso",
+ "undo_redo_h",
+ "undo_redo",
+ "save_h",
+ "save",
+ "save_validation",
+ "upload_h",
+ "upload",
+ "backups_h",
+ "backups",
+ "keyboard_h",
+ "keyboard"
+ ]],
+ ["feature_editor", [
+ "intro",
+ "definitions",
+ "type_h",
+ "type",
+ "type_picker",
+ "fields_h",
+ "fields_all_fields",
+ "fields_example",
+ "fields_add_field",
+ "tags_h",
+ "tags_all_tags",
+ "tags_resources"
+ ]],
+ ["points", [
+ "intro",
+ "add_point_h",
+ "add_point",
+ "add_point_finish",
+ "move_point_h",
+ "move_point",
+ "delete_point_h",
+ "delete_point",
+ "delete_point_command"
+ ]],
+ ["lines", [
+ "intro",
+ "add_line_h",
+ "add_line",
+ "add_line_draw",
+ "add_line_continue",
+ "add_line_finish",
+ "modify_line_h",
+ "modify_line_dragnode",
+ "modify_line_addnode",
+ "connect_line_h",
+ "connect_line",
+ "connect_line_display",
+ "connect_line_drag",
+ "connect_line_tag",
+ "disconnect_line_h",
+ "disconnect_line_command",
+ "move_line_h",
+ "move_line_command",
+ "move_line_connected",
+ "delete_line_h",
+ "delete_line",
+ "delete_line_command"
+ ]],
+ ["areas", [
+ "intro",
+ "point_or_area_h",
+ "point_or_area",
+ "add_area_h",
+ "add_area_command",
+ "add_area_draw",
+ "add_area_continue",
+ "add_area_finish",
+ "square_area_h",
+ "square_area_command",
+ "modify_area_h",
+ "modify_area_dragnode",
+ "modify_area_addnode",
+ "delete_area_h",
+ "delete_area",
+ "delete_area_command"
+ ]],
+ ["relations", [
+ "intro",
+ "edit_relation_h",
+ "edit_relation",
+ "edit_relation_add",
+ "edit_relation_delete",
+ "maintain_relation_h",
+ "maintain_relation",
+ "relation_types_h",
+ "multipolygon_h",
+ "multipolygon",
+ "multipolygon_create",
+ "multipolygon_merge",
+ "turn_restriction_h",
+ "turn_restriction",
+ "turn_restriction_field",
+ "turn_restriction_editing",
+ "route_h",
+ "route",
+ "route_add",
+ "boundary_h",
+ "boundary",
+ "boundary_add"
+ ]],
+ ["operations", [
+ "intro",
+ "intro_2",
+ "straighten",
+ "orthogonalize",
+ "circularize",
+ "move",
+ "rotate",
+ "reflect",
+ "continue",
+ "reverse",
+ "disconnect",
+ "split",
+ "extract",
+ "merge",
+ "delete",
+ "downgrade",
+ "copy_paste"
+ ]],
+ ["notes", [
+ "intro",
+ "add_note_h",
+ "add_note",
+ "place_note",
+ "move_note",
+ "update_note_h",
+ "update_note",
+ "save_note_h",
+ "save_note"
+ ]],
+ ["imagery", [
+ "intro",
+ "sources_h",
+ "choosing",
+ "sources",
+ "offsets_h",
+ "offset",
+ "offset_change"
+ ]],
+ ["streetlevel", [
+ "intro",
+ "using_h",
+ "using",
+ "photos",
+ "viewer"
+ ]],
+ ["gps", [
+ "intro",
+ "survey",
+ "using_h",
+ "using",
+ "tracing",
+ "upload"
+ ]],
+ ["qa", [
+ "intro",
+ "tools_h",
+ "tools",
+ "issues_h",
+ "issues"
+ ]]
+ ];
+ var headings = {
+ "help.help.open_data_h": 3,
+ "help.help.before_start_h": 3,
+ "help.help.open_source_h": 3,
+ "help.overview.navigation_h": 3,
+ "help.overview.features_h": 3,
+ "help.editing.select_h": 3,
+ "help.editing.multiselect_h": 3,
+ "help.editing.undo_redo_h": 3,
+ "help.editing.save_h": 3,
+ "help.editing.upload_h": 3,
+ "help.editing.backups_h": 3,
+ "help.editing.keyboard_h": 3,
+ "help.feature_editor.type_h": 3,
+ "help.feature_editor.fields_h": 3,
+ "help.feature_editor.tags_h": 3,
+ "help.points.add_point_h": 3,
+ "help.points.move_point_h": 3,
+ "help.points.delete_point_h": 3,
+ "help.lines.add_line_h": 3,
+ "help.lines.modify_line_h": 3,
+ "help.lines.connect_line_h": 3,
+ "help.lines.disconnect_line_h": 3,
+ "help.lines.move_line_h": 3,
+ "help.lines.delete_line_h": 3,
+ "help.areas.point_or_area_h": 3,
+ "help.areas.add_area_h": 3,
+ "help.areas.square_area_h": 3,
+ "help.areas.modify_area_h": 3,
+ "help.areas.delete_area_h": 3,
+ "help.relations.edit_relation_h": 3,
+ "help.relations.maintain_relation_h": 3,
+ "help.relations.relation_types_h": 2,
+ "help.relations.multipolygon_h": 3,
+ "help.relations.turn_restriction_h": 3,
+ "help.relations.route_h": 3,
+ "help.relations.boundary_h": 3,
+ "help.notes.add_note_h": 3,
+ "help.notes.update_note_h": 3,
+ "help.notes.save_note_h": 3,
+ "help.imagery.sources_h": 3,
+ "help.imagery.offsets_h": 3,
+ "help.streetlevel.using_h": 3,
+ "help.gps.using_h": 3,
+ "help.qa.tools_h": 3,
+ "help.qa.issues_h": 3
};
-
- return sourceSwitch;
-};
-iD.ui.Spinner = function(context) {
- var connection = context.connection();
-
- return function(selection) {
- var img = selection.append('img')
- .attr('src', context.imagePath('loader-black.gif'))
- .style('opacity', 0);
-
- connection.on('loading.spinner', function() {
- img.transition()
- .style('opacity', 1);
- });
-
- connection.on('loaded.spinner', function() {
- img.transition()
- .style('opacity', 0);
+ var docs = docKeys.map(function(key) {
+ var helpkey = "help." + key[0];
+ var helpPaneReplacements = { version: context.version };
+ var text2 = key[1].reduce(function(all, part) {
+ var subkey = helpkey + "." + part;
+ var depth = headings[subkey];
+ var hhh = depth ? Array(depth + 1).join("#") + " " : "";
+ return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
+ }, "");
+ return {
+ title: _t.html(helpkey + ".title"),
+ content: marked(text2.trim()).replace(//g, "").replace(/<\/code>/g, "")
+ };
+ });
+ var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.html("help.title")).description(_t.html("help.title")).iconName("iD-icon-help");
+ helpPane.renderContent = function(content) {
+ function clickHelp(d, i2) {
+ var rtl = _mainLocalizer.textDirection() === "rtl";
+ content.property("scrollTop", 0);
+ helpPane.selection().select(".pane-heading h2").html(d.title);
+ body.html(d.content);
+ body.selectAll("a").attr("target", "_blank");
+ menuItems.classed("selected", function(m) {
+ return m.title === d.title;
});
- };
-};
-iD.ui.Splash = function(context) {
- return function(selection) {
- if (context.storage('sawSplash'))
- return;
-
- context.storage('sawSplash', true);
-
- var modal = iD.ui.modal(selection);
-
- modal.select('.modal')
- .attr('class', 'modal-splash modal col6');
-
- var introModal = modal.select('.content')
- .append('div')
- .attr('class', 'fillL');
-
- introModal.append('div')
- .attr('class','modal-section cf')
- .append('h3').text(t('splash.welcome'));
-
- introModal.append('div')
- .attr('class','modal-section')
- .append('p')
- .html(t('splash.text', {
- version: iD.version,
- website: 'ideditor.com',
- github: 'github.com'
- }));
-
- var buttons = introModal.append('div').attr('class', 'modal-actions cf');
-
- buttons.append('button')
- .attr('class', 'col6 walkthrough')
- .text(t('splash.walkthrough'))
- .on('click', function() {
- d3.select(document.body).call(iD.ui.intro(context));
- modal.close();
+ nav.html("");
+ if (rtl) {
+ nav.call(drawNext).call(drawPrevious);
+ } else {
+ nav.call(drawPrevious).call(drawNext);
+ }
+ function drawNext(selection2) {
+ if (i2 < docs.length - 1) {
+ var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ clickHelp(docs[i2 + 1], i2 + 1);
});
-
- buttons.append('button')
- .attr('class', 'col6 start')
- .text(t('splash.start'))
- .on('click', modal.close);
-
- modal.select('button.close').attr('class','hide');
-
- };
-};
-iD.ui.Status = function(context) {
- var connection = context.connection(),
- errCount = 0;
-
- return function(selection) {
-
- function update() {
-
- connection.status(function(err, apiStatus) {
-
- selection.html('');
-
- if (err && errCount++ < 2) return;
-
- if (err) {
- selection.text(t('status.error'));
-
- } else if (apiStatus === 'readonly') {
- selection.text(t('status.readonly'));
-
- } else if (apiStatus === 'offline') {
- selection.text(t('status.offline'));
- }
-
- selection.attr('class', 'api-status ' + (err ? 'error' : apiStatus));
- if (!err) errCount = 0;
-
+ nextLink.append("span").html(docs[i2 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
+ }
+ }
+ function drawPrevious(selection2) {
+ if (i2 > 0) {
+ var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
+ d3_event.preventDefault();
+ clickHelp(docs[i2 - 1], i2 - 1);
});
+ prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i2 - 1].title);
+ }
}
+ }
+ function clickWalkthrough(d3_event) {
+ d3_event.preventDefault();
+ if (context.inIntro())
+ return;
+ context.container().call(uiIntro(context));
+ context.ui().togglePanes();
+ }
+ function clickShortcuts(d3_event) {
+ d3_event.preventDefault();
+ context.container().call(context.ui().shortcuts, true);
+ }
+ var toc = content.append("ul").attr("class", "toc");
+ var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d) {
+ return d.title;
+ }).on("click", function(d3_event, d) {
+ d3_event.preventDefault();
+ clickHelp(d, docs.indexOf(d));
+ });
+ var shortcuts = toc.append("li").attr("class", "shortcuts").call(uiTooltip().title(_t.html("shortcuts.tooltip")).keys(["?"]).placement("top")).append("a").attr("href", "#").on("click", clickShortcuts);
+ shortcuts.append("div").call(_t.append("shortcuts.title"));
+ var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
+ walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
+ walkthrough.append("div").call(_t.append("splash.walkthrough"));
+ var helpContent = content.append("div").attr("class", "left-content");
+ var body = helpContent.append("div").attr("class", "body");
+ var nav = helpContent.append("div").attr("class", "nav");
+ clickHelp(docs[0], 0);
+ };
+ return helpPane;
+ }
- connection.on('auth', function() { update(selection); });
- window.setInterval(update, 90000);
- update(selection);
- };
-};
-iD.ui.Success = function(context) {
- var dispatch = d3.dispatch('cancel'),
- changeset;
-
- function success(selection) {
- var message = (changeset.comment || t('success.edited_osm')).substring(0, 130) +
- ' ' + context.connection().changesetURL(changeset.id);
-
- var header = selection.append('div')
- .attr('class', 'header fillL');
-
- header.append('button')
- .attr('class', 'fr')
- .on('click', function() { dispatch.cancel(); })
- .call(iD.svg.Icon('#icon-close'));
-
- header.append('h3')
- .text(t('success.just_edited'));
-
- var body = selection.append('div')
- .attr('class', 'body save-success fillL');
-
- body.append('p')
- .html(t('success.help_html'));
-
- body.append('a')
- .attr('class', 'details')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-out-link', 'inline'))
- .attr('href', t('success.help_link_url'))
- .append('span')
- .text(t('success.help_link_text'));
-
- var changesetURL = context.connection().changesetURL(changeset.id);
-
- body.append('a')
- .attr('class', 'button col12 osm')
- .attr('target', '_blank')
- .attr('href', changesetURL)
- .text(t('success.view_on_osm'));
-
- var sharing = {
- facebook: 'https://facebook.com/sharer/sharer.php?u=' + encodeURIComponent(changesetURL),
- twitter: 'https://twitter.com/intent/tweet?source=webclient&text=' + encodeURIComponent(message),
- google: 'https://plus.google.com/share?url=' + encodeURIComponent(changesetURL)
- };
-
- body.selectAll('.button.social')
- .data(d3.entries(sharing))
- .enter()
- .append('a')
- .attr('class', 'button social col4')
- .attr('target', '_blank')
- .attr('href', function(d) { return d.value; })
- .call(bootstrap.tooltip()
- .title(function(d) { return t('success.' + d.key); })
- .placement('bottom'))
- .each(function(d) { d3.select(this).call(iD.svg.Icon('#logo-' + d.key, 'social')); });
- }
-
- success.changeset = function(_) {
- if (!arguments.length) return changeset;
- changeset = _;
- return success;
- };
-
- return d3.rebind(success, dispatch, 'on');
-};
-iD.ui.TagReference = function(tag, context) {
- var tagReference = {},
- button,
- body,
- loaded,
- showing;
-
- function findLocal(data) {
- var locale = iD.detect().locale.toLowerCase(),
- localized;
-
- localized = _.find(data, function(d) {
- return d.lang.toLowerCase() === locale;
- });
- if (localized) return localized;
-
- // try the non-regional version of a language, like
- // 'en' if the language is 'en-US'
- if (locale.indexOf('-') !== -1) {
- var first = locale.split('-')[0];
- localized = _.find(data, function(d) {
- return d.lang.toLowerCase() === first;
- });
- if (localized) return localized;
+ // modules/ui/sections/validation_issues.js
+ function uiSectionValidationIssues(id2, severity, context) {
+ var _issues = [];
+ var section = uiSection(id2, context).label(function() {
+ if (!_issues)
+ return "";
+ var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
+ return _t.html("inspector.title_count", { title: { html: _t.html("issues." + severity + "s.list_title") }, count: issueCountText });
+ }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
+ return _issues && _issues.length;
+ });
+ function getOptions() {
+ return {
+ what: corePreferences("validate-what") || "edited",
+ where: corePreferences("validate-where") || "all"
+ };
+ }
+ function reloadIssues() {
+ _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
+ }
+ function renderDisclosureContent(selection2) {
+ var center = context.map().center();
+ var graph = context.graph();
+ var issues = _issues.map(function withDistance(issue) {
+ var extent = issue.extent(graph);
+ var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
+ return Object.assign(issue, { dist });
+ }).sort(function byDistance(a, b) {
+ return a.dist - b.dist;
+ });
+ issues = issues.slice(0, 1e3);
+ selection2.call(drawIssuesList, issues);
+ }
+ function drawIssuesList(selection2, issues) {
+ var list = selection2.selectAll(".issues-list").data([0]);
+ list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
+ var items = list.selectAll("li").data(issues, function(d) {
+ return d.key;
+ });
+ items.exit().remove();
+ var itemsEnter = items.enter().append("li").attr("class", function(d) {
+ return "issue severity-" + d.severity;
+ });
+ var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d) {
+ context.validator().focusIssue(d);
+ }).on("mouseover", function(d3_event, d) {
+ utilHighlightEntities(d.entityIds, true, context);
+ }).on("mouseout", function(d3_event, d) {
+ utilHighlightEntities(d.entityIds, false, context);
+ });
+ var textEnter = labelsEnter.append("span").attr("class", "issue-text");
+ textEnter.append("span").attr("class", "issue-icon").each(function(d) {
+ var iconName = "#iD-icon-" + (d.severity === "warning" ? "alert" : "error");
+ select_default2(this).call(svgIcon(iconName));
+ });
+ textEnter.append("span").attr("class", "issue-message");
+ items = items.merge(itemsEnter).order();
+ items.selectAll(".issue-message").html(function(d) {
+ return d.message(context);
+ });
+ }
+ context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
+ window.requestIdleCallback(function() {
+ reloadIssues();
+ section.reRender();
+ });
+ });
+ context.map().on("move.uiSectionValidationIssues" + id2, debounce_default(function() {
+ window.requestIdleCallback(function() {
+ if (getOptions().where === "visible") {
+ reloadIssues();
}
+ section.reRender();
+ });
+ }, 1e3));
+ return section;
+ }
- // finally fall back to english
- return _.find(data, function(d) {
- return d.lang.toLowerCase() === 'en';
+ // modules/ui/sections/validation_options.js
+ function uiSectionValidationOptions(context) {
+ var section = uiSection("issues-options", context).content(renderContent);
+ function renderContent(selection2) {
+ var container = selection2.selectAll(".issues-options-container").data([0]);
+ container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
+ var data = [
+ { key: "what", values: ["edited", "all"] },
+ { key: "where", values: ["visible", "all"] }
+ ];
+ var options2 = container.selectAll(".issues-option").data(data, function(d) {
+ return d.key;
+ });
+ var optionsEnter = options2.enter().append("div").attr("class", function(d) {
+ return "issues-option issues-option-" + d.key;
+ });
+ optionsEnter.append("div").attr("class", "issues-option-title").html(function(d) {
+ return _t.html("issues.options." + d.key + ".title");
+ });
+ var valuesEnter = optionsEnter.selectAll("label").data(function(d) {
+ return d.values.map(function(val) {
+ return { value: val, key: d.key };
});
+ }).enter().append("label");
+ valuesEnter.append("input").attr("type", "radio").attr("name", function(d) {
+ return "issues-option-" + d.key;
+ }).attr("value", function(d) {
+ return d.value;
+ }).property("checked", function(d) {
+ return getOptions()[d.key] === d.value;
+ }).on("change", function(d3_event, d) {
+ updateOptionValue(d3_event, d.key, d.value);
+ });
+ valuesEnter.append("span").html(function(d) {
+ return _t.html("issues.options." + d.key + "." + d.value);
+ });
}
+ function getOptions() {
+ return {
+ what: corePreferences("validate-what") || "edited",
+ where: corePreferences("validate-where") || "all"
+ };
+ }
+ function updateOptionValue(d3_event, d, val) {
+ if (!val && d3_event && d3_event.target) {
+ val = d3_event.target.value;
+ }
+ corePreferences("validate-" + d, val);
+ context.validator().validate();
+ }
+ return section;
+ }
- function load(param) {
- button.classed('tag-reference-loading', true);
-
- context.taginfo().docs(param, function show(err, data) {
- var docs;
- if (!err && data) {
- docs = findLocal(data);
- }
-
- body.html('');
-
- if (!docs || !docs.description) {
- if (param.hasOwnProperty('value')) {
- load(_.omit(param, 'value')); // retry with key only
- } else {
- body.append('p').text(t('inspector.no_documentation_key'));
- done();
- }
- return;
- }
-
- if (docs.image && docs.image.thumb_url_prefix) {
- body
- .append('img')
- .attr('class', 'wiki-image')
- .attr('src', docs.image.thumb_url_prefix + '100' + docs.image.thumb_url_suffix)
- .on('load', function() { done(); })
- .on('error', function() { d3.select(this).remove(); done(); });
- } else {
- done();
- }
-
- body
- .append('p')
- .text(docs.description);
+ // modules/ui/sections/validation_rules.js
+ function uiSectionValidationRules(context) {
+ var MINSQUARE = 0;
+ var MAXSQUARE = 20;
+ var DEFAULTSQUARE = 5;
+ var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(_t.html("issues.rules.title"));
+ var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
+ return key !== "maprules";
+ }).sort(function(key1, key2) {
+ return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
+ });
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".issues-rulelist-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
+ containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
+ var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
+ ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.validator().disableRules(_ruleKeys);
+ });
+ ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.validator().disableRules([]);
+ });
+ container = container.merge(containerEnter);
+ container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
+ }
+ function drawListItems(selection2, data, type3, name2, change, active) {
+ var items = selection2.selectAll("li").data(data);
+ items.exit().remove();
+ var enter = items.enter().append("li");
+ if (name2 === "rule") {
+ enter.call(uiTooltip().title(function(d) {
+ return _t.html("issues." + d + ".tip");
+ }).placement("top"));
+ }
+ var label = enter.append("label");
+ label.append("input").attr("type", type3).attr("name", name2).on("change", change);
+ label.append("span").html(function(d) {
+ var params = {};
+ if (d === "unsquare_way") {
+ params.val = { html: '' };
+ }
+ return _t.html("issues." + d + ".title", params);
+ });
+ items = items.merge(enter);
+ items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
+ var degStr = corePreferences("validate-square-degrees");
+ if (degStr === null) {
+ degStr = DEFAULTSQUARE.toString();
+ }
+ var span = items.selectAll(".square-degrees");
+ var input = span.selectAll(".square-degrees-input").data([0]);
+ input.enter().append("input").attr("type", "number").attr("min", MINSQUARE.toString()).attr("max", MAXSQUARE.toString()).attr("step", "0.5").attr("class", "square-degrees-input").call(utilNoAuto).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ this.select();
+ }).on("keyup", function(d3_event) {
+ if (d3_event.keyCode === 13) {
+ this.blur();
+ this.select();
+ }
+ }).on("blur", changeSquare).merge(input).property("value", degStr);
+ }
+ function changeSquare() {
+ var input = select_default2(this);
+ var degStr = utilGetSetValue(input).trim();
+ var degNum = parseFloat(degStr, 10);
+ if (!isFinite(degNum)) {
+ degNum = DEFAULTSQUARE;
+ } else if (degNum > MAXSQUARE) {
+ degNum = MAXSQUARE;
+ } else if (degNum < MINSQUARE) {
+ degNum = MINSQUARE;
+ }
+ degNum = Math.round(degNum * 10) / 10;
+ degStr = degNum.toString();
+ input.property("value", degStr);
+ corePreferences("validate-square-degrees", degStr);
+ context.validator().revalidateUnsquare();
+ }
+ function isRuleEnabled(d) {
+ return context.validator().isRuleEnabled(d);
+ }
+ function toggleRule(d3_event, d) {
+ context.validator().toggleRule(d);
+ }
+ context.validator().on("validated.uiSectionValidationRules", function() {
+ window.requestIdleCallback(section.reRender);
+ });
+ return section;
+ }
- body
- .append('a')
- .attr('target', '_blank')
- .attr('tabindex', -1)
- .attr('href', 'https://wiki.openstreetmap.org/wiki/' + docs.title)
- .call(iD.svg.Icon('#icon-out-link', 'inline'))
- .append('span')
- .text(t('inspector.reference'));
+ // modules/ui/sections/validation_status.js
+ function uiSectionValidationStatus(context) {
+ var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
+ var issues = context.validator().getIssues(getOptions());
+ return issues.length === 0;
+ });
+ function getOptions() {
+ return {
+ what: corePreferences("validate-what") || "edited",
+ where: corePreferences("validate-where") || "all"
+ };
+ }
+ function renderContent(selection2) {
+ var box = selection2.selectAll(".box").data([0]);
+ var boxEnter = box.enter().append("div").attr("class", "box");
+ boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
+ var noIssuesMessage = boxEnter.append("span");
+ noIssuesMessage.append("strong").attr("class", "message");
+ noIssuesMessage.append("br");
+ noIssuesMessage.append("span").attr("class", "details");
+ renderIgnoredIssuesReset(selection2);
+ setNoIssuesText(selection2);
+ }
+ function renderIgnoredIssuesReset(selection2) {
+ var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
+ var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
+ resetIgnored.exit().remove();
+ var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
+ resetIgnoredEnter.append("a").attr("href", "#");
+ resetIgnored = resetIgnored.merge(resetIgnoredEnter);
+ resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
+ resetIgnored.on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.validator().resetIgnoredIssues();
+ });
+ }
+ function setNoIssuesText(selection2) {
+ var opts = getOptions();
+ function checkForHiddenIssues(cases) {
+ for (var type3 in cases) {
+ var hiddenOpts = cases[type3];
+ var hiddenIssues = context.validator().getIssues(hiddenOpts);
+ if (hiddenIssues.length) {
+ selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues." + type3, { count: hiddenIssues.length.toString() }));
+ return;
+ }
+ }
+ selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
+ }
+ var messageType;
+ if (opts.what === "edited" && opts.where === "visible") {
+ messageType = "edits_in_view";
+ checkForHiddenIssues({
+ elsewhere: { what: "edited", where: "all" },
+ everything_else: { what: "all", where: "visible" },
+ disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
+ everything_else_elsewhere: { what: "all", where: "all" },
+ disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
+ ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
});
+ } else if (opts.what === "edited" && opts.where === "all") {
+ messageType = "edits";
+ checkForHiddenIssues({
+ everything_else: { what: "all", where: "all" },
+ disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
+ });
+ } else if (opts.what === "all" && opts.where === "visible") {
+ messageType = "everything_in_view";
+ checkForHiddenIssues({
+ elsewhere: { what: "all", where: "all" },
+ disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
+ disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
+ ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
+ });
+ } else if (opts.what === "all" && opts.where === "all") {
+ messageType = "everything";
+ checkForHiddenIssues({
+ disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
+ ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
+ });
+ }
+ if (opts.what === "edited" && context.history().difference().summary().length === 0) {
+ messageType = "no_edits";
+ }
+ selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
}
+ context.validator().on("validated.uiSectionValidationStatus", function() {
+ window.requestIdleCallback(section.reRender);
+ });
+ context.map().on("move.uiSectionValidationStatus", debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3));
+ return section;
+ }
- function done() {
- loaded = true;
-
- button.classed('tag-reference-loading', false);
+ // modules/ui/panes/issues.js
+ function uiPaneIssues(context) {
+ var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.html("issues.title")).description(_t.html("issues.title")).iconName("iD-icon-alert").sections([
+ uiSectionValidationOptions(context),
+ uiSectionValidationStatus(context),
+ uiSectionValidationIssues("issues-errors", "error", context),
+ uiSectionValidationIssues("issues-warnings", "warning", context),
+ uiSectionValidationRules(context)
+ ]);
+ return issuesPane;
+ }
- body.transition()
- .duration(200)
- .style('max-height', '200px')
- .style('opacity', '1');
+ // modules/ui/settings/custom_data.js
+ function uiSettingsCustomData(context) {
+ var dispatch10 = dispatch_default("change");
+ function render(selection2) {
+ var dataLayer = context.layers().layer("data");
+ var _origSettings = {
+ fileList: dataLayer && dataLayer.fileList() || null,
+ url: corePreferences("settings-custom-data-url")
+ };
+ var _currSettings = {
+ fileList: dataLayer && dataLayer.fileList() || null,
+ url: corePreferences("settings-custom-data-url")
+ };
+ var modal = uiConfirm(selection2).okButton();
+ modal.classed("settings-modal settings-custom-data", true);
+ modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
+ var textSection = modal.select(".modal-section.message-text");
+ textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
+ textSection.append("input").attr("class", "field-file").attr("type", "file").attr("accept", ".gpx,.kml,.geojson,.json,application/gpx+xml,application/vnd.google-earth.kml+xml,application/geo+json,application/json").property("files", _currSettings.fileList).on("change", function(d3_event) {
+ var files = d3_event.target.files;
+ if (files && files.length) {
+ _currSettings.url = "";
+ textSection.select(".field-url").property("value", "");
+ _currSettings.fileList = files;
+ } else {
+ _currSettings.fileList = null;
+ }
+ });
+ textSection.append("h4").call(_t.append("settings.custom_data.or"));
+ textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
+ textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
+ var buttonSection = modal.select(".modal-section.buttons");
+ buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
+ buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
+ buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
+ function isSaveDisabled() {
+ return null;
+ }
+ function clickCancel() {
+ textSection.select(".field-url").property("value", _origSettings.url);
+ corePreferences("settings-custom-data-url", _origSettings.url);
+ this.blur();
+ modal.close();
+ }
+ function clickSave() {
+ _currSettings.url = textSection.select(".field-url").property("value").trim();
+ if (_currSettings.url) {
+ _currSettings.fileList = null;
+ }
+ if (_currSettings.fileList) {
+ _currSettings.url = "";
+ }
+ corePreferences("settings-custom-data-url", _currSettings.url);
+ this.blur();
+ modal.close();
+ dispatch10.call("change", this, _currSettings);
+ }
+ }
+ return utilRebind(render, dispatch10, "on");
+ }
- showing = true;
+ // modules/ui/sections/data_layers.js
+ function uiSectionDataLayers(context) {
+ var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
+ var layers = context.layers();
+ var section = uiSection("data-layers", context).label(_t.html("map_data.data_layers")).disclosureContent(renderDisclosureContent);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".data-layer-container").data([0]);
+ container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
+ }
+ function showsLayer(which) {
+ var layer = layers.layer(which);
+ if (layer) {
+ return layer.enabled();
+ }
+ return false;
+ }
+ function setLayer(which, enabled) {
+ var mode = context.mode();
+ if (mode && /^draw/.test(mode.id))
+ return;
+ var layer = layers.layer(which);
+ if (layer) {
+ layer.enabled(enabled);
+ if (!enabled && (which === "osm" || which === "notes")) {
+ context.enter(modeBrowse(context));
+ }
+ }
+ }
+ function toggleLayer(which) {
+ setLayer(which, !showsLayer(which));
+ }
+ function drawOsmItems(selection2) {
+ var osmKeys = ["osm", "notes"];
+ var osmLayers = layers.all().filter(function(obj) {
+ return osmKeys.indexOf(obj.id) !== -1;
+ });
+ var ul = selection2.selectAll(".layer-list-osm").data([0]);
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
+ var li = ul.selectAll(".list-item").data(osmLayers);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d) {
+ return "list-item list-item-" + d.id;
+ });
+ var labelEnter = liEnter.append("label").each(function(d) {
+ if (d.id === "osm") {
+ select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom"));
+ } else {
+ select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).placement("bottom"));
+ }
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
+ toggleLayer(d.id);
+ });
+ labelEnter.append("span").html(function(d) {
+ return _t.html("map_data.layers." + d.id + ".title");
+ });
+ li.merge(liEnter).classed("active", function(d) {
+ return d.layer.enabled();
+ }).selectAll("input").property("checked", function(d) {
+ return d.layer.enabled();
+ });
+ }
+ function drawQAItems(selection2) {
+ var qaKeys = ["keepRight", "improveOSM", "osmose"];
+ var qaLayers = layers.all().filter(function(obj) {
+ return qaKeys.indexOf(obj.id) !== -1;
+ });
+ var ul = selection2.selectAll(".layer-list-qa").data([0]);
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
+ var li = ul.selectAll(".list-item").data(qaLayers);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d) {
+ return "list-item list-item-" + d.id;
+ });
+ var labelEnter = liEnter.append("label").each(function(d) {
+ select_default2(this).call(uiTooltip().title(_t.html("map_data.layers." + d.id + ".tooltip")).placement("bottom"));
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
+ toggleLayer(d.id);
+ });
+ labelEnter.append("span").html(function(d) {
+ return _t.html("map_data.layers." + d.id + ".title");
+ });
+ li.merge(liEnter).classed("active", function(d) {
+ return d.layer.enabled();
+ }).selectAll("input").property("checked", function(d) {
+ return d.layer.enabled();
+ });
+ }
+ function drawVectorItems(selection2) {
+ var dataLayer = layers.layer("data");
+ var vtData = [
+ {
+ name: "Detroit Neighborhoods/Parks",
+ src: "neighborhoods-parks",
+ tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
+ template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmur6x34562qp9iv1u3ksf-54hev,jonahadkins.cjksmqxdx33jj2wp90xd9x2md-4e5y2/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
+ },
+ {
+ name: "Detroit Composite POIs",
+ src: "composite-poi",
+ tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
+ template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmm6a02sli31myxhsr7zf3-2sw8h/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
+ },
+ {
+ name: "Detroit All-The-Places POIs",
+ src: "alltheplaces-poi",
+ tooltip: "Public domain business location data created by web scrapers.",
+ template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmswgk340g2vo06p1w9w0j-8fjjc/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
+ }
+ ];
+ var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
+ var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
+ var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
+ container.exit().remove();
+ var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
+ containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
+ containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
+ containerEnter.append("div").attr("class", "vectortile-footer").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmus/detroit-mapping-challenge").append("span").text("About these layers");
+ container = container.merge(containerEnter);
+ var ul = container.selectAll(".layer-list-vectortile");
+ var li = ul.selectAll(".list-item").data(vtData);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d) {
+ return "list-item list-item-" + d.src;
+ });
+ var labelEnter = liEnter.append("label").each(function(d) {
+ select_default2(this).call(uiTooltip().title(d.tooltip).placement("top"));
+ });
+ labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
+ labelEnter.append("span").text(function(d) {
+ return d.name;
+ });
+ li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
+ function isVTLayerSelected(d) {
+ return dataLayer && dataLayer.template() === d.template;
+ }
+ function selectVTLayer(d3_event, d) {
+ corePreferences("settings-custom-data-url", d.template);
+ if (dataLayer) {
+ dataLayer.template(d.template, d.src);
+ dataLayer.enabled(true);
+ }
+ }
+ }
+ function drawCustomDataItems(selection2) {
+ var dataLayer = layers.layer("data");
+ var hasData = dataLayer && dataLayer.hasData();
+ var showsData = hasData && dataLayer.enabled();
+ var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
+ ul.exit().remove();
+ var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
+ var liEnter = ulEnter.append("li").attr("class", "list-item-data");
+ var labelEnter = liEnter.append("label").call(uiTooltip().title(_t.html("map_data.layers.custom.tooltip")).placement("top"));
+ labelEnter.append("input").attr("type", "checkbox").on("change", function() {
+ toggleLayer("data");
+ });
+ labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
+ liEnter.append("button").attr("class", "open-data-options").call(uiTooltip().title(_t.html("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ editCustom();
+ }).call(svgIcon("#iD-icon-more"));
+ liEnter.append("button").attr("class", "zoom-to-data").call(uiTooltip().title(_t.html("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")).on("click", function(d3_event) {
+ if (select_default2(this).classed("disabled"))
+ return;
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ dataLayer.fitZoom();
+ }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
+ ul = ul.merge(ulEnter);
+ ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
+ ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
+ }
+ function editCustom() {
+ context.container().call(settingsCustomData);
+ }
+ function customChanged(d) {
+ var dataLayer = layers.layer("data");
+ if (d && d.url) {
+ dataLayer.url(d.url);
+ } else if (d && d.fileList) {
+ dataLayer.fileList(d.fileList);
+ }
+ }
+ function drawPanelItems(selection2) {
+ var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
+ var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top"));
+ historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("history");
+ });
+ historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
+ var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(uiTooltip().title(_t.html("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top"));
+ measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
+ d3_event.preventDefault();
+ context.ui().info.toggle("measurement");
+ });
+ measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
}
+ context.layers().on("change.uiSectionDataLayers", section.reRender);
+ context.map().on("move.uiSectionDataLayers", debounce_default(function() {
+ window.requestIdleCallback(section.reRender);
+ }, 1e3));
+ return section;
+ }
- function hide(selection) {
- selection = selection || body.transition().duration(200);
+ // modules/ui/sections/map_features.js
+ function uiSectionMapFeatures(context) {
+ var _features = context.features().keys();
+ var section = uiSection("map-features", context).label(_t.html("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-feature-list-container").data([0]);
+ var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
+ containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
+ var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
+ footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.features().disableAll();
+ });
+ footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
+ d3_event.preventDefault();
+ context.features().enableAll();
+ });
+ container = container.merge(containerEnter);
+ container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
+ }
+ function drawListItems(selection2, data, type3, name2, change, active) {
+ var items = selection2.selectAll("li").data(data);
+ items.exit().remove();
+ var enter = items.enter().append("li").call(uiTooltip().title(function(d) {
+ var tip = _t.html(name2 + "." + d + ".tooltip");
+ if (autoHiddenFeature(d)) {
+ var msg = showsLayer("osm") ? _t.html("map_data.autohidden") : _t.html("map_data.osmhidden");
+ tip += "" + msg + "
";
+ }
+ return tip;
+ }).placement("top"));
+ var label = enter.append("label");
+ label.append("input").attr("type", type3).attr("name", name2).on("change", change);
+ label.append("span").html(function(d) {
+ return _t.html(name2 + "." + d + ".description");
+ });
+ items = items.merge(enter);
+ items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
+ }
+ function autoHiddenFeature(d) {
+ return context.features().autoHidden(d);
+ }
+ function showsFeature(d) {
+ return context.features().enabled(d);
+ }
+ function clickFeature(d3_event, d) {
+ context.features().toggle(d);
+ }
+ function showsLayer(id2) {
+ var layer = context.layers().layer(id2);
+ return layer && layer.enabled();
+ }
+ context.features().on("change.map_features", section.reRender);
+ return section;
+ }
- selection
- .style('max-height', '0px')
- .style('opacity', '0');
+ // modules/ui/sections/map_style_options.js
+ function uiSectionMapStyleOptions(context) {
+ var section = uiSection("fill-area", context).label(_t.html("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".layer-fill-list").data([0]);
+ container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
+ var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
+ container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
+ return context.surface().classed("highlight-edited");
+ });
+ }
+ function drawListItems(selection2, data, type3, name2, change, active) {
+ var items = selection2.selectAll("li").data(data);
+ items.exit().remove();
+ var enter = items.enter().append("li").call(uiTooltip().title(function(d) {
+ return _t.html(name2 + "." + d + ".tooltip");
+ }).keys(function(d) {
+ var key = d === "wireframe" ? _t("area_fill.wireframe.key") : null;
+ if (d === "highlight_edits")
+ key = _t("map_data.highlight_edits.key");
+ return key ? [key] : null;
+ }).placement("top"));
+ var label = enter.append("label");
+ label.append("input").attr("type", type3).attr("name", name2).on("change", change);
+ label.append("span").html(function(d) {
+ return _t.html(name2 + "." + d + ".description");
+ });
+ items = items.merge(enter);
+ items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
+ }
+ function isActiveFill(d) {
+ return context.map().activeAreaFill() === d;
+ }
+ function toggleHighlightEdited(d3_event) {
+ d3_event.preventDefault();
+ context.map().toggleHighlightEdited();
+ }
+ function setFill(d3_event, d) {
+ context.map().activeAreaFill(d);
+ }
+ context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
+ return section;
+ }
- showing = false;
+ // modules/ui/sections/photo_overlays.js
+ function uiSectionPhotoOverlays(context) {
+ var layers = context.layers();
+ var section = uiSection("photo-overlays", context).label(_t.html("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
+ function renderDisclosureContent(selection2) {
+ var container = selection2.selectAll(".photo-overlay-container").data([0]);
+ container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter);
+ }
+ function drawPhotoItems(selection2) {
+ var photoKeys = context.photos().overlayLayerIDs();
+ var photoLayers = layers.all().filter(function(obj) {
+ return photoKeys.indexOf(obj.id) !== -1;
+ });
+ var data = photoLayers.filter(function(obj) {
+ return obj.layer.supported();
+ });
+ function layerSupported(d) {
+ return d.layer && d.layer.supported();
+ }
+ function layerEnabled(d) {
+ return layerSupported(d) && d.layer.enabled();
+ }
+ var ul = selection2.selectAll(".layer-list-photos").data([0]);
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
+ var li = ul.selectAll(".list-item-photos").data(data);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d) {
+ var classes = "list-item-photos list-item-" + d.id;
+ if (d.id === "mapillary-signs" || d.id === "mapillary-map-features") {
+ classes += " indented";
+ }
+ return classes;
+ });
+ var labelEnter = liEnter.append("label").each(function(d) {
+ var titleID;
+ if (d.id === "mapillary-signs")
+ titleID = "mapillary.signs.tooltip";
+ else if (d.id === "mapillary")
+ titleID = "mapillary_images.tooltip";
+ else if (d.id === "kartaview")
+ titleID = "kartaview_images.tooltip";
+ else
+ titleID = d.id.replace(/-/g, "_") + ".tooltip";
+ select_default2(this).call(uiTooltip().title(_t.html(titleID)).placement("top"));
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
+ toggleLayer(d.id);
+ });
+ labelEnter.append("span").html(function(d) {
+ var id2 = d.id;
+ if (id2 === "mapillary-signs")
+ id2 = "photo_overlays.traffic_signs";
+ return _t.html(id2.replace(/-/g, "_") + ".title");
+ });
+ li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("checked", layerEnabled);
+ }
+ function drawPhotoTypeItems(selection2) {
+ var data = context.photos().allPhotoTypes();
+ function typeEnabled(d) {
+ return context.photos().showsPhotoType(d);
+ }
+ var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
+ ul.exit().remove();
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
+ var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", function(d) {
+ return "list-item-photo-types list-item-" + d;
+ });
+ var labelEnter = liEnter.append("label").each(function(d) {
+ select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.photo_type." + d + ".tooltip")).placement("top"));
+ });
+ labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d) {
+ context.photos().togglePhotoType(d);
+ });
+ labelEnter.append("span").html(function(d) {
+ return _t.html("photo_overlays.photo_type." + d + ".title");
+ });
+ li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
+ }
+ function drawDateFilter(selection2) {
+ var data = context.photos().dateFilters();
+ function filterEnabled(d) {
+ return context.photos().dateFilterValue(d);
+ }
+ var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
+ ul.exit().remove();
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
+ var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
+ var labelEnter = liEnter.append("label").each(function(d) {
+ select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.date_filter." + d + ".tooltip")).placement("top"));
+ });
+ labelEnter.append("span").html(function(d) {
+ return _t.html("photo_overlays.date_filter." + d + ".title");
+ });
+ labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d) {
+ utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d) || "");
+ }).on("change", function(d3_event, d) {
+ var value = utilGetSetValue(select_default2(this)).trim();
+ context.photos().setDateFilter(d, value, true);
+ li.selectAll("input").each(function(d2) {
+ utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
+ });
+ });
+ li = li.merge(liEnter).classed("active", filterEnabled);
+ }
+ function drawUsernameFilter(selection2) {
+ function filterEnabled() {
+ return context.photos().usernames();
+ }
+ var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
+ ul.exit().remove();
+ ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
+ var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
+ li.exit().remove();
+ var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
+ var labelEnter = liEnter.append("label").each(function() {
+ select_default2(this).call(uiTooltip().title(_t.html("photo_overlays.username_filter.tooltip")).placement("top"));
+ });
+ labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
+ labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
+ var value = select_default2(this).property("value");
+ context.photos().setUsernameFilter(value, true);
+ select_default2(this).property("value", usernameValue);
+ });
+ li.merge(liEnter).classed("active", filterEnabled);
+ function usernameValue() {
+ var usernames = context.photos().usernames();
+ if (usernames)
+ return usernames.join("; ");
+ return usernames;
+ }
}
+ function toggleLayer(which) {
+ setLayer(which, !showsLayer(which));
+ }
+ function showsLayer(which) {
+ var layer = layers.layer(which);
+ if (layer) {
+ return layer.enabled();
+ }
+ return false;
+ }
+ function setLayer(which, enabled) {
+ var layer = layers.layer(which);
+ if (layer) {
+ layer.enabled(enabled);
+ }
+ }
+ context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
+ context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
+ return section;
+ }
- tagReference.button = function(selection) {
- button = selection.selectAll('.tag-reference-button')
- .data([0]);
+ // modules/ui/panes/map_data.js
+ function uiPaneMapData(context) {
+ var mapDataPane = uiPane("map-data", context).key(_t("map_data.key")).label(_t.html("map_data.title")).description(_t.html("map_data.description")).iconName("iD-icon-data").sections([
+ uiSectionDataLayers(context),
+ uiSectionPhotoOverlays(context),
+ uiSectionMapStyleOptions(context),
+ uiSectionMapFeatures(context)
+ ]);
+ return mapDataPane;
+ }
- button.enter()
- .append('button')
- .attr('class', 'tag-reference-button')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-inspect'));
+ // modules/ui/panes/preferences.js
+ function uiPanePreferences(context) {
+ let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.html("preferences.title")).description(_t.html("preferences.description")).iconName("fas-user-cog").sections([
+ uiSectionPrivacy(context)
+ ]);
+ return preferencesPane;
+ }
- button.on('click', function () {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- if (showing) {
- hide();
- } else if (loaded) {
- done();
- } else {
- if (context.taginfo()) {
- load(tag);
- }
- }
+ // modules/ui/init.js
+ function uiInit(context) {
+ var _initCounter = 0;
+ var _needWidth = {};
+ var _lastPointerType;
+ function render(container) {
+ container.on("click.ui", function(d3_event) {
+ if (d3_event.button !== 0)
+ return;
+ if (!d3_event.composedPath)
+ return;
+ var isOkayTarget = d3_event.composedPath().some(function(node) {
+ return node.nodeType === 1 && (node.nodeName === "INPUT" || node.nodeName === "LABEL" || node.nodeName === "A");
+ });
+ if (isOkayTarget)
+ return;
+ d3_event.preventDefault();
+ });
+ var detected = utilDetect();
+ if ("GestureEvent" in window && !detected.isMobileWebKit) {
+ container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
+ d3_event.preventDefault();
+ });
+ }
+ if ("PointerEvent" in window) {
+ select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
+ var pointerType = d3_event.pointerType || "mouse";
+ if (_lastPointerType !== pointerType) {
+ _lastPointerType = pointerType;
+ container.attr("pointer", pointerType);
+ }
+ }, true);
+ } else {
+ _lastPointerType = "mouse";
+ container.attr("pointer", "mouse");
+ }
+ container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
+ container.call(uiFullScreen(context));
+ var map2 = context.map();
+ map2.redrawEnable(false);
+ map2.on("hitMinZoom.ui", function() {
+ ui.flash.iconName("#iD-icon-no").label(_t.html("cannot_zoom"))();
+ });
+ container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
+ container.append("div").attr("class", "sidebar").call(ui.sidebar);
+ var content = container.append("div").attr("class", "main-content active");
+ content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
+ content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
+ var overMap = content.append("div").attr("class", "over-map");
+ overMap.append("div").attr("class", "select-trap").text("t");
+ overMap.call(uiMapInMap(context)).call(uiNotice(context));
+ overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
+ var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
+ var controls = controlsWrap.append("div").attr("class", "map-controls");
+ controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
+ controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
+ controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
+ controlsWrap.on("wheel.mapControls", function(d3_event) {
+ if (!d3_event.deltaX) {
+ controlsWrap.node().scrollTop += d3_event.deltaY;
+ }
+ });
+ var panes = overMap.append("div").attr("class", "map-panes");
+ var uiPanes = [
+ uiPaneBackground(context),
+ uiPaneMapData(context),
+ uiPaneIssues(context),
+ uiPanePreferences(context),
+ uiPaneHelp(context)
+ ];
+ uiPanes.forEach(function(pane) {
+ controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
+ panes.call(pane.renderPane);
+ });
+ ui.info = uiInfo(context);
+ overMap.call(ui.info);
+ overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
+ overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
+ var about = content.append("div").attr("class", "map-footer");
+ about.append("div").attr("class", "api-status").call(uiStatus(context));
+ var footer = about.append("div").attr("class", "map-footer-bar fillD");
+ footer.append("div").attr("class", "flash-wrap footer-hide");
+ var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
+ footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
+ var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
+ aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
+ var apiConnections = context.apiConnections();
+ if (apiConnections && apiConnections.length > 1) {
+ aboutList.append("li").attr("class", "source-switch").call(uiSourceSwitch(context).keys(apiConnections));
+ }
+ aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
+ aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
+ var issueLinks = aboutList.append("li");
+ issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/issues").attr("aria-label", _t("report_a_bug")).call(svgIcon("#iD-icon-bug", "light")).call(uiTooltip().title(_t.html("report_a_bug")).placement("top"));
+ issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/develop/CONTRIBUTING.md#translating").attr("aria-label", _t("help_translate")).call(svgIcon("#iD-icon-translate", "light")).call(uiTooltip().title(_t.html("help_translate")).placement("top"));
+ aboutList.append("li").attr("class", "version").call(uiVersion(context));
+ if (!context.embed()) {
+ aboutList.call(uiAccount(context));
+ }
+ ui.onResize();
+ map2.redrawEnable(true);
+ ui.hash = behaviorHash(context);
+ ui.hash();
+ if (!ui.hash.hadHash) {
+ map2.centerZoom([0, 0], 2);
+ }
+ window.onbeforeunload = function() {
+ return context.save();
+ };
+ window.onunload = function() {
+ context.history().unlock();
+ };
+ select_default2(window).on("resize.editor", function() {
+ ui.onResize();
+ });
+ var panPixels = 80;
+ context.keybinding().on("\u232B", function(d3_event) {
+ d3_event.preventDefault();
+ }).on([_t("sidebar.key"), "`", "\xB2", "@"], ui.sidebar.toggle).on("\u2190", pan([panPixels, 0])).on("\u2191", pan([0, panPixels])).on("\u2192", pan([-panPixels, 0])).on("\u2193", pan([0, -panPixels])).on(uiCmd("\u2325\u2190"), pan([map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2191"), pan([0, map2.dimensions()[1]])).on(uiCmd("\u2325\u2192"), pan([-map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2193"), pan([0, -map2.dimensions()[1]])).on(uiCmd("\u2318" + _t("background.key")), function quickSwitch(d3_event) {
+ if (d3_event) {
+ d3_event.stopImmediatePropagation();
+ d3_event.preventDefault();
+ }
+ var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
+ if (previousBackground) {
+ var currentBackground = context.background().baseLayerSource();
+ corePreferences("background-last-used-toggle", currentBackground.id);
+ corePreferences("background-last-used", previousBackground.id);
+ context.background().baseLayerSource(previousBackground);
+ }
+ }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ context.map().toggleWireframe();
+ }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
+ d3_event.preventDefault();
+ d3_event.stopPropagation();
+ var mode = context.mode();
+ if (mode && /^draw/.test(mode.id))
+ return;
+ var layer = context.layers().layer("osm");
+ if (layer) {
+ layer.enabled(!layer.enabled());
+ if (!layer.enabled()) {
+ context.enter(modeBrowse(context));
+ }
+ }
+ }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
+ d3_event.preventDefault();
+ context.map().toggleHighlightEdited();
+ });
+ context.on("enter.editor", function(entered) {
+ container.classed("mode-" + entered.id, true);
+ }).on("exit.editor", function(exited) {
+ container.classed("mode-" + exited.id, false);
+ });
+ context.enter(modeBrowse(context));
+ if (!_initCounter++) {
+ if (!ui.hash.startWalkthrough) {
+ context.container().call(uiSplash(context)).call(uiRestore(context));
+ }
+ context.container().call(ui.shortcuts);
+ }
+ var osm = context.connection();
+ var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
+ if (osm && auth) {
+ osm.on("authLoading.ui", function() {
+ context.container().call(auth);
+ }).on("authDone.ui", function() {
+ auth.close();
+ });
+ }
+ _initCounter++;
+ if (ui.hash.startWalkthrough) {
+ ui.hash.startWalkthrough = false;
+ context.container().call(uiIntro(context));
+ }
+ function pan(d) {
+ return function(d3_event) {
+ if (d3_event.shiftKey)
+ return;
+ if (context.container().select(".combobox").size())
+ return;
+ d3_event.preventDefault();
+ context.map().pan(d, 100);
+ };
+ }
+ }
+ let ui = {};
+ let _loadPromise;
+ ui.ensureLoaded = () => {
+ if (_loadPromise)
+ return _loadPromise;
+ return _loadPromise = Promise.all([
+ _mainLocalizer.ensureLoaded(),
+ _mainPresetIndex.ensureLoaded()
+ ]).then(() => {
+ if (!context.container().empty())
+ render(context.container());
+ }).catch((err) => console.error(err));
+ };
+ ui.restart = function() {
+ context.keybinding().clear();
+ _loadPromise = null;
+ context.container().selectAll("*").remove();
+ ui.ensureLoaded();
+ };
+ ui.lastPointerType = function() {
+ return _lastPointerType;
+ };
+ ui.svgDefs = svgDefs(context);
+ ui.flash = uiFlash(context);
+ ui.sidebar = uiSidebar(context);
+ ui.photoviewer = uiPhotoviewer(context);
+ ui.shortcuts = uiShortcuts(context);
+ ui.onResize = function(withPan) {
+ var map2 = context.map();
+ var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
+ utilGetDimensions(context.container().select(".sidebar"), true);
+ if (withPan !== void 0) {
+ map2.redrawEnable(false);
+ map2.pan(withPan);
+ map2.redrawEnable(true);
+ }
+ map2.dimensions(mapDimensions);
+ ui.photoviewer.onMapResize();
+ ui.checkOverflow(".top-toolbar");
+ ui.checkOverflow(".map-footer-bar");
+ var resizeWindowEvent = document.createEvent("Event");
+ resizeWindowEvent.initEvent("resizeWindow", true, true);
+ document.dispatchEvent(resizeWindowEvent);
+ };
+ ui.checkOverflow = function(selector, reset) {
+ if (reset) {
+ delete _needWidth[selector];
+ }
+ var selection2 = context.container().select(selector);
+ if (selection2.empty())
+ return;
+ var scrollWidth = selection2.property("scrollWidth");
+ var clientWidth = selection2.property("clientWidth");
+ var needed = _needWidth[selector] || scrollWidth;
+ if (scrollWidth > clientWidth) {
+ selection2.classed("narrow", true);
+ if (!_needWidth[selector]) {
+ _needWidth[selector] = scrollWidth;
+ }
+ } else if (scrollWidth >= needed) {
+ selection2.classed("narrow", false);
+ }
+ };
+ ui.togglePanes = function(showPane) {
+ var hidePanes = context.container().selectAll(".map-pane.shown");
+ var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
+ hidePanes.classed("shown", false).classed("hide", true);
+ context.container().selectAll(".map-pane-control button").classed("active", false);
+ if (showPane) {
+ hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
+ context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
+ showPane.classed("shown", true).classed("hide", false);
+ if (hidePanes.empty()) {
+ showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
+ } else {
+ showPane.style(side, "0px");
+ }
+ } else {
+ hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
+ select_default2(this).classed("shown", false).classed("hide", true);
});
+ }
};
+ var _editMenu = uiEditMenu(context);
+ ui.editMenu = function() {
+ return _editMenu;
+ };
+ ui.showEditMenu = function(anchorPoint, triggerType, operations) {
+ ui.closeEditMenu();
+ if (!operations && context.mode().operations)
+ operations = context.mode().operations();
+ if (!operations || !operations.length)
+ return;
+ if (!context.map().editableDataEnabled())
+ return;
+ var surfaceNode = context.surface().node();
+ if (surfaceNode.focus) {
+ surfaceNode.focus();
+ }
+ operations.forEach(function(operation) {
+ if (operation.point)
+ operation.point(anchorPoint);
+ });
+ _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
+ context.map().supersurface.call(_editMenu);
+ };
+ ui.closeEditMenu = function() {
+ context.map().supersurface.select(".edit-menu").remove();
+ };
+ var _saveLoading = select_default2(null);
+ context.uploader().on("saveStarted.ui", function() {
+ _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
+ context.container().call(_saveLoading);
+ }).on("saveEnded.ui", function() {
+ _saveLoading.close();
+ _saveLoading = select_default2(null);
+ });
+ return ui;
+ }
- tagReference.body = function(selection) {
- body = selection.selectAll('.tag-reference-body')
- .data([0]);
-
- body.enter().append('div')
- .attr('class', 'tag-reference-body cf')
- .style('max-height', '0')
- .style('opacity', '0');
-
- if (showing === false) {
- hide(body);
+ // modules/core/context.js
+ function coreContext() {
+ const dispatch10 = dispatch_default("enter", "exit", "change");
+ let context = utilRebind({}, dispatch10, "on");
+ let _deferred2 = /* @__PURE__ */ new Set();
+ context.version = "2.21.0";
+ context.privacyVersion = "20201202";
+ context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
+ context.changeset = null;
+ let _defaultChangesetComment = context.initialHashParams.comment;
+ let _defaultChangesetSource = context.initialHashParams.source;
+ let _defaultChangesetHashtags = context.initialHashParams.hashtags;
+ context.defaultChangesetComment = function(val) {
+ if (!arguments.length)
+ return _defaultChangesetComment;
+ _defaultChangesetComment = val;
+ return context;
+ };
+ context.defaultChangesetSource = function(val) {
+ if (!arguments.length)
+ return _defaultChangesetSource;
+ _defaultChangesetSource = val;
+ return context;
+ };
+ context.defaultChangesetHashtags = function(val) {
+ if (!arguments.length)
+ return _defaultChangesetHashtags;
+ _defaultChangesetHashtags = val;
+ return context;
+ };
+ let _setsDocumentTitle = true;
+ context.setsDocumentTitle = function(val) {
+ if (!arguments.length)
+ return _setsDocumentTitle;
+ _setsDocumentTitle = val;
+ return context;
+ };
+ let _documentTitleBase = document.title;
+ context.documentTitleBase = function(val) {
+ if (!arguments.length)
+ return _documentTitleBase;
+ _documentTitleBase = val;
+ return context;
+ };
+ let _ui;
+ context.ui = () => _ui;
+ context.lastPointerType = () => _ui.lastPointerType();
+ let _keybinding = utilKeybinding("context");
+ context.keybinding = () => _keybinding;
+ select_default2(document).call(_keybinding);
+ let _connection = services.osm;
+ let _history;
+ let _validator;
+ let _uploader;
+ context.connection = () => _connection;
+ context.history = () => _history;
+ context.validator = () => _validator;
+ context.uploader = () => _uploader;
+ context.preauth = (options2) => {
+ if (_connection) {
+ _connection.switch(options2);
+ }
+ return context;
+ };
+ let _apiConnections;
+ context.apiConnections = function(val) {
+ if (!arguments.length)
+ return _apiConnections;
+ _apiConnections = val;
+ return context;
+ };
+ context.locale = function(locale2) {
+ if (!arguments.length)
+ return _mainLocalizer.localeCode();
+ _mainLocalizer.preferredLocaleCodes(locale2);
+ return context;
+ };
+ function afterLoad(cid, callback) {
+ return (err, result) => {
+ if (err) {
+ if (err.status === 400 || err.status === 401 || err.status === 403) {
+ if (_connection) {
+ _connection.logout();
+ }
+ }
+ if (typeof callback === "function") {
+ callback(err);
+ }
+ return;
+ } else if (_connection && _connection.getConnectionId() !== cid) {
+ if (typeof callback === "function") {
+ callback({ message: "Connection Switched", status: -1 });
+ }
+ return;
+ } else {
+ _history.merge(result.data, result.extent);
+ if (typeof callback === "function") {
+ callback(err, result);
+ }
+ return;
}
+ };
+ }
+ context.loadTiles = (projection2, callback) => {
+ const handle = window.requestIdleCallback(() => {
+ _deferred2.delete(handle);
+ if (_connection && context.editableDataEnabled()) {
+ const cid = _connection.getConnectionId();
+ _connection.loadTiles(projection2, afterLoad(cid, callback));
+ }
+ });
+ _deferred2.add(handle);
};
-
- tagReference.showing = function(_) {
- if (!arguments.length) return showing;
- showing = _;
- return tagReference;
+ context.loadTileAtLoc = (loc, callback) => {
+ const handle = window.requestIdleCallback(() => {
+ _deferred2.delete(handle);
+ if (_connection && context.editableDataEnabled()) {
+ const cid = _connection.getConnectionId();
+ _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
+ }
+ });
+ _deferred2.add(handle);
};
-
- return tagReference;
-};
-// toggles the visibility of ui elements, using a combination of the
-// hide class, which sets display=none, and a d3 transition for opacity.
-// this will cause blinking when called repeatedly, so check that the
-// value actually changes between calls.
-iD.ui.Toggle = function(show, callback) {
- return function(selection) {
- selection
- .style('opacity', show ? 0 : 1)
- .classed('hide', false)
- .transition()
- .style('opacity', show ? 1 : 0)
- .each('end', function() {
- d3.select(this)
- .classed('hide', !show)
- .style('opacity', null);
- if (callback) callback.apply(this);
- });
+ context.loadEntity = (entityID, callback) => {
+ if (_connection) {
+ const cid = _connection.getConnectionId();
+ _connection.loadEntity(entityID, afterLoad(cid, callback));
+ _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
+ }
};
-};
-iD.ui.UndoRedo = function(context) {
- var commands = [{
- id: 'undo',
- cmd: iD.ui.cmd('âZ'),
- action: function() { if (!(context.inIntro() || saving())) context.undo(); },
- annotation: function() { return context.history().undoAnnotation(); }
- }, {
- id: 'redo',
- cmd: iD.ui.cmd('ââ§Z'),
- action: function() {if (!(context.inIntro() || saving())) context.redo(); },
- annotation: function() { return context.history().redoAnnotation(); }
- }];
-
- function saving() {
- return context.mode().id === 'save';
+ context.zoomToEntity = (entityID, zoomTo) => {
+ context.loadEntity(entityID, (err, result) => {
+ if (err)
+ return;
+ if (zoomTo !== false) {
+ const entity = result.data.find((e) => e.id === entityID);
+ if (entity) {
+ _map.zoomTo(entity);
+ }
+ }
+ });
+ _map.on("drawn.zoomToEntity", () => {
+ if (!context.hasEntity(entityID))
+ return;
+ _map.on("drawn.zoomToEntity", null);
+ context.on("enter.zoomToEntity", null);
+ context.enter(modeSelect(context, [entityID]));
+ });
+ context.on("enter.zoomToEntity", () => {
+ if (_mode.id !== "browse") {
+ _map.on("drawn.zoomToEntity", null);
+ context.on("enter.zoomToEntity", null);
+ }
+ });
+ };
+ let _minEditableZoom = 16;
+ context.minEditableZoom = function(val) {
+ if (!arguments.length)
+ return _minEditableZoom;
+ _minEditableZoom = val;
+ if (_connection) {
+ _connection.tileZoom(val);
+ }
+ return context;
+ };
+ context.maxCharsForTagKey = () => 255;
+ context.maxCharsForTagValue = () => 255;
+ context.maxCharsForRelationRole = () => 255;
+ function cleanOsmString(val, maxChars) {
+ if (val === void 0 || val === null) {
+ val = "";
+ } else {
+ val = val.toString();
+ }
+ val = val.trim();
+ if (val.normalize)
+ val = val.normalize("NFC");
+ return utilUnicodeCharsTruncated(val, maxChars);
+ }
+ context.cleanTagKey = (val) => cleanOsmString(val, context.maxCharsForTagKey());
+ context.cleanTagValue = (val) => cleanOsmString(val, context.maxCharsForTagValue());
+ context.cleanRelationRole = (val) => cleanOsmString(val, context.maxCharsForRelationRole());
+ let _inIntro = false;
+ context.inIntro = function(val) {
+ if (!arguments.length)
+ return _inIntro;
+ _inIntro = val;
+ return context;
+ };
+ context.save = () => {
+ if (_inIntro || context.container().select(".modal").size())
+ return;
+ let canSave;
+ if (_mode && _mode.id === "save") {
+ canSave = false;
+ if (services.osm && services.osm.isChangesetInflight()) {
+ _history.clearSaved();
+ return;
+ }
+ } else {
+ canSave = context.selectedIDs().every((id2) => {
+ const entity = context.hasEntity(id2);
+ return entity && !entity.isDegenerate();
+ });
+ }
+ if (canSave) {
+ _history.save();
+ }
+ if (_history.hasChanges()) {
+ return _t("save.unsaved_changes");
+ }
+ };
+ context.debouncedSave = debounce_default(context.save, 350);
+ function withDebouncedSave(fn) {
+ return function() {
+ const result = fn.apply(_history, arguments);
+ context.debouncedSave();
+ return result;
+ };
}
-
- return function(selection) {
- var tooltip = bootstrap.tooltip()
- .placement('bottom')
- .html(true)
- .title(function (d) {
- return iD.ui.tooltipHtml(d.annotation() ?
- t(d.id + '.tooltip', {action: d.annotation()}) :
- t(d.id + '.nothing'), d.cmd);
- });
-
- var buttons = selection.selectAll('button')
- .data(commands)
- .enter().append('button')
- .attr('class', 'col6 disabled')
- .on('click', function(d) { return d.action(); })
- .call(tooltip);
-
- buttons.each(function(d) {
- d3.select(this)
- .call(iD.svg.Icon('#icon-' + d.id));
+ context.hasEntity = (id2) => _history.graph().hasEntity(id2);
+ context.entity = (id2) => _history.graph().entity(id2);
+ let _mode;
+ context.mode = () => _mode;
+ context.enter = (newMode) => {
+ if (_mode) {
+ _mode.exit();
+ dispatch10.call("exit", this, _mode);
+ }
+ _mode = newMode;
+ _mode.enter();
+ dispatch10.call("enter", this, _mode);
+ };
+ context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
+ context.activeID = () => _mode && _mode.activeID && _mode.activeID();
+ let _selectedNoteID;
+ context.selectedNoteID = function(noteID) {
+ if (!arguments.length)
+ return _selectedNoteID;
+ _selectedNoteID = noteID;
+ return context;
+ };
+ let _selectedErrorID;
+ context.selectedErrorID = function(errorID) {
+ if (!arguments.length)
+ return _selectedErrorID;
+ _selectedErrorID = errorID;
+ return context;
+ };
+ context.install = (behavior) => context.surface().call(behavior);
+ context.uninstall = (behavior) => context.surface().call(behavior.off);
+ let _copyGraph;
+ context.copyGraph = () => _copyGraph;
+ let _copyIDs = [];
+ context.copyIDs = function(val) {
+ if (!arguments.length)
+ return _copyIDs;
+ _copyIDs = val;
+ _copyGraph = _history.graph();
+ return context;
+ };
+ let _copyLonLat;
+ context.copyLonLat = function(val) {
+ if (!arguments.length)
+ return _copyLonLat;
+ _copyLonLat = val;
+ return context;
+ };
+ let _background;
+ context.background = () => _background;
+ let _features;
+ context.features = () => _features;
+ context.hasHiddenConnections = (id2) => {
+ const graph = _history.graph();
+ const entity = graph.entity(id2);
+ return _features.hasHiddenConnections(entity, graph);
+ };
+ let _photos;
+ context.photos = () => _photos;
+ let _map;
+ context.map = () => _map;
+ context.layers = () => _map.layers();
+ context.surface = () => _map.surface;
+ context.editableDataEnabled = () => _map.editableDataEnabled();
+ context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
+ context.editable = () => {
+ const mode = context.mode();
+ if (!mode || mode.id === "save")
+ return false;
+ return _map.editableDataEnabled();
+ };
+ let _debugFlags = {
+ tile: false,
+ collision: false,
+ imagery: false,
+ target: false,
+ downloaded: false
+ };
+ context.debugFlags = () => _debugFlags;
+ context.getDebug = (flag) => flag && _debugFlags[flag];
+ context.setDebug = function(flag, val) {
+ if (arguments.length === 1)
+ val = true;
+ _debugFlags[flag] = val;
+ dispatch10.call("change");
+ return context;
+ };
+ let _container = select_default2(null);
+ context.container = function(val) {
+ if (!arguments.length)
+ return _container;
+ _container = val;
+ _container.classed("ideditor", true);
+ return context;
+ };
+ context.containerNode = function(val) {
+ if (!arguments.length)
+ return context.container().node();
+ context.container(select_default2(val));
+ return context;
+ };
+ let _embed;
+ context.embed = function(val) {
+ if (!arguments.length)
+ return _embed;
+ _embed = val;
+ return context;
+ };
+ let _assetPath = "";
+ context.assetPath = function(val) {
+ if (!arguments.length)
+ return _assetPath;
+ _assetPath = val;
+ _mainFileFetcher.assetPath(val);
+ return context;
+ };
+ let _assetMap = {};
+ context.assetMap = function(val) {
+ if (!arguments.length)
+ return _assetMap;
+ _assetMap = val;
+ _mainFileFetcher.assetMap(val);
+ return context;
+ };
+ context.asset = (val) => {
+ if (/^http(s)?:\/\//i.test(val))
+ return val;
+ const filename = _assetPath + val;
+ return _assetMap[filename] || filename;
+ };
+ context.imagePath = (val) => context.asset(`img/${val}`);
+ context.reset = context.flush = () => {
+ context.debouncedSave.cancel();
+ Array.from(_deferred2).forEach((handle) => {
+ window.cancelIdleCallback(handle);
+ _deferred2.delete(handle);
+ });
+ Object.values(services).forEach((service) => {
+ if (service && typeof service.reset === "function") {
+ service.reset(context);
+ }
+ });
+ context.changeset = null;
+ _validator.reset();
+ _features.reset();
+ _history.reset();
+ _uploader.reset();
+ context.container().select(".inspector-wrap *").remove();
+ return context;
+ };
+ context.projection = geoRawMercator();
+ context.curtainProjection = geoRawMercator();
+ context.init = () => {
+ instantiateInternal();
+ initializeDependents();
+ return context;
+ function instantiateInternal() {
+ _history = coreHistory(context);
+ context.graph = _history.graph;
+ context.pauseChangeDispatch = _history.pauseChangeDispatch;
+ context.resumeChangeDispatch = _history.resumeChangeDispatch;
+ context.perform = withDebouncedSave(_history.perform);
+ context.replace = withDebouncedSave(_history.replace);
+ context.pop = withDebouncedSave(_history.pop);
+ context.overwrite = withDebouncedSave(_history.overwrite);
+ context.undo = withDebouncedSave(_history.undo);
+ context.redo = withDebouncedSave(_history.redo);
+ _validator = coreValidator(context);
+ _uploader = coreUploader(context);
+ _background = rendererBackground(context);
+ _features = rendererFeatures(context);
+ _map = rendererMap(context);
+ _photos = rendererPhotos(context);
+ _ui = uiInit(context);
+ }
+ function initializeDependents() {
+ if (context.initialHashParams.presets) {
+ _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
+ }
+ if (context.initialHashParams.locale) {
+ _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
+ }
+ _mainLocalizer.ensureLoaded();
+ _background.ensureLoaded();
+ _mainPresetIndex.ensureLoaded();
+ Object.values(services).forEach((service) => {
+ if (service && typeof service.init === "function") {
+ service.init();
+ }
});
-
- var keybinding = d3.keybinding('undo')
- .on(commands[0].cmd, function() { d3.event.preventDefault(); commands[0].action(); })
- .on(commands[1].cmd, function() { d3.event.preventDefault(); commands[1].action(); });
-
- d3.select(document)
- .call(keybinding);
-
- context.history()
- .on('change.undo_redo', update);
-
- context
- .on('enter.undo_redo', update);
-
- function update() {
- buttons
- .property('disabled', saving())
- .classed('disabled', function(d) { return !d.annotation(); })
- .each(function() {
- var selection = d3.select(this);
- if (selection.property('tooltipVisible')) {
- selection.call(tooltip.show);
- }
- });
+ _map.init();
+ _validator.init();
+ _features.init();
+ if (services.maprules && context.initialHashParams.maprules) {
+ json_default(context.initialHashParams.maprules).then((mapcss) => {
+ services.maprules.init();
+ mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
+ }).catch(() => {
+ });
+ }
+ if (!context.container().empty()) {
+ _ui.ensureLoaded().then(() => {
+ _photos.init();
+ });
}
+ }
};
-};
-iD.ui.ViewOnOSM = function(context) {
- var id;
-
- function viewOnOSM(selection) {
- var entity = context.entity(id);
-
- selection.style('display', entity.isNew() ? 'none' : null);
-
- var $link = selection.selectAll('.view-on-osm')
- .data([0]);
-
- $link.enter()
- .append('a')
- .attr('class', 'view-on-osm')
- .attr('target', '_blank')
- .call(iD.svg.Icon('#icon-out-link', 'inline'))
- .append('span')
- .text(t('inspector.view_on_osm'));
+ return context;
+ }
- $link
- .attr('href', context.connection().entityURL(entity));
+ // modules/services/nsi.js
+ var _nsiStatus = "loading";
+ var _nsi = {};
+ var buildingPreset = {
+ "building/commercial": true,
+ "building/government": true,
+ "building/hotel": true,
+ "building/retail": true,
+ "building/office": true,
+ "building/supermarket": true,
+ "building/yes": true
+ };
+ var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
+ var notBranches = /(coop|express|wireless|factory|outlet)/i;
+ function setNsiSources() {
+ const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
+ const v = (0, import_vparse2.default)(nsiVersion);
+ const vMinor = `${v.major}.${v.minor}`;
+ const sources = {
+ "nsi_data": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/nsi.min.json`,
+ "nsi_dissolved": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/dissolved.min.json`,
+ "nsi_features": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/featureCollection.min.json`,
+ "nsi_generics": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/genericWords.min.json`,
+ "nsi_presets": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/presets/nsi-id-presets.min.json`,
+ "nsi_replacements": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/replacements.min.json`,
+ "nsi_trees": `https://cdn.jsdelivr.net/npm/name-suggestion-index@${vMinor}/dist/trees.min.json`
+ };
+ let fileMap = _mainFileFetcher.fileMap();
+ for (const k in sources) {
+ if (!fileMap[k])
+ fileMap[k] = sources[k];
}
-
- viewOnOSM.entityID = function(_) {
- if (!arguments.length) return id;
- id = _;
- return viewOnOSM;
- };
-
- return viewOnOSM;
-};
-iD.ui.Zoom = function(context) {
- var zooms = [{
- id: 'zoom-in',
- icon: 'plus',
- title: t('zoom.in'),
- action: context.zoomIn,
- key: '+'
- }, {
- id: 'zoom-out',
- icon: 'minus',
- title: t('zoom.out'),
- action: context.zoomOut,
- key: '-'
- }];
-
- function zoomIn() {
- d3.event.preventDefault();
- if (!context.inIntro()) context.zoomIn();
+ }
+ function loadNsiPresets() {
+ return Promise.all([
+ _mainFileFetcher.get("nsi_presets"),
+ _mainFileFetcher.get("nsi_features")
+ ]).then((vals) => {
+ Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
+ _mainPresetIndex.merge({
+ presets: vals[0].presets,
+ featureCollection: vals[1]
+ });
+ });
+ }
+ function loadNsiData() {
+ return Promise.all([
+ _mainFileFetcher.get("nsi_data"),
+ _mainFileFetcher.get("nsi_dissolved"),
+ _mainFileFetcher.get("nsi_replacements"),
+ _mainFileFetcher.get("nsi_trees")
+ ]).then((vals) => {
+ _nsi = {
+ data: vals[0].nsi,
+ dissolved: vals[1].dissolved,
+ replacements: vals[2].replacements,
+ trees: vals[3].trees,
+ kvt: /* @__PURE__ */ new Map(),
+ qids: /* @__PURE__ */ new Map(),
+ ids: /* @__PURE__ */ new Map()
+ };
+ _nsi.matcher = new Matcher();
+ _nsi.matcher.buildMatchIndex(_nsi.data);
+ _nsi.matcher.buildLocationIndex(_nsi.data, _mainLocations.loco());
+ Object.keys(_nsi.data).forEach((tkv) => {
+ const category = _nsi.data[tkv];
+ const parts = tkv.split("/", 3);
+ const t = parts[0];
+ const k = parts[1];
+ const v = parts[2];
+ let vmap = _nsi.kvt.get(k);
+ if (!vmap) {
+ vmap = /* @__PURE__ */ new Map();
+ _nsi.kvt.set(k, vmap);
+ }
+ vmap.set(v, t);
+ const tree = _nsi.trees[t];
+ const mainTag = tree.mainTag;
+ const items = category.items || [];
+ items.forEach((item) => {
+ item.tkv = tkv;
+ item.mainTag = mainTag;
+ _nsi.ids.set(item.id, item);
+ const wd = item.tags[mainTag];
+ const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
+ if (wd)
+ _nsi.qids.set(wd, wd);
+ if (wp && wd)
+ _nsi.qids.set(wp, wd);
+ });
+ });
+ });
+ }
+ function gatherKVs(tags) {
+ let primary = /* @__PURE__ */ new Set();
+ let alternate = /* @__PURE__ */ new Set();
+ Object.keys(tags).forEach((osmkey) => {
+ const osmvalue = tags[osmkey];
+ if (!osmvalue)
+ return;
+ if (osmkey === "route_master")
+ osmkey = "route";
+ const vmap = _nsi.kvt.get(osmkey);
+ if (!vmap)
+ return;
+ if (vmap.get(osmvalue)) {
+ primary.add(`${osmkey}/${osmvalue}`);
+ } else if (osmvalue === "yes") {
+ alternate.add(`${osmkey}/${osmvalue}`);
+ }
+ });
+ const preset = _mainPresetIndex.matchTags(tags, "area");
+ if (buildingPreset[preset.id]) {
+ alternate.add("building/yes");
}
-
- function zoomOut() {
- d3.event.preventDefault();
- if (!context.inIntro()) context.zoomOut();
+ return { primary, alternate };
+ }
+ function identifyTree(tags) {
+ let unknown;
+ let t;
+ Object.keys(tags).forEach((osmkey) => {
+ if (t)
+ return;
+ const osmvalue = tags[osmkey];
+ if (!osmvalue)
+ return;
+ if (osmkey === "route_master")
+ osmkey = "route";
+ const vmap = _nsi.kvt.get(osmkey);
+ if (!vmap)
+ return;
+ if (osmvalue === "yes") {
+ unknown = "unknown";
+ } else {
+ t = vmap.get(osmvalue);
+ }
+ });
+ return t || unknown || null;
+ }
+ function gatherNames(tags) {
+ const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
+ let primary = /* @__PURE__ */ new Set();
+ let alternate = /* @__PURE__ */ new Set();
+ let foundSemi = false;
+ let testNameFragments = false;
+ let patterns2;
+ let t = identifyTree(tags);
+ if (!t)
+ return empty2;
+ if (t === "transit") {
+ patterns2 = {
+ primary: /^network$/i,
+ alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
+ };
+ } else if (t === "flags") {
+ patterns2 = {
+ primary: /^(flag:name|flag:name:\w+)$/i,
+ alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
+ };
+ } else if (t === "brands") {
+ testNameFragments = true;
+ patterns2 = {
+ primary: /^(name|name:\w+)$/i,
+ alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
+ };
+ } else if (t === "operators") {
+ testNameFragments = true;
+ patterns2 = {
+ primary: /^(name|name:\w+|operator|operator:\w+)$/i,
+ alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
+ };
+ } else {
+ testNameFragments = true;
+ patterns2 = {
+ primary: /^(name|name:\w+)$/i,
+ alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
+ };
}
-
- function zoomInFurther() {
- d3.event.preventDefault();
- if (!context.inIntro()) context.zoomInFurther();
+ if (tags.name && testNameFragments) {
+ const nameParts = tags.name.split(/[\s\-\/,.]/);
+ for (let split = nameParts.length; split > 0; split--) {
+ const name2 = nameParts.slice(0, split).join(" ");
+ primary.add(name2);
+ }
}
-
- function zoomOutFurther() {
- d3.event.preventDefault();
- if (!context.inIntro()) context.zoomOutFurther();
+ Object.keys(tags).forEach((osmkey) => {
+ const osmvalue = tags[osmkey];
+ if (!osmvalue)
+ return;
+ if (isNamelike(osmkey, "primary")) {
+ if (/;/.test(osmvalue)) {
+ foundSemi = true;
+ } else {
+ primary.add(osmvalue);
+ alternate.delete(osmvalue);
+ }
+ } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
+ if (/;/.test(osmvalue)) {
+ foundSemi = true;
+ } else {
+ alternate.add(osmvalue);
+ }
+ }
+ });
+ if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
+ const osmvalue = tags.country;
+ if (/;/.test(osmvalue)) {
+ foundSemi = true;
+ } else {
+ alternate.add(osmvalue);
+ }
}
-
-
- return function(selection) {
- var button = selection.selectAll('button')
- .data(zooms)
- .enter().append('button')
- .attr('tabindex', -1)
- .attr('class', function(d) { return d.id; })
- .on('click.editor', function(d) { d.action(); })
- .call(bootstrap.tooltip()
- .placement('left')
- .html(true)
- .title(function(d) {
- return iD.ui.tooltipHtml(d.title, d.key);
- }));
-
- button.each(function(d) {
- d3.select(this)
- .call(iD.svg.Icon('#icon-' + d.icon, 'light'));
- });
-
- var keybinding = d3.keybinding('zoom');
-
- _.each(['=','ffequals','plus','ffplus'], function(key) {
- keybinding.on(key, zoomIn);
- keybinding.on('â§' + key, zoomIn);
- keybinding.on(iD.ui.cmd('â' + key), zoomInFurther);
- keybinding.on(iD.ui.cmd('ââ§' + key), zoomInFurther);
- });
- _.each(['-','ffminus','_','dash'], function(key) {
- keybinding.on(key, zoomOut);
- keybinding.on('â§' + key, zoomOut);
- keybinding.on(iD.ui.cmd('â' + key), zoomOutFurther);
- keybinding.on(iD.ui.cmd('ââ§' + key), zoomOutFurther);
- });
-
- d3.select(document)
- .call(keybinding);
- };
-};
-iD.ui.preset.access = function(field) {
- var dispatch = d3.dispatch('change'),
- items;
-
- function access(selection) {
- var wrap = selection.selectAll('.preset-input-wrap')
- .data([0]);
-
- wrap.enter().append('div')
- .attr('class', 'cf preset-input-wrap')
- .append('ul');
-
- items = wrap.select('ul').selectAll('li')
- .data(field.keys);
-
- // Enter
-
- var enter = items.enter().append('li')
- .attr('class', function(d) { return 'cf preset-access-' + d; });
-
- enter.append('span')
- .attr('class', 'col6 label preset-label-access')
- .attr('for', function(d) { return 'preset-input-access-' + d; })
- .text(function(d) { return field.t('types.' + d); });
-
- enter.append('div')
- .attr('class', 'col6 preset-input-access-wrap')
- .append('input')
- .attr('type', 'text')
- .attr('class', 'preset-input-access')
- .attr('id', function(d) { return 'preset-input-access-' + d; })
- .each(function(d) {
- d3.select(this)
- .call(d3.combobox()
- .data(access.options(d)));
- });
-
- // Update
-
- wrap.selectAll('.preset-input-access')
- .on('change', change)
- .on('blur', change);
+ if (foundSemi) {
+ return empty2;
+ } else {
+ return { primary, alternate };
}
-
- function change(d) {
- var tag = {};
- tag[d] = d3.select(this).value() || undefined;
- dispatch.change(tag);
+ function isNamelike(osmkey, which) {
+ if (osmkey === "old_name")
+ return false;
+ return patterns2[which].test(osmkey) && !notNames.test(osmkey);
}
-
- access.options = function(type) {
- var options = ['no', 'permissive', 'private', 'destination'];
-
- if (type !== 'access') {
- options.unshift('yes');
- options.push('designated');
-
- if (type === 'bicycle') {
- options.push('dismount');
- }
- }
-
- return options.map(function(option) {
- return {
- title: field.t('options.' + option + '.description'),
- value: option
- };
+ }
+ function gatherTuples(tryKVs, tryNames) {
+ let tuples = [];
+ ["primary", "alternate"].forEach((whichName) => {
+ const arr = Array.from(tryNames[whichName]).sort((a, b) => b.length - a.length);
+ arr.forEach((n2) => {
+ ["primary", "alternate"].forEach((whichKV) => {
+ tryKVs[whichKV].forEach((kv) => {
+ const parts = kv.split("/", 2);
+ const k = parts[0];
+ const v = parts[1];
+ tuples.push({ k, v, n: n2 });
+ });
});
- };
-
- var placeholders = {
- footway: {
- foot: 'designated',
- motor_vehicle: 'no'
- },
- steps: {
- foot: 'yes',
- motor_vehicle: 'no',
- bicycle: 'no',
- horse: 'no'
- },
- pedestrian: {
- foot: 'yes',
- motor_vehicle: 'no'
- },
- cycleway: {
- motor_vehicle: 'no',
- bicycle: 'designated'
- },
- bridleway: {
- motor_vehicle: 'no',
- horse: 'designated'
- },
- path: {
- foot: 'yes',
- motor_vehicle: 'no',
- bicycle: 'yes',
- horse: 'yes'
- },
- motorway: {
- foot: 'no',
- motor_vehicle: 'yes',
- bicycle: 'no',
- horse: 'no'
- },
- trunk: {
- motor_vehicle: 'yes'
- },
- primary: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- secondary: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- tertiary: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- residential: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- unclassified: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- service: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- motorway_link: {
- foot: 'no',
- motor_vehicle: 'yes',
- bicycle: 'no',
- horse: 'no'
- },
- trunk_link: {
- motor_vehicle: 'yes'
- },
- primary_link: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- secondary_link: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
- },
- tertiary_link: {
- foot: 'yes',
- motor_vehicle: 'yes',
- bicycle: 'yes',
- horse: 'yes'
+ });
+ });
+ return tuples;
+ }
+ function _upgradeTags(tags, loc) {
+ let newTags = Object.assign({}, tags);
+ let changed = false;
+ Object.keys(newTags).forEach((osmkey) => {
+ const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
+ if (matchTag) {
+ const prefix = matchTag[1] || "";
+ const wd = newTags[osmkey];
+ const replace = _nsi.replacements[wd];
+ if (replace && replace.wikidata !== void 0) {
+ changed = true;
+ if (replace.wikidata) {
+ newTags[osmkey] = replace.wikidata;
+ } else {
+ delete newTags[osmkey];
+ }
}
- };
-
- access.tags = function(tags) {
- items.selectAll('.preset-input-access')
- .value(function(d) { return tags[d] || ''; })
- .attr('placeholder', function() {
- return tags.access ? tags.access : field.placeholder();
- });
-
- // items.selectAll('#preset-input-access-access')
- // .attr('placeholder', 'yes');
-
- _.forEach(placeholders[tags.highway], function(v, k) {
- items.selectAll('#preset-input-access-' + k)
- .attr('placeholder', function() { return (tags.access || v); });
- });
- };
-
- access.focus = function() {
- items.selectAll('.preset-input-access')
- .node().focus();
- };
-
- return d3.rebind(access, dispatch, 'on');
-};
-iD.ui.preset.address = function(field, context) {
- var dispatch = d3.dispatch('init', 'change'),
- wrap,
- entity,
- isInitialized;
-
- var widths = {
- housenumber: 1/3,
- street: 2/3,
- city: 2/3,
- state: 1/4,
- postcode: 1/3
- };
-
- function getStreets() {
- var extent = entity.extent(context.graph()),
- l = extent.center(),
- box = iD.geo.Extent(l).padByMeters(200);
-
- return context.intersects(box)
- .filter(isAddressable)
- .map(function(d) {
- var loc = context.projection([
- (extent[0][0] + extent[1][0]) / 2,
- (extent[0][1] + extent[1][1]) / 2]),
- choice = iD.geo.chooseEdge(context.childNodes(d), loc, context.projection);
- return {
- title: d.tags.name,
- value: d.tags.name,
- dist: choice.distance
- };
- }).sort(function(a, b) {
- return a.dist - b.dist;
- });
-
- function isAddressable(d) {
- return d.tags.highway && d.tags.name && d.type === 'way';
+ if (replace && replace.wikipedia !== void 0) {
+ changed = true;
+ const wpkey = `${prefix}wikipedia`;
+ if (replace.wikipedia) {
+ newTags[wpkey] = replace.wikipedia;
+ } else {
+ delete newTags[wpkey];
+ }
+ }
+ }
+ });
+ const isRouteMaster = tags.type === "route_master";
+ const tryKVs = gatherKVs(tags);
+ if (!tryKVs.primary.size && !tryKVs.alternate.size) {
+ return changed ? { newTags, matched: null } : null;
+ }
+ const tryNames = gatherNames(tags);
+ const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
+ if (foundQID)
+ tryNames.primary.add(foundQID);
+ if (!tryNames.primary.size && !tryNames.alternate.size) {
+ return changed ? { newTags, matched: null } : null;
+ }
+ const tuples = gatherTuples(tryKVs, tryNames);
+ let foundPrimary = false;
+ let bestItem;
+ for (let i2 = 0; i2 < tuples.length && !foundPrimary; i2++) {
+ const tuple = tuples[i2];
+ const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
+ if (!hits || !hits.length)
+ continue;
+ if (hits[0].match !== "primary" && hits[0].match !== "alternate")
+ break;
+ for (let j2 = 0; j2 < hits.length; j2++) {
+ const hit = hits[j2];
+ const isPrimary = hits[j2].match === "primary";
+ const itemID = hit.itemID;
+ if (_nsi.dissolved[itemID])
+ continue;
+ const item = _nsi.ids.get(itemID);
+ if (!item)
+ continue;
+ const mainTag = item.mainTag;
+ const itemQID = item.tags[mainTag];
+ const notQID = newTags[`not:${mainTag}`];
+ if (!itemQID || itemQID === notQID || newTags.office && !item.tags.office) {
+ continue;
+ }
+ if (!bestItem || isPrimary) {
+ bestItem = item;
+ if (isPrimary) {
+ foundPrimary = true;
+ }
+ break;
}
+ }
}
-
- function getCities() {
- var extent = entity.extent(context.graph()),
- l = extent.center(),
- box = iD.geo.Extent(l).padByMeters(200);
-
- return context.intersects(box)
- .filter(isAddressable)
- .map(function(d) {
- return {
- title: d.tags['addr:city'] || d.tags.name,
- value: d.tags['addr:city'] || d.tags.name,
- dist: iD.geo.sphericalDistance(d.extent(context.graph()).center(), l)
- };
- }).sort(function(a, b) {
- return a.dist - b.dist;
- });
-
- function isAddressable(d) {
- if (d.tags.name &&
- (d.tags.admin_level === '8' || d.tags.border_type === 'city'))
- return true;
-
- if (d.tags.place && d.tags.name && (
- d.tags.place === 'city' ||
- d.tags.place === 'town' ||
- d.tags.place === 'village'))
- return true;
-
- if (d.tags['addr:city']) return true;
-
- return false;
+ if (bestItem) {
+ const itemID = bestItem.id;
+ const item = JSON.parse(JSON.stringify(bestItem));
+ const tkv = item.tkv;
+ const parts = tkv.split("/", 3);
+ const k = parts[1];
+ const v = parts[2];
+ const category = _nsi.data[tkv];
+ const properties = category.properties || {};
+ let preserveTags = item.preserveTags || properties.preserveTags || [];
+ ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
+ if (k !== osmkey)
+ preserveTags.push(`^${osmkey}$`);
+ });
+ const regexes = preserveTags.map((s) => new RegExp(s, "i"));
+ let keepTags = {};
+ Object.keys(newTags).forEach((osmkey) => {
+ if (regexes.some((regex) => regex.test(osmkey))) {
+ keepTags[osmkey] = newTags[osmkey];
+ }
+ });
+ _nsi.kvt.forEach((vmap, k2) => {
+ if (newTags[k2] === "yes")
+ delete newTags[k2];
+ });
+ if (foundQID) {
+ delete newTags.wikipedia;
+ delete newTags.wikidata;
+ }
+ Object.assign(newTags, item.tags, keepTags);
+ if (isRouteMaster) {
+ newTags.route_master = newTags.route;
+ delete newTags.route;
+ }
+ const origName = tags.name;
+ const newName = newTags.name;
+ if (newName && origName && newName !== origName && !newTags.branch) {
+ const newNames = gatherNames(newTags);
+ const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
+ const isMoved = newSet.has(origName);
+ if (!isMoved) {
+ const nameParts = origName.split(/[\s\-\/,.]/);
+ for (let split = nameParts.length; split > 0; split--) {
+ const name2 = nameParts.slice(0, split).join(" ");
+ const branch = nameParts.slice(split).join(" ");
+ const nameHits = _nsi.matcher.match(k, v, name2, loc);
+ if (!nameHits || !nameHits.length)
+ continue;
+ if (nameHits.some((hit) => hit.itemID === itemID)) {
+ if (branch) {
+ if (notBranches.test(branch)) {
+ newTags.name = origName;
+ } else {
+ const branchHits = _nsi.matcher.match(k, v, branch, loc);
+ if (branchHits && branchHits.length) {
+ if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
+ return null;
+ }
+ } else {
+ newTags.branch = branch;
+ }
+ }
+ }
+ break;
+ }
+ }
}
+ }
+ return { newTags, matched: item };
}
+ return changed ? { newTags, matched: null } : null;
+ }
+ function _isGenericName(tags) {
+ const n2 = tags.name;
+ if (!n2)
+ return false;
+ const tryNames = { primary: /* @__PURE__ */ new Set([n2]), alternate: /* @__PURE__ */ new Set() };
+ const tryKVs = gatherKVs(tags);
+ if (!tryKVs.primary.size && !tryKVs.alternate.size)
+ return false;
+ const tuples = gatherTuples(tryKVs, tryNames);
+ for (let i2 = 0; i2 < tuples.length; i2++) {
+ const tuple = tuples[i2];
+ const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
+ if (hits && hits.length && hits[0].match === "excludeGeneric")
+ return true;
+ }
+ return false;
+ }
+ var nsi_default = {
+ init: () => {
+ setNsiSources();
+ _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => delay(100)).then(() => _mainLocations.mergeLocationSets([])).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
+ function delay(msec) {
+ return new Promise((resolve) => {
+ window.setTimeout(resolve, msec);
+ });
+ }
+ },
+ reset: () => {
+ },
+ status: () => _nsiStatus,
+ isGenericName: (tags) => _isGenericName(tags),
+ upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
+ cache: () => _nsi
+ };
- function getPostCodes() {
- var extent = entity.extent(context.graph()),
- l = extent.center(),
- box = iD.geo.Extent(l).padByMeters(200);
-
- return context.intersects(box)
- .filter(isAddressable)
- .map(function(d) {
- return {
- title: d.tags['addr:postcode'],
- value: d.tags['addr:postcode'],
- dist: iD.geo.sphericalDistance(d.extent(context.graph()).center(), l)
- };
- }).sort(function(a, b) {
- return a.dist - b.dist;
- });
-
- function isAddressable(d) {
- return d.tags['addr:postcode'];
+ // modules/services/kartaview.js
+ var import_rbush8 = __toESM(require_rbush_min());
+ var apibase2 = "https://kartaview.org";
+ var maxResults = 1e3;
+ var tileZoom = 14;
+ var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
+ var dispatch6 = dispatch_default("loadedImages");
+ var imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
+ var _oscCache;
+ var _oscSelectedImage;
+ var _loadViewerPromise2;
+ function abortRequest4(controller) {
+ controller.abort();
+ }
+ function maxPageAtZoom(z) {
+ if (z < 15)
+ return 2;
+ if (z === 15)
+ return 5;
+ if (z === 16)
+ return 10;
+ if (z === 17)
+ return 20;
+ if (z === 18)
+ return 40;
+ if (z > 18)
+ return 80;
+ }
+ function loadTiles2(which, url, projection2) {
+ var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
+ var tiles = tiler4.getTiles(projection2);
+ var cache = _oscCache[which];
+ Object.keys(cache.inflight).forEach(function(k) {
+ var wanted = tiles.find(function(tile) {
+ return k.indexOf(tile.id + ",") === 0;
+ });
+ if (!wanted) {
+ abortRequest4(cache.inflight[k]);
+ delete cache.inflight[k];
+ }
+ });
+ tiles.forEach(function(tile) {
+ loadNextTilePage(which, currZoom, url, tile);
+ });
+ }
+ function loadNextTilePage(which, currZoom, url, tile) {
+ var cache = _oscCache[which];
+ var bbox = tile.extent.bbox();
+ var maxPages = maxPageAtZoom(currZoom);
+ var nextPage = cache.nextPage[tile.id] || 1;
+ var params = utilQsString({
+ ipp: maxResults,
+ page: nextPage,
+ bbTopLeft: [bbox.maxY, bbox.minX].join(","),
+ bbBottomRight: [bbox.minY, bbox.maxX].join(",")
+ }, true);
+ if (nextPage > maxPages)
+ return;
+ var id2 = tile.id + "," + String(nextPage);
+ if (cache.loaded[id2] || cache.inflight[id2])
+ return;
+ var controller = new AbortController();
+ cache.inflight[id2] = controller;
+ var options2 = {
+ method: "POST",
+ signal: controller.signal,
+ body: params,
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
+ };
+ json_default(url, options2).then(function(data) {
+ cache.loaded[id2] = true;
+ delete cache.inflight[id2];
+ if (!data || !data.currentPageItems || !data.currentPageItems.length) {
+ throw new Error("No Data");
+ }
+ var features2 = data.currentPageItems.map(function(item) {
+ var loc = [+item.lng, +item.lat];
+ var d;
+ if (which === "images") {
+ d = {
+ loc,
+ key: item.id,
+ ca: +item.heading,
+ captured_at: item.shot_date || item.date_added,
+ captured_by: item.username,
+ imagePath: item.lth_name,
+ sequence_id: item.sequence_id,
+ sequence_index: +item.sequence_index
+ };
+ var seq = _oscCache.sequences[d.sequence_id];
+ if (!seq) {
+ seq = { rotation: 0, images: [] };
+ _oscCache.sequences[d.sequence_id] = seq;
+ }
+ seq.images[d.sequence_index] = d;
+ _oscCache.images.forImageKey[d.key] = d;
+ }
+ return {
+ minX: loc[0],
+ minY: loc[1],
+ maxX: loc[0],
+ maxY: loc[1],
+ data: d
+ };
+ });
+ cache.rtree.load(features2);
+ if (data.currentPageItems.length === maxResults) {
+ cache.nextPage[tile.id] = nextPage + 1;
+ loadNextTilePage(which, currZoom, url, tile);
+ } else {
+ cache.nextPage[tile.id] = Infinity;
+ }
+ if (which === "images") {
+ dispatch6.call("loadedImages");
+ }
+ }).catch(function() {
+ cache.loaded[id2] = true;
+ delete cache.inflight[id2];
+ });
+ }
+ function partitionViewport2(projection2) {
+ var z = geoScaleToZoom(projection2.scale());
+ var z2 = Math.ceil(z * 2) / 2 + 2.5;
+ var tiler8 = utilTiler().zoomExtent([z2, z2]);
+ return tiler8.getTiles(projection2).map(function(tile) {
+ return tile.extent;
+ });
+ }
+ function searchLimited2(limit, projection2, rtree) {
+ limit = limit || 5;
+ return partitionViewport2(projection2).reduce(function(result, extent) {
+ var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d) {
+ return d.data;
+ });
+ return found.length ? result.concat(found) : result;
+ }, []);
+ }
+ var kartaview_default = {
+ init: function() {
+ if (!_oscCache) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch6, "on");
+ },
+ reset: function() {
+ if (_oscCache) {
+ Object.values(_oscCache.images.inflight).forEach(abortRequest4);
+ }
+ _oscCache = {
+ images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
+ sequences: {}
+ };
+ _oscSelectedImage = null;
+ },
+ images: function(projection2) {
+ var limit = 5;
+ return searchLimited2(limit, projection2, _oscCache.images.rtree);
+ },
+ sequences: function(projection2) {
+ var viewport = projection2.clipExtent();
+ var min3 = [viewport[0][0], viewport[1][1]];
+ var max3 = [viewport[1][0], viewport[0][1]];
+ var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ var sequenceKeys = {};
+ _oscCache.images.rtree.search(bbox).forEach(function(d) {
+ sequenceKeys[d.data.sequence_id] = true;
+ });
+ var lineStrings = [];
+ Object.keys(sequenceKeys).forEach(function(sequenceKey) {
+ var seq = _oscCache.sequences[sequenceKey];
+ var images = seq && seq.images;
+ if (images) {
+ lineStrings.push({
+ type: "LineString",
+ coordinates: images.map(function(d) {
+ return d.loc;
+ }).filter(Boolean),
+ properties: {
+ captured_at: images[0] ? images[0].captured_at : null,
+ captured_by: images[0] ? images[0].captured_by : null,
+ key: sequenceKey
+ }
+ });
+ }
+ });
+ return lineStrings;
+ },
+ cachedImage: function(imageKey) {
+ return _oscCache.images.forImageKey[imageKey];
+ },
+ loadImages: function(projection2) {
+ var url = apibase2 + "/1.0/list/nearby-photos/";
+ loadTiles2("images", url, projection2);
+ },
+ ensureViewerLoaded: function(context) {
+ if (_loadViewerPromise2)
+ return _loadViewerPromise2;
+ var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
+ var that = this;
+ var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan)).on("dblclick.zoom", null);
+ wrapEnter.append("div").attr("class", "photo-attribution fillD");
+ var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
+ controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
+ controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
+ controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
+ controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
+ wrapEnter.append("div").attr("class", "kartaview-image-wrap");
+ context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
+ imgZoom = zoom_default2().extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]).scaleExtent([1, 15]).on("zoom", zoomPan);
+ });
+ function zoomPan(d3_event) {
+ var t = d3_event.transform;
+ context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t.x, t.y, t.k);
+ }
+ function rotate(deg) {
+ return function() {
+ if (!_oscSelectedImage)
+ return;
+ var sequenceKey = _oscSelectedImage.sequence_id;
+ var sequence = _oscCache.sequences[sequenceKey];
+ if (!sequence)
+ return;
+ var r = sequence.rotation || 0;
+ r += deg;
+ if (r > 180)
+ r -= 360;
+ if (r < -180)
+ r += 360;
+ sequence.rotation = r;
+ var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
+ wrap3.transition().duration(100).call(imgZoom.transform, identity2);
+ wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r + "deg)");
+ };
+ }
+ function step(stepBy) {
+ return function() {
+ if (!_oscSelectedImage)
+ return;
+ var sequenceKey = _oscSelectedImage.sequence_id;
+ var sequence = _oscCache.sequences[sequenceKey];
+ if (!sequence)
+ return;
+ var nextIndex = _oscSelectedImage.sequence_index + stepBy;
+ var nextImage = sequence.images[nextIndex];
+ if (!nextImage)
+ return;
+ context.map().centerEase(nextImage.loc);
+ that.selectImage(context, nextImage.key);
+ };
+ }
+ _loadViewerPromise2 = Promise.resolve();
+ return _loadViewerPromise2;
+ },
+ showViewer: function(context) {
+ var viewer = context.container().select(".photoviewer").classed("hide", false);
+ var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
+ if (isHidden) {
+ viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
+ viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
+ }
+ return this;
+ },
+ hideViewer: function(context) {
+ _oscSelectedImage = null;
+ this.updateUrlImage(null);
+ var viewer = context.container().select(".photoviewer");
+ if (!viewer.empty())
+ viewer.datum(null);
+ viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
+ context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
+ return this.setStyles(context, null, true);
+ },
+ selectImage: function(context, imageKey) {
+ var d = this.cachedImage(imageKey);
+ _oscSelectedImage = d;
+ this.updateUrlImage(imageKey);
+ var viewer = context.container().select(".photoviewer");
+ if (!viewer.empty())
+ viewer.datum(d);
+ this.setStyles(context, null, true);
+ context.container().selectAll(".icon-sign").classed("currentView", false);
+ if (!d)
+ return this;
+ var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
+ var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
+ var attribution = wrap2.selectAll(".photo-attribution").text("");
+ wrap2.transition().duration(100).call(imgZoom.transform, identity2);
+ imageWrap.selectAll(".kartaview-image").remove();
+ if (d) {
+ var sequence = _oscCache.sequences[d.sequence_id];
+ var r = sequence && sequence.rotation || 0;
+ imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d.imagePath).style("transform", "rotate(" + r + "deg)");
+ if (d.captured_by) {
+ attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d.captured_by)).text("@" + d.captured_by);
+ attribution.append("span").text("|");
+ }
+ if (d.captured_at) {
+ attribution.append("span").attr("class", "captured_at").text(localeDateString2(d.captured_at));
+ attribution.append("span").text("|");
+ }
+ attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d.sequence_id + "/" + d.sequence_index).text("kartaview.org");
+ }
+ return this;
+ function localeDateString2(s) {
+ if (!s)
+ return null;
+ var options2 = { day: "numeric", month: "short", year: "numeric" };
+ var d2 = new Date(s);
+ if (isNaN(d2.getTime()))
+ return null;
+ return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
+ }
+ },
+ getSelectedImage: function() {
+ return _oscSelectedImage;
+ },
+ getSequenceKeyForImage: function(d) {
+ return d && d.sequence_id;
+ },
+ setStyles: function(context, hovered, reset) {
+ if (reset) {
+ context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
+ context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
+ }
+ var hoveredImageKey = hovered && hovered.key;
+ var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
+ var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
+ var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d) {
+ return d.key;
+ }) || [];
+ var viewer = context.container().select(".photoviewer");
+ var selected = viewer.empty() ? void 0 : viewer.datum();
+ var selectedImageKey = selected && selected.key;
+ var selectedSequenceKey = this.getSequenceKeyForImage(selected);
+ var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
+ var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d) {
+ return d.key;
+ }) || [];
+ var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
+ context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d) {
+ return highlightedImageKeys.indexOf(d.key) !== -1;
+ }).classed("hovered", function(d) {
+ return d.key === hoveredImageKey;
+ }).classed("currentView", function(d) {
+ return d.key === selectedImageKey;
+ });
+ context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d) {
+ return d.properties.key === hoveredSequenceKey;
+ }).classed("currentView", function(d) {
+ return d.properties.key === selectedSequenceKey;
+ });
+ context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
+ function viewfieldPath() {
+ var d = this.parentNode.__data__;
+ if (d.pano && d.key !== selectedImageKey) {
+ return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
+ } else {
+ return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
+ }
+ }
+ return this;
+ },
+ updateUrlImage: function(imageKey) {
+ if (!window.mocha) {
+ var hash = utilStringQs(window.location.hash);
+ if (imageKey) {
+ hash.photo = "kartaview/" + imageKey;
+ } else {
+ delete hash.photo;
}
+ window.location.replace("#" + utilQsString(hash, true));
+ }
+ },
+ cache: function() {
+ return _oscCache;
}
+ };
- function address(selection) {
- isInitialized = false;
-
- wrap = selection.selectAll('.preset-input-wrap')
- .data([0]);
-
- // Enter
-
- wrap.enter()
- .append('div')
- .attr('class', 'preset-input-wrap');
-
- var center = entity.extent(context.graph()).center(),
- addressFormat;
-
- iD.services.nominatim().countryCode(center, function (err, countryCode) {
- addressFormat = _.find(iD.data.addressFormats, function (a) {
- return a && a.countryCodes && _.includes(a.countryCodes, countryCode);
- }) || _.first(iD.data.addressFormats);
-
- function row(r) {
- // Normalize widths.
- var total = _.reduce(r, function(sum, field) {
- return sum + (widths[field] || 0.5);
- }, 0);
-
- return r.map(function (field) {
- return {
- id: field,
- width: (widths[field] || 0.5) / total
- };
- });
- }
-
- wrap.selectAll('div')
- .data(addressFormat.format)
- .enter()
- .append('div')
- .attr('class', 'addr-row')
- .selectAll('input')
- .data(row)
- .enter()
- .append('input')
- .property('type', 'text')
- .attr('placeholder', function (d) { return field.t('placeholders.' + d.id); })
- .attr('class', function (d) { return 'addr-' + d.id; })
- .style('width', function (d) { return d.width * 100 + '%'; });
-
- // Update
-
- wrap.selectAll('.addr-street')
- .call(d3.combobox()
- .fetcher(function(value, callback) {
- callback(getStreets());
- }));
-
- wrap.selectAll('.addr-city')
- .call(d3.combobox()
- .fetcher(function(value, callback) {
- callback(getCities());
- }));
-
- wrap.selectAll('.addr-postcode')
- .call(d3.combobox()
- .fetcher(function(value, callback) {
- callback(getPostCodes());
- }));
-
- wrap.selectAll('input')
- .on('blur', change())
- .on('change', change());
-
- wrap.selectAll('input:not(.combobox-input)')
- .on('input', change(true));
-
- dispatch.init();
- isInitialized = true;
+ // node_modules/osm-auth/src/osm-auth.mjs
+ var import_store = __toESM(require_store_legacy(), 1);
+ function osmAuth(o) {
+ var oauth2 = {};
+ oauth2.authenticated = function() {
+ return !!token("oauth2_access_token");
+ };
+ oauth2.logout = function() {
+ token("oauth2_access_token", "");
+ token("oauth_token", "");
+ token("oauth_token_secret", "");
+ token("oauth_request_token_secret", "");
+ return oauth2;
+ };
+ oauth2.authenticate = function(callback) {
+ if (oauth2.authenticated()) {
+ callback(null, oauth2);
+ return;
+ }
+ oauth2.logout();
+ var url = o.url + "/oauth2/authorize?" + utilQsString2({
+ client_id: o.client_id,
+ redirect_uri: o.redirect_uri,
+ response_type: "code",
+ scope: o.scope
+ });
+ if (!o.singlepage) {
+ var w = 600;
+ var h = 550;
+ var settings = [
+ ["width", w],
+ ["height", h],
+ ["left", screen.width / 2 - w / 2],
+ ["top", screen.height / 2 - h / 2]
+ ].map(function(x) {
+ return x.join("=");
+ }).join(",");
+ var popup = window.open("about:blank", "oauth_window", settings);
+ oauth2.popupWindow = popup;
+ popup.location = url;
+ if (!popup) {
+ var error = new Error("Popup was blocked");
+ error.status = "popup-blocked";
+ throw error;
+ }
+ }
+ window.authComplete = function(url2) {
+ var params = utilStringQs2(url2.split("?")[1]);
+ getAccessToken(params.code);
+ delete window.authComplete;
+ };
+ function getAccessToken(auth_code) {
+ var url2 = o.url + "/oauth2/token?" + utilQsString2({
+ client_id: o.client_id,
+ grant_type: "authorization_code",
+ code: auth_code,
+ redirect_uri: o.redirect_uri,
+ client_secret: o.client_secret
});
- }
-
- function change(onInput) {
- return function() {
- var tags = {};
-
- wrap.selectAll('input')
- .each(function (field) {
- tags['addr:' + field.id] = this.value || undefined;
- });
-
- dispatch.change(tags, onInput);
- };
- }
-
- function updateTags(tags) {
- wrap.selectAll('input')
- .value(function (field) {
- return tags['addr:' + field.id] || '';
- });
- }
-
- address.entity = function(_) {
- if (!arguments.length) return entity;
- entity = _;
- return address;
+ oauth2.rawxhr("POST", url2, null, null, null, accessTokenDone);
+ o.loading();
+ }
+ function accessTokenDone(err, xhr) {
+ o.done();
+ if (err) {
+ callback(err);
+ return;
+ }
+ var access_token = JSON.parse(xhr.response);
+ token("oauth2_access_token", access_token.access_token);
+ callback(null, oauth2);
+ }
};
-
- address.tags = function(tags) {
- if (isInitialized) {
- updateTags(tags);
- } else {
- dispatch.on('init', function () {
- updateTags(tags);
- });
+ oauth2.bringPopupWindowToFront = function() {
+ var broughtPopupToFront = false;
+ try {
+ if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
+ oauth2.popupWindow.focus();
+ broughtPopupToFront = true;
}
+ } catch (err) {
+ }
+ return broughtPopupToFront;
+ };
+ oauth2.bootstrapToken = function(auth_code, callback) {
+ function getAccessToken(auth_code2) {
+ var url = o.url + "/oauth2/token?" + utilQsString2({
+ client_id: o.client_id,
+ grant_type: "authorization_code",
+ code: auth_code2,
+ redirect_uri: o.redirect_uri,
+ client_secret: o.client_secret
+ });
+ oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
+ o.loading();
+ }
+ function accessTokenDone(err, xhr) {
+ o.done();
+ if (err) {
+ callback(err);
+ return;
+ }
+ var access_token = JSON.parse(xhr.response);
+ token("oauth2_access_token", access_token.access_token);
+ callback(null, oauth2);
+ }
+ getAccessToken(auth_code);
};
-
- address.focus = function() {
- var node = wrap.selectAll('input').node();
- if (node) node.focus();
+ oauth2.xhr = function(options2, callback) {
+ if (oauth2.authenticated()) {
+ return run();
+ } else {
+ if (o.auto) {
+ oauth2.authenticate(run);
+ return;
+ } else {
+ callback("not authenticated", null);
+ return;
+ }
+ }
+ function run() {
+ var url = options2.prefix !== false ? o.url + options2.path : options2.path;
+ return oauth2.rawxhr(options2.method, url, token("oauth2_access_token"), options2.content, options2.headers, done);
+ }
+ function done(err, xhr) {
+ if (err) {
+ callback(err);
+ } else if (xhr.responseXML) {
+ callback(err, xhr.responseXML);
+ } else {
+ callback(err, xhr.response);
+ }
+ }
};
-
- return d3.rebind(address, dispatch, 'on');
-};
-iD.ui.preset.check =
-iD.ui.preset.defaultcheck = function(field) {
- var dispatch = d3.dispatch('change'),
- options = field.strings && field.strings.options,
- values = [],
- texts = [],
- entity, value, box, text, label;
-
- if (options) {
- for (var k in options) {
- values.push(k === 'undefined' ? undefined : k);
- texts.push(field.t('options.' + k, { 'default': options[k] }));
+ oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
+ headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
+ if (access_token) {
+ headers.Authorization = "Bearer " + access_token;
+ }
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === 4 && xhr.status !== 0) {
+ if (/^20\d$/.test(xhr.status)) {
+ callback(null, xhr);
+ } else {
+ callback(xhr, null);
+ }
}
+ };
+ xhr.onerror = function(e) {
+ callback(e, null);
+ };
+ xhr.open(method, url, true);
+ for (var h in headers)
+ xhr.setRequestHeader(h, headers[h]);
+ xhr.send(data);
+ return xhr;
+ };
+ oauth2.preauth = function(val) {
+ if (val && val.access_token) {
+ token("oauth2_access_token", val.access_token);
+ }
+ return oauth2;
+ };
+ oauth2.options = function(val) {
+ if (!arguments.length)
+ return o;
+ o = val;
+ o.url = o.url || "https://www.openstreetmap.org";
+ o.auto = o.auto || false;
+ o.singlepage = o.singlepage || false;
+ o.loading = o.loading || function() {
+ };
+ o.done = o.done || function() {
+ };
+ return oauth2.preauth(o);
+ };
+ var token;
+ if (import_store.default.enabled) {
+ token = function(x, y) {
+ if (arguments.length === 1)
+ return import_store.default.get(o.url + x);
+ else if (arguments.length === 2)
+ return import_store.default.set(o.url + x, y);
+ };
} else {
- values = [undefined, 'yes'];
- texts = [t('inspector.unknown'), t('inspector.check.yes')];
- if (field.type === 'check') {
- values.push('no');
- texts.push(t('inspector.check.no'));
- }
+ var storage = {};
+ token = function(x, y) {
+ if (arguments.length === 1)
+ return storage[o.url + x];
+ else if (arguments.length === 2)
+ return storage[o.url + x] = y;
+ };
}
+ oauth2.options(o);
+ return oauth2;
+ }
+ function utilQsString2(obj) {
+ return Object.keys(obj).sort().map(function(key) {
+ return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
+ }).join("&");
+ }
+ function utilStringQs2(str2) {
+ var i2 = 0;
+ while (i2 < str2.length && (str2[i2] === "?" || str2[i2] === "#"))
+ i2++;
+ str2 = str2.slice(i2);
+ return str2.split("&").reduce(function(obj, pair2) {
+ var parts = pair2.split("=");
+ if (parts.length === 2) {
+ obj[parts[0]] = decodeURIComponent(parts[1]);
+ }
+ return obj;
+ }, {});
+ }
- var check = function(selection) {
- // hack: pretend oneway field is a oneway_yes field
- // where implied oneway tag exists (e.g. `junction=roundabout`) #2220, #1841
- if (field.id === 'oneway') {
- for (var key in entity.tags) {
- if (key in iD.oneWayTags && (entity.tags[key] in iD.oneWayTags[key])) {
- texts[0] = t('presets.fields.oneway_yes.options.undefined');
- break;
- }
+ // modules/services/osm.js
+ var import_rbush9 = __toESM(require_rbush_min());
+ var tiler5 = utilTiler();
+ var dispatch7 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
+ var urlroot = "https://www.openstreetmap.org";
+ var redirectPath = window.location.origin + window.location.pathname;
+ var oauth = osmAuth({
+ url: urlroot,
+ client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
+ client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q",
+ scope: "read_prefs write_prefs write_api read_gpx write_notes",
+ redirect_uri: redirectPath + "land.html",
+ loading: authLoading,
+ done: authDone
+ });
+ var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
+ var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
+ var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
+ var _userCache = { toLoad: {}, user: {} };
+ var _cachedApiStatus;
+ var _changeset = {};
+ var _deferred = /* @__PURE__ */ new Set();
+ var _connectionID = 1;
+ var _tileZoom4 = 16;
+ var _noteZoom = 12;
+ var _rateLimitError;
+ var _userChangesets;
+ var _userDetails;
+ var _off;
+ var _maxWayNodes = 2e3;
+ function authLoading() {
+ dispatch7.call("authLoading");
+ }
+ function authDone() {
+ dispatch7.call("authDone");
+ }
+ function abortRequest5(controllerOrXHR) {
+ if (controllerOrXHR) {
+ controllerOrXHR.abort();
+ }
+ }
+ function hasInflightRequests(cache) {
+ return Object.keys(cache.inflight).length;
+ }
+ function abortUnwantedRequests4(cache, visibleTiles) {
+ Object.keys(cache.inflight).forEach(function(k) {
+ if (cache.toLoad[k])
+ return;
+ if (visibleTiles.find(function(tile) {
+ return k === tile.id;
+ }))
+ return;
+ abortRequest5(cache.inflight[k]);
+ delete cache.inflight[k];
+ });
+ }
+ function getLoc(attrs) {
+ var lon = attrs.lon && attrs.lon.value;
+ var lat = attrs.lat && attrs.lat.value;
+ return [parseFloat(lon), parseFloat(lat)];
+ }
+ function getNodes(obj) {
+ var elems = obj.getElementsByTagName("nd");
+ var nodes = new Array(elems.length);
+ for (var i2 = 0, l = elems.length; i2 < l; i2++) {
+ nodes[i2] = "n" + elems[i2].attributes.ref.value;
+ }
+ return nodes;
+ }
+ function getNodesJSON(obj) {
+ var elems = obj.nodes;
+ var nodes = new Array(elems.length);
+ for (var i2 = 0, l = elems.length; i2 < l; i2++) {
+ nodes[i2] = "n" + elems[i2];
+ }
+ return nodes;
+ }
+ function getTags(obj) {
+ var elems = obj.getElementsByTagName("tag");
+ var tags = {};
+ for (var i2 = 0, l = elems.length; i2 < l; i2++) {
+ var attrs = elems[i2].attributes;
+ tags[attrs.k.value] = attrs.v.value;
+ }
+ return tags;
+ }
+ function getMembers(obj) {
+ var elems = obj.getElementsByTagName("member");
+ var members = new Array(elems.length);
+ for (var i2 = 0, l = elems.length; i2 < l; i2++) {
+ var attrs = elems[i2].attributes;
+ members[i2] = {
+ id: attrs.type.value[0] + attrs.ref.value,
+ type: attrs.type.value,
+ role: attrs.role.value
+ };
+ }
+ return members;
+ }
+ function getMembersJSON(obj) {
+ var elems = obj.members;
+ var members = new Array(elems.length);
+ for (var i2 = 0, l = elems.length; i2 < l; i2++) {
+ var attrs = elems[i2];
+ members[i2] = {
+ id: attrs.type[0] + attrs.ref,
+ type: attrs.type,
+ role: attrs.role
+ };
+ }
+ return members;
+ }
+ function getVisible(attrs) {
+ return !attrs.visible || attrs.visible.value !== "false";
+ }
+ function parseComments(comments) {
+ var parsedComments = [];
+ for (var i2 = 0; i2 < comments.length; i2++) {
+ var comment = comments[i2];
+ if (comment.nodeName === "comment") {
+ var childNodes = comment.childNodes;
+ var parsedComment = {};
+ for (var j2 = 0; j2 < childNodes.length; j2++) {
+ var node = childNodes[j2];
+ var nodeName = node.nodeName;
+ if (nodeName === "#text")
+ continue;
+ parsedComment[nodeName] = node.textContent;
+ if (nodeName === "uid") {
+ var uid = node.textContent;
+ if (uid && !_userCache.user[uid]) {
+ _userCache.toLoad[uid] = true;
}
+ }
}
-
- selection.classed('checkselect', 'true');
-
- label = selection.selectAll('.preset-input-wrap')
- .data([0]);
-
- var enter = label.enter().append('label')
- .attr('class', 'preset-input-wrap');
-
- enter.append('input')
- .property('indeterminate', field.type === 'check')
- .attr('type', 'checkbox')
- .attr('id', 'preset-input-' + field.id);
-
- enter.append('span')
- .text(texts[0])
- .attr('class', 'value');
-
- box = label.select('input')
- .on('click', function() {
- var t = {};
- t[field.key] = values[(values.indexOf(value) + 1) % values.length];
- dispatch.change(t);
- d3.event.stopPropagation();
- });
-
- text = label.select('span.value');
- };
-
- check.entity = function(_) {
- if (!arguments.length) return entity;
- entity = _;
- return check;
- };
-
- check.tags = function(tags) {
- value = tags[field.key];
- box.property('indeterminate', field.type === 'check' && !value);
- box.property('checked', value === 'yes');
- text.text(texts[values.indexOf(value)]);
- label.classed('set', !!value);
- };
-
- check.focus = function() {
- box.node().focus();
+ if (parsedComment) {
+ parsedComments.push(parsedComment);
+ }
+ }
+ }
+ return parsedComments;
+ }
+ function encodeNoteRtree(note) {
+ return {
+ minX: note.loc[0],
+ minY: note.loc[1],
+ maxX: note.loc[0],
+ maxY: note.loc[1],
+ data: note
};
-
- return d3.rebind(check, dispatch, 'on');
-};
-iD.ui.preset.combo =
-iD.ui.preset.typeCombo =
-iD.ui.preset.multiCombo = function(field, context) {
- var dispatch = d3.dispatch('change'),
- isMulti = (field.type === 'multiCombo'),
- optstrings = field.strings && field.strings.options,
- optarray = field.options,
- snake_case = (field.snake_case || (field.snake_case === undefined)),
- combobox = d3.combobox().minItems(isMulti ? 1 : 2),
- comboData = [],
- multiData = [],
- container,
- input,
- entity;
-
- // ensure multiCombo field.key ends with a ':'
- if (isMulti && field.key.match(/:$/) === null) {
- field.key += ':';
+ }
+ var jsonparsers = {
+ node: function nodeData(obj, uid) {
+ return new osmNode({
+ id: uid,
+ visible: typeof obj.visible === "boolean" ? obj.visible : true,
+ version: obj.version && obj.version.toString(),
+ changeset: obj.changeset && obj.changeset.toString(),
+ timestamp: obj.timestamp,
+ user: obj.user,
+ uid: obj.uid && obj.uid.toString(),
+ loc: [parseFloat(obj.lon), parseFloat(obj.lat)],
+ tags: obj.tags
+ });
+ },
+ way: function wayData(obj, uid) {
+ return new osmWay({
+ id: uid,
+ visible: typeof obj.visible === "boolean" ? obj.visible : true,
+ version: obj.version && obj.version.toString(),
+ changeset: obj.changeset && obj.changeset.toString(),
+ timestamp: obj.timestamp,
+ user: obj.user,
+ uid: obj.uid && obj.uid.toString(),
+ tags: obj.tags,
+ nodes: getNodesJSON(obj)
+ });
+ },
+ relation: function relationData(obj, uid) {
+ return new osmRelation({
+ id: uid,
+ visible: typeof obj.visible === "boolean" ? obj.visible : true,
+ version: obj.version && obj.version.toString(),
+ changeset: obj.changeset && obj.changeset.toString(),
+ timestamp: obj.timestamp,
+ user: obj.user,
+ uid: obj.uid && obj.uid.toString(),
+ tags: obj.tags,
+ members: getMembersJSON(obj)
+ });
+ },
+ user: function parseUser(obj, uid) {
+ return {
+ id: uid,
+ display_name: obj.display_name,
+ account_created: obj.account_created,
+ image_url: obj.img && obj.img.href,
+ changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
+ active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
+ };
}
-
-
- function snake(s) {
- return s.replace(/\s+/g, '_');
+ };
+ function parseJSON(payload, callback, options2) {
+ options2 = Object.assign({ skipSeen: true }, options2);
+ if (!payload) {
+ return callback({ message: "No JSON", status: -1 });
+ }
+ var json = payload;
+ if (typeof json !== "object")
+ json = JSON.parse(payload);
+ if (!json.elements)
+ return callback({ message: "No JSON", status: -1 });
+ var children2 = json.elements;
+ var handle = window.requestIdleCallback(function() {
+ _deferred.delete(handle);
+ var results = [];
+ var result;
+ for (var i2 = 0; i2 < children2.length; i2++) {
+ result = parseChild(children2[i2]);
+ if (result)
+ results.push(result);
+ }
+ callback(null, results);
+ });
+ _deferred.add(handle);
+ function parseChild(child) {
+ var parser3 = jsonparsers[child.type];
+ if (!parser3)
+ return null;
+ var uid;
+ uid = osmEntity.id.fromOSM(child.type, child.id);
+ if (options2.skipSeen) {
+ if (_tileCache.seen[uid])
+ return null;
+ _tileCache.seen[uid] = true;
+ }
+ return parser3(child, uid);
}
-
- function unsnake(s) {
- return s.replace(/_+/g, ' ');
+ }
+ function parseUserJSON(payload, callback, options2) {
+ options2 = Object.assign({ skipSeen: true }, options2);
+ if (!payload) {
+ return callback({ message: "No JSON", status: -1 });
+ }
+ var json = payload;
+ if (typeof json !== "object")
+ json = JSON.parse(payload);
+ if (!json.users && !json.user)
+ return callback({ message: "No JSON", status: -1 });
+ var objs = json.users || [json];
+ var handle = window.requestIdleCallback(function() {
+ _deferred.delete(handle);
+ var results = [];
+ var result;
+ for (var i2 = 0; i2 < objs.length; i2++) {
+ result = parseObj(objs[i2]);
+ if (result)
+ results.push(result);
+ }
+ callback(null, results);
+ });
+ _deferred.add(handle);
+ function parseObj(obj) {
+ var uid = obj.user.id && obj.user.id.toString();
+ if (options2.skipSeen && _userCache.user[uid]) {
+ delete _userCache.toLoad[uid];
+ return null;
+ }
+ var user = jsonparsers.user(obj.user, uid);
+ _userCache.user[uid] = user;
+ delete _userCache.toLoad[uid];
+ return user;
}
-
- function clean(s) {
- return s.split(';')
- .map(function(s) { return s.trim(); })
- .join(';');
+ }
+ var parsers = {
+ node: function nodeData2(obj, uid) {
+ var attrs = obj.attributes;
+ return new osmNode({
+ id: uid,
+ visible: getVisible(attrs),
+ version: attrs.version.value,
+ changeset: attrs.changeset && attrs.changeset.value,
+ timestamp: attrs.timestamp && attrs.timestamp.value,
+ user: attrs.user && attrs.user.value,
+ uid: attrs.uid && attrs.uid.value,
+ loc: getLoc(attrs),
+ tags: getTags(obj)
+ });
+ },
+ way: function wayData2(obj, uid) {
+ var attrs = obj.attributes;
+ return new osmWay({
+ id: uid,
+ visible: getVisible(attrs),
+ version: attrs.version.value,
+ changeset: attrs.changeset && attrs.changeset.value,
+ timestamp: attrs.timestamp && attrs.timestamp.value,
+ user: attrs.user && attrs.user.value,
+ uid: attrs.uid && attrs.uid.value,
+ tags: getTags(obj),
+ nodes: getNodes(obj)
+ });
+ },
+ relation: function relationData2(obj, uid) {
+ var attrs = obj.attributes;
+ return new osmRelation({
+ id: uid,
+ visible: getVisible(attrs),
+ version: attrs.version.value,
+ changeset: attrs.changeset && attrs.changeset.value,
+ timestamp: attrs.timestamp && attrs.timestamp.value,
+ user: attrs.user && attrs.user.value,
+ uid: attrs.uid && attrs.uid.value,
+ tags: getTags(obj),
+ members: getMembers(obj)
+ });
+ },
+ note: function parseNote(obj, uid) {
+ var attrs = obj.attributes;
+ var childNodes = obj.childNodes;
+ var props = {};
+ props.id = uid;
+ props.loc = getLoc(attrs);
+ var coincident = false;
+ var epsilon3 = 1e-5;
+ do {
+ if (coincident) {
+ props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
+ }
+ var bbox = geoExtent(props.loc).bbox();
+ coincident = _noteCache.rtree.search(bbox).length;
+ } while (coincident);
+ for (var i2 = 0; i2 < childNodes.length; i2++) {
+ var node = childNodes[i2];
+ var nodeName = node.nodeName;
+ if (nodeName === "#text")
+ continue;
+ if (nodeName === "comments") {
+ props[nodeName] = parseComments(node.childNodes);
+ } else {
+ props[nodeName] = node.textContent;
+ }
+ }
+ var note = new osmNote(props);
+ var item = encodeNoteRtree(note);
+ _noteCache.note[note.id] = note;
+ _noteCache.rtree.insert(item);
+ return note;
+ },
+ user: function parseUser2(obj, uid) {
+ var attrs = obj.attributes;
+ var user = {
+ id: uid,
+ display_name: attrs.display_name && attrs.display_name.value,
+ account_created: attrs.account_created && attrs.account_created.value,
+ changesets_count: "0",
+ active_blocks: "0"
+ };
+ var img = obj.getElementsByTagName("img");
+ if (img && img[0] && img[0].getAttribute("href")) {
+ user.image_url = img[0].getAttribute("href");
+ }
+ var changesets = obj.getElementsByTagName("changesets");
+ if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
+ user.changesets_count = changesets[0].getAttribute("count");
+ }
+ var blocks = obj.getElementsByTagName("blocks");
+ if (blocks && blocks[0]) {
+ var received = blocks[0].getElementsByTagName("received");
+ if (received && received[0] && received[0].getAttribute("active")) {
+ user.active_blocks = received[0].getAttribute("active");
+ }
+ }
+ _userCache.user[uid] = user;
+ delete _userCache.toLoad[uid];
+ return user;
}
-
-
- // returns the tag value for a display value
- // (for multiCombo, dval should be the key suffix, not the entire key)
- function tagValue(dval) {
- dval = clean(dval || '');
-
- if (optstrings) {
- var match = _.find(comboData, function(o) {
- return o.key && clean(o.value) === dval;
- });
- if (match) {
- return match.key;
+ };
+ function parseXML(xml, callback, options2) {
+ options2 = Object.assign({ skipSeen: true }, options2);
+ if (!xml || !xml.childNodes) {
+ return callback({ message: "No XML", status: -1 });
+ }
+ var root3 = xml.childNodes[0];
+ var children2 = root3.childNodes;
+ var handle = window.requestIdleCallback(function() {
+ _deferred.delete(handle);
+ var results = [];
+ var result;
+ for (var i2 = 0; i2 < children2.length; i2++) {
+ result = parseChild(children2[i2]);
+ if (result)
+ results.push(result);
+ }
+ callback(null, results);
+ });
+ _deferred.add(handle);
+ function parseChild(child) {
+ var parser3 = parsers[child.nodeName];
+ if (!parser3)
+ return null;
+ var uid;
+ if (child.nodeName === "user") {
+ uid = child.attributes.id.value;
+ if (options2.skipSeen && _userCache.user[uid]) {
+ delete _userCache.toLoad[uid];
+ return null;
+ }
+ } else if (child.nodeName === "note") {
+ uid = child.getElementsByTagName("id")[0].textContent;
+ } else {
+ uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
+ if (options2.skipSeen) {
+ if (_tileCache.seen[uid])
+ return null;
+ _tileCache.seen[uid] = true;
+ }
+ }
+ return parser3(child, uid);
+ }
+ }
+ function updateRtree4(item, replace) {
+ _noteCache.rtree.remove(item, function isEql(a, b) {
+ return a.data.id === b.data.id;
+ });
+ if (replace) {
+ _noteCache.rtree.insert(item);
+ }
+ }
+ function wrapcb(thisArg, callback, cid) {
+ return function(err, result) {
+ if (err) {
+ if (err.status === 400 || err.status === 401 || err.status === 403) {
+ thisArg.logout();
+ }
+ return callback.call(thisArg, err);
+ } else if (thisArg.getConnectionId() !== cid) {
+ return callback.call(thisArg, { message: "Connection Switched", status: -1 });
+ } else {
+ return callback.call(thisArg, err, result);
+ }
+ };
+ }
+ var osm_default = {
+ init: function() {
+ utilRebind(this, dispatch7, "on");
+ },
+ reset: function() {
+ Array.from(_deferred).forEach(function(handle) {
+ window.cancelIdleCallback(handle);
+ _deferred.delete(handle);
+ });
+ _connectionID++;
+ _userChangesets = void 0;
+ _userDetails = void 0;
+ _rateLimitError = void 0;
+ Object.values(_tileCache.inflight).forEach(abortRequest5);
+ Object.values(_noteCache.inflight).forEach(abortRequest5);
+ Object.values(_noteCache.inflightPost).forEach(abortRequest5);
+ if (_changeset.inflight)
+ abortRequest5(_changeset.inflight);
+ _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush9.default() };
+ _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush9.default() };
+ _userCache = { toLoad: {}, user: {} };
+ _cachedApiStatus = void 0;
+ _changeset = {};
+ return this;
+ },
+ getConnectionId: function() {
+ return _connectionID;
+ },
+ getUrlRoot: function() {
+ return urlroot;
+ },
+ changesetURL: function(changesetID) {
+ return urlroot + "/changeset/" + changesetID;
+ },
+ changesetsURL: function(center, zoom) {
+ var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
+ return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
+ },
+ entityURL: function(entity) {
+ return urlroot + "/" + entity.type + "/" + entity.osmId();
+ },
+ historyURL: function(entity) {
+ return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
+ },
+ userURL: function(username) {
+ return urlroot + "/user/" + encodeURIComponent(username);
+ },
+ noteURL: function(note) {
+ return urlroot + "/note/" + note.id;
+ },
+ noteReportURL: function(note) {
+ return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
+ },
+ loadFromAPI: function(path, callback, options2) {
+ options2 = Object.assign({ skipSeen: true }, options2);
+ var that = this;
+ var cid = _connectionID;
+ function done(err, payload) {
+ if (that.getConnectionId() !== cid) {
+ if (callback)
+ callback({ message: "Connection Switched", status: -1 });
+ return;
+ }
+ var isAuthenticated = that.authenticated();
+ if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
+ that.logout();
+ that.loadFromAPI(path, callback, options2);
+ } else {
+ if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
+ _rateLimitError = err;
+ dispatch7.call("change");
+ that.reloadApiStatus();
+ } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
+ that.reloadApiStatus();
+ }
+ if (callback) {
+ if (err) {
+ return callback(err);
+ } else {
+ if (path.indexOf(".json") !== -1) {
+ return parseJSON(payload, callback, options2);
+ } else {
+ return parseXML(payload, callback, options2);
+ }
}
+ }
}
-
- if (field.type === 'typeCombo' && !dval) {
- return 'yes';
+ }
+ if (this.authenticated()) {
+ return oauth.xhr({ method: "GET", path }, done);
+ } else {
+ var url = urlroot + path;
+ var controller = new AbortController();
+ var fn;
+ if (path.indexOf(".json") !== -1) {
+ fn = json_default;
+ } else {
+ fn = xml_default;
+ }
+ fn(url, { signal: controller.signal }).then(function(data) {
+ done(null, data);
+ }).catch(function(err) {
+ if (err.name === "AbortError")
+ return;
+ var match = err.message.match(/^\d{3}/);
+ if (match) {
+ done({ status: +match[0], statusText: err.message });
+ } else {
+ done(err.message);
+ }
+ });
+ return controller;
+ }
+ },
+ loadEntity: function(id2, callback) {
+ var type3 = osmEntity.id.type(id2);
+ var osmID = osmEntity.id.toOSM(id2);
+ var options2 = { skipSeen: false };
+ this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + (type3 !== "node" ? "/full" : "") + ".json", function(err, entities) {
+ if (callback)
+ callback(err, { data: entities });
+ }, options2);
+ },
+ loadEntityVersion: function(id2, version2, callback) {
+ var type3 = osmEntity.id.type(id2);
+ var osmID = osmEntity.id.toOSM(id2);
+ var options2 = { skipSeen: false };
+ this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + "/" + version2 + ".json", function(err, entities) {
+ if (callback)
+ callback(err, { data: entities });
+ }, options2);
+ },
+ loadEntityRelations: function(id2, callback) {
+ var type3 = osmEntity.id.type(id2);
+ var osmID = osmEntity.id.toOSM(id2);
+ var options2 = { skipSeen: false };
+ this.loadFromAPI("/api/0.6/" + type3 + "/" + osmID + "/relations.json", function(err, entities) {
+ if (callback)
+ callback(err, { data: entities });
+ }, options2);
+ },
+ loadMultiple: function(ids, callback) {
+ var that = this;
+ var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
+ Object.keys(groups).forEach(function(k) {
+ var type3 = k + "s";
+ var osmIDs = groups[k].map(function(id2) {
+ return osmEntity.id.toOSM(id2);
+ });
+ var options2 = { skipSeen: false };
+ utilArrayChunk(osmIDs, 150).forEach(function(arr) {
+ that.loadFromAPI("/api/0.6/" + type3 + ".json?" + type3 + "=" + arr.join(), function(err, entities) {
+ if (callback)
+ callback(err, { data: entities });
+ }, options2);
+ });
+ });
+ },
+ putChangeset: function(changeset, changes, callback) {
+ var cid = _connectionID;
+ if (_changeset.inflight) {
+ return callback({ message: "Changeset already inflight", status: -2 }, changeset);
+ } else if (_changeset.open) {
+ return createdChangeset.call(this, null, _changeset.open);
+ } else {
+ var options2 = {
+ method: "PUT",
+ path: "/api/0.6/changeset/create",
+ headers: { "Content-Type": "text/xml" },
+ content: JXON.stringify(changeset.asJXON())
+ };
+ _changeset.inflight = oauth.xhr(options2, wrapcb(this, createdChangeset, cid));
+ }
+ function createdChangeset(err, changesetID) {
+ _changeset.inflight = null;
+ if (err) {
+ return callback(err, changeset);
+ }
+ _changeset.open = changesetID;
+ changeset = changeset.update({ id: changesetID });
+ var options3 = {
+ method: "POST",
+ path: "/api/0.6/changeset/" + changesetID + "/upload",
+ headers: { "Content-Type": "text/xml" },
+ content: JXON.stringify(changeset.osmChangeJXON(changes))
+ };
+ _changeset.inflight = oauth.xhr(options3, wrapcb(this, uploadedChangeset, cid));
+ }
+ function uploadedChangeset(err) {
+ _changeset.inflight = null;
+ if (err)
+ return callback(err, changeset);
+ window.setTimeout(function() {
+ callback(null, changeset);
+ }, 2500);
+ _changeset.open = null;
+ if (this.getConnectionId() === cid) {
+ oauth.xhr({
+ method: "PUT",
+ path: "/api/0.6/changeset/" + changeset.id + "/close",
+ headers: { "Content-Type": "text/xml" }
+ }, function() {
+ return true;
+ });
+ }
+ }
+ },
+ loadUsers: function(uids, callback) {
+ var toLoad = [];
+ var cached = [];
+ utilArrayUniq(uids).forEach(function(uid) {
+ if (_userCache.user[uid]) {
+ delete _userCache.toLoad[uid];
+ cached.push(_userCache.user[uid]);
+ } else {
+ toLoad.push(uid);
+ }
+ });
+ if (cached.length || !this.authenticated()) {
+ callback(void 0, cached);
+ if (!this.authenticated())
+ return;
+ }
+ utilArrayChunk(toLoad, 150).forEach(function(arr) {
+ oauth.xhr({ method: "GET", path: "/api/0.6/users.json?users=" + arr.join() }, wrapcb(this, done, _connectionID));
+ }.bind(this));
+ function done(err, payload) {
+ if (err)
+ return callback(err);
+ var options2 = { skipSeen: true };
+ return parseUserJSON(payload, function(err2, results) {
+ if (err2)
+ return callback(err2);
+ return callback(void 0, results);
+ }, options2);
+ }
+ },
+ loadUser: function(uid, callback) {
+ if (_userCache.user[uid] || !this.authenticated()) {
+ delete _userCache.toLoad[uid];
+ return callback(void 0, _userCache.user[uid]);
+ }
+ oauth.xhr({ method: "GET", path: "/api/0.6/user/" + uid + ".json" }, wrapcb(this, done, _connectionID));
+ function done(err, payload) {
+ if (err)
+ return callback(err);
+ var options2 = { skipSeen: true };
+ return parseUserJSON(payload, function(err2, results) {
+ if (err2)
+ return callback(err2);
+ return callback(void 0, results[0]);
+ }, options2);
+ }
+ },
+ userDetails: function(callback) {
+ if (_userDetails) {
+ return callback(void 0, _userDetails);
+ }
+ oauth.xhr({ method: "GET", path: "/api/0.6/user/details.json" }, wrapcb(this, done, _connectionID));
+ function done(err, payload) {
+ if (err)
+ return callback(err);
+ var options2 = { skipSeen: false };
+ return parseUserJSON(payload, function(err2, results) {
+ if (err2)
+ return callback(err2);
+ _userDetails = results[0];
+ return callback(void 0, _userDetails);
+ }, options2);
+ }
+ },
+ userChangesets: function(callback) {
+ if (_userChangesets) {
+ return callback(void 0, _userChangesets);
+ }
+ this.userDetails(wrapcb(this, gotDetails, _connectionID));
+ function gotDetails(err, user) {
+ if (err) {
+ return callback(err);
}
-
- return (snake_case ? snake(dval) : dval) || undefined;
- }
-
-
- // returns the display value for a tag value
- // (for multiCombo, tval should be the key suffix, not the entire key)
- function displayValue(tval) {
- tval = tval || '';
-
- if (optstrings) {
- var match = _.find(comboData, function(o) { return o.key === tval && o.value; });
- if (match) {
- return match.value;
+ oauth.xhr({ method: "GET", path: "/api/0.6/changesets?user=" + user.id }, wrapcb(this, done, _connectionID));
+ }
+ function done(err, xml) {
+ if (err) {
+ return callback(err);
+ }
+ _userChangesets = Array.prototype.map.call(xml.getElementsByTagName("changeset"), function(changeset) {
+ return { tags: getTags(changeset) };
+ }).filter(function(changeset) {
+ var comment = changeset.tags.comment;
+ return comment && comment !== "";
+ });
+ return callback(void 0, _userChangesets);
+ }
+ },
+ status: function(callback) {
+ var url = urlroot + "/api/capabilities";
+ var errback = wrapcb(this, done, _connectionID);
+ xml_default(url).then(function(data) {
+ errback(null, data);
+ }).catch(function(err) {
+ errback(err.message);
+ });
+ function done(err, xml) {
+ if (err) {
+ return callback(err, null);
+ }
+ var elements = xml.getElementsByTagName("blacklist");
+ var regexes = [];
+ for (var i2 = 0; i2 < elements.length; i2++) {
+ var regexString = elements[i2].getAttribute("regex");
+ if (regexString) {
+ try {
+ var regex = new RegExp(regexString);
+ regexes.push(regex);
+ } catch (e) {
}
+ }
}
-
- if (field.type === 'typeCombo' && tval.toLowerCase() === 'yes') {
- return '';
+ if (regexes.length) {
+ _imageryBlocklists = regexes;
}
-
- return snake_case ? unsnake(tval) : tval;
- }
-
-
- function objectDifference(a, b) {
- return _.reject(a, function(d1) {
- return _.some(b, function(d2) { return d1.value === d2.value; });
- });
- }
-
-
- function initCombo(selection, attachTo) {
- if (optstrings) {
- selection.attr('readonly', 'readonly');
- selection.call(combobox, attachTo);
- setStaticValues(setPlaceholder);
-
- } else if (optarray) {
- selection.call(combobox, attachTo);
- setStaticValues(setPlaceholder);
-
- } else if (context.taginfo()) {
- selection.call(combobox.fetcher(setTaginfoValues), attachTo);
- setTaginfoValues('', setPlaceholder);
+ if (_rateLimitError) {
+ return callback(_rateLimitError, "rateLimited");
+ } else {
+ var waynodes = xml.getElementsByTagName("waynodes");
+ var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
+ if (maxWayNodes && isFinite(maxWayNodes))
+ _maxWayNodes = maxWayNodes;
+ var apiStatus = xml.getElementsByTagName("status");
+ var val = apiStatus[0].getAttribute("api");
+ return callback(void 0, val);
}
- }
-
-
- function setStaticValues(callback) {
- if (!(optstrings || optarray)) return;
-
- if (optstrings) {
- comboData = Object.keys(optstrings).map(function(k) {
- var v = field.t('options.' + k, { 'default': optstrings[k] });
- return {
- key: k,
- value: v,
- title: v
- };
- });
-
- } else if (optarray) {
- comboData = optarray.map(function(k) {
- var v = snake_case ? unsnake(k) : k;
- return {
- key: k,
- value: v,
- title: v
- };
- });
+ }
+ },
+ reloadApiStatus: function() {
+ if (!this.throttledReloadApiStatus) {
+ var that = this;
+ this.throttledReloadApiStatus = throttle_default(function() {
+ that.status(function(err, status) {
+ if (status !== _cachedApiStatus) {
+ _cachedApiStatus = status;
+ dispatch7.call("apiStatusChange", that, err, status);
+ }
+ });
+ }, 500);
+ }
+ this.throttledReloadApiStatus();
+ },
+ maxWayNodes: function() {
+ return _maxWayNodes;
+ },
+ loadTiles: function(projection2, callback) {
+ if (_off)
+ return;
+ var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
+ var hadRequests = hasInflightRequests(_tileCache);
+ abortUnwantedRequests4(_tileCache, tiles);
+ if (hadRequests && !hasInflightRequests(_tileCache)) {
+ dispatch7.call("loaded");
+ }
+ tiles.forEach(function(tile) {
+ this.loadTile(tile, callback);
+ }, this);
+ },
+ loadTile: function(tile, callback) {
+ if (_off)
+ return;
+ if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
+ return;
+ if (!hasInflightRequests(_tileCache)) {
+ dispatch7.call("loading");
+ }
+ var path = "/api/0.6/map.json?bbox=";
+ var options2 = { skipSeen: true };
+ _tileCache.inflight[tile.id] = this.loadFromAPI(path + tile.extent.toParam(), tileCallback, options2);
+ function tileCallback(err, parsed) {
+ delete _tileCache.inflight[tile.id];
+ if (!err) {
+ delete _tileCache.toLoad[tile.id];
+ _tileCache.loaded[tile.id] = true;
+ var bbox = tile.extent.bbox();
+ bbox.id = tile.id;
+ _tileCache.rtree.insert(bbox);
+ }
+ if (callback) {
+ callback(err, Object.assign({ data: parsed }, tile));
+ }
+ if (!hasInflightRequests(_tileCache)) {
+ dispatch7.call("loaded");
}
-
- combobox.data(objectDifference(comboData, multiData));
- if (callback) callback(comboData);
- }
-
-
- function setTaginfoValues(q, callback) {
- var fn = isMulti ? 'multikeys' : 'values';
- context.taginfo()[fn]({
- debounce: true,
- key: field.key,
- geometry: context.geometry(entity.id),
- query: (isMulti ? field.key : '') + q
- }, function(err, data) {
- if (err) return;
- comboData = _.map(data, 'value').map(function(k) {
- if (isMulti) k = k.replace(field.key, '');
- var v = snake_case ? unsnake(k) : k;
- return {
- key: k,
- value: v,
- title: v
- };
+ }
+ },
+ isDataLoaded: function(loc) {
+ var bbox = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
+ return _tileCache.rtree.collides(bbox);
+ },
+ loadTileAtLoc: function(loc, callback) {
+ if (Object.keys(_tileCache.toLoad).length > 50)
+ return;
+ var k = geoZoomToScale(_tileZoom4 + 1);
+ var offset = geoRawMercator().scale(k)(loc);
+ var projection2 = geoRawMercator().transform({ k, x: -offset[0], y: -offset[1] });
+ var tiles = tiler5.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
+ tiles.forEach(function(tile) {
+ if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
+ return;
+ _tileCache.toLoad[tile.id] = true;
+ this.loadTile(tile, callback);
+ }, this);
+ },
+ loadNotes: function(projection2, noteOptions) {
+ noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
+ if (_off)
+ return;
+ var that = this;
+ var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
+ var throttleLoadUsers = throttle_default(function() {
+ var uids = Object.keys(_userCache.toLoad);
+ if (!uids.length)
+ return;
+ that.loadUsers(uids, function() {
+ });
+ }, 750);
+ var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
+ abortUnwantedRequests4(_noteCache, tiles);
+ tiles.forEach(function(tile) {
+ if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
+ return;
+ var options2 = { skipSeen: false };
+ _noteCache.inflight[tile.id] = that.loadFromAPI(path + tile.extent.toParam(), function(err) {
+ delete _noteCache.inflight[tile.id];
+ if (!err) {
+ _noteCache.loaded[tile.id] = true;
+ }
+ throttleLoadUsers();
+ dispatch7.call("loadedNotes");
+ }, options2);
+ });
+ },
+ postNoteCreate: function(note, callback) {
+ if (!this.authenticated()) {
+ return callback({ message: "Not Authenticated", status: -3 }, note);
+ }
+ if (_noteCache.inflightPost[note.id]) {
+ return callback({ message: "Note update already inflight", status: -2 }, note);
+ }
+ if (!note.loc[0] || !note.loc[1] || !note.newComment)
+ return;
+ var comment = note.newComment;
+ if (note.newCategory && note.newCategory !== "None") {
+ comment += " #" + note.newCategory;
+ }
+ var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
+ _noteCache.inflightPost[note.id] = oauth.xhr({ method: "POST", path }, wrapcb(this, done, _connectionID));
+ function done(err, xml) {
+ delete _noteCache.inflightPost[note.id];
+ if (err) {
+ return callback(err);
+ }
+ this.removeNote(note);
+ var options2 = { skipSeen: false };
+ return parseXML(xml, function(err2, results) {
+ if (err2) {
+ return callback(err2);
+ } else {
+ return callback(void 0, results[0]);
+ }
+ }, options2);
+ }
+ },
+ postNoteUpdate: function(note, newStatus, callback) {
+ if (!this.authenticated()) {
+ return callback({ message: "Not Authenticated", status: -3 }, note);
+ }
+ if (_noteCache.inflightPost[note.id]) {
+ return callback({ message: "Note update already inflight", status: -2 }, note);
+ }
+ var action;
+ if (note.status !== "closed" && newStatus === "closed") {
+ action = "close";
+ } else if (note.status !== "open" && newStatus === "open") {
+ action = "reopen";
+ } else {
+ action = "comment";
+ if (!note.newComment)
+ return;
+ }
+ var path = "/api/0.6/notes/" + note.id + "/" + action;
+ if (note.newComment) {
+ path += "?" + utilQsString({ text: note.newComment });
+ }
+ _noteCache.inflightPost[note.id] = oauth.xhr({ method: "POST", path }, wrapcb(this, done, _connectionID));
+ function done(err, xml) {
+ delete _noteCache.inflightPost[note.id];
+ if (err) {
+ return callback(err);
+ }
+ this.removeNote(note);
+ if (action === "close") {
+ _noteCache.closed[note.id] = true;
+ } else if (action === "reopen") {
+ delete _noteCache.closed[note.id];
+ }
+ var options2 = { skipSeen: false };
+ return parseXML(xml, function(err2, results) {
+ if (err2) {
+ return callback(err2);
+ } else {
+ return callback(void 0, results[0]);
+ }
+ }, options2);
+ }
+ },
+ switch: function(newOptions) {
+ urlroot = newOptions.url;
+ var oldOptions = utilObjectOmit(oauth.options(), "access_token");
+ oauth.options(Object.assign(oldOptions, newOptions));
+ this.reset();
+ this.userChangesets(function() {
+ });
+ dispatch7.call("change");
+ return this;
+ },
+ toggle: function(val) {
+ _off = !val;
+ return this;
+ },
+ isChangesetInflight: function() {
+ return !!_changeset.inflight;
+ },
+ caches: function(obj) {
+ function cloneCache(source) {
+ var target = {};
+ Object.keys(source).forEach(function(k) {
+ if (k === "rtree") {
+ target.rtree = new import_rbush9.default().fromJSON(source.rtree.toJSON());
+ } else if (k === "note") {
+ target.note = {};
+ Object.keys(source.note).forEach(function(id2) {
+ target.note[id2] = osmNote(source.note[id2]);
});
- comboData = objectDifference(comboData, multiData);
- if (callback) callback(comboData);
+ } else {
+ target[k] = JSON.parse(JSON.stringify(source[k]));
+ }
+ });
+ return target;
+ }
+ if (!arguments.length) {
+ return {
+ tile: cloneCache(_tileCache),
+ note: cloneCache(_noteCache),
+ user: cloneCache(_userCache)
+ };
+ }
+ if (obj === "get") {
+ return {
+ tile: _tileCache,
+ note: _noteCache,
+ user: _userCache
+ };
+ }
+ if (obj.tile) {
+ _tileCache = obj.tile;
+ _tileCache.inflight = {};
+ }
+ if (obj.note) {
+ _noteCache = obj.note;
+ _noteCache.inflight = {};
+ _noteCache.inflightPost = {};
+ }
+ if (obj.user) {
+ _userCache = obj.user;
+ }
+ return this;
+ },
+ logout: function() {
+ _userChangesets = void 0;
+ _userDetails = void 0;
+ oauth.logout();
+ dispatch7.call("change");
+ return this;
+ },
+ authenticated: function() {
+ return oauth.authenticated();
+ },
+ authenticate: function(callback) {
+ var that = this;
+ var cid = _connectionID;
+ _userChangesets = void 0;
+ _userDetails = void 0;
+ function done(err, res) {
+ if (err) {
+ if (callback)
+ callback(err);
+ return;
+ }
+ if (that.getConnectionId() !== cid) {
+ if (callback)
+ callback({ message: "Connection Switched", status: -1 });
+ return;
+ }
+ _rateLimitError = void 0;
+ dispatch7.call("change");
+ if (callback)
+ callback(err, res);
+ that.userChangesets(function() {
});
+ }
+ oauth.authenticate(done);
+ },
+ imageryBlocklists: function() {
+ return _imageryBlocklists;
+ },
+ tileZoom: function(val) {
+ if (!arguments.length)
+ return _tileZoom4;
+ _tileZoom4 = val;
+ return this;
+ },
+ notes: function(projection2) {
+ var viewport = projection2.clipExtent();
+ var min3 = [viewport[0][0], viewport[1][1]];
+ var max3 = [viewport[1][0], viewport[0][1]];
+ var bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ return _noteCache.rtree.search(bbox).map(function(d) {
+ return d.data;
+ });
+ },
+ getNote: function(id2) {
+ return _noteCache.note[id2];
+ },
+ removeNote: function(note) {
+ if (!(note instanceof osmNote) || !note.id)
+ return;
+ delete _noteCache.note[note.id];
+ updateRtree4(encodeNoteRtree(note), false);
+ },
+ replaceNote: function(note) {
+ if (!(note instanceof osmNote) || !note.id)
+ return;
+ _noteCache.note[note.id] = note;
+ updateRtree4(encodeNoteRtree(note), true);
+ return note;
+ },
+ getClosedIDs: function() {
+ return Object.keys(_noteCache.closed).sort();
}
+ };
-
- function setPlaceholder(d) {
- var ph;
- if (isMulti) {
- ph = field.placeholder() || t('inspector.add');
- } else {
- var vals = _.map(d, 'value').filter(function(s) { return s.length < 20; }),
- placeholders = vals.length > 1 ? vals : _.map(d, 'key');
- ph = field.placeholder() || placeholders.slice(0, 3).join(', ');
+ // modules/services/osm_wikibase.js
+ var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
+ var _inflight2 = {};
+ var _wikibaseCache = {};
+ var _localeIDs = { en: false };
+ var debouncedRequest = debounce_default(request, 500, { leading: false });
+ function request(url, callback) {
+ if (_inflight2[url])
+ return;
+ var controller = new AbortController();
+ _inflight2[url] = controller;
+ json_default(url, { signal: controller.signal }).then(function(result) {
+ delete _inflight2[url];
+ if (callback)
+ callback(null, result);
+ }).catch(function(err) {
+ delete _inflight2[url];
+ if (err.name === "AbortError")
+ return;
+ if (callback)
+ callback(err.message);
+ });
+ }
+ var osm_wikibase_default = {
+ init: function() {
+ _inflight2 = {};
+ _wikibaseCache = {};
+ _localeIDs = {};
+ },
+ reset: function() {
+ Object.values(_inflight2).forEach(function(controller) {
+ controller.abort();
+ });
+ _inflight2 = {};
+ },
+ claimToValue: function(entity, property, langCode) {
+ if (!entity.claims[property])
+ return void 0;
+ var locale2 = _localeIDs[langCode];
+ var preferredPick, localePick;
+ entity.claims[property].forEach(function(stmt) {
+ if (!preferredPick && stmt.rank === "preferred") {
+ preferredPick = stmt;
+ }
+ if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
+ localePick = stmt;
}
-
- input.attr('placeholder', ph + 'â¦');
- }
-
-
- function change() {
- var val = tagValue(input.value()),
- t = {};
-
- if (isMulti) {
- if (!val) return;
- container.classed('active', false);
- input.value('');
- field.keys.push(field.key + val);
- t[field.key + val] = 'yes';
- window.setTimeout(function() { input.node().focus(); }, 10);
-
+ });
+ var result = localePick || preferredPick;
+ if (result) {
+ var datavalue = result.mainsnak.datavalue;
+ return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
+ } else {
+ return void 0;
+ }
+ },
+ monolingualClaimToValueObj: function(entity, property) {
+ if (!entity || !entity.claims[property])
+ return void 0;
+ return entity.claims[property].reduce(function(acc, obj) {
+ var value = obj.mainsnak.datavalue.value;
+ acc[value.language] = value.text;
+ return acc;
+ }, {});
+ },
+ toSitelink: function(key, value) {
+ var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
+ return result.replace(/_/g, " ").trim();
+ },
+ getEntity: function(params, callback) {
+ var doRequest = params.debounce ? debouncedRequest : request;
+ var that = this;
+ var titles = [];
+ var result = {};
+ var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
+ var keySitelink = params.key ? this.toSitelink(params.key) : false;
+ var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
+ var localeSitelink;
+ if (params.langCodes) {
+ params.langCodes.forEach(function(langCode) {
+ if (_localeIDs[langCode] === void 0) {
+ localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
+ titles.push(localeSitelink);
+ }
+ });
+ }
+ if (rtypeSitelink) {
+ if (_wikibaseCache[rtypeSitelink]) {
+ result.rtype = _wikibaseCache[rtypeSitelink];
} else {
- t[field.key] = val;
+ titles.push(rtypeSitelink);
}
-
- dispatch.change(t);
- }
-
-
- function removeMultikey(d) {
- d3.event.stopPropagation();
- var t = {};
- t[d.key] = undefined;
- dispatch.change(t);
- }
-
-
- function combo(selection) {
- if (isMulti) {
- container = selection.selectAll('ul').data([0]);
-
- container.enter()
- .append('ul')
- .attr('class', 'form-field-multicombo')
- .on('click', function() {
- window.setTimeout(function() { input.node().focus(); }, 10);
- });
-
+ }
+ if (keySitelink) {
+ if (_wikibaseCache[keySitelink]) {
+ result.key = _wikibaseCache[keySitelink];
} else {
- container = selection;
+ titles.push(keySitelink);
}
-
- input = container.selectAll('input')
- .data([0]);
-
- input.enter()
- .append('input')
- .attr('type', 'text')
- .attr('id', 'preset-input-' + field.id)
- .call(initCombo, selection);
-
- input
- .on('change', change)
- .on('blur', change);
-
- if (isMulti) {
- combobox
- .on('accept', function() {
- input.node().blur();
- input.node().focus();
- });
-
- input
- .on('focus', function() { container.classed('active', true); });
- }
- }
-
-
- combo.tags = function(tags) {
- if (isMulti) {
- multiData = [];
-
- // Build multiData array containing keys already set..
- Object.keys(tags).forEach(function(key) {
- if (key.indexOf(field.key) !== 0 || tags[key].toLowerCase() !== 'yes') return;
-
- var suffix = key.substring(field.key.length);
- multiData.push({
- key: key,
- value: displayValue(suffix)
- });
- });
-
- // Set keys for form-field modified (needed for undo and reset buttons)..
- field.keys = _.map(multiData, 'key');
-
- // Exclude existing multikeys from combo options..
- var available = objectDifference(comboData, multiData);
- combobox.data(available);
-
- // Hide "Add" button if this field uses fixed set of
- // translateable optstrings and they're all currently used..
- container.selectAll('.combobox-input, .combobox-caret')
- .classed('hide', optstrings && !available.length);
-
-
- // Render chips
- var chips = container.selectAll('.chips').data(multiData);
-
- var enter = chips.enter()
- .insert('li', 'input')
- .attr('class', 'chips');
-
- enter.append('span');
- enter.append('a');
-
- chips.select('span')
- .text(function(d) { return d.value; });
-
- chips.select('a')
- .on('click', removeMultikey)
- .attr('class', 'remove')
- .text('Ã');
-
- chips.exit()
- .remove();
-
+ }
+ if (tagSitelink) {
+ if (_wikibaseCache[tagSitelink]) {
+ result.tag = _wikibaseCache[tagSitelink];
} else {
- input.value(displayValue(tags[field.key]));
- }
- };
-
-
- combo.focus = function() {
- input.node().focus();
- };
-
-
- combo.entity = function(_) {
- if (!arguments.length) return entity;
- entity = _;
- return combo;
- };
-
-
- return d3.rebind(combo, dispatch, 'on');
-};
-iD.ui.preset.cycleway = function(field) {
- var dispatch = d3.dispatch('change'),
- items;
-
- function cycleway(selection) {
- var wrap = selection.selectAll('.preset-input-wrap')
- .data([0]);
-
- wrap.enter().append('div')
- .attr('class', 'cf preset-input-wrap')
- .append('ul');
-
- items = wrap.select('ul').selectAll('li')
- .data(field.keys);
-
- // Enter
-
- var enter = items.enter().append('li')
- .attr('class', function(d) { return 'cf preset-cycleway-' + d; });
-
- enter.append('span')
- .attr('class', 'col6 label preset-label-cycleway')
- .attr('for', function(d) { return 'preset-input-cycleway-' + d; })
- .text(function(d) { return field.t('types.' + d); });
-
- enter.append('div')
- .attr('class', 'col6 preset-input-cycleway-wrap')
- .append('input')
- .attr('type', 'text')
- .attr('class', 'preset-input-cycleway')
- .attr('id', function(d) { return 'preset-input-cycleway-' + d; })
- .each(function(d) {
- d3.select(this)
- .call(d3.combobox()
- .data(cycleway.options(d)));
- });
-
- // Update
-
- wrap.selectAll('.preset-input-cycleway')
- .on('change', change)
- .on('blur', change);
- }
-
- function change() {
- var inputs = d3.selectAll('.preset-input-cycleway')[0],
- left = d3.select(inputs[0]).value(),
- right = d3.select(inputs[1]).value(),
- tag = {};
- if (left === 'none' || left === '') { left = undefined; }
- if (right === 'none' || right === '') { right = undefined; }
-
- // Always set both left and right as changing one can affect the other
- tag = {
- cycleway: undefined,
- 'cycleway:left': left,
- 'cycleway:right': right
- };
-
- // If the left and right tags match, use the cycleway tag to tag both
- // sides the same way
- if (left === right) {
- tag = {
- cycleway: left,
- 'cycleway:left': undefined,
- 'cycleway:right': undefined
- };
- }
-
- dispatch.change(tag);
- }
-
- cycleway.options = function() {
- return d3.keys(field.strings.options).map(function(option) {
- return {
- title: field.t('options.' + option + '.description'),
- value: option
- };
- });
- };
-
- cycleway.tags = function(tags) {
- items.selectAll('.preset-input-cycleway')
- .value(function(d) {
- // If cycleway is set, always return that
- if (tags.cycleway) {
- return tags.cycleway;
- }
- return tags[d] || '';
- })
- .attr('placeholder', field.placeholder());
- };
-
- cycleway.focus = function() {
- items.selectAll('.preset-input-cycleway')
- .node().focus();
- };
-
- return d3.rebind(cycleway, dispatch, 'on');
-};
-iD.ui.preset.text =
-iD.ui.preset.number =
-iD.ui.preset.tel =
-iD.ui.preset.email =
-iD.ui.preset.url = function(field, context) {
-
- var dispatch = d3.dispatch('change'),
- input,
- entity;
-
- function i(selection) {
- var fieldId = 'preset-input-' + field.id;
-
- input = selection.selectAll('input')
- .data([0]);
-
- input.enter().append('input')
- .attr('type', field.type)
- .attr('id', fieldId)
- .attr('placeholder', field.placeholder() || t('inspector.unknown'));
-
- input
- .on('input', change(true))
- .on('blur', change())
- .on('change', change());
-
- if (field.type === 'tel') {
- var center = entity.extent(context.graph()).center();
- iD.services.nominatim().countryCode(center, function (err, countryCode) {
- if (err || !iD.data.phoneFormats[countryCode]) return;
- selection.selectAll('#' + fieldId)
- .attr('placeholder', iD.data.phoneFormats[countryCode]);
- });
-
- } else if (field.type === 'number') {
- input.attr('type', 'text');
-
- var spinControl = selection.selectAll('.spin-control')
- .data([0]);
-
- var enter = spinControl.enter().append('div')
- .attr('class', 'spin-control');
-
- enter.append('button')
- .datum(1)
- .attr('class', 'increment')
- .attr('tabindex', -1);
-
- enter.append('button')
- .datum(-1)
- .attr('class', 'decrement')
- .attr('tabindex', -1);
-
- spinControl.selectAll('button')
- .on('click', function(d) {
- d3.event.preventDefault();
- var num = parseInt(input.node().value || 0, 10);
- if (!isNaN(num)) input.node().value = num + d;
- change()();
- });
+ titles.push(tagSitelink);
}
- }
-
- function change(onInput) {
- return function() {
- var t = {};
- t[field.key] = input.value() || undefined;
- dispatch.change(t, onInput);
- };
- }
-
- i.entity = function(_) {
- if (!arguments.length) return entity;
- entity = _;
- return i;
- };
-
- i.tags = function(tags) {
- input.value(tags[field.key] || '');
- };
-
- i.focus = function() {
- var node = input.node();
- if (node) node.focus();
- };
-
- return d3.rebind(i, dispatch, 'on');
-};
-iD.ui.preset.localized = function(field, context) {
- var dispatch = d3.dispatch('change', 'input'),
- wikipedia = iD.services.wikipedia(),
- input, localizedInputs, wikiTitles,
- entity;
-
- function localized(selection) {
- input = selection.selectAll('.localized-main')
- .data([0]);
-
- input.enter().append('input')
- .attr('type', 'text')
- .attr('id', 'preset-input-' + field.id)
- .attr('class', 'localized-main')
- .attr('placeholder', field.placeholder());
-
- if (field.id === 'name') {
- var preset = context.presets().match(entity, context.graph());
- input.call(d3.combobox().fetcher(
- iD.util.SuggestNames(preset, iD.data.suggestions)
- ));
+ }
+ if (!titles.length) {
+ return callback(null, result);
+ }
+ var obj = {
+ action: "wbgetentities",
+ sites: "wiki",
+ titles: titles.join("|"),
+ languages: params.langCodes.join("|"),
+ languagefallback: 1,
+ origin: "*",
+ format: "json"
+ };
+ var url = apibase3 + "?" + utilQsString(obj);
+ doRequest(url, function(err, d) {
+ if (err) {
+ callback(err);
+ } else if (!d.success || d.error) {
+ callback(d.error.messages.map(function(v) {
+ return v.html["*"];
+ }).join("
"));
+ } else {
+ var localeID = false;
+ Object.values(d.entities).forEach(function(res) {
+ if (res.missing !== "") {
+ var title = res.sitelinks.wiki.title;
+ if (title === rtypeSitelink) {
+ _wikibaseCache[rtypeSitelink] = res;
+ result.rtype = res;
+ } else if (title === keySitelink) {
+ _wikibaseCache[keySitelink] = res;
+ result.key = res;
+ } else if (title === tagSitelink) {
+ _wikibaseCache[tagSitelink] = res;
+ result.tag = res;
+ } else if (title === localeSitelink) {
+ localeID = res.id;
+ } else {
+ console.log("Unexpected title " + title);
+ }
+ }
+ });
+ if (localeSitelink) {
+ that.addLocale(params.langCodes[0], localeID);
+ }
+ callback(null, result);
}
-
- input
- .on('input', change(true))
- .on('blur', change())
- .on('change', change());
-
- var translateButton = selection.selectAll('.localized-add')
- .data([0]);
-
- translateButton.enter()
- .append('button')
- .attr('class', 'button-input-action localized-add minor')
- .attr('tabindex', -1)
- .call(iD.svg.Icon('#icon-plus'))
- .call(bootstrap.tooltip()
- .title(t('translate.translate'))
- .placement('left'));
-
- translateButton
- .on('click', addNew);
-
- localizedInputs = selection.selectAll('.localized-wrap')
- .data([0]);
-
- localizedInputs.enter().append('div')
- .attr('class', 'localized-wrap');
- }
-
- function addNew() {
- d3.event.preventDefault();
- var data = localizedInputs.selectAll('div.entry').data();
- var defaultLang = iD.detect().locale.toLowerCase().split('-')[0];
- var langExists = _.find(data, function(datum) { return datum.lang === defaultLang;});
- var isLangEn = defaultLang.indexOf('en') > -1;
- if (isLangEn || langExists) {
- defaultLang = '';
+ });
+ },
+ getDocs: function(params, callback) {
+ var that = this;
+ var langCodes = _mainLocalizer.localeCodes().map(function(code) {
+ return code.toLowerCase();
+ });
+ params.langCodes = langCodes;
+ this.getEntity(params, function(err, data) {
+ if (err) {
+ callback(err);
+ return;
}
- data.push({ lang: defaultLang, value: '' });
- localizedInputs.call(render, data);
- }
-
- function change(onInput) {
- return function() {
- var t = {};
- t[field.key] = d3.select(this).value() || undefined;
- dispatch.change(t, onInput);
+ var entity = data.rtype || data.tag || data.key;
+ if (!entity) {
+ callback("No entity");
+ return;
+ }
+ var i2;
+ var description2;
+ for (i2 in langCodes) {
+ let code2 = langCodes[i2];
+ if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
+ description2 = entity.descriptions[code2];
+ break;
+ }
+ }
+ if (!description2 && Object.values(entity.descriptions).length)
+ description2 = Object.values(entity.descriptions)[0];
+ var result = {
+ title: entity.title,
+ description: description2 ? description2.value : "",
+ descriptionLocaleCode: description2 ? description2.language : "",
+ editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
};
- }
-
- function key(lang) { return field.key + ':' + lang; }
-
- function changeLang(d) {
- var lang = d3.select(this).value(),
- t = {},
- language = _.find(iD.data.wikipedia, function(d) {
- return d[0].toLowerCase() === lang.toLowerCase() ||
- d[1].toLowerCase() === lang.toLowerCase();
+ if (entity.claims) {
+ var imageroot;
+ var image = that.claimToValue(entity, "P4", langCodes[0]);
+ if (image) {
+ imageroot = "https://commons.wikimedia.org/w/index.php";
+ } else {
+ image = that.claimToValue(entity, "P28", langCodes[0]);
+ if (image) {
+ imageroot = "https://wiki.openstreetmap.org/w/index.php";
+ }
+ }
+ if (imageroot && image) {
+ result.imageURL = imageroot + "?" + utilQsString({
+ title: "Special:Redirect/file/" + image,
+ width: 400
});
-
- if (language) lang = language[2];
-
- if (d.lang && d.lang !== lang) {
- t[key(d.lang)] = undefined;
+ }
}
-
- var value = d3.select(this.parentNode)
- .selectAll('.localized-value')
- .value();
-
- if (lang && value) {
- t[key(lang)] = value;
- } else if (lang && wikiTitles && wikiTitles[d.lang]) {
- t[key(lang)] = wikiTitles[d.lang];
+ var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
+ var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
+ var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
+ var wikis = [rtypeWiki, tagWiki, keyWiki];
+ for (i2 in wikis) {
+ var wiki = wikis[i2];
+ for (var j2 in langCodes) {
+ var code = langCodes[j2];
+ var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
+ var info = getWikiInfo(wiki, code, referenceId);
+ if (info) {
+ result.wiki = info;
+ break;
+ }
+ }
+ if (result.wiki)
+ break;
}
-
- d.lang = lang;
- dispatch.change(t);
- }
-
- function changeValue(d) {
- if (!d.lang) return;
- var t = {};
- t[key(d.lang)] = d3.select(this).value() || undefined;
- dispatch.change(t);
+ callback(null, result);
+ function getWikiInfo(wiki2, langCode, tKey) {
+ if (wiki2 && wiki2[langCode]) {
+ return {
+ title: wiki2[langCode],
+ text: tKey,
+ url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
+ };
+ }
+ }
+ });
+ },
+ addLocale: function(langCode, qid) {
+ _localeIDs[langCode] = qid;
+ },
+ apibase: function(val) {
+ if (!arguments.length)
+ return apibase3;
+ apibase3 = val;
+ return this;
}
+ };
- function fetcher(value, cb) {
- var v = value.toLowerCase();
+ // modules/services/streetside.js
+ var import_rbush10 = __toESM(require_rbush_min());
- cb(iD.data.wikipedia.filter(function(d) {
- return d[0].toLowerCase().indexOf(v) >= 0 ||
- d[1].toLowerCase().indexOf(v) >= 0 ||
- d[2].toLowerCase().indexOf(v) >= 0;
- }).map(function(d) {
- return { value: d[1] };
- }));
+ // modules/util/jsonp_request.js
+ var jsonpCache = {};
+ window.jsonpCache = jsonpCache;
+ function jsonpRequest(url, callback) {
+ var request3 = {
+ abort: function() {
+ }
+ };
+ if (window.JSONP_FIX) {
+ if (window.JSONP_DELAY === 0) {
+ callback(window.JSONP_FIX);
+ } else {
+ var t = window.setTimeout(function() {
+ callback(window.JSONP_FIX);
+ }, window.JSONP_DELAY || 0);
+ request3.abort = function() {
+ window.clearTimeout(t);
+ };
+ }
+ return request3;
+ }
+ function rand() {
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ var c = "";
+ var i2 = -1;
+ while (++i2 < 15)
+ c += chars.charAt(Math.floor(Math.random() * 52));
+ return c;
+ }
+ function create2(url2) {
+ var e = url2.match(/callback=(\w+)/);
+ var c = e ? e[1] : rand();
+ jsonpCache[c] = function(data) {
+ if (jsonpCache[c]) {
+ callback(data);
+ }
+ finalize();
+ };
+ function finalize() {
+ delete jsonpCache[c];
+ script.remove();
+ }
+ request3.abort = finalize;
+ return "jsonpCache." + c;
}
+ var cb = create2(url);
+ var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
+ return request3;
+ }
- function render(selection, data) {
- var wraps = selection.selectAll('div.entry').
- data(data, function(d) { return d.lang; });
-
- var innerWrap = wraps.enter()
- .insert('div', ':first-child');
-
- innerWrap.attr('class', 'entry')
- .each(function() {
- var wrap = d3.select(this);
- var langcombo = d3.combobox().fetcher(fetcher).minItems(0);
-
- var label = wrap.append('label')
- .attr('class','form-label')
- .text(t('translate.localized_translation_label'))
- .attr('for','localized-lang');
-
- label.append('button')
- .attr('class', 'minor remove')
- .on('click', function(d){
- d3.event.preventDefault();
- var t = {};
- t[key(d.lang)] = undefined;
- dispatch.change(t);
- d3.select(this.parentNode.parentNode)
- .style('top','0')
- .style('max-height','240px')
- .transition()
- .style('opacity', '0')
- .style('max-height','0px')
- .remove();
- })
- .call(iD.svg.Icon('#operation-delete'));
-
- wrap.append('input')
- .attr('class', 'localized-lang')
- .attr('type', 'text')
- .attr('placeholder',t('translate.localized_translation_language'))
- .on('blur', changeLang)
- .on('change', changeLang)
- .call(langcombo);
-
- wrap.append('input')
- .on('blur', changeValue)
- .on('change', changeValue)
- .attr('type', 'text')
- .attr('placeholder', t('translate.localized_translation_name'))
- .attr('class', 'localized-value');
- });
-
- innerWrap
- .style('margin-top', '0px')
- .style('max-height', '0px')
- .style('opacity', '0')
- .transition()
- .duration(200)
- .style('margin-top', '10px')
- .style('max-height', '240px')
- .style('opacity', '1')
- .each('end', function() {
- d3.select(this)
- .style('max-height', '')
- .style('overflow', 'visible');
- });
-
- wraps.exit()
- .transition()
- .duration(200)
- .style('max-height','0px')
- .style('opacity', '0')
- .style('top','-10px')
- .remove();
-
- var entry = selection.selectAll('.entry');
-
- entry.select('.localized-lang')
- .value(function(d) {
- var lang = _.find(iD.data.wikipedia, function(lang) { return lang[2] === d.lang; });
- return lang ? lang[1] : d.lang;
- });
-
- entry.select('.localized-value')
- .value(function(d) { return d.value; });
+ // modules/services/streetside.js
+ var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
+ var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
+ var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
+ var pannellumViewerCSS = "pannellum-streetside/pannellum.css";
+ var pannellumViewerJS = "pannellum-streetside/pannellum.js";
+ var maxResults2 = 2e3;
+ var tileZoom2 = 16.5;
+ var tiler6 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
+ var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
+ var minHfov = 10;
+ var maxHfov = 90;
+ var defaultHfov = 45;
+ var _hires = false;
+ var _resolution = 512;
+ var _currScene = 0;
+ var _ssCache;
+ var _pannellumViewer;
+ var _sceneOptions = {
+ showFullscreenCtrl: false,
+ autoLoad: true,
+ compass: true,
+ yaw: 0,
+ minHfov,
+ maxHfov,
+ hfov: defaultHfov,
+ type: "cubemap",
+ cubeMap: []
+ };
+ var _loadViewerPromise3;
+ function abortRequest6(i2) {
+ i2.abort();
+ }
+ function localeTimestamp(s) {
+ if (!s)
+ return null;
+ const options2 = { day: "numeric", month: "short", year: "numeric" };
+ const d = new Date(s);
+ if (isNaN(d.getTime()))
+ return null;
+ return d.toLocaleString(_mainLocalizer.localeCode(), options2);
+ }
+ function loadTiles3(which, url, projection2, margin) {
+ const tiles = tiler6.margin(margin).getTiles(projection2);
+ const cache = _ssCache[which];
+ Object.keys(cache.inflight).forEach((k) => {
+ const wanted = tiles.find((tile) => k.indexOf(tile.id + ",") === 0);
+ if (!wanted) {
+ abortRequest6(cache.inflight[k]);
+ delete cache.inflight[k];
+ }
+ });
+ tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
+ }
+ function loadNextTilePage2(which, url, tile) {
+ const cache = _ssCache[which];
+ const nextPage = cache.nextPage[tile.id] || 0;
+ const id2 = tile.id + "," + String(nextPage);
+ if (cache.loaded[id2] || cache.inflight[id2])
+ return;
+ cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
+ cache.loaded[id2] = true;
+ delete cache.inflight[id2];
+ if (!bubbles)
+ return;
+ bubbles.shift();
+ const features2 = bubbles.map((bubble) => {
+ if (cache.points[bubble.id])
+ return null;
+ const loc = [bubble.lo, bubble.la];
+ const d = {
+ loc,
+ key: bubble.id,
+ ca: bubble.he,
+ captured_at: bubble.cd,
+ captured_by: "microsoft",
+ pr: bubble.pr,
+ ne: bubble.ne,
+ pano: true,
+ sequenceKey: null
+ };
+ cache.points[bubble.id] = d;
+ if (bubble.pr === void 0) {
+ cache.leaders.push(bubble.id);
+ }
+ return {
+ minX: loc[0],
+ minY: loc[1],
+ maxX: loc[0],
+ maxY: loc[1],
+ data: d
+ };
+ }).filter(Boolean);
+ cache.rtree.load(features2);
+ connectSequences();
+ if (which === "bubbles") {
+ dispatch8.call("loadedImages");
+ }
+ });
+ }
+ function connectSequences() {
+ let cache = _ssCache.bubbles;
+ let keepLeaders = [];
+ for (let i2 = 0; i2 < cache.leaders.length; i2++) {
+ let bubble = cache.points[cache.leaders[i2]];
+ let seen = {};
+ let sequence = { key: bubble.key, bubbles: [] };
+ let complete = false;
+ do {
+ sequence.bubbles.push(bubble);
+ seen[bubble.key] = true;
+ if (bubble.ne === void 0) {
+ complete = true;
+ } else {
+ bubble = cache.points[bubble.ne];
+ }
+ } while (bubble && !seen[bubble.key] && !complete);
+ if (complete) {
+ _ssCache.sequences[sequence.key] = sequence;
+ for (let j2 = 0; j2 < sequence.bubbles.length; j2++) {
+ sequence.bubbles[j2].sequenceKey = sequence.key;
+ }
+ sequence.geojson = {
+ type: "LineString",
+ properties: {
+ captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
+ captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
+ key: sequence.key
+ },
+ coordinates: sequence.bubbles.map((d) => d.loc)
+ };
+ } else {
+ keepLeaders.push(cache.leaders[i2]);
+ }
}
-
- localized.tags = function(tags) {
- // Fetch translations from wikipedia
- if (tags.wikipedia && !wikiTitles) {
- wikiTitles = {};
- var wm = tags.wikipedia.match(/([^:]+):(.+)/);
- if (wm && wm[0] && wm[1]) {
- wikipedia.translations(wm[1], wm[2], function(d) {
- wikiTitles = d;
- });
- }
+ cache.leaders = keepLeaders;
+ }
+ function getBubbles(url, tile, callback) {
+ let rect = tile.extent.rectangle();
+ let urlForRequest = url + utilQsString({
+ n: rect[3],
+ s: rect[1],
+ e: rect[2],
+ w: rect[0],
+ c: maxResults2,
+ appkey: bubbleAppKey,
+ jsCallback: "{callback}"
+ });
+ return jsonpRequest(urlForRequest, (data) => {
+ if (!data || data.error) {
+ callback(null);
+ } else {
+ callback(data);
+ }
+ });
+ }
+ function partitionViewport3(projection2) {
+ let z = geoScaleToZoom(projection2.scale());
+ let z2 = Math.ceil(z * 2) / 2 + 2.5;
+ let tiler8 = utilTiler().zoomExtent([z2, z2]);
+ return tiler8.getTiles(projection2).map((tile) => tile.extent);
+ }
+ function searchLimited3(limit, projection2, rtree) {
+ limit = limit || 5;
+ return partitionViewport3(projection2).reduce((result, extent) => {
+ let found = rtree.search(extent.bbox()).slice(0, limit).map((d) => d.data);
+ return found.length ? result.concat(found) : result;
+ }, []);
+ }
+ function loadImage(imgInfo) {
+ return new Promise((resolve) => {
+ let img = new Image();
+ img.onload = () => {
+ let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
+ let ctx = canvas.getContext("2d");
+ ctx.drawImage(img, imgInfo.x, imgInfo.y);
+ resolve({ imgInfo, status: "ok" });
+ };
+ img.onerror = () => {
+ resolve({ data: imgInfo, status: "error" });
+ };
+ img.setAttribute("crossorigin", "");
+ img.src = imgInfo.url;
+ });
+ }
+ function loadCanvas(imageGroup) {
+ return Promise.all(imageGroup.map(loadImage)).then((data) => {
+ let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
+ const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
+ let face = data[0].imgInfo.face;
+ _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
+ return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
+ });
+ }
+ function loadFaces(faceGroup) {
+ return Promise.all(faceGroup.map(loadCanvas)).then(() => {
+ return { status: "loadFaces done" };
+ });
+ }
+ function setupCanvas(selection2, reset) {
+ if (reset) {
+ selection2.selectAll("#ideditor-stitcher-canvases").remove();
+ }
+ selection2.selectAll("#ideditor-stitcher-canvases").data([0]).enter().append("div").attr("id", "ideditor-stitcher-canvases").attr("display", "none").selectAll("canvas").data(["canvas01", "canvas02", "canvas03", "canvas10", "canvas11", "canvas12"]).enter().append("canvas").attr("id", (d) => "ideditor-" + d).attr("width", _resolution).attr("height", _resolution);
+ }
+ function qkToXY(qk) {
+ let x = 0;
+ let y = 0;
+ let scale = 256;
+ for (let i2 = qk.length; i2 > 0; i2--) {
+ const key = qk[i2 - 1];
+ x += +(key === "1" || key === "3") * scale;
+ y += +(key === "2" || key === "3") * scale;
+ scale *= 2;
+ }
+ return [x, y];
+ }
+ function getQuadKeys() {
+ let dim = _resolution / 256;
+ let quadKeys;
+ if (dim === 16) {
+ quadKeys = [
+ "0000",
+ "0001",
+ "0010",
+ "0011",
+ "0100",
+ "0101",
+ "0110",
+ "0111",
+ "1000",
+ "1001",
+ "1010",
+ "1011",
+ "1100",
+ "1101",
+ "1110",
+ "1111",
+ "0002",
+ "0003",
+ "0012",
+ "0013",
+ "0102",
+ "0103",
+ "0112",
+ "0113",
+ "1002",
+ "1003",
+ "1012",
+ "1013",
+ "1102",
+ "1103",
+ "1112",
+ "1113",
+ "0020",
+ "0021",
+ "0030",
+ "0031",
+ "0120",
+ "0121",
+ "0130",
+ "0131",
+ "1020",
+ "1021",
+ "1030",
+ "1031",
+ "1120",
+ "1121",
+ "1130",
+ "1131",
+ "0022",
+ "0023",
+ "0032",
+ "0033",
+ "0122",
+ "0123",
+ "0132",
+ "0133",
+ "1022",
+ "1023",
+ "1032",
+ "1033",
+ "1122",
+ "1123",
+ "1132",
+ "1133",
+ "0200",
+ "0201",
+ "0210",
+ "0211",
+ "0300",
+ "0301",
+ "0310",
+ "0311",
+ "1200",
+ "1201",
+ "1210",
+ "1211",
+ "1300",
+ "1301",
+ "1310",
+ "1311",
+ "0202",
+ "0203",
+ "0212",
+ "0213",
+ "0302",
+ "0303",
+ "0312",
+ "0313",
+ "1202",
+ "1203",
+ "1212",
+ "1213",
+ "1302",
+ "1303",
+ "1312",
+ "1313",
+ "0220",
+ "0221",
+ "0230",
+ "0231",
+ "0320",
+ "0321",
+ "0330",
+ "0331",
+ "1220",
+ "1221",
+ "1230",
+ "1231",
+ "1320",
+ "1321",
+ "1330",
+ "1331",
+ "0222",
+ "0223",
+ "0232",
+ "0233",
+ "0322",
+ "0323",
+ "0332",
+ "0333",
+ "1222",
+ "1223",
+ "1232",
+ "1233",
+ "1322",
+ "1323",
+ "1332",
+ "1333",
+ "2000",
+ "2001",
+ "2010",
+ "2011",
+ "2100",
+ "2101",
+ "2110",
+ "2111",
+ "3000",
+ "3001",
+ "3010",
+ "3011",
+ "3100",
+ "3101",
+ "3110",
+ "3111",
+ "2002",
+ "2003",
+ "2012",
+ "2013",
+ "2102",
+ "2103",
+ "2112",
+ "2113",
+ "3002",
+ "3003",
+ "3012",
+ "3013",
+ "3102",
+ "3103",
+ "3112",
+ "3113",
+ "2020",
+ "2021",
+ "2030",
+ "2031",
+ "2120",
+ "2121",
+ "2130",
+ "2131",
+ "3020",
+ "3021",
+ "3030",
+ "3031",
+ "3120",
+ "3121",
+ "3130",
+ "3131",
+ "2022",
+ "2023",
+ "2032",
+ "2033",
+ "2122",
+ "2123",
+ "2132",
+ "2133",
+ "3022",
+ "3023",
+ "3032",
+ "3033",
+ "3122",
+ "3123",
+ "3132",
+ "3133",
+ "2200",
+ "2201",
+ "2210",
+ "2211",
+ "2300",
+ "2301",
+ "2310",
+ "2311",
+ "3200",
+ "3201",
+ "3210",
+ "3211",
+ "3300",
+ "3301",
+ "3310",
+ "3311",
+ "2202",
+ "2203",
+ "2212",
+ "2213",
+ "2302",
+ "2303",
+ "2312",
+ "2313",
+ "3202",
+ "3203",
+ "3212",
+ "3213",
+ "3302",
+ "3303",
+ "3312",
+ "3313",
+ "2220",
+ "2221",
+ "2230",
+ "2231",
+ "2320",
+ "2321",
+ "2330",
+ "2331",
+ "3220",
+ "3221",
+ "3230",
+ "3231",
+ "3320",
+ "3321",
+ "3330",
+ "3331",
+ "2222",
+ "2223",
+ "2232",
+ "2233",
+ "2322",
+ "2323",
+ "2332",
+ "2333",
+ "3222",
+ "3223",
+ "3232",
+ "3233",
+ "3322",
+ "3323",
+ "3332",
+ "3333"
+ ];
+ } else if (dim === 8) {
+ quadKeys = [
+ "000",
+ "001",
+ "010",
+ "011",
+ "100",
+ "101",
+ "110",
+ "111",
+ "002",
+ "003",
+ "012",
+ "013",
+ "102",
+ "103",
+ "112",
+ "113",
+ "020",
+ "021",
+ "030",
+ "031",
+ "120",
+ "121",
+ "130",
+ "131",
+ "022",
+ "023",
+ "032",
+ "033",
+ "122",
+ "123",
+ "132",
+ "133",
+ "200",
+ "201",
+ "210",
+ "211",
+ "300",
+ "301",
+ "310",
+ "311",
+ "202",
+ "203",
+ "212",
+ "213",
+ "302",
+ "303",
+ "312",
+ "313",
+ "220",
+ "221",
+ "230",
+ "231",
+ "320",
+ "321",
+ "330",
+ "331",
+ "222",
+ "223",
+ "232",
+ "233",
+ "322",
+ "323",
+ "332",
+ "333"
+ ];
+ } else if (dim === 4) {
+ quadKeys = [
+ "00",
+ "01",
+ "10",
+ "11",
+ "02",
+ "03",
+ "12",
+ "13",
+ "20",
+ "21",
+ "30",
+ "31",
+ "22",
+ "23",
+ "32",
+ "33"
+ ];
+ } else {
+ quadKeys = [
+ "0",
+ "1",
+ "2",
+ "3"
+ ];
+ }
+ return quadKeys;
+ }
+ var streetside_default = {
+ init: function() {
+ if (!_ssCache) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch8, "on");
+ },
+ reset: function() {
+ if (_ssCache) {
+ Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
+ }
+ _ssCache = {
+ bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush10.default(), points: {}, leaders: [] },
+ sequences: {}
+ };
+ },
+ bubbles: function(projection2) {
+ const limit = 5;
+ return searchLimited3(limit, projection2, _ssCache.bubbles.rtree);
+ },
+ cachedImage: function(imageKey) {
+ return _ssCache.bubbles.points[imageKey];
+ },
+ sequences: function(projection2) {
+ const viewport = projection2.clipExtent();
+ const min3 = [viewport[0][0], viewport[1][1]];
+ const max3 = [viewport[1][0], viewport[0][1]];
+ const bbox = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
+ let seen = {};
+ let results = [];
+ _ssCache.bubbles.rtree.search(bbox).forEach((d) => {
+ const key = d.data.sequenceKey;
+ if (key && !seen[key]) {
+ seen[key] = true;
+ results.push(_ssCache.sequences[key].geojson);
}
-
- input.value(tags[field.key] || '');
-
- var postfixed = [], k, m;
- for (k in tags) {
- m = k.match(/^(.*):([a-zA-Z_-]+)$/);
- if (m && m[1] === field.key && m[2]) {
- postfixed.push({ lang: m[2], value: tags[k] });
+ });
+ return results;
+ },
+ loadBubbles: function(projection2, margin) {
+ if (margin === void 0)
+ margin = 2;
+ loadTiles3("bubbles", bubbleApi, projection2, margin);
+ },
+ viewer: function() {
+ return _pannellumViewer;
+ },
+ initViewer: function() {
+ if (!window.pannellum)
+ return;
+ if (_pannellumViewer)
+ return;
+ _currScene += 1;
+ const sceneID = _currScene.toString();
+ const options2 = {
+ "default": { firstScene: sceneID },
+ scenes: {}
+ };
+ options2.scenes[sceneID] = _sceneOptions;
+ _pannellumViewer = window.pannellum.viewer("ideditor-viewer-streetside", options2);
+ },
+ ensureViewerLoaded: function(context) {
+ if (_loadViewerPromise3)
+ return _loadViewerPromise3;
+ let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
+ let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
+ let that = this;
+ let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
+ select_default2(window).on(pointerPrefix + "move.streetside", () => {
+ dispatch8.call("viewerChanged");
+ }, true);
+ }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
+ select_default2(window).on(pointerPrefix + "move.streetside", null);
+ let t = timer((elapsed) => {
+ dispatch8.call("viewerChanged");
+ if (elapsed > 2e3) {
+ t.stop();
+ }
+ });
+ }).append("div").attr("class", "photo-attribution fillD");
+ let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
+ controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
+ controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
+ wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
+ context.ui().photoviewer.on("resize.streetside", () => {
+ if (_pannellumViewer) {
+ _pannellumViewer.resize();
+ }
+ });
+ _loadViewerPromise3 = new Promise((resolve, reject) => {
+ let loadedCount = 0;
+ function loaded() {
+ loadedCount += 1;
+ if (loadedCount === 2)
+ resolve();
+ }
+ const head = select_default2("head");
+ head.selectAll("#ideditor-streetside-viewercss").data([0]).enter().append("link").attr("id", "ideditor-streetside-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
+ reject();
+ });
+ head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
+ reject();
+ });
+ }).catch(function() {
+ _loadViewerPromise3 = null;
+ });
+ return _loadViewerPromise3;
+ function step(stepBy) {
+ return () => {
+ let viewer = context.container().select(".photoviewer");
+ let selected = viewer.empty() ? void 0 : viewer.datum();
+ if (!selected)
+ return;
+ let nextID = stepBy === 1 ? selected.ne : selected.pr;
+ let yaw = _pannellumViewer.getYaw();
+ let ca = selected.ca + yaw;
+ let origin = selected.loc;
+ const meters = 35;
+ let p1 = [
+ origin[0] + geoMetersToLon(meters / 5, origin[1]),
+ origin[1]
+ ];
+ let p2 = [
+ origin[0] + geoMetersToLon(meters / 2, origin[1]),
+ origin[1] + geoMetersToLat(meters)
+ ];
+ let p3 = [
+ origin[0] - geoMetersToLon(meters / 2, origin[1]),
+ origin[1] + geoMetersToLat(meters)
+ ];
+ let p4 = [
+ origin[0] - geoMetersToLon(meters / 5, origin[1]),
+ origin[1]
+ ];
+ let poly = [p1, p2, p3, p4, p1];
+ let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
+ poly = geoRotate(poly, -angle2, origin);
+ let extent = poly.reduce((extent2, point) => {
+ return extent2.extend(geoExtent(point));
+ }, geoExtent());
+ let minDist = Infinity;
+ _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d) => {
+ if (d.data.key === selected.key)
+ return;
+ if (!geoPointInPolygon(d.data.loc, poly))
+ return;
+ let dist = geoVecLength(d.data.loc, selected.loc);
+ let theta = selected.ca - d.data.ca;
+ let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
+ if (minTheta > 20) {
+ dist += 5;
}
+ if (dist < minDist) {
+ nextID = d.data.key;
+ minDist = dist;
+ }
+ });
+ let nextBubble = nextID && that.cachedImage(nextID);
+ if (!nextBubble)
+ return;
+ context.map().centerEase(nextBubble.loc);
+ that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
+ };
+ }
+ },
+ yaw: function(yaw) {
+ if (typeof yaw !== "number")
+ return yaw;
+ _sceneOptions.yaw = yaw;
+ return this;
+ },
+ showViewer: function(context) {
+ let wrap2 = context.container().select(".photoviewer").classed("hide", false);
+ let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
+ if (isHidden) {
+ wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
+ wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
+ }
+ return this;
+ },
+ hideViewer: function(context) {
+ let viewer = context.container().select(".photoviewer");
+ if (!viewer.empty())
+ viewer.datum(null);
+ viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
+ context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
+ this.updateUrlImage(null);
+ return this.setStyles(context, null, true);
+ },
+ selectImage: function(context, key) {
+ let that = this;
+ let d = this.cachedImage(key);
+ let viewer = context.container().select(".photoviewer");
+ if (!viewer.empty())
+ viewer.datum(d);
+ this.setStyles(context, null, true);
+ let wrap2 = context.container().select(".photoviewer .ms-wrapper");
+ let attribution = wrap2.selectAll(".photo-attribution").html("");
+ wrap2.selectAll(".pnlm-load-box").style("display", "block");
+ if (!d)
+ return this;
+ this.updateUrlImage(key);
+ _sceneOptions.northOffset = d.ca;
+ let line1 = attribution.append("div").attr("class", "attribution-row");
+ const hiresDomId = utilUniqueDomId("streetside-hires");
+ let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
+ label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
+ d3_event.stopPropagation();
+ _hires = !_hires;
+ _resolution = _hires ? 1024 : 512;
+ wrap2.call(setupCanvas, true);
+ let viewstate = {
+ yaw: _pannellumViewer.getYaw(),
+ pitch: _pannellumViewer.getPitch(),
+ hfov: _pannellumViewer.getHfov()
+ };
+ _sceneOptions = Object.assign(_sceneOptions, viewstate);
+ that.selectImage(context, d.key).showViewer(context);
+ });
+ label.append("span").call(_t.append("streetside.hires"));
+ let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
+ if (d.captured_by) {
+ const yyyy = new Date().getFullYear();
+ captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
+ captureInfo.append("span").text("|");
+ }
+ if (d.captured_at) {
+ captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp(d.captured_at));
+ }
+ let line2 = attribution.append("div").attr("class", "attribution-row");
+ line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d.loc[1] + "~" + d.loc[0] + "&lvl=17&dir=" + d.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
+ line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d.key) + "&focus=photo&lat=" + d.loc[1] + "&lng=" + d.loc[0] + "&z=17").call(_t.append("streetside.report"));
+ let bubbleIdQuadKey = d.key.toString(4);
+ const paddingNeeded = 16 - bubbleIdQuadKey.length;
+ for (let i2 = 0; i2 < paddingNeeded; i2++) {
+ bubbleIdQuadKey = "0" + bubbleIdQuadKey;
+ }
+ const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
+ const imgUrlSuffix = ".jpg?g=6338&n=z";
+ const faceKeys = ["01", "02", "03", "10", "11", "12"];
+ let quadKeys = getQuadKeys();
+ let faces = faceKeys.map((faceKey) => {
+ return quadKeys.map((quadKey) => {
+ const xy = qkToXY(quadKey);
+ return {
+ face: faceKey,
+ url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
+ x: xy[0],
+ y: xy[1]
+ };
+ });
+ });
+ loadFaces(faces).then(function() {
+ if (!_pannellumViewer) {
+ that.initViewer();
+ } else {
+ _currScene += 1;
+ let sceneID = _currScene.toString();
+ _pannellumViewer.addScene(sceneID, _sceneOptions).loadScene(sceneID);
+ if (_currScene > 2) {
+ sceneID = (_currScene - 1).toString();
+ _pannellumViewer.removeScene(sceneID);
+ }
+ }
+ });
+ return this;
+ },
+ getSequenceKeyForBubble: function(d) {
+ return d && d.sequenceKey;
+ },
+ setStyles: function(context, hovered, reset) {
+ if (reset) {
+ context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
+ context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
+ }
+ let hoveredBubbleKey = hovered && hovered.key;
+ let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
+ let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
+ let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d) => d.key) || [];
+ let viewer = context.container().select(".photoviewer");
+ let selected = viewer.empty() ? void 0 : viewer.datum();
+ let selectedBubbleKey = selected && selected.key;
+ let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
+ let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
+ let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d) => d.key) || [];
+ let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
+ context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d) => highlightedBubbleKeys.indexOf(d.key) !== -1).classed("hovered", (d) => d.key === hoveredBubbleKey).classed("currentView", (d) => d.key === selectedBubbleKey);
+ context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d) => d.properties.key === hoveredSequenceKey).classed("currentView", (d) => d.properties.key === selectedSequenceKey);
+ context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
+ function viewfieldPath() {
+ let d = this.parentNode.__data__;
+ if (d.pano && d.key !== selectedBubbleKey) {
+ return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
+ } else {
+ return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
}
+ }
+ return this;
+ },
+ updateUrlImage: function(imageKey) {
+ if (!window.mocha) {
+ var hash = utilStringQs(window.location.hash);
+ if (imageKey) {
+ hash.photo = "streetside/" + imageKey;
+ } else {
+ delete hash.photo;
+ }
+ window.location.replace("#" + utilQsString(hash, true));
+ }
+ },
+ cache: function() {
+ return _ssCache;
+ }
+ };
- localizedInputs.call(render, postfixed.reverse());
+ // modules/services/taginfo.js
+ var apibase4 = "https://taginfo.openstreetmap.org/api/4/";
+ var _inflight3 = {};
+ var _popularKeys = {};
+ var _taginfoCache = {};
+ var tag_sorts = {
+ point: "count_nodes",
+ vertex: "count_nodes",
+ area: "count_ways",
+ line: "count_ways"
+ };
+ var tag_sort_members = {
+ point: "count_node_members",
+ vertex: "count_node_members",
+ area: "count_way_members",
+ line: "count_way_members",
+ relation: "count_relation_members"
+ };
+ var tag_filters = {
+ point: "nodes",
+ vertex: "nodes",
+ area: "ways",
+ line: "ways"
+ };
+ var tag_members_fractions = {
+ point: "count_node_members_fraction",
+ vertex: "count_node_members_fraction",
+ area: "count_way_members_fraction",
+ line: "count_way_members_fraction",
+ relation: "count_relation_members_fraction"
+ };
+ function sets(params, n2, o) {
+ if (params.geometry && o[params.geometry]) {
+ params[n2] = o[params.geometry];
+ }
+ return params;
+ }
+ function setFilter(params) {
+ return sets(params, "filter", tag_filters);
+ }
+ function setSort(params) {
+ return sets(params, "sortname", tag_sorts);
+ }
+ function setSortMembers(params) {
+ return sets(params, "sortname", tag_sort_members);
+ }
+ function clean(params) {
+ return utilObjectOmit(params, ["geometry", "debounce"]);
+ }
+ function filterKeys(type3) {
+ var count_type = type3 ? "count_" + type3 : "count_all";
+ return function(d) {
+ return parseFloat(d[count_type]) > 2500 || d.in_wiki;
};
-
- localized.focus = function() {
- input.node().focus();
+ }
+ function filterMultikeys(prefix) {
+ return function(d) {
+ var re2 = new RegExp("^" + prefix + "(.*)$");
+ var matches = d.key.match(re2) || [];
+ return matches.length === 2 && matches[1].indexOf(":") === -1;
};
-
- localized.entity = function(_) {
- if (!arguments.length) return entity;
- entity = _;
- return localized;
+ }
+ function filterValues(allowUpperCase) {
+ return function(d) {
+ if (d.value.match(/[;,]/) !== null)
+ return false;
+ if (!allowUpperCase && d.value.match(/[A-Z*]/) !== null)
+ return false;
+ return parseFloat(d.fraction) > 0;
};
-
- return d3.rebind(localized, dispatch, 'on');
-};
-iD.ui.preset.maxspeed = function(field, context) {
- var dispatch = d3.dispatch('change'),
- entity,
- imperial,
- unitInput,
- combobox,
- input;
-
- var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],
- imperialValues = [20, 25, 30, 35, 40, 45, 50, 55, 65, 70];
-
- function maxspeed(selection) {
- combobox = d3.combobox();
- var unitCombobox = d3.combobox().data(['km/h', 'mph'].map(comboValues));
-
- input = selection.selectAll('#preset-input-' + field.id)
- .data([0]);
-
- input.enter().append('input')
- .attr('type', 'text')
- .attr('id', 'preset-input-' + field.id)
- .attr('placeholder', field.placeholder());
-
- input
- .call(combobox)
- .on('change', change)
- .on('blur', change);
-
- var childNodes = context.graph().childNodes(context.entity(entity.id)),
- loc = childNodes[~~(childNodes.length/2)].loc;
-
- imperial = _.some(iD.data.imperial.features, function(f) {
- return _.some(f.geometry.coordinates, function(d) {
- return iD.geo.pointInPolygon(loc, d[0]);
- });
+ }
+ function filterRoles(geometry) {
+ return function(d) {
+ if (d.role === "")
+ return false;
+ if (d.role.match(/[A-Z*;,]/) !== null)
+ return false;
+ return parseFloat(d[tag_members_fractions[geometry]]) > 0;
+ };
+ }
+ function valKey(d) {
+ return {
+ value: d.key,
+ title: d.key
+ };
+ }
+ function valKeyDescription(d) {
+ var obj = {
+ value: d.value,
+ title: d.description || d.value
+ };
+ if (d.count) {
+ obj.count = d.count;
+ }
+ return obj;
+ }
+ function roleKey(d) {
+ return {
+ value: d.role,
+ title: d.role
+ };
+ }
+ function sortKeys(a, b) {
+ return a.key.indexOf(":") === -1 && b.key.indexOf(":") !== -1 ? -1 : a.key.indexOf(":") !== -1 && b.key.indexOf(":") === -1 ? 1 : 0;
+ }
+ var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
+ function request2(url, params, exactMatch, callback, loaded) {
+ if (_inflight3[url])
+ return;
+ if (checkCache(url, params, exactMatch, callback))
+ return;
+ var controller = new AbortController();
+ _inflight3[url] = controller;
+ json_default(url, { signal: controller.signal }).then(function(result) {
+ delete _inflight3[url];
+ if (loaded)
+ loaded(null, result);
+ }).catch(function(err) {
+ delete _inflight3[url];
+ if (err.name === "AbortError")
+ return;
+ if (loaded)
+ loaded(err.message);
+ });
+ }
+ function checkCache(url, params, exactMatch, callback) {
+ var rp = params.rp || 25;
+ var testQuery = params.query || "";
+ var testUrl = url;
+ do {
+ var hit = _taginfoCache[testUrl];
+ if (hit && (url === testUrl || hit.length < rp)) {
+ callback(null, hit);
+ return true;
+ }
+ if (exactMatch || !testQuery.length)
+ return false;
+ testQuery = testQuery.slice(0, -1);
+ testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
+ } while (testQuery.length >= 0);
+ return false;
+ }
+ var taginfo_default = {
+ init: function() {
+ _inflight3 = {};
+ _taginfoCache = {};
+ _popularKeys = {
+ postal_code: true,
+ full_name: true,
+ loc_name: true,
+ reg_name: true,
+ short_name: true,
+ sorting_name: true,
+ artist_name: true,
+ nat_name: true,
+ long_name: true,
+ "bridge:name": true
+ };
+ var params = {
+ rp: 100,
+ sortname: "values_all",
+ sortorder: "desc",
+ page: 1,
+ debounce: false,
+ lang: _mainLocalizer.languageCode()
+ };
+ this.keys(params, function(err, data) {
+ if (err)
+ return;
+ data.forEach(function(d) {
+ if (d.value === "opening_hours")
+ return;
+ _popularKeys[d.value] = true;
});
-
- unitInput = selection.selectAll('input.maxspeed-unit')
- .data([0]);
-
- unitInput.enter().append('input')
- .attr('type', 'text')
- .attr('class', 'maxspeed-unit');
-
- unitInput
- .on('blur', changeUnits)
- .on('change', changeUnits)
- .call(unitCombobox);
-
- function changeUnits() {
- imperial = unitInput.value() === 'mph';
- unitInput.value(imperial ? 'mph' : 'km/h');
- setSuggestions();
- change();
+ });
+ },
+ reset: function() {
+ Object.values(_inflight3).forEach(function(controller) {
+ controller.abort();
+ });
+ _inflight3 = {};
+ },
+ keys: function(params, callback) {
+ var doRequest = params.debounce ? debouncedRequest2 : request2;
+ params = clean(setSort(params));
+ params = Object.assign({
+ rp: 10,
+ sortname: "count_all",
+ sortorder: "desc",
+ page: 1,
+ lang: _mainLocalizer.languageCode()
+ }, params);
+ var url = apibase4 + "keys/all?" + utilQsString(params);
+ doRequest(url, params, false, callback, function(err, d) {
+ if (err) {
+ callback(err);
+ } else {
+ var f2 = filterKeys(params.filter);
+ var result = d.data.filter(f2).sort(sortKeys).map(valKey);
+ _taginfoCache[url] = result;
+ callback(null, result);
+ }
+ });
+ },
+ multikeys: function(params, callback) {
+ var doRequest = params.debounce ? debouncedRequest2 : request2;
+ params = clean(setSort(params));
+ params = Object.assign({
+ rp: 25,
+ sortname: "count_all",
+ sortorder: "desc",
+ page: 1,
+ lang: _mainLocalizer.languageCode()
+ }, params);
+ var prefix = params.query;
+ var url = apibase4 + "keys/all?" + utilQsString(params);
+ doRequest(url, params, true, callback, function(err, d) {
+ if (err) {
+ callback(err);
+ } else {
+ var f2 = filterMultikeys(prefix);
+ var result = d.data.filter(f2).map(valKey);
+ _taginfoCache[url] = result;
+ callback(null, result);
+ }
+ });
+ },
+ values: function(params, callback) {
+ var key = params.key;
+ if (key && _popularKeys[key]) {
+ callback(null, []);
+ return;
+ }
+ var doRequest = params.debounce ? debouncedRequest2 : request2;
+ params = clean(setSort(setFilter(params)));
+ params = Object.assign({
+ rp: 25,
+ sortname: "count_all",
+ sortorder: "desc",
+ page: 1,
+ lang: _mainLocalizer.languageCode()
+ }, params);
+ var url = apibase4 + "key/values?" + utilQsString(params);
+ doRequest(url, params, false, callback, function(err, d) {
+ if (err) {
+ callback(err);
+ } else {
+ var re2 = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale/;
+ var allowUpperCase = re2.test(params.key);
+ var f2 = filterValues(allowUpperCase);
+ var result = d.data.filter(f2).map(valKeyDescription);
+ _taginfoCache[url] = result;
+ callback(null, result);
}
-
+ });
+ },
+ roles: function(params, callback) {
+ var doRequest = params.debounce ? debouncedRequest2 : request2;
+ var geometry = params.geometry;
+ params = clean(setSortMembers(params));
+ params = Object.assign({
+ rp: 25,
+ sortname: "count_all_members",
+ sortorder: "desc",
+ page: 1,
+ lang: _mainLocalizer.languageCode()
+ }, params);
+ var url = apibase4 + "relation/roles?" + utilQsString(params);
+ doRequest(url, params, true, callback, function(err, d) {
+ if (err) {
+ callback(err);
+ } else {
+ var f2 = filterRoles(geometry);
+ var result = d.data.filter(f2).map(roleKey);
+ _taginfoCache[url] = result;
+ callback(null, result);
+ }
+ });
+ },
+ docs: function(params, callback) {
+ var doRequest = params.debounce ? debouncedRequest2 : request2;
+ params = clean(setSort(params));
+ var path = "key/wiki_pages?";
+ if (params.value) {
+ path = "tag/wiki_pages?";
+ } else if (params.rtype) {
+ path = "relation/wiki_pages?";
+ }
+ var url = apibase4 + path + utilQsString(params);
+ doRequest(url, params, true, callback, function(err, d) {
+ if (err) {
+ callback(err);
+ } else {
+ _taginfoCache[url] = d.data;
+ callback(null, d.data);
+ }
+ });
+ },
+ apibase: function(_) {
+ if (!arguments.length)
+ return apibase4;
+ apibase4 = _;
+ return this;
}
+ };
- function setSuggestions() {
- combobox.data((imperial ? imperialValues : metricValues).map(comboValues));
- unitInput.value(imperial ? 'mph' : 'km/h');
+ // modules/services/vector_tile.js
+ var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
+
+ // node_modules/@turf/helpers/dist/es/index.js
+ var earthRadius = 63710088e-1;
+ var factors = {
+ centimeters: earthRadius * 100,
+ centimetres: earthRadius * 100,
+ degrees: earthRadius / 111325,
+ feet: earthRadius * 3.28084,
+ inches: earthRadius * 39.37,
+ kilometers: earthRadius / 1e3,
+ kilometres: earthRadius / 1e3,
+ meters: earthRadius,
+ metres: earthRadius,
+ miles: earthRadius / 1609.344,
+ millimeters: earthRadius * 1e3,
+ millimetres: earthRadius * 1e3,
+ nauticalmiles: earthRadius / 1852,
+ radians: 1,
+ yards: earthRadius * 1.0936
+ };
+ var unitsFactors = {
+ centimeters: 100,
+ centimetres: 100,
+ degrees: 1 / 111325,
+ feet: 3.28084,
+ inches: 39.37,
+ kilometers: 1 / 1e3,
+ kilometres: 1 / 1e3,
+ meters: 1,
+ metres: 1,
+ miles: 1 / 1609.344,
+ millimeters: 1e3,
+ millimetres: 1e3,
+ nauticalmiles: 1 / 1852,
+ radians: 1 / earthRadius,
+ yards: 1.0936133
+ };
+ function feature2(geom, properties, options2) {
+ if (options2 === void 0) {
+ options2 = {};
}
-
- function comboValues(d) {
- return {
- value: d.toString(),
- title: d.toString()
- };
+ var feat = { type: "Feature" };
+ if (options2.id === 0 || options2.id) {
+ feat.id = options2.id;
}
-
- function change() {
- var tag = {},
- value = input.value();
-
- if (!value) {
- tag[field.key] = undefined;
- } else if (isNaN(value) || !imperial) {
- tag[field.key] = value;
- } else {
- tag[field.key] = value + ' mph';
- }
-
- dispatch.change(tag);
+ if (options2.bbox) {
+ feat.bbox = options2.bbox;
}
-
- maxspeed.tags = function(tags) {
- var value = tags[field.key];
-
- if (value && value.indexOf('mph') >= 0) {
- value = parseInt(value, 10);
- imperial = true;
- } else if (value) {
- imperial = false;
+ feat.properties = properties || {};
+ feat.geometry = geom;
+ return feat;
+ }
+ function polygon(coordinates, properties, options2) {
+ if (options2 === void 0) {
+ options2 = {};
+ }
+ for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
+ var ring = coordinates_1[_i];
+ if (ring.length < 4) {
+ throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
+ }
+ for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
+ if (ring[ring.length - 1][j2] !== ring[0][j2]) {
+ throw new Error("First and last Position are not equivalent.");
}
-
- setSuggestions();
-
- input.value(value || '');
+ }
+ }
+ var geom = {
+ type: "Polygon",
+ coordinates
};
-
- maxspeed.focus = function() {
- input.node().focus();
+ return feature2(geom, properties, options2);
+ }
+ function lineString(coordinates, properties, options2) {
+ if (options2 === void 0) {
+ options2 = {};
+ }
+ if (coordinates.length < 2) {
+ throw new Error("coordinates must be an array of two or more positions");
+ }
+ var geom = {
+ type: "LineString",
+ coordinates
};
-
- maxspeed.entity = function(_) {
- entity = _;
+ return feature2(geom, properties, options2);
+ }
+ function multiLineString(coordinates, properties, options2) {
+ if (options2 === void 0) {
+ options2 = {};
+ }
+ var geom = {
+ type: "MultiLineString",
+ coordinates
};
-
- return d3.rebind(maxspeed, dispatch, 'on');
-};
-iD.ui.preset.radio = function(field) {
- var dispatch = d3.dispatch('change'),
- labels, radios, placeholder;
-
- function radio(selection) {
- selection.classed('preset-radio', true);
-
- var wrap = selection.selectAll('.preset-input-wrap')
- .data([0]);
-
- var buttonWrap = wrap.enter().append('div')
- .attr('class', 'preset-input-wrap toggle-list');
-
- buttonWrap.append('span')
- .attr('class', 'placeholder');
-
- placeholder = selection.selectAll('.placeholder');
-
- labels = wrap.selectAll('label')
- .data(field.options || field.keys);
-
- var enter = labels.enter().append('label');
-
- enter.append('input')
- .attr('type', 'radio')
- .attr('name', field.id)
- .attr('value', function(d) { return field.t('options.' + d, { 'default': d }); })
- .attr('checked', false);
-
- enter.append('span')
- .text(function(d) { return field.t('options.' + d, { 'default': d }); });
-
- radios = labels.selectAll('input')
- .on('change', change);
+ return feature2(geom, properties, options2);
+ }
+ function multiPolygon(coordinates, properties, options2) {
+ if (options2 === void 0) {
+ options2 = {};
}
+ var geom = {
+ type: "MultiPolygon",
+ coordinates
+ };
+ return feature2(geom, properties, options2);
+ }
- function change() {
- var t = {};
- if (field.key) t[field.key] = undefined;
- radios.each(function(d) {
- var active = d3.select(this).property('checked');
- if (field.key) {
- if (active) t[field.key] = d;
- } else {
- t[d] = active ? 'yes' : undefined;
- }
- });
- dispatch.change(t);
+ // node_modules/@turf/invariant/dist/es/index.js
+ function getGeom(geojson) {
+ if (geojson.type === "Feature") {
+ return geojson.geometry;
}
+ return geojson;
+ }
- radio.tags = function(tags) {
- function checked(d) {
- if (field.key) {
- return tags[field.key] === d;
- } else {
- return !!(tags[d] && tags[d] !== 'no');
+ // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
+ function lineclip(points, bbox, result) {
+ var len = points.length, codeA = bitCode(points[0], bbox), part = [], i2, codeB, lastCode;
+ var a;
+ var b;
+ if (!result)
+ result = [];
+ for (i2 = 1; i2 < len; i2++) {
+ a = points[i2 - 1];
+ b = points[i2];
+ codeB = lastCode = bitCode(b, bbox);
+ while (true) {
+ if (!(codeA | codeB)) {
+ part.push(a);
+ if (codeB !== lastCode) {
+ part.push(b);
+ if (i2 < len - 1) {
+ result.push(part);
+ part = [];
}
- }
-
- labels.classed('active', checked);
- radios.property('checked', checked);
- var selection = radios.filter(function() { return this.checked; });
- if (selection.empty()) {
- placeholder.text(t('inspector.none'));
+ } else if (i2 === len - 1) {
+ part.push(b);
+ }
+ break;
+ } else if (codeA & codeB) {
+ break;
+ } else if (codeA) {
+ a = intersect(a, b, codeA, bbox);
+ codeA = bitCode(a, bbox);
} else {
- placeholder.text(selection.attr('value'));
+ b = intersect(a, b, codeB, bbox);
+ codeB = bitCode(b, bbox);
}
- };
-
- radio.focus = function() {
- radios.node().focus();
- };
-
- return d3.rebind(radio, dispatch, 'on');
-};
-iD.ui.preset.restrictions = function(field, context) {
- var dispatch = d3.dispatch('change'),
- hover = iD.behavior.Hover(context),
- vertexID,
- fromNodeID;
-
+ }
+ codeA = lastCode;
+ }
+ if (part.length)
+ result.push(part);
+ return result;
+ }
+ function polygonclip(points, bbox) {
+ var result, edge, prev, prevInside, i2, p, inside;
+ for (edge = 1; edge <= 8; edge *= 2) {
+ result = [];
+ prev = points[points.length - 1];
+ prevInside = !(bitCode(prev, bbox) & edge);
+ for (i2 = 0; i2 < points.length; i2++) {
+ p = points[i2];
+ inside = !(bitCode(p, bbox) & edge);
+ if (inside !== prevInside)
+ result.push(intersect(prev, p, edge, bbox));
+ if (inside)
+ result.push(p);
+ prev = p;
+ prevInside = inside;
+ }
+ points = result;
+ if (!points.length)
+ break;
+ }
+ return result;
+ }
+ function intersect(a, b, edge, bbox) {
+ return edge & 8 ? [a[0] + (b[0] - a[0]) * (bbox[3] - a[1]) / (b[1] - a[1]), bbox[3]] : edge & 4 ? [a[0] + (b[0] - a[0]) * (bbox[1] - a[1]) / (b[1] - a[1]), bbox[1]] : edge & 2 ? [bbox[2], a[1] + (b[1] - a[1]) * (bbox[2] - a[0]) / (b[0] - a[0])] : edge & 1 ? [bbox[0], a[1] + (b[1] - a[1]) * (bbox[0] - a[0]) / (b[0] - a[0])] : null;
+ }
+ function bitCode(p, bbox) {
+ var code = 0;
+ if (p[0] < bbox[0])
+ code |= 1;
+ else if (p[0] > bbox[2])
+ code |= 2;
+ if (p[1] < bbox[1])
+ code |= 4;
+ else if (p[1] > bbox[3])
+ code |= 8;
+ return code;
+ }
- function restrictions(selection) {
- // if form field is hidden or has detached from dom, clean up.
- if (!d3.select('.inspector-wrap.inspector-hidden').empty() || !selection.node().parentNode) {
- selection.call(restrictions.off);
- return;
+ // node_modules/@turf/bbox-clip/dist/es/index.js
+ function bboxClip(feature3, bbox) {
+ var geom = getGeom(feature3);
+ var type3 = geom.type;
+ var properties = feature3.type === "Feature" ? feature3.properties : {};
+ var coords = geom.coordinates;
+ switch (type3) {
+ case "LineString":
+ case "MultiLineString": {
+ var lines_1 = [];
+ if (type3 === "LineString") {
+ coords = [coords];
+ }
+ coords.forEach(function(line) {
+ lineclip(line, bbox, lines_1);
+ });
+ if (lines_1.length === 1) {
+ return lineString(lines_1[0], properties);
}
-
- var wrap = selection.selectAll('.preset-input-wrap')
- .data([0]);
-
- var enter = wrap.enter()
- .append('div')
- .attr('class', 'preset-input-wrap');
-
- enter
- .append('div')
- .attr('class', 'restriction-help');
-
-
- var intersection = iD.geo.Intersection(context.graph(), vertexID),
- graph = intersection.graph,
- vertex = graph.entity(vertexID),
- filter = d3.functor(true),
- extent = iD.geo.Extent(),
- projection = iD.geo.RawMercator();
-
- var d = wrap.dimensions(),
- c = [d[0] / 2, d[1] / 2],
- z = 24;
-
- projection
- .scale(256 * Math.pow(2, z) / (2 * Math.PI));
-
- var s = projection(vertex.loc);
-
- projection
- .translate([c[0] - s[0], c[1] - s[1]])
- .clipExtent([[0, 0], d]);
-
- var drawLayers = iD.svg.Layers(projection, context).only('osm').dimensions(d),
- drawVertices = iD.svg.Vertices(projection, context),
- drawLines = iD.svg.Lines(projection, context),
- drawTurns = iD.svg.Turns(projection, context);
-
- enter
- .call(drawLayers)
- .selectAll('.surface')
- .call(hover);
-
-
- var surface = wrap.selectAll('.surface');
-
- surface
- .dimensions(d)
- .call(drawVertices, graph, [vertex], filter, extent, z)
- .call(drawLines, graph, intersection.ways, filter)
- .call(drawTurns, graph, intersection.turns(fromNodeID));
-
- surface
- .on('click.restrictions', click)
- .on('mouseover.restrictions', mouseover)
- .on('mouseout.restrictions', mouseout);
-
- surface
- .selectAll('.selected')
- .classed('selected', false);
-
- if (fromNodeID) {
- surface
- .selectAll('.' + intersection.highways[fromNodeID].id)
- .classed('selected', true);
+ return multiLineString(lines_1, properties);
+ }
+ case "Polygon":
+ return polygon(clipPolygon(coords, bbox), properties);
+ case "MultiPolygon":
+ return multiPolygon(coords.map(function(poly) {
+ return clipPolygon(poly, bbox);
+ }), properties);
+ default:
+ throw new Error("geometry " + type3 + " not supported");
+ }
+ }
+ function clipPolygon(rings, bbox) {
+ var outRings = [];
+ for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
+ var ring = rings_1[_i];
+ var clipped = polygonclip(ring, bbox);
+ if (clipped.length > 0) {
+ if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
+ clipped.push(clipped[0]);
+ }
+ if (clipped.length >= 4) {
+ outRings.push(clipped);
}
+ }
+ }
+ return outRings;
+ }
- mouseout();
-
- context.history()
- .on('change.restrictions', render);
-
- d3.select(window)
- .on('resize.restrictions', function() {
- wrap.dimensions(null);
- render();
- });
-
- function click() {
- var datum = d3.event.target.__data__;
- if (datum instanceof iD.Entity) {
- fromNodeID = intersection.adjacentNodeId(datum.id);
- render();
- } else if (datum instanceof iD.geo.Turn) {
- if (datum.restriction) {
- context.perform(
- iD.actions.UnrestrictTurn(datum, projection),
- t('operations.restriction.annotation.delete'));
- } else {
- context.perform(
- iD.actions.RestrictTurn(datum, projection),
- t('operations.restriction.annotation.create'));
- }
+ // modules/services/vector_tile.js
+ var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
+ var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
+ var import_pbf2 = __toESM(require_pbf());
+ var import_vector_tile2 = __toESM(require_vector_tile());
+ var tiler7 = utilTiler().tileSize(512).margin(1);
+ var dispatch9 = dispatch_default("loadedData");
+ var _vtCache;
+ function abortRequest7(controller) {
+ controller.abort();
+ }
+ function vtToGeoJSON(data, tile, mergeCache) {
+ var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
+ var layers = Object.keys(vectorTile.layers);
+ if (!Array.isArray(layers)) {
+ layers = [layers];
+ }
+ var features2 = [];
+ layers.forEach(function(layerID) {
+ var layer = vectorTile.layers[layerID];
+ if (layer) {
+ for (var i2 = 0; i2 < layer.length; i2++) {
+ var feature3 = layer.feature(i2).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
+ var geometry = feature3.geometry;
+ if (geometry.type === "Polygon") {
+ geometry.type = "MultiPolygon";
+ geometry.coordinates = [geometry.coordinates];
+ }
+ var isClipped = false;
+ if (geometry.type === "MultiPolygon") {
+ var featureClip = bboxClip(feature3, tile.extent.rectangle());
+ if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
+ isClipped = true;
}
- }
-
- function mouseover() {
- var datum = d3.event.target.__data__;
- if (datum instanceof iD.geo.Turn) {
- var graph = context.graph(),
- presets = context.presets(),
- preset;
-
- if (datum.restriction) {
- preset = presets.match(graph.entity(datum.restriction), graph);
- } else {
- preset = presets.item('type/restriction/' +
- iD.geo.inferRestriction(
- graph,
- datum.from,
- datum.via,
- datum.to,
- projection));
- }
-
- wrap.selectAll('.restriction-help')
- .text(t('operations.restriction.help.' +
- (datum.restriction ? 'toggle_off' : 'toggle_on'),
- {restriction: preset.name()}));
+ if (!feature3.geometry.coordinates.length)
+ continue;
+ if (!feature3.geometry.coordinates[0].length)
+ continue;
+ }
+ var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
+ var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
+ feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
+ feature3.__featurehash__ = featurehash;
+ feature3.__propertyhash__ = propertyhash;
+ features2.push(feature3);
+ if (isClipped && geometry.type === "MultiPolygon") {
+ var merged = mergeCache[propertyhash];
+ if (merged && merged.length) {
+ var other = merged[0];
+ var coords = import_polygon_clipping2.default.union(feature3.geometry.coordinates, other.geometry.coordinates);
+ if (!coords || !coords.length) {
+ continue;
+ }
+ merged.push(feature3);
+ for (var j2 = 0; j2 < merged.length; j2++) {
+ merged[j2].geometry.coordinates = coords;
+ merged[j2].__featurehash__ = featurehash;
+ }
+ } else {
+ mergeCache[propertyhash] = [feature3];
}
+ }
}
-
- function mouseout() {
- wrap.selectAll('.restriction-help')
- .text(t('operations.restriction.help.' +
- (fromNodeID ? 'toggle' : 'select')));
+ }
+ });
+ return features2;
+ }
+ function loadTile2(source, tile) {
+ if (source.loaded[tile.id] || source.inflight[tile.id])
+ return;
+ var url = source.template.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace(/\{[t-]y\}/, Math.pow(2, tile.xyz[2]) - tile.xyz[1] - 1).replace(/\{z(oom)?\}/, tile.xyz[2]).replace(/\{switch:([^}]+)\}/, function(s, r) {
+ var subdomains = r.split(",");
+ return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
+ });
+ var controller = new AbortController();
+ source.inflight[tile.id] = controller;
+ fetch(url, { signal: controller.signal }).then(function(response) {
+ if (!response.ok) {
+ throw new Error(response.status + " " + response.statusText);
+ }
+ source.loaded[tile.id] = [];
+ delete source.inflight[tile.id];
+ return response.arrayBuffer();
+ }).then(function(data) {
+ if (!data) {
+ throw new Error("No Data");
+ }
+ var z = tile.xyz[2];
+ if (!source.canMerge[z]) {
+ source.canMerge[z] = {};
+ }
+ source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z]);
+ dispatch9.call("loadedData");
+ }).catch(function() {
+ source.loaded[tile.id] = [];
+ delete source.inflight[tile.id];
+ });
+ }
+ var vector_tile_default = {
+ init: function() {
+ if (!_vtCache) {
+ this.reset();
+ }
+ this.event = utilRebind(this, dispatch9, "on");
+ },
+ reset: function() {
+ for (var sourceID in _vtCache) {
+ var source = _vtCache[sourceID];
+ if (source && source.inflight) {
+ Object.values(source.inflight).forEach(abortRequest7);
}
-
- function render() {
- if (context.hasEntity(vertexID)) {
- restrictions(selection);
- }
+ }
+ _vtCache = {};
+ },
+ addSource: function(sourceID, template) {
+ _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
+ return _vtCache[sourceID];
+ },
+ data: function(sourceID, projection2) {
+ var source = _vtCache[sourceID];
+ if (!source)
+ return [];
+ var tiles = tiler7.getTiles(projection2);
+ var seen = {};
+ var results = [];
+ for (var i2 = 0; i2 < tiles.length; i2++) {
+ var features2 = source.loaded[tiles[i2].id];
+ if (!features2 || !features2.length)
+ continue;
+ for (var j2 = 0; j2 < features2.length; j2++) {
+ var feature3 = features2[j2];
+ var hash = feature3.__featurehash__;
+ if (seen[hash])
+ continue;
+ seen[hash] = true;
+ results.push(Object.assign({}, feature3));
}
- }
-
- restrictions.entity = function(_) {
- if (!vertexID || vertexID !== _.id) {
- fromNodeID = null;
- vertexID = _.id;
+ }
+ return results;
+ },
+ loadTiles: function(sourceID, template, projection2) {
+ var source = _vtCache[sourceID];
+ if (!source) {
+ source = this.addSource(sourceID, template);
+ }
+ var tiles = tiler7.getTiles(projection2);
+ Object.keys(source.inflight).forEach(function(k) {
+ var wanted = tiles.find(function(tile) {
+ return k === tile.id;
+ });
+ if (!wanted) {
+ abortRequest7(source.inflight[k]);
+ delete source.inflight[k];
}
- };
-
- restrictions.tags = function() {};
- restrictions.focus = function() {};
-
- restrictions.off = function(selection) {
- selection.selectAll('.surface')
- .call(hover.off)
- .on('click.restrictions', null)
- .on('mouseover.restrictions', null)
- .on('mouseout.restrictions', null);
-
- context.history()
- .on('change.restrictions', null);
-
- d3.select(window)
- .on('resize.restrictions', null);
- };
-
- return d3.rebind(restrictions, dispatch, 'on');
-};
-iD.ui.preset.textarea = function(field) {
- var dispatch = d3.dispatch('change'),
- input;
-
- function textarea(selection) {
- input = selection.selectAll('textarea')
- .data([0]);
-
- input.enter().append('textarea')
- .attr('id', 'preset-input-' + field.id)
- .attr('placeholder', field.placeholder() || t('inspector.unknown'))
- .attr('maxlength', 255);
-
- input
- .on('input', change(true))
- .on('blur', change())
- .on('change', change());
+ });
+ tiles.forEach(function(tile) {
+ loadTile2(source, tile);
+ });
+ },
+ cache: function() {
+ return _vtCache;
}
+ };
- function change(onInput) {
- return function() {
- var t = {};
- t[field.key] = input.value() || undefined;
- dispatch.change(t, onInput);
+ // modules/services/wikidata.js
+ var apibase5 = "https://www.wikidata.org/w/api.php?";
+ var _wikidataCache = {};
+ var wikidata_default = {
+ init: function() {
+ },
+ reset: function() {
+ _wikidataCache = {};
+ },
+ itemsForSearchQuery: function(query, callback) {
+ if (!query) {
+ if (callback)
+ callback("No query", {});
+ return;
+ }
+ var lang = this.languagesToQuery()[0];
+ var url = apibase5 + utilQsString({
+ action: "wbsearchentities",
+ format: "json",
+ formatversion: 2,
+ search: query,
+ type: "item",
+ language: lang,
+ uselang: lang,
+ limit: 10,
+ origin: "*"
+ });
+ json_default(url).then(function(result) {
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ if (callback)
+ callback(null, result.search || {});
+ }).catch(function(err) {
+ if (callback)
+ callback(err.message, {});
+ });
+ },
+ itemsByTitle: function(lang, title, callback) {
+ if (!title) {
+ if (callback)
+ callback("No title", {});
+ return;
+ }
+ lang = lang || "en";
+ var url = apibase5 + utilQsString({
+ action: "wbgetentities",
+ format: "json",
+ formatversion: 2,
+ sites: lang.replace(/-/g, "_") + "wiki",
+ titles: title,
+ languages: "en",
+ origin: "*"
+ });
+ json_default(url).then(function(result) {
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ if (callback)
+ callback(null, result.entities || {});
+ }).catch(function(err) {
+ if (callback)
+ callback(err.message, {});
+ });
+ },
+ languagesToQuery: function() {
+ return _mainLocalizer.localeCodes().map(function(code) {
+ return code.toLowerCase();
+ }).filter(function(code) {
+ return code !== "en-us";
+ });
+ },
+ entityByQID: function(qid, callback) {
+ if (!qid) {
+ callback("No qid", {});
+ return;
+ }
+ if (_wikidataCache[qid]) {
+ if (callback)
+ callback(null, _wikidataCache[qid]);
+ return;
+ }
+ var langs = this.languagesToQuery();
+ var url = apibase5 + utilQsString({
+ action: "wbgetentities",
+ format: "json",
+ formatversion: 2,
+ ids: qid,
+ props: "labels|descriptions|claims|sitelinks",
+ sitefilter: langs.map(function(d) {
+ return d + "wiki";
+ }).join("|"),
+ languages: langs.join("|"),
+ languagefallback: 1,
+ origin: "*"
+ });
+ json_default(url).then(function(result) {
+ if (result && result.error) {
+ throw new Error(result.error);
+ }
+ if (callback)
+ callback(null, result.entities[qid] || {});
+ }).catch(function(err) {
+ if (callback)
+ callback(err.message, {});
+ });
+ },
+ getDocs: function(params, callback) {
+ var langs = this.languagesToQuery();
+ this.entityByQID(params.qid, function(err, entity) {
+ if (err || !entity) {
+ callback(err || "No entity");
+ return;
+ }
+ var i2;
+ var description2;
+ for (i2 in langs) {
+ let code = langs[i2];
+ if (entity.descriptions[code] && entity.descriptions[code].language === code) {
+ description2 = entity.descriptions[code];
+ break;
+ }
+ }
+ if (!description2 && Object.values(entity.descriptions).length)
+ description2 = Object.values(entity.descriptions)[0];
+ var result = {
+ title: entity.id,
+ description: description2 ? description2.value : "",
+ descriptionLocaleCode: description2 ? description2.language : "",
+ editURL: "https://www.wikidata.org/wiki/" + entity.id
};
+ if (entity.claims) {
+ var imageroot = "https://commons.wikimedia.org/w/index.php";
+ var props = ["P154", "P18"];
+ var prop, image;
+ for (i2 = 0; i2 < props.length; i2++) {
+ prop = entity.claims[props[i2]];
+ if (prop && Object.keys(prop).length > 0) {
+ image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
+ if (image) {
+ result.imageURL = imageroot + "?" + utilQsString({
+ title: "Special:Redirect/file/" + image,
+ width: 400
+ });
+ break;
+ }
+ }
+ }
+ }
+ if (entity.sitelinks) {
+ var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
+ for (i2 = 0; i2 < langs.length; i2++) {
+ var w = langs[i2] + "wiki";
+ if (entity.sitelinks[w]) {
+ var title = entity.sitelinks[w].title;
+ var tKey = "inspector.wiki_reference";
+ if (!englishLocale && langs[i2] === "en") {
+ tKey = "inspector.wiki_en_reference";
+ }
+ result.wiki = {
+ title,
+ text: tKey,
+ url: "https://" + langs[i2] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
+ };
+ break;
+ }
+ }
+ }
+ callback(null, result);
+ });
}
+ };
- textarea.tags = function(tags) {
- input.value(tags[field.key] || '');
- };
-
- textarea.focus = function() {
- input.node().focus();
- };
-
- return d3.rebind(textarea, dispatch, 'on');
-};
-iD.ui.preset.wikipedia = function(field, context) {
- var dispatch = d3.dispatch('change'),
- wikipedia = iD.services.wikipedia(),
- wikidata = iD.services.wikidata(),
- link, entity, lang, title;
-
- function wiki(selection) {
- var langcombo = d3.combobox()
- .fetcher(function(value, cb) {
- var v = value.toLowerCase();
-
- cb(iD.data.wikipedia.filter(function(d) {
- return d[0].toLowerCase().indexOf(v) >= 0 ||
- d[1].toLowerCase().indexOf(v) >= 0 ||
- d[2].toLowerCase().indexOf(v) >= 0;
- }).map(function(d) {
- return { value: d[1] };
- }));
- });
-
- var titlecombo = d3.combobox()
- .fetcher(function(value, cb) {
-
- if (!value) value = context.entity(entity.id).tags.name || '';
- var searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
-
- searchfn(language()[2], value, function(query, data) {
- cb(data.map(function(d) {
- return { value: d };
- }));
- });
+ // modules/services/wikipedia.js
+ var endpoint = "https://en.wikipedia.org/w/api.php?";
+ var wikipedia_default = {
+ init: function() {
+ },
+ reset: function() {
+ },
+ search: function(lang, query, callback) {
+ if (!query) {
+ if (callback)
+ callback("No Query", []);
+ return;
+ }
+ lang = lang || "en";
+ var url = endpoint.replace("en", lang) + utilQsString({
+ action: "query",
+ list: "search",
+ srlimit: "10",
+ srinfo: "suggestion",
+ format: "json",
+ origin: "*",
+ srsearch: query
+ });
+ json_default(url).then(function(result) {
+ if (result && result.error) {
+ throw new Error(result.error);
+ } else if (!result || !result.query || !result.query.search) {
+ throw new Error("No Results");
+ }
+ if (callback) {
+ var titles = result.query.search.map(function(d) {
+ return d.title;
+ });
+ callback(null, titles);
+ }
+ }).catch(function(err) {
+ if (callback)
+ callback(err, []);
+ });
+ },
+ suggestions: function(lang, query, callback) {
+ if (!query) {
+ if (callback)
+ callback("", []);
+ return;
+ }
+ lang = lang || "en";
+ var url = endpoint.replace("en", lang) + utilQsString({
+ action: "opensearch",
+ namespace: 0,
+ suggest: "",
+ format: "json",
+ origin: "*",
+ search: query
+ });
+ json_default(url).then(function(result) {
+ if (result && result.error) {
+ throw new Error(result.error);
+ } else if (!result || result.length < 2) {
+ throw new Error("No Results");
+ }
+ if (callback)
+ callback(null, result[1] || []);
+ }).catch(function(err) {
+ if (callback)
+ callback(err.message, []);
+ });
+ },
+ translations: function(lang, title, callback) {
+ if (!title) {
+ if (callback)
+ callback("No Title");
+ return;
+ }
+ var url = endpoint.replace("en", lang) + utilQsString({
+ action: "query",
+ prop: "langlinks",
+ format: "json",
+ origin: "*",
+ lllimit: 500,
+ titles: title
+ });
+ json_default(url).then(function(result) {
+ if (result && result.error) {
+ throw new Error(result.error);
+ } else if (!result || !result.query || !result.query.pages) {
+ throw new Error("No Results");
+ }
+ if (callback) {
+ var list = result.query.pages[Object.keys(result.query.pages)[0]];
+ var translations = {};
+ if (list && list.langlinks) {
+ list.langlinks.forEach(function(d) {
+ translations[d.lang] = d["*"];
});
+ }
+ callback(null, translations);
+ }
+ }).catch(function(err) {
+ if (callback)
+ callback(err.message);
+ });
+ }
+ };
- lang = selection.selectAll('input.wiki-lang')
- .data([0]);
-
- lang.enter().append('input')
- .attr('type', 'text')
- .attr('class', 'wiki-lang')
- .attr('placeholder', t('translate.localized_translation_language'))
- .value('English');
-
- lang
- .call(langcombo)
- .on('blur', changeLang)
- .on('change', changeLang);
-
- title = selection.selectAll('input.wiki-title')
- .data([0]);
-
- title.enter().append('input')
- .attr('type', 'text')
- .attr('class', 'wiki-title')
- .attr('id', 'preset-input-' + field.id);
-
- title
- .call(titlecombo)
- .on('blur', blur)
- .on('change', change);
-
- link = selection.selectAll('a.wiki-link')
- .data([0]);
+ // modules/services/index.js
+ var services = {
+ geocoder: nominatim_default,
+ keepRight: keepRight_default,
+ improveOSM: improveOSM_default,
+ osmose: osmose_default,
+ mapillary: mapillary_default,
+ nsi: nsi_default,
+ kartaview: kartaview_default,
+ osm: osm_default,
+ osmWikibase: osm_wikibase_default,
+ maprules: maprules_default,
+ streetside: streetside_default,
+ taginfo: taginfo_default,
+ vectorTile: vector_tile_default,
+ wikidata: wikidata_default,
+ wikipedia: wikipedia_default
+ };
- link.enter().append('a')
- .attr('class', 'wiki-link button-input-action minor')
- .attr('tabindex', -1)
- .attr('target', '_blank')
- .call(iD.svg.Icon('#icon-out-link', 'inline'));
+ // modules/modes/drag_note.js
+ function modeDragNote(context) {
+ var mode = {
+ id: "drag-note",
+ button: "browse"
+ };
+ var edit2 = behaviorEdit(context);
+ var _nudgeInterval;
+ var _lastLoc;
+ var _note;
+ function startNudge(d3_event, nudge) {
+ if (_nudgeInterval)
+ window.clearInterval(_nudgeInterval);
+ _nudgeInterval = window.setInterval(function() {
+ context.map().pan(nudge);
+ doMove(d3_event, nudge);
+ }, 50);
+ }
+ function stopNudge() {
+ if (_nudgeInterval) {
+ window.clearInterval(_nudgeInterval);
+ _nudgeInterval = null;
+ }
}
-
- function language() {
- var value = lang.value().toLowerCase();
- var locale = iD.detect().locale.toLowerCase();
- var localeLanguage;
- return _.find(iD.data.wikipedia, function(d) {
- if (d[2] === locale) localeLanguage = d;
- return d[0].toLowerCase() === value ||
- d[1].toLowerCase() === value ||
- d[2] === value;
- }) || localeLanguage || ['English', 'English', 'en'];
+ function origin(note) {
+ return context.projection(note.loc);
}
-
- function changeLang() {
- lang.value(language()[1]);
- change(true);
+ function start2(d3_event, note) {
+ _note = note;
+ var osm = services.osm;
+ if (osm) {
+ _note = osm.getNote(_note.id);
+ }
+ context.surface().selectAll(".note-" + _note.id).classed("active", true);
+ context.perform(actionNoop());
+ context.enter(mode);
+ context.selectedNoteID(_note.id);
+ }
+ function move(d3_event, entity, point) {
+ d3_event.stopPropagation();
+ _lastLoc = context.projection.invert(point);
+ doMove(d3_event);
+ var nudge = geoViewportEdge(point, context.map().dimensions());
+ if (nudge) {
+ startNudge(d3_event, nudge);
+ } else {
+ stopNudge();
+ }
}
-
- function blur() {
- change(true);
+ function doMove(d3_event, nudge) {
+ nudge = nudge || [0, 0];
+ var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
+ var currMouse = geoVecSubtract(currPoint, nudge);
+ var loc = context.projection.invert(currMouse);
+ _note = _note.move(loc);
+ var osm = services.osm;
+ if (osm) {
+ osm.replaceNote(_note);
+ }
+ context.replace(actionNoop());
}
-
- function change(skipWikidata) {
- var value = title.value(),
- m = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/),
- l = m && _.find(iD.data.wikipedia, function(d) { return m[1] === d[2]; }),
- anchor,
- syncTags = {};
-
- if (l) {
- // Normalize title http://www.mediawiki.org/wiki/API:Query#Title_normalization
- value = decodeURIComponent(m[2]).replace(/_/g, ' ');
- if (m[3]) {
- try {
- // Best-effort `anchordecode:` implementation
- anchor = decodeURIComponent(m[3].replace(/\.([0-9A-F]{2})/g, '%$1'));
- } catch (e) {
- anchor = decodeURIComponent(m[3]);
- }
- value += '#' + anchor.replace(/_/g, ' ');
- }
- value = value.slice(0, 1).toUpperCase() + value.slice(1);
- lang.value(l[1]);
- title.value(value);
- }
-
- syncTags.wikipedia = value ? language()[2] + ':' + value : undefined;
- if (!skipWikidata) {
- syncTags.wikidata = undefined;
- }
-
- dispatch.change(syncTags);
-
-
- if (skipWikidata || !value || !language()[2]) return;
-
- // attempt asynchronous update of wikidata tag..
- var initEntityId = entity.id,
- initWikipedia = context.entity(initEntityId).tags.wikipedia;
-
- wikidata.itemsByTitle(language()[2], value, function (title, data) {
- // 1. most recent change was a tag change
- var annotation = t('operations.change_tags.annotation'),
- currAnnotation = context.history().undoAnnotation();
- if (currAnnotation !== annotation) return;
-
- // 2. same entity exists and still selected
- var selectedIds = context.selectedIDs(),
- currEntityId = selectedIds.length > 0 && selectedIds[0];
- if (currEntityId !== initEntityId) return;
-
- // 3. wikipedia value has not changed
- var currTags = _.clone(context.entity(currEntityId).tags),
- qids = data && Object.keys(data);
- if (initWikipedia !== currTags.wikipedia) return;
-
- // ok to coalesce the update of wikidata tag into the previous tag change
- currTags.wikidata = qids && _.find(qids, function (id) {
- return id.match(/^Q\d+$/);
- });
-
- context.overwrite(iD.actions.ChangeTags(currEntityId, currTags), annotation);
- dispatch.change(currTags);
- });
+ function end() {
+ context.replace(actionNoop());
+ context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
}
-
- wiki.tags = function(tags) {
- var value = tags[field.key] || '',
- m = value.match(/([^:]+):([^#]+)(?:#(.+))?/),
- l = m && _.find(iD.data.wikipedia, function(d) { return m[1] === d[2]; }),
- anchor = m && m[3];
-
- // value in correct format
- if (l) {
- lang.value(l[1]);
- title.value(m[2] + (anchor ? ('#' + anchor) : ''));
- if (anchor) {
- try {
- // Best-effort `anchorencode:` implementation
- anchor = encodeURIComponent(anchor.replace(/ /g, '_')).replace(/%/g, '.');
- } catch (e) {
- anchor = anchor.replace(/ /g, '_');
- }
- }
- link.attr('href', 'https://' + m[1] + '.wikipedia.org/wiki/' +
- m[2].replace(/ /g, '_') + (anchor ? ('#' + anchor) : ''));
-
- // unrecognized value format
- } else {
- title.value(value);
- if (value && value !== '') {
- lang.value('');
- }
- link.attr('href', 'https://en.wikipedia.org/wiki/Special:Search?search=' + value);
- }
- };
-
- wiki.entity = function(_) {
- if (!arguments.length) return entity;
- entity = _;
- return wiki;
+ var drag = behaviorDrag().selector(".layer-touch.markers .target.note.new").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
+ mode.enter = function() {
+ context.install(edit2);
};
-
- wiki.focus = function() {
- title.node().focus();
+ mode.exit = function() {
+ context.ui().sidebar.hover.cancel();
+ context.uninstall(edit2);
+ context.surface().selectAll(".active").classed("active", false);
+ stopNudge();
};
+ mode.behavior = drag;
+ return mode;
+ }
- return d3.rebind(wiki, dispatch, 'on');
-};
-iD.ui.intro.area = function(context, reveal) {
- var event = d3.dispatch('done'),
- timeout;
-
- var step = {
- title: 'intro.areas.title'
+ // modules/modes/select_data.js
+ function modeSelectData(context, selectedDatum) {
+ var mode = {
+ id: "select-data",
+ button: "browse"
};
-
- step.enter = function() {
- var playground = [-85.63552, 41.94159],
- corner = [-85.63565411045074, 41.9417715536927];
- context.map().centerZoom(playground, 19);
- reveal('button.add-area',
- t('intro.areas.add', { button: iD.ui.intro.icon('#icon-area', 'pre-text') }),
- { tooltipClass: 'intro-areas-add' });
-
- context.on('enter.intro', addArea);
-
- function addArea(mode) {
- if (mode.id !== 'add-area') return;
- context.on('enter.intro', drawArea);
-
- var padding = 120 * Math.pow(2, context.map().zoom() - 19);
- var pointBox = iD.ui.intro.pad(corner, padding, context);
- reveal(pointBox, t('intro.areas.corner'));
-
- context.map().on('move.intro', function() {
- padding = 120 * Math.pow(2, context.map().zoom() - 19);
- pointBox = iD.ui.intro.pad(corner, padding, context);
- reveal(pointBox, t('intro.areas.corner'), {duration: 0});
- });
- }
-
- function drawArea(mode) {
- if (mode.id !== 'draw-area') return;
- context.on('enter.intro', enterSelect);
-
- var padding = 150 * Math.pow(2, context.map().zoom() - 19);
- var pointBox = iD.ui.intro.pad(playground, padding, context);
- reveal(pointBox, t('intro.areas.place'));
-
- context.map().on('move.intro', function() {
- padding = 150 * Math.pow(2, context.map().zoom() - 19);
- pointBox = iD.ui.intro.pad(playground, padding, context);
- reveal(pointBox, t('intro.areas.place'), {duration: 0});
- });
- }
-
- function enterSelect(mode) {
- if (mode.id !== 'select') return;
- context.map().on('move.intro', null);
- context.on('enter.intro', null);
-
- timeout = setTimeout(function() {
- reveal('.preset-search-input',
- t('intro.areas.search',
- { name: context.presets().item('leisure/playground').name() }));
- d3.select('.preset-search-input').on('keyup.intro', keySearch);
- }, 500);
- }
-
- function keySearch() {
- var first = d3.select('.preset-list-item:first-child');
- if (first.classed('preset-leisure-playground')) {
- reveal(first.select('.preset-list-button').node(), t('intro.areas.choose'));
- d3.selection.prototype.one.call(context.history(), 'change.intro', selectedPreset);
- d3.select('.preset-search-input').on('keyup.intro', null);
- }
- }
-
- function selectedPreset() {
- reveal('.pane',
- t('intro.areas.describe', { button: iD.ui.intro.icon('#icon-apply', 'pre-text') }));
- context.on('exit.intro', event.done);
+ var keybinding = utilKeybinding("select-data");
+ var dataEditor = uiDataEditor(context);
+ var behaviors = [
+ behaviorBreathe(context),
+ behaviorHover(context),
+ behaviorSelect(context),
+ behaviorLasso(context),
+ modeDragNode(context).behavior,
+ modeDragNote(context).behavior
+ ];
+ function selectData(d3_event, drawn) {
+ var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
+ if (selection2.empty()) {
+ var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
+ if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
+ context.enter(modeBrowse(context));
}
+ } else {
+ selection2.classed("selected", true);
+ }
+ }
+ function esc() {
+ if (context.container().select(".combobox").size())
+ return;
+ context.enter(modeBrowse(context));
+ }
+ mode.zoomToSelected = function() {
+ var extent = geoExtent(bounds_default(selectedDatum));
+ context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
};
-
- step.exit = function() {
- window.clearTimeout(timeout);
- context.on('enter.intro', null);
- context.on('exit.intro', null);
- context.history().on('change.intro', null);
- context.map().on('move.intro', null);
- d3.select('.preset-search-input').on('keyup.intro', null);
+ mode.enter = function() {
+ behaviors.forEach(context.install);
+ keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
+ select_default2(document).call(keybinding);
+ selectData();
+ var sidebar = context.ui().sidebar;
+ sidebar.show(dataEditor.datum(selectedDatum));
+ var extent = geoExtent(bounds_default(selectedDatum));
+ sidebar.expand(sidebar.intersects(extent));
+ context.map().on("drawn.select-data", selectData);
};
-
- return d3.rebind(step, event, 'on');
-};
-iD.ui.intro.line = function(context, reveal) {
- var event = d3.dispatch('done'),
- timeouts = [];
-
- var step = {
- title: 'intro.lines.title'
+ mode.exit = function() {
+ behaviors.forEach(context.uninstall);
+ select_default2(document).call(keybinding.unbind);
+ context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
+ context.map().on("drawn.select-data", null);
+ context.ui().sidebar.hide();
};
+ return mode;
+ }
- function timeout(f, t) {
- timeouts.push(window.setTimeout(f, t));
- }
-
- function eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
+ // modules/behavior/select.js
+ function behaviorSelect(context) {
+ var _tolerancePx = 4;
+ var _lastMouseEvent = null;
+ var _showMenu = false;
+ var _downPointers = {};
+ var _longPressTimeout = null;
+ var _lastInteractionType = null;
+ var _multiselectionPointerId = null;
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ function keydown(d3_event) {
+ if (d3_event.keyCode === 32) {
+ var activeNode = document.activeElement;
+ if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
+ return;
+ }
+ if (d3_event.keyCode === 93 || d3_event.keyCode === 32) {
+ d3_event.preventDefault();
+ }
+ if (d3_event.repeat)
+ return;
+ cancelLongPress();
+ if (d3_event.shiftKey) {
+ context.surface().classed("behavior-multiselect", true);
+ }
+ if (d3_event.keyCode === 32) {
+ if (!_downPointers.spacebar && _lastMouseEvent) {
+ cancelLongPress();
+ _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
+ _downPointers.spacebar = {
+ firstEvent: _lastMouseEvent,
+ lastEvent: _lastMouseEvent
+ };
+ }
+ }
}
-
- step.enter = function() {
- var centroid = [-85.62830, 41.95699];
- var midpoint = [-85.62975395449628, 41.95787501510204];
- var start = [-85.6297754121684, 41.95805253325314];
- var intersection = [-85.62974496187628, 41.95742515554585];
-
- context.map().centerZoom(start, 18);
- reveal('button.add-line',
- t('intro.lines.add', { button: iD.ui.intro.icon('#icon-line', 'pre-text') }),
- { tooltipClass: 'intro-lines-add' });
-
- context.on('enter.intro', addLine);
-
- function addLine(mode) {
- if (mode.id !== 'add-line') return;
- context.on('enter.intro', drawLine);
-
- var padding = 150 * Math.pow(2, context.map().zoom() - 18);
- var pointBox = iD.ui.intro.pad(start, padding, context);
- reveal(pointBox, t('intro.lines.start'));
-
- context.map().on('move.intro', function() {
- padding = 150 * Math.pow(2, context.map().zoom() - 18);
- pointBox = iD.ui.intro.pad(start, padding, context);
- reveal(pointBox, t('intro.lines.start'), {duration: 0});
- });
+ function keyup(d3_event) {
+ cancelLongPress();
+ if (!d3_event.shiftKey) {
+ context.surface().classed("behavior-multiselect", false);
+ }
+ if (d3_event.keyCode === 93) {
+ d3_event.preventDefault();
+ _lastInteractionType = "menukey";
+ contextmenu(d3_event);
+ } else if (d3_event.keyCode === 32) {
+ var pointer = _downPointers.spacebar;
+ if (pointer) {
+ delete _downPointers.spacebar;
+ if (pointer.done)
+ return;
+ d3_event.preventDefault();
+ _lastInteractionType = "spacebar";
+ click(pointer.firstEvent, pointer.lastEvent, "spacebar");
}
-
- function drawLine(mode) {
- if (mode.id !== 'draw-line') return;
- context.history().on('change.intro', addIntersection);
- context.on('enter.intro', retry);
-
- var padding = 300 * Math.pow(2, context.map().zoom() - 19);
- var pointBox = iD.ui.intro.pad(midpoint, padding, context);
- reveal(pointBox, t('intro.lines.intersect', {name: t('intro.graph.flower_st')}));
-
- context.map().on('move.intro', function() {
- padding = 300 * Math.pow(2, context.map().zoom() - 19);
- pointBox = iD.ui.intro.pad(midpoint, padding, context);
- reveal(pointBox, t('intro.lines.intersect', {name: t('intro.graph.flower_st')}), {duration: 0});
- });
+ }
+ }
+ function pointerdown(d3_event) {
+ var id2 = (d3_event.pointerId || "mouse").toString();
+ cancelLongPress();
+ if (d3_event.buttons && d3_event.buttons !== 1)
+ return;
+ context.ui().closeEditMenu();
+ _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
+ _downPointers[id2] = {
+ firstEvent: d3_event,
+ lastEvent: d3_event
+ };
+ }
+ function didLongPress(id2, interactionType) {
+ var pointer = _downPointers[id2];
+ if (!pointer)
+ return;
+ for (var i2 in _downPointers) {
+ _downPointers[i2].done = true;
+ }
+ _longPressTimeout = null;
+ _lastInteractionType = interactionType;
+ _showMenu = true;
+ click(pointer.firstEvent, pointer.lastEvent, id2);
+ }
+ function pointermove(d3_event) {
+ var id2 = (d3_event.pointerId || "mouse").toString();
+ if (_downPointers[id2]) {
+ _downPointers[id2].lastEvent = d3_event;
+ }
+ if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
+ _lastMouseEvent = d3_event;
+ if (_downPointers.spacebar) {
+ _downPointers.spacebar.lastEvent = d3_event;
}
-
- // ended line before creating intersection
- function retry(mode) {
- if (mode.id !== 'select') return;
- var pointBox = iD.ui.intro.pad(intersection, 30, context),
- ids = mode.selectedIDs();
- reveal(pointBox, t('intro.lines.restart', {name: t('intro.graph.flower_st')}));
- d3.select(window).on('mousedown.intro', eventCancel, true);
-
- timeout(function() {
- context.replace(iD.actions.DeleteMultiple(ids));
- step.exit();
- step.enter();
- }, 3000);
+ }
+ }
+ function pointerup(d3_event) {
+ var id2 = (d3_event.pointerId || "mouse").toString();
+ var pointer = _downPointers[id2];
+ if (!pointer)
+ return;
+ delete _downPointers[id2];
+ if (_multiselectionPointerId === id2) {
+ _multiselectionPointerId = null;
+ }
+ if (pointer.done)
+ return;
+ click(pointer.firstEvent, d3_event, id2);
+ }
+ function pointercancel(d3_event) {
+ var id2 = (d3_event.pointerId || "mouse").toString();
+ if (!_downPointers[id2])
+ return;
+ delete _downPointers[id2];
+ if (_multiselectionPointerId === id2) {
+ _multiselectionPointerId = null;
+ }
+ }
+ function contextmenu(d3_event) {
+ d3_event.preventDefault();
+ if (!+d3_event.clientX && !+d3_event.clientY) {
+ if (_lastMouseEvent) {
+ d3_event.sourceEvent = _lastMouseEvent;
+ } else {
+ return;
}
-
- function addIntersection(changes) {
- if ( _.some(changes.created(), function(d) {
- return d.type === 'node' && context.graph().parentWays(d).length > 1;
- })) {
- context.history().on('change.intro', null);
- context.on('enter.intro', enterSelect);
-
- var padding = 900 * Math.pow(2, context.map().zoom() - 19);
- var pointBox = iD.ui.intro.pad(centroid, padding, context);
- reveal(pointBox, t('intro.lines.finish'));
-
- context.map().on('move.intro', function() {
- padding = 900 * Math.pow(2, context.map().zoom() - 19);
- pointBox = iD.ui.intro.pad(centroid, padding, context);
- reveal(pointBox, t('intro.lines.finish'), {duration: 0});
- });
- }
+ } else {
+ _lastMouseEvent = d3_event;
+ _lastInteractionType = "rightclick";
+ }
+ _showMenu = true;
+ click(d3_event, d3_event);
+ }
+ function click(firstEvent, lastEvent, pointerId) {
+ cancelLongPress();
+ var mapNode = context.container().select(".main-map").node();
+ var pointGetter = utilFastMouse(mapNode);
+ var p1 = pointGetter(firstEvent);
+ var p2 = pointGetter(lastEvent);
+ var dist = geoVecLength(p1, p2);
+ if (dist > _tolerancePx || !mapContains(lastEvent)) {
+ resetProperties();
+ return;
+ }
+ var targetDatum = lastEvent.target.__data__;
+ var multiselectEntityId;
+ if (!_multiselectionPointerId) {
+ var selectPointerInfo = pointerDownOnSelection(pointerId);
+ if (selectPointerInfo) {
+ _multiselectionPointerId = selectPointerInfo.pointerId;
+ multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
+ _downPointers[selectPointerInfo.pointerId].done = true;
}
-
- function enterSelect(mode) {
- if (mode.id !== 'select') return;
- context.map().on('move.intro', null);
- context.on('enter.intro', null);
- d3.select('#curtain').style('pointer-events', 'all');
-
- presetCategory();
+ }
+ var isMultiselect = context.mode().id === "select" && (lastEvent && lastEvent.shiftKey || context.surface().select(".lasso").node() || _multiselectionPointerId && !multiselectEntityId);
+ processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
+ function mapContains(event) {
+ var rect = mapNode.getBoundingClientRect();
+ return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
+ }
+ function pointerDownOnSelection(skipPointerId) {
+ var mode = context.mode();
+ var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
+ for (var pointerId2 in _downPointers) {
+ if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
+ continue;
+ var pointerInfo = _downPointers[pointerId2];
+ var p12 = pointGetter(pointerInfo.firstEvent);
+ var p22 = pointGetter(pointerInfo.lastEvent);
+ if (geoVecLength(p12, p22) > _tolerancePx)
+ continue;
+ var datum2 = pointerInfo.firstEvent.target.__data__;
+ var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
+ if (context.graph().hasEntity(entity.id)) {
+ return {
+ pointerId: pointerId2,
+ entityId: entity.id,
+ selected: selectedIDs.indexOf(entity.id) !== -1
+ };
+ }
}
-
- function presetCategory() {
- timeout(function() {
- d3.select('#curtain').style('pointer-events', 'none');
- var road = d3.select('.preset-category-road .preset-list-button');
- reveal(road.node(), t('intro.lines.road'));
- road.one('click.intro', roadCategory);
- }, 500);
+ return null;
+ }
+ }
+ function processClick(datum2, isMultiselect, point, alsoSelectId) {
+ var mode = context.mode();
+ var showMenu = _showMenu;
+ var interactionType = _lastInteractionType;
+ var entity = datum2 && datum2.properties && datum2.properties.entity;
+ if (entity)
+ datum2 = entity;
+ if (datum2 && datum2.type === "midpoint") {
+ datum2 = datum2.parents[0];
+ }
+ var newMode;
+ if (datum2 instanceof osmEntity) {
+ var selectedIDs = context.selectedIDs();
+ context.selectedNoteID(null);
+ context.selectedErrorID(null);
+ if (!isMultiselect) {
+ if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
+ if (alsoSelectId === datum2.id)
+ alsoSelectId = null;
+ selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
+ newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
+ context.enter(newMode);
+ }
+ } else {
+ if (selectedIDs.indexOf(datum2.id) !== -1) {
+ if (!showMenu) {
+ selectedIDs = selectedIDs.filter(function(id2) {
+ return id2 !== datum2.id;
+ });
+ newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
+ context.enter(newMode);
+ }
+ } else {
+ selectedIDs = selectedIDs.concat([datum2.id]);
+ newMode = mode.selectedIDs(selectedIDs);
+ context.enter(newMode);
+ }
}
-
- function roadCategory() {
- timeout(function() {
- var grid = d3.select('.subgrid');
- reveal(grid.node(), t('intro.lines.residential'));
- grid.selectAll(':not(.preset-highway-residential) .preset-list-button')
- .one('click.intro', retryPreset);
- grid.selectAll('.preset-highway-residential .preset-list-button')
- .one('click.intro', roadDetails);
- }, 500);
+ } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
+ context.selectedNoteID(null).enter(modeSelectData(context, datum2));
+ } else if (datum2 instanceof osmNote && !isMultiselect) {
+ context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
+ } else if (datum2 instanceof QAItem && !isMultiselect) {
+ context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
+ } else {
+ context.selectedNoteID(null);
+ context.selectedErrorID(null);
+ if (!isMultiselect && mode.id !== "browse") {
+ context.enter(modeBrowse(context));
}
-
- // selected wrong road type
- function retryPreset() {
- timeout(function() {
- var preset = d3.select('.entity-editor-pane .preset-list-button');
- reveal(preset.node(), t('intro.lines.wrong_preset'));
- preset.one('click.intro', presetCategory);
- }, 500);
+ }
+ context.ui().closeEditMenu();
+ if (showMenu)
+ context.ui().showEditMenu(point, interactionType);
+ resetProperties();
+ }
+ function cancelLongPress() {
+ if (_longPressTimeout)
+ window.clearTimeout(_longPressTimeout);
+ _longPressTimeout = null;
+ }
+ function resetProperties() {
+ cancelLongPress();
+ _showMenu = false;
+ _lastInteractionType = null;
+ }
+ function behavior(selection2) {
+ resetProperties();
+ _lastMouseEvent = context.map().lastPointerEvent();
+ select_default2(window).on("keydown.select", keydown).on("keyup.select", keyup).on(_pointerPrefix + "move.select", pointermove, true).on(_pointerPrefix + "up.select", pointerup, true).on("pointercancel.select", pointercancel, true).on("contextmenu.select-window", function(d3_event) {
+ var e = d3_event;
+ if (+e.clientX === 0 && +e.clientY === 0) {
+ d3_event.preventDefault();
}
+ });
+ selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
+ }
+ behavior.off = function(selection2) {
+ cancelLongPress();
+ select_default2(window).on("keydown.select", null).on("keyup.select", null).on("contextmenu.select-window", null).on(_pointerPrefix + "move.select", null, true).on(_pointerPrefix + "up.select", null, true).on("pointercancel.select", null, true);
+ selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
+ context.surface().classed("behavior-multiselect", false);
+ };
+ return behavior;
+ }
- function roadDetails() {
- reveal('.pane',
- t('intro.lines.describe', { button: iD.ui.intro.icon('#icon-apply', 'pre-text') }));
- context.on('exit.intro', event.done);
- }
+ // modules/operations/index.js
+ var operations_exports = {};
+ __export(operations_exports, {
+ operationCircularize: () => operationCircularize,
+ operationContinue: () => operationContinue,
+ operationCopy: () => operationCopy,
+ operationDelete: () => operationDelete,
+ operationDisconnect: () => operationDisconnect,
+ operationDowngrade: () => operationDowngrade,
+ operationExtract: () => operationExtract,
+ operationMerge: () => operationMerge,
+ operationMove: () => operationMove,
+ operationOrthogonalize: () => operationOrthogonalize,
+ operationPaste: () => operationPaste,
+ operationReflectLong: () => operationReflectLong,
+ operationReflectShort: () => operationReflectShort,
+ operationReverse: () => operationReverse,
+ operationRotate: () => operationRotate,
+ operationSplit: () => operationSplit,
+ operationStraighten: () => operationStraighten
+ });
+ // modules/operations/continue.js
+ function operationContinue(context, selectedIDs) {
+ var _entities = selectedIDs.map(function(id2) {
+ return context.graph().entity(id2);
+ });
+ var _geometries = Object.assign({ line: [], vertex: [] }, utilArrayGroupBy(_entities, function(entity) {
+ return entity.geometry(context.graph());
+ }));
+ var _vertex = _geometries.vertex.length && _geometries.vertex[0];
+ function candidateWays() {
+ return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
+ return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
+ }) : [];
+ }
+ var _candidates = candidateWays();
+ var operation = function() {
+ var candidate = _candidates[0];
+ context.enter(modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true));
};
-
- step.exit = function() {
- d3.select(window).on('mousedown.intro', null, true);
- d3.select('#curtain').style('pointer-events', 'none');
- timeouts.forEach(window.clearTimeout);
- context.on('enter.intro', null);
- context.on('exit.intro', null);
- context.map().on('move.intro', null);
- context.history().on('change.intro', null);
+ operation.relatedEntityIds = function() {
+ return _candidates.length ? [_candidates[0].id] : [];
};
-
- return d3.rebind(step, event, 'on');
-};
-iD.ui.intro.navigation = function(context, reveal) {
- var event = d3.dispatch('done'),
- timeouts = [];
-
- var step = {
- title: 'intro.navigation.title'
+ operation.available = function() {
+ return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
};
+ operation.disabled = function() {
+ if (_candidates.length === 0) {
+ return "not_eligible";
+ } else if (_candidates.length > 1) {
+ return "multiple";
+ }
+ return false;
+ };
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.continue." + disable) : _t("operations.continue.description");
+ };
+ operation.annotation = function() {
+ return _t("operations.continue.annotation.line");
+ };
+ operation.id = "continue";
+ operation.keys = [_t("operations.continue.key")];
+ operation.title = _t("operations.continue.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- function set(f, t) {
- timeouts.push(window.setTimeout(f, t));
- }
-
- function eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
+ // modules/operations/copy.js
+ function operationCopy(context, selectedIDs) {
+ function getFilteredIdsToCopy() {
+ return selectedIDs.filter(function(selectedID) {
+ var entity = context.graph().hasEntity(selectedID);
+ return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
+ });
}
-
- step.enter = function() {
- var rect = context.surfaceRect(),
- map = {
- left: rect.left + 10,
- top: rect.top + 70,
- width: rect.width - 70,
- height: rect.height - 170
- };
-
- context.map().centerZoom([-85.63591, 41.94285], 19);
-
- reveal(map, t('intro.navigation.drag'));
-
- context.map().on('move.intro', _.debounce(function() {
- context.map().on('move.intro', null);
- townhall();
- context.on('enter.intro', inspectTownHall);
- }, 400));
-
- function townhall() {
- var hall = [-85.63645945147184, 41.942986488012565];
-
- var point = context.projection(hall);
- if (point[0] < 0 || point[0] > rect.width ||
- point[1] < 0 || point[1] > rect.height) {
- context.map().center(hall);
- }
-
- var box = iD.ui.intro.pointBox(hall, context);
- reveal(box, t('intro.navigation.select'));
-
- context.map().on('move.intro', function() {
- var box = iD.ui.intro.pointBox(hall, context);
- reveal(box, t('intro.navigation.select'), {duration: 0});
- });
+ var operation = function() {
+ var graph = context.graph();
+ var selected = groupEntities(getFilteredIdsToCopy(), graph);
+ var canCopy = [];
+ var skip = {};
+ var entity;
+ var i2;
+ for (i2 = 0; i2 < selected.relation.length; i2++) {
+ entity = selected.relation[i2];
+ if (!skip[entity.id] && entity.isComplete(graph)) {
+ canCopy.push(entity.id);
+ skip = getDescendants(entity.id, graph, skip);
}
-
- function inspectTownHall(mode) {
- if (mode.id !== 'select') return;
- context.on('enter.intro', null);
- context.map().on('move.intro', null);
- set(function() {
- reveal('.entity-editor-pane',
- t('intro.navigation.pane', { button: iD.ui.intro.icon('#icon-close', 'pre-text') }));
- context.on('exit.intro', streetSearch);
- }, 700);
+ }
+ for (i2 = 0; i2 < selected.way.length; i2++) {
+ entity = selected.way[i2];
+ if (!skip[entity.id]) {
+ canCopy.push(entity.id);
+ skip = getDescendants(entity.id, graph, skip);
}
-
- function streetSearch() {
- context.on('exit.intro', null);
- reveal('.search-header input',
- t('intro.navigation.search', { name: t('intro.graph.spring_st') }));
- d3.select('.search-header input').on('keyup.intro', searchResult);
+ }
+ for (i2 = 0; i2 < selected.node.length; i2++) {
+ entity = selected.node[i2];
+ if (!skip[entity.id]) {
+ canCopy.push(entity.id);
}
+ }
+ context.copyIDs(canCopy);
+ if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
+ context.copyLonLat(context.projection.invert(_point));
+ } else {
+ context.copyLonLat(null);
+ }
+ };
+ function groupEntities(ids, graph) {
+ var entities = ids.map(function(id2) {
+ return graph.entity(id2);
+ });
+ return Object.assign({ relation: [], way: [], node: [] }, utilArrayGroupBy(entities, "type"));
+ }
+ function getDescendants(id2, graph, descendants) {
+ var entity = graph.entity(id2);
+ var children2;
+ descendants = descendants || {};
+ if (entity.type === "relation") {
+ children2 = entity.members.map(function(m) {
+ return m.id;
+ });
+ } else if (entity.type === "way") {
+ children2 = entity.nodes;
+ } else {
+ children2 = [];
+ }
+ for (var i2 = 0; i2 < children2.length; i2++) {
+ if (!descendants[children2[i2]]) {
+ descendants[children2[i2]] = true;
+ descendants = getDescendants(children2[i2], graph, descendants);
+ }
+ }
+ return descendants;
+ }
+ operation.available = function() {
+ return getFilteredIdsToCopy().length > 0;
+ };
+ operation.disabled = function() {
+ var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
+ if (extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ }
+ return false;
+ };
+ operation.availableForKeypress = function() {
+ var selection2 = window.getSelection && window.getSelection();
+ return !selection2 || !selection2.toString();
+ };
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.copy." + disable, { n: selectedIDs.length }) : _t("operations.copy.description", { n: selectedIDs.length });
+ };
+ operation.annotation = function() {
+ return _t("operations.copy.annotation", { n: selectedIDs.length });
+ };
+ var _point;
+ operation.point = function(val) {
+ _point = val;
+ return operation;
+ };
+ operation.id = "copy";
+ operation.keys = [uiCmd("\u2318C")];
+ operation.title = _t("operations.copy.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- function searchResult() {
- var first = d3.select('.feature-list-item:nth-child(0n+2)'), // skip No Results item
- firstName = first.select('.entity-name'),
- name = t('intro.graph.spring_st');
-
- if (!firstName.empty() && firstName.text() === name) {
- reveal(first.node(), t('intro.navigation.choose', { name: name }));
- context.on('exit.intro', selectedStreet);
- d3.select('.search-header input')
- .on('keydown.intro', eventCancel, true)
- .on('keyup.intro', null);
+ // modules/operations/disconnect.js
+ function operationDisconnect(context, selectedIDs) {
+ var _vertexIDs = [];
+ var _wayIDs = [];
+ var _otherIDs = [];
+ var _actions = [];
+ selectedIDs.forEach(function(id2) {
+ var entity = context.entity(id2);
+ if (entity.type === "way") {
+ _wayIDs.push(id2);
+ } else if (entity.geometry(context.graph()) === "vertex") {
+ _vertexIDs.push(id2);
+ } else {
+ _otherIDs.push(id2);
+ }
+ });
+ var _coords, _descriptionID = "", _annotationID = "features";
+ var _disconnectingVertexIds = [];
+ var _disconnectingWayIds = [];
+ if (_vertexIDs.length > 0) {
+ _disconnectingVertexIds = _vertexIDs;
+ _vertexIDs.forEach(function(vertexID) {
+ var action = actionDisconnect(vertexID);
+ if (_wayIDs.length > 0) {
+ var waysIDsForVertex = _wayIDs.filter(function(wayID) {
+ var way = context.entity(wayID);
+ return way.nodes.indexOf(vertexID) !== -1;
+ });
+ action.limitWays(waysIDsForVertex);
+ }
+ _actions.push(action);
+ _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d) => d.id));
+ });
+ _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
+ return _wayIDs.indexOf(id2) === -1;
+ });
+ _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
+ if (_wayIDs.length === 1) {
+ _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
+ } else {
+ _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
+ }
+ } else if (_wayIDs.length > 0) {
+ var ways = _wayIDs.map(function(id2) {
+ return context.entity(id2);
+ });
+ var nodes = utilGetAllNodes(_wayIDs, context.graph());
+ _coords = nodes.map(function(n2) {
+ return n2.loc;
+ });
+ var sharedActions = [];
+ var sharedNodes = [];
+ var unsharedActions = [];
+ var unsharedNodes = [];
+ nodes.forEach(function(node) {
+ var action = actionDisconnect(node.id).limitWays(_wayIDs);
+ if (action.disabled(context.graph()) !== "not_connected") {
+ var count = 0;
+ for (var i2 in ways) {
+ var way = ways[i2];
+ if (way.nodes.indexOf(node.id) !== -1) {
+ count += 1;
}
+ if (count > 1)
+ break;
+ }
+ if (count > 1) {
+ sharedActions.push(action);
+ sharedNodes.push(node);
+ } else {
+ unsharedActions.push(action);
+ unsharedNodes.push(node);
+ }
}
-
- function selectedStreet() {
- var springSt = [-85.63585099140167, 41.942506848938926];
- context.map().center(springSt);
- context.on('exit.intro', event.done);
- set(function() {
- reveal('.entity-editor-pane',
- t('intro.navigation.chosen', {
- name: t('intro.graph.spring_st'),
- button: iD.ui.intro.icon('#icon-close', 'pre-text')
- }));
- }, 400);
+ });
+ _descriptionID += "no_points.";
+ _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
+ if (sharedActions.length) {
+ _actions = sharedActions;
+ _disconnectingVertexIds = sharedNodes.map((node) => node.id);
+ _descriptionID += "conjoined";
+ _annotationID = "from_each_other";
+ } else {
+ _actions = unsharedActions;
+ _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
+ if (_wayIDs.length === 1) {
+ _descriptionID += context.graph().geometry(_wayIDs[0]);
+ } else {
+ _descriptionID += "separate";
+ }
+ }
+ }
+ var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
+ var operation = function() {
+ context.perform(function(graph) {
+ return _actions.reduce(function(graph2, action) {
+ return action(graph2);
+ }, graph);
+ }, operation.annotation());
+ context.validator().validate();
+ };
+ operation.relatedEntityIds = function() {
+ if (_vertexIDs.length) {
+ return _disconnectingWayIds;
+ }
+ return _disconnectingVertexIds;
+ };
+ operation.available = function() {
+ if (_actions.length === 0)
+ return false;
+ if (_otherIDs.length !== 0)
+ return false;
+ if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
+ return _vertexIDs.some(function(vertexID) {
+ var way = context.entity(wayID);
+ return way.nodes.indexOf(vertexID) !== -1;
+ });
+ }))
+ return false;
+ return true;
+ };
+ operation.disabled = function() {
+ var reason;
+ for (var actionIndex in _actions) {
+ reason = _actions[actionIndex].disabled(context.graph());
+ if (reason)
+ return reason;
+ }
+ if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
+ } else if (_coords && someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = _coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
+ });
+ return true;
+ }
}
+ return false;
+ }
};
-
- step.exit = function() {
- timeouts.forEach(window.clearTimeout);
- context.map().on('move.intro', null);
- context.on('enter.intro', null);
- context.on('exit.intro', null);
- d3.select('.search-header input')
- .on('keydown.intro', null)
- .on('keyup.intro', null);
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ if (disable) {
+ return _t("operations.disconnect." + disable);
+ }
+ return _t("operations.disconnect.description." + _descriptionID);
};
-
- return d3.rebind(step, event, 'on');
-};
-iD.ui.intro.point = function(context, reveal) {
- var event = d3.dispatch('done'),
- timeouts = [];
-
- var step = {
- title: 'intro.points.title'
+ operation.annotation = function() {
+ return _t("operations.disconnect.annotation." + _annotationID);
};
+ operation.id = "disconnect";
+ operation.keys = [_t("operations.disconnect.key")];
+ operation.title = _t("operations.disconnect.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- function setTimeout(f, t) {
- timeouts.push(window.setTimeout(f, t));
+ // modules/operations/downgrade.js
+ function operationDowngrade(context, selectedIDs) {
+ var _affectedFeatureCount = 0;
+ var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
+ var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
+ function downgradeTypeForEntityIDs(entityIds) {
+ var downgradeType;
+ _affectedFeatureCount = 0;
+ for (var i2 in entityIds) {
+ var entityID = entityIds[i2];
+ var type3 = downgradeTypeForEntityID(entityID);
+ if (type3) {
+ _affectedFeatureCount += 1;
+ if (downgradeType && type3 !== downgradeType) {
+ if (downgradeType !== "generic" && type3 !== "generic") {
+ downgradeType = "building_address";
+ } else {
+ downgradeType = "generic";
+ }
+ } else {
+ downgradeType = type3;
+ }
+ }
+ }
+ return downgradeType;
}
-
- function eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
+ function downgradeTypeForEntityID(entityID) {
+ var graph = context.graph();
+ var entity = graph.entity(entityID);
+ var preset = _mainPresetIndex.match(entity, graph);
+ if (!preset || preset.isFallback())
+ return null;
+ if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
+ return key.match(/^addr:.{1,}/);
+ })) {
+ return "address";
+ }
+ var geometry = entity.geometry(graph);
+ if (geometry === "area" && entity.tags.building && !preset.tags.building) {
+ return "building";
+ }
+ if (geometry === "vertex" && Object.keys(entity.tags).length) {
+ return "generic";
+ }
+ return null;
}
-
- step.enter = function() {
- context.map().centerZoom([-85.63279, 41.94394], 19);
- reveal('button.add-point',
- t('intro.points.add', { button: iD.ui.intro.icon('#icon-point', 'pre-text') }),
- { tooltipClass: 'intro-points-add' });
-
- var corner = [-85.632481,41.944094];
-
- context.on('enter.intro', addPoint);
-
- function addPoint(mode) {
- if (mode.id !== 'add-point') return;
- context.on('enter.intro', enterSelect);
-
- var pointBox = iD.ui.intro.pad(corner, 150, context);
- reveal(pointBox, t('intro.points.place'));
-
- context.map().on('move.intro', function() {
- pointBox = iD.ui.intro.pad(corner, 150, context);
- reveal(pointBox, t('intro.points.place'), {duration: 0});
- });
- }
-
- function enterSelect(mode) {
- if (mode.id !== 'select') return;
- context.map().on('move.intro', null);
- context.on('enter.intro', null);
-
- setTimeout(function() {
- reveal('.preset-search-input',
- t('intro.points.search', {name: context.presets().item('amenity/cafe').name()}));
- d3.select('.preset-search-input').on('keyup.intro', keySearch);
- }, 500);
- }
-
- function keySearch() {
- var first = d3.select('.preset-list-item:first-child');
- if (first.classed('preset-amenity-cafe')) {
- reveal(first.select('.preset-list-button').node(), t('intro.points.choose'));
- d3.selection.prototype.one.call(context.history(), 'change.intro', selectedPreset);
- d3.select('.preset-search-input')
- .on('keydown.intro', eventCancel, true)
- .on('keyup.intro', null);
+ var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
+ var addressKeysToKeep = ["source"];
+ var operation = function() {
+ context.perform(function(graph) {
+ for (var i2 in selectedIDs) {
+ var entityID = selectedIDs[i2];
+ var type3 = downgradeTypeForEntityID(entityID);
+ if (!type3)
+ continue;
+ var tags = Object.assign({}, graph.entity(entityID).tags);
+ for (var key in tags) {
+ if (type3 === "address" && addressKeysToKeep.indexOf(key) !== -1)
+ continue;
+ if (type3 === "building") {
+ if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
+ continue;
}
+ if (type3 !== "generic") {
+ if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
+ continue;
+ }
+ delete tags[key];
+ }
+ graph = actionChangeTags(entityID, tags)(graph);
}
-
- function selectedPreset() {
- setTimeout(function() {
- reveal('.entity-editor-pane', t('intro.points.describe'), {tooltipClass: 'intro-points-describe'});
- context.history().on('change.intro', closeEditor);
- context.on('exit.intro', selectPoint);
- }, 400);
- }
-
- function closeEditor() {
- d3.select('.preset-search-input').on('keydown.intro', null);
- context.history().on('change.intro', null);
- reveal('.entity-editor-pane',
- t('intro.points.close', { button: iD.ui.intro.icon('#icon-apply', 'pre-text') }));
- }
-
- function selectPoint() {
- context.on('exit.intro', null);
- context.history().on('change.intro', null);
- context.on('enter.intro', enterReselect);
-
- var pointBox = iD.ui.intro.pad(corner, 150, context);
- reveal(pointBox, t('intro.points.reselect'));
-
- context.map().on('move.intro', function() {
- pointBox = iD.ui.intro.pad(corner, 150, context);
- reveal(pointBox, t('intro.points.reselect'), {duration: 0});
- });
- }
-
- function enterReselect(mode) {
- if (mode.id !== 'select') return;
- context.map().on('move.intro', null);
- context.on('enter.intro', null);
-
- setTimeout(function() {
- reveal('.entity-editor-pane',
- t('intro.points.fixname', { button: iD.ui.intro.icon('#icon-apply', 'pre-text') }));
- context.on('exit.intro', deletePoint);
- }, 500);
- }
-
- function deletePoint() {
- context.on('exit.intro', null);
- context.on('enter.intro', enterDelete);
-
- var pointBox = iD.ui.intro.pad(corner, 150, context);
- reveal(pointBox, t('intro.points.reselect_delete'));
-
- context.map().on('move.intro', function() {
- pointBox = iD.ui.intro.pad(corner, 150, context);
- reveal(pointBox, t('intro.points.reselect_delete'), {duration: 0});
- });
- }
-
- function enterDelete(mode) {
- if (mode.id !== 'select') return;
- context.map().on('move.intro', null);
- context.on('enter.intro', null);
- context.on('exit.intro', deletePoint);
- context.map().on('move.intro', deletePoint);
- context.history().on('change.intro', deleted);
-
- setTimeout(function() {
- var node = d3.select('.radial-menu-item-delete').node();
- var pointBox = iD.ui.intro.pad(node.getBoundingClientRect(), 50, context);
- reveal(pointBox,
- t('intro.points.delete', { button: iD.ui.intro.icon('#operation-delete', 'pre-text') }));
- }, 300);
- }
-
- function deleted(changed) {
- if (changed.deleted().length) event.done();
- }
-
+ return graph;
+ }, operation.annotation());
+ context.validator().validate();
+ context.enter(modeSelect(context, selectedIDs));
};
-
- step.exit = function() {
- timeouts.forEach(window.clearTimeout);
- context.on('exit.intro', null);
- context.on('enter.intro', null);
- context.map().on('move.intro', null);
- context.history().on('change.intro', null);
- d3.select('.preset-search-input')
- .on('keyup.intro', null)
- .on('keydown.intro', null);
+ operation.available = function() {
+ return _downgradeType;
};
-
- return d3.rebind(step, event, 'on');
-};
-iD.ui.intro.startEditing = function(context, reveal) {
- var event = d3.dispatch('done', 'startEditing'),
- modal,
- timeouts = [];
-
- var step = {
- title: 'intro.startediting.title'
+ operation.disabled = function() {
+ if (selectedIDs.some(hasWikidataTag)) {
+ return "has_wikidata_tag";
+ }
+ return false;
+ function hasWikidataTag(id2) {
+ var entity = context.entity(id2);
+ return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
+ }
};
-
- function timeout(f, t) {
- timeouts.push(window.setTimeout(f, t));
- }
-
- step.enter = function() {
- reveal('.map-control.help-control',
- t('intro.startediting.help', { button: iD.ui.intro.icon('#icon-help', 'pre-text') }));
-
- timeout(function() {
- reveal('#bar button.save', t('intro.startediting.save'));
- }, 5000);
-
- timeout(function() {
- reveal('#surface');
- }, 10000);
-
- timeout(function() {
- modal = iD.ui.modal(context.container());
-
- modal.select('.modal')
- .attr('class', 'modal-splash modal col6');
-
- modal.selectAll('.close').remove();
-
- var startbutton = modal.select('.content')
- .attr('class', 'fillL')
- .append('button')
- .attr('class', 'modal-section huge-modal-button')
- .on('click', function() {
- modal.remove();
- });
-
- startbutton.append('div')
- .attr('class','illustration');
- startbutton.append('h2')
- .text(t('intro.startediting.start'));
-
- event.startEditing();
- }, 10500);
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.downgrade." + disable + "." + _multi) : _t("operations.downgrade.description." + _downgradeType);
};
-
- step.exit = function() {
- if (modal) modal.remove();
- timeouts.forEach(window.clearTimeout);
+ operation.annotation = function() {
+ var suffix;
+ if (_downgradeType === "building_address") {
+ suffix = "generic";
+ } else {
+ suffix = _downgradeType;
+ }
+ return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
};
+ operation.id = "downgrade";
+ operation.keys = [uiCmd("\u232B")];
+ operation.title = _t("operations.downgrade.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- return d3.rebind(step, event, 'on');
-};
-iD.presets = function() {
-
- // an iD.presets.Collection with methods for
- // loading new data and returning defaults
-
- var all = iD.presets.Collection([]),
- defaults = { area: all, line: all, point: all, vertex: all, relation: all },
- fields = {},
- universal = [],
- recent = iD.presets.Collection([]);
-
- // Index of presets by (geometry, tag key).
- var index = {
- point: {},
- vertex: {},
- line: {},
- area: {},
- relation: {}
+ // modules/operations/extract.js
+ function operationExtract(context, selectedIDs) {
+ var _amount = selectedIDs.length === 1 ? "single" : "multiple";
+ var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
+ return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
+ }).filter(Boolean));
+ var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
+ var _extent;
+ var _actions = selectedIDs.map(function(entityID) {
+ var graph = context.graph();
+ var entity = graph.hasEntity(entityID);
+ if (!entity || !entity.hasInterestingTags())
+ return null;
+ if (entity.type === "node" && graph.parentWays(entity).length === 0)
+ return null;
+ if (entity.type !== "node") {
+ var preset = _mainPresetIndex.match(entity, graph);
+ if (preset.geometry.indexOf("point") === -1)
+ return null;
+ }
+ _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
+ return actionExtract(entityID, context.projection);
+ }).filter(Boolean);
+ var operation = function() {
+ var combinedAction = function(graph) {
+ _actions.forEach(function(action) {
+ graph = action(graph);
+ });
+ return graph;
+ };
+ context.perform(combinedAction, operation.annotation());
+ var extractedNodeIDs = _actions.map(function(action) {
+ return action.getExtractedNodeID();
+ });
+ context.enter(modeSelect(context, extractedNodeIDs));
};
-
- all.match = function(entity, resolver) {
- var geometry = entity.geometry(resolver),
- geometryMatches = index[geometry],
- best = -1,
- match;
-
- for (var k in entity.tags) {
- var keyMatches = geometryMatches[k];
- if (!keyMatches) continue;
-
- for (var i = 0; i < keyMatches.length; i++) {
- var score = keyMatches[i].matchScore(entity);
- if (score > best) {
- best = score;
- match = keyMatches[i];
- }
- }
- }
-
- return match || all.item(geometry);
+ operation.available = function() {
+ return _actions.length && selectedIDs.length === _actions.length;
};
+ operation.disabled = function() {
+ if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (selectedIDs.some(function(entityID) {
+ return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
+ })) {
+ return "connected_to_hidden";
+ }
+ return false;
+ };
+ operation.tooltip = function() {
+ var disableReason = operation.disabled();
+ if (disableReason) {
+ return _t("operations.extract." + disableReason + "." + _amount);
+ } else {
+ return _t("operations.extract.description." + _geometryID + "." + _amount);
+ }
+ };
+ operation.annotation = function() {
+ return _t("operations.extract.annotation", { n: selectedIDs.length });
+ };
+ operation.id = "extract";
+ operation.keys = [_t("operations.extract.key")];
+ operation.title = _t("operations.extract.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- // Because of the open nature of tagging, iD will never have a complete
- // list of tags used in OSM, so we want it to have logic like "assume
- // that a closed way with an amenity tag is an area, unless the amenity
- // is one of these specific types". This function computes a structure
- // that allows testing of such conditions, based on the presets designated
- // as as supporting (or not supporting) the area geometry.
- //
- // The returned object L is a whitelist/blacklist of tags. A closed way
- // with a tag (k, v) is considered to be an area if `k in L && !(v in L[k])`
- // (see `iD.Way#isArea()`). In other words, the keys of L form the whitelist,
- // and the subkeys form the blacklist.
- all.areaKeys = function() {
- var areaKeys = {},
- ignore = ['barrier', 'highway', 'footway', 'railway', 'type'],
- presets = _.reject(all.collection, 'suggestion');
-
- // whitelist
- presets.forEach(function(d) {
- for (var key in d.tags) break;
- if (!key) return;
- if (ignore.indexOf(key) !== -1) return;
-
- if (d.geometry.indexOf('area') !== -1) {
- areaKeys[key] = areaKeys[key] || {};
- }
- });
-
- // blacklist
- presets.forEach(function(d) {
- for (var key in d.tags) break;
- if (!key) return;
- if (ignore.indexOf(key) !== -1) return;
-
- var value = d.tags[key];
- if (d.geometry.indexOf('area') === -1 &&
- d.geometry.indexOf('line') !== -1 &&
- key in areaKeys && value !== '*') {
- areaKeys[key][value] = true;
- }
+ // modules/operations/merge.js
+ function operationMerge(context, selectedIDs) {
+ var _action = getAction();
+ function getAction() {
+ var join = actionJoin(selectedIDs);
+ if (!join.disabled(context.graph()))
+ return join;
+ var merge3 = actionMerge(selectedIDs);
+ if (!merge3.disabled(context.graph()))
+ return merge3;
+ var mergePolygon = actionMergePolygon(selectedIDs);
+ if (!mergePolygon.disabled(context.graph()))
+ return mergePolygon;
+ var mergeNodes = actionMergeNodes(selectedIDs);
+ if (!mergeNodes.disabled(context.graph()))
+ return mergeNodes;
+ if (join.disabled(context.graph()) !== "not_eligible")
+ return join;
+ if (merge3.disabled(context.graph()) !== "not_eligible")
+ return merge3;
+ if (mergePolygon.disabled(context.graph()) !== "not_eligible")
+ return mergePolygon;
+ return mergeNodes;
+ }
+ var operation = function() {
+ if (operation.disabled())
+ return;
+ context.perform(_action, operation.annotation());
+ context.validator().validate();
+ var resultIDs = selectedIDs.filter(context.hasEntity);
+ if (resultIDs.length > 1) {
+ var interestingIDs = resultIDs.filter(function(id2) {
+ return context.entity(id2).hasInterestingTags();
});
-
- return areaKeys;
+ if (interestingIDs.length)
+ resultIDs = interestingIDs;
+ }
+ context.enter(modeSelect(context, resultIDs));
};
-
- all.load = function(d) {
-
- if (d.fields) {
- _.forEach(d.fields, function(d, id) {
- fields[id] = iD.presets.Field(id, d);
- if (d.universal) universal.push(fields[id]);
- });
- }
-
- if (d.presets) {
- _.forEach(d.presets, function(d, id) {
- all.collection.push(iD.presets.Preset(id, d, fields));
- });
- }
-
- if (d.categories) {
- _.forEach(d.categories, function(d, id) {
- all.collection.push(iD.presets.Category(id, d, all));
- });
+ operation.available = function() {
+ return selectedIDs.length >= 2;
+ };
+ operation.disabled = function() {
+ var actionDisabled = _action.disabled(context.graph());
+ if (actionDisabled)
+ return actionDisabled;
+ var osm = context.connection();
+ if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
+ return "too_many_vertices";
+ }
+ return false;
+ };
+ operation.tooltip = function() {
+ var disabled = operation.disabled();
+ if (disabled) {
+ if (disabled === "conflicting_relations") {
+ return _t("operations.merge.conflicting_relations");
}
-
- if (d.defaults) {
- var getItem = _.bind(all.item, all);
- defaults = {
- area: iD.presets.Collection(d.defaults.area.map(getItem)),
- line: iD.presets.Collection(d.defaults.line.map(getItem)),
- point: iD.presets.Collection(d.defaults.point.map(getItem)),
- vertex: iD.presets.Collection(d.defaults.vertex.map(getItem)),
- relation: iD.presets.Collection(d.defaults.relation.map(getItem))
- };
+ if (disabled === "restriction" || disabled === "connectivity") {
+ return _t("operations.merge.damage_relation", { relation: _mainPresetIndex.item("type/" + disabled).name() });
}
+ return _t("operations.merge." + disabled);
+ }
+ return _t("operations.merge.description");
+ };
+ operation.annotation = function() {
+ return _t("operations.merge.annotation", { n: selectedIDs.length });
+ };
+ operation.id = "merge";
+ operation.keys = [_t("operations.merge.key")];
+ operation.title = _t("operations.merge.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- for (var i = 0; i < all.collection.length; i++) {
- var preset = all.collection[i],
- geometry = preset.geometry;
-
- for (var j = 0; j < geometry.length; j++) {
- var g = index[geometry[j]];
- for (var k in preset.tags) {
- (g[k] = g[k] || []).push(preset);
- }
- }
+ // modules/operations/paste.js
+ function operationPaste(context) {
+ var _pastePoint;
+ var operation = function() {
+ if (!_pastePoint)
+ return;
+ var oldIDs = context.copyIDs();
+ if (!oldIDs.length)
+ return;
+ var projection2 = context.projection;
+ var extent = geoExtent();
+ var oldGraph = context.copyGraph();
+ var newIDs = [];
+ var action = actionCopyEntities(oldIDs, oldGraph);
+ context.perform(action);
+ var copies = action.copies();
+ var originals = /* @__PURE__ */ new Set();
+ Object.values(copies).forEach(function(entity) {
+ originals.add(entity.id);
+ });
+ for (var id2 in copies) {
+ var oldEntity = oldGraph.entity(id2);
+ var newEntity = copies[id2];
+ extent._extend(oldEntity.extent(oldGraph));
+ var parents = context.graph().parentWays(newEntity);
+ var parentCopied = parents.some(function(parent) {
+ return originals.has(parent.id);
+ });
+ if (!parentCopied) {
+ newIDs.push(newEntity.id);
}
-
- return all;
+ }
+ var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
+ var delta = geoVecSubtract(_pastePoint, copyPoint);
+ context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
+ context.enter(modeSelect(context, newIDs));
};
-
- all.field = function(id) {
- return fields[id];
+ operation.point = function(val) {
+ _pastePoint = val;
+ return operation;
};
-
- all.universal = function() {
- return universal;
+ operation.available = function() {
+ return context.mode().id === "browse";
};
-
- all.defaults = function(geometry, n) {
- var rec = recent.matchGeometry(geometry).collection.slice(0, 4),
- def = _.uniq(rec.concat(defaults[geometry].collection)).slice(0, n - 1);
- return iD.presets.Collection(_.uniq(rec.concat(def).concat(all.item(geometry))));
+ operation.disabled = function() {
+ return !context.copyIDs().length;
+ };
+ operation.tooltip = function() {
+ var oldGraph = context.copyGraph();
+ var ids = context.copyIDs();
+ if (!ids.length) {
+ return _t("operations.paste.nothing_copied");
+ }
+ return _t("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
+ };
+ operation.annotation = function() {
+ var ids = context.copyIDs();
+ return _t("operations.paste.annotation", { n: ids.length });
};
+ operation.id = "paste";
+ operation.keys = [uiCmd("\u2318V")];
+ operation.title = _t("operations.paste.title");
+ return operation;
+ }
- all.choose = function(preset) {
- if (!preset.isFallback()) {
- recent = iD.presets.Collection(_.uniq([preset].concat(recent.collection)));
+ // modules/operations/reverse.js
+ function operationReverse(context, selectedIDs) {
+ var operation = function() {
+ context.perform(function combinedReverseAction(graph) {
+ actions().forEach(function(action) {
+ graph = action(graph);
+ });
+ return graph;
+ }, operation.annotation());
+ context.validator().validate();
+ };
+ function actions(situation) {
+ return selectedIDs.map(function(entityID) {
+ var entity = context.hasEntity(entityID);
+ if (!entity)
+ return null;
+ if (situation === "toolbar") {
+ if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
+ return null;
}
- return all;
+ var geometry = entity.geometry(context.graph());
+ if (entity.type !== "node" && geometry !== "line")
+ return null;
+ var action = actionReverse(entityID);
+ if (action.disabled(context.graph()))
+ return null;
+ return action;
+ }).filter(Boolean);
+ }
+ function reverseTypeID() {
+ var acts = actions();
+ var nodeActionCount = acts.filter(function(act) {
+ var entity = context.hasEntity(act.entityID());
+ return entity && entity.type === "node";
+ }).length;
+ if (nodeActionCount === 0)
+ return "line";
+ if (nodeActionCount === acts.length)
+ return "point";
+ return "feature";
+ }
+ operation.available = function(situation) {
+ return actions(situation).length > 0;
};
-
- return all;
-};
-iD.presets.Category = function(id, category, all) {
- category = _.clone(category);
-
- category.id = id;
-
- category.members = iD.presets.Collection(category.members.map(function(id) {
- return all.item(id);
- }));
-
- category.matchGeometry = function(geometry) {
- return category.geometry.indexOf(geometry) >= 0;
+ operation.disabled = function() {
+ return false;
};
-
- category.matchScore = function() { return -1; };
-
- category.name = function() {
- return t('presets.categories.' + id + '.name', {'default': id});
+ operation.tooltip = function() {
+ return _t("operations.reverse.description." + reverseTypeID());
};
-
- category.terms = function() {
- return [];
+ operation.annotation = function() {
+ var acts = actions();
+ return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
};
+ operation.id = "reverse";
+ operation.keys = [_t("operations.reverse.key")];
+ operation.title = _t("operations.reverse.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- return category;
-};
-iD.presets.Collection = function(collection) {
-
- var maxSearchResults = 50,
- maxSuggestionResults = 10;
-
- var presets = {
-
- collection: collection,
-
- item: function(id) {
- return _.find(collection, function(d) {
- return d.id === id;
- });
- },
-
- matchGeometry: function(geometry) {
- return iD.presets.Collection(collection.filter(function(d) {
- return d.matchGeometry(geometry);
- }));
- },
-
- search: function(value, geometry) {
- if (!value) return this;
-
- value = value.toLowerCase();
-
- var searchable = _.filter(collection, function(a) {
- return a.searchable !== false && a.suggestion !== true;
- }),
- suggestions = _.filter(collection, function(a) {
- return a.suggestion === true;
- });
-
- function leading(a) {
- var index = a.indexOf(value);
- return index === 0 || a[index - 1] === ' ';
- }
-
- // matches value to preset.name
- var leading_name = _.filter(searchable, function(a) {
- return leading(a.name().toLowerCase());
- }).sort(function(a, b) {
- var i = a.name().toLowerCase().indexOf(value) - b.name().toLowerCase().indexOf(value);
- if (i === 0) return a.name().length - b.name().length;
- else return i;
- });
-
- // matches value to preset.terms values
- var leading_terms = _.filter(searchable, function(a) {
- return _.some(a.terms() || [], leading);
- });
-
- // matches value to preset.tags values
- var leading_tag_values = _.filter(searchable, function(a) {
- return _.some(_.without(_.values(a.tags || {}), '*'), leading);
- });
-
-
- // finds close matches to value in preset.name
- var levenstein_name = searchable.map(function(a) {
- return {
- preset: a,
- dist: iD.util.editDistance(value, a.name().toLowerCase())
- };
- }).filter(function(a) {
- return a.dist + Math.min(value.length - a.preset.name().length, 0) < 3;
- }).sort(function(a, b) {
- return a.dist - b.dist;
- }).map(function(a) {
- return a.preset;
- });
-
- // finds close matches to value in preset.terms
- var leventstein_terms = _.filter(searchable, function(a) {
- return _.some(a.terms() || [], function(b) {
- return iD.util.editDistance(value, b) + Math.min(value.length - b.length, 0) < 3;
- });
- });
-
- function suggestionName(name) {
- var nameArray = name.split(' - ');
- if (nameArray.length > 1) {
- name = nameArray.slice(0, nameArray.length-1).join(' - ');
- }
- return name.toLowerCase();
- }
-
- var leading_suggestions = _.filter(suggestions, function(a) {
- return leading(suggestionName(a.name()));
- }).sort(function(a, b) {
- a = suggestionName(a.name());
- b = suggestionName(b.name());
- var i = a.indexOf(value) - b.indexOf(value);
- if (i === 0) return a.length - b.length;
- else return i;
- });
-
- var leven_suggestions = suggestions.map(function(a) {
- return {
- preset: a,
- dist: iD.util.editDistance(value, suggestionName(a.name()))
- };
- }).filter(function(a) {
- return a.dist + Math.min(value.length - suggestionName(a.preset.name()).length, 0) < 1;
- }).sort(function(a, b) {
- return a.dist - b.dist;
- }).map(function(a) {
- return a.preset;
- });
-
- var other = presets.item(geometry);
-
- var results = leading_name.concat(
- leading_terms,
- leading_tag_values,
- leading_suggestions.slice(0, maxSuggestionResults+5),
- levenstein_name,
- leventstein_terms,
- leven_suggestions.slice(0, maxSuggestionResults)
- ).slice(0, maxSearchResults-1);
-
- return iD.presets.Collection(_.uniq(
- results.concat(other)
- ));
- }
+ // modules/operations/split.js
+ function operationSplit(context, selectedIDs) {
+ var _vertexIds = selectedIDs.filter(function(id2) {
+ return context.graph().geometry(id2) === "vertex";
+ });
+ var _selectedWayIds = selectedIDs.filter(function(id2) {
+ var entity = context.graph().hasEntity(id2);
+ return entity && entity.type === "way";
+ });
+ var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
+ var _action = actionSplit(_vertexIds);
+ var _ways = [];
+ var _geometry = "feature";
+ var _waysAmount = "single";
+ var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
+ if (_isAvailable) {
+ if (_selectedWayIds.length)
+ _action.limitWays(_selectedWayIds);
+ _ways = _action.ways(context.graph());
+ var geometries = {};
+ _ways.forEach(function(way) {
+ geometries[way.geometry(context.graph())] = true;
+ });
+ if (Object.keys(geometries).length === 1) {
+ _geometry = Object.keys(geometries)[0];
+ }
+ _waysAmount = _ways.length === 1 ? "single" : "multiple";
+ }
+ var operation = function() {
+ var difference = context.perform(_action, operation.annotation());
+ var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
+ return context.entity(id2).type === "way";
+ }));
+ context.enter(modeSelect(context, idsToSelect));
};
-
- return presets;
-};
-iD.presets.Field = function(id, field) {
- field = _.clone(field);
-
- field.id = id;
-
- field.matchGeometry = function(geometry) {
- return !field.geometry || field.geometry === geometry;
+ operation.relatedEntityIds = function() {
+ return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
};
-
- field.t = function(scope, options) {
- return t('presets.fields.' + id + '.' + scope, options);
+ operation.available = function() {
+ return _isAvailable;
};
-
- field.label = function() {
- return field.t('label', {'default': id});
+ operation.disabled = function() {
+ var reason = _action.disabled(context.graph());
+ if (reason) {
+ return reason;
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ }
+ return false;
};
-
- var placeholder = field.placeholder;
- field.placeholder = function() {
- return field.t('placeholder', {'default': placeholder});
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ if (disable)
+ return _t("operations.split." + disable);
+ return _t("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
};
-
- return field;
-};
-iD.presets.Preset = function(id, preset, fields) {
- preset = _.clone(preset);
-
- preset.id = id;
- preset.fields = (preset.fields || []).map(getFields);
- preset.geometry = (preset.geometry || []);
-
- function getFields(f) {
- return fields[f];
- }
-
- preset.matchGeometry = function(geometry) {
- return preset.geometry.indexOf(geometry) >= 0;
+ operation.annotation = function() {
+ return _t("operations.split.annotation." + _geometry, { n: _ways.length });
+ };
+ operation.icon = function() {
+ if (_waysAmount === "multiple") {
+ return "#iD-operation-split-multiple";
+ } else {
+ return "#iD-operation-split";
+ }
};
+ operation.id = "split";
+ operation.keys = [_t("operations.split.key")];
+ operation.title = _t("operations.split.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- var matchScore = preset.matchScore || 1;
- preset.matchScore = function(entity) {
- var tags = preset.tags,
- score = 0;
-
- for (var t in tags) {
- if (entity.tags[t] === tags[t]) {
- score += matchScore;
- } else if (tags[t] === '*' && t in entity.tags) {
- score += matchScore / 2;
- } else {
- return -1;
- }
+ // modules/operations/straighten.js
+ function operationStraighten(context, selectedIDs) {
+ var _wayIDs = selectedIDs.filter(function(id2) {
+ return id2.charAt(0) === "w";
+ });
+ var _nodeIDs = selectedIDs.filter(function(id2) {
+ return id2.charAt(0) === "n";
+ });
+ var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
+ var _nodes = utilGetAllNodes(selectedIDs, context.graph());
+ var _coords = _nodes.map(function(n2) {
+ return n2.loc;
+ });
+ var _extent = utilTotalExtent(selectedIDs, context.graph());
+ var _action = chooseAction();
+ var _geometry;
+ function chooseAction() {
+ if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
+ _geometry = "point";
+ return actionStraightenNodes(_nodeIDs, context.projection);
+ } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
+ var startNodeIDs = [];
+ var endNodeIDs = [];
+ for (var i2 = 0; i2 < selectedIDs.length; i2++) {
+ var entity = context.entity(selectedIDs[i2]);
+ if (entity.type === "node") {
+ continue;
+ } else if (entity.type !== "way" || entity.isClosed()) {
+ return null;
+ }
+ startNodeIDs.push(entity.first());
+ endNodeIDs.push(entity.last());
}
-
- return score;
- };
-
- preset.t = function(scope, options) {
- return t('presets.presets.' + id + '.' + scope, options);
+ startNodeIDs = startNodeIDs.filter(function(n2) {
+ return startNodeIDs.indexOf(n2) === startNodeIDs.lastIndexOf(n2);
+ });
+ endNodeIDs = endNodeIDs.filter(function(n2) {
+ return endNodeIDs.indexOf(n2) === endNodeIDs.lastIndexOf(n2);
+ });
+ if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
+ return null;
+ var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
+ return node.id;
+ });
+ if (wayNodeIDs.length <= 2)
+ return null;
+ if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
+ return null;
+ if (_nodeIDs.length) {
+ _extent = utilTotalExtent(_nodeIDs, context.graph());
+ }
+ _geometry = "line";
+ return actionStraightenWay(selectedIDs, context.projection);
+ }
+ return null;
+ }
+ function operation() {
+ if (!_action)
+ return;
+ context.perform(_action, operation.annotation());
+ window.setTimeout(function() {
+ context.validator().validate();
+ }, 300);
+ }
+ operation.available = function() {
+ return Boolean(_action);
};
-
- var name = preset.name;
- preset.name = function() {
- if (preset.suggestion) {
- id = id.split('/');
- id = id[0] + '/' + id[1];
- return name + ' - ' + t('presets.presets.' + id + '.name');
+ operation.disabled = function() {
+ var reason = _action.disabled(context.graph());
+ if (reason) {
+ return reason;
+ } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing()) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
+ }
+ return false;
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ var osm = context.connection();
+ if (osm) {
+ var missing = _coords.filter(function(loc) {
+ return !osm.isDataLoaded(loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc) {
+ context.loadTileAtLoc(loc);
+ });
+ return true;
+ }
}
- return preset.t('name', {'default': name});
+ return false;
+ }
};
-
- preset.terms = function() {
- return preset.t('terms', {'default': ''}).toLowerCase().trim().split(/\s*,+\s*/);
+ operation.tooltip = function() {
+ var disable = operation.disabled();
+ return disable ? _t("operations.straighten." + disable + "." + _amount) : _t("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
};
-
- preset.isFallback = function() {
- var tagCount = Object.keys(preset.tags).length;
- return tagCount === 0 || (tagCount === 1 && preset.tags.hasOwnProperty('area'));
+ operation.annotation = function() {
+ return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
};
+ operation.id = "straighten";
+ operation.keys = [_t("operations.straighten.key")];
+ operation.title = _t("operations.straighten.title");
+ operation.behavior = behaviorOperation(context).which(operation);
+ return operation;
+ }
- preset.reference = function(geometry) {
- var key = Object.keys(preset.tags)[0],
- value = preset.tags[key];
-
- if (geometry === 'relation' && key === 'type') {
- return { rtype: value };
- } else if (value === '*') {
- return { key: key };
- } else {
- return { key: key, value: value };
+ // modules/modes/select.js
+ function modeSelect(context, selectedIDs) {
+ var mode = {
+ id: "select",
+ button: "browse"
+ };
+ var keybinding = utilKeybinding("select");
+ var _breatheBehavior = behaviorBreathe(context);
+ var _modeDragNode = modeDragNode(context);
+ var _selectBehavior;
+ var _behaviors = [];
+ var _operations = [];
+ var _newFeature = false;
+ var _follow = false;
+ var _focusedParentWayId;
+ var _focusedVertexIds;
+ function singular() {
+ if (selectedIDs && selectedIDs.length === 1) {
+ return context.hasEntity(selectedIDs[0]);
+ }
+ }
+ function selectedEntities() {
+ return selectedIDs.map(function(id2) {
+ return context.hasEntity(id2);
+ }).filter(Boolean);
+ }
+ function checkSelectedIDs() {
+ var ids = [];
+ if (Array.isArray(selectedIDs)) {
+ ids = selectedIDs.filter(function(id2) {
+ return context.hasEntity(id2);
+ });
+ }
+ if (!ids.length) {
+ context.enter(modeBrowse(context));
+ return false;
+ } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
+ context.enter(modeSelect(context, ids));
+ return false;
+ }
+ selectedIDs = ids;
+ return true;
+ }
+ function parentWaysIdsOfSelection(onlyCommonParents) {
+ var graph = context.graph();
+ var parents = [];
+ for (var i2 = 0; i2 < selectedIDs.length; i2++) {
+ var entity = context.hasEntity(selectedIDs[i2]);
+ if (!entity || entity.geometry(graph) !== "vertex") {
+ return [];
}
- };
-
- var removeTags = preset.removeTags || preset.tags;
- preset.removeTags = function(tags, geometry) {
- tags = _.omit(tags, _.keys(removeTags));
-
- for (var f in preset.fields) {
- var field = preset.fields[f];
- if (field.matchGeometry(geometry) && field.default === tags[field.key]) {
- delete tags[field.key];
- }
+ var currParents = graph.parentWays(entity).map(function(w) {
+ return w.id;
+ });
+ if (!parents.length) {
+ parents = currParents;
+ continue;
}
-
- delete tags.area;
- return tags;
+ parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
+ if (!parents.length) {
+ return [];
+ }
+ }
+ return parents;
+ }
+ function childNodeIdsOfSelection(onlyCommon) {
+ var graph = context.graph();
+ var childs = [];
+ for (var i2 = 0; i2 < selectedIDs.length; i2++) {
+ var entity = context.hasEntity(selectedIDs[i2]);
+ if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
+ return [];
+ }
+ var currChilds = graph.childNodes(entity).map(function(node) {
+ return node.id;
+ });
+ if (!childs.length) {
+ childs = currChilds;
+ continue;
+ }
+ childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
+ if (!childs.length) {
+ return [];
+ }
+ }
+ return childs;
+ }
+ function checkFocusedParent() {
+ if (_focusedParentWayId) {
+ var parents = parentWaysIdsOfSelection(true);
+ if (parents.indexOf(_focusedParentWayId) === -1)
+ _focusedParentWayId = null;
+ }
+ }
+ function parentWayIdForVertexNavigation() {
+ var parentIds = parentWaysIdsOfSelection(true);
+ if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
+ return _focusedParentWayId;
+ }
+ return parentIds.length ? parentIds[0] : null;
+ }
+ mode.selectedIDs = function(val) {
+ if (!arguments.length)
+ return selectedIDs;
+ selectedIDs = val;
+ return mode;
+ };
+ mode.zoomToSelected = function() {
+ context.map().zoomToEase(selectedEntities());
+ };
+ mode.newFeature = function(val) {
+ if (!arguments.length)
+ return _newFeature;
+ _newFeature = val;
+ return mode;
+ };
+ mode.selectBehavior = function(val) {
+ if (!arguments.length)
+ return _selectBehavior;
+ _selectBehavior = val;
+ return mode;
+ };
+ mode.follow = function(val) {
+ if (!arguments.length)
+ return _follow;
+ _follow = val;
+ return mode;
+ };
+ function loadOperations() {
+ _operations.forEach(function(operation) {
+ if (operation.behavior) {
+ context.uninstall(operation.behavior);
+ }
+ });
+ _operations = Object.values(operations_exports).map(function(o) {
+ return o(context, selectedIDs);
+ }).filter(function(o) {
+ return o.id !== "delete" && o.id !== "downgrade" && o.id !== "copy";
+ }).concat([
+ operationCopy(context, selectedIDs),
+ operationDowngrade(context, selectedIDs),
+ operationDelete(context, selectedIDs)
+ ]).filter(function(operation) {
+ return operation.available();
+ });
+ _operations.forEach(function(operation) {
+ if (operation.behavior) {
+ context.install(operation.behavior);
+ }
+ });
+ context.ui().closeEditMenu();
+ }
+ mode.operations = function() {
+ return _operations;
};
-
- var applyTags = preset.addTags || preset.tags;
- preset.applyTags = function(tags, geometry) {
- var k;
-
- tags = _.clone(tags);
-
- for (k in applyTags) {
- if (applyTags[k] === '*') {
- tags[k] = 'yes';
- } else {
- tags[k] = applyTags[k];
+ mode.enter = function() {
+ if (!checkSelectedIDs())
+ return;
+ context.features().forceVisible(selectedIDs);
+ _modeDragNode.restoreSelectedIDs(selectedIDs);
+ loadOperations();
+ if (!_behaviors.length) {
+ if (!_selectBehavior)
+ _selectBehavior = behaviorSelect(context);
+ _behaviors = [
+ behaviorPaste(context),
+ _breatheBehavior,
+ behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
+ _selectBehavior,
+ behaviorLasso(context),
+ _modeDragNode.behavior,
+ modeDragNote(context).behavior
+ ];
+ }
+ _behaviors.forEach(context.install);
+ keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on(["[", "pgup"], previousVertex).on(["]", "pgdown"], nextVertex).on(["{", uiCmd("\u2318["), "home"], firstVertex).on(["}", uiCmd("\u2318]"), "end"], lastVertex).on(uiCmd("\u21E7\u2190"), nudgeSelection([-10, 0])).on(uiCmd("\u21E7\u2191"), nudgeSelection([0, -10])).on(uiCmd("\u21E7\u2192"), nudgeSelection([10, 0])).on(uiCmd("\u21E7\u2193"), nudgeSelection([0, 10])).on(uiCmd("\u21E7\u2325\u2190"), nudgeSelection([-100, 0])).on(uiCmd("\u21E7\u2325\u2191"), nudgeSelection([0, -100])).on(uiCmd("\u21E7\u2325\u2192"), nudgeSelection([100, 0])).on(uiCmd("\u21E7\u2325\u2193"), nudgeSelection([0, 100])).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1.05)).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(Math.pow(1.05, 5))).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1 / 1.05)).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(1 / Math.pow(1.05, 5))).on(["\\", "pause"], focusNextParent).on(uiCmd("\u2318\u2191"), selectParent).on(uiCmd("\u2318\u2193"), selectChild).on("\u238B", esc, true);
+ select_default2(document).call(keybinding);
+ context.ui().sidebar.select(selectedIDs, _newFeature);
+ context.history().on("change.select", function() {
+ loadOperations();
+ selectElements();
+ }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
+ context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
+ selectElements();
+ _breatheBehavior.restartIfNeeded(context.surface());
+ });
+ context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
+ selectElements();
+ if (_follow) {
+ var extent = geoExtent();
+ var graph = context.graph();
+ selectedIDs.forEach(function(id2) {
+ var entity = context.entity(id2);
+ extent._extend(entity.extent(graph));
+ });
+ var loc = extent.center();
+ context.map().centerEase(loc);
+ _follow = false;
+ }
+ function nudgeSelection(delta) {
+ return function() {
+ if (!context.map().withinEditableZoom())
+ return;
+ var moveOp = operationMove(context, selectedIDs);
+ if (moveOp.disabled()) {
+ context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip)();
+ } else {
+ context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
+ context.validator().validate();
+ }
+ };
+ }
+ function scaleSelection(factor) {
+ return function() {
+ if (!context.map().withinEditableZoom())
+ return;
+ let nodes = utilGetAllNodes(selectedIDs, context.graph());
+ let isUp = factor > 1;
+ if (nodes.length <= 1)
+ return;
+ let extent2 = utilTotalExtent(selectedIDs, context.graph());
+ function scalingDisabled() {
+ if (tooSmall()) {
+ return "too_small";
+ } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
+ return "too_large";
+ } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
+ return "not_downloaded";
+ } else if (selectedIDs.some(context.hasHiddenConnections)) {
+ return "connected_to_hidden";
}
- }
-
- // Add area=yes if necessary.
- // This is necessary if the geometry is already an area (e.g. user drew an area) AND any of:
- // 1. chosen preset could be either an area or a line (`barrier=city_wall`)
- // 2. chosen preset doesn't have a key in areaKeys (`railway=station`)
- if (geometry === 'area') {
- var needsAreaTag = true;
- if (preset.geometry.indexOf('line') === -1) {
- for (k in applyTags) {
- if (k in iD.areaKeys) {
- needsAreaTag = false;
- break;
- }
+ return false;
+ function tooSmall() {
+ if (isUp)
+ return false;
+ let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
+ let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
+ return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
+ }
+ function someMissing() {
+ if (context.inIntro())
+ return false;
+ let osm = context.connection();
+ if (osm) {
+ let missing = nodes.filter(function(n2) {
+ return !osm.isDataLoaded(n2.loc);
+ });
+ if (missing.length) {
+ missing.forEach(function(loc2) {
+ context.loadTileAtLoc(loc2);
+ });
+ return true;
}
+ }
+ return false;
}
- if (needsAreaTag) {
- tags.area = 'yes';
+ function incompleteRelation(id2) {
+ let entity = context.entity(id2);
+ return entity.type === "relation" && !entity.isComplete(context.graph());
}
+ }
+ const disabled = scalingDisabled();
+ if (disabled) {
+ let multi = selectedIDs.length === 1 ? "single" : "multiple";
+ context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.html("operations.scale." + disabled + "." + multi))();
+ } else {
+ const pivot = context.projection(extent2.center());
+ const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
+ context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
+ context.validator().validate();
+ }
+ };
+ }
+ function didDoubleUp(d3_event, loc2) {
+ if (!context.map().withinEditableZoom())
+ return;
+ var target = select_default2(d3_event.target);
+ var datum2 = target.datum();
+ var entity = datum2 && datum2.properties && datum2.properties.entity;
+ if (!entity)
+ return;
+ if (entity instanceof osmWay && target.classed("target")) {
+ var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
+ var prev = entity.nodes[choice.index - 1];
+ var next = entity.nodes[choice.index];
+ context.perform(actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()), _t("operations.add.annotation.vertex"));
+ context.validator().validate();
+ } else if (entity.type === "midpoint") {
+ context.perform(actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()), _t("operations.add.annotation.vertex"));
+ context.validator().validate();
}
-
- for (var f in preset.fields) {
- var field = preset.fields[f];
- if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
- tags[field.key] = field.default;
- }
+ }
+ function selectElements() {
+ if (!checkSelectedIDs())
+ return;
+ var surface = context.surface();
+ surface.selectAll(".selected-member").classed("selected-member", false);
+ surface.selectAll(".selected").classed("selected", false);
+ surface.selectAll(".related").classed("related", false);
+ checkFocusedParent();
+ if (_focusedParentWayId) {
+ surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
+ }
+ if (context.map().withinEditableZoom()) {
+ surface.selectAll(utilDeepMemberSelector(selectedIDs, context.graph(), true)).classed("selected-member", true);
+ surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
}
-
- return tags;
- };
-
- return preset;
-};
-iD.validations = {};
-iD.validations.DeprecatedTag = function() {
-
- var validation = function(changes) {
- var warnings = [];
- for (var i = 0; i < changes.created.length; i++) {
- var change = changes.created[i],
- deprecatedTags = change.deprecatedTags();
-
- if (!_.isEmpty(deprecatedTags)) {
- var tags = iD.util.tagText({ tags: deprecatedTags });
- warnings.push({
- id: 'deprecated_tags',
- message: t('validations.deprecated_tags', { tags: tags }),
- entity: change
- });
- }
+ }
+ function esc() {
+ if (context.container().select(".combobox").size())
+ return;
+ context.enter(modeBrowse(context));
+ }
+ function firstVertex(d3_event) {
+ d3_event.preventDefault();
+ var entity = singular();
+ var parentId = parentWayIdForVertexNavigation();
+ var way;
+ if (entity && entity.type === "way") {
+ way = entity;
+ } else if (parentId) {
+ way = context.entity(parentId);
+ }
+ _focusedParentWayId = way && way.id;
+ if (way) {
+ context.enter(mode.selectedIDs([way.first()]).follow(true));
+ }
+ }
+ function lastVertex(d3_event) {
+ d3_event.preventDefault();
+ var entity = singular();
+ var parentId = parentWayIdForVertexNavigation();
+ var way;
+ if (entity && entity.type === "way") {
+ way = entity;
+ } else if (parentId) {
+ way = context.entity(parentId);
+ }
+ _focusedParentWayId = way && way.id;
+ if (way) {
+ context.enter(mode.selectedIDs([way.last()]).follow(true));
+ }
+ }
+ function previousVertex(d3_event) {
+ d3_event.preventDefault();
+ var parentId = parentWayIdForVertexNavigation();
+ _focusedParentWayId = parentId;
+ if (!parentId)
+ return;
+ var way = context.entity(parentId);
+ var length = way.nodes.length;
+ var curr = way.nodes.indexOf(selectedIDs[0]);
+ var index = -1;
+ if (curr > 0) {
+ index = curr - 1;
+ } else if (way.isClosed()) {
+ index = length - 2;
+ }
+ if (index !== -1) {
+ context.enter(mode.selectedIDs([way.nodes[index]]).follow(true));
+ }
+ }
+ function nextVertex(d3_event) {
+ d3_event.preventDefault();
+ var parentId = parentWayIdForVertexNavigation();
+ _focusedParentWayId = parentId;
+ if (!parentId)
+ return;
+ var way = context.entity(parentId);
+ var length = way.nodes.length;
+ var curr = way.nodes.indexOf(selectedIDs[0]);
+ var index = -1;
+ if (curr < length - 1) {
+ index = curr + 1;
+ } else if (way.isClosed()) {
+ index = 0;
+ }
+ if (index !== -1) {
+ context.enter(mode.selectedIDs([way.nodes[index]]).follow(true));
+ }
+ }
+ function focusNextParent(d3_event) {
+ d3_event.preventDefault();
+ var parents = parentWaysIdsOfSelection(true);
+ if (!parents || parents.length < 2)
+ return;
+ var index = parents.indexOf(_focusedParentWayId);
+ if (index < 0 || index > parents.length - 2) {
+ _focusedParentWayId = parents[0];
+ } else {
+ _focusedParentWayId = parents[index + 1];
+ }
+ var surface = context.surface();
+ surface.selectAll(".related").classed("related", false);
+ if (_focusedParentWayId) {
+ surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
}
- return warnings;
+ }
+ function selectParent(d3_event) {
+ d3_event.preventDefault();
+ var currentSelectedIds = mode.selectedIDs();
+ var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
+ if (!parentIds.length)
+ return;
+ context.enter(mode.selectedIDs(parentIds));
+ _focusedVertexIds = currentSelectedIds;
+ }
+ function selectChild(d3_event) {
+ d3_event.preventDefault();
+ var currentSelectedIds = mode.selectedIDs();
+ var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
+ if (!childIds || !childIds.length)
+ return;
+ if (currentSelectedIds.length === 1)
+ _focusedParentWayId = currentSelectedIds[0];
+ context.enter(mode.selectedIDs(childIds));
+ }
};
-
- return validation;
-};
-iD.validations.ManyDeletions = function() {
- var threshold = 100;
-
- var validation = function(changes) {
- var warnings = [];
- if (changes.deleted.length > threshold) {
- warnings.push({
- id: 'many_deletions',
- message: t('validations.many_deletions', { n: changes.deleted.length })
- });
+ mode.exit = function() {
+ _newFeature = false;
+ _focusedVertexIds = null;
+ _operations.forEach(function(operation) {
+ if (operation.behavior) {
+ context.uninstall(operation.behavior);
}
- return warnings;
+ });
+ _operations = [];
+ _behaviors.forEach(context.uninstall);
+ select_default2(document).call(keybinding.unbind);
+ context.ui().closeEditMenu();
+ context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
+ var surface = context.surface();
+ surface.selectAll(".selected-member").classed("selected-member", false);
+ surface.selectAll(".selected").classed("selected", false);
+ surface.selectAll(".highlighted").classed("highlighted", false);
+ surface.selectAll(".related").classed("related", false);
+ context.map().on("drawn.select", null);
+ context.ui().sidebar.hide();
+ context.features().forceVisible([]);
+ var entity = singular();
+ if (_newFeature && entity && entity.type === "relation" && Object.keys(entity.tags).length === 0 && context.graph().parentRelations(entity).length === 0 && (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
+ var deleteAction = actionDeleteRelation(entity.id, true);
+ context.perform(deleteAction, _t("operations.delete.annotation.relation"));
+ context.validator().validate();
+ }
};
+ return mode;
+ }
- return validation;
-};
-iD.validations.MissingTag = function() {
-
- // Slightly stricter check than Entity#isUsed (#3091)
- function hasTags(entity, graph) {
- return _.without(Object.keys(entity.tags), 'area', 'name').length > 0 ||
- graph.parentRelations(entity).length > 0;
- }
-
- var validation = function(changes, graph) {
- var warnings = [];
- for (var i = 0; i < changes.created.length; i++) {
- var change = changes.created[i],
- geometry = change.geometry(graph);
-
- if ((geometry === 'point' || geometry === 'line' || geometry === 'area') && !hasTags(change, graph)) {
- warnings.push({
- id: 'missing_tag',
- message: t('validations.untagged_' + geometry),
- tooltip: t('validations.untagged_' + geometry + '_tooltip'),
- entity: change
- });
+ // modules/behavior/lasso.js
+ function behaviorLasso(context) {
+ var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
+ var behavior = function(selection2) {
+ var lasso;
+ function pointerdown(d3_event) {
+ var button = 0;
+ if (d3_event.button === button && d3_event.shiftKey === true) {
+ lasso = null;
+ select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
+ d3_event.stopPropagation();
+ }
+ }
+ function pointermove() {
+ if (!lasso) {
+ lasso = uiLasso(context);
+ context.surface().call(lasso);
+ }
+ lasso.p(context.map().mouse());
+ }
+ function normalize2(a, b) {
+ return [
+ [Math.min(a[0], b[0]), Math.min(a[1], b[1])],
+ [Math.max(a[0], b[0]), Math.max(a[1], b[1])]
+ ];
+ }
+ function lassoed() {
+ if (!lasso)
+ return [];
+ var graph = context.graph();
+ var limitToNodes;
+ if (context.map().editableDataEnabled(true) && context.map().isInWideSelection()) {
+ limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
+ } else if (!context.map().editableDataEnabled()) {
+ return [];
+ }
+ var bounds = lasso.extent().map(context.projection.invert);
+ var extent = geoExtent(normalize2(bounds[0], bounds[1]));
+ var intersects = context.history().intersects(extent).filter(function(entity) {
+ return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
+ });
+ intersects.sort(function(node1, node2) {
+ var parents1 = graph.parentWays(node1);
+ var parents2 = graph.parentWays(node2);
+ if (parents1.length && parents2.length) {
+ var sharedParents = utilArrayIntersection(parents1, parents2);
+ if (sharedParents.length) {
+ var sharedParentNodes = sharedParents[0].nodes;
+ return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
+ } else {
+ return parseFloat(parents1[0].id.slice(1)) - parseFloat(parents2[0].id.slice(1));
}
+ } else if (parents1.length || parents2.length) {
+ return parents1.length - parents2.length;
+ }
+ return node1.loc[0] - node2.loc[0];
+ });
+ return intersects.map(function(entity) {
+ return entity.id;
+ });
+ }
+ function pointerup() {
+ select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
+ if (!lasso)
+ return;
+ var ids = lassoed();
+ lasso.close();
+ if (ids.length) {
+ context.enter(modeSelect(context, ids));
}
- return warnings;
+ }
+ selection2.on(_pointerPrefix + "down.lasso", pointerdown);
+ };
+ behavior.off = function(selection2) {
+ selection2.on(_pointerPrefix + "down.lasso", null);
};
+ return behavior;
+ }
- return validation;
-};
-iD.validations.TagSuggestsArea = function() {
+ // modules/modes/browse.js
+ function modeBrowse(context) {
+ var mode = {
+ button: "browse",
+ id: "browse",
+ title: _t("modes.browse.title"),
+ description: _t("modes.browse.description")
+ };
+ var sidebar;
+ var _selectBehavior;
+ var _behaviors = [];
+ mode.selectBehavior = function(val) {
+ if (!arguments.length)
+ return _selectBehavior;
+ _selectBehavior = val;
+ return mode;
+ };
+ mode.enter = function() {
+ if (!_behaviors.length) {
+ if (!_selectBehavior)
+ _selectBehavior = behaviorSelect(context);
+ _behaviors = [
+ behaviorPaste(context),
+ behaviorHover(context).on("hover", context.ui().sidebar.hover),
+ _selectBehavior,
+ behaviorLasso(context),
+ modeDragNode(context).behavior,
+ modeDragNote(context).behavior
+ ];
+ }
+ _behaviors.forEach(context.install);
+ if (document.activeElement && document.activeElement.blur) {
+ document.activeElement.blur();
+ }
+ if (sidebar) {
+ context.ui().sidebar.show(sidebar);
+ } else {
+ context.ui().sidebar.select(null);
+ }
+ };
+ mode.exit = function() {
+ context.ui().sidebar.hover.cancel();
+ _behaviors.forEach(context.uninstall);
+ if (sidebar) {
+ context.ui().sidebar.hide();
+ }
+ };
+ mode.sidebar = function(_) {
+ if (!arguments.length)
+ return sidebar;
+ sidebar = _;
+ return mode;
+ };
+ mode.operations = function() {
+ return [operationPaste(context)];
+ };
+ return mode;
+ }
- // https://github.com/openstreetmap/josm/blob/mirror/src/org/
- // openstreetmap/josm/data/validation/tests/UnclosedWays.java#L80
- function tagSuggestsArea(tags) {
- if (_.isEmpty(tags)) return false;
+ // modules/behavior/add_way.js
+ function behaviorAddWay(context) {
+ var dispatch10 = dispatch_default("start", "startFromWay", "startFromNode");
+ var draw = behaviorDraw(context);
+ function behavior(surface) {
+ draw.on("click", function() {
+ dispatch10.apply("start", this, arguments);
+ }).on("clickWay", function() {
+ dispatch10.apply("startFromWay", this, arguments);
+ }).on("clickNode", function() {
+ dispatch10.apply("startFromNode", this, arguments);
+ }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
+ context.map().dblclickZoomEnable(false);
+ surface.call(draw);
+ }
+ behavior.off = function(surface) {
+ surface.call(draw.off);
+ };
+ behavior.cancel = function() {
+ window.setTimeout(function() {
+ context.map().dblclickZoomEnable(true);
+ }, 1e3);
+ context.enter(modeBrowse(context));
+ };
+ return utilRebind(behavior, dispatch10, "on");
+ }
- var presence = ['landuse', 'amenities', 'tourism', 'shop'];
- for (var i = 0; i < presence.length; i++) {
- if (tags[presence[i]] !== undefined) {
- return presence[i] + '=' + tags[presence[i]];
- }
+ // modules/behavior/hash.js
+ function behaviorHash(context) {
+ var _cachedHash = null;
+ var _latitudeLimit = 90 - 1e-8;
+ function computedHashParameters() {
+ var map2 = context.map();
+ var center = map2.center();
+ var zoom = map2.zoom();
+ var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
+ var oldParams = utilObjectOmit(utilStringQs(window.location.hash), ["comment", "source", "hashtags", "walkthrough"]);
+ var newParams = {};
+ delete oldParams.id;
+ var selected = context.selectedIDs().filter(function(id2) {
+ return context.hasEntity(id2);
+ });
+ if (selected.length) {
+ newParams.id = selected.join(",");
+ }
+ newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
+ return Object.assign(oldParams, newParams);
+ }
+ function computedHash() {
+ return "#" + utilQsString(computedHashParameters(), true);
+ }
+ function computedTitle(includeChangeCount) {
+ var baseTitle = context.documentTitleBase() || "iD";
+ var contextual;
+ var changeCount;
+ var titleID;
+ var selected = context.selectedIDs().filter(function(id2) {
+ return context.hasEntity(id2);
+ });
+ if (selected.length) {
+ var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
+ if (selected.length > 1) {
+ contextual = _t("title.labeled_and_more", {
+ labeled: firstLabel,
+ count: selected.length - 1
+ });
+ } else {
+ contextual = firstLabel;
}
-
- if (tags.building && tags.building === 'yes') return 'building=yes';
+ titleID = "context";
+ }
+ if (includeChangeCount) {
+ changeCount = context.history().difference().summary().length;
+ if (changeCount > 0) {
+ titleID = contextual ? "changes_context" : "changes";
+ }
+ }
+ if (titleID) {
+ return _t("title.format." + titleID, {
+ changes: changeCount,
+ base: baseTitle,
+ context: contextual
+ });
+ }
+ return baseTitle;
}
-
- var validation = function(changes, graph) {
- var warnings = [];
- for (var i = 0; i < changes.created.length; i++) {
- var change = changes.created[i],
- geometry = change.geometry(graph),
- suggestion = (geometry === 'line' ? tagSuggestsArea(change.tags) : undefined);
-
- if (suggestion) {
- warnings.push({
- id: 'tag_suggests_area',
- message: t('validations.tag_suggests_area', { tag: suggestion }),
- entity: change
- });
- }
+ function updateTitle(includeChangeCount) {
+ if (!context.setsDocumentTitle())
+ return;
+ var newTitle = computedTitle(includeChangeCount);
+ if (document.title !== newTitle) {
+ document.title = newTitle;
+ }
+ }
+ function updateHashIfNeeded() {
+ if (context.inIntro())
+ return;
+ var latestHash = computedHash();
+ if (_cachedHash !== latestHash) {
+ _cachedHash = latestHash;
+ window.history.replaceState(null, computedTitle(false), latestHash);
+ updateTitle(true);
+ }
+ }
+ var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
+ var _throttledUpdateTitle = throttle_default(function() {
+ updateTitle(true);
+ }, 500);
+ function hashchange() {
+ if (window.location.hash === _cachedHash)
+ return;
+ _cachedHash = window.location.hash;
+ var q = utilStringQs(_cachedHash);
+ var mapArgs = (q.map || "").split("/").map(Number);
+ if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
+ updateHashIfNeeded();
+ } else {
+ if (_cachedHash === computedHash())
+ return;
+ var mode = context.mode();
+ context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
+ if (q.id && mode) {
+ var ids = q.id.split(",").filter(function(id2) {
+ return context.hasEntity(id2);
+ });
+ if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
+ context.enter(modeSelect(context, ids));
+ return;
+ }
+ }
+ var center = context.map().center();
+ var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
+ var maxdist = 500;
+ if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
+ context.enter(modeBrowse(context));
+ return;
+ }
+ }
+ }
+ function behavior() {
+ context.map().on("move.behaviorHash", _throttledUpdate);
+ context.history().on("change.behaviorHash", _throttledUpdateTitle);
+ context.on("enter.behaviorHash", _throttledUpdate);
+ select_default2(window).on("hashchange.behaviorHash", hashchange);
+ if (window.location.hash) {
+ var q = utilStringQs(window.location.hash);
+ if (q.id) {
+ context.zoomToEntity(q.id.split(",")[0], !q.map);
}
- return warnings;
+ if (q.walkthrough === "true") {
+ behavior.startWalkthrough = true;
+ }
+ if (q.map) {
+ behavior.hadHash = true;
+ }
+ hashchange();
+ updateTitle(false);
+ }
+ }
+ behavior.off = function() {
+ _throttledUpdate.cancel();
+ _throttledUpdateTitle.cancel();
+ context.map().on("move.behaviorHash", null);
+ context.on("enter.behaviorHash", null);
+ select_default2(window).on("hashchange.behaviorHash", null);
+ window.location.hash = "";
};
+ return behavior;
+ }
- return validation;
-};
-})();
-window.locale = { _current: 'en' };
-
-locale.current = function(_) {
- if (!arguments.length) return locale._current;
- if (locale[_] !== undefined) locale._current = _;
- else if (locale[_.split('-')[0]]) locale._current = _.split('-')[0];
- return locale;
-};
-
-function t(s, o, loc) {
- loc = loc || locale._current;
-
- var path = s.split(".").reverse(),
- rep = locale[loc];
-
- while (rep !== undefined && path.length) rep = rep[path.pop()];
-
- if (rep !== undefined) {
- if (o) for (var k in o) rep = rep.replace('{' + k + '}', o[k]);
- return rep;
+ // node_modules/d3-brush/src/brush.js
+ var { abs: abs2, max: max2, min: min2 } = Math;
+ function number1(e) {
+ return [+e[0], +e[1]];
+ }
+ function number22(e) {
+ return [number1(e[0]), number1(e[1])];
+ }
+ var X = {
+ name: "x",
+ handles: ["w", "e"].map(type2),
+ input: function(x, e) {
+ return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]];
+ },
+ output: function(xy) {
+ return xy && [xy[0][0], xy[1][0]];
}
-
- if (loc !== 'en') {
- return t(s, o, 'en');
+ };
+ var Y = {
+ name: "y",
+ handles: ["n", "s"].map(type2),
+ input: function(y, e) {
+ return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]];
+ },
+ output: function(xy) {
+ return xy && [xy[0][1], xy[1][1]];
}
-
- if (o && 'default' in o) {
- return o['default'];
+ };
+ var XY = {
+ name: "xy",
+ handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type2),
+ input: function(xy) {
+ return xy == null ? null : number22(xy);
+ },
+ output: function(xy) {
+ return xy;
}
+ };
+ function type2(t) {
+ return { type: t };
+ }
- var missing = 'Missing ' + loc + ' translation: ' + s;
- if (typeof console !== "undefined") console.error(missing);
+ // modules/index.js
+ var debug = false;
+ var d3 = {
+ dispatch: dispatch_default,
+ geoMercator: mercator_default,
+ geoProjection: projection,
+ polygonArea: area_default3,
+ polygonCentroid: centroid_default2,
+ select: select_default2,
+ selectAll: selectAll_default2,
+ timerFlush
+ };
- return missing;
-}
-iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081]},"n185964961":{"id":"n185964961","loc":[-85.6406588,41.942601]},"n185964962":{"id":"n185964962","loc":[-85.6394548,41.94261]},"n185970607":{"id":"n185970607","loc":[-85.641094,41.94006]},"n185970614":{"id":"n185970614","loc":[-85.641825,41.941316]},"n185970616":{"id":"n185970616","loc":[-85.641838,41.941556]},"n185973650":{"id":"n185973650","loc":[-85.639918,41.940064]},"n185973660":{"id":"n185973660","loc":[-85.640645,41.941339]},"n185973659":{"id":"n185973659","loc":[-85.6406115,41.9400658]},"n185974479":{"id":"n185974479","loc":[-85.639402,41.941344]},"n185974481":{"id":"n185974481","loc":[-85.643071,41.941288]},"n185976259":{"id":"n185976259","loc":[-85.642213,41.940043]},"n185976261":{"id":"n185976261","loc":[-85.643056,41.94001]},"n185964959":{"id":"n185964959","loc":[-85.6431031,41.9425754]},"n185964960":{"id":"n185964960","loc":[-85.6418749,41.9425864]},"n185981481":{"id":"n185981481","loc":[-85.6386827,41.9400828]},"n185981482":{"id":"n185981482","loc":[-85.6393664,41.9400854]},"n2138493844":{"id":"n2138493844","loc":[-85.6427969,41.940522]},"n2138493845":{"id":"n2138493845","loc":[-85.6425891,41.9405228]},"n2138493846":{"id":"n2138493846","loc":[-85.6425868,41.9402875]},"n2138493847":{"id":"n2138493847","loc":[-85.6427969,41.9402858]},"n2138493848":{"id":"n2138493848","loc":[-85.6425708,41.9405234]},"n2138493849":{"id":"n2138493849","loc":[-85.642568,41.9402855]},"n2138493850":{"id":"n2138493850","loc":[-85.6423157,41.9402886]},"n2138493851":{"id":"n2138493851","loc":[-85.6423212,41.9404362]},"n2138493852":{"id":"n2138493852","loc":[-85.6422923,41.9404578]},"n2138493853":{"id":"n2138493853","loc":[-85.6422868,41.9404834]},"n2138493854":{"id":"n2138493854","loc":[-85.6423226,41.9405091]},"n2138493855":{"id":"n2138493855","loc":[-85.6423847,41.9405111]},"n2138493856":{"id":"n2138493856","loc":[-85.6424081,41.9405265]},"n2140155811":{"id":"n2140155811","loc":[-85.6419547,41.9410956]},"n2140155814":{"id":"n2140155814","loc":[-85.6427577,41.9410884]},"n2140155816":{"id":"n2140155816","loc":[-85.6427545,41.9410052]},"n2140155818":{"id":"n2140155818","loc":[-85.6428057,41.9410028]},"n2140155821":{"id":"n2140155821","loc":[-85.6427993,41.9407339]},"n2140155823":{"id":"n2140155823","loc":[-85.6427385,41.9407339]},"n2140155825":{"id":"n2140155825","loc":[-85.6427417,41.9406435]},"n2140155827":{"id":"n2140155827","loc":[-85.6419515,41.9406482]},"n2140155828":{"id":"n2140155828","loc":[-85.6429368,41.9412407]},"n2140155829":{"id":"n2140155829","loc":[-85.6417756,41.9412526]},"n2140155830":{"id":"n2140155830","loc":[-85.641766,41.9405983]},"n2140155831":{"id":"n2140155831","loc":[-85.6419803,41.9405983]},"n2140155832":{"id":"n2140155832","loc":[-85.6419611,41.9401366]},"n2140155833":{"id":"n2140155833","loc":[-85.6429336,41.94012]},"n2140155834":{"id":"n2140155834","loc":[-85.6430697,41.9411732]},"n2140155835":{"id":"n2140155835","loc":[-85.6428411,41.9409974]},"n2140155837":{"id":"n2140155837","loc":[-85.6428388,41.9407211]},"n2140155839":{"id":"n2140155839","loc":[-85.6430624,41.9405521]},"n2140155840":{"id":"n2140155840","loc":[-85.6427323,41.9412396]},"n2140155842":{"id":"n2140155842","loc":[-85.6418147,41.9412457]},"n2140155844":{"id":"n2140155844","loc":[-85.641813,41.9411319]},"n2140155845":{"id":"n2140155845","loc":[-85.6418394,41.9411111]},"n2140155847":{"id":"n2140155847","loc":[-85.6418838,41.9410977]},"n2140155849":{"id":"n2140155849","loc":[-85.6427324,41.9410921]},"n2140155851":{"id":"n2140155851","loc":[-85.6427798,41.9412945]},"n2140155852":{"id":"n2140155852","loc":[-85.6427701,41.9411777]},"n2140155854":{"id":"n2140155854","loc":[-85.6427323,41.9411572]},"n2140155856":{"id":"n2140155856","loc":[-85.6418478,41.9411666]},"n2165942818":{"id":"n2165942818","loc":[-85.6437533,41.9415029]},"n2165942819":{"id":"n2165942819","loc":[-85.6437623,41.9421195]},"n2168510551":{"id":"n2168510551","loc":[-85.6423795,41.9422615]},"n2168510552":{"id":"n2168510552","loc":[-85.6423744,41.9419439]},"n2168510553":{"id":"n2168510553","loc":[-85.642518,41.9419427]},"n2168510554":{"id":"n2168510554","loc":[-85.6425186,41.9419801]},"n2168510555":{"id":"n2168510555","loc":[-85.6428314,41.9419773]},"n2168510556":{"id":"n2168510556","loc":[-85.6428368,41.9423116]},"n2168510557":{"id":"n2168510557","loc":[-85.6424947,41.9423146]},"n2168510558":{"id":"n2168510558","loc":[-85.6424938,41.9422605]},"n2189046007":{"id":"n2189046007","loc":[-85.6410866,41.9424327]},"n2189046009":{"id":"n2189046009","loc":[-85.6410805,41.9420061]},"n2189046011":{"id":"n2189046011","loc":[-85.6412443,41.9420048]},"n2189046012":{"id":"n2189046012","loc":[-85.6412505,41.9424314]},"n2189046014":{"id":"n2189046014","loc":[-85.6413311,41.942968]},"n2189046016":{"id":"n2189046016","loc":[-85.6413281,41.942713]},"n2189046018":{"id":"n2189046018","loc":[-85.641521,41.9427117]},"n2189046021":{"id":"n2189046021","loc":[-85.6415234,41.9429236]},"n2189046022":{"id":"n2189046022","loc":[-85.6415045,41.9429238]},"n2189046025":{"id":"n2189046025","loc":[-85.641505,41.9429668]},"n2189046053":{"id":"n2189046053","loc":[-85.6385988,41.942412]},"n2189046054":{"id":"n2189046054","loc":[-85.6385985,41.9423311]},"n2189046055":{"id":"n2189046055","loc":[-85.6387617,41.9423308]},"n2189046056":{"id":"n2189046056","loc":[-85.6387616,41.9423026]},"n2189046058":{"id":"n2189046058","loc":[-85.6388215,41.9423025]},"n2189046059":{"id":"n2189046059","loc":[-85.6388219,41.9424115]},"n2189046060":{"id":"n2189046060","loc":[-85.6391096,41.9424486]},"n2189046061":{"id":"n2189046061","loc":[-85.6391105,41.9423673]},"n2189046063":{"id":"n2189046063","loc":[-85.6392911,41.9423684]},"n2189046065":{"id":"n2189046065","loc":[-85.6392903,41.9424497]},"n2189046067":{"id":"n2189046067","loc":[-85.6397927,41.9423876]},"n2189046069":{"id":"n2189046069","loc":[-85.6397897,41.9422981]},"n2189046070":{"id":"n2189046070","loc":[-85.6399702,41.9422947]},"n2189046072":{"id":"n2189046072","loc":[-85.6399732,41.9423843]},"n2189046074":{"id":"n2189046074","loc":[-85.6396331,41.9430227]},"n2189046075":{"id":"n2189046075","loc":[-85.6398673,41.9430189]},"n2189046077":{"id":"n2189046077","loc":[-85.6398656,41.9429637]},"n2189046079":{"id":"n2189046079","loc":[-85.6398885,41.9429633]},"n2189046082":{"id":"n2189046082","loc":[-85.6398832,41.942779]},"n2189046083":{"id":"n2189046083","loc":[-85.6398513,41.9427796]},"n2189046085":{"id":"n2189046085","loc":[-85.6398502,41.9427401]},"n2189046087":{"id":"n2189046087","loc":[-85.6397889,41.9427411]},"n2189046089":{"id":"n2189046089","loc":[-85.6397892,41.942753]},"n2189046090":{"id":"n2189046090","loc":[-85.6396983,41.9427544]},"n2189046092":{"id":"n2189046092","loc":[-85.6396993,41.9427882]},"n2189046094":{"id":"n2189046094","loc":[-85.6396746,41.9427886]},"n2189046096":{"id":"n2189046096","loc":[-85.6396758,41.9428296]},"n2189046097":{"id":"n2189046097","loc":[-85.6397007,41.9428292]},"n2189046099":{"id":"n2189046099","loc":[-85.6397018,41.9428686]},"n2189046103":{"id":"n2189046103","loc":[-85.6396289,41.9428697]},"n2189046112":{"id":"n2189046112","loc":[-85.6435683,41.9429457]},"n2189046113":{"id":"n2189046113","loc":[-85.643568,41.9427766]},"n2189046115":{"id":"n2189046115","loc":[-85.6434011,41.9427767]},"n2189046116":{"id":"n2189046116","loc":[-85.6434012,41.9428631]},"n2189046117":{"id":"n2189046117","loc":[-85.643448,41.9428631]},"n2189046118":{"id":"n2189046118","loc":[-85.6434481,41.9429457]},"n2189046119":{"id":"n2189046119","loc":[-85.6428363,41.9429809]},"n2189046120":{"id":"n2189046120","loc":[-85.6429171,41.9429791]},"n2189046121":{"id":"n2189046121","loc":[-85.642914,41.9429041]},"n2189046122":{"id":"n2189046122","loc":[-85.6429385,41.9429035]},"n2189046123":{"id":"n2189046123","loc":[-85.6429348,41.9428126]},"n2189046124":{"id":"n2189046124","loc":[-85.6427746,41.9428163]},"n2189046125":{"id":"n2189046125","loc":[-85.6427783,41.942906]},"n2189046126":{"id":"n2189046126","loc":[-85.6428332,41.9429047]},"n2189046127":{"id":"n2189046127","loc":[-85.6423018,41.9428859]},"n2189046128":{"id":"n2189046128","loc":[-85.6422987,41.9427208]},"n2189046130":{"id":"n2189046130","loc":[-85.6424218,41.9427195]},"n2189046131":{"id":"n2189046131","loc":[-85.6424246,41.9428684]},"n2189046132":{"id":"n2189046132","loc":[-85.6423845,41.9428689]},"n2189046133":{"id":"n2189046133","loc":[-85.6423848,41.942885]},"n2189046134":{"id":"n2189046134","loc":[-85.641533,41.9429392]},"n2189046135":{"id":"n2189046135","loc":[-85.6416096,41.9428768]},"n2189046137":{"id":"n2189046137","loc":[-85.6416763,41.9429221]},"n2189046138":{"id":"n2189046138","loc":[-85.6415997,41.9429845]},"n2189046139":{"id":"n2189046139","loc":[-85.6420598,41.9428016]},"n2189046140":{"id":"n2189046140","loc":[-85.6420593,41.9427415]},"n2189046141":{"id":"n2189046141","loc":[-85.6421957,41.9427409]},"n2189046142":{"id":"n2189046142","loc":[-85.6421963,41.9428182]},"n2189046143":{"id":"n2189046143","loc":[-85.6421281,41.9428185]},"n2189046144":{"id":"n2189046144","loc":[-85.6421279,41.9428013]},"n2189046145":{"id":"n2189046145","loc":[-85.6409429,41.9429345]},"n2189046146":{"id":"n2189046146","loc":[-85.6410354,41.9429334]},"n2189046147":{"id":"n2189046147","loc":[-85.6410325,41.9427972]},"n2189046148":{"id":"n2189046148","loc":[-85.640997,41.9427976]},"n2189046149":{"id":"n2189046149","loc":[-85.6409963,41.9427643]},"n2189046150":{"id":"n2189046150","loc":[-85.6408605,41.9427659]},"n2189046152":{"id":"n2189046152","loc":[-85.6408623,41.9428482]},"n2189046153":{"id":"n2189046153","loc":[-85.640941,41.9428473]},"n2189152992":{"id":"n2189152992","loc":[-85.6437661,41.9422257]},"n2189152993":{"id":"n2189152993","loc":[-85.643768,41.9424067]},"n2189152994":{"id":"n2189152994","loc":[-85.6432176,41.9417705]},"n2189152995":{"id":"n2189152995","loc":[-85.6432097,41.941327]},"n2189152996":{"id":"n2189152996","loc":[-85.6436493,41.9413226]},"n2189152997":{"id":"n2189152997","loc":[-85.6436563,41.9417164]},"n2189152998":{"id":"n2189152998","loc":[-85.6435796,41.9417171]},"n2189152999":{"id":"n2189152999","loc":[-85.6435805,41.9417669]},"n2189153000":{"id":"n2189153000","loc":[-85.6438202,41.9414953]},"n2189153001":{"id":"n2189153001","loc":[-85.6438173,41.9413175]},"n2189153004":{"id":"n2189153004","loc":[-85.6432535,41.9418466]},"n2189153005":{"id":"n2189153005","loc":[-85.6433935,41.9418599]},"n2189153006":{"id":"n2189153006","loc":[-85.6434831,41.9418986]},"n2189153007":{"id":"n2189153007","loc":[-85.6435678,41.9419774]},"n2189153008":{"id":"n2189153008","loc":[-85.6435987,41.9420282]},"n2189153009":{"id":"n2189153009","loc":[-85.643438,41.9419573]},"n2189153010":{"id":"n2189153010","loc":[-85.6435284,41.9424676]},"n2189153011":{"id":"n2189153011","loc":[-85.6436207,41.9423631]},"n2189153012":{"id":"n2189153012","loc":[-85.6434957,41.9422973]},"n2189153013":{"id":"n2189153013","loc":[-85.6434457,41.9422458]},"n2189153014":{"id":"n2189153014","loc":[-85.6433976,41.9421772]},"n2189153015":{"id":"n2189153015","loc":[-85.6433861,41.9420785]},"n2189153016":{"id":"n2189153016","loc":[-85.6433765,41.9420313]},"n2189153017":{"id":"n2189153017","loc":[-85.6432207,41.9420284]},"n2189153018":{"id":"n2189153018","loc":[-85.6432245,41.9422759]},"n2189153019":{"id":"n2189153019","loc":[-85.6432649,41.9423474]},"n2189153020":{"id":"n2189153020","loc":[-85.6433226,41.9424132]},"n2189153021":{"id":"n2189153021","loc":[-85.6434111,41.9424704]},"n2189153022":{"id":"n2189153022","loc":[-85.6434591,41.9424347]},"n2189153025":{"id":"n2189153025","loc":[-85.6437669,41.9423073]},"n2189153026":{"id":"n2189153026","loc":[-85.6436611,41.942293]},"n2189153027":{"id":"n2189153027","loc":[-85.6435784,41.9422473]},"n2189153028":{"id":"n2189153028","loc":[-85.6435245,41.9421443]},"n2189153029":{"id":"n2189153029","loc":[-85.6435149,41.9420613]},"n2189153030":{"id":"n2189153030","loc":[-85.6433528,41.9419269]},"n2189153031":{"id":"n2189153031","loc":[-85.6432535,41.9419191]},"n2189153032":{"id":"n2189153032","loc":[-85.6430868,41.9419198]},"n2189153033":{"id":"n2189153033","loc":[-85.6434894,41.9420033]},"n2189153034":{"id":"n2189153034","loc":[-85.6432974,41.9419225]},"n2189153035":{"id":"n2189153035","loc":[-85.6433055,41.9421632]},"n2189153036":{"id":"n2189153036","loc":[-85.6433538,41.9422849]},"n2189153037":{"id":"n2189153037","loc":[-85.6434718,41.9423887]},"n2189153038":{"id":"n2189153038","loc":[-85.6436134,41.9422667]},"n2189153040":{"id":"n2189153040","loc":[-85.6438759,41.9414017]},"n2189153041":{"id":"n2189153041","loc":[-85.6438181,41.9413687]},"n2189153042":{"id":"n2189153042","loc":[-85.6436821,41.9413044]},"n2189153043":{"id":"n2189153043","loc":[-85.6435899,41.9412862]},"n2189153044":{"id":"n2189153044","loc":[-85.6433169,41.9417268]},"n2189153045":{"id":"n2189153045","loc":[-85.643301,41.9412859]},"n2189153046":{"id":"n2189153046","loc":[-85.6435531,41.9416981]},"n2189153047":{"id":"n2189153047","loc":[-85.6435427,41.9412863]},"n185948706":{"id":"n185948706","loc":[-85.6369439,41.940122]},"n185949348":{"id":"n185949348","loc":[-85.640039,41.931135]},"n185949870":{"id":"n185949870","loc":[-85.643195,41.949261]},"n185954680":{"id":"n185954680","loc":[-85.6337802,41.9401143]},"n185954784":{"id":"n185954784","loc":[-85.6487485,41.942527]},"n185958670":{"id":"n185958670","loc":[-85.637255,41.940104]},"n185958672":{"id":"n185958672","loc":[-85.636996,41.941355]},"n185960207":{"id":"n185960207","loc":[-85.634992,41.940118]},"n185963163":{"id":"n185963163","loc":[-85.638831,41.93398]},"n185963165":{"id":"n185963165","loc":[-85.640073,41.933968]},"n185963167":{"id":"n185963167","loc":[-85.641225,41.933972]},"n185963168":{"id":"n185963168","loc":[-85.642386,41.933952]},"n185964695":{"id":"n185964695","loc":[-85.6443608,41.9425645]},"n185964697":{"id":"n185964697","loc":[-85.644384,41.939941]},"n185964963":{"id":"n185964963","loc":[-85.6382347,41.9426146]},"n185964965":{"id":"n185964965","loc":[-85.637022,41.942622]},"n185964967":{"id":"n185964967","loc":[-85.6363706,41.9426606]},"n185964968":{"id":"n185964968","loc":[-85.6357988,41.9427748]},"n185964969":{"id":"n185964969","loc":[-85.6355409,41.9428465]},"n185964970":{"id":"n185964970","loc":[-85.6348729,41.9430443]},"n185966958":{"id":"n185966958","loc":[-85.641946,41.946413]},"n185966960":{"id":"n185966960","loc":[-85.643148,41.946389]},"n185967774":{"id":"n185967774","loc":[-85.641889,41.943852]},"n185967775":{"id":"n185967775","loc":[-85.641922,41.945121]},"n185967776":{"id":"n185967776","loc":[-85.641927,41.947544]},"n185967777":{"id":"n185967777","loc":[-85.641982,41.947622]},"n185969289":{"id":"n185969289","loc":[-85.63928,41.929221]},"n185969704":{"id":"n185969704","loc":[-85.6388186,41.9350099]},"n185969706":{"id":"n185969706","loc":[-85.6400709,41.9349957]},"n185969708":{"id":"n185969708","loc":[-85.6412214,41.9349827]},"n185969710":{"id":"n185969710","loc":[-85.6423509,41.934974]},"n185970602":{"id":"n185970602","loc":[-85.641293,41.931817]},"n185970604":{"id":"n185970604","loc":[-85.641258,41.932705]},"n185970605":{"id":"n185970605","loc":[-85.641148,41.936984]},"n185970606":{"id":"n185970606","loc":[-85.641112,41.938169]},"n185970906":{"id":"n185970906","loc":[-85.639454,41.943871]},"n185970908":{"id":"n185970908","loc":[-85.6394635,41.9450504]},"n185970909":{"id":"n185970909","loc":[-85.6394914,41.9451911]},"n185971368":{"id":"n185971368","loc":[-85.635769,41.940122]},"n185971978":{"id":"n185971978","loc":[-85.640003,41.936988]},"n185971980":{"id":"n185971980","loc":[-85.642299,41.936988]},"n185973633":{"id":"n185973633","loc":[-85.639023,41.92861]},"n185973635":{"id":"n185973635","loc":[-85.639153,41.928969]},"n185973637":{"id":"n185973637","loc":[-85.639213,41.929088]},"n185973639":{"id":"n185973639","loc":[-85.63935,41.929396]},"n185973641":{"id":"n185973641","loc":[-85.640143,41.931462]},"n185973644":{"id":"n185973644","loc":[-85.64019,41.931788]},"n185973646":{"id":"n185973646","loc":[-85.6401365,41.9327199]},"n185973648":{"id":"n185973648","loc":[-85.639983,41.938174]},"n185974477":{"id":"n185974477","loc":[-85.638206,41.941331]},"n185975928":{"id":"n185975928","loc":[-85.640683,41.94513]},"n185975930":{"id":"n185975930","loc":[-85.643102,41.945103]},"n185976255":{"id":"n185976255","loc":[-85.642424,41.931817]},"n185976257":{"id":"n185976257","loc":[-85.64242,41.932699]},"n185976258":{"id":"n185976258","loc":[-85.6422621,41.9381489]},"n185977452":{"id":"n185977452","loc":[-85.6457497,41.9398834]},"n185978772":{"id":"n185978772","loc":[-85.646656,41.939869]},"n185981472":{"id":"n185981472","loc":[-85.6388962,41.9321266]},"n185981474":{"id":"n185981474","loc":[-85.6388769,41.9327334]},"n185981476":{"id":"n185981476","loc":[-85.638829,41.934116]},"n185981478":{"id":"n185981478","loc":[-85.63876,41.937002]},"n185981480":{"id":"n185981480","loc":[-85.638682,41.93819]},"n185981999":{"id":"n185981999","loc":[-85.638194,41.9400866]},"n185982001":{"id":"n185982001","loc":[-85.646302,41.93988]},"n185982877":{"id":"n185982877","loc":[-85.640676,41.943867]},"n185982879":{"id":"n185982879","loc":[-85.640734,41.945887]},"n185985823":{"id":"n185985823","loc":[-85.643106,41.943841]},"n185985824":{"id":"n185985824","loc":[-85.643145,41.947641]},"n185985825":{"id":"n185985825","loc":[-85.643219,41.950829]},"n1475301385":{"id":"n1475301385","loc":[-85.6360612,41.9427042]},"n1475301397":{"id":"n1475301397","loc":[-85.6366651,41.9426328]},"n2139795811":{"id":"n2139795811","loc":[-85.6469154,41.9425427]},"n2139795830":{"id":"n2139795830","loc":[-85.6443194,41.9399444]},"n2139795834":{"id":"n2139795834","loc":[-85.6453506,41.9399002]},"n2139795837":{"id":"n2139795837","loc":[-85.645806,41.9398831]},"n2139858932":{"id":"n2139858932","loc":[-85.6351721,41.9429557]},"n2140019000":{"id":"n2140019000","loc":[-85.6359935,41.9427224]},"n2165942817":{"id":"n2165942817","loc":[-85.6442017,41.9414993]},"n2165942820":{"id":"n2165942820","loc":[-85.6442107,41.9421159]},"n2189152990":{"id":"n2189152990","loc":[-85.6442328,41.942404]},"n2189152991":{"id":"n2189152991","loc":[-85.6442309,41.9422229]},"n2189153002":{"id":"n2189153002","loc":[-85.6441329,41.9413147]},"n2189153003":{"id":"n2189153003","loc":[-85.6441357,41.9414925]},"n2189153023":{"id":"n2189153023","loc":[-85.6443453,41.9423074]},"n2189153024":{"id":"n2189153024","loc":[-85.6442318,41.9423045]},"n2189153039":{"id":"n2189153039","loc":[-85.6441343,41.9414025]},"w208643102":{"id":"w208643102","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153034","n2189153035","n2189153036","n2189153037","n2189153038"]},"w17966942":{"id":"w17966942","tags":{"highway":"residential","name":"Millard St"},"nodes":["n185954680","n185960207","n185971368","n185948706","n185958670","n185981999","n185981481","n185981482","n185973650","n185973659","n185970607","n185976259","n185976261","n2139795830","n185964697","n2139795834","n185977452","n2139795837","n185982001","n185978772"]},"w208643105":{"id":"w208643105","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153046","n2189153047"]},"w208631637":{"id":"w208631637","tags":{"area":"yes","building":"yes"},"nodes":["n2189046014","n2189046016","n2189046018","n2189046021","n2189046022","n2189046025","n2189046014"]},"w208643096":{"id":"w208643096","tags":{"amenity":"parking","area":"yes","fee":"no"},"nodes":["n2189152990","n2189153024","n2189152991","n2189152992","n2189153025","n2189152993","n2189152990"]},"w208631656":{"id":"w208631656","tags":{"area":"yes","building":"yes"},"nodes":["n2189046134","n2189046135","n2189046137","n2189046138","n2189046134"]},"w204003417":{"id":"w204003417","tags":{"area":"yes","building":"school"},"nodes":["n2140155811","n2140155814","n2140155816","n2140155818","n2140155821","n2140155823","n2140155825","n2140155827","n2140155811"]},"w208631654":{"id":"w208631654","tags":{"area":"yes","building":"yes"},"nodes":["n2189046127","n2189046128","n2189046130","n2189046131","n2189046132","n2189046133","n2189046127"]},"w17966327":{"id":"w17966327","tags":{"highway":"residential","name":"S Douglas Ave"},"nodes":["n185976261","n2140155839","n2140155834","n185974481","n2189153032","n185964959"]},"w41785752":{"id":"w41785752","tags":{"highway":"primary","name":"West Michigan Avenue","old_ref":"US 131","ref":"US 131 Business;M 60","access":"yes"},"nodes":["n185954784","n2139795811","n185964695","n185964959","n185964960","n185964961","n185964962","n185964963","n185964965","n1475301397","n185964967","n1475301385","n2140019000","n185964968","n185964969","n2139858932","n185964970"]},"w203841842":{"id":"w203841842","tags":{"area":"yes","leisure":"playground"},"nodes":["n2138493848","n2138493849","n2138493850","n2138493851","n2138493852","n2138493853","n2138493854","n2138493855","n2138493856","n2138493848"]},"w208643103":{"id":"w208643103","tags":{"highway":"service"},"nodes":["n2189153039","n2189153040","n2189153041","n2189153042","n2189153043","n2189153047","n2189153045","n185974481"]},"w208643098":{"id":"w208643098","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189153000","n2189153041","n2189153001","n2189153002","n2189153039","n2189153003","n2189153000"]},"w208631646":{"id":"w208631646","tags":{"area":"yes","building":"yes"},"nodes":["n2189046067","n2189046069","n2189046070","n2189046072","n2189046067"]},"w208631653":{"id":"w208631653","tags":{"area":"yes","building":"yes"},"nodes":["n2189046119","n2189046120","n2189046121","n2189046122","n2189046123","n2189046124","n2189046125","n2189046126","n2189046119"]},"w17966041":{"id":"w17966041","tags":{"highway":"residential","name":"S Lincoln Ave"},"nodes":["n185973659","n185973660","n185964961"]},"w208631645":{"id":"w208631645","tags":{"area":"yes","building":"yes"},"nodes":["n2189046060","n2189046061","n2189046063","n2189046065","n2189046060"]},"w206803397":{"id":"w206803397","tags":{"area":"yes","building":"yes"},"nodes":["n2168510551","n2168510552","n2168510553","n2168510554","n2168510555","n2168510556","n2168510557","n2168510558","n2168510551"]},"w17965792":{"id":"w17965792","tags":{"highway":"residential","name":"N Hooker Ave"},"nodes":["n185964962","n185970906","n185970908","n185970909"]},"w208631651":{"id":"w208631651","tags":{"area":"yes","building":"yes"},"nodes":["n2189046112","n2189046113","n2189046115","n2189046116","n2189046117","n2189046118","n2189046112"]},"w208631643":{"id":"w208631643","tags":{"area":"yes","building":"yes"},"nodes":["n2189046053","n2189046054","n2189046055","n2189046056","n2189046058","n2189046059","n2189046053"]},"w17966878":{"id":"w17966878","tags":{"highway":"residential","name":"S Hooker Ave"},"nodes":["n185981472","n185981474","n185963163","n185981476","n185969704","n185981478","n185981480","n185981481"]},"w17966102":{"id":"w17966102","tags":{"highway":"residential","name":"South St"},"nodes":["n185958672","n185974477","n185974479","n185973660","n185970614"]},"w208631660":{"id":"w208631660","tags":{"area":"yes","building":"yes"},"nodes":["n2189046145","n2189046146","n2189046147","n2189046148","n2189046149","n2189046150","n2189046152","n2189046153","n2189046145"]},"w208643101":{"id":"w208643101","tags":{"highway":"service"},"nodes":["n2189153023","n2189153024","n2189153025","n2189153026","n2189153038","n2189153027","n2189153028","n2189153029","n2189153033","n2189153009","n2189153030","n2189153034","n2189153031","n2189153032"]},"w204000205":{"id":"w204000205","tags":{"highway":"residential","name":"South St","oneway":"yes"},"nodes":["n185974481","n2140155851","n185970614"]},"w203841841":{"id":"w203841841","tags":{"area":"yes","leisure":"pitch","pitch":"basketball"},"nodes":["n2138493844","n2138493845","n2138493846","n2138493847","n2138493844"]},"w17965444":{"id":"w17965444","tags":{"highway":"residential","name":"N Grant Ave"},"nodes":["n185964960","n185967774","n185967775","n185966958","n185967776","n185967777"]},"w208631648":{"id":"w208631648","tags":{"area":"yes","building":"yes"},"nodes":["n2189046074","n2189046075","n2189046077","n2189046079","n2189046082","n2189046083","n2189046085","n2189046087","n2189046089","n2189046090","n2189046092","n2189046094","n2189046096","n2189046097","n2189046099","n2189046103","n2189046074"]},"w208643100":{"id":"w208643100","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189153010","n2189153011","n2189153012","n2189153013","n2189153014","n2189153015","n2189153016","n2189153017","n2189153018","n2189153019","n2189153020","n2189153021","n2189153022","n2189153010"]},"w17965749":{"id":"w17965749","tags":{"highway":"residential","name":"S Grant Ave"},"nodes":["n185970614","n185970616","n185964960"]},"w206574482":{"id":"w206574482","tags":{"amenity":"library","area":"yes","building":"yes","name":"Three Rivers Public Library"},"nodes":["n2165942817","n2165942818","n2165942819","n2165942820","n2165942817"]},"w208643097":{"id":"w208643097","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189152994","n2189152995","n2189152996","n2189152997","n2189152998","n2189152999","n2189152994"]},"w17966879":{"id":"w17966879","tags":{"highway":"residential","name":"S Hooker Ave"},"nodes":["n185981482","n185974479","n185964962"]},"w17966325":{"id":"w17966325","tags":{"highway":"residential","name":"S Douglas Ave"},"nodes":["n185976255","n185976257","n185963168","n185969710","n185971980","n185976258","n185954700","n185976259"]},"w17967390":{"id":"w17967390","tags":{"highway":"residential","name":"N Douglas Ave"},"nodes":["n185964959","n185985823","n185975930","n185966960","n185985824","n185949870","n185985825"]},"w208631635":{"id":"w208631635","tags":{"area":"yes","building":"yes"},"nodes":["n2189046007","n2189046009","n2189046011","n2189046012","n2189046007"]},"w208643099":{"id":"w208643099","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189153031","n2189153004","n2189153005","n2189153006","n2189153007","n2189153008","n2189153029","n2189153033","n2189153009","n2189153030","n2189153031"]},"w208631658":{"id":"w208631658","tags":{"area":"yes","building":"yes"},"nodes":["n2189046139","n2189046140","n2189046141","n2189046142","n2189046143","n2189046144","n2189046139"]},"w208643104":{"id":"w208643104","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153044","n2189153045"]},"w17966039":{"id":"w17966039","tags":{"highway":"residential","name":"S Lincoln Ave"},"nodes":["n185973633","n185973635","n185973637","n185969289","n185973639","n185949348","n185973641","n185973644","n185973646","n185963165","n185969706","n185971978","n185973648","n185973650"]},"w204003420":{"id":"w204003420","tags":{"amenity":"parking","area":"yes"},"nodes":["n2140155840","n2140155842","n2140155844","n2140155845","n2140155847","n2140155849","n2140155854","n2140155840"]},"w204003419":{"id":"w204003419","tags":{"highway":"service"},"nodes":["n2140155834","n2140155835","n2140155837","n2140155839"]},"w204003418":{"id":"w204003418","tags":{"amenity":"school","area":"yes","name":"Andrews Elementary School"},"nodes":["n2140155828","n2140155829","n2140155830","n2140155831","n2140155832","n2140155833","n2140155828"]},"w17965747":{"id":"w17965747","tags":{"highway":"residential","name":"S Grant Ave"},"nodes":["n185970602","n185970604","n185963167","n185969708","n185970605","n185970606","n185970607"]},"w17967073":{"id":"w17967073","tags":{"highway":"residential","name":"N Lincoln Ave"},"nodes":["n185964961","n185982877","n185975928","n185982879"]},"w204003421":{"id":"w204003421","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2140155851","n2140155852","n2140155854","n2140155856"]},"r1943857":{"id":"r1943857","tags":{"modifier":"Business","name":"US 131 Business (Three Rivers, MI)","network":"US:US","ref":"131","route":"road","type":"route"},"members":[{"id":"w17966509","type":"way","role":"forward"},{"id":"w143497377","type":"way","role":""},{"id":"w134150811","type":"way","role":""},{"id":"w134150800","type":"way","role":""},{"id":"w134150789","type":"way","role":""},{"id":"w134150795","type":"way","role":""},{"id":"w41785752","type":"way","role":""},{"id":"w17965146","type":"way","role":"forward"},{"id":"w17964031","type":"way","role":"forward"}]},"r270277":{"id":"r270277","tags":{"network":"US:MI","ref":"60","route":"road","state_id":"MI","type":"route","url":"http://en.wikipedia.org/wiki/M-60_%28Michigan_highway%29"},"members":[{"id":"w17751087","type":"way","role":"east"},{"id":"w117148312","type":"way","role":"east"},{"id":"w40942155","type":"way","role":"west"},{"id":"w17751017","type":"way","role":""},{"id":"w17751083","type":"way","role":""},{"id":"w17747780","type":"way","role":""},{"id":"w41068082","type":"way","role":""},{"id":"w197025212","type":"way","role":""},{"id":"w17743874","type":"way","role":""},{"id":"w17751044","type":"way","role":""},{"id":"w17752167","type":"way","role":""},{"id":"w17751089","type":"way","role":""},{"id":"w17743879","type":"way","role":""},{"id":"w17751064","type":"way","role":""},{"id":"w197057073","type":"way","role":""},{"id":"w167699963","type":"way","role":""},{"id":"w167699972","type":"way","role":""},{"id":"w17967584","type":"way","role":""},{"id":"w167699964","type":"way","role":""},{"id":"w17967582","type":"way","role":"west"},{"id":"w41260270","type":"way","role":"west"},{"id":"w17965146","type":"way","role":"west"},{"id":"w41785752","type":"way","role":""},{"id":"w134150795","type":"way","role":""},{"id":"w134150789","type":"way","role":""},{"id":"w134150800","type":"way","role":""},{"id":"w134150811","type":"way","role":""},{"id":"w134150836","type":"way","role":""},{"id":"w134150802","type":"way","role":""},{"id":"w41074896","type":"way","role":""},{"id":"w17966773","type":"way","role":""},{"id":"w17967415","type":"way","role":""},{"id":"w41074899","type":"way","role":""},{"id":"w17967581","type":"way","role":""},{"id":"w41074902","type":"way","role":""},{"id":"w41074906","type":"way","role":""},{"id":"w209707997","type":"way","role":""},{"id":"w209707998","type":"way","role":""},{"id":"w17964798","type":"way","role":""},{"id":"w17966034","type":"way","role":""},{"id":"w17967593","type":"way","role":""},{"id":"w41074888","type":"way","role":""},{"id":"w17733772","type":"way","role":""},{"id":"w41074813","type":"way","role":""},{"id":"w17742213","type":"way","role":""},{"id":"w17746863","type":"way","role":""},{"id":"w17745772","type":"way","role":""},{"id":"w17742222","type":"way","role":""},{"id":"w17745922","type":"way","role":""},{"id":"w17742198","type":"way","role":""},{"id":"w17747675","type":"way","role":""},{"id":"w17739927","type":"way","role":""},{"id":"w17745708","type":"way","role":""},{"id":"w41006323","type":"way","role":""},{"id":"w17744233","type":"way","role":""},{"id":"w17739436","type":"way","role":""},{"id":"w17742201","type":"way","role":""},{"id":"w151418616","type":"way","role":""},{"id":"w17750062","type":"way","role":""},{"id":"w17742227","type":"way","role":"east"},{"id":"w41006348","type":"way","role":"east"},{"id":"w41260984","type":"way","role":""},{"id":"w17832427","type":"way","role":""},{"id":"w17838408","type":"way","role":""},{"id":"w17835846","type":"way","role":""},{"id":"w17832923","type":"way","role":""},{"id":"w17839388","type":"way","role":""},{"id":"w17838390","type":"way","role":""},{"id":"w17831272","type":"way","role":""},{"id":"w17828581","type":"way","role":""},{"id":"w38240686","type":"way","role":""},{"id":"w17838405","type":"way","role":"east"},{"id":"w123323711","type":"way","role":"east"},{"id":"w17830167","type":"way","role":"east"},{"id":"w99011909","type":"way","role":"east"},{"id":"w41911361","type":"way","role":"east"},{"id":"w41911355","type":"way","role":"east"},{"id":"w41911356","type":"way","role":"east"},{"id":"w117148326","type":"way","role":"west"},{"id":"w41911352","type":"way","role":"west"},{"id":"w41911353","type":"way","role":"west"},{"id":"w41911354","type":"way","role":"west"},{"id":"w41911360","type":"way","role":"west"},{"id":"w38240676","type":"way","role":"west"},{"id":"w123323710","type":"way","role":"west"},{"id":"w41260271","type":"way","role":"east"},{"id":"w41260273","type":"way","role":"east"},{"id":"w17964031","type":"way","role":"east"},{"id":"w41006344","type":"way","role":"west"},{"id":"w41006351","type":"way","role":"west"}]},"n367813436":{"id":"n367813436","loc":[-85.63605205663384,41.94305506683346],"tags":{"amenity":"fire_station","name":"Three Rivers Fire Department"}},"n185948708":{"id":"n185948708","loc":[-85.6369828,41.9408789]},"n185948710":{"id":"n185948710","loc":[-85.6370184,41.9411346]},"n185954691":{"id":"n185954691","loc":[-85.634476,41.941475]},"n185954692":{"id":"n185954692","loc":[-85.635008,41.941846]},"n185954693":{"id":"n185954693","loc":[-85.635362,41.941962]},"n185954695":{"id":"n185954695","loc":[-85.63578,41.941978]},"n185972903":{"id":"n185972903","loc":[-85.63295,41.9430062]},"n185964971":{"id":"n185964971","loc":[-85.6346811,41.9431023]},"n1819805854":{"id":"n1819805854","loc":[-85.6331275,41.9404837]},"n1819805918":{"id":"n1819805918","loc":[-85.6331168,41.942798]},"n1819805762":{"id":"n1819805762","loc":[-85.6333034,41.9424123]},"n1819805907":{"id":"n1819805907","loc":[-85.6334819,41.9419121]},"n1819805915":{"id":"n1819805915","loc":[-85.6334554,41.9413588]},"n1819848888":{"id":"n1819848888","loc":[-85.6331625,41.942679]},"n1819848930":{"id":"n1819848930","loc":[-85.6338684,41.9431252]},"n1819858505":{"id":"n1819858505","loc":[-85.6346782,41.9429092]},"n1819858507":{"id":"n1819858507","loc":[-85.6339003,41.9414534]},"n1819858508":{"id":"n1819858508","loc":[-85.6345709,41.9427742]},"n1819858509":{"id":"n1819858509","loc":[-85.63419,41.9417322]},"n1819858511":{"id":"n1819858511","loc":[-85.6340666,41.9415652]},"n1819858512":{"id":"n1819858512","loc":[-85.6343295,41.9423027]},"n1819858514":{"id":"n1819858514","loc":[-85.6343241,41.942207]},"n1819858521":{"id":"n1819858521","loc":[-85.633391,41.941231]},"n1819858528":{"id":"n1819858528","loc":[-85.6343027,41.9419716]},"n185954683":{"id":"n185954683","loc":[-85.6335412,41.940147]},"n185954685":{"id":"n185954685","loc":[-85.6334296,41.9403023]},"n185954687":{"id":"n185954687","loc":[-85.6333988,41.9404704]},"n185954689":{"id":"n185954689","loc":[-85.6335511,41.9410225]},"n185954690":{"id":"n185954690","loc":[-85.6336721,41.9411669]},"n1820938802":{"id":"n1820938802","loc":[-85.6330671,41.941845]},"n1821006702":{"id":"n1821006702","loc":[-85.6344047,41.9395496]},"n2130304133":{"id":"n2130304133","loc":[-85.6349025,41.9427659]},"n2130304136":{"id":"n2130304136","loc":[-85.6346027,41.9422017]},"n2130304138":{"id":"n2130304138","loc":[-85.6348577,41.9421517]},"n2130304140":{"id":"n2130304140","loc":[-85.6348419,41.9422694]},"n2130304142":{"id":"n2130304142","loc":[-85.6349071,41.9423135]},"n2130304144":{"id":"n2130304144","loc":[-85.6350495,41.9423312]},"n2130304146":{"id":"n2130304146","loc":[-85.6351009,41.9422812]},"n2130304147":{"id":"n2130304147","loc":[-85.6351227,41.9421532]},"n2130304148":{"id":"n2130304148","loc":[-85.635526,41.9421547]},"n2130304149":{"id":"n2130304149","loc":[-85.6355339,41.9425768]},"n2130304150":{"id":"n2130304150","loc":[-85.6351582,41.9426562]},"n2130304151":{"id":"n2130304151","loc":[-85.6351207,41.9427032]},"n2138493807":{"id":"n2138493807","loc":[-85.6350923,41.9415216]},"n2138493808":{"id":"n2138493808","loc":[-85.6353603,41.9411061]},"n2138493809":{"id":"n2138493809","loc":[-85.6354421,41.9410942]},"n2138493810":{"id":"n2138493810","loc":[-85.6355079,41.9411044]},"n2138493811":{"id":"n2138493811","loc":[-85.6355693,41.9411246]},"n2138493812":{"id":"n2138493812","loc":[-85.6355829,41.9411061]},"n2138493813":{"id":"n2138493813","loc":[-85.6355624,41.9409777]},"n2138493814":{"id":"n2138493814","loc":[-85.6355011,41.9409152]},"n2138493815":{"id":"n2138493815","loc":[-85.635383,41.9409219]},"n2138493816":{"id":"n2138493816","loc":[-85.635299,41.9409658]},"n2138493817":{"id":"n2138493817","loc":[-85.6351695,41.941204]},"n2138493818":{"id":"n2138493818","loc":[-85.6348879,41.9415166]},"n2138493819":{"id":"n2138493819","loc":[-85.634897,41.9415757]},"n2138493820":{"id":"n2138493820","loc":[-85.6349606,41.9416399]},"n2138493821":{"id":"n2138493821","loc":[-85.6350219,41.9416669]},"n2138493822":{"id":"n2138493822","loc":[-85.6351241,41.9416314]},"n2138493823":{"id":"n2138493823","loc":[-85.6350855,41.9415622]},"n2138493824":{"id":"n2138493824","loc":[-85.6350401,41.9413603]},"n2138493825":{"id":"n2138493825","loc":[-85.6352206,41.9410765]},"n2138493826":{"id":"n2138493826","loc":[-85.6343865,41.9415594]},"n2138493827":{"id":"n2138493827","loc":[-85.6343506,41.9415873]},"n2138493828":{"id":"n2138493828","loc":[-85.6344158,41.9417557]},"n2138493829":{"id":"n2138493829","loc":[-85.6344614,41.9417968]},"n2138493830":{"id":"n2138493830","loc":[-85.6345005,41.9418186]},"n2138493831":{"id":"n2138493831","loc":[-85.6345965,41.9418162]},"n2138493832":{"id":"n2138493832","loc":[-85.6347317,41.9417242]},"n2138493833":{"id":"n2138493833","loc":[-85.6346722,41.941775]},"n2139858909":{"id":"n2139858909","loc":[-85.633403,41.9391006]},"n2139858910":{"id":"n2139858910","loc":[-85.6332973,41.9393967]},"n2139858911":{"id":"n2139858911","loc":[-85.633205,41.9396742]},"n2139858912":{"id":"n2139858912","loc":[-85.6332203,41.9397772]},"n2139858913":{"id":"n2139858913","loc":[-85.6333453,41.939936]},"n2139858914":{"id":"n2139858914","loc":[-85.6333761,41.9400018]},"n2139858915":{"id":"n2139858915","loc":[-85.63328,41.9402249]},"n2139858916":{"id":"n2139858916","loc":[-85.6332357,41.9403523]},"n2139858917":{"id":"n2139858917","loc":[-85.6332838,41.9405831]},"n2139858918":{"id":"n2139858918","loc":[-85.6333643,41.9408744]},"n2139858919":{"id":"n2139858919","loc":[-85.6334394,41.9410519]},"n2139858920":{"id":"n2139858920","loc":[-85.6335815,41.9411717]},"n2139858921":{"id":"n2139858921","loc":[-85.6337478,41.9412734]},"n2139858922":{"id":"n2139858922","loc":[-85.6343174,41.9415268]},"n2139858923":{"id":"n2139858923","loc":[-85.6343886,41.9417397]},"n2139858924":{"id":"n2139858924","loc":[-85.6344407,41.9418015]},"n2139858925":{"id":"n2139858925","loc":[-85.6345139,41.9418366]},"n2139858926":{"id":"n2139858926","loc":[-85.6344846,41.942005]},"n2139858927":{"id":"n2139858927","loc":[-85.6345775,41.9422218]},"n2139858928":{"id":"n2139858928","loc":[-85.6348771,41.9427814]},"n2139858929":{"id":"n2139858929","loc":[-85.6349487,41.9427995]},"n2139858930":{"id":"n2139858930","loc":[-85.6350415,41.9427874]},"n2139858931":{"id":"n2139858931","loc":[-85.6351246,41.9428589]},"n2139858978":{"id":"n2139858978","loc":[-85.6349658,41.9431481]},"n2139858979":{"id":"n2139858979","loc":[-85.6350081,41.9431287]},"n2139858980":{"id":"n2139858980","loc":[-85.6349967,41.9430997]},"n2139858981":{"id":"n2139858981","loc":[-85.6352158,41.9430352]},"n2139858982":{"id":"n2139858982","loc":[-85.6348174,41.94267]},"n2139858983":{"id":"n2139858983","loc":[-85.6346142,41.9425989]},"n2139858984":{"id":"n2139858984","loc":[-85.6344938,41.9423809]},"n2139858985":{"id":"n2139858985","loc":[-85.6344856,41.9422997]},"n2139870380":{"id":"n2139870380","loc":[-85.6346707,41.9417955]},"n2139870381":{"id":"n2139870381","loc":[-85.6345949,41.9418311]},"n2139870382":{"id":"n2139870382","loc":[-85.6343322,41.9418659]},"n2139870383":{"id":"n2139870383","loc":[-85.6342072,41.941885]},"n2139870384":{"id":"n2139870384","loc":[-85.6341325,41.9418919]},"n2139870385":{"id":"n2139870385","loc":[-85.6341314,41.9422028]},"n2139870386":{"id":"n2139870386","loc":[-85.6340472,41.9423271]},"n2139870387":{"id":"n2139870387","loc":[-85.6342185,41.9427933]},"n2139870388":{"id":"n2139870388","loc":[-85.6340605,41.9423924]},"n2139870389":{"id":"n2139870389","loc":[-85.6339889,41.9424069]},"n2139870390":{"id":"n2139870390","loc":[-85.633971,41.942356]},"n2139870391":{"id":"n2139870391","loc":[-85.63361,41.9424235]},"n2139870392":{"id":"n2139870392","loc":[-85.6337137,41.9426819]},"n2139870393":{"id":"n2139870393","loc":[-85.6336977,41.9428632]},"n2139870394":{"id":"n2139870394","loc":[-85.6338823,41.9428647]},"n2139870395":{"id":"n2139870395","loc":[-85.6339412,41.9430069]},"n2139870396":{"id":"n2139870396","loc":[-85.6338873,41.9430353]},"n2139870397":{"id":"n2139870397","loc":[-85.6337676,41.942815]},"n2139870398":{"id":"n2139870398","loc":[-85.6336822,41.9423505]},"n2139870399":{"id":"n2139870399","loc":[-85.634037,41.9422725]},"n2139870400":{"id":"n2139870400","loc":[-85.6340294,41.9422518]},"n2139870401":{"id":"n2139870401","loc":[-85.6336726,41.9423312]},"n2139870402":{"id":"n2139870402","loc":[-85.6342188,41.9425715]},"n2139870403":{"id":"n2139870403","loc":[-85.6342524,41.942565]},"n2139870404":{"id":"n2139870404","loc":[-85.6341438,41.942299]},"n2139870405":{"id":"n2139870405","loc":[-85.6341149,41.9423061]},"n2139870407":{"id":"n2139870407","loc":[-85.6340846,41.9431458]},"n2139870408":{"id":"n2139870408","loc":[-85.6339436,41.9429032]},"n2139870409":{"id":"n2139870409","loc":[-85.6343143,41.9428207]},"n2139870410":{"id":"n2139870410","loc":[-85.6343507,41.94277]},"n2139870411":{"id":"n2139870411","loc":[-85.6341527,41.942254]},"n2139870412":{"id":"n2139870412","loc":[-85.6340925,41.9422199]},"n2139870413":{"id":"n2139870413","loc":[-85.6335435,41.9423433]},"n2139870414":{"id":"n2139870414","loc":[-85.6335023,41.9423975]},"n2139870415":{"id":"n2139870415","loc":[-85.6335086,41.9424552]},"n2139870416":{"id":"n2139870416","loc":[-85.6336296,41.942665]},"n2139870417":{"id":"n2139870417","loc":[-85.6341396,41.9428596]},"n2139870418":{"id":"n2139870418","loc":[-85.6339701,41.9424487]},"n2139870419":{"id":"n2139870419","loc":[-85.6335514,41.9425294]},"n2139870420":{"id":"n2139870420","loc":[-85.6337406,41.9424929]},"n2139870421":{"id":"n2139870421","loc":[-85.6338939,41.9428687]},"n2139870422":{"id":"n2139870422","loc":[-85.6341323,41.9419538]},"n2139870423":{"id":"n2139870423","loc":[-85.6340321,41.9420376]},"n2139870424":{"id":"n2139870424","loc":[-85.6337648,41.942238]},"n2139870425":{"id":"n2139870425","loc":[-85.6337604,41.9422685]},"n2139870426":{"id":"n2139870426","loc":[-85.6337682,41.9422928]},"n2139870427":{"id":"n2139870427","loc":[-85.6338086,41.9423862]},"n2139870428":{"id":"n2139870428","loc":[-85.6349465,41.9416631]},"n2139870429":{"id":"n2139870429","loc":[-85.6351097,41.9416973]},"n2139870430":{"id":"n2139870430","loc":[-85.6353371,41.9416798]},"n2139870431":{"id":"n2139870431","loc":[-85.6349627,41.9422506]},"n2139870432":{"id":"n2139870432","loc":[-85.634979,41.9421815]},"n2139870433":{"id":"n2139870433","loc":[-85.634885,41.9421679]},"n2139870434":{"id":"n2139870434","loc":[-85.6348689,41.9422377]},"n2139870435":{"id":"n2139870435","loc":[-85.6349779,41.9419486]},"n2139870436":{"id":"n2139870436","loc":[-85.6349505,41.9418933]},"n2139870437":{"id":"n2139870437","loc":[-85.6347327,41.9419505]},"n2139870438":{"id":"n2139870438","loc":[-85.6347614,41.9420087]},"n2139870439":{"id":"n2139870439","loc":[-85.6351889,41.9416912]},"n2139870440":{"id":"n2139870440","loc":[-85.6351092,41.9418426]},"n2139870441":{"id":"n2139870441","loc":[-85.635086,41.9419659]},"n2139870442":{"id":"n2139870442","loc":[-85.6350584,41.9421466]},"n2139870443":{"id":"n2139870443","loc":[-85.6350993,41.9421606]},"n2139870444":{"id":"n2139870444","loc":[-85.6350993,41.9422132]},"n2139870445":{"id":"n2139870445","loc":[-85.6350794,41.9422855]},"n2139870446":{"id":"n2139870446","loc":[-85.6350474,41.9423159]},"n2139870447":{"id":"n2139870447","loc":[-85.6349251,41.9422998]},"n2139870448":{"id":"n2139870448","loc":[-85.634911,41.9422755]},"n2139870449":{"id":"n2139870449","loc":[-85.6349157,41.9422553]},"n2139870450":{"id":"n2139870450","loc":[-85.6347213,41.9419324]},"n2139870451":{"id":"n2139870451","loc":[-85.6349535,41.9418771]},"n2139870452":{"id":"n2139870452","loc":[-85.6350135,41.9419421]},"n2139870453":{"id":"n2139870453","loc":[-85.6348584,41.9418997]},"n2139870454":{"id":"n2139870454","loc":[-85.6348113,41.9418101]},"n2139870455":{"id":"n2139870455","loc":[-85.6347306,41.9417449]},"n2139870456":{"id":"n2139870456","loc":[-85.6349123,41.941776]},"n2139870457":{"id":"n2139870457","loc":[-85.6349423,41.9421448]},"n2139870458":{"id":"n2139870458","loc":[-85.6349436,41.9420652]},"n2139870459":{"id":"n2139870459","loc":[-85.6349136,41.9419963]},"n2139870460":{"id":"n2139870460","loc":[-85.6349814,41.9419789]},"n2139989328":{"id":"n2139989328","loc":[-85.6334188,41.9421725]},"n2139989330":{"id":"n2139989330","loc":[-85.6335087,41.9416308]},"n2139989335":{"id":"n2139989335","loc":[-85.6336856,41.9429371]},"n2139989337":{"id":"n2139989337","loc":[-85.6333713,41.9427217]},"n2139989339":{"id":"n2139989339","loc":[-85.6332912,41.9425383]},"n2139989341":{"id":"n2139989341","loc":[-85.6339369,41.9409198]},"n2139989344":{"id":"n2139989344","loc":[-85.634097,41.9409469]},"n2139989346":{"id":"n2139989346","loc":[-85.634137,41.9412852]},"n2139989348":{"id":"n2139989348","loc":[-85.6344536,41.9414151]},"n2139989350":{"id":"n2139989350","loc":[-85.6350794,41.9412392]},"n2139989351":{"id":"n2139989351","loc":[-85.6352541,41.9409387]},"n2139989353":{"id":"n2139989353","loc":[-85.6357198,41.9408007]},"n2139989355":{"id":"n2139989355","loc":[-85.6357235,41.9427088]},"n2139989357":{"id":"n2139989357","loc":[-85.6337119,41.9421256]},"n2139989359":{"id":"n2139989359","loc":[-85.6336913,41.9420655]},"n2139989360":{"id":"n2139989360","loc":[-85.633582,41.9420867]},"n2139989362":{"id":"n2139989362","loc":[-85.6336058,41.9421491]},"n2139989364":{"id":"n2139989364","loc":[-85.6339685,41.9410995]},"n2139989366":{"id":"n2139989366","loc":[-85.6339067,41.9411383]},"n2139989368":{"id":"n2139989368","loc":[-85.6339685,41.9411972]},"n2139989370":{"id":"n2139989370","loc":[-85.6340398,41.9411619]},"n2139870379":{"id":"n2139870379","loc":[-85.6348391,41.9416651]},"n2140006363":{"id":"n2140006363","loc":[-85.6353144,41.9430345]},"n2140006364":{"id":"n2140006364","loc":[-85.6349191,41.9431422]},"n2140018997":{"id":"n2140018997","loc":[-85.63645945147184,41.942986488012565],"tags":{"amenity":"townhall","name":"Three Rivers City Hall"}},"n2140018998":{"id":"n2140018998","loc":[-85.6370319,41.9427919]},"n2140018999":{"id":"n2140018999","loc":[-85.6360687,41.9427808]},"n2199856288":{"id":"n2199856288","loc":[-85.6344968,41.9407307]},"n2199856289":{"id":"n2199856289","loc":[-85.634492,41.9406036]},"n2199856290":{"id":"n2199856290","loc":[-85.634891,41.9406001]},"n2199856291":{"id":"n2199856291","loc":[-85.6348894,41.9405288]},"n2199856292":{"id":"n2199856292","loc":[-85.6349166,41.94053]},"n2199856293":{"id":"n2199856293","loc":[-85.6349166,41.9404956]},"n2199856294":{"id":"n2199856294","loc":[-85.6350219,41.9404956]},"n2199856295":{"id":"n2199856295","loc":[-85.6350251,41.94053]},"n2199856296":{"id":"n2199856296","loc":[-85.6350538,41.9405288]},"n2199856297":{"id":"n2199856297","loc":[-85.6350602,41.94079]},"n2199856298":{"id":"n2199856298","loc":[-85.6351703,41.9407912]},"n2199856299":{"id":"n2199856299","loc":[-85.6351688,41.9409171]},"n2199856300":{"id":"n2199856300","loc":[-85.6347889,41.9409135]},"n2199856301":{"id":"n2199856301","loc":[-85.6347921,41.94079]},"n2199856302":{"id":"n2199856302","loc":[-85.6348942,41.9407888]},"n2199856303":{"id":"n2199856303","loc":[-85.6348926,41.9407283]},"n185951869":{"id":"n185951869","loc":[-85.6387639,41.957288]},"n185958643":{"id":"n185958643","loc":[-85.636746,41.929221]},"n185958645":{"id":"n185958645","loc":[-85.636791,41.929363]},"n185958647":{"id":"n185958647","loc":[-85.6375975,41.9314987]},"n185958649":{"id":"n185958649","loc":[-85.637669,41.931667]},"n185958651":{"id":"n185958651","loc":[-85.637728,41.931901]},"n185958653":{"id":"n185958653","loc":[-85.637724,41.932187]},"n185958656":{"id":"n185958656","loc":[-85.637732,41.932761]},"n185958658":{"id":"n185958658","loc":[-85.637688,41.93398]},"n185958660":{"id":"n185958660","loc":[-85.637685,41.934223]},"n185958662":{"id":"n185958662","loc":[-85.6376468,41.9350232]},"n185958664":{"id":"n185958664","loc":[-85.637564,41.937028]},"n185958666":{"id":"n185958666","loc":[-85.637458,41.938197]},"n185958668":{"id":"n185958668","loc":[-85.637424,41.938692]},"n185964972":{"id":"n185964972","loc":[-85.6341901,41.9432732]},"n185971361":{"id":"n185971361","loc":[-85.635762,41.938208]},"n185971364":{"id":"n185971364","loc":[-85.635732,41.9384]},"n185971366":{"id":"n185971366","loc":[-85.635736,41.938697]},"n185972775":{"id":"n185972775","loc":[-85.635638,42.070357]},"n185972777":{"id":"n185972777","loc":[-85.635724,42.069929]},"n185972779":{"id":"n185972779","loc":[-85.635804,42.069248]},"n185972781":{"id":"n185972781","loc":[-85.635869,42.068361]},"n185972783":{"id":"n185972783","loc":[-85.635883,42.067582]},"n185972785":{"id":"n185972785","loc":[-85.635875,42.067114]},"n185972787":{"id":"n185972787","loc":[-85.635778,42.065359]},"n185972788":{"id":"n185972788","loc":[-85.635728,42.063416]},"n185972789":{"id":"n185972789","loc":[-85.635665,42.062491]},"n185972790":{"id":"n185972790","loc":[-85.635617,42.061928]},"n185972791":{"id":"n185972791","loc":[-85.635614,42.061898]},"n185972793":{"id":"n185972793","loc":[-85.635379,42.060288]},"n185972795":{"id":"n185972795","loc":[-85.635092,42.05799]},"n185972797":{"id":"n185972797","loc":[-85.634843,42.055781]},"n185972798":{"id":"n185972798","loc":[-85.634817,42.055549]},"n185972800":{"id":"n185972800","loc":[-85.634708,42.053942]},"n185972802":{"id":"n185972802","loc":[-85.634447,42.051809]},"n185972805":{"id":"n185972805","loc":[-85.634241,42.04946]},"n185972807":{"id":"n185972807","loc":[-85.633787,42.045926]},"n185972809":{"id":"n185972809","loc":[-85.633811,42.045645]},"n185972811":{"id":"n185972811","loc":[-85.63373,42.043626]},"n185972813":{"id":"n185972813","loc":[-85.633698,42.042184]},"n185972814":{"id":"n185972814","loc":[-85.63369,42.04181]},"n185972815":{"id":"n185972815","loc":[-85.633681,42.040714]},"n185972816":{"id":"n185972816","loc":[-85.633571,42.036322]},"n185972817":{"id":"n185972817","loc":[-85.633537,42.034044]},"n185972819":{"id":"n185972819","loc":[-85.633481,42.030785]},"n185972821":{"id":"n185972821","loc":[-85.633452,42.027538]},"n185972824":{"id":"n185972824","loc":[-85.633438,42.027427]},"n185972826":{"id":"n185972826","loc":[-85.633342,42.022656]},"n185972830":{"id":"n185972830","loc":[-85.63327,42.020724]},"n185972832":{"id":"n185972832","loc":[-85.633198,42.019106]},"n185972834":{"id":"n185972834","loc":[-85.633249,42.018363]},"n185972835":{"id":"n185972835","loc":[-85.633139,42.012944]},"n185972836":{"id":"n185972836","loc":[-85.63309,42.008284]},"n185972839":{"id":"n185972839","loc":[-85.63298,42.00005]},"n185972845":{"id":"n185972845","loc":[-85.6325369,41.9764959]},"n185972847":{"id":"n185972847","loc":[-85.6327549,41.9750005]},"n185972849":{"id":"n185972849","loc":[-85.6329374,41.9742527]},"n185972851":{"id":"n185972851","loc":[-85.6331387,41.9736039]},"n185972862":{"id":"n185972862","loc":[-85.6383589,41.9585023]},"n185972868":{"id":"n185972868","loc":[-85.6393633,41.9551716]},"n185972878":{"id":"n185972878","loc":[-85.639377,41.95335]},"n185972882":{"id":"n185972882","loc":[-85.6389179,41.9516944]},"n185972885":{"id":"n185972885","loc":[-85.6387444,41.9512105]},"n185972891":{"id":"n185972891","loc":[-85.636421,41.946392]},"n185972895":{"id":"n185972895","loc":[-85.635965,41.945809]},"n185972897":{"id":"n185972897","loc":[-85.635683,41.945449]},"n185972899":{"id":"n185972899","loc":[-85.635281,41.9450252]},"n185972905":{"id":"n185972905","loc":[-85.6324428,41.9425743]},"n185985217":{"id":"n185985217","loc":[-85.638243,41.943674]},"n185985219":{"id":"n185985219","loc":[-85.638228,41.943747]},"n185985221":{"id":"n185985221","loc":[-85.638163,41.943797]},"n185985222":{"id":"n185985222","loc":[-85.638089,41.943832]},"n185985223":{"id":"n185985223","loc":[-85.637969,41.943841]},"n185985225":{"id":"n185985225","loc":[-85.637841,41.943833]},"n185985227":{"id":"n185985227","loc":[-85.637601,41.943789]},"n185985229":{"id":"n185985229","loc":[-85.637449,41.943754]},"n185985231":{"id":"n185985231","loc":[-85.637342,41.943734]},"n185985233":{"id":"n185985233","loc":[-85.637218,41.943703]},"n185985235":{"id":"n185985235","loc":[-85.637151,41.943663]},"n185985238":{"id":"n185985238","loc":[-85.637118,41.943615]},"n185985240":{"id":"n185985240","loc":[-85.637073,41.943494]},"n185990434":{"id":"n185990434","loc":[-85.6329028,41.9984292],"tags":{"railway":"level_crossing"}},"n1475284023":{"id":"n1475284023","loc":[-85.6336163,41.9435806],"tags":{"railway":"level_crossing"}},"n1475293222":{"id":"n1475293222","loc":[-85.6394045,41.953658],"tags":{"railway":"level_crossing"}},"n1475293226":{"id":"n1475293226","loc":[-85.6364975,41.9638663],"tags":{"railway":"level_crossing"}},"n1475293234":{"id":"n1475293234","loc":[-85.6390449,41.9565145]},"n1475293240":{"id":"n1475293240","loc":[-85.636943,41.9473114]},"n1475293252":{"id":"n1475293252","loc":[-85.6392115,41.9559003]},"n1475293254":{"id":"n1475293254","loc":[-85.6348931,41.9685127],"tags":{"railway":"level_crossing"}},"n1475293260":{"id":"n1475293260","loc":[-85.6375999,41.9485401]},"n1475293261":{"id":"n1475293261","loc":[-85.6391256,41.9523817],"tags":{"railway":"level_crossing"}},"n1475293264":{"id":"n1475293264","loc":[-85.6394155,41.9546493],"tags":{"railway":"level_crossing"}},"n1819805614":{"id":"n1819805614","loc":[-85.6345652,41.9363097]},"n1819805618":{"id":"n1819805618","loc":[-85.6295334,41.9426862]},"n1819805622":{"id":"n1819805622","loc":[-85.6308208,41.9430773]},"n1819805626":{"id":"n1819805626","loc":[-85.6274734,41.9406592]},"n1819805629":{"id":"n1819805629","loc":[-85.6296943,41.9430533]},"n1819805632":{"id":"n1819805632","loc":[-85.6340931,41.9354477]},"n1819805636":{"id":"n1819805636","loc":[-85.6304131,41.9436598]},"n1819805639":{"id":"n1819805639","loc":[-85.6304882,41.9426623]},"n1819805641":{"id":"n1819805641","loc":[-85.6336103,41.9367487]},"n1819805643":{"id":"n1819805643","loc":[-85.6300376,41.9418084]},"n1819805645":{"id":"n1819805645","loc":[-85.6365286,41.9336679]},"n1819805647":{"id":"n1819805647","loc":[-85.632016,41.9429221]},"n1819805666":{"id":"n1819805666","loc":[-85.6314753,41.9442663]},"n1819805669":{"id":"n1819805669","loc":[-85.6268619,41.9402203]},"n1819805673":{"id":"n1819805673","loc":[-85.6296728,41.9412099]},"n1819805676":{"id":"n1819805676","loc":[-85.6354557,41.932766]},"n1819805680":{"id":"n1819805680","loc":[-85.632752,41.9431012]},"n1819805683":{"id":"n1819805683","loc":[-85.631147,41.9432014]},"n1819805687":{"id":"n1819805687","loc":[-85.635284,41.9343942]},"n1819805690":{"id":"n1819805690","loc":[-85.6249736,41.9405794]},"n1819805694":{"id":"n1819805694","loc":[-85.6294153,41.9417925]},"n1819805698":{"id":"n1819805698","loc":[-85.6323486,41.9426986]},"n1819805702":{"id":"n1819805702","loc":[-85.6340287,41.9373871]},"n1819805707":{"id":"n1819805707","loc":[-85.6353698,41.9316326]},"n1819805711":{"id":"n1819805711","loc":[-85.6284176,41.940356]},"n1819805715":{"id":"n1819805715","loc":[-85.6291471,41.9412897]},"n1819805718":{"id":"n1819805718","loc":[-85.6311105,41.943979]},"n1819805722":{"id":"n1819805722","loc":[-85.6320868,41.9400128]},"n1819805724":{"id":"n1819805724","loc":[-85.635166,41.9324627]},"n1819805727":{"id":"n1819805727","loc":[-85.6344686,41.9350567]},"n1819805728":{"id":"n1819805728","loc":[-85.6357132,41.9332369]},"n1819805731":{"id":"n1819805731","loc":[-85.629984,41.9434444]},"n1819805760":{"id":"n1819805760","loc":[-85.6330996,41.9378784]},"n1819805766":{"id":"n1819805766","loc":[-85.625274,41.9411141]},"n1819805770":{"id":"n1819805770","loc":[-85.6326321,41.9412173]},"n1819805774":{"id":"n1819805774","loc":[-85.6347047,41.9312096]},"n1819805777":{"id":"n1819805777","loc":[-85.6363569,41.9339552]},"n1819805780":{"id":"n1819805780","loc":[-85.6327392,41.941926]},"n1819805783":{"id":"n1819805783","loc":[-85.6357239,41.9338435]},"n1819805786":{"id":"n1819805786","loc":[-85.6356595,41.9346576]},"n1819805789":{"id":"n1819805789","loc":[-85.6316469,41.9436598]},"n1819805792":{"id":"n1819805792","loc":[-85.6350587,41.9354557]},"n1819805795":{"id":"n1819805795","loc":[-85.6360028,41.9322791]},"n1819805798":{"id":"n1819805798","loc":[-85.63125,41.9443062]},"n1819805802":{"id":"n1819805802","loc":[-85.6263362,41.9408109]},"n1819805805":{"id":"n1819805805","loc":[-85.6315075,41.9438753]},"n1819805808":{"id":"n1819805808","loc":[-85.6340008,41.9316051]},"n1819805810":{"id":"n1819805810","loc":[-85.6345545,41.9320557]},"n1819805812":{"id":"n1819805812","loc":[-85.6250809,41.9408587]},"n1819805814":{"id":"n1819805814","loc":[-85.6257783,41.9400926]},"n1819805834":{"id":"n1819805834","loc":[-85.6326408,41.9424363]},"n1819805838":{"id":"n1819805838","loc":[-85.6365607,41.9334365]},"n1819805842":{"id":"n1819805842","loc":[-85.6288253,41.9410343]},"n1819805846":{"id":"n1819805846","loc":[-85.6279133,41.9402921]},"n1819805849":{"id":"n1819805849","loc":[-85.6289433,41.9405156]},"n1819805852":{"id":"n1819805852","loc":[-85.6313787,41.9439152]},"n1819805858":{"id":"n1819805858","loc":[-85.6300805,41.9420398]},"n1819805861":{"id":"n1819805861","loc":[-85.6321941,41.9396297]},"n1819805864":{"id":"n1819805864","loc":[-85.6329129,41.9393903]},"n1819805868":{"id":"n1819805868","loc":[-85.632001,41.9434922]},"n1819805870":{"id":"n1819805870","loc":[-85.6314903,41.9431535]},"n1819805873":{"id":"n1819805873","loc":[-85.6251667,41.9401166]},"n1819805876":{"id":"n1819805876","loc":[-85.63287,41.939941]},"n1819805878":{"id":"n1819805878","loc":[-85.6307886,41.9437317]},"n1819805880":{"id":"n1819805880","loc":[-85.6321727,41.940348]},"n1819805883":{"id":"n1819805883","loc":[-85.6265872,41.940113]},"n1819805885":{"id":"n1819805885","loc":[-85.6268404,41.9406672]},"n1819805887":{"id":"n1819805887","loc":[-85.6325267,41.9389035]},"n1819805889":{"id":"n1819805889","loc":[-85.6364964,41.933189]},"n1819805911":{"id":"n1819805911","loc":[-85.6248663,41.9401804]},"n1819805922":{"id":"n1819805922","loc":[-85.633267,41.9387199]},"n1819805925":{"id":"n1819805925","loc":[-85.6293402,41.9408428]},"n1819848849":{"id":"n1819848849","loc":[-85.6464957,41.9695178]},"n1819848850":{"id":"n1819848850","loc":[-85.6497642,41.9611355]},"n1819848851":{"id":"n1819848851","loc":[-85.6480943,41.9624818]},"n1819848854":{"id":"n1819848854","loc":[-85.6500362,41.9657367]},"n1819848855":{"id":"n1819848855","loc":[-85.6493673,41.9783496]},"n1819848856":{"id":"n1819848856","loc":[-85.6457409,41.9548007]},"n1819848857":{"id":"n1819848857","loc":[-85.651313,41.9760426]},"n1819848858":{"id":"n1819848858","loc":[-85.6495819,41.9784772]},"n1819848859":{"id":"n1819848859","loc":[-85.6495105,41.9833722]},"n1819848860":{"id":"n1819848860","loc":[-85.6405053,41.9492792]},"n1819848863":{"id":"n1819848863","loc":[-85.6502293,41.9786826]},"n1819848865":{"id":"n1819848865","loc":[-85.6406877,41.9495106]},"n1819848870":{"id":"n1819848870","loc":[-85.6493136,41.9704611]},"n1819848871":{"id":"n1819848871","loc":[-85.6372249,41.9441284]},"n1819848873":{"id":"n1819848873","loc":[-85.6512379,41.9659441]},"n1819848875":{"id":"n1819848875","loc":[-85.6508087,41.9650187]},"n1819848877":{"id":"n1819848877","loc":[-85.6487166,41.9605352]},"n1819848878":{"id":"n1819848878","loc":[-85.6506478,41.9760665]},"n1819848879":{"id":"n1819848879","loc":[-85.651431,41.9758512]},"n1819848886":{"id":"n1819848886","loc":[-85.6477617,41.9563945]},"n1819848889":{"id":"n1819848889","loc":[-85.6497895,41.9832286]},"n1819848892":{"id":"n1819848892","loc":[-85.6504868,41.9791931]},"n1819848893":{"id":"n1819848893","loc":[-85.6498002,41.9615085]},"n1819848894":{"id":"n1819848894","loc":[-85.6404302,41.9502846]},"n1819848901":{"id":"n1819848901","loc":[-85.6354412,41.9439886]},"n1819848903":{"id":"n1819848903","loc":[-85.6472145,41.9698528]},"n1819848904":{"id":"n1819848904","loc":[-85.6401979,41.9486233]},"n1819848905":{"id":"n1819848905","loc":[-85.6475042,41.963503]},"n1819848909":{"id":"n1819848909","loc":[-85.6343405,41.94358]},"n1819848914":{"id":"n1819848914","loc":[-85.6503474,41.9737773]},"n1819848915":{"id":"n1819848915","loc":[-85.6389533,41.9470992]},"n1819848916":{"id":"n1819848916","loc":[-85.6483625,41.9577907]},"n1819848917":{"id":"n1819848917","loc":[-85.6484768,41.9617419]},"n1819848918":{"id":"n1819848918","loc":[-85.644078,41.9545693]},"n1819848919":{"id":"n1819848919","loc":[-85.6437169,41.9543041]},"n1819848920":{"id":"n1819848920","loc":[-85.6478331,41.9627949]},"n1819848922":{"id":"n1819848922","loc":[-85.6499144,41.9785889]},"n1819848924":{"id":"n1819848924","loc":[-85.647633,41.9720066]},"n1819848926":{"id":"n1819848926","loc":[-85.6487987,41.978868]},"n1819848927":{"id":"n1819848927","loc":[-85.6495105,41.9730355]},"n1819848928":{"id":"n1819848928","loc":[-85.648223,41.9829654]},"n1819848929":{"id":"n1819848929","loc":[-85.6514846,41.9659122]},"n1819848931":{"id":"n1819848931","loc":[-85.6498753,41.9731871]},"n1819848932":{"id":"n1819848932","loc":[-85.640906,41.9508575]},"n1819848933":{"id":"n1819848933","loc":[-85.649775,41.9799767]},"n1819848934":{"id":"n1819848934","loc":[-85.6507014,41.9739927]},"n1819848937":{"id":"n1819848937","loc":[-85.6479763,41.9840899]},"n1819848938":{"id":"n1819848938","loc":[-85.6501113,41.9600884]},"n1819848939":{"id":"n1819848939","loc":[-85.6389962,41.9478253]},"n1819848941":{"id":"n1819848941","loc":[-85.637469,41.9445791]},"n1819848942":{"id":"n1819848942","loc":[-85.6494569,41.9601682]},"n1819848943":{"id":"n1819848943","loc":[-85.6368803,41.9439351]},"n1819848945":{"id":"n1819848945","loc":[-85.6474398,41.9724213]},"n1819848946":{"id":"n1819848946","loc":[-85.6382629,41.9463666]},"n1819848948":{"id":"n1819848948","loc":[-85.6489633,41.9830771]},"n1819848952":{"id":"n1819848952","loc":[-85.6488882,41.9600326]},"n1819848953":{"id":"n1819848953","loc":[-85.6488094,41.9774324]},"n1819848954":{"id":"n1819848954","loc":[-85.6491135,41.9600485]},"n1819848955":{"id":"n1819848955","loc":[-85.6501435,41.9734583]},"n1819848956":{"id":"n1819848956","loc":[-85.6495534,41.960958]},"n1819848958":{"id":"n1819848958","loc":[-85.6474683,41.9561491]},"n1819848959":{"id":"n1819848959","loc":[-85.6401083,41.9485451]},"n1819848960":{"id":"n1819848960","loc":[-85.6481764,41.9678686]},"n1819848961":{"id":"n1819848961","loc":[-85.6484017,41.967382]},"n1819848962":{"id":"n1819848962","loc":[-85.6501328,41.959897]},"n1819848964":{"id":"n1819848964","loc":[-85.6403695,41.9504586]},"n1819848966":{"id":"n1819848966","loc":[-85.6398975,41.9491499]},"n1819848967":{"id":"n1819848967","loc":[-85.6412455,41.9510187]},"n1819848968":{"id":"n1819848968","loc":[-85.6482622,41.9619493]},"n1819848969":{"id":"n1819848969","loc":[-85.6405841,41.9501474]},"n1819848970":{"id":"n1819848970","loc":[-85.6478583,41.9703394]},"n1819848971":{"id":"n1819848971","loc":[-85.6493388,41.9832845]},"n1819848972":{"id":"n1819848972","loc":[-85.6485664,41.9829415]},"n1819848974":{"id":"n1819848974","loc":[-85.6491457,41.9779887]},"n1819848975":{"id":"n1819848975","loc":[-85.6468889,41.9697033]},"n1819848976":{"id":"n1819848976","loc":[-85.6452726,41.9546072]},"n1819848977":{"id":"n1819848977","loc":[-85.6448435,41.9546072]},"n1819848979":{"id":"n1819848979","loc":[-85.6485342,41.9763138]},"n1819848980":{"id":"n1819848980","loc":[-85.6495282,41.9664087]},"n1819848986":{"id":"n1819848986","loc":[-85.6486307,41.9603278]},"n1819848987":{"id":"n1819848987","loc":[-85.6492278,41.9791871]},"n1819848990":{"id":"n1819848990","loc":[-85.6501934,41.9800724]},"n1819848992":{"id":"n1819848992","loc":[-85.6482445,41.9819685]},"n1819848993":{"id":"n1819848993","loc":[-85.6481871,41.9704451]},"n1819848994":{"id":"n1819848994","loc":[-85.6371364,41.9457602]},"n1819848996":{"id":"n1819848996","loc":[-85.6500362,41.9801023]},"n1819849000":{"id":"n1819849000","loc":[-85.639007,41.9485914]},"n1819849001":{"id":"n1819849001","loc":[-85.6488882,41.9669253]},"n1819849002":{"id":"n1819849002","loc":[-85.6484698,41.9565062]},"n1819849004":{"id":"n1819849004","loc":[-85.6510769,41.9761064]},"n1819849005":{"id":"n1819849005","loc":[-85.6503581,41.9799029]},"n1819849006":{"id":"n1819849006","loc":[-85.6489381,41.9703893]},"n1819849008":{"id":"n1819849008","loc":[-85.6497457,41.9833588]},"n1819849011":{"id":"n1819849011","loc":[-85.6497358,41.9717593]},"n1819849012":{"id":"n1819849012","loc":[-85.6494676,41.9796796]},"n1819849019":{"id":"n1819849019","loc":[-85.6486093,41.9771034]},"n1819849021":{"id":"n1819849021","loc":[-85.6504546,41.9796556]},"n1819849022":{"id":"n1819849022","loc":[-85.6371294,41.9454154]},"n1819849023":{"id":"n1819849023","loc":[-85.6503436,41.9759249]},"n1819849025":{"id":"n1819849025","loc":[-85.6462382,41.9693822]},"n1819849026":{"id":"n1819849026","loc":[-85.6497573,41.983093]},"n1819849028":{"id":"n1819849028","loc":[-85.6497465,41.9602799]},"n1819849029":{"id":"n1819849029","loc":[-85.6374728,41.9460698]},"n1819849030":{"id":"n1819849030","loc":[-85.6486592,41.9566039]},"n1819849031":{"id":"n1819849031","loc":[-85.6515989,41.9654993]},"n1819849032":{"id":"n1819849032","loc":[-85.6387028,41.9482658]},"n1819849033":{"id":"n1819849033","loc":[-85.6464742,41.9688398]},"n1819849034":{"id":"n1819849034","loc":[-85.6495212,41.9589236]},"n1819849035":{"id":"n1819849035","loc":[-85.6490599,41.9790096]},"n1819849036":{"id":"n1819849036","loc":[-85.6489918,41.9800724]},"n1819849038":{"id":"n1819849038","loc":[-85.6499182,41.9659042]},"n1819849040":{"id":"n1819849040","loc":[-85.639758,41.9490143]},"n1819849041":{"id":"n1819849041","loc":[-85.6514846,41.9755241]},"n1819849042":{"id":"n1819849042","loc":[-85.6436633,41.9540647]},"n1819849045":{"id":"n1819849045","loc":[-85.6475541,41.9726387]},"n1819849046":{"id":"n1819849046","loc":[-85.6488308,41.9718331]},"n1819849047":{"id":"n1819849047","loc":[-85.6377694,41.9460953]},"n1819849048":{"id":"n1819849048","loc":[-85.6490706,41.9804452]},"n1819849049":{"id":"n1819849049","loc":[-85.6485449,41.9766248]},"n1819849051":{"id":"n1819849051","loc":[-85.6483625,41.9790256]},"n1819849052":{"id":"n1819849052","loc":[-85.6490706,41.9585167]},"n1819849053":{"id":"n1819849053","loc":[-85.6425008,41.9522874]},"n1819849054":{"id":"n1819849054","loc":[-85.6475793,41.9632158]},"n1819849055":{"id":"n1819849055","loc":[-85.6408631,41.9499399]},"n1819849056":{"id":"n1819849056","loc":[-85.6483373,41.9814681]},"n1819849057":{"id":"n1819849057","loc":[-85.6313548,41.9442876]},"n1819849058":{"id":"n1819849058","loc":[-85.6432663,41.9529796]},"n1819849059":{"id":"n1819849059","loc":[-85.6487128,41.9582873]},"n1819849060":{"id":"n1819849060","loc":[-85.6482338,41.9817612]},"n1819849062":{"id":"n1819849062","loc":[-85.6485664,41.9788661]},"n1819849063":{"id":"n1819849063","loc":[-85.6373081,41.9448824]},"n1819849064":{"id":"n1819849064","loc":[-85.6472215,41.9557582]},"n1819849065":{"id":"n1819849065","loc":[-85.6348984,41.9440414]},"n1819849066":{"id":"n1819849066","loc":[-85.6501972,41.9647315]},"n1819849067":{"id":"n1819849067","loc":[-85.6489741,41.9808281]},"n1819849068":{"id":"n1819849068","loc":[-85.6420111,41.9515034]},"n1819849069":{"id":"n1819849069","loc":[-85.6397972,41.9488882]},"n1819849070":{"id":"n1819849070","loc":[-85.6499718,41.9593465]},"n1819849071":{"id":"n1819849071","loc":[-85.6486844,41.9811311]},"n1819849072":{"id":"n1819849072","loc":[-85.6390392,41.9474663]},"n1819849074":{"id":"n1819849074","loc":[-85.6495642,41.9616362]},"n1819849075":{"id":"n1819849075","loc":[-85.6483518,41.9791931]},"n1819849076":{"id":"n1819849076","loc":[-85.6478974,41.9833104]},"n1819849077":{"id":"n1819849077","loc":[-85.640155,41.948719]},"n1819849078":{"id":"n1819849078","loc":[-85.6399366,41.9487845]},"n1819849079":{"id":"n1819849079","loc":[-85.6492959,41.9825348]},"n1819849080":{"id":"n1819849080","loc":[-85.6505083,41.9648352]},"n1819849081":{"id":"n1819849081","loc":[-85.6492959,41.9645241]},"n1819849082":{"id":"n1819849082","loc":[-85.6402049,41.9491835]},"n1819849083":{"id":"n1819849083","loc":[-85.6495175,41.9826963]},"n1819849084":{"id":"n1819849084","loc":[-85.6480836,41.9728361]},"n1819849085":{"id":"n1819849085","loc":[-85.6374349,41.9443425]},"n1819849086":{"id":"n1819849086","loc":[-85.6478331,41.9681238]},"n1819849089":{"id":"n1819849089","loc":[-85.639368,41.9486169]},"n1819849092":{"id":"n1819849092","loc":[-85.6503581,41.9788022]},"n1819849093":{"id":"n1819849093","loc":[-85.64862,41.9568014]},"n1819849094":{"id":"n1819849094","loc":[-85.6496999,41.9828877]},"n1819849095":{"id":"n1819849095","loc":[-85.647472,41.972198]},"n1819849096":{"id":"n1819849096","loc":[-85.6485771,41.9644523]},"n1819849097":{"id":"n1819849097","loc":[-85.6388353,41.9480488]},"n1819849099":{"id":"n1819849099","loc":[-85.6472752,41.9683312]},"n1819849104":{"id":"n1819849104","loc":[-85.6479548,41.9836035]},"n1819849105":{"id":"n1819849105","loc":[-85.6462489,41.9691668]},"n1819849107":{"id":"n1819849107","loc":[-85.6511912,41.9746328]},"n1819849108":{"id":"n1819849108","loc":[-85.6498646,41.9714881]},"n1819849111":{"id":"n1819849111","loc":[-85.6488239,41.961684]},"n1819849112":{"id":"n1819849112","loc":[-85.6469356,41.9553812]},"n1819849114":{"id":"n1819849114","loc":[-85.6479548,41.9640853]},"n1819849119":{"id":"n1819849119","loc":[-85.6491565,41.961692]},"n1819849121":{"id":"n1819849121","loc":[-85.651667,41.9656728]},"n1819849124":{"id":"n1819849124","loc":[-85.6388423,41.9484414]},"n1819849126":{"id":"n1819849126","loc":[-85.6371686,41.9450978]},"n1819849127":{"id":"n1819849127","loc":[-85.6502615,41.9656728]},"n1819849129":{"id":"n1819849129","loc":[-85.6498501,41.9613031]},"n1819849131":{"id":"n1819849131","loc":[-85.6513881,41.9653298]},"n1819849133":{"id":"n1819849133","loc":[-85.639883,41.9485291]},"n1819849139":{"id":"n1819849139","loc":[-85.6508693,41.9658264]},"n1819849140":{"id":"n1819849140","loc":[-85.6486806,41.9761642]},"n1819849141":{"id":"n1819849141","loc":[-85.6483159,41.9717613]},"n1819849144":{"id":"n1819849144","loc":[-85.6443714,41.9546232]},"n1819849146":{"id":"n1819849146","loc":[-85.641775,41.9513359]},"n1819849147":{"id":"n1819849147","loc":[-85.6495604,41.9757335]},"n1819849148":{"id":"n1819849148","loc":[-85.6465671,41.9551678]},"n1819849150":{"id":"n1819849150","loc":[-85.6485127,41.9794084]},"n1819849151":{"id":"n1819849151","loc":[-85.6499144,41.9757096]},"n1819849152":{"id":"n1819849152","loc":[-85.6433736,41.9531072]},"n1819849154":{"id":"n1819849154","loc":[-85.6489741,41.9607426]},"n1819849155":{"id":"n1819849155","loc":[-85.640627,41.9507697]},"n1819849156":{"id":"n1819849156","loc":[-85.6509659,41.9743058]},"n1819849157":{"id":"n1819849157","loc":[-85.6486844,41.9704431]},"n1819849158":{"id":"n1819849158","loc":[-85.6498538,41.9711132]},"n1819849159":{"id":"n1819849159","loc":[-85.6358937,41.943719]},"n1819849160":{"id":"n1819849160","loc":[-85.6497358,41.9707702]},"n1819849161":{"id":"n1819849161","loc":[-85.6480476,41.9564842]},"n1819849162":{"id":"n1819849162","loc":[-85.6482982,41.9574556]},"n1819849163":{"id":"n1819849163","loc":[-85.6501757,41.9757794]},"n1819849164":{"id":"n1819849164","loc":[-85.6372973,41.9459916]},"n1819849165":{"id":"n1819849165","loc":[-85.6513773,41.9750775]},"n1819849166":{"id":"n1819849166","loc":[-85.6436418,41.9537455]},"n1819849167":{"id":"n1819849167","loc":[-85.6483625,41.9571524]},"n1819849169":{"id":"n1819849169","loc":[-85.647751,41.9727962]},"n1819849170":{"id":"n1819849170","loc":[-85.6504546,41.9656808]},"n1819849171":{"id":"n1819849171","loc":[-85.6479977,41.971839]},"n1819849172":{"id":"n1819849172","loc":[-85.6482767,41.9642449]},"n1819849174":{"id":"n1819849174","loc":[-85.6414317,41.9512086]},"n1819849176":{"id":"n1819849176","loc":[-85.6469034,41.9685287]},"n1819849179":{"id":"n1819849179","loc":[-85.6408631,41.9497564]},"n1819849182":{"id":"n1819849182","loc":[-85.6476721,41.96384]},"n1819849183":{"id":"n1819849183","loc":[-85.6479725,41.983111]},"n1819849184":{"id":"n1819849184","loc":[-85.640788,41.9500516]},"n1819849185":{"id":"n1819849185","loc":[-85.6427798,41.9528778]},"n1819849186":{"id":"n1819849186","loc":[-85.6435308,41.9534124]},"n1819849187":{"id":"n1819849187","loc":[-85.6483733,41.9821998]},"n1819849189":{"id":"n1819849189","loc":[-85.6351752,41.9440796]},"n1819849191":{"id":"n1819849191","loc":[-85.6487021,41.9601463]},"n1819849192":{"id":"n1819849192","loc":[-85.6363811,41.9437605]},"n1819849193":{"id":"n1819849193","loc":[-85.6490883,41.9759728]},"n1819849194":{"id":"n1819849194","loc":[-85.6423292,41.9520081]},"n1819849195":{"id":"n1819849195","loc":[-85.6500003,41.960242]},"n1819849196":{"id":"n1819849196","loc":[-85.6385778,41.9466443]},"n1819849197":{"id":"n1819849197","loc":[-85.6494032,41.9718789]},"n1819849198":{"id":"n1819849198","loc":[-85.6404339,41.9506501]},"n1819849199":{"id":"n1819849199","loc":[-85.6426226,41.9527083]},"n1819849200":{"id":"n1819849200","loc":[-85.6439101,41.9545035]},"n1819849201":{"id":"n1819849201","loc":[-85.6516563,41.9657845]},"n1819849202":{"id":"n1819849202","loc":[-85.6473395,41.9699585]},"n1819858501":{"id":"n1819858501","loc":[-85.6361263,41.9437126]},"n1819858503":{"id":"n1819858503","loc":[-85.6350068,41.944034]},"n1819858513":{"id":"n1819858513","loc":[-85.6371402,41.9453282]},"n1819858518":{"id":"n1819858518","loc":[-85.6348713,41.9432923]},"n1819858523":{"id":"n1819858523","loc":[-85.6357047,41.943799]},"n1819858526":{"id":"n1819858526","loc":[-85.6349947,41.9435756]},"n1819858531":{"id":"n1819858531","loc":[-85.6350376,41.943827]},"n1820937508":{"id":"n1820937508","loc":[-85.1026013,42.0881722]},"n1820937509":{"id":"n1820937509","loc":[-85.0558088,42.102493]},"n1820937511":{"id":"n1820937511","loc":[-85.3030116,41.9724451]},"n1820937513":{"id":"n1820937513","loc":[-85.0353221,42.1027398]},"n1820937514":{"id":"n1820937514","loc":[-85.0835468,42.1015469]},"n1820937515":{"id":"n1820937515","loc":[-85.2421298,42.0106305]},"n1820937517":{"id":"n1820937517","loc":[-85.0090632,42.0910452]},"n1820937518":{"id":"n1820937518","loc":[-85.086626,42.0948838]},"n1820937520":{"id":"n1820937520","loc":[-85.2552039,42.0015448]},"n1820937521":{"id":"n1820937521","loc":[-85.3739614,41.9969917]},"n1820937522":{"id":"n1820937522","loc":[-85.4831166,41.993898]},"n1820937523":{"id":"n1820937523","loc":[-85.0341084,42.0977657]},"n1820937524":{"id":"n1820937524","loc":[-85.3272802,41.9710333]},"n1820937525":{"id":"n1820937525","loc":[-85.2125568,42.0414521]},"n1820937526":{"id":"n1820937526","loc":[-85.3798022,41.9992458]},"n1820937527":{"id":"n1820937527","loc":[-85.2652021,41.999768]},"n1820937528":{"id":"n1820937528","loc":[-85.3852739,42.0004896]},"n1820937529":{"id":"n1820937529","loc":[-85.3911919,42.0030513]},"n1820937530":{"id":"n1820937530","loc":[-85.5440349,41.9717109]},"n1820937531":{"id":"n1820937531","loc":[-85.2790155,41.9911764]},"n1820937532":{"id":"n1820937532","loc":[-85.4723277,41.9950518]},"n1820937533":{"id":"n1820937533","loc":[-85.5690546,41.9653931]},"n1820937535":{"id":"n1820937535","loc":[-85.5674882,41.9649623]},"n1820937536":{"id":"n1820937536","loc":[-85.6362815,41.9189165]},"n1820937537":{"id":"n1820937537","loc":[-85.5659003,41.963638]},"n1820937539":{"id":"n1820937539","loc":[-85.6391353,41.9122262]},"n1820937540":{"id":"n1820937540","loc":[-85.4834385,41.9894803]},"n1820937541":{"id":"n1820937541","loc":[-85.6399078,41.9160744]},"n1820937542":{"id":"n1820937542","loc":[-85.632874,41.941031]},"n1820937543":{"id":"n1820937543","loc":[-85.1307591,42.0726961]},"n1820937544":{"id":"n1820937544","loc":[-85.6444397,41.9128378]},"n1820937545":{"id":"n1820937545","loc":[-85.6197204,41.9420365]},"n1820937546":{"id":"n1820937546","loc":[-85.1164857,42.0864631]},"n1820937547":{"id":"n1820937547","loc":[-85.6476111,41.9142222]},"n1820937548":{"id":"n1820937548","loc":[-85.2915747,41.9774223]},"n1820937549":{"id":"n1820937549","loc":[-85.6430192,41.9102461]},"n1820937550":{"id":"n1820937550","loc":[-85.1597495,42.0639017]},"n1820937551":{"id":"n1820937551","loc":[-85.5504079,41.9701793]},"n1820937553":{"id":"n1820937553","loc":[-85.2781317,41.9948951]},"n1820937555":{"id":"n1820937555","loc":[-85.3724594,41.997518]},"n1820937556":{"id":"n1820937556","loc":[-85.5629434,41.9665155]},"n1820937557":{"id":"n1820937557","loc":[-85.3791971,41.9990808]},"n1820937558":{"id":"n1820937558","loc":[-85.001891,42.0878843]},"n1820937560":{"id":"n1820937560","loc":[-85.3140838,41.9709056]},"n1820937561":{"id":"n1820937561","loc":[-85.2468032,42.0146987]},"n1820937563":{"id":"n1820937563","loc":[-85.0877378,42.097255]},"n1820937564":{"id":"n1820937564","loc":[-85.2442498,42.0150654]},"n1820937566":{"id":"n1820937566","loc":[-85.3108973,41.9701478]},"n1820937568":{"id":"n1820937568","loc":[-85.0344584,42.1016572]},"n1820937569":{"id":"n1820937569","loc":[-85.2331025,42.0297387]},"n1820937570":{"id":"n1820937570","loc":[-85.5058446,41.9746996]},"n1820937571":{"id":"n1820937571","loc":[-85.5622739,41.9676427]},"n1820937572":{"id":"n1820937572","loc":[-85.2792687,41.9890337]},"n1820937574":{"id":"n1820937574","loc":[-84.9909302,42.08695]},"n1820937575":{"id":"n1820937575","loc":[-85.6218233,41.9418609]},"n1820937576":{"id":"n1820937576","loc":[-85.3577437,41.9931062]},"n1820937577":{"id":"n1820937577","loc":[-85.639028,41.9165853]},"n1820937578":{"id":"n1820937578","loc":[-84.9956576,42.0865348]},"n1820937579":{"id":"n1820937579","loc":[-85.4828376,41.990198]},"n1820937580":{"id":"n1820937580","loc":[-85.3244478,41.9720543]},"n1820937582":{"id":"n1820937582","loc":[-85.0517479,42.1035159]},"n1820937583":{"id":"n1820937583","loc":[-85.225646,42.0338025]},"n1820937584":{"id":"n1820937584","loc":[-84.9941019,42.0862163]},"n1820937586":{"id":"n1820937586","loc":[-85.1051762,42.0879452]},"n1820937587":{"id":"n1820937587","loc":[-85.1245203,42.0753162]},"n1820937588":{"id":"n1820937588","loc":[-85.3250808,41.9719506]},"n1820937589":{"id":"n1820937589","loc":[-85.2720109,41.997933]},"n1820937590":{"id":"n1820937590","loc":[-85.2556653,42.0027248]},"n1820937591":{"id":"n1820937591","loc":[-85.0872483,42.0943544]},"n1820937592":{"id":"n1820937592","loc":[-85.2778353,41.9955023]},"n1820937593":{"id":"n1820937593","loc":[-85.2984733,41.9735538]},"n1820937594":{"id":"n1820937594","loc":[-85.101578,42.0889552]},"n1820937595":{"id":"n1820937595","loc":[-85.3888745,42.0016959]},"n1820937596":{"id":"n1820937596","loc":[-84.9903508,42.0870654]},"n1820937597":{"id":"n1820937597","loc":[-85.6405558,41.9146261]},"n1820937598":{"id":"n1820937598","loc":[-85.6460704,41.9141311]},"n1820937599":{"id":"n1820937599","loc":[-85.0377468,42.1037428]},"n1820937600":{"id":"n1820937600","loc":[-85.2298345,42.0312899]},"n1820937601":{"id":"n1820937601","loc":[-85.1080958,42.0861964]},"n1820937602":{"id":"n1820937602","loc":[-85.6325307,41.9402329]},"n1820937603":{"id":"n1820937603","loc":[-85.1165984,42.0832184]},"n1820937604":{"id":"n1820937604","loc":[-85.6354446,41.9190602]},"n1820937605":{"id":"n1820937605","loc":[-85.1114592,42.0862959]},"n1820937606":{"id":"n1820937606","loc":[-85.0858763,42.1001646]},"n1820937607":{"id":"n1820937607","loc":[-85.0472083,42.1015151]},"n1820937608":{"id":"n1820937608","loc":[-85.0802477,42.1027609]},"n1820937610":{"id":"n1820937610","loc":[-85.0924585,42.0928564]},"n1820937611":{"id":"n1820937611","loc":[-85.0329617,42.09827]},"n1820937612":{"id":"n1820937612","loc":[-85.2814617,41.993465]},"n1820937613":{"id":"n1820937613","loc":[-85.3097708,41.9700282]},"n1820937614":{"id":"n1820937614","loc":[-85.2809427,41.993695]},"n1820937615":{"id":"n1820937615","loc":[-85.0583233,42.1026494]},"n1820937617":{"id":"n1820937617","loc":[-85.2801592,41.9840021]},"n1820937619":{"id":"n1820937619","loc":[-85.1064154,42.0863449]},"n1820937620":{"id":"n1820937620","loc":[-85.0423173,42.1014662]},"n1820937621":{"id":"n1820937621","loc":[-85.2168913,42.0398107]},"n1820937622":{"id":"n1820937622","loc":[-85.2798481,41.9833401]},"n1820937623":{"id":"n1820937623","loc":[-85.0575468,42.1028672]},"n1820937625":{"id":"n1820937625","loc":[-85.0130369,42.0893067]},"n1820937626":{"id":"n1820937626","loc":[-85.0346985,42.1018256]},"n1820937627":{"id":"n1820937627","loc":[-85.2231569,42.0372768]},"n1820937628":{"id":"n1820937628","loc":[-85.2956195,41.9732268]},"n1820937629":{"id":"n1820937629","loc":[-85.1052312,42.086893]},"n1820937630":{"id":"n1820937630","loc":[-85.4813356,41.9958436]},"n1820937631":{"id":"n1820937631","loc":[-85.0961599,42.0914672]},"n1820937632":{"id":"n1820937632","loc":[-85.308419,41.9704749]},"n1820937633":{"id":"n1820937633","loc":[-85.295952,41.9715119]},"n1820937634":{"id":"n1820937634","loc":[-85.3310933,41.9703923]},"n1820937635":{"id":"n1820937635","loc":[-85.2940745,41.9739686]},"n1820937636":{"id":"n1820937636","loc":[-85.3803343,42.000484]},"n1820937637":{"id":"n1820937637","loc":[-85.1174231,42.0845533]},"n1820937638":{"id":"n1820937638","loc":[-85.0095836,42.089839]},"n1820937639":{"id":"n1820937639","loc":[-85.3179354,41.9705866]},"n1820937640":{"id":"n1820937640","loc":[-85.257708,42.0001189]},"n1820937641":{"id":"n1820937641","loc":[-85.2563522,42.0002771]},"n1820937642":{"id":"n1820937642","loc":[-85.3181929,41.970419]},"n1820937643":{"id":"n1820937643","loc":[-85.2911884,41.9757154]},"n1820937644":{"id":"n1820937644","loc":[-85.2714423,41.9975862]},"n1820937645":{"id":"n1820937645","loc":[-85.0193669,42.089888]},"n1820937646":{"id":"n1820937646","loc":[-85.3889818,42.0039921]},"n1820937647":{"id":"n1820937647","loc":[-85.3408093,41.9853965]},"n1820937648":{"id":"n1820937648","loc":[-85.1258091,42.0748332]},"n1820937649":{"id":"n1820937649","loc":[-85.5722561,41.962782]},"n1820937650":{"id":"n1820937650","loc":[-85.3266902,41.9721819]},"n1820937651":{"id":"n1820937651","loc":[-85.1473255,42.065192]},"n1820937652":{"id":"n1820937652","loc":[-85.1462526,42.0655106]},"n1820937653":{"id":"n1820937653","loc":[-85.4641051,42.0013929]},"n1820937654":{"id":"n1820937654","loc":[-85.5620379,41.9700677]},"n1820937655":{"id":"n1820937655","loc":[-85.3226025,41.971121]},"n1820937656":{"id":"n1820937656","loc":[-85.0200965,42.0899516]},"n1820937657":{"id":"n1820937657","loc":[-85.0624714,42.1044711]},"n1820937658":{"id":"n1820937658","loc":[-85.5649562,41.9637178]},"n1820937659":{"id":"n1820937659","loc":[-85.2360315,42.0253315]},"n1820937660":{"id":"n1820937660","loc":[-85.3881449,41.9994475]},"n1820937661":{"id":"n1820937661","loc":[-85.5032911,41.976263]},"n1820937662":{"id":"n1820937662","loc":[-85.481297,41.9871414]},"n1820937663":{"id":"n1820937663","loc":[-85.1167056,42.0841898]},"n1820937664":{"id":"n1820937664","loc":[-85.2891714,41.9787223]},"n1820937665":{"id":"n1820937665","loc":[-85.4393429,42.0058736]},"n1820937666":{"id":"n1820937666","loc":[-85.0077007,42.0895762]},"n1820937667":{"id":"n1820937667","loc":[-85.2736202,41.9979171]},"n1820937668":{"id":"n1820937668","loc":[-84.9935332,42.0859296]},"n1820937669":{"id":"n1820937669","loc":[-85.0622769,42.1046713]},"n1820937670":{"id":"n1820937670","loc":[-85.2309031,42.0311249]},"n1820937671":{"id":"n1820937671","loc":[-85.0343726,42.10069]},"n1820937672":{"id":"n1820937672","loc":[-85.0596551,42.1048612]},"n1820937673":{"id":"n1820937673","loc":[-85.1338597,42.0707449]},"n1820937674":{"id":"n1820937674","loc":[-85.3117663,41.9689194]},"n1820937675":{"id":"n1820937675","loc":[-85.0705649,42.1057499]},"n1820937676":{"id":"n1820937676","loc":[-85.2441425,42.0180944]},"n1820937677":{"id":"n1820937677","loc":[-85.1171174,42.0862692]},"n1820937678":{"id":"n1820937678","loc":[-85.0346824,42.1005519]},"n1820937680":{"id":"n1820937680","loc":[-85.2389927,42.0229245]},"n1820937681":{"id":"n1820937681","loc":[-85.0834892,42.1018642]},"n1820937682":{"id":"n1820937682","loc":[-85.0619443,42.1049459]},"n1820937683":{"id":"n1820937683","loc":[-85.2845366,41.9811868]},"n1820937684":{"id":"n1820937684","loc":[-85.210411,42.0394123]},"n1820937685":{"id":"n1820937685","loc":[-85.4377383,42.0055942]},"n1820937686":{"id":"n1820937686","loc":[-85.2882058,41.9789138]},"n1820937687":{"id":"n1820937687","loc":[-85.2741191,41.9955808]},"n1820937688":{"id":"n1820937688","loc":[-85.3442211,41.9903575]},"n1820937689":{"id":"n1820937689","loc":[-85.2641413,41.9995237]},"n1820937690":{"id":"n1820937690","loc":[-85.2804489,41.9829174]},"n1820937691":{"id":"n1820937691","loc":[-85.5593342,41.9729074]},"n1820937692":{"id":"n1820937692","loc":[-85.3590912,41.9932601]},"n1820937694":{"id":"n1820937694","loc":[-85.4826445,41.9957479]},"n1820937695":{"id":"n1820937695","loc":[-85.4539127,42.0063041]},"n1820937696":{"id":"n1820937696","loc":[-85.2456767,42.0153683]},"n1820937697":{"id":"n1820937697","loc":[-85.5794015,41.9489631]},"n1820937698":{"id":"n1820937698","loc":[-85.4108686,42.0078507]},"n1820937699":{"id":"n1820937699","loc":[-85.0616386,42.1051529]},"n1820937700":{"id":"n1820937700","loc":[-85.4977979,41.978241]},"n1820937701":{"id":"n1820937701","loc":[-85.2488417,42.0086319]},"n1820937702":{"id":"n1820937702","loc":[-85.5588836,41.9728116]},"n1820937703":{"id":"n1820937703","loc":[-85.4557366,42.0051241]},"n1820937705":{"id":"n1820937705","loc":[-85.0723151,42.1056094]},"n1820937706":{"id":"n1820937706","loc":[-85.0057909,42.0887323]},"n1820937707":{"id":"n1820937707","loc":[-85.0756786,42.105677]},"n1820937708":{"id":"n1820937708","loc":[-85.0901504,42.0940001]},"n1820937709":{"id":"n1820937709","loc":[-85.0979999,42.0910213]},"n1820937710":{"id":"n1820937710","loc":[-85.2376301,42.0239686]},"n1820937711":{"id":"n1820937711","loc":[-85.2780671,41.9902299]},"n1820937712":{"id":"n1820937712","loc":[-85.251481,42.0113188]},"n1820937713":{"id":"n1820937713","loc":[-85.3114767,41.9690311]},"n1820937714":{"id":"n1820937714","loc":[-85.2649621,41.9975662]},"n1820937715":{"id":"n1820937715","loc":[-85.283807,41.9813383]},"n1820937716":{"id":"n1820937716","loc":[-85.5515451,41.9703867]},"n1820937717":{"id":"n1820937717","loc":[-85.1176605,42.0850896]},"n1820937718":{"id":"n1820937718","loc":[-85.1069317,42.0862441]},"n1820937719":{"id":"n1820937719","loc":[-85.2739314,41.9976938]},"n1820937720":{"id":"n1820937720","loc":[-85.5550212,41.9702112]},"n1820937721":{"id":"n1820937721","loc":[-85.3076679,41.9719904]},"n1820937722":{"id":"n1820937722","loc":[-85.592319,41.9440316]},"n1820937723":{"id":"n1820937723","loc":[-85.3139979,41.9704031]},"n1820937724":{"id":"n1820937724","loc":[-85.0421134,42.1013149]},"n1820937725":{"id":"n1820937725","loc":[-85.2508373,42.0102741]},"n1820937726":{"id":"n1820937726","loc":[-85.0830922,42.1038821]},"n1820937727":{"id":"n1820937727","loc":[-85.6342473,41.9360031]},"n1820937730":{"id":"n1820937730","loc":[-85.0500192,42.1024942]},"n1820937731":{"id":"n1820937731","loc":[-85.3498644,41.9926221]},"n1820937732":{"id":"n1820937732","loc":[-85.0234117,42.0918903]},"n1820937733":{"id":"n1820937733","loc":[-85.0464425,42.1009408]},"n1820937734":{"id":"n1820937734","loc":[-85.033938,42.099886]},"n1820937736":{"id":"n1820937736","loc":[-85.0152752,42.0886009]},"n1820937737":{"id":"n1820937737","loc":[-85.0441894,42.1012671]},"n1820937738":{"id":"n1820937738","loc":[-85.4668731,41.9979804]},"n1820937739":{"id":"n1820937739","loc":[-85.4407377,42.006033]},"n1820937740":{"id":"n1820937740","loc":[-85.2262253,42.0344878]},"n1820937741":{"id":"n1820937741","loc":[-85.2550001,42.0033706]},"n1820937742":{"id":"n1820937742","loc":[-85.3071422,41.9722617]},"n1820937743":{"id":"n1820937743","loc":[-85.6147852,41.942228]},"n1820937744":{"id":"n1820937744","loc":[-85.0183853,42.0901825]},"n1820937745":{"id":"n1820937745","loc":[-85.6323161,41.9228489]},"n1820937746":{"id":"n1820937746","loc":[-85.0095568,42.0901376]},"n1820937747":{"id":"n1820937747","loc":[-85.2524037,42.0113826]},"n1820937748":{"id":"n1820937748","loc":[-85.3186864,41.9708578]},"n1820937749":{"id":"n1820937749","loc":[-85.2805669,41.9870883]},"n1820937750":{"id":"n1820937750","loc":[-85.0585768,42.1038144]},"n1820937751":{"id":"n1820937751","loc":[-85.2970786,41.9715358]},"n1820937752":{"id":"n1820937752","loc":[-85.1315758,42.0723445]},"n1820937753":{"id":"n1820937753","loc":[-85.2448291,42.0175444]},"n1820937754":{"id":"n1820937754","loc":[-85.2446468,42.0174248]},"n1820937755":{"id":"n1820937755","loc":[-85.229165,42.032129]},"n1820937756":{"id":"n1820937756","loc":[-85.5612654,41.9724926]},"n1820937757":{"id":"n1820937757","loc":[-85.2331776,42.030854]},"n1820937758":{"id":"n1820937758","loc":[-85.2271909,42.0334519]},"n1820937759":{"id":"n1820937759","loc":[-85.1032396,42.0879214]},"n1820937760":{"id":"n1820937760","loc":[-85.0638447,42.1044154]},"n1820937761":{"id":"n1820937761","loc":[-85.1260706,42.0745556]},"n1820937762":{"id":"n1820937762","loc":[-85.3454485,41.99132]},"n1820937763":{"id":"n1820937763","loc":[-85.2639321,41.9980088]},"n1820937764":{"id":"n1820937764","loc":[-85.0837681,42.1013746]},"n1820937765":{"id":"n1820937765","loc":[-85.2808137,41.9869368]},"n1820937766":{"id":"n1820937766","loc":[-85.6338997,41.9309373]},"n1820937767":{"id":"n1820937767","loc":[-85.2267403,42.0332766]},"n1820937768":{"id":"n1820937768","loc":[-85.0605831,42.1052074]},"n1820937769":{"id":"n1820937769","loc":[-85.0259021,42.0930037]},"n1820937770":{"id":"n1820937770","loc":[-85.232963,42.0313162]},"n1820937771":{"id":"n1820937771","loc":[-85.2404947,42.0125381]},"n1820937772":{"id":"n1820937772","loc":[-85.0910892,42.0935742]},"n1820937773":{"id":"n1820937773","loc":[-85.2554829,42.0019435]},"n1820937774":{"id":"n1820937774","loc":[-85.2799339,41.9867773]},"n1820937775":{"id":"n1820937775","loc":[-85.1075432,42.0852767]},"n1820937776":{"id":"n1820937776","loc":[-85.1176927,42.0854001]},"n1820937777":{"id":"n1820937777","loc":[-85.1067064,42.0863357]},"n1820937778":{"id":"n1820937778","loc":[-85.2517492,42.0106333]},"n1820937779":{"id":"n1820937779","loc":[-85.0987174,42.0909031]},"n1820937780":{"id":"n1820937780","loc":[-85.1160083,42.0863994]},"n1820937781":{"id":"n1820937781","loc":[-85.1268645,42.0739703]},"n1820937782":{"id":"n1820937782","loc":[-85.0454702,42.1002852]},"n1820937783":{"id":"n1820937783","loc":[-85.1334145,42.0705418]},"n1820937784":{"id":"n1820937784","loc":[-85.5866542,41.947431]},"n1820937786":{"id":"n1820937786","loc":[-85.2359886,42.0250366]},"n1820937787":{"id":"n1820937787","loc":[-85.3138048,41.9698527]},"n1820937788":{"id":"n1820937788","loc":[-85.1274291,42.0733081]},"n1820937790":{"id":"n1820937790","loc":[-85.6292905,41.9411267]},"n1820937791":{"id":"n1820937791","loc":[-85.5958809,41.9417333]},"n1820937792":{"id":"n1820937792","loc":[-85.1271019,42.0737581]},"n1820937793":{"id":"n1820937793","loc":[-85.2312679,42.0314437]},"n1820937794":{"id":"n1820937794","loc":[-85.1081387,42.0863516]},"n1820937795":{"id":"n1820937795","loc":[-85.2424473,42.0212109]},"n1820937796":{"id":"n1820937796","loc":[-85.2710654,41.9975236]},"n1820937797":{"id":"n1820937797","loc":[-85.4798408,41.9863223]},"n1820937798":{"id":"n1820937798","loc":[-85.035939,42.104296]},"n1820937799":{"id":"n1820937799","loc":[-85.2178139,42.0395398]},"n1820937800":{"id":"n1820937800","loc":[-85.0630709,42.1042614]},"n1820937801":{"id":"n1820937801","loc":[-85.0440124,42.1014861]},"n1820937802":{"id":"n1820937802","loc":[-85.1321874,42.0720458]},"n1820937804":{"id":"n1820937804","loc":[-85.079427,42.1029121]},"n1820937805":{"id":"n1820937805","loc":[-85.2962632,41.9738968]},"n1820937806":{"id":"n1820937806","loc":[-85.6334748,41.9274627]},"n1820937807":{"id":"n1820937807","loc":[-85.1057341,42.0872804]},"n1820937808":{"id":"n1820937808","loc":[-85.4960169,41.9778263]},"n1820937809":{"id":"n1820937809","loc":[-85.2821226,41.9910273]},"n1820937810":{"id":"n1820937810","loc":[-85.0013868,42.0885054]},"n1820937811":{"id":"n1820937811","loc":[-85.2952547,41.9729795]},"n1820937812":{"id":"n1820937812","loc":[-85.1298375,42.0667842]},"n1820937813":{"id":"n1820937813","loc":[-85.1339201,42.0710025]},"n1820937814":{"id":"n1820937814","loc":[-85.0374356,42.103691]},"n1820937815":{"id":"n1820937815","loc":[-85.0061115,42.0880607]},"n1820937817":{"id":"n1820937817","loc":[-85.2398402,42.0226934]},"n1820937818":{"id":"n1820937818","loc":[-85.123501,42.076236]},"n1820937819":{"id":"n1820937819","loc":[-85.1209489,42.0791294]},"n1820937820":{"id":"n1820937820","loc":[-85.0818624,42.1025778]},"n1820937821":{"id":"n1820937821","loc":[-85.4428835,42.0054749]},"n1820937822":{"id":"n1820937822","loc":[-85.4710359,41.9961147]},"n1820937823":{"id":"n1820937823","loc":[-85.4253354,42.006198]},"n1820937824":{"id":"n1820937824","loc":[-85.5486483,41.9709451]},"n1820937825":{"id":"n1820937825","loc":[-85.2303238,42.0310452]},"n1820937826":{"id":"n1820937826","loc":[-85.6450405,41.9136361]},"n1820937828":{"id":"n1820937828","loc":[-85.2606853,41.9964073]},"n1820937830":{"id":"n1820937830","loc":[-85.097383,42.0911447]},"n1820937831":{"id":"n1820937831","loc":[-85.0498207,42.102136]},"n1820937832":{"id":"n1820937832","loc":[-85.1232435,42.0763793]},"n1820937833":{"id":"n1820937833","loc":[-85.394093,42.0055921]},"n1820937834":{"id":"n1820937834","loc":[-85.3566665,41.9928295]},"n1820937835":{"id":"n1820937835","loc":[-85.3543276,41.9920002]},"n1820937837":{"id":"n1820937837","loc":[-85.084668,42.1034932]},"n1820937838":{"id":"n1820937838","loc":[-85.4400296,42.0060649]},"n1820937839":{"id":"n1820937839","loc":[-85.2362246,42.025714]},"n1820937840":{"id":"n1820937840","loc":[-85.0409225,42.1012791]},"n1820937841":{"id":"n1820937841","loc":[-85.2442283,42.019832]},"n1820937842":{"id":"n1820937842","loc":[-85.1123001,42.084824]},"n1820937843":{"id":"n1820937843","loc":[-85.1603074,42.0638061]},"n1820937844":{"id":"n1820937844","loc":[-85.1359744,42.0650646]},"n1820937845":{"id":"n1820937845","loc":[-85.1757569,42.053849]},"n1820937846":{"id":"n1820937846","loc":[-85.5200925,41.9716686]},"n1820937848":{"id":"n1820937848","loc":[-85.5525322,41.9701315]},"n1820937849":{"id":"n1820937849","loc":[-85.0406489,42.10149]},"n1820937850":{"id":"n1820937850","loc":[-85.0142547,42.088825]},"n1820937851":{"id":"n1820937851","loc":[-85.343749,41.9881884]},"n1820937852":{"id":"n1820937852","loc":[-85.074996,42.1060205]},"n1820937853":{"id":"n1820937853","loc":[-85.2436275,42.0136864]},"n1820937854":{"id":"n1820937854","loc":[-85.2641453,41.9980897]},"n1820937856":{"id":"n1820937856","loc":[-85.2802343,41.9870086]},"n1820937857":{"id":"n1820937857","loc":[-85.0099256,42.0909946]},"n1820937858":{"id":"n1820937858","loc":[-85.493957,41.9786079]},"n1820937859":{"id":"n1820937859","loc":[-85.0739405,42.1059795]},"n1820937860":{"id":"n1820937860","loc":[-85.2331605,42.0301423]},"n1820937862":{"id":"n1820937862","loc":[-85.2035231,42.0438425]},"n1820937863":{"id":"n1820937863","loc":[-85.0884928,42.0986971]},"n1820937864":{"id":"n1820937864","loc":[-85.131597,42.0690142]},"n1820937865":{"id":"n1820937865","loc":[-85.3937454,42.0052677]},"n1820937866":{"id":"n1820937866","loc":[-85.2212729,42.0378561]},"n1820937867":{"id":"n1820937867","loc":[-85.0886068,42.0982421]},"n1820937868":{"id":"n1820937868","loc":[-85.0875004,42.0968064]},"n1820937869":{"id":"n1820937869","loc":[-85.0771323,42.1042642]},"n1820937870":{"id":"n1820937870","loc":[-85.0164554,42.0894887]},"n1820937871":{"id":"n1820937871","loc":[-85.6069102,41.9415577]},"n1820937872":{"id":"n1820937872","loc":[-85.3273875,41.9704908]},"n1820937873":{"id":"n1820937873","loc":[-85.3890891,41.9997983]},"n1820937875":{"id":"n1820937875","loc":[-85.5091276,41.9723705]},"n1820937876":{"id":"n1820937876","loc":[-85.0770626,42.1047696]},"n1820937877":{"id":"n1820937877","loc":[-85.612575,41.9419567]},"n1820937878":{"id":"n1820937878","loc":[-85.3868146,42.0036094]},"n1820937879":{"id":"n1820937879","loc":[-85.2722738,41.9981204]},"n1820937880":{"id":"n1820937880","loc":[-85.3064878,41.9723733]},"n1820937882":{"id":"n1820937882","loc":[-85.1270845,42.0727678]},"n1820937884":{"id":"n1820937884","loc":[-85.3316512,41.97923]},"n1820937885":{"id":"n1820937885","loc":[-85.3932519,42.0042472]},"n1820937886":{"id":"n1820937886","loc":[-85.2457411,42.0175444]},"n1820937887":{"id":"n1820937887","loc":[-85.1397509,42.0648415]},"n1820937891":{"id":"n1820937891","loc":[-85.3196735,41.9719665]},"n1820937892":{"id":"n1820937892","loc":[-85.3372473,41.9845033]},"n1820937894":{"id":"n1820937894","loc":[-85.3254778,41.9719745]},"n1820937897":{"id":"n1820937897","loc":[-85.3185148,41.9691268]},"n1820937899":{"id":"n1820937899","loc":[-85.5419106,41.9714556]},"n1820937901":{"id":"n1820937901","loc":[-85.3293509,41.9748368]},"n1820937903":{"id":"n1820937903","loc":[-85.0798078,42.1028365]},"n1820937905":{"id":"n1820937905","loc":[-85.3954191,42.0056025]},"n1820937909":{"id":"n1820937909","loc":[-85.3417534,41.9857155]},"n1820937913":{"id":"n1820937913","loc":[-84.9927822,42.0857107]},"n1820937915":{"id":"n1820937915","loc":[-85.5444212,41.9712801]},"n1820937917":{"id":"n1820937917","loc":[-85.259088,41.9981682]},"n1820937921":{"id":"n1820937921","loc":[-85.2784576,41.9876358]},"n1820937922":{"id":"n1820937922","loc":[-84.9971918,42.087753]},"n1820937924":{"id":"n1820937924","loc":[-85.5310688,41.966899]},"n1820937928":{"id":"n1820937928","loc":[-85.3766436,41.9979326]},"n1820937930":{"id":"n1820937930","loc":[-85.5494852,41.9704346]},"n1820937933":{"id":"n1820937933","loc":[-85.5548281,41.9695412]},"n1820937935":{"id":"n1820937935","loc":[-85.0768588,42.105088]},"n1820937937":{"id":"n1820937937","loc":[-85.2646885,41.9978054]},"n1820937939":{"id":"n1820937939","loc":[-85.2441532,42.0176082]},"n1820937941":{"id":"n1820937941","loc":[-85.105553,42.0877928]},"n1820937943":{"id":"n1820937943","loc":[-85.0879457,42.0958909]},"n1820937944":{"id":"n1820937944","loc":[-85.3187015,41.9704402]},"n1820937945":{"id":"n1820937945","loc":[-85.5624456,41.970626]},"n1820937946":{"id":"n1820937946","loc":[-85.0580176,42.1028644]},"n1820937948":{"id":"n1820937948","loc":[-85.3016061,41.9726286]},"n1820937949":{"id":"n1820937949","loc":[-85.4310388,42.0069418]},"n1820937950":{"id":"n1820937950","loc":[-85.2945144,41.9740723]},"n1820937951":{"id":"n1820937951","loc":[-85.1170222,42.082657]},"n1820937952":{"id":"n1820937952","loc":[-85.0864503,42.0947632]},"n1820937953":{"id":"n1820937953","loc":[-85.4285926,42.0059533]},"n1820937970":{"id":"n1820937970","loc":[-85.3629965,41.9938023]},"n1820937972":{"id":"n1820937972","loc":[-85.2438099,42.0199755]},"n1820937974":{"id":"n1820937974","loc":[-85.1327654,42.0699285]},"n1820937977":{"id":"n1820937977","loc":[-85.1515956,42.0611935]},"n1820937978":{"id":"n1820937978","loc":[-85.0107369,42.0896638]},"n1820937979":{"id":"n1820937979","loc":[-85.1152626,42.0862083]},"n1820937980":{"id":"n1820937980","loc":[-85.4531831,42.0062881]},"n1820937981":{"id":"n1820937981","loc":[-85.0341473,42.0985924]},"n1820937982":{"id":"n1820937982","loc":[-85.0877485,42.0960171]},"n1820937983":{"id":"n1820937983","loc":[-85.2756373,41.9951742]},"n1820937984":{"id":"n1820937984","loc":[-85.2965421,41.9714401]},"n1820937985":{"id":"n1820937985","loc":[-85.2409775,42.0226934]},"n1820937986":{"id":"n1820937986","loc":[-85.0170723,42.0900579]},"n1820937987":{"id":"n1820937987","loc":[-85.1034663,42.0880555]},"n1820937988":{"id":"n1820937988","loc":[-85.0585071,42.1031577]},"n1820937990":{"id":"n1820937990","loc":[-85.0819174,42.1032373]},"n1820937992":{"id":"n1820937992","loc":[-85.0546608,42.1030542]},"n1820937993":{"id":"n1820937993","loc":[-85.0100811,42.0906125]},"n1820937995":{"id":"n1820937995","loc":[-85.6304278,41.9432655]},"n1820937997":{"id":"n1820937997","loc":[-85.0255628,42.092778]},"n1820938011":{"id":"n1820938011","loc":[-85.2316756,42.0317146]},"n1820938012":{"id":"n1820938012","loc":[-85.4067917,42.008042]},"n1820938013":{"id":"n1820938013","loc":[-85.390398,42.0028759]},"n1820938014":{"id":"n1820938014","loc":[-85.0161604,42.0886527]},"n1820938015":{"id":"n1820938015","loc":[-85.125337,42.0744589]},"n1820938016":{"id":"n1820938016","loc":[-85.2151317,42.0404801]},"n1820938017":{"id":"n1820938017","loc":[-85.3165085,41.9706025]},"n1820938018":{"id":"n1820938018","loc":[-85.5641193,41.9640688]},"n1820938019":{"id":"n1820938019","loc":[-85.147583,42.0642203]},"n1820938022":{"id":"n1820938022","loc":[-85.2803781,41.9947886]},"n1820938024":{"id":"n1820938024","loc":[-85.2692469,41.9982053]},"n1820938026":{"id":"n1820938026","loc":[-85.4321975,42.0067505]},"n1820938028":{"id":"n1820938028","loc":[-85.572535,41.9633405]},"n1820938030":{"id":"n1820938030","loc":[-85.3237505,41.9716475]},"n1820938032":{"id":"n1820938032","loc":[-85.6487698,41.9141583]},"n1820938033":{"id":"n1820938033","loc":[-85.0526371,42.1038315]},"n1820938034":{"id":"n1820938034","loc":[-85.088069,42.0978731]},"n1820938035":{"id":"n1820938035","loc":[-85.2516312,42.0102267]},"n1820938039":{"id":"n1820938039","loc":[-85.2731374,41.9982958]},"n1820938040":{"id":"n1820938040","loc":[-85.5453224,41.9713439]},"n1820938041":{"id":"n1820938041","loc":[-85.4480548,42.0049647]},"n1820938043":{"id":"n1820938043","loc":[-85.2504081,42.010322]},"n1820938045":{"id":"n1820938045","loc":[-85.2663447,41.99919]},"n1820938046":{"id":"n1820938046","loc":[-85.0507287,42.102907]},"n1820938047":{"id":"n1820938047","loc":[-85.0408246,42.1024743]},"n1820938048":{"id":"n1820938048","loc":[-85.2796335,41.9866099]},"n1820938050":{"id":"n1820938050","loc":[-85.452475,42.0061127]},"n1820938051":{"id":"n1820938051","loc":[-85.2410569,42.0128147]},"n1820938052":{"id":"n1820938052","loc":[-85.0413302,42.1011477]},"n1820938053":{"id":"n1820938053","loc":[-85.6327409,41.9197627]},"n1820938056":{"id":"n1820938056","loc":[-85.1072039,42.0857994]},"n1820938057":{"id":"n1820938057","loc":[-85.2001114,42.0448145]},"n1820938058":{"id":"n1820938058","loc":[-85.2655347,41.9978186]},"n1820938059":{"id":"n1820938059","loc":[-85.2330918,42.0304874]},"n1820938060":{"id":"n1820938060","loc":[-85.2601113,41.9966545]},"n1820938061":{"id":"n1820938061","loc":[-85.5397863,41.9708494]},"n1820938062":{"id":"n1820938062","loc":[-85.2702085,41.9977217]},"n1820938063":{"id":"n1820938063","loc":[-85.2219982,42.03699]},"n1820938064":{"id":"n1820938064","loc":[-85.0668957,42.105121]},"n1820938065":{"id":"n1820938065","loc":[-85.2328665,42.0270769]},"n1820938066":{"id":"n1820938066","loc":[-85.3189654,41.9694778]},"n1820938067":{"id":"n1820938067","loc":[-85.3814115,42.0022915]},"n1820938068":{"id":"n1820938068","loc":[-85.2759108,41.9956008]},"n1820938069":{"id":"n1820938069","loc":[-85.0391938,42.1034853]},"n1820938070":{"id":"n1820938070","loc":[-85.2850623,41.9810353]},"n1820938071":{"id":"n1820938071","loc":[-85.538074,41.970855]},"n1820938073":{"id":"n1820938073","loc":[-85.1319661,42.0670932]},"n1820938074":{"id":"n1820938074","loc":[-85.2816763,41.9913678]},"n1820938075":{"id":"n1820938075","loc":[-85.3182144,41.9700282]},"n1820938076":{"id":"n1820938076","loc":[-85.5909028,41.9458989]},"n1820938077":{"id":"n1820938077","loc":[-85.4057617,42.0074361]},"n1820938078":{"id":"n1820938078","loc":[-85.2620438,41.9967729]},"n1820938079":{"id":"n1820938079","loc":[-85.1122143,42.0851107]},"n1820938080":{"id":"n1820938080","loc":[-85.2443785,42.0174567]},"n1820938081":{"id":"n1820938081","loc":[-85.0319733,42.0953853]},"n1820938082":{"id":"n1820938082","loc":[-85.0878276,42.09443]},"n1820938083":{"id":"n1820938083","loc":[-85.0271789,42.0935809]},"n1820938084":{"id":"n1820938084","loc":[-85.0326399,42.0974222]},"n1820938085":{"id":"n1820938085","loc":[-85.3989167,42.0065592]},"n1820938086":{"id":"n1820938086","loc":[-85.3263361,41.9721261]},"n1820938087":{"id":"n1820938087","loc":[-85.2547855,42.0037134]},"n1820938088":{"id":"n1820938088","loc":[-85.4373259,42.005746]},"n1820938089":{"id":"n1820938089","loc":[-85.3094275,41.9699245]},"n1820938090":{"id":"n1820938090","loc":[-85.2783246,41.9872793]},"n1820938092":{"id":"n1820938092","loc":[-85.0815633,42.1025169]},"n1820938093":{"id":"n1820938093","loc":[-85.1788511,42.0522134]},"n1820938095":{"id":"n1820938095","loc":[-85.2830345,41.9816733]},"n1820938096":{"id":"n1820938096","loc":[-85.0744984,42.1059835]},"n1820938097":{"id":"n1820938097","loc":[-85.2788396,41.9879333]},"n1820938098":{"id":"n1820938098","loc":[-85.3640093,41.9946531]},"n1820938099":{"id":"n1820938099","loc":[-85.291167,41.9787463]},"n1820938100":{"id":"n1820938100","loc":[-85.0772436,42.1038156]},"n1820938101":{"id":"n1820938101","loc":[-85.00563,42.0887482]},"n1820938102":{"id":"n1820938102","loc":[-85.0326881,42.0961245]},"n1820938104":{"id":"n1820938104","loc":[-85.0530448,42.1038634]},"n1820938105":{"id":"n1820938105","loc":[-85.2625266,41.9970639]},"n1820938106":{"id":"n1820938106","loc":[-85.2827556,41.9823512]},"n1820938107":{"id":"n1820938107","loc":[-85.2784319,41.9910752]},"n1820938108":{"id":"n1820938108","loc":[-85.0882099,42.094393]},"n1820938109":{"id":"n1820938109","loc":[-85.5718484,41.9645371]},"n1820938110":{"id":"n1820938110","loc":[-85.2559764,42.0099317]},"n1820938111":{"id":"n1820938111","loc":[-85.2969284,41.973179]},"n1820938113":{"id":"n1820938113","loc":[-85.3875055,42.0019726]},"n1820938114":{"id":"n1820938114","loc":[-85.4250779,42.0068199]},"n1820938115":{"id":"n1820938115","loc":[-85.0645367,42.104889]},"n1820938116":{"id":"n1820938116","loc":[-85.1636762,42.0623724]},"n1820938117":{"id":"n1820938117","loc":[-85.0757322,42.1055935]},"n1820938118":{"id":"n1820938118","loc":[-85.3695197,41.9981559]},"n1820938120":{"id":"n1820938120","loc":[-85.1297516,42.0671027]},"n1820938121":{"id":"n1820938121","loc":[-85.1057448,42.0875551]},"n1820938122":{"id":"n1820938122","loc":[-85.2805175,41.9943182]},"n1820938123":{"id":"n1820938123","loc":[-85.2545173,42.0040722]},"n1820938124":{"id":"n1820938124","loc":[-84.9966607,42.0871319]},"n1820938125":{"id":"n1820938125","loc":[-85.0099899,42.0904612]},"n1820938126":{"id":"n1820938126","loc":[-85.2489919,42.0091102]},"n1820938127":{"id":"n1820938127","loc":[-85.0342706,42.0979476]},"n1820938128":{"id":"n1820938128","loc":[-85.1080891,42.0855884]},"n1820938129":{"id":"n1820938129","loc":[-85.0128183,42.0905356]},"n1820938130":{"id":"n1820938130","loc":[-85.631608,41.9434251]},"n1820938131":{"id":"n1820938131","loc":[-85.2551975,42.0008524]},"n1820938132":{"id":"n1820938132","loc":[-85.6421823,41.9096233]},"n1820938133":{"id":"n1820938133","loc":[-85.0125059,42.0906284]},"n1820938134":{"id":"n1820938134","loc":[-85.5499358,41.9701793]},"n1820938135":{"id":"n1820938135","loc":[-85.5472107,41.9712323]},"n1820938136":{"id":"n1820938136","loc":[-85.2760758,41.9958691]},"n1820938137":{"id":"n1820938137","loc":[-85.276678,41.9960433]},"n1820938138":{"id":"n1820938138","loc":[-85.0570319,42.1024731]},"n1820938140":{"id":"n1820938140","loc":[-85.2394325,42.0227492]},"n1820938142":{"id":"n1820938142","loc":[-85.5666341,41.9638829]},"n1820938144":{"id":"n1820938144","loc":[-85.258101,41.9996353]},"n1820938147":{"id":"n1820938147","loc":[-85.2129645,42.0413565]},"n1820938149":{"id":"n1820938149","loc":[-84.9962369,42.0868373]},"n1820938151":{"id":"n1820938151","loc":[-85.2570386,42.0084968]},"n1820938153":{"id":"n1820938153","loc":[-85.3971142,42.0050285]},"n1820938155":{"id":"n1820938155","loc":[-85.1072093,42.0855566]},"n1820938157":{"id":"n1820938157","loc":[-85.2840323,41.9920959]},"n1820938159":{"id":"n1820938159","loc":[-85.1187924,42.0816458]},"n1820938161":{"id":"n1820938161","loc":[-85.2681324,41.9985788]},"n1820938163":{"id":"n1820938163","loc":[-85.0887034,42.0984969]},"n1820938165":{"id":"n1820938165","loc":[-85.4133405,42.0073141]},"n1820938166":{"id":"n1820938166","loc":[-85.0097445,42.0902888]},"n1820938167":{"id":"n1820938167","loc":[-85.0828133,42.1037388]},"n1820938168":{"id":"n1820938168","loc":[-85.0549599,42.1030833]},"n1820938169":{"id":"n1820938169","loc":[-85.4571528,42.0010421]},"n1820938178":{"id":"n1820938178","loc":[-85.2706644,41.9975941]},"n1820938180":{"id":"n1820938180","loc":[-85.2258606,42.0335794]},"n1820938182":{"id":"n1820938182","loc":[-85.2832276,41.9814659]},"n1820938184":{"id":"n1820938184","loc":[-85.1082299,42.0860928]},"n1820938185":{"id":"n1820938185","loc":[-85.3839392,42.0022381]},"n1820938186":{"id":"n1820938186","loc":[-85.2772131,41.995905]},"n1820938187":{"id":"n1820938187","loc":[-85.1044895,42.0879214]},"n1820938188":{"id":"n1820938188","loc":[-85.2135267,42.0407087]},"n1820938189":{"id":"n1820938189","loc":[-85.2543993,42.0044628]},"n1820938190":{"id":"n1820938190","loc":[-85.1501793,42.0617351]},"n1820938191":{"id":"n1820938191","loc":[-85.3350587,41.9820469]},"n1820938192":{"id":"n1820938192","loc":[-85.1350731,42.0655735]},"n1820938193":{"id":"n1820938193","loc":[-85.0404008,42.1028843]},"n1820938194":{"id":"n1820938194","loc":[-85.6323161,41.943042]},"n1820938195":{"id":"n1820938195","loc":[-85.1259593,42.0742837]},"n1820938196":{"id":"n1820938196","loc":[-85.4562988,42.0033758]},"n1820938197":{"id":"n1820938197","loc":[-85.256824,42.0056826]},"n1820938198":{"id":"n1820938198","loc":[-85.2742103,41.9963862]},"n1820938199":{"id":"n1820938199","loc":[-85.0380888,42.1037877]},"n1820938200":{"id":"n1820938200","loc":[-85.47404,41.9944721]},"n1820938201":{"id":"n1820938201","loc":[-85.103021,42.087948]},"n1820938202":{"id":"n1820938202","loc":[-85.4030151,42.0065113]},"n1820938203":{"id":"n1820938203","loc":[-85.2113981,42.040735]},"n1820938204":{"id":"n1820938204","loc":[-85.2603433,41.9965137]},"n1820938206":{"id":"n1820938206","loc":[-85.1669378,42.0607634]},"n1820938207":{"id":"n1820938207","loc":[-85.0642027,42.1046076]},"n1820938208":{"id":"n1820938208","loc":[-85.2812428,41.9915696]},"n1820938209":{"id":"n1820938209","loc":[-85.0839559,42.1038343]},"n1820938210":{"id":"n1820938210","loc":[-85.1239946,42.0769368]},"n1820938211":{"id":"n1820938211","loc":[-85.2311177,42.0283042]},"n1820938212":{"id":"n1820938212","loc":[-85.2791614,41.9882682]},"n1820938213":{"id":"n1820938213","loc":[-85.2674941,41.9987582]},"n1820938214":{"id":"n1820938214","loc":[-85.352787,41.9919579]},"n1820938215":{"id":"n1820938215","loc":[-85.0874146,42.0952182]},"n1820938216":{"id":"n1820938216","loc":[-85.0069711,42.0877092]},"n1820938217":{"id":"n1820938217","loc":[-85.2059049,42.0404004]},"n1820938218":{"id":"n1820938218","loc":[-85.2403552,42.0227332]},"n1820938219":{"id":"n1820938219","loc":[-85.2492923,42.0098915]},"n1820938220":{"id":"n1820938220","loc":[-85.269778,41.9979541]},"n1820938221":{"id":"n1820938221","loc":[-85.2097673,42.0389024]},"n1820938222":{"id":"n1820938222","loc":[-85.0845942,42.1032015]},"n1820938223":{"id":"n1820938223","loc":[-84.993206,42.0858142]},"n1820938224":{"id":"n1820938224","loc":[-85.2108187,42.0402729]},"n1820938225":{"id":"n1820938225","loc":[-84.9893959,42.0873043]},"n1820938226":{"id":"n1820938226","loc":[-85.2952332,41.9719984]},"n1820938227":{"id":"n1820938227","loc":[-85.4100961,42.0081536]},"n1820938228":{"id":"n1820938228","loc":[-85.3299088,41.9785696]},"n1820938229":{"id":"n1820938229","loc":[-85.2258176,42.0340097]},"n1820938230":{"id":"n1820938230","loc":[-85.3146739,41.9711449]},"n1820938231":{"id":"n1820938231","loc":[-85.5447645,41.9712801]},"n1820938232":{"id":"n1820938232","loc":[-85.5510087,41.9705941]},"n1820938233":{"id":"n1820938233","loc":[-85.5122389,41.9703445]},"n1820938234":{"id":"n1820938234","loc":[-85.2792687,41.9865381]},"n1820938235":{"id":"n1820938235","loc":[-85.1475229,42.0630151]},"n1820938237":{"id":"n1820938237","loc":[-85.0332889,42.0996034]},"n1820938238":{"id":"n1820938238","loc":[-85.2588882,41.9986877]},"n1820938239":{"id":"n1820938239","loc":[-85.0656458,42.1050892]},"n1820938240":{"id":"n1820938240","loc":[-84.9913915,42.086098]},"n1820938241":{"id":"n1820938241","loc":[-85.4752416,41.9944402]},"n1820938242":{"id":"n1820938242","loc":[-85.1214304,42.0791147]},"n1820938243":{"id":"n1820938243","loc":[-85.0075183,42.0886925]},"n1820938244":{"id":"n1820938244","loc":[-85.1052888,42.0872087]},"n1820938245":{"id":"n1820938245","loc":[-85.3104252,41.9703393]},"n1820938246":{"id":"n1820938246","loc":[-85.232109,42.0318158]},"n1820938247":{"id":"n1820938247","loc":[-85.0756075,42.1059528]},"n1820938248":{"id":"n1820938248","loc":[-85.0075612,42.0890866]},"n1820938249":{"id":"n1820938249","loc":[-85.1013312,42.0897474]},"n1820938250":{"id":"n1820938250","loc":[-85.1168076,42.0828919]},"n1820938251":{"id":"n1820938251","loc":[-85.2951367,41.9723334]},"n1820938252":{"id":"n1820938252","loc":[-85.0879363,42.0976053]},"n1820938253":{"id":"n1820938253","loc":[-85.0354763,42.1021838]},"n1820938254":{"id":"n1820938254","loc":[-85.2379627,42.0236339]},"n1820938255":{"id":"n1820938255","loc":[-85.1308245,42.0685364]},"n1820938256":{"id":"n1820938256","loc":[-85.0914446,42.0934774]},"n1820938257":{"id":"n1820938257","loc":[-85.2436812,42.014069]},"n1820938258":{"id":"n1820938258","loc":[-85.0682529,42.1056106]},"n1820938259":{"id":"n1820938259","loc":[-85.290652,41.9766805]},"n1820938260":{"id":"n1820938260","loc":[-85.0133494,42.0897434]},"n1820938261":{"id":"n1820938261","loc":[-85.2753047,41.9949429]},"n1820938262":{"id":"n1820938262","loc":[-85.0314691,42.0950788]},"n1820938263":{"id":"n1820938263","loc":[-85.3444786,41.9908359]},"n1820938264":{"id":"n1820938264","loc":[-85.0443115,42.1009061]},"n1820938265":{"id":"n1820938265","loc":[-85.0634853,42.1043159]},"n1820938267":{"id":"n1820938267","loc":[-85.3978223,42.0053952]},"n1820938268":{"id":"n1820938268","loc":[-85.0228659,42.0911885]},"n1820938269":{"id":"n1820938269","loc":[-85.0220237,42.0906272]},"n1820938270":{"id":"n1820938270","loc":[-85.1061525,42.0863369]},"n1820938271":{"id":"n1820938271","loc":[-85.2382309,42.0233708]},"n1820938272":{"id":"n1820938272","loc":[-85.310672,41.9702755]},"n1820938273":{"id":"n1820938273","loc":[-85.1448192,42.0652613]},"n1820938274":{"id":"n1820938274","loc":[-85.6036057,41.9403766]},"n1820938275":{"id":"n1820938275","loc":[-85.0778941,42.1032413]},"n1820938276":{"id":"n1820938276","loc":[-85.1279374,42.0723974]},"n1820938277":{"id":"n1820938277","loc":[-85.2806635,41.9847836]},"n1820938278":{"id":"n1820938278","loc":[-85.2653201,41.9976352]},"n1820938279":{"id":"n1820938279","loc":[-85.0351665,42.1001805]},"n1820938280":{"id":"n1820938280","loc":[-85.0718269,42.1056253]},"n1820938281":{"id":"n1820938281","loc":[-85.2574248,42.0075322]},"n1820938282":{"id":"n1820938282","loc":[-85.126666,42.0740778]},"n1820938283":{"id":"n1820938283","loc":[-85.077705,42.1034733]},"n1820938284":{"id":"n1820938284","loc":[-85.3535552,41.9919045]},"n1820938286":{"id":"n1820938286","loc":[-85.2810711,41.9866657]},"n1820938287":{"id":"n1820938287","loc":[-85.4567494,42.0019885]},"n1820938288":{"id":"n1820938288","loc":[-85.2642419,41.9992936]},"n1820938289":{"id":"n1820938289","loc":[-85.2643344,41.9980925]},"n1820938290":{"id":"n1820938290","loc":[-85.3270335,41.9776125]},"n1820938291":{"id":"n1820938291","loc":[-85.1200584,42.0795077]},"n1820938292":{"id":"n1820938292","loc":[-85.2290792,42.0340256]},"n1820938293":{"id":"n1820938293","loc":[-85.6015887,41.9401372]},"n1820938294":{"id":"n1820938294","loc":[-85.5370869,41.970488]},"n1820938295":{"id":"n1820938295","loc":[-85.3108866,41.9698048]},"n1820938297":{"id":"n1820938297","loc":[-85.1556511,42.0628184]},"n1820938298":{"id":"n1820938298","loc":[-85.0027922,42.0875221]},"n1820938300":{"id":"n1820938300","loc":[-85.3873338,42.0040614]},"n1820938301":{"id":"n1820938301","loc":[-85.0350753,42.1004034]},"n1820938302":{"id":"n1820938302","loc":[-85.6239476,41.9411906]},"n1820938304":{"id":"n1820938304","loc":[-85.0118246,42.0897964]},"n1820938306":{"id":"n1820938306","loc":[-85.4796877,41.995275]},"n1820938307":{"id":"n1820938307","loc":[-85.5388636,41.9707856]},"n1820938309":{"id":"n1820938309","loc":[-85.2971902,41.9727773]},"n1820938310":{"id":"n1820938310","loc":[-85.5426831,41.9715513]},"n1820938311":{"id":"n1820938311","loc":[-85.2798373,41.9836671]},"n1820938312":{"id":"n1820938312","loc":[-85.2432198,42.0104017]},"n1820938313":{"id":"n1820938313","loc":[-85.2650412,41.9987554]},"n1820938317":{"id":"n1820938317","loc":[-85.0015423,42.0882386]},"n1820938318":{"id":"n1820938318","loc":[-85.1409783,42.064879]},"n1820938319":{"id":"n1820938319","loc":[-85.1691908,42.058995]},"n1820938320":{"id":"n1820938320","loc":[-85.1059165,42.0864882]},"n1820938321":{"id":"n1820938321","loc":[-85.3664941,41.9965771]},"n1820938323":{"id":"n1820938323","loc":[-85.3143198,41.9710971]},"n1820938324":{"id":"n1820938324","loc":[-85.0016067,42.0880675]},"n1820938325":{"id":"n1820938325","loc":[-85.0148139,42.0887164]},"n1820938326":{"id":"n1820938326","loc":[-85.0324682,42.0959056]},"n1820938327":{"id":"n1820938327","loc":[-85.0898661,42.0939921]},"n1820938328":{"id":"n1820938328","loc":[-85.2556427,42.0004936]},"n1820938329":{"id":"n1820938329","loc":[-85.6287112,41.9407437]},"n1820938330":{"id":"n1820938330","loc":[-84.9913392,42.0866701]},"n1820938331":{"id":"n1820938331","loc":[-85.2685777,41.9984632]},"n1820938332":{"id":"n1820938332","loc":[-85.0078884,42.0901614]},"n1820938333":{"id":"n1820938333","loc":[-84.999642,42.0878616]},"n1820938334":{"id":"n1820938334","loc":[-85.0188909,42.0899186]},"n1820938335":{"id":"n1820938335","loc":[-85.2830238,41.9819843]},"n1820938336":{"id":"n1820938336","loc":[-85.2491421,42.0096204]},"n1820938337":{"id":"n1820938337","loc":[-85.0585701,42.1034295]},"n1820938338":{"id":"n1820938338","loc":[-85.0651965,42.1051636]},"n1820938339":{"id":"n1820938339","loc":[-85.0583944,42.104292]},"n1820938340":{"id":"n1820938340","loc":[-85.119876,42.0801567]},"n1820938341":{"id":"n1820938341","loc":[-85.0943937,42.0931323]},"n1820938342":{"id":"n1820938342","loc":[-85.1504583,42.0613209]},"n1820938343":{"id":"n1820938343","loc":[-85.0425426,42.1019836]},"n1820938345":{"id":"n1820938345","loc":[-84.9991391,42.0878206]},"n1820938346":{"id":"n1820938346","loc":[-85.2563841,42.0094614]},"n1820938347":{"id":"n1820938347","loc":[-85.0515387,42.103297]},"n1820938348":{"id":"n1820938348","loc":[-85.0857261,42.1003636]},"n1820938349":{"id":"n1820938349","loc":[-85.078971,42.1029241]},"n1820938350":{"id":"n1820938350","loc":[-85.5699558,41.958931]},"n1820938351":{"id":"n1820938351","loc":[-85.3181285,41.9696533]},"n1820938352":{"id":"n1820938352","loc":[-85.5998506,41.9402329]},"n1820938353":{"id":"n1820938353","loc":[-85.2567277,42.000317]},"n1820938354":{"id":"n1820938354","loc":[-85.3082795,41.9708338]},"n1820938355":{"id":"n1820938355","loc":[-85.3127856,41.9692784]},"n1820938356":{"id":"n1820938356","loc":[-85.0340775,42.1010721]},"n1820938357":{"id":"n1820938357","loc":[-85.3158111,41.9706583]},"n1820938359":{"id":"n1820938359","loc":[-85.2312035,42.0280412]},"n1820938360":{"id":"n1820938360","loc":[-85.2448613,42.018477]},"n1820938361":{"id":"n1820938361","loc":[-85.29077,41.9759068]},"n1820938364":{"id":"n1820938364","loc":[-85.3677387,41.9976615]},"n1820938365":{"id":"n1820938365","loc":[-85.0785204,42.1030355]},"n1820938366":{"id":"n1820938366","loc":[-85.2262039,42.0333722]},"n1820938367":{"id":"n1820938367","loc":[-85.1226011,42.0780902]},"n1820938368":{"id":"n1820938368","loc":[-85.3229673,41.971129]},"n1820938369":{"id":"n1820938369","loc":[-85.385334,42.0000056]},"n1820938370":{"id":"n1820938370","loc":[-85.000098,42.0879094]},"n1820938372":{"id":"n1820938372","loc":[-85.3852481,42.0025091]},"n1820938373":{"id":"n1820938373","loc":[-85.3770513,41.9982515]},"n1820938374":{"id":"n1820938374","loc":[-85.6278314,41.9405362]},"n1820938375":{"id":"n1820938375","loc":[-85.6355133,41.9344068]},"n1820938376":{"id":"n1820938376","loc":[-85.635642,41.9324753]},"n1820938377":{"id":"n1820938377","loc":[-85.3154463,41.970778]},"n1820938378":{"id":"n1820938378","loc":[-85.0920334,42.093411]},"n1820938379":{"id":"n1820938379","loc":[-85.3269155,41.9722297]},"n1820938381":{"id":"n1820938381","loc":[-85.1134334,42.0849184]},"n1820938382":{"id":"n1820938382","loc":[-85.005968,42.088585]},"n1820938384":{"id":"n1820938384","loc":[-85.1245203,42.0757183]},"n1820938385":{"id":"n1820938385","loc":[-85.020704,42.0905396]},"n1820938386":{"id":"n1820938386","loc":[-85.119585,42.0808984]},"n1820938387":{"id":"n1820938387","loc":[-85.0072447,42.0880117]},"n1820938388":{"id":"n1820938388","loc":[-85.2742908,41.9960273]},"n1820938389":{"id":"n1820938389","loc":[-85.3275807,41.9696852]},"n1820938390":{"id":"n1820938390","loc":[-85.2385635,42.0231556]},"n1820938392":{"id":"n1820938392","loc":[-85.0202856,42.0900778]},"n1820938393":{"id":"n1820938393","loc":[-85.2067847,42.0395398]},"n1820938394":{"id":"n1820938394","loc":[-85.5183544,41.9713495]},"n1820938396":{"id":"n1820938396","loc":[-85.5073037,41.9736787]},"n1820938397":{"id":"n1820938397","loc":[-85.2519638,42.0114225]},"n1820938398":{"id":"n1820938398","loc":[-85.287487,41.9793285]},"n1820938399":{"id":"n1820938399","loc":[-85.2298088,42.0336431]},"n1820938400":{"id":"n1820938400","loc":[-85.229444,42.0339141]},"n1820938401":{"id":"n1820938401","loc":[-85.2421791,42.0220239]},"n1820938402":{"id":"n1820938402","loc":[-85.2976687,41.9737612]},"n1820938403":{"id":"n1820938403","loc":[-85.3622069,41.993473]},"n1820938404":{"id":"n1820938404","loc":[-85.2465458,42.014906]},"n1820938405":{"id":"n1820938405","loc":[-85.5724663,41.9639412]},"n1820938406":{"id":"n1820938406","loc":[-85.3708501,41.9982037]},"n1820938408":{"id":"n1820938408","loc":[-85.2564592,42.0055311]},"n1820938409":{"id":"n1820938409","loc":[-85.1192846,42.0810856]},"n1820938410":{"id":"n1820938410","loc":[-85.5623812,41.971663]},"n1820938411":{"id":"n1820938411","loc":[-85.3221948,41.9719665]},"n1820938412":{"id":"n1820938412","loc":[-85.5168738,41.9710305]},"n1820938413":{"id":"n1820938413","loc":[-85.4546852,42.0061127]},"n1820938414":{"id":"n1820938414","loc":[-85.5896153,41.9463617]},"n1820938415":{"id":"n1820938415","loc":[-85.2978189,41.9722138]},"n1820938416":{"id":"n1820938416","loc":[-85.1021681,42.0883581]},"n1820938417":{"id":"n1820938417","loc":[-85.2797193,41.9912984]},"n1820938419":{"id":"n1820938419","loc":[-85.2362461,42.0248533]},"n1820938420":{"id":"n1820938420","loc":[-85.4833639,41.9846252]},"n1820938422":{"id":"n1820938422","loc":[-85.3281064,41.9689433]},"n1820938424":{"id":"n1820938424","loc":[-85.2416963,42.0130088]},"n1820938425":{"id":"n1820938425","loc":[-85.5718655,41.9564577]},"n1820938426":{"id":"n1820938426","loc":[-85.0512812,42.1030701]},"n1820938427":{"id":"n1820938427","loc":[-85.1273527,42.0723616]},"n1820938428":{"id":"n1820938428","loc":[-85.0215033,42.0904083]},"n1820938429":{"id":"n1820938429","loc":[-85.6169953,41.942228]},"n1820938430":{"id":"n1820938430","loc":[-85.2829165,41.9907243]},"n1820938431":{"id":"n1820938431","loc":[-85.2240796,42.0374203]},"n1820938432":{"id":"n1820938432","loc":[-85.0167598,42.0898442]},"n1820938433":{"id":"n1820938433","loc":[-85.2132649,42.0411334]},"n1820938434":{"id":"n1820938434","loc":[-85.2293839,42.031513]},"n1820938435":{"id":"n1820938435","loc":[-85.1203374,42.0792608]},"n1820938436":{"id":"n1820938436","loc":[-85.109571,42.086268]},"n1820938437":{"id":"n1820938437","loc":[-85.1079026,42.0853842]},"n1820938438":{"id":"n1820938438","loc":[-85.109237,42.0862413]},"n1820938439":{"id":"n1820938439","loc":[-85.2259936,42.0350831]},"n1820938440":{"id":"n1820938440","loc":[-85.3669705,41.99679]},"n1820938441":{"id":"n1820938441","loc":[-85.2418143,42.0223507]},"n1820938442":{"id":"n1820938442","loc":[-85.3101248,41.9702515]},"n1820938443":{"id":"n1820938443","loc":[-85.069315,42.1059688]},"n1820938444":{"id":"n1820938444","loc":[-85.205862,42.0410378]},"n1820938445":{"id":"n1820938445","loc":[-85.0388076,42.1036604]},"n1820938446":{"id":"n1820938446","loc":[-85.2225389,42.0370115]},"n1820938447":{"id":"n1820938447","loc":[-85.3241474,41.9719346]},"n1820938448":{"id":"n1820938448","loc":[-85.3125496,41.9690789]},"n1820938449":{"id":"n1820938449","loc":[-85.1146497,42.0857039]},"n1820938450":{"id":"n1820938450","loc":[-85.1333944,42.0714963]},"n1820938451":{"id":"n1820938451","loc":[-85.5619306,41.9720937]},"n1820938452":{"id":"n1820938452","loc":[-85.2553651,42.0006479]},"n1820938453":{"id":"n1820938453","loc":[-85.3151137,41.9710093]},"n1820938454":{"id":"n1820938454","loc":[-85.2592315,41.9977947]},"n1820938455":{"id":"n1820938455","loc":[-85.2655723,41.9995966]},"n1820938456":{"id":"n1820938456","loc":[-85.4820652,41.9959233]},"n1820938459":{"id":"n1820938459","loc":[-85.450737,42.0055068]},"n1820938460":{"id":"n1820938460","loc":[-85.2428658,42.0205573]},"n1820938461":{"id":"n1820938461","loc":[-85.0835576,42.1021559]},"n1820938462":{"id":"n1820938462","loc":[-85.244636,42.0194733]},"n1820938463":{"id":"n1820938463","loc":[-85.5702562,41.9581332]},"n1820938465":{"id":"n1820938465","loc":[-85.5680031,41.9659515]},"n1820938467":{"id":"n1820938467","loc":[-85.2798752,41.9948353]},"n1820938468":{"id":"n1820938468","loc":[-85.0477407,42.1015537]},"n1820938469":{"id":"n1820938469","loc":[-85.6403842,41.913732]},"n1820938470":{"id":"n1820938470","loc":[-85.0396029,42.103289]},"n1820938471":{"id":"n1820938471","loc":[-85.2824702,41.9907777]},"n1820938472":{"id":"n1820938472","loc":[-85.2969284,41.9735538]},"n1820938474":{"id":"n1820938474","loc":[-85.401041,42.0070853]},"n1820938475":{"id":"n1820938475","loc":[-85.4116625,42.0073883]},"n1820938476":{"id":"n1820938476","loc":[-85.0437764,42.1016214]},"n1820938477":{"id":"n1820938477","loc":[-85.3643269,41.9958436]},"n1820938478":{"id":"n1820938478","loc":[-85.3895182,42.0009465]},"n1820938479":{"id":"n1820938479","loc":[-85.636157,41.9333373]},"n1820938480":{"id":"n1820938480","loc":[-85.2811355,41.9858044]},"n1820938481":{"id":"n1820938481","loc":[-85.0239052,42.092153]},"n1820938482":{"id":"n1820938482","loc":[-85.2558798,42.0053557]},"n1820938483":{"id":"n1820938483","loc":[-85.2544422,42.0047339]},"n1820938484":{"id":"n1820938484","loc":[-85.4864683,41.9843183]},"n1820938485":{"id":"n1820938485","loc":[-85.2554185,42.0031075]},"n1820938486":{"id":"n1820938486","loc":[-85.3082795,41.9712486]},"n1820938487":{"id":"n1820938487","loc":[-85.2433378,42.0133436]},"n1820938488":{"id":"n1820938488","loc":[-85.0216696,42.0904162]},"n1820938489":{"id":"n1820938489","loc":[-85.2546138,42.0050289]},"n1820938490":{"id":"n1820938490","loc":[-85.2717521,41.9977349]},"n1820938491":{"id":"n1820938491","loc":[-85.0100489,42.0908195]},"n1820938492":{"id":"n1820938492","loc":[-85.207879,42.0392211]},"n1820938493":{"id":"n1820938493","loc":[-85.0007363,42.0882836]},"n1820938494":{"id":"n1820938494","loc":[-85.5775303,41.9504097]},"n1820938495":{"id":"n1820938495","loc":[-85.1131584,42.0847683]},"n1820938496":{"id":"n1820938496","loc":[-85.0887825,42.0941633]},"n1820938497":{"id":"n1820938497","loc":[-85.1185926,42.0818938]},"n1820938498":{"id":"n1820938498","loc":[-85.2748487,41.9948712]},"n1820938499":{"id":"n1820938499","loc":[-85.2566952,42.0090788]},"n1820938500":{"id":"n1820938500","loc":[-85.0774757,42.1036234]},"n1820938501":{"id":"n1820938501","loc":[-85.4190869,42.008903]},"n1820938502":{"id":"n1820938502","loc":[-85.1140395,42.0850577]},"n1820938503":{"id":"n1820938503","loc":[-85.1136104,42.0848627]},"n1820938504":{"id":"n1820938504","loc":[-85.5828089,41.9480638]},"n1820938505":{"id":"n1820938505","loc":[-85.625514,41.9405202]},"n1820938506":{"id":"n1820938506","loc":[-85.2063384,42.0398322]},"n1820938507":{"id":"n1820938507","loc":[-85.3395476,41.9851636]},"n1820938508":{"id":"n1820938508","loc":[-85.0328853,42.0963606]},"n1820938510":{"id":"n1820938510","loc":[-85.1170369,42.0843702]},"n1820938511":{"id":"n1820938511","loc":[-85.2784748,41.9868487]},"n1820938512":{"id":"n1820938512","loc":[-85.6310501,41.9435528]},"n1820938514":{"id":"n1820938514","loc":[-85.0334284,42.0981028]},"n1820938515":{"id":"n1820938515","loc":[-84.9912091,42.0868226]},"n1820938516":{"id":"n1820938516","loc":[-85.2806141,41.9940351]},"n1820938517":{"id":"n1820938517","loc":[-85.1233025,42.0776734]},"n1820938518":{"id":"n1820938518","loc":[-85.2047891,42.0429023]},"n1820938519":{"id":"n1820938519","loc":[-85.1475443,42.0648312]},"n1820938520":{"id":"n1820938520","loc":[-85.2644685,41.9990891]},"n1820938521":{"id":"n1820938521","loc":[-85.1056281,42.0872553]},"n1820938522":{"id":"n1820938522","loc":[-85.4813184,41.9930105]},"n1820938523":{"id":"n1820938523","loc":[-85.321551,41.9722936]},"n1820938524":{"id":"n1820938524","loc":[-85.1564664,42.0631211]},"n1820938525":{"id":"n1820938525","loc":[-85.4149885,42.0079144]},"n1820938527":{"id":"n1820938527","loc":[-85.2861888,41.9803653]},"n1820938528":{"id":"n1820938528","loc":[-85.1301379,42.0682178]},"n1820938529":{"id":"n1820938529","loc":[-85.4156537,42.0084247]},"n1820938530":{"id":"n1820938530","loc":[-85.245151,42.0176082]},"n1820938531":{"id":"n1820938531","loc":[-85.457818,42.0001651]},"n1820938532":{"id":"n1820938532","loc":[-85.310951,41.9694538]},"n1820938533":{"id":"n1820938533","loc":[-85.1509089,42.0611298]},"n1820938534":{"id":"n1820938534","loc":[-85.1108249,42.086321]},"n1820938535":{"id":"n1820938535","loc":[-85.1260344,42.0740687]},"n1820938536":{"id":"n1820938536","loc":[-85.4561228,42.0042791]},"n1820938537":{"id":"n1820938537","loc":[-85.2805082,41.9945761]},"n1820938538":{"id":"n1820938538","loc":[-85.273352,41.9981921]},"n1820938539":{"id":"n1820938539","loc":[-85.1084216,42.0864364]},"n1820938540":{"id":"n1820938540","loc":[-85.5009737,41.9773637]},"n1820938541":{"id":"n1820938541","loc":[-85.3960843,42.0051879]},"n1820938542":{"id":"n1820938542","loc":[-85.3425088,41.9865034]},"n1820938545":{"id":"n1820938545","loc":[-84.9937907,42.0860849]},"n1820938546":{"id":"n1820938546","loc":[-85.1084176,42.086065]},"n1820938547":{"id":"n1820938547","loc":[-85.3492851,41.9924786]},"n1820938548":{"id":"n1820938548","loc":[-85.2512235,42.0101147]},"n1820938549":{"id":"n1820938549","loc":[-85.3717298,41.9979326]},"n1820938551":{"id":"n1820938551","loc":[-85.2573712,42.0064081]},"n1820938552":{"id":"n1820938552","loc":[-85.2514596,42.010139]},"n1820938553":{"id":"n1820938553","loc":[-85.416512,42.0088073]},"n1820938554":{"id":"n1820938554","loc":[-85.4365964,42.0061606]},"n1820938555":{"id":"n1820938555","loc":[-85.4552431,42.0057301]},"n1820938556":{"id":"n1820938556","loc":[-85.2916283,41.9778769]},"n1820938557":{"id":"n1820938557","loc":[-85.100709,42.0902968]},"n1820938558":{"id":"n1820938558","loc":[-85.4703064,41.9965771]},"n1820938559":{"id":"n1820938559","loc":[-85.3134722,41.9696134]},"n1820938560":{"id":"n1820938560","loc":[-85.4834213,41.9885768]},"n1820938561":{"id":"n1820938561","loc":[-85.2740641,41.9975236]},"n1820938562":{"id":"n1820938562","loc":[-85.148334,42.0623405]},"n1820938563":{"id":"n1820938563","loc":[-85.2358598,42.0263675]},"n1820938565":{"id":"n1820938565","loc":[-85.2902979,41.9790892]},"n1820938566":{"id":"n1820938566","loc":[-85.2528865,42.0112869]},"n1820938567":{"id":"n1820938567","loc":[-85.2595319,41.9973003]},"n1820938568":{"id":"n1820938568","loc":[-85.071151,42.105689]},"n1820938570":{"id":"n1820938570","loc":[-85.299278,41.9732188]},"n1820938571":{"id":"n1820938571","loc":[-85.0354669,42.1024771]},"n1820938583":{"id":"n1820938583","loc":[-85.3313937,41.972562]},"n1820938585":{"id":"n1820938585","loc":[-85.0756933,42.1058334]},"n1820938587":{"id":"n1820938587","loc":[-85.3130324,41.9694219]},"n1820938590":{"id":"n1820938590","loc":[-85.0934227,42.0931681]},"n1820938592":{"id":"n1820938592","loc":[-85.3517956,41.9922553]},"n1820938593":{"id":"n1820938593","loc":[-85.4023971,42.0065169]},"n1820938594":{"id":"n1820938594","loc":[-85.3506798,41.9925583]},"n1820938595":{"id":"n1820938595","loc":[-85.3673524,41.9971193]},"n1820938596":{"id":"n1820938596","loc":[-85.1073608,42.0853523]},"n1820938597":{"id":"n1820938597","loc":[-85.2976579,41.972477]},"n1820938598":{"id":"n1820938598","loc":[-85.5616517,41.9694295]},"n1820938599":{"id":"n1820938599","loc":[-85.3552074,41.9921915]},"n1820938600":{"id":"n1820938600","loc":[-85.4665126,41.9999953]},"n1820938601":{"id":"n1820938601","loc":[-85.2740695,41.9966226]},"n1820938602":{"id":"n1820938602","loc":[-85.279376,41.9886669]},"n1820938603":{"id":"n1820938603","loc":[-85.0771109,42.1040413]},"n1820938604":{"id":"n1820938604","loc":[-85.2636049,41.9977895]},"n1820938605":{"id":"n1820938605","loc":[-85.3762145,41.9976456]},"n1820938606":{"id":"n1820938606","loc":[-85.2321369,42.0289577]},"n1820938620":{"id":"n1820938620","loc":[-85.4947724,41.9776189]},"n1820938622":{"id":"n1820938622","loc":[-85.1547069,42.0622768]},"n1820938624":{"id":"n1820938624","loc":[-85.0005056,42.0880249]},"n1820938626":{"id":"n1820938626","loc":[-85.0735596,42.1059357]},"n1820938628":{"id":"n1820938628","loc":[-85.4665298,41.99932]},"n1820938629":{"id":"n1820938629","loc":[-85.434515,42.0065273]},"n1820938630":{"id":"n1820938630","loc":[-85.117462,42.0823823]},"n1820938631":{"id":"n1820938631","loc":[-85.0131777,42.0890707]},"n1820938632":{"id":"n1820938632","loc":[-85.0875326,42.0961934]},"n1820938634":{"id":"n1820938634","loc":[-85.6433839,41.9112042]},"n1820938635":{"id":"n1820938635","loc":[-85.1366181,42.064969]},"n1820938636":{"id":"n1820938636","loc":[-85.073109,42.1057925]},"n1820938638":{"id":"n1820938638","loc":[-85.161406,42.0632541]},"n1820938640":{"id":"n1820938640","loc":[-85.6343932,41.9188845]},"n1820938642":{"id":"n1820938642","loc":[-85.2500004,42.010306]},"n1820938644":{"id":"n1820938644","loc":[-85.291918,41.9753166]},"n1820938663":{"id":"n1820938663","loc":[-85.2841611,41.9916812]},"n1820938664":{"id":"n1820938664","loc":[-85.1052955,42.0868134]},"n1820938665":{"id":"n1820938665","loc":[-85.4606118,42.0005534]},"n1820938666":{"id":"n1820938666","loc":[-85.5672736,41.9642922]},"n1820938667":{"id":"n1820938667","loc":[-85.6348481,41.9316932]},"n1820938668":{"id":"n1820938668","loc":[-85.0224904,42.0909576]},"n1820938669":{"id":"n1820938669","loc":[-85.0133856,42.0899755]},"n1820938670":{"id":"n1820938670","loc":[-85.344779,41.991139]},"n1820938671":{"id":"n1820938671","loc":[-85.632874,41.9425313]},"n1820938673":{"id":"n1820938673","loc":[-85.4941501,41.9779698]},"n1820938675":{"id":"n1820938675","loc":[-85.0862559,42.0997519]},"n1820938676":{"id":"n1820938676","loc":[-85.0097874,42.0898032]},"n1820938678":{"id":"n1820938678","loc":[-84.9913553,42.0863675]},"n1820938680":{"id":"n1820938680","loc":[-85.0533666,42.1038315]},"n1820938682":{"id":"n1820938682","loc":[-85.2950294,41.9743914]},"n1820938684":{"id":"n1820938684","loc":[-85.2517385,42.0104499]},"n1820938686":{"id":"n1820938686","loc":[-85.0247971,42.0922514]},"n1820938688":{"id":"n1820938688","loc":[-85.0807037,42.1026017]},"n1820938690":{"id":"n1820938690","loc":[-85.52462,41.9722748]},"n1820938694":{"id":"n1820938694","loc":[-85.2586535,41.9988818]},"n1820938695":{"id":"n1820938695","loc":[-85.0931612,42.092948]},"n1820938697":{"id":"n1820938697","loc":[-85.2470822,42.016564]},"n1820938698":{"id":"n1820938698","loc":[-85.4143018,42.0075158]},"n1820938699":{"id":"n1820938699","loc":[-85.0771484,42.104487]},"n1820938700":{"id":"n1820938700","loc":[-85.0291208,42.0942775]},"n1820938701":{"id":"n1820938701","loc":[-85.6367964,41.9185971]},"n1820938702":{"id":"n1820938702","loc":[-85.085419,42.1010693]},"n1820938703":{"id":"n1820938703","loc":[-85.0583877,42.1040584]},"n1820938705":{"id":"n1820938705","loc":[-85.2573379,42.0003182]},"n1820938706":{"id":"n1820938706","loc":[-85.2655937,41.9981575]},"n1820938707":{"id":"n1820938707","loc":[-85.023181,42.0915758]},"n1820938708":{"id":"n1820938708","loc":[-85.2318687,42.0274674]},"n1820938709":{"id":"n1820938709","loc":[-85.1056389,42.0866184]},"n1820938710":{"id":"n1820938710","loc":[-85.5276265,41.9700978]},"n1820938711":{"id":"n1820938711","loc":[-85.0864128,42.0945761]},"n1820938712":{"id":"n1820938712","loc":[-84.9897071,42.0871888]},"n1820938714":{"id":"n1820938714","loc":[-85.1328845,42.0665611]},"n1820938715":{"id":"n1820938715","loc":[-85.0336537,42.0991377]},"n1820938716":{"id":"n1820938716","loc":[-85.087597,42.0986692]},"n1820938717":{"id":"n1820938717","loc":[-85.1241394,42.0761882]},"n1820938718":{"id":"n1820938718","loc":[-85.1176002,42.0847723]},"n1820938719":{"id":"n1820938719","loc":[-85.2423615,42.0216572]},"n1820938721":{"id":"n1820938721","loc":[-85.2196378,42.0387908]},"n1820938722":{"id":"n1820938722","loc":[-85.0164272,42.0890082]},"n1820938723":{"id":"n1820938723","loc":[-85.5917182,41.9451807]},"n1820938724":{"id":"n1820938724","loc":[-85.2458806,42.0086638]},"n1820938725":{"id":"n1820938725","loc":[-85.1264474,42.0740527]},"n1820938726":{"id":"n1820938726","loc":[-85.1961631,42.04738]},"n1820938727":{"id":"n1820938727","loc":[-85.2784643,41.9943648]},"n1820938728":{"id":"n1820938728","loc":[-85.2905554,41.9763216]},"n1820938729":{"id":"n1820938729","loc":[-85.2913386,41.9771511]},"n1820938730":{"id":"n1820938730","loc":[-85.0112519,42.0895683]},"n1820938732":{"id":"n1820938732","loc":[-85.4290261,42.0064531]},"n1820938733":{"id":"n1820938733","loc":[-85.3867073,42.0031629]},"n1820938734":{"id":"n1820938734","loc":[-85.4943647,41.9836005]},"n1820938735":{"id":"n1820938735","loc":[-85.4900303,41.9860728]},"n1820938736":{"id":"n1820938736","loc":[-85.0866153,42.0944539]},"n1820938737":{"id":"n1820938737","loc":[-85.0869532,42.0990911]},"n1820938738":{"id":"n1820938738","loc":[-85.6321659,41.9208851]},"n1820938739":{"id":"n1820938739","loc":[-85.5930485,41.9433453]},"n1820938740":{"id":"n1820938740","loc":[-85.0406851,42.102733]},"n1820938741":{"id":"n1820938741","loc":[-85.1051131,42.0869846]},"n1820938742":{"id":"n1820938742","loc":[-85.1377554,42.0648893]},"n1820938743":{"id":"n1820938743","loc":[-85.2795694,41.994604]},"n1820938745":{"id":"n1820938745","loc":[-85.4948153,41.9826594]},"n1820938746":{"id":"n1820938746","loc":[-85.4488916,42.0050923]},"n1820938747":{"id":"n1820938747","loc":[-85.1052526,42.0866144]},"n1820938748":{"id":"n1820938748","loc":[-85.1468749,42.0653991]},"n1820938749":{"id":"n1820938749","loc":[-85.0856886,42.1006104]},"n1820938750":{"id":"n1820938750","loc":[-85.2144022,42.0404004]},"n1820938751":{"id":"n1820938751","loc":[-85.277771,41.9907458]},"n1820938752":{"id":"n1820938752","loc":[-85.1474542,42.0636149]},"n1820938753":{"id":"n1820938753","loc":[-85.0820515,42.1028075]},"n1820938754":{"id":"n1820938754","loc":[-85.1122948,42.08525]},"n1820938756":{"id":"n1820938756","loc":[-85.0173352,42.0901933]},"n1820938757":{"id":"n1820938757","loc":[-85.2259721,42.0354018]},"n1820938758":{"id":"n1820938758","loc":[-85.0872389,42.0987795]},"n1820938759":{"id":"n1820938759","loc":[-85.2291436,42.031874]},"n1820938760":{"id":"n1820938760","loc":[-85.3802485,42.0016002]},"n1820938761":{"id":"n1820938761","loc":[-85.3945822,42.0057938]},"n1820938762":{"id":"n1820938762","loc":[-85.5273237,41.9713017]},"n1820938763":{"id":"n1820938763","loc":[-85.2868862,41.9798629]},"n1820938764":{"id":"n1820938764","loc":[-85.2516677,42.0107899]},"n1820938766":{"id":"n1820938766","loc":[-85.3183002,41.9693103]},"n1820938768":{"id":"n1820938768","loc":[-85.2159042,42.0401932]},"n1820938770":{"id":"n1820938770","loc":[-85.0094481,42.0911141]},"n1820938771":{"id":"n1820938771","loc":[-85.0244538,42.0922155]},"n1820938772":{"id":"n1820938772","loc":[-85.231697,42.028862]},"n1820938773":{"id":"n1820938773","loc":[-85.2102394,42.0390617]},"n1820938774":{"id":"n1820938774","loc":[-85.2463419,42.0151212]},"n1820938775":{"id":"n1820938775","loc":[-85.0726195,42.1056424]},"n1820938776":{"id":"n1820938776","loc":[-85.0060431,42.0883262]},"n1820938778":{"id":"n1820938778","loc":[-85.425889,42.0056982]},"n1820938779":{"id":"n1820938779","loc":[-85.1183042,42.0820638]},"n1820938780":{"id":"n1820938780","loc":[-85.441596,42.0058257]},"n1820938781":{"id":"n1820938781","loc":[-85.1124879,42.0847086]},"n1820938782":{"id":"n1820938782","loc":[-85.2452733,42.0153894]},"n1820938783":{"id":"n1820938783","loc":[-85.2741191,41.9969244]},"n1820938784":{"id":"n1820938784","loc":[-85.2829487,41.9822236]},"n1820938785":{"id":"n1820938785","loc":[-85.3202743,41.972142]},"n1820938786":{"id":"n1820938786","loc":[-85.2345402,42.0266465]},"n1820938787":{"id":"n1820938787","loc":[-85.3037626,41.9724611]},"n1820938789":{"id":"n1820938789","loc":[-85.2474792,42.0161973]},"n1820938790":{"id":"n1820938790","loc":[-85.2951045,41.9727323]},"n1820938791":{"id":"n1820938791","loc":[-85.322345,41.9712726]},"n1820938792":{"id":"n1820938792","loc":[-85.2402372,42.0110394]},"n1820938793":{"id":"n1820938793","loc":[-85.5135693,41.9698659]},"n1820938794":{"id":"n1820938794","loc":[-85.4695339,41.9967366]},"n1820938796":{"id":"n1820938796","loc":[-85.0418492,42.1011131]},"n1820938797":{"id":"n1820938797","loc":[-85.3334107,41.9806337]},"n1820938798":{"id":"n1820938798","loc":[-85.5625314,41.9711685]},"n1820938799":{"id":"n1820938799","loc":[-85.3755707,41.9973585]},"n1820938800":{"id":"n1820938800","loc":[-85.5227532,41.9722429]},"n1820938801":{"id":"n1820938801","loc":[-85.4267687,42.0052836]},"n1820938803":{"id":"n1820938803","loc":[-85.0284704,42.0940837]},"n1820938804":{"id":"n1820938804","loc":[-85.015585,42.0885305]},"n1820938805":{"id":"n1820938805","loc":[-85.0765905,42.1053865]},"n1820938806":{"id":"n1820938806","loc":[-85.2614953,41.9964551]},"n1820938808":{"id":"n1820938808","loc":[-85.0307355,42.0947313]},"n1820938810":{"id":"n1820938810","loc":[-85.3894753,42.0003565]},"n1820938812":{"id":"n1820938812","loc":[-85.0868848,42.095006]},"n1820938813":{"id":"n1820938813","loc":[-85.3854198,42.0009465]},"n1820938814":{"id":"n1820938814","loc":[-85.2659692,41.9993534]},"n1820938815":{"id":"n1820938815","loc":[-85.1234259,42.0765266]},"n1820938816":{"id":"n1820938816","loc":[-85.1426906,42.0648893]},"n1820938818":{"id":"n1820938818","loc":[-85.1014533,42.0893067]},"n1820938819":{"id":"n1820938819","loc":[-85.0883064,42.098067]},"n1820938820":{"id":"n1820938820","loc":[-85.0503156,42.102704]},"n1820938821":{"id":"n1820938821","loc":[-85.1179649,42.0821884]},"n1820938822":{"id":"n1820938822","loc":[-85.3484697,41.9921596]},"n1820938823":{"id":"n1820938823","loc":[-85.3732962,41.9970874]},"n1820938824":{"id":"n1820938824","loc":[-85.2784104,41.9898312]},"n1820938825":{"id":"n1820938825","loc":[-85.4441709,42.0052198]},"n1820938826":{"id":"n1820938826","loc":[-85.3925438,42.0038326]},"n1820938829":{"id":"n1820938829","loc":[-85.5717582,41.9621861]},"n1820938830":{"id":"n1820938830","loc":[-85.0866314,42.0995051]},"n1820938831":{"id":"n1820938831","loc":[-85.576672,41.9522769]},"n1820938832":{"id":"n1820938832","loc":[-85.1587238,42.0636205]},"n1820938833":{"id":"n1820938833","loc":[-85.3804245,41.9999155]},"n1820938834":{"id":"n1820938834","loc":[-85.280083,41.9948843]},"n1820938836":{"id":"n1820938836","loc":[-85.561892,41.9686693]},"n1820938837":{"id":"n1820938837","loc":[-85.0158975,42.0885253]},"n1820938838":{"id":"n1820938838","loc":[-85.4248204,42.007633]},"n1820938839":{"id":"n1820938839","loc":[-85.0352738,42.1039657]},"n1820938840":{"id":"n1820938840","loc":[-85.211956,42.0411812]},"n1820938841":{"id":"n1820938841","loc":[-85.4816575,41.9908997]},"n1820938842":{"id":"n1820938842","loc":[-85.3807635,42.0020308]},"n1820938843":{"id":"n1820938843","loc":[-85.0100865,42.0898521]},"n1820938844":{"id":"n1820938844","loc":[-85.0103936,42.0897434]},"n1820938848":{"id":"n1820938848","loc":[-85.2430052,42.0131363]},"n1820938849":{"id":"n1820938849","loc":[-85.112559,42.0853723]},"n1820938851":{"id":"n1820938851","loc":[-85.3641553,41.9952535]},"n1820938852":{"id":"n1820938852","loc":[-85.2087373,42.0390777]},"n1820938853":{"id":"n1820938853","loc":[-85.2473933,42.0148263]},"n1820938854":{"id":"n1820938854","loc":[-85.0213464,42.090509]},"n1820938855":{"id":"n1820938855","loc":[-85.0673208,42.1052353]},"n1820938856":{"id":"n1820938856","loc":[-85.1003053,42.0905528]},"n1820938857":{"id":"n1820938857","loc":[-85.2617367,41.9965389]},"n1820938858":{"id":"n1820938858","loc":[-85.280363,41.9916015]},"n1820938859":{"id":"n1820938859","loc":[-85.0038866,42.0873469]},"n1820938860":{"id":"n1820938860","loc":[-85.2476401,42.0151451]},"n1820938861":{"id":"n1820938861","loc":[-85.193717,42.0499294]},"n1820938862":{"id":"n1820938862","loc":[-85.3478689,41.9917609]},"n1820938863":{"id":"n1820938863","loc":[-85.5638017,41.9648881]},"n1820938864":{"id":"n1820938864","loc":[-85.4356308,42.0064476]},"n1820938865":{"id":"n1820938865","loc":[-85.0561722,42.1023509]},"n1820938867":{"id":"n1820938867","loc":[-85.2256031,42.0356034]},"n1820938868":{"id":"n1820938868","loc":[-85.6102576,41.9420844]},"n1820938869":{"id":"n1820938869","loc":[-85.2285213,42.0339938]},"n1820938870":{"id":"n1820938870","loc":[-85.0326238,42.0978003]},"n1820938871":{"id":"n1820938871","loc":[-85.0131389,42.0903736]},"n1820938872":{"id":"n1820938872","loc":[-85.2550859,42.0012259]},"n1820938873":{"id":"n1820938873","loc":[-85.1130029,42.0846966]},"n1820938874":{"id":"n1820938874","loc":[-85.1579041,42.06336]},"n1820938875":{"id":"n1820938875","loc":[-85.0430522,42.1020234]},"n1820938876":{"id":"n1820938876","loc":[-85.2786679,41.9865935]},"n1820938877":{"id":"n1820938877","loc":[-85.1221666,42.0788706]},"n1820938878":{"id":"n1820938878","loc":[-85.2554614,42.0103303]},"n1820938879":{"id":"n1820938879","loc":[-85.2349801,42.0265748]},"n1820938880":{"id":"n1820938880","loc":[-85.0997434,42.0907864]},"n1820938881":{"id":"n1820938881","loc":[-85.0045464,42.0878167]},"n1820938882":{"id":"n1820938882","loc":[-85.2728048,41.9982519]},"n1820938883":{"id":"n1820938883","loc":[-85.3111333,41.9691587]},"n1820938884":{"id":"n1820938884","loc":[-85.3219802,41.9721899]},"n1820938885":{"id":"n1820938885","loc":[-85.3091378,41.9699325]},"n1820938887":{"id":"n1820938887","loc":[-85.4242367,42.0085203]},"n1820938888":{"id":"n1820938888","loc":[-84.9968377,42.0874504]},"n1820938890":{"id":"n1820938890","loc":[-85.5443139,41.9714078]},"n1820938891":{"id":"n1820938891","loc":[-85.6404013,41.9154676]},"n1820938892":{"id":"n1820938892","loc":[-85.3644986,41.9962582]},"n1820938893":{"id":"n1820938893","loc":[-85.0496772,42.1018323]},"n1820938894":{"id":"n1820938894","loc":[-85.297261,41.9737373]},"n1820938895":{"id":"n1820938895","loc":[-85.0327096,42.098071]},"n1820938896":{"id":"n1820938896","loc":[-85.3856773,41.9996867]},"n1820938897":{"id":"n1820938897","loc":[-85.0493862,42.1015509]},"n1820938898":{"id":"n1820938898","loc":[-84.9969879,42.0876614]},"n1820938899":{"id":"n1820938899","loc":[-85.0848625,42.1013587]},"n1820938900":{"id":"n1820938900","loc":[-85.5853195,41.9479201]},"n1820938901":{"id":"n1820938901","loc":[-85.6329169,41.9387964]},"n1820938902":{"id":"n1820938902","loc":[-85.0843046,42.1029468]},"n1820938903":{"id":"n1820938903","loc":[-85.1228747,42.0778474]},"n1820938904":{"id":"n1820938904","loc":[-85.4855456,41.984095]},"n1820938905":{"id":"n1820938905","loc":[-85.0573269,42.1026801]},"n1820938906":{"id":"n1820938906","loc":[-85.2425868,42.0131523]},"n1820938907":{"id":"n1820938907","loc":[-85.1149622,42.0860053]},"n1820938908":{"id":"n1820938908","loc":[-85.4833097,41.9951578]},"n1820938909":{"id":"n1820938909","loc":[-85.075979,42.1056372]},"n1820938910":{"id":"n1820938910","loc":[-85.0338509,42.0977139]},"n1820938911":{"id":"n1820938911","loc":[-85.6384272,41.9115715]},"n1820938912":{"id":"n1820938912","loc":[-85.0458363,42.1004074]},"n1820938913":{"id":"n1820938913","loc":[-85.0592138,42.1048305]},"n1820938914":{"id":"n1820938914","loc":[-85.2807493,41.9916653]},"n1820938915":{"id":"n1820938915","loc":[-85.1103274,42.0864193]},"n1820938916":{"id":"n1820938916","loc":[-85.6267156,41.9404404]},"n1820938918":{"id":"n1820938918","loc":[-85.0331374,42.0982911]},"n1820938919":{"id":"n1820938919","loc":[-85.5637331,41.965409]},"n1820938920":{"id":"n1820938920","loc":[-85.5457515,41.9714237]},"n1820938922":{"id":"n1820938922","loc":[-85.082073,42.1030104]},"n1820938923":{"id":"n1820938923","loc":[-85.0780765,42.103102]},"n1820938924":{"id":"n1820938924","loc":[-85.4208035,42.0089508]},"n1820938925":{"id":"n1820938925","loc":[-85.3469934,41.9914795]},"n1820938926":{"id":"n1820938926","loc":[-85.0322,42.095619]},"n1820938927":{"id":"n1820938927","loc":[-85.4784431,41.9949401]},"n1820938928":{"id":"n1820938928","loc":[-85.1303095,42.0667523]},"n1820938929":{"id":"n1820938929","loc":[-85.2463784,42.0084781]},"n1820938930":{"id":"n1820938930","loc":[-85.6299986,41.9427707]},"n1820938931":{"id":"n1820938931","loc":[-85.6325907,41.9238499]},"n1820938932":{"id":"n1820938932","loc":[-85.4808464,41.9914476]},"n1820938934":{"id":"n1820938934","loc":[-85.2411599,42.0105292]},"n1820938935":{"id":"n1820938935","loc":[-85.0163213,42.0892379]},"n1820938936":{"id":"n1820938936","loc":[-85.3290934,41.9682322]},"n1820938937":{"id":"n1820938937","loc":[-85.4925623,41.9853231]},"n1820938938":{"id":"n1820938938","loc":[-85.0338294,42.09892]},"n1820938940":{"id":"n1820938940","loc":[-85.4174561,42.008903]},"n1820938941":{"id":"n1820938941","loc":[-85.1165595,42.0838845]},"n1820938942":{"id":"n1820938942","loc":[-85.2954585,41.9717192]},"n1820938943":{"id":"n1820938943","loc":[-85.6330199,41.9257338]},"n1820938944":{"id":"n1820938944","loc":[-85.2294654,42.0324478]},"n1820938945":{"id":"n1820938945","loc":[-85.5601282,41.9728914]},"n1820938946":{"id":"n1820938946","loc":[-85.1176324,42.08568]},"n1820938947":{"id":"n1820938947","loc":[-85.0210245,42.0906005]},"n1820938948":{"id":"n1820938948","loc":[-85.0251887,42.09253]},"n1820938949":{"id":"n1820938949","loc":[-85.0895832,42.0939551]},"n1820938950":{"id":"n1820938950","loc":[-84.9915109,42.085842]},"n1820938951":{"id":"n1820938951","loc":[-85.2187366,42.0393486]},"n1820938952":{"id":"n1820938952","loc":[-85.006605,42.087579]},"n1820938953":{"id":"n1820938953","loc":[-85.046641,42.1012393]},"n1820938954":{"id":"n1820938954","loc":[-85.052102,42.103695]},"n1820938955":{"id":"n1820938955","loc":[-85.283925,41.9912825]},"n1820938956":{"id":"n1820938956","loc":[-85.2326626,42.0316349]},"n1820938957":{"id":"n1820938957","loc":[-85.1174298,42.0859694]},"n1820938958":{"id":"n1820938958","loc":[-85.3802056,41.9994794]},"n1820938959":{"id":"n1820938959","loc":[-85.4586334,41.9999737]},"n1820938960":{"id":"n1820938960","loc":[-85.4302234,42.0069418]},"n1820938961":{"id":"n1820938961","loc":[-85.092201,42.0930674]},"n1820938962":{"id":"n1820938962","loc":[-85.3684511,41.9979382]},"n1820938963":{"id":"n1820938963","loc":[-85.4618735,42.0011856]},"n1820938964":{"id":"n1820938964","loc":[-85.4828205,41.9877793]},"n1820938965":{"id":"n1820938965","loc":[-85.0837789,42.1025726]},"n1820938966":{"id":"n1820938966","loc":[-85.0176195,42.090253]},"n1820938967":{"id":"n1820938967","loc":[-85.3801627,42.001074]},"n1820938968":{"id":"n1820938968","loc":[-85.4767007,41.994488]},"n1820938969":{"id":"n1820938969","loc":[-85.274268,41.9957495]},"n1820938970":{"id":"n1820938970","loc":[-85.2977438,41.9719506]},"n1820938971":{"id":"n1820938971","loc":[-85.2425546,42.0208682]},"n1820938972":{"id":"n1820938972","loc":[-85.2557082,42.002382]},"n1820938973":{"id":"n1820938973","loc":[-85.3187937,41.9691986]},"n1820938975":{"id":"n1820938975","loc":[-85.2448077,42.0153045]},"n1820938977":{"id":"n1820938977","loc":[-85.0343015,42.0997718]},"n1820938978":{"id":"n1820938978","loc":[-85.2449364,42.01874]},"n1820938979":{"id":"n1820938979","loc":[-85.2598391,41.9969602]},"n1820938980":{"id":"n1820938980","loc":[-85.4294724,42.0067665]},"n1820938981":{"id":"n1820938981","loc":[-85.428082,42.0055124]},"n1820938983":{"id":"n1820938983","loc":[-85.5436315,41.9717484]},"n1820938985":{"id":"n1820938985","loc":[-85.5978336,41.9407437]},"n1820938986":{"id":"n1820938986","loc":[-85.491661,41.9860249]},"n1820938987":{"id":"n1820938987","loc":[-85.4942789,41.9801392]},"n1820938988":{"id":"n1820938988","loc":[-85.0416306,42.1010841]},"n1820938989":{"id":"n1820938989","loc":[-85.2653644,41.9984433]},"n1820938990":{"id":"n1820938990","loc":[-85.1028266,42.0881124]},"n1820938991":{"id":"n1820938991","loc":[-85.0163146,42.0887932]},"n1820938992":{"id":"n1820938992","loc":[-85.5282209,41.9678112]},"n1820938993":{"id":"n1820938993","loc":[-85.5442752,41.9715888]},"n1820938994":{"id":"n1820938994","loc":[-85.5634327,41.9658558]},"n1820938995":{"id":"n1820938995","loc":[-85.0384227,42.1037627]},"n1820938996":{"id":"n1820938996","loc":[-85.1144258,42.0854439]},"n1820938997":{"id":"n1820938997","loc":[-85.1870651,42.0506305]},"n1820938998":{"id":"n1820938998","loc":[-85.1256159,42.0747376]},"n1820938999":{"id":"n1820938999","loc":[-85.3272695,41.9715836]},"n1820939000":{"id":"n1820939000","loc":[-85.0543067,42.103098]},"n1820939001":{"id":"n1820939001","loc":[-85.4678173,41.9973585]},"n1820939003":{"id":"n1820939003","loc":[-85.0266626,42.0933154]},"n1820939004":{"id":"n1820939004","loc":[-85.0353046,42.1019728]},"n1820939005":{"id":"n1820939005","loc":[-85.1237961,42.0762798]},"n1820939006":{"id":"n1820939006","loc":[-85.2812214,41.9826702]},"n1820939007":{"id":"n1820939007","loc":[-85.2927763,41.9747343]},"n1820939008":{"id":"n1820939008","loc":[-85.3270979,41.9720862]},"n1820939009":{"id":"n1820939009","loc":[-85.488657,41.9856581]},"n1820939010":{"id":"n1820939010","loc":[-85.3087301,41.9701399]},"n1820939011":{"id":"n1820939011","loc":[-85.0276939,42.093768]},"n1820939012":{"id":"n1820939012","loc":[-85.2956516,41.9748779]},"n1820939013":{"id":"n1820939013","loc":[-85.1298579,42.0726443]},"n1820939014":{"id":"n1820939014","loc":[-85.105144,42.0870893]},"n1820939015":{"id":"n1820939015","loc":[-85.0677486,42.1053917]},"n1820939016":{"id":"n1820939016","loc":[-85.0333681,42.0993459]},"n1820939017":{"id":"n1820939017","loc":[-85.6384272,41.910805]},"n1820939018":{"id":"n1820939018","loc":[-85.399496,42.006894]},"n1820939019":{"id":"n1820939019","loc":[-85.2648427,41.9998318]},"n1820939020":{"id":"n1820939020","loc":[-85.1237424,42.0766779]},"n1820939021":{"id":"n1820939021","loc":[-85.2515025,42.0109442]},"n1820939022":{"id":"n1820939022","loc":[-85.5566306,41.9718385]},"n1820939023":{"id":"n1820939023","loc":[-85.090644,42.0938369]},"n1820939024":{"id":"n1820939024","loc":[-85.1245525,42.074914]},"n1820939025":{"id":"n1820939025","loc":[-85.1099934,42.0863926]},"n1820939026":{"id":"n1820939026","loc":[-85.1251653,42.0744589]},"n1820939027":{"id":"n1820939027","loc":[-85.401792,42.0068143]},"n1820939028":{"id":"n1820939028","loc":[-85.0094763,42.0899584]},"n1820939029":{"id":"n1820939029","loc":[-85.1330779,42.0705605]},"n1820939030":{"id":"n1820939030","loc":[-85.4935064,41.984398]},"n1820939031":{"id":"n1820939031","loc":[-85.5713334,41.9613939]},"n1820939032":{"id":"n1820939032","loc":[-85.0873945,42.0964669]},"n1820939033":{"id":"n1820939033","loc":[-85.0886497,42.0986481]},"n1820939034":{"id":"n1820939034","loc":[-85.3276343,41.9758897]},"n1820939035":{"id":"n1820939035","loc":[-85.1304386,42.0727387]},"n1820939036":{"id":"n1820939036","loc":[-85.2551932,42.0052999]},"n1820939037":{"id":"n1820939037","loc":[-85.2206936,42.0384458]},"n1820939038":{"id":"n1820939038","loc":[-85.2313645,42.0286389]},"n1820939039":{"id":"n1820939039","loc":[-85.0754586,42.1059835]},"n1820939040":{"id":"n1820939040","loc":[-85.0663324,42.1050812]},"n1820939041":{"id":"n1820939041","loc":[-85.2406234,42.0106887]},"n1820939042":{"id":"n1820939042","loc":[-85.0685962,42.1058175]},"n1820939043":{"id":"n1820939043","loc":[-85.0689462,42.1059437]},"n1820939044":{"id":"n1820939044","loc":[-85.0586144,42.1046144]},"n1820939045":{"id":"n1820939045","loc":[-85.3650565,41.9965452]},"n1820939047":{"id":"n1820939047","loc":[-85.5752558,41.9536014]},"n1820939048":{"id":"n1820939048","loc":[-85.5110159,41.9710624]},"n1820939050":{"id":"n1820939050","loc":[-85.2832641,41.9926477]},"n1820939051":{"id":"n1820939051","loc":[-85.0078402,42.0898947]},"n1820939052":{"id":"n1820939052","loc":[-85.3882737,42.0017916]},"n1820939053":{"id":"n1820939053","loc":[-85.1718945,42.0564937]},"n1820939054":{"id":"n1820939054","loc":[-85.0947048,42.0929293]},"n1820939055":{"id":"n1820939055","loc":[-85.4456944,42.0051082]},"n1820939056":{"id":"n1820939056","loc":[-85.3139872,41.9706903]},"n1820939057":{"id":"n1820939057","loc":[-85.3893895,42.0034021]},"n1820939058":{"id":"n1820939058","loc":[-85.2425332,42.0106089]},"n1820939059":{"id":"n1820939059","loc":[-85.6085624,41.9420844]},"n1820939060":{"id":"n1820939060","loc":[-85.210411,42.0397789]},"n1820939061":{"id":"n1820939061","loc":[-85.2762542,41.9960473]},"n1820939062":{"id":"n1820939062","loc":[-85.4686584,41.9969973]},"n1820939063":{"id":"n1820939063","loc":[-85.3860421,42.0018394]},"n1820939064":{"id":"n1820939064","loc":[-85.5636944,41.9644414]},"n1820939065":{"id":"n1820939065","loc":[-85.3267331,41.9766554]},"n1820939066":{"id":"n1820939066","loc":[-85.0868996,42.0943822]},"n1820939067":{"id":"n1820939067","loc":[-85.104861,42.0880038]},"n1820939068":{"id":"n1820939068","loc":[-85.5537123,41.9695093]},"n1820939069":{"id":"n1820939069","loc":[-85.6325092,41.9396743]},"n1820939070":{"id":"n1820939070","loc":[-85.3869648,42.0024454]},"n1820939071":{"id":"n1820939071","loc":[-85.2775349,41.9957335]},"n1820939072":{"id":"n1820939072","loc":[-85.2055616,42.0421533]},"n1820939073":{"id":"n1820939073","loc":[-85.4731431,41.9946531]},"n1820939074":{"id":"n1820939074","loc":[-85.0399609,42.1030833]},"n1820939075":{"id":"n1820939075","loc":[-85.3055758,41.9725169]},"n1820939076":{"id":"n1820939076","loc":[-85.4834599,41.994488]},"n1820939077":{"id":"n1820939077","loc":[-85.3819866,42.0023018]},"n1820939078":{"id":"n1820939078","loc":[-85.1218756,42.0789992]},"n1820939079":{"id":"n1820939079","loc":[-85.2793159,41.9944458]},"n1820939080":{"id":"n1820939080","loc":[-85.2495498,42.0101466]},"n1820939081":{"id":"n1820939081","loc":[-85.0035969,42.0872434]},"n1820939082":{"id":"n1820939082","loc":[-85.1054243,42.0865626]},"n1820939083":{"id":"n1820939083","loc":[-85.0917665,42.0934774]},"n1820939084":{"id":"n1820939084","loc":[-85.3442211,41.988938]},"n1820939086":{"id":"n1820939086","loc":[-85.273989,41.9953588]},"n1820939087":{"id":"n1820939087","loc":[-85.1142541,42.0852488]},"n1820939089":{"id":"n1820939089","loc":[-85.1526684,42.0615758]},"n1820939090":{"id":"n1820939090","loc":[-85.2538843,42.0110159]},"n1820939091":{"id":"n1820939091","loc":[-85.28341,41.9909635]},"n1820939092":{"id":"n1820939092","loc":[-85.3963178,42.0050217]},"n1820939093":{"id":"n1820939093","loc":[-85.0851682,42.1012472]},"n1820939095":{"id":"n1820939095","loc":[-85.2811784,41.986243]},"n1820939096":{"id":"n1820939096","loc":[-85.4274125,42.0052995]},"n1820939097":{"id":"n1820939097","loc":[-85.0871262,42.0951652]},"n1820939099":{"id":"n1820939099","loc":[-85.1314253,42.0671665]},"n1820939100":{"id":"n1820939100","loc":[-85.2778997,41.991001]},"n1820939101":{"id":"n1820939101","loc":[-85.112107,42.0862812]},"n1820939102":{"id":"n1820939102","loc":[-85.299911,41.9729955]},"n1820939103":{"id":"n1820939103","loc":[-85.639822,41.9094796]},"n1820939104":{"id":"n1820939104","loc":[-85.122294,42.0785334]},"n1820939105":{"id":"n1820939105","loc":[-85.2476294,42.015719]},"n1820939106":{"id":"n1820939106","loc":[-85.4946007,41.9814631]},"n1820939107":{"id":"n1820939107","loc":[-85.0879524,42.0986919]},"n1820939108":{"id":"n1820939108","loc":[-85.0342814,42.098274]},"n1820939109":{"id":"n1820939109","loc":[-85.2450695,42.0095463]},"n1820939110":{"id":"n1820939110","loc":[-85.3847546,42.0024135]},"n1820939111":{"id":"n1820939111","loc":[-85.2961344,41.9742558]},"n1820939112":{"id":"n1820939112","loc":[-85.27899,41.994317]},"n1820939114":{"id":"n1820939114","loc":[-85.1017644,42.0886618]},"n1820939115":{"id":"n1820939115","loc":[-85.076215,42.1056333]},"n1820939116":{"id":"n1820939116","loc":[-85.1198009,42.0805349]},"n1820939117":{"id":"n1820939117","loc":[-85.11988,42.0798513]},"n1820939118":{"id":"n1820939118","loc":[-85.147819,42.0625476]},"n1820939119":{"id":"n1820939119","loc":[-85.0585969,42.1029042]},"n1820939120":{"id":"n1820939120","loc":[-85.1248596,42.0745744]},"n1820939121":{"id":"n1820939121","loc":[-85.3023786,41.9725249]},"n1820939123":{"id":"n1820939123","loc":[-85.0119332,42.0900699]},"n1820939124":{"id":"n1820939124","loc":[-85.2466852,42.0170343]},"n1820939125":{"id":"n1820939125","loc":[-85.0033019,42.0872792]},"n1820939126":{"id":"n1820939126","loc":[-85.0042084,42.0875778]},"n1820939128":{"id":"n1820939128","loc":[-85.0052961,42.0885424]},"n1820939130":{"id":"n1820939130","loc":[-85.0647942,42.10508]},"n1820939131":{"id":"n1820939131","loc":[-85.2824123,41.9825107]},"n1820939132":{"id":"n1820939132","loc":[-85.3210039,41.9723255]},"n1820939133":{"id":"n1820939133","loc":[-85.0491033,42.1014184]},"n1820939134":{"id":"n1820939134","loc":[-85.1127776,42.0855168]},"n1820939135":{"id":"n1820939135","loc":[-85.1243768,42.0759322]},"n1820939137":{"id":"n1820939137","loc":[-85.125974,42.0747547]},"n1820939138":{"id":"n1820939138","loc":[-85.1071248,42.0859973]},"n1820939139":{"id":"n1820939139","loc":[-85.5326175,41.9674833]},"n1820939140":{"id":"n1820939140","loc":[-85.1338715,42.0660833]},"n1820939142":{"id":"n1820939142","loc":[-85.649671,41.9135675]},"n1820939144":{"id":"n1820939144","loc":[-85.0236545,42.0920444]},"n1820939145":{"id":"n1820939145","loc":[-85.1084391,42.0859376]},"n1820939146":{"id":"n1820939146","loc":[-85.1539988,42.0618626]},"n1820939147":{"id":"n1820939147","loc":[-85.2354521,42.026511]},"n1820939148":{"id":"n1820939148","loc":[-85.2362246,42.0260408]},"n1820939149":{"id":"n1820939149","loc":[-85.2401342,42.0115233]},"n1820939150":{"id":"n1820939150","loc":[-85.295319,41.9747423]},"n1820939151":{"id":"n1820939151","loc":[-85.1164696,42.0835409]},"n1820939152":{"id":"n1820939152","loc":[-85.3232891,41.9712885]},"n1820939153":{"id":"n1820939153","loc":[-85.2574463,42.0068944]},"n1820939155":{"id":"n1820939155","loc":[-85.5704064,41.9598246]},"n1820939156":{"id":"n1820939156","loc":[-85.0349077,42.0998116]},"n1820939157":{"id":"n1820939157","loc":[-85.0949529,42.0925619]},"n1820939159":{"id":"n1820939159","loc":[-85.0179829,42.0902343]},"n1820939160":{"id":"n1820939160","loc":[-85.0405832,42.1016942]},"n1820939161":{"id":"n1820939161","loc":[-85.2534015,42.0111833]},"n1820939162":{"id":"n1820939162","loc":[-85.0839881,42.102708]},"n1820939163":{"id":"n1820939163","loc":[-85.0341996,42.1008385]},"n1820939164":{"id":"n1820939164","loc":[-85.1037761,42.0879731]},"n1820939173":{"id":"n1820939173","loc":[-85.0460616,42.1005786]},"n1820939177":{"id":"n1820939177","loc":[-85.0061651,42.0878059]},"n1820939181":{"id":"n1820939181","loc":[-85.1456775,42.0654684]},"n1820939183":{"id":"n1820939183","loc":[-85.1325508,42.0718439]},"n1820939185":{"id":"n1820939185","loc":[-85.2485842,42.008329]},"n1820939187":{"id":"n1820939187","loc":[-85.2744128,41.9949322]},"n1820939189":{"id":"n1820939189","loc":[-85.2579025,41.9999542]},"n1820939191":{"id":"n1820939191","loc":[-85.3358998,41.9828987]},"n1820939193":{"id":"n1820939193","loc":[-85.3192658,41.9716714]},"n1820939194":{"id":"n1820939194","loc":[-85.6400795,41.9130725]},"n1820939195":{"id":"n1820939195","loc":[-85.3278489,41.9780591]},"n1820939196":{"id":"n1820939196","loc":[-85.2800197,41.983061]},"n1820939197":{"id":"n1820939197","loc":[-85.3278167,41.9692943]},"n1820939198":{"id":"n1820939198","loc":[-85.3366894,41.9838653]},"n1820939199":{"id":"n1820939199","loc":[-85.0328383,42.0969923]},"n1820939201":{"id":"n1820939201","loc":[-85.3259284,41.9720383]},"n1820939217":{"id":"n1820939217","loc":[-85.1840181,42.0503277]},"n1820939220":{"id":"n1820939220","loc":[-85.422563,42.0089986]},"n1820939222":{"id":"n1820939222","loc":[-85.555386,41.9707856]},"n1820939224":{"id":"n1820939224","loc":[-85.3830809,42.002254]},"n1820939226":{"id":"n1820939226","loc":[-84.9917938,42.0857517]},"n1820939227":{"id":"n1820939227","loc":[-85.2936775,41.9740484]},"n1820939228":{"id":"n1820939228","loc":[-85.2632133,41.9975024]},"n1820939229":{"id":"n1820939229","loc":[-85.2809424,41.9853259]},"n1820939230":{"id":"n1820939230","loc":[-85.242104,42.0131204]},"n1820939232":{"id":"n1820939232","loc":[-85.2610246,41.9963901]},"n1820939233":{"id":"n1820939233","loc":[-85.2335531,42.0268378]},"n1820939234":{"id":"n1820939234","loc":[-85.3188839,41.9713575]},"n1820939235":{"id":"n1820939235","loc":[-85.2413637,42.0225658]},"n1820939237":{"id":"n1820939237","loc":[-85.0010796,42.0887215]},"n1820939239":{"id":"n1820939239","loc":[-85.2241697,42.0362624]},"n1820939243":{"id":"n1820939243","loc":[-85.0368456,42.1040134]},"n1820939244":{"id":"n1820939244","loc":[-85.1327986,42.069524]},"n1820939260":{"id":"n1820939260","loc":[-85.5408163,41.9711206]},"n1820939261":{"id":"n1820939261","loc":[-85.2959199,41.9746546]},"n1820939262":{"id":"n1820939262","loc":[-85.3298659,41.9683598]},"n1820939263":{"id":"n1820939263","loc":[-85.2240581,42.0358425]},"n1820939264":{"id":"n1820939264","loc":[-85.2438206,42.0101944]},"n1820939265":{"id":"n1820939265","loc":[-85.3984489,42.0059589]},"n1820939266":{"id":"n1820939266","loc":[-85.2330811,42.0294279]},"n1820939268":{"id":"n1820939268","loc":[-85.1126877,42.0857704]},"n1820939271":{"id":"n1820939271","loc":[-85.254925,42.0106253]},"n1820939273":{"id":"n1820939273","loc":[-85.4328046,42.0064662]},"n1820939277":{"id":"n1820939277","loc":[-85.289622,41.9789616]},"n1820939279":{"id":"n1820939279","loc":[-85.4574532,42.0004043]},"n1820939281":{"id":"n1820939281","loc":[-85.4803486,41.9867211]},"n1820939283":{"id":"n1820939283","loc":[-85.157475,42.0631848]},"n1820939285":{"id":"n1820939285","loc":[-85.2571458,42.0059935]},"n1820939287":{"id":"n1820939287","loc":[-85.2818544,41.9825984]},"n1820939289":{"id":"n1820939289","loc":[-85.2298302,42.0328781]},"n1820939291":{"id":"n1820939291","loc":[-85.4819523,41.984821]},"n1820939301":{"id":"n1820939301","loc":[-85.3139765,41.9701159]},"n1820939304":{"id":"n1820939304","loc":[-85.0424447,42.101742]},"n1820939306":{"id":"n1820939306","loc":[-85.6360283,41.9338482]},"n1820939310":{"id":"n1820939310","loc":[-85.3463025,41.9913622]},"n1820939312":{"id":"n1820939312","loc":[-85.4664869,41.9988097]},"n1820939314":{"id":"n1820939314","loc":[-85.149364,42.0622449]},"n1820939316":{"id":"n1820939316","loc":[-85.2460415,42.0153125]},"n1820939318":{"id":"n1820939318","loc":[-85.4806103,41.9924523]},"n1820939320":{"id":"n1820939320","loc":[-85.2449042,42.0190987]},"n1820939322":{"id":"n1820939322","loc":[-85.5280165,41.9689263]},"n1820939324":{"id":"n1820939324","loc":[-85.0051204,42.0882625]},"n1820939326":{"id":"n1820939326","loc":[-85.1240925,42.0771546]},"n1820939329":{"id":"n1820939329","loc":[-85.2261653,42.0342225]},"n1820939331":{"id":"n1820939331","loc":[-85.5259933,41.972211]},"n1820939333":{"id":"n1820939333","loc":[-85.0074754,42.0883183]},"n1820939335":{"id":"n1820939335","loc":[-85.0764014,42.1055549]},"n1820939336":{"id":"n1820939336","loc":[-85.2908773,41.9769597]},"n1820939337":{"id":"n1820939337","loc":[-85.4095382,42.0083449]},"n1820939346":{"id":"n1820939346","loc":[-85.2514166,42.0111753]},"n1820939348":{"id":"n1820939348","loc":[-85.0030377,42.0873799]},"n1820939350":{"id":"n1820939350","loc":[-85.3659362,41.9964974]},"n1820939352":{"id":"n1820939352","loc":[-85.226058,42.0348281]},"n1820939355":{"id":"n1820939355","loc":[-85.1902408,42.0507101]},"n1820939357":{"id":"n1820939357","loc":[-85.2781854,41.9946001]},"n1820939359":{"id":"n1820939359","loc":[-85.2139988,42.0405175]},"n1820939361":{"id":"n1820939361","loc":[-85.0086609,42.0908262]},"n1820939363":{"id":"n1820939363","loc":[-85.0627128,42.1043398]},"n1820939365":{"id":"n1820939365","loc":[-85.1311346,42.072501]},"n1820939369":{"id":"n1820939369","loc":[-85.248198,42.0082652]},"n1820939370":{"id":"n1820939370","loc":[-84.99792,42.087794]},"n1820939371":{"id":"n1820939371","loc":[-85.2786775,41.9942783]},"n1820939372":{"id":"n1820939372","loc":[-85.0342103,42.1013957]},"n1820939373":{"id":"n1820939373","loc":[-85.2022357,42.0444799]},"n1820939374":{"id":"n1820939374","loc":[-85.2279205,42.0337388]},"n1820939375":{"id":"n1820939375","loc":[-85.1337699,42.0712614]},"n1820939376":{"id":"n1820939376","loc":[-85.317517,41.9707062]},"n1820939377":{"id":"n1820939377","loc":[-85.1326326,42.070218]},"n1820939394":{"id":"n1820939394","loc":[-85.0197746,42.0899118]},"n1820939397":{"id":"n1820939397","loc":[-85.2590076,41.9984632]},"n1820939399":{"id":"n1820939399","loc":[-85.2469964,42.0083449]},"n1820939400":{"id":"n1820939400","loc":[-85.2470929,42.0146668]},"n1820939401":{"id":"n1820939401","loc":[-84.9984095,42.0878087]},"n1820939402":{"id":"n1820939402","loc":[-85.2372653,42.0243273]},"n1820939403":{"id":"n1820939403","loc":[-85.2454986,42.0091955]},"n1820939404":{"id":"n1820939404","loc":[-85.0539205,42.1035995]},"n1820939405":{"id":"n1820939405","loc":[-85.550601,41.9706101]},"n1820939406":{"id":"n1820939406","loc":[-85.0351343,42.0999656]},"n1820939407":{"id":"n1820939407","loc":[-85.0082908,42.0905755]},"n1820939408":{"id":"n1820939408","loc":[-85.0132904,42.0902251]},"n1820939410":{"id":"n1820939410","loc":[-85.0892546,42.094012]},"n1820939412":{"id":"n1820939412","loc":[-85.0350793,42.1030315]},"n1820939416":{"id":"n1820939416","loc":[-85.0012406,42.0886777]},"n1820939418":{"id":"n1820939418","loc":[-85.0577453,42.1029229]},"n1820939420":{"id":"n1820939420","loc":[-85.1230786,42.0776722]},"n1820939422":{"id":"n1820939422","loc":[-85.571136,41.9649304]},"n1820939436":{"id":"n1820939436","loc":[-85.1137968,42.0848997]},"n1820939437":{"id":"n1820939437","loc":[-85.3559584,41.9925105]},"n1820939438":{"id":"n1820939438","loc":[-85.0080172,42.0903565]},"n1820939439":{"id":"n1820939439","loc":[-85.0048897,42.0880913]},"n1820939441":{"id":"n1820939441","loc":[-85.0406959,42.1018574]},"n1820939443":{"id":"n1820939443","loc":[-85.3897328,42.0029078]},"n1820939445":{"id":"n1820939445","loc":[-85.122349,42.0782814]},"n1820939448":{"id":"n1820939448","loc":[-85.4872193,41.985036]},"n1820939450":{"id":"n1820939450","loc":[-85.0120459,42.0904919]},"n1820939452":{"id":"n1820939452","loc":[-85.6320543,41.921982]},"n1820939456":{"id":"n1820939456","loc":[-85.0844749,42.1036843]},"n1820939458":{"id":"n1820939458","loc":[-85.0968037,42.091296]},"n1820939463":{"id":"n1820939463","loc":[-85.5339747,41.9681841]},"n1820939465":{"id":"n1820939465","loc":[-85.4125423,42.0072129]},"n1820939467":{"id":"n1820939467","loc":[-85.6335563,41.9303626]},"n1820939469":{"id":"n1820939469","loc":[-85.2821014,41.9932126]},"n1820939471":{"id":"n1820939471","loc":[-85.374691,41.9969917]},"n1820939485":{"id":"n1820939485","loc":[-85.4471321,42.0049806]},"n1820939487":{"id":"n1820939487","loc":[-85.3752532,41.9972206]},"n1820939489":{"id":"n1820939489","loc":[-85.4517283,42.005927]},"n1820939492":{"id":"n1820939492","loc":[-85.4662552,42.0005693]},"n1820939494":{"id":"n1820939494","loc":[-85.0120083,42.0902928]},"n1820939496":{"id":"n1820939496","loc":[-85.044463,42.1004631]},"n1820939498":{"id":"n1820939498","loc":[-85.418293,42.0089667]},"n1820939500":{"id":"n1820939500","loc":[-85.0554762,42.1027358]},"n1820939504":{"id":"n1820939504","loc":[-85.1246289,42.0746858]},"n1820939507":{"id":"n1820939507","loc":[-85.0408139,42.1021838]},"n1820939508":{"id":"n1820939508","loc":[-85.1236204,42.0775169]},"n1820939509":{"id":"n1820939509","loc":[-85.0350109,42.1037428]},"n1820939510":{"id":"n1820939510","loc":[-85.0551583,42.1029878]},"n1820939511":{"id":"n1820939511","loc":[-85.0956771,42.0916662]},"n1820939512":{"id":"n1820939512","loc":[-85.2323408,42.0273638]},"n1820939513":{"id":"n1820939513","loc":[-85.1232771,42.0762388]},"n1820939531":{"id":"n1820939531","loc":[-85.264608,41.9997828]},"n1820939533":{"id":"n1820939533","loc":[-85.4198808,42.0087914]},"n1820939535":{"id":"n1820939535","loc":[-85.3080864,41.9715677]},"n1820939536":{"id":"n1820939536","loc":[-85.1189426,42.0812596]},"n1820939537":{"id":"n1820939537","loc":[-85.2642741,41.9996764]},"n1820939538":{"id":"n1820939538","loc":[-85.2572531,42.0079627]},"n1820939539":{"id":"n1820939539","loc":[-85.2907807,41.9790174]},"n1820939540":{"id":"n1820939540","loc":[-85.3171415,41.9707301]},"n1820939541":{"id":"n1820939541","loc":[-85.08777,42.0953841]},"n1820939542":{"id":"n1820939542","loc":[-85.1239262,42.0773218]},"n1820939543":{"id":"n1820939543","loc":[-84.9973956,42.0877968]},"n1820939544":{"id":"n1820939544","loc":[-85.011606,42.0896161]},"n1820939545":{"id":"n1820939545","loc":[-85.4077358,42.0082971]},"n1820939546":{"id":"n1820939546","loc":[-85.3614945,41.9933717]},"n1820939547":{"id":"n1820939547","loc":[-85.3189118,41.9697649]},"n1820939550":{"id":"n1820939550","loc":[-85.1262691,42.0740221]},"n1820939551":{"id":"n1820939551","loc":[-85.3863639,41.9994635]},"n1820939552":{"id":"n1820939552","loc":[-85.2836034,41.9923953]},"n1820939554":{"id":"n1820939554","loc":[-85.3222377,41.9715916]},"n1820939555":{"id":"n1820939555","loc":[-85.0122658,42.0906312]},"n1820939556":{"id":"n1820939556","loc":[-85.0022652,42.0877581]},"n1820939557":{"id":"n1820939557","loc":[-85.1011314,42.0899954]},"n1820939559":{"id":"n1820939559","loc":[-85.0008181,42.0885293]},"n1820939561":{"id":"n1820939561","loc":[-85.3637046,41.9942488]},"n1820939562":{"id":"n1820939562","loc":[-85.4500117,42.0052892]},"n1820939563":{"id":"n1820939563","loc":[-85.0537636,42.1036365]},"n1820939565":{"id":"n1820939565","loc":[-85.2367503,42.0246939]},"n1820939566":{"id":"n1820939566","loc":[-85.0448479,42.1002653]},"n1820939567":{"id":"n1820939567","loc":[-85.6337065,41.9295006]},"n1820939568":{"id":"n1820939568","loc":[-85.0879792,42.095623]},"n1820939569":{"id":"n1820939569","loc":[-85.6347623,41.9352369]},"n1820939570":{"id":"n1820939570","loc":[-85.1497931,42.0620378]},"n1820939571":{"id":"n1820939571","loc":[-85.5676169,41.9656324]},"n1820939572":{"id":"n1820939572","loc":[-85.638041,41.9166971]},"n1820939573":{"id":"n1820939573","loc":[-85.4993429,41.9781293]},"n1820939574":{"id":"n1820939574","loc":[-85.5352831,41.9692127]},"n1820939575":{"id":"n1820939575","loc":[-84.9924429,42.0857118]},"n1820939577":{"id":"n1820939577","loc":[-85.0581101,42.1026721]},"n1820939578":{"id":"n1820939578","loc":[-85.641088,41.9094477]},"n1820939579":{"id":"n1820939579","loc":[-85.2548821,42.0052282]},"n1820939580":{"id":"n1820939580","loc":[-85.1124463,42.0859734]},"n1820939581":{"id":"n1820939581","loc":[-85.1083479,42.0857624]},"n1820939583":{"id":"n1820939583","loc":[-85.1387424,42.0648893]},"n1820939584":{"id":"n1820939584","loc":[-85.5152645,41.9700892]},"n1820939585":{"id":"n1820939585","loc":[-85.5463738,41.9713439]},"n1820939586":{"id":"n1820939586","loc":[-85.360207,41.9933717]},"n1820939587":{"id":"n1820939587","loc":[-85.2402372,42.0120917]},"n1820939588":{"id":"n1820939588","loc":[-85.3936381,42.0047255]},"n1820939589":{"id":"n1820939589","loc":[-85.3310246,41.973784]},"n1820939590":{"id":"n1820939590","loc":[-85.0329403,42.096642]},"n1820939591":{"id":"n1820939591","loc":[-85.0097271,42.0910981]},"n1820939593":{"id":"n1820939593","loc":[-85.0446562,42.1003437]},"n1820939595":{"id":"n1820939595","loc":[-85.0856671,42.1008452]},"n1820939596":{"id":"n1820939596","loc":[-85.4087228,42.0083449]},"n1820939597":{"id":"n1820939597","loc":[-85.0609519,42.1052564]},"n1820939598":{"id":"n1820939598","loc":[-85.3432126,41.9874548]},"n1820939599":{"id":"n1820939599","loc":[-85.4041738,42.0067027]},"n1820939600":{"id":"n1820939600","loc":[-85.0825437,42.1035768]},"n1820939601":{"id":"n1820939601","loc":[-85.048422,42.101498]},"n1820939602":{"id":"n1820939602","loc":[-85.0336256,42.0999031]},"n1820939603":{"id":"n1820939603","loc":[-85.046818,42.1014104]},"n1820939605":{"id":"n1820939605","loc":[-85.2856524,41.98078]},"n1820939607":{"id":"n1820939607","loc":[-85.1118173,42.0864245]},"n1820939609":{"id":"n1820939609","loc":[-85.0443397,42.1006263]},"n1820939610":{"id":"n1820939610","loc":[-85.0336698,42.0978361]},"n1820939611":{"id":"n1820939611","loc":[-85.4630322,42.0014248]},"n1820939612":{"id":"n1820939612","loc":[-85.0613127,42.1052353]},"n1820939613":{"id":"n1820939613","loc":[-85.0137571,42.0887801]},"n1820939614":{"id":"n1820939614","loc":[-85.272487,41.9982013]},"n1820939616":{"id":"n1820939616","loc":[-85.4665727,41.9983791]},"n1820939617":{"id":"n1820939617","loc":[-85.1288078,42.0725476]},"n1820939618":{"id":"n1820939618","loc":[-85.4653282,42.00109]},"n1820939619":{"id":"n1820939619","loc":[-85.2314717,42.0276746]},"n1820939620":{"id":"n1820939620","loc":[-85.255982,42.0003569]},"n1820939621":{"id":"n1820939621","loc":[-85.2886779,41.9787223]},"n1820939622":{"id":"n1820939622","loc":[-85.22438,42.0367509]},"n1820939623":{"id":"n1820939623","loc":[-85.0334713,42.0998382]},"n1820939624":{"id":"n1820939624","loc":[-85.2236504,42.037484]},"n1820939625":{"id":"n1820939625","loc":[-85.636908,41.9175162]},"n1820939627":{"id":"n1820939627","loc":[-85.2669187,41.9989707]},"n1820939628":{"id":"n1820939628","loc":[-85.3247268,41.9720702]},"n1820939629":{"id":"n1820939629","loc":[-85.3785104,41.9987299]},"n1820939630":{"id":"n1820939630","loc":[-85.5267658,41.9720515]},"n1820939631":{"id":"n1820939631","loc":[-85.2445116,42.0098811]},"n1820939632":{"id":"n1820939632","loc":[-85.1271448,42.0725077]},"n1820939633":{"id":"n1820939633","loc":[-85.0345751,42.099724]},"n1820939634":{"id":"n1820939634","loc":[-85.4217476,42.0089986]},"n1820939635":{"id":"n1820939635","loc":[-85.3121848,41.9689433]},"n1820939636":{"id":"n1820939636","loc":[-85.2826419,41.9929985]},"n1820939637":{"id":"n1820939637","loc":[-85.3160257,41.9706344]},"n1820939638":{"id":"n1820939638","loc":[-85.5684967,41.9657919]},"n1820939640":{"id":"n1820939640","loc":[-85.225131,42.0356194]},"n1820939642":{"id":"n1820939642","loc":[-85.1324124,42.0693328]},"n1820939644":{"id":"n1820939644","loc":[-84.9994073,42.0878843]},"n1820939645":{"id":"n1820939645","loc":[-85.1087596,42.0863329]},"n1820939646":{"id":"n1820939646","loc":[-85.2915532,41.9782996]},"n1820939647":{"id":"n1820939647","loc":[-84.9988708,42.0877808]},"n1820939648":{"id":"n1820939648","loc":[-85.2243628,42.0356728]},"n1820939649":{"id":"n1820939649","loc":[-85.0427397,42.1020524]},"n1820939650":{"id":"n1820939650","loc":[-85.6388392,41.9100752]},"n1820939651":{"id":"n1820939651","loc":[-85.0133709,42.0888557]},"n1820939652":{"id":"n1820939652","loc":[-85.318798,41.9701211]},"n1820939653":{"id":"n1820939653","loc":[-85.6335778,41.9190602]},"n1820939654":{"id":"n1820939654","loc":[-85.6338396,41.9370247]},"n1820939655":{"id":"n1820939655","loc":[-85.0939069,42.0931988]},"n1820939656":{"id":"n1820939656","loc":[-85.5702347,41.9651378]},"n1820939657":{"id":"n1820939657","loc":[-85.4235286,42.0088392]},"n1820939658":{"id":"n1820939658","loc":[-85.2740856,41.9972206]},"n1820939659":{"id":"n1820939659","loc":[-85.4824299,41.9934195]},"n1820939660":{"id":"n1820939660","loc":[-85.3857846,42.0014408]},"n1820939661":{"id":"n1820939661","loc":[-85.0451658,42.10028]},"n1820939662":{"id":"n1820939662","loc":[-85.3893036,42.001377]},"n1820939664":{"id":"n1820939664","loc":[-85.2455845,42.0088607]},"n1820939665":{"id":"n1820939665","loc":[-85.2741071,41.9951116]},"n1820939666":{"id":"n1820939666","loc":[-85.1298375,42.0677718]},"n1820939667":{"id":"n1820939667","loc":[-85.5491848,41.9707377]},"n1820939669":{"id":"n1820939669","loc":[-85.2780298,41.995238]},"n1820939670":{"id":"n1820939670","loc":[-85.1330068,42.0716926]},"n1820939671":{"id":"n1820939671","loc":[-85.0811342,42.1025129]},"n1820939672":{"id":"n1820939672","loc":[-85.2325124,42.0290135]},"n1820939673":{"id":"n1820939673","loc":[-85.2975077,41.9716953]},"n1820939674":{"id":"n1820939674","loc":[-85.0951729,42.0922394]},"n1820939676":{"id":"n1820939676","loc":[-85.0363252,42.1043119]},"n1820939677":{"id":"n1820939677","loc":[-85.2960057,41.97349]},"n1820939678":{"id":"n1820939678","loc":[-85.3701849,41.9982515]},"n1820939679":{"id":"n1820939679","loc":[-85.3381486,41.9848861]},"n1820939680":{"id":"n1820939680","loc":[-85.2058448,42.0417286]},"n1820939682":{"id":"n1820939682","loc":[-85.0819335,42.1034443]},"n1820939683":{"id":"n1820939683","loc":[-85.3872223,41.9993359]},"n1820939684":{"id":"n1820939684","loc":[-85.095366,42.091909]},"n1820939685":{"id":"n1820939685","loc":[-85.2327914,42.0291888]},"n1820939686":{"id":"n1820939686","loc":[-85.0433459,42.1018773]},"n1820939687":{"id":"n1820939687","loc":[-85.0585339,42.1027318]},"n1820939688":{"id":"n1820939688","loc":[-85.0062885,42.0876347]},"n1820939689":{"id":"n1820939689","loc":[-85.246299,42.017377]},"n1820939690":{"id":"n1820939690","loc":[-85.2932376,41.9742877]},"n1820939691":{"id":"n1820939691","loc":[-85.2962846,41.9736815]},"n1820939692":{"id":"n1820939692","loc":[-85.6052365,41.9409193]},"n1820939693":{"id":"n1820939693","loc":[-85.2570536,42.0003341]},"n1820939694":{"id":"n1820939694","loc":[-85.0488458,42.1014064]},"n1820939695":{"id":"n1820939695","loc":[-85.4050321,42.0069578]},"n1820939696":{"id":"n1820939696","loc":[-85.4847517,41.9845894]},"n1820939697":{"id":"n1820939697","loc":[-85.0844655,42.1013826]},"n1820939698":{"id":"n1820939698","loc":[-85.1437206,42.0650008]},"n1820939699":{"id":"n1820939699","loc":[-85.1168183,42.0864034]},"n1820939700":{"id":"n1820939700","loc":[-85.5479831,41.9711366]},"n1820939701":{"id":"n1820939701","loc":[-85.0349948,42.1034124]},"n1820939702":{"id":"n1820939702","loc":[-85.0835589,42.1038821]},"n1820939703":{"id":"n1820939703","loc":[-85.0203875,42.0902649]},"n1820939704":{"id":"n1820939704","loc":[-85.0371191,42.1038184]},"n1820939705":{"id":"n1820939705","loc":[-85.1273312,42.0735681]},"n1820939707":{"id":"n1820939707","loc":[-85.1272239,42.0730226]},"n1820939710":{"id":"n1820939710","loc":[-85.0349881,42.1019012]},"n1820939712":{"id":"n1820939712","loc":[-85.2440459,42.0178313]},"n1820939713":{"id":"n1820939713","loc":[-85.2444751,42.0182618]},"n1820939714":{"id":"n1820939714","loc":[-85.0539996,42.1032863]},"n1820939715":{"id":"n1820939715","loc":[-85.2215905,42.0373246]},"n1820939716":{"id":"n1820939716","loc":[-85.0649712,42.1051994]},"n1820939717":{"id":"n1820939717","loc":[-85.0927146,42.0927581]},"n1820939718":{"id":"n1820939718","loc":[-85.3884668,42.0042312]},"n1820939719":{"id":"n1820939719","loc":[-85.0840672,42.1013241]},"n1820939720":{"id":"n1820939720","loc":[-85.304739,41.9725408]},"n1820939721":{"id":"n1820939721","loc":[-85.2243585,42.0371334]},"n1820939722":{"id":"n1820939722","loc":[-85.0599823,42.1049686]},"n1820939723":{"id":"n1820939723","loc":[-85.0298825,42.0944288]},"n1820939724":{"id":"n1820939724","loc":[-85.0366095,42.1042443]},"n1820939725":{"id":"n1820939725","loc":[-85.0698783,42.1058135]},"n1820939726":{"id":"n1820939726","loc":[-85.1054551,42.0873361]},"n1820939727":{"id":"n1820939727","loc":[-84.9952324,42.0864285]},"n1820939728":{"id":"n1820939728","loc":[-85.3442211,41.9897993]},"n1820939729":{"id":"n1820939729","loc":[-85.4386134,42.0056822]},"n1820939730":{"id":"n1820939730","loc":[-85.2438528,42.0146589]},"n1820939731":{"id":"n1820939731","loc":[-85.0355581,42.1041846]},"n1820939732":{"id":"n1820939732","loc":[-85.557682,41.9724447]},"n1820939734":{"id":"n1820939734","loc":[-85.2299418,42.033314]},"n1820939735":{"id":"n1820939735","loc":[-85.6297412,41.9419088]},"n1820939736":{"id":"n1820939736","loc":[-85.2645101,41.9980259]},"n1820939738":{"id":"n1820939738","loc":[-85.082195,42.1035649]},"n1820939739":{"id":"n1820939739","loc":[-85.234272,42.0267102]},"n1820939740":{"id":"n1820939740","loc":[-85.0130758,42.0895006]},"n1820939741":{"id":"n1820939741","loc":[-85.4594702,42.0000375]},"n1820939742":{"id":"n1820939742","loc":[-84.9946745,42.0863687]},"n1820939743":{"id":"n1820939743","loc":[-85.6438775,41.9120186]},"n1820939744":{"id":"n1820939744","loc":[-85.6372685,41.9168089]},"n1820939745":{"id":"n1820939745","loc":[-85.2789468,41.9893208]},"n1820939747":{"id":"n1820939747","loc":[-85.3775019,41.998427]},"n1820939749":{"id":"n1820939749","loc":[-85.0993571,42.0909178]},"n1820939750":{"id":"n1820939750","loc":[-85.1308503,42.0669339]},"n1820939751":{"id":"n1820939751","loc":[-85.4802566,41.9856659]},"n1820939752":{"id":"n1820939752","loc":[-85.2543563,42.0108804]},"n1820939753":{"id":"n1820939753","loc":[-85.1041033,42.0878815]},"n1820939755":{"id":"n1820939755","loc":[-85.4000969,42.0071651]},"n1820939757":{"id":"n1820939757","loc":[-85.3858275,42.0022381]},"n1820939758":{"id":"n1820939758","loc":[-85.3653998,41.996609]},"n1820939759":{"id":"n1820939759","loc":[-85.2432949,42.0202305]},"n1820939760":{"id":"n1820939760","loc":[-85.3878874,42.0042472]},"n1820939761":{"id":"n1820939761","loc":[-85.2516741,42.0114145]},"n1820939762":{"id":"n1820939762","loc":[-85.2788825,41.9865142]},"n1820939763":{"id":"n1820939763","loc":[-85.0009147,42.0886686]},"n1820939764":{"id":"n1820939764","loc":[-85.3918142,42.003434]},"n1820939765":{"id":"n1820939765","loc":[-85.5532832,41.9696848]},"n1820939766":{"id":"n1820939766","loc":[-85.5545063,41.969254]},"n1820939768":{"id":"n1820939768","loc":[-85.1327989,42.0704769]},"n1820939770":{"id":"n1820939770","loc":[-85.0588558,42.1047696]},"n1820939772":{"id":"n1820939772","loc":[-85.555798,41.9713017]},"n1820939773":{"id":"n1820939773","loc":[-85.0565853,42.1023589]},"n1820939774":{"id":"n1820939774","loc":[-85.2582941,41.9992765]},"n1820939775":{"id":"n1820939775","loc":[-85.3007264,41.9727642]},"n1820939776":{"id":"n1820939776","loc":[-85.2477045,42.0082652]},"n1820939777":{"id":"n1820939777","loc":[-85.2415247,42.0104973]},"n1821006698":{"id":"n1821006698","loc":[-85.6345227,41.9382009]},"n1821006700":{"id":"n1821006700","loc":[-85.6344894,41.938975]},"n1821006704":{"id":"n1821006704","loc":[-85.6351181,41.9370157]},"n1821006706":{"id":"n1821006706","loc":[-85.6357554,41.9361657]},"n1821006708":{"id":"n1821006708","loc":[-85.6351235,41.9368481]},"n1821006710":{"id":"n1821006710","loc":[-85.6352844,41.9364211]},"n1821006712":{"id":"n1821006712","loc":[-85.6351503,41.937307]},"n1821006716":{"id":"n1821006716","loc":[-85.6350366,41.9379774]},"n1821006725":{"id":"n1821006725","loc":[-85.6352147,41.9375903]},"n1821137607":{"id":"n1821137607","loc":[-85.5297057,41.9669915]},"n1821137608":{"id":"n1821137608","loc":[-85.5288598,41.9673094]},"n1821139530":{"id":"n1821139530","loc":[-85.4832228,41.9881686]},"n1821139531":{"id":"n1821139531","loc":[-85.4812101,41.9851258]},"n1821139532":{"id":"n1821139532","loc":[-85.4799127,41.9860244]},"n1821139533":{"id":"n1821139533","loc":[-85.4800313,41.9865555]},"n1841425201":{"id":"n1841425201","loc":[-85.4334577,42.0063713]},"n1841425222":{"id":"n1841425222","loc":[-85.4382449,42.0055785]},"n1914861007":{"id":"n1914861007","loc":[-85.394959,42.0057472]},"n1914861057":{"id":"n1914861057","loc":[-85.3967185,42.0049695]},"n1914861112":{"id":"n1914861112","loc":[-85.394179,42.0056906]},"n1914861306":{"id":"n1914861306","loc":[-85.3900226,42.0028488]},"n2114807565":{"id":"n2114807565","loc":[-85.6385979,41.9577824]},"n2114807568":{"id":"n2114807568","loc":[-85.6325097,41.9775713]},"n2114807572":{"id":"n2114807572","loc":[-85.6328996,41.9980965]},"n2114807578":{"id":"n2114807578","loc":[-85.6344818,41.9696956]},"n2114807583":{"id":"n2114807583","loc":[-85.6326289,41.9757853]},"n2114807593":{"id":"n2114807593","loc":[-85.6360828,41.9650674]},"n2130304159":{"id":"n2130304159","loc":[-85.6352537,41.9450015],"tags":{"railway":"level_crossing"}},"n2139795852":{"id":"n2139795852","loc":[-85.6374708,41.9311633]},"n2139858882":{"id":"n2139858882","loc":[-85.635178,41.9356158]},"n2139858883":{"id":"n2139858883","loc":[-85.63533,41.9355886]},"n2139858884":{"id":"n2139858884","loc":[-85.6353819,41.93556]},"n2139858885":{"id":"n2139858885","loc":[-85.6353665,41.9355157]},"n2139858886":{"id":"n2139858886","loc":[-85.6353165,41.9354971]},"n2139858887":{"id":"n2139858887","loc":[-85.6352454,41.9355328]},"n2139858888":{"id":"n2139858888","loc":[-85.6350184,41.9357846]},"n2139858889":{"id":"n2139858889","loc":[-85.634978,41.9359448]},"n2139858890":{"id":"n2139858890","loc":[-85.6347723,41.9361523]},"n2139858891":{"id":"n2139858891","loc":[-85.6347165,41.9362667]},"n2139858892":{"id":"n2139858892","loc":[-85.6346992,41.9364312]},"n2139858893":{"id":"n2139858893","loc":[-85.634603,41.9366329]},"n2139858894":{"id":"n2139858894","loc":[-85.6345973,41.9367488]},"n2139858895":{"id":"n2139858895","loc":[-85.6345127,41.9369734]},"n2139858896":{"id":"n2139858896","loc":[-85.634478,41.9371923]},"n2139858897":{"id":"n2139858897","loc":[-85.6344838,41.9373768]},"n2139858898":{"id":"n2139858898","loc":[-85.6346242,41.9375299]},"n2139858899":{"id":"n2139858899","loc":[-85.6347723,41.9376357]},"n2139858900":{"id":"n2139858900","loc":[-85.6347607,41.9377788]},"n2139858901":{"id":"n2139858901","loc":[-85.6346204,41.9379533]},"n2139858902":{"id":"n2139858902","loc":[-85.6344184,41.9380105]},"n2139858903":{"id":"n2139858903","loc":[-85.6341627,41.9380406]},"n2139858904":{"id":"n2139858904","loc":[-85.634005,41.9381679]},"n2139858905":{"id":"n2139858905","loc":[-85.63393,41.9383353]},"n2139858906":{"id":"n2139858906","loc":[-85.6338588,41.9384597]},"n2139858907":{"id":"n2139858907","loc":[-85.6336627,41.9387759]},"n2139858908":{"id":"n2139858908","loc":[-85.6335127,41.9389361]},"n2139858933":{"id":"n2139858933","loc":[-85.6353118,41.9432646]},"n2139858934":{"id":"n2139858934","loc":[-85.6353952,41.9433002]},"n2139858935":{"id":"n2139858935","loc":[-85.6356496,41.9433255]},"n2139858936":{"id":"n2139858936","loc":[-85.6363128,41.9433373]},"n2139858937":{"id":"n2139858937","loc":[-85.6365467,41.9433779]},"n2139858938":{"id":"n2139858938","loc":[-85.6368692,41.9435265]},"n2139858939":{"id":"n2139858939","loc":[-85.6370986,41.9437039]},"n2139858940":{"id":"n2139858940","loc":[-85.6372371,41.9437732]},"n2139858941":{"id":"n2139858941","loc":[-85.6374756,41.9438171]},"n2139858942":{"id":"n2139858942","loc":[-85.6376164,41.9439286]},"n2139858943":{"id":"n2139858943","loc":[-85.6377504,41.944138]},"n2139858944":{"id":"n2139858944","loc":[-85.6384204,41.9443137]},"n2139858945":{"id":"n2139858945","loc":[-85.6385726,41.9444506]},"n2139858946":{"id":"n2139858946","loc":[-85.638702,41.9445739]},"n2139858947":{"id":"n2139858947","loc":[-85.6387179,41.9446516]},"n2139858948":{"id":"n2139858948","loc":[-85.6387088,41.9447985]},"n2139858949":{"id":"n2139858949","loc":[-85.6387656,41.9449877]},"n2139858950":{"id":"n2139858950","loc":[-85.638777,41.9451448]},"n2139858951":{"id":"n2139858951","loc":[-85.6387088,41.9452631]},"n2139858964":{"id":"n2139858964","loc":[-85.6383346,41.9442912]},"n2139858966":{"id":"n2139858966","loc":[-85.6384724,41.9443605]},"n2139858967":{"id":"n2139858967","loc":[-85.6354078,41.9434285]},"n2139858968":{"id":"n2139858968","loc":[-85.635271,41.943654]},"n2139858969":{"id":"n2139858969","loc":[-85.6352657,41.9437437]},"n2139858970":{"id":"n2139858970","loc":[-85.635271,41.9438195]},"n2139858971":{"id":"n2139858971","loc":[-85.6351563,41.9438906]},"n2139858972":{"id":"n2139858972","loc":[-85.6351384,41.9438882]},"n2139858973":{"id":"n2139858973","loc":[-85.6351514,41.9438034]},"n2139858974":{"id":"n2139858974","loc":[-85.6351237,41.9436641]},"n2139858975":{"id":"n2139858975","loc":[-85.6351498,41.9436108]},"n2139858976":{"id":"n2139858976","loc":[-85.6351058,41.9435345]},"n2139858977":{"id":"n2139858977","loc":[-85.6349641,41.9432051]},"n2139858986":{"id":"n2139858986","loc":[-85.6341205,41.9380746]},"n2139858990":{"id":"n2139858990","loc":[-85.6345671,41.9381816]},"n2139858995":{"id":"n2139858995","loc":[-85.6339783,41.9382273]},"n2139859003":{"id":"n2139859003","loc":[-85.6340477,41.9373489]},"n2139859004":{"id":"n2139859004","loc":[-85.6339784,41.9374752]},"n2139870406":{"id":"n2139870406","loc":[-85.6342265,41.9432605]},"n2139877106":{"id":"n2139877106","loc":[-85.6346323,41.9438746]},"n2139982399":{"id":"n2139982399","loc":[-85.6324055,41.9408537]},"n2139982400":{"id":"n2139982400","loc":[-85.632488,41.941063],"tags":{"leisure":"slipway"}},"n2139982401":{"id":"n2139982401","loc":[-85.6327261,41.9415366]},"n2139982402":{"id":"n2139982402","loc":[-85.6326391,41.9413598]},"n2139982403":{"id":"n2139982403","loc":[-85.6327041,41.9414391]},"n2139982405":{"id":"n2139982405","loc":[-85.6322891,41.9406009]},"n2139982406":{"id":"n2139982406","loc":[-85.6325412,41.9425257]},"n2139989333":{"id":"n2139989333","loc":[-85.6340584,41.9431731]},"n2140006331":{"id":"n2140006331","loc":[-85.6361751,41.9459744]},"n2140006334":{"id":"n2140006334","loc":[-85.636528,41.9459751]},"n2140006336":{"id":"n2140006336","loc":[-85.6370918,41.9458926]},"n2140006338":{"id":"n2140006338","loc":[-85.6378806,41.9456474]},"n2140006340":{"id":"n2140006340","loc":[-85.6385831,41.9454343]},"n2140006342":{"id":"n2140006342","loc":[-85.639341,41.945157]},"n2140006344":{"id":"n2140006344","loc":[-85.6393497,41.9450232]},"n2140006346":{"id":"n2140006346","loc":[-85.6388245,41.9450145]},"n2140006348":{"id":"n2140006348","loc":[-85.6388167,41.9441739]},"n2140006351":{"id":"n2140006351","loc":[-85.6382915,41.9441797]},"n2140006353":{"id":"n2140006353","loc":[-85.63828,41.9438109]},"n2140006355":{"id":"n2140006355","loc":[-85.6381949,41.9436009]},"n2140006357":{"id":"n2140006357","loc":[-85.6371904,41.9435918]},"n2140006359":{"id":"n2140006359","loc":[-85.6366966,41.9432727]},"n2140006361":{"id":"n2140006361","loc":[-85.6353755,41.9432744]},"n2140006365":{"id":"n2140006365","loc":[-85.6350906,41.9435472]},"n2140006366":{"id":"n2140006366","loc":[-85.6343461,41.9441573]},"n2140006395":{"id":"n2140006395","loc":[-85.6351171,41.9437175]},"n2140006397":{"id":"n2140006397","loc":[-85.635352,41.9450206]},"n2140006399":{"id":"n2140006399","loc":[-85.6358194,41.9454937]},"n2140006401":{"id":"n2140006401","loc":[-85.6348693,41.9445739]},"n2140006431":{"id":"n2140006431","loc":[-85.6376737,41.9438023]},"n2140006437":{"id":"n2140006437","loc":[-85.6382631,41.9442724]},"n2189123379":{"id":"n2189123379","loc":[-85.6342671,41.9352665]},"w203974076":{"id":"w203974076","tags":{"highway":"footway"},"nodes":["n2139870442","n2139870457","n2139870458","n2139870459","n2139870460","n2139870452"]},"w170989131":{"id":"w170989131","tags":{"name":"St Joseph River","waterway":"river"},"nodes":["n1820938225","n1820938712","n1820937596","n1820937574","n1820938515","n1820938330","n1820938678","n1820938240","n1820938950","n1820939226","n1820939575","n1820937913","n1820938223","n1820937668","n1820938545","n1820937584","n1820939742","n1820939727","n1820937578","n1820938149","n1820938124","n1820938888","n1820938898","n1820937922","n1820939543","n1820939370","n1820939401","n1820939647","n1820938345","n1820939644","n1820938333","n1820938370","n1820938624","n1820938493","n1820939559","n1820939763","n1820939237","n1820939416","n1820937810","n1820938317","n1820938324","n1820937558","n1820939556","n1820938298","n1820939348","n1820939125","n1820939081","n1820938859","n1820939126","n1820938881","n1820939439","n1820939324","n1820939128","n1820938101","n1820937706","n1820938382","n1820938776","n1820937815","n1820939177","n1820939688","n1820938952","n1820938216","n1820938387","n1820939333","n1820938243","n1820938248","n1820937666","n1820939051","n1820938332","n1820939438","n1820939407","n1820939361","n1820937517","n1820938770","n1820939591","n1820937857","n1820938491","n1820937993","n1820938125","n1820938166","n1820937746","n1820939028","n1820937638","n1820938676","n1820938843","n1820938844","n1820937978","n1820938730","n1820939544","n1820938304","n1820939123","n1820939494","n1820939450","n1820939555","n1820938133","n1820938129","n1820938871","n1820939408","n1820938669","n1820938260","n1820939740","n1820937625","n1820938631","n1820939651","n1820939613","n1820937850","n1820938325","n1820937736","n1820938804","n1820938837","n1820938014","n1820938991","n1820938722","n1820938935","n1820937870","n1820938432","n1820937986","n1820938756","n1820938966","n1820939159","n1820937744","n1820938334","n1820937645","n1820939394","n1820937656","n1820938392","n1820939703","n1820938385","n1820938947","n1820938854","n1820938428","n1820938488","n1820938269","n1820938668","n1820938268","n1820938707","n1820937732","n1820939144","n1820938481","n1820938771","n1820938686","n1820938948","n1820937997","n1820937769","n1820939003","n1820938083","n1820939011","n1820938803","n1820938700","n1820939723","n1820938808","n1820938262","n1820938081","n1820938926","n1820938326","n1820938102","n1820938508","n1820939590","n1820939199","n1820938084","n1820938870","n1820938895","n1820937611","n1820938918","n1820938514","n1820939610","n1820938910","n1820937523","n1820938127","n1820939108","n1820937981","n1820938938","n1820938715","n1820939016","n1820938237","n1820939623","n1820939602","n1820937734","n1820938977","n1820939633","n1820939156","n1820939406","n1820938279","n1820938301","n1820937678","n1820937671","n1820939163","n1820938356","n1820939372","n1820937568","n1820937626","n1820939710","n1820939004","n1820938253","n1820938571","n1820937513","n1820939412","n1820939701","n1820939509","n1820938839","n1820939731","n1820937798","n1820939676","n1820939724","n1820939243","n1820939704","n1820937814","n1820937599","n1820938199","n1820938995","n1820938445","n1820938069","n1820938470","n1820939074","n1820938193","n1820938740","n1820938047","n1820939507","n1820939441","n1820939160","n1820937849","n1820937840","n1820938052","n1820938988","n1820938796","n1820937724","n1820937620","n1820939304","n1820938343","n1820939649","n1820938875","n1820939686","n1820938476","n1820937801","n1820937737","n1820938264","n1820939609","n1820939496","n1820939593","n1820939566","n1820939661","n1820937782","n1820938912","n1820939173","n1820937733","n1820938953","n1820939603","n1820937607","n1820938468","n1820939601","n1820939694","n1820939133","n1820938897","n1820938893","n1820937831","n1820937730","n1820938820","n1820938046","n1820938426","n1820938347","n1820937582","n1820938954","n1820938033","n1820938104","n1820938680","n1820939563","n1820939404","n1820939714","n1820939000","n1820937992","n1820938168","n1820939510","n1820939500","n1820937509","n1820938865","n1820939773","n1820938138","n1820938905","n1820937623","n1820939418","n1820937946","n1820939577","n1820937615","n1820939687","n1820939119","n1820937988","n1820938337","n1820937750","n1820938703","n1820938339","n1820939044","n1820939770","n1820938913","n1820937672","n1820939722","n1820937768","n1820939597","n1820939612","n1820937699","n1820937682","n1820937669","n1820937657","n1820939363","n1820937800","n1820938265","n1820937760","n1820938207","n1820938115","n1820939130","n1820939716","n1820938338","n1820938239","n1820939040","n1820938064","n1820938855","n1820939015","n1820938258","n1820939042","n1820939043","n1820938443","n1820939725","n1820937675","n1820938568","n1820938280","n1820937705","n1820938775","n1820938636","n1820938626","n1820937859","n1820938096","n1820937852","n1820939039","n1820938247","n1820938585","n1820937707","n1820938117","n1820938909","n1820939115","n1820939335","n1820938805","n1820937935","n1820937876","n1820938699","n1820937869","n1820938603","n1820938100","n1820938500","n1820938283","n1820938275","n1820938923","n1820938365","n1820938349","n1820937804","n1820937903","n1820937608","n1820938688","n1820939671","n1820938092","n1820937820","n1820938753","n1820938922","n1820937990","n1820939682","n1820939738","n1820939600","n1820938167","n1820937726","n1820939702","n1820938209","n1820939456","n1820937837","n1820938222","n1820938902","n1820939162","n1820938965","n1820938461","n1820937681","n1820937514","n1820937764","n1820939719","n1820939697","n1820938899","n1820939093","n1820938702","n1820939595","n1820938749","n1820938348","n1820937606","n1820938675","n1820938830","n1820938737","n1820938758","n1820938716","n1820939107","n1820937863","n1820939033","n1820938163","n1820937867","n1820938819","n1820938034","n1820938252","n1820937563","n1820937868","n1820939032","n1820938632","n1820937982","n1820937943","n1820939568","n1820939541","n1820938215","n1820939097","n1820938812","n1820937518","n1820937952","n1820938711","n1820938736","n1820939066","n1820937591","n1820938082","n1820938108","n1820938496","n1820939410","n1820938949","n1820938327","n1820937708","n1820939023","n1820937772","n1820938256","n1820939083","n1820938378","n1820938961","n1820937610","n1820939717","n1820938695","n1820938590","n1820939655","n1820938341","n1820939054","n1820939157","n1820939674","n1820939684","n1820939511","n1820937631","n1820939458","n1820937830","n1820937709","n1820937779","n1820939749","n1820938880","n1820938856","n1820938557","n1820939557","n1820938249","n1820938818","n1820937594","n1820939114","n1820938416","n1820937508","n1820938990","n1820938201","n1820937759","n1820937987","n1820939164","n1820939753","n1820938187","n1820939067","n1820937586","n1820937941","n1820938121","n1820937807","n1820938521","n1820939726","n1820938244","n1820939014","n1820938741","n1820937629","n1820938664","n1820938747","n1820939082","n1820938709","n1820938320","n1820938270","n1820937619","n1820937777","n1820937718","n1820939138","n1820938056","n1820938155","n1820938596","n1820937775","n1820938437","n1820938128","n1820939581","n1820939145","n1820938546","n1820938184","n1820937601","n1820937794","n1820938539","n1820939645","n1820938438","n1820938436","n1820939025","n1820938915","n1820938534","n1820937605","n1820939607","n1820939101","n1820939580","n1820939268","n1820939134","n1820938849","n1820938754","n1820938079","n1820937842","n1820938781","n1820938873","n1820938495","n1820938381","n1820938503","n1820939436","n1820938502","n1820939087","n1820938996","n1820938449","n1820938907","n1820937979","n1820937780","n1820937546","n1820939699","n1820937677","n1820938957","n1820938946","n1820937776","n1820937717","n1820938718","n1820937637","n1820938510","n1820937663","n1820938941","n1820939151","n1820937603","n1820938250","n1820937951","n1820938630","n1820938821","n1820938779","n1820938497","n1820938159","n1820939536","n1820938409","n1820938386","n1820939116","n1820938340","n1820939117","n1820938291","n1820938435","n1820937819","n1820938242","n1820939078","n1820938877","n1820939104","n1820939445","n1820938367","n1820938903","n1820939420","n1820938517","n1820939508","n1820939542","n1820939326","n1820938210","n1820939020","n1820938815","n1820937832","n1820939513","n1820937818","n1820939005","n1820938717","n1820939135","n1820938384","n1820937587","n1820939024","n1820939504","n1820939120","n1820939026","n1820938015","n1820938998","n1820937648","n1820939137","n1820937761","n1820938195","n1820938535","n1820939550","n1820938725","n1820938282","n1820937781","n1820937792","n1820939705","n1820937788","n1820939707","n1820937882","n1820939632","n1820938427","n1820938276","n1820939617","n1820939013","n1820939035","n1820937543","n1820939365","n1820937752","n1820937802","n1820939183","n1820939670","n1820938450","n1820939375","n1820937813","n1820937673","n1820937783","n1820939029","n1820939768","n1820939377","n1820937974","n1820939244","n1820939642","n1820937864","n1820938255","n1820938528","n1820939666","n1820938120","n1820937812","n1820938928","n1820939750","n1820939099","n1820938073","n1820938714","n1820939140","n1820938192","n1820937844","n1820938635","n1820938742","n1820939583","n1820937887","n1820938318","n1820938816","n1820939698","n1820938273","n1820939181","n1820937652","n1820938748","n1820937651","n1820938519","n1820938019","n1820938752","n1820938235","n1820939118","n1820938562","n1820939314","n1820939570","n1820938190","n1820938342","n1820938533","n1820937977","n1820939089","n1820939146","n1820938622","n1820938297","n1820938524","n1820939283","n1820938874","n1820938832","n1820937550","n1820937843","n1820938638","n1820938116","n1820938206","n1820938319","n1820939053","n1820937845","n1820938093","n1820939217","n1820938997","n1820939355","n1820938861","n1820938726","n1820938057","n1820939373","n1820937862","n1820938518","n1820939072","n1820939680","n1820938444","n1820938217","n1820938506","n1820938393","n1820938492","n1820938852","n1820938221","n1820938773","n1820937684","n1820939060","n1820938224","n1820938203","n1820938840","n1820937525","n1820938147","n1820938433","n1820938188","n1820939359","n1820938750","n1820938016","n1820938768","n1820937621","n1820937799","n1820938951","n1820938721","n1820939037","n1820937866","n1820939715","n1820938063","n1820938446","n1820937627","n1820939624","n1820938431","n1820939721","n1820939622","n1820939239","n1820939263","n1820939648","n1820939640","n1820938867","n1820938757","n1820938439","n1820939352","n1820937740","n1820939329","n1820938229","n1820937583","n1820938180","n1820938366","n1820937767","n1820937758","n1820939374","n1820938869","n1820938292","n1820938400","n1820938399","n1820939734","n1820939289","n1820938944","n1820937755","n1820938759","n1820938434","n1820937600","n1820937825","n1820937670","n1820937793","n1820938011","n1820938246","n1820938956","n1820937770","n1820937757","n1820938059","n1820937860","n1820937569","n1820939266","n1820939685","n1820939672","n1820938606","n1820938772","n1820939038","n1820938211","n1820938359","n1820939619","n1820938708","n1820939512","n1820938065","n1820939233","n1820939739","n1820938786","n1820938879","n1820939147","n1820938563","n1820939148","n1820937839","n1820937659","n1820937786","n1820938419","n1820939565","n1820939402","n1820937710","n1820938254","n1820938271","n1820938390","n1820937680","n1820938140","n1820937817","n1820938218","n1820937985","n1820939235","n1820938441","n1820938401","n1820938719","n1820937795","n1820938971","n1820938460","n1820939759","n1820937972","n1820937841","n1820938462","n1820939320","n1820938978","n1820938360","n1820939713","n1820937676","n1820939712","n1820937939","n1820938080","n1820937754","n1820937753","n1820938530","n1820937886","n1820939689","n1820939124","n1820938697","n1820938789","n1820939105","n1820938860","n1820938853","n1820939400","n1820937561","n1820938404","n1820938774","n1820939316","n1820937696","n1820938782","n1820938975","n1820937564","n1820939730","n1820938257","n1820937853","n1820938487","n1820938848","n1820938906","n1820939230","n1820938424","n1820938051","n1820937771","n1820939587","n1820939149","n1820938792","n1820939041","n1820938934","n1820939777","n1820937515","n1820939058","n1820938312","n1820939264","n1820939631","n1820939109","n1820939403","n1820939664","n1820938724","n1820938929","n1820939399","n1820939776","n1820939369","n1820939185","n1820937701","n1820938126","n1820938336","n1820938219","n1820939080","n1820938642","n1820938043","n1820937725","n1820938548","n1820938552","n1820938035","n1820938684","n1820937778","n1820938764","n1820939021","n1820939346","n1820937712","n1820939761","n1820938397","n1820937747","n1820938566","n1820939161","n1820939090","n1820939752","n1820939271","n1820938878","n1820938110","n1820938346","n1820938499","n1820938151","n1820939538","n1820938281","n1820939153","n1820938551","n1820939285","n1820938197","n1820938408","n1820938482","n1820939036","n1820939579","n1820938489","n1820938483","n1820938189","n1820938123","n1820938087","n1820937741","n1820938485","n1820937590","n1820938972","n1820937773","n1820937520","n1820938872","n1820938131","n1820938452","n1820938328","n1820939620","n1820937641","n1820938353","n1820939693","n1820938705","n1820937640","n1820939189","n1820938144","n1820939774","n1820938694","n1820938238","n1820939397","n1820937917","n1820938454","n1820938567","n1820938979","n1820938060","n1820938204","n1820937828","n1820939232","n1820938806","n1820938857","n1820938078","n1820938105","n1820939228","n1820938604","n1820937763","n1820937854","n1820938289","n1820939736","n1820937937","n1820937714","n1820938278","n1820938058","n1820938706","n1820938989","n1820938313","n1820938520","n1820938288","n1820937689","n1820939537","n1820939531","n1820939019","n1820937527","n1820938455","n1820938814","n1820938045","n1820939627","n1820938213","n1820938161","n1820938331","n1820938024","n1820938220","n1820938062","n1820938178","n1820937796","n1820937644","n1820938490","n1820937589","n1820937879","n1820939614","n1820938882","n1820938039","n1820938538","n1820937667","n1820937719","n1820938561","n1820939658","n1820938783","n1820938601","n1820938198","n1820938388","n1820938969","n1820937687","n1820939086","n1820939665","n1820939187","n1820938498","n1820938261","n1820937983","n1820938068","n1820938136","n1820939061","n1820938137","n1820938186","n1820939071","n1820937592","n1820939669","n1820937553","n1820939357","n1820938727","n1820939371","n1820939112","n1820939079","n1820938743","n1820938467","n1820938834","n1820938022","n1820938537","n1820938122","n1820938516","n1820937614","n1820937612","n1820939469","n1820939636","n1820939050","n1820939552","n1820938157","n1820938663","n1820938955","n1820939091","n1820938430","n1820938471","n1820937809","n1820938074","n1820938208","n1820938914","n1820938858","n1820938417","n1820937531","n1820938107","n1820939100","n1820938751","n1820937711","n1820938824","n1820939745","n1820937572","n1820938602","n1820938212","n1820938097","n1820937921","n1820938090","n1820938511","n1820938876","n1820939762","n1820938234","n1820938048","n1820937774","n1820937856","n1820937749","n1820937765","n1820938286","n1820939095","n1820938480","n1820939229","n1820938277","n1820937617","n1820938311","n1820937622","n1820939196","n1820937690","n1820939006","n1820939287","n1820939131","n1820938106","n1820938784","n1820938335","n1820938095","n1820938182","n1820937715","n1820937683","n1820938070","n1820939605","n1820938527","n1820938763","n1820938398","n1820937686","n1820939621","n1820937664","n1820939277","n1820938565","n1820939539","n1820938099","n1820939646","n1820938556","n1820937548","n1820938729","n1820939336","n1820938259","n1820938728","n1820938361","n1820937643","n1820938644","n1820939007","n1820939690","n1820939227","n1820937635","n1820937950","n1820938682","n1820939150","n1820939012","n1820939261","n1820939111","n1820937805","n1820939691","n1820939677","n1820937628","n1820937811","n1820938790","n1820938251","n1820938226","n1820938942","n1820937633","n1820937984","n1820937751","n1820939673","n1820938970","n1820938415","n1820938597","n1820938309","n1820938111","n1820938472","n1820938894","n1820938402","n1820937593","n1820938570","n1820939102","n1820939775","n1820937948","n1820939121","n1820937511","n1820938787","n1820939720","n1820939075","n1820937880","n1820937742","n1820937721","n1820939535","n1820938486","n1820938354","n1820937632","n1820939010","n1820938885","n1820938089","n1820937613","n1820938442","n1820938245","n1820938272","n1820937566","n1820938295","n1820938532","n1820938883","n1820937713","n1820937674","n1820939635","n1820938448","n1820938355","n1820938587","n1820938559","n1820937787","n1820939301","n1820937723","n1820939056","n1820937560","n1820938323","n1820938230","n1820938453","n1820938377","n1820938357","n1820939637","n1820938017","n1820939540","n1820939376","n1820937639","n1820937642","n1820938075","n1820938351","n1820938766","n1820937897","n1820938973","n1820938066","n1820939547","n1820939652","n1820937944","n1820937748","n1820939234","n1820939193","n1820937891","n1820938785","n1820939132","n1820938523","n1820938884","n1820938411","n1820939554","n1820938791","n1820937655","n1820938368","n1820939152","n1820938030","n1820938447","n1820937580","n1820939628","n1820937588","n1820937894","n1820939201","n1820938086","n1820937650","n1820938379","n1820939008","n1820938999","n1820937524","n1820937872","n1820938389","n1820939197","n1820938422","n1820938936","n1820939262","n1820937634","n1820938583","n1820939589","n1820937901","n1820939034","n1820939065","n1820938290","n1820939195","n1820938228","n1820937884","n1820938797","n1820938191","n1820939191","n1820939198","n1820937892","n1820939679","n1820938507","n1820937647","n1820937909","n1820938542","n1820939598","n1820937851","n1820939084","n1820939728","n1820937688","n1820938263","n1820938670","n1820937762","n1820939310","n1820938925","n1820938862","n1820938822","n1820938547","n1820937731","n1820938594","n1820938592","n1820938214","n1820938284","n1820937835","n1820938599","n1820939437","n1820937834","n1820937576","n1820937692","n1820939586","n1820939546","n1820938403","n1820937970","n1820939561","n1820938098","n1820938851","n1820938477","n1820938892","n1820939045","n1820939758","n1820939350","n1820938321","n1820938440","n1820938595","n1820938364","n1820938962","n1820938118","n1820939678","n1820938406","n1820938549","n1820937555","n1820938823","n1820937521","n1820939471","n1820939487","n1820938799","n1820938605","n1820937928","n1820938373","n1820939747","n1820939629","n1820937557","n1820937526","n1820938958","n1820938833","n1820937636","n1820938967","n1820938760","n1820938842","n1820938067","n1820939077","n1820939224","n1820938185","n1820939110","n1820938372","n1820939757","n1820939063","n1820939660","n1820938813","n1820937528","n1820938369","n1820938896","n1820939551","n1820939683","n1820937660","n1820937873","n1820938810","n1820938478","n1820939662","n1820937595","n1820939052","n1820938113","n1820939070","n1820938733","n1820937878","n1820938300","n1820939760","n1820939718","n1820937646","n1820939057","n1820939443","n1914861306","n1820938013","n1820937529","n1820939764","n1820938826","n1820937885","n1820939588","n1820937865","n1820937833","n1914861112","n1820938761","n1914861007","n1820937905","n1820938541","n1820939092","n1914861057","n1820938153","n1820938267","n1820939265","n1820938085","n1820939018","n1820939755","n1820938474","n1820939027","n1820938593","n1820938202","n1820939599","n1820939695","n1820938077","n1820938012","n1820939545","n1820939596","n1820939337","n1820938227","n1820937698","n1820938475","n1820939465","n1820938165","n1820938698","n1820938525","n1820938529","n1820938553","n1820938940","n1820939498","n1820938501","n1820939533","n1820938924","n1820939634","n1820939220","n1820939657","n1820938887","n1820938838","n1820938114","n1820937823","n1820938778","n1820938801","n1820939096","n1820938981","n1820937953","n1820938732","n1820938980","n1820938960","n1820937949","n1820938026","n1820939273","n1841425201","n1820938629","n1820938864","n1820938554","n1820938088","n1820937685","n1841425222","n1820939729","n1820937665","n1820937838","n1820937739","n1820938780","n1820937821","n1820938825","n1820939055","n1820939485","n1820938041","n1820938746","n1820939562","n1820938459","n1820939489","n1820938050","n1820937980","n1820937695","n1820938413","n1820938555","n1820937703","n1820938536","n1820938196","n1820938287","n1820938169","n1820939279","n1820938531","n1820938959","n1820939741","n1820938665","n1820938963","n1820939611","n1820937653","n1820939618","n1820939492","n1820938600","n1820938628","n1820939312","n1820939616","n1820937738","n1820939001","n1820939062","n1820938794","n1820938558","n1820937822","n1820937532","n1820939073","n1820938200","n1820938241","n1820938968","n1820938927","n1820938306","n1820937630","n1820938456","n1820937694","n1820938908","n1820939076","n1820937522","n1820939659","n1820938522","n1820939318","n1820938932","n1820938841","n1820937579","n1820937540","n1820938560","n1821139530","n1820938964","n1820937662","n1820939281","n1821139533","n1820937797","n1821139532","n1820939751","n1821139531","n1820939291","n1820938420","n1820939696","n1820938904","n1820938484","n1820939448","n1820939009","n1820938735","n1820938986","n1820938937","n1820939030","n1820938734","n1820938745","n1820939106","n1820938987","n1820937858","n1820938673","n1820938620","n1820937808","n1820937700","n1820939573","n1820938540","n1820937661","n1820937570","n1820938396","n1820937875","n1820939048","n1820938233","n1820938793","n1820939584","n1820938412","n1820938394","n1820937846","n1820938800","n1820938690","n1820939331","n1820939630","n1820938762","n1820938710","n1820939322","n1820938992","n1821137608","n1821137607","n1820937924","n1820939139","n1820939463","n1820939574","n1820938294","n1820938071","n1820938307","n1820938061","n1820939260","n1820937899","n1820938310","n1820938983","n1820937530","n1820938993","n1820938890","n1820937915","n1820938231","n1820938040","n1820938920","n1820939585","n1820938135","n1820939700","n1820937824","n1820939667","n1820937930","n1820938134","n1820937551","n1820939405","n1820938232","n1820937716","n1820937848","n1820939765","n1820939068","n1820939766","n1820937933","n1820937720","n1820939222","n1820939772","n1820939022","n1820939732","n1820937702","n1820937691","n1820938945","n1820937756","n1820938451","n1820938410","n1820938798","n1820937945","n1820937654","n1820938598","n1820938836","n1820937571","n1820937556","n1820938994","n1820938919","n1820938863","n1820939064","n1820938018","n1820937658","n1820937537","n1820938142","n1820938666","n1820937535","n1820939571","n1820938465","n1820939638","n1820937533","n1820939656","n1820939422","n1820938109","n1820938405","n1820938028","n1820937649","n1820938829","n1820939031","n1820939155","n1820938350","n1820938463","n1820938425","n1820939047","n1820938831","n1820938494","n1820937697","n1820938504","n1820938900","n1820937784","n1820938414","n1820938076","n1820938723","n1820937722","n1820938739","n1820937791","n1820938985","n1820938352","n1820938293","n1820938274","n1820939692","n1820937871","n1820939059","n1820938868","n1820937877","n1820937743","n1820938429","n1820937545","n1820937575","n1820938302","n1820938505","n1820938916","n1820938374","n1820938329","n1820937790","n1820939735","n1820938930","n1820937995","n1820938512","n1820938130","n1820938194","n1820938671","n1820938802","n1820937542","n1820937602","n1820939069","n1820938901","n1820939654","n1820937727","n1820939569","n1820938375","n1820939306","n1820938479","n1820938376","n1820938667","n1820937766","n1820939467","n1820939567","n1820937806","n1820938943","n1820938931","n1820937745","n1820939452","n1820938738","n1820938053","n1820939653","n1820938640","n1820937604","n1820937536","n1820938701","n1820939625","n1820939744","n1820939572","n1820937577","n1820937541","n1820938891","n1820937597","n1820938469","n1820939194","n1820937539","n1820938911","n1820939017","n1820939650","n1820939103","n1820939578","n1820938132","n1820937549","n1820938634","n1820939743","n1820937544","n1820937826","n1820937598","n1820937547","n1820938032","n1820939142"]},"w17963021":{"id":"w17963021","tags":{"highway":"residential"},"nodes":["n185948706","n185948708","n185948710"]},"w203974069":{"id":"w203974069","tags":{"amenity":"shelter","area":"yes","building":"yes","shelter_type":"picnic_shelter"},"nodes":["n2139870431","n2139870432","n2139870433","n2139870434","n2139870431"]},"w209816575":{"id":"w209816575","tags":{"area":"yes","building":"yes"},"nodes":["n2199856288","n2199856289","n2199856290","n2199856291","n2199856292","n2199856293","n2199856294","n2199856295","n2199856296","n2199856297","n2199856298","n2199856299","n2199856300","n2199856301","n2199856302","n2199856303","n2199856288"]},"w203841838":{"id":"w203841838","tags":{"area":"yes","natural":"water"},"nodes":["n2138493826","n2138493827","n2138493828","n2138493829","n2138493830","n2138493831","n2138493833","n2138493832","n2138493826"]},"w203972937":{"id":"w203972937","tags":{"highway":"path","name":"Riverwalk Trail","surface":"asphalt","width":"3"},"nodes":["n2139858882","n2139858883","n2139858884","n2139858885","n2139858886","n2139858887","n2139858882","n2139858888","n2139858889","n2139858890","n2139858891","n2139858892","n2139858893","n2139858894","n2139858895","n2139858896","n2139858897","n2139858898","n2139858899","n2139858900","n2139858901","n2139858902","n2139858903","n2139858986","n2139858904","n2139858995","n2139858905","n2139858906","n2139858907","n2139858908","n2139858909","n2139858910","n2139858911","n2139858912","n2139858913","n2139858914","n2139858915","n2139858916","n2139858917","n2139858918","n2139858919","n2139858920","n2139858921","n2139858922","n2139858923","n2139858924","n2139858925","n2139858926","n2139858927","n2139858982","n2139858928","n2139858929","n2139858930","n2139858931","n2139858932","n2139858981","n2139858933","n2139858934","n2139858935","n2139858936","n2139858937","n2139858938","n2139858939","n2139858940","n2139858941","n2139858942","n2139858943","n2140006437","n2139858964","n2139858944","n2139858966","n2139858945","n2139858946","n2139858947","n2139858948","n2139858949","n2139858950","n2139858951"]},"w17964015":{"id":"w17964015","tags":{"highway":"residential"},"nodes":["n185954680","n185954683","n185954685","n185954687","n185954689","n185954690","n185954691","n2139870379","n2139870456","n185954692","n185954693","n185954695"]},"w17967315":{"id":"w17967315","tags":{"highway":"residential","name":"South Andrews Street"},"nodes":["n185981999","n185974477","n185964963"]},"w203974071":{"id":"w203974071","tags":{"highway":"footway"},"nodes":["n2139870439","n2139870440","n2139870441","n2139870442","n2139870443","n2139870444","n2139870445","n2139870446","n2139870447","n2139870448","n2139870449"]},"w170848824":{"id":"w170848824","tags":{"name":"Rocky River","waterway":"river"},"nodes":["n1819858503","n1819858531","n1819858526","n1819858518","n1819858505","n1819858508","n1819858512","n1819858514","n1819858528","n1819858509","n1819858511","n1819858507","n1819858521"]},"w203986458":{"id":"w203986458","tags":{"amenity":"shelter","area":"yes","shelter_type":"picnic_shelter"},"nodes":["n2139989357","n2139989359","n2139989360","n2139989362","n2139989357"]},"w170844917":{"id":"w170844917","tags":{"waterway":"riverbank"},"nodes":["n1819805911","n1819805690","n1819805812","n1819805766","n1819805802","n1819805885","n1819805626","n1819805842","n1819805715","n1819805694","n1819805618","n1819805629","n1819805731","n1819805636","n1819805878","n1819805718","n1819805798","n1819849057","n1819805666","n1819805852","n1819805805","n1819805789","n1819805868","n1819805680","n1819805918","n1819848888","n1819805762","n2139989328","n1819805907","n2139989330","n1819805915","n1819858521","n1819805854","n1819805876","n1819805864","n1819805922","n2139859004","n1819805702","n2139859003","n1819805614","n1819805792","n1819805786","n1819805777","n1819805645","n1819805838","n1819805889","n1819805795","n1819805707","n1819805774","n1819805808","n1819805810","n1819805724","n1819805676","n1819805728","n1819805783","n1819805687","n1819805727","n2189123379","n1819805632","n1819805641","n1819805760","n1819805887","n1819805861","n1819805722","n1819805880","n2139982405","n2139982399","n2139982400","n1819805770","n2139982402","n2139982403","n2139982401","n1819805780","n1819805834","n2139982406","n1819805698","n1819805647","n1819805870","n1819805683","n1819805622","n1819805639","n1819805858","n1819805643","n1819805673","n1819805925","n1819805849","n1819805711","n1819805846","n1819805669","n1819805883","n1819805814","n1819805873","n1819805911"]},"w17967326":{"id":"w17967326","tags":{"highway":"residential","name":"North Constantine Street"},"nodes":["n185985217","n185985219","n185985221","n185985222","n185985223","n185985225","n2140006431","n185985227","n185985229","n185985231","n185985233","n185985235","n185985238","n185985240","n2140018998","n185964965"]},"w134150789":{"id":"w134150789","tags":{"highway":"primary","name":"West Michigan Avenue","old_ref":"US 131","ref":"US 131 Business;M 60"},"nodes":["n185964971","n2139870406","n185964972"]},"w17966400":{"id":"w17966400","tags":{"highway":"tertiary","name":"South Constantine Street"},"nodes":["n185958672","n185964965"]},"w203974066":{"id":"w203974066","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2139870417","n2139870418","n2139870420","n2139870419"]},"w17965998":{"id":"w17965998","tags":{"name":"Conrail Railroad","railway":"rail"},"nodes":["n185972775","n185972777","n185972779","n185972781","n185972783","n185972785","n185972787","n185972788","n185972789","n185972790","n185972791","n185972793","n185972795","n185972797","n185972798","n185972800","n185972802","n185972805","n185972807","n185972809","n185972811","n185972813","n185972814","n185972815","n185972816","n185972817","n185972819","n185972821","n185972824","n185972826","n185972830","n185972832","n185972834","n185972835","n185972836","n185972839","n185990434","n2114807572","n2114807568","n185972845","n2114807583","n185972847","n185972849","n185972851","n2114807578","n1475293254","n2114807593","n1475293226","n185972862","n2114807565","n185951869","n1475293234","n1475293252","n185972868","n1475293264","n1475293222","n185972878","n1475293261","n185972882","n185972885","n1475293260","n1475293240","n185972891","n185972895","n185972897","n185972899","n2130304159","n1475284023","n185972903"]},"w134150795":{"id":"w134150795","tags":{"bridge":"yes","highway":"primary","name":"West Michigan Avenue","old_ref":"US 131","ref":"US 131 Business;M 60"},"nodes":["n185964970","n185964971"]},"w203974067":{"id":"w203974067","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2139870420","n2139870421"]},"w170995908":{"id":"w170995908","tags":{"highway":"residential","name":"Thomas Street"},"nodes":["n1821006702","n1821006700","n1821006698","n2139858990","n1821006716","n1821006725","n1821006712","n1821006704","n1821006708","n1821006710","n1821006706"]},"w17965834":{"id":"w17965834","tags":{"highway":"residential","name":"Spring Street"},"nodes":["n185971361","n185971364","n185971366","n185971368","n185954695","n185964968"]},"w203974070":{"id":"w203974070","tags":{"amenity":"shelter","area":"yes","building":"yes","shelter_type":"picnic_shelter"},"nodes":["n2139870435","n2139870436","n2139870437","n2139870438","n2139870435"]},"w203989879":{"id":"w203989879","tags":{"highway":"service"},"nodes":["n2140018998","n2140018999","n2140019000"]},"w203974062":{"id":"w203974062","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139870387","n2139870388","n2139870389","n2139870390","n2139870391","n2139870392","n2139870397","n2139870393","n2139870396","n2139870395","n2139870394","n2139870387"]},"w203974061":{"id":"w203974061","tags":{"bridge":"yes","highway":"footway"},"nodes":["n2139870382","n2139870383"]},"w203049587":{"id":"w203049587","tags":{"area":"yes","name":"Scidmore Park Petting Zoo","tourism":"zoo","zoo":"petting_zoo"},"nodes":["n2130304133","n2130304136","n2130304138","n2130304140","n2130304142","n2130304144","n2130304146","n2130304147","n2130304148","n2130304149","n2130304150","n2130304151","n2130304133"]},"w203972941":{"id":"w203972941","tags":{"highway":"path"},"nodes":["n2139858982","n2139858983","n2139858984","n2139858985","n2139858927"]},"w203974065":{"id":"w203974065","tags":{"highway":"service"},"nodes":["n2139870406","n2139870407","n2139870408","n2139870417","n2139870409","n2139870410","n2139870411","n2139870412","n2139870426","n2139870413","n2139870414","n2139870415","n2139870419","n2139870416","n2139870421","n2139870408"]},"w203972940":{"id":"w203972940","tags":{"highway":"path","name":"Riverwalk Trail"},"nodes":["n2139858934","n2139858967","n2139858968","n2139858969","n2139858970","n2139858971","n2139858972","n2139858973","n2139858974","n2139858975","n2139858976","n2139858977","n2139858978","n2139858979","n2139858980","n2139858981"]},"w203974072":{"id":"w203974072","tags":{"highway":"footway"},"nodes":["n2139858925","n2139870450","n2139870453","n2139870451","n2139870452","n2139870441"]},"w203974074":{"id":"w203974074","tags":{"highway":"footway"},"nodes":["n2139870454","n2139870456","n2139870429"]},"w203974060":{"id":"w203974060","tags":{"highway":"footway"},"nodes":["n2139870383","n2139870384","n2139870422","n2139870385","n2139870386","n2139870388"]},"w203841837":{"id":"w203841837","tags":{"area":"yes","natural":"water"},"nodes":["n2138493807","n2138493808","n2138493809","n2138493810","n2138493811","n2138493812","n2138493813","n2138493814","n2138493815","n2138493816","n2138493825","n2138493817","n2138493824","n2138493818","n2138493819","n2138493820","n2138493821","n2138493822","n2138493823","n2138493807"]},"w134150845":{"id":"w134150845","tags":{"bridge":"yes","name":"Conrail Railroad","railway":"rail"},"nodes":["n185972903","n185972905"]},"w203974059":{"id":"w203974059","tags":{"highway":"footway"},"nodes":["n2139870430","n2139870439","n2139870429","n2139870428","n2139870379","n2139870455","n2139870380","n2139870381","n2139858925","n2139870382"]},"w203986457":{"id":"w203986457","tags":{"area":"yes","leisure":"park","name":"Scidmore Park"},"nodes":["n2139989333","n2139989335","n2139989337","n2139989339","n1819805762","n2139989328","n1819805907","n2139989330","n1819805915","n2139989341","n2139989344","n2139989346","n2139989348","n2139989350","n2139989351","n2139989353","n2139989355","n2139989333"]},"w170848331":{"id":"w170848331","tags":{"name":"Rocky River","waterway":"river"},"nodes":["n1819848937","n1819849104","n1819849076","n1819849183","n1819848928","n1819848972","n1819848948","n1819848971","n1819848859","n1819849008","n1819848889","n1819849026","n1819849094","n1819849083","n1819849079","n1819849187","n1819848992","n1819849060","n1819849056","n1819849071","n1819849067","n1819849048","n1819849036","n1819849150","n1819849075","n1819849051","n1819849062","n1819848926","n1819849035","n1819848987","n1819849012","n1819848933","n1819848996","n1819848990","n1819849005","n1819849021","n1819848892","n1819849092","n1819848863","n1819848922","n1819848858","n1819848855","n1819848974","n1819848953","n1819849019","n1819849049","n1819848979","n1819849140","n1819849193","n1819849147","n1819849151","n1819849163","n1819849023","n1819848878","n1819849004","n1819848857","n1819848879","n1819849041","n1819849165","n1819849107","n1819849156","n1819848934","n1819848914","n1819848955","n1819848931","n1819848927","n1819849084","n1819849169","n1819849045","n1819848945","n1819849095","n1819848924","n1819849171","n1819849141","n1819849046","n1819849197","n1819849011","n1819849108","n1819849158","n1819849160","n1819848870","n1819849006","n1819849157","n1819848993","n1819848970","n1819849202","n1819848903","n1819848975","n1819848849","n1819849025","n1819849105","n1819849033","n1819849176","n1819849099","n1819849086","n1819848960","n1819848961","n1819849001","n1819848980","n1819849038","n1819848854","n1819849127","n1819849170","n1819849139","n1819848873","n1819848929","n1819849201","n1819849121","n1819849031","n1819849131","n1819848875","n1819849080","n1819849066","n1819849081","n1819849096","n1819849172","n1819849114","n1819849182","n1819848905","n1819849054","n1819848920","n1819848851","n1819848968","n1819848917","n1819849111","n1819849119","n1819849074","n1819848893","n1819849129","n1819848850","n1819848956","n1819849154","n1819848877","n1819848986","n1819849191","n1819848952","n1819848954","n1819848942","n1819849028","n1819849195","n1819848938","n1819848962","n1819849070","n1819849034","n1819849052","n1819849059","n1819848916","n1819849162","n1819849167","n1819849093","n1819849030","n1819849002","n1819849161","n1819848886","n1819848958","n1819849064","n1819849112","n1819849148","n1819848856","n1819848976","n1819848977","n1819849144","n1819848918","n1819849200","n1819848919","n1819849042","n1819849166","n1819849186","n1819849152","n1819849058","n1819849185","n1819849199","n1819849053","n1819849194","n1819849068","n1819849146","n1819849174","n1819848967","n1819848932","n1819849155","n1819849198","n1819848964","n1819848894","n1819848969","n1819849184","n1819849055","n1819849179","n1819848865","n1819848860","n1819849082","n1819848966","n1819849040","n1819849069","n1819849078","n1819849077","n1819848904","n1819848959","n1819849133","n1819849089","n1819849000","n1819849124","n1819849032","n1819849097","n1819848939","n1819849072","n1819848915","n1819849196","n1819848946","n1819849047","n1819849029","n1819849164","n1819848994","n1819849022","n1819858513","n1819849126","n1819849063","n1819848941","n1819849085","n1819848871","n1819848943","n1819849192","n1819858501","n1819849159","n1819858523","n1819848901","n1819849189","n1819858503","n1819849065","n2139877106","n1819848909","n1819848930","n1819848888"]},"w17967397":{"id":"w17967397","tags":{"highway":"residential","name":"North Andrews Street"},"nodes":["n185964963","n185985217"]},"w17964497":{"id":"w17964497","tags":{"highway":"tertiary","name":"Constantine St"},"nodes":["n185958643","n185958645","n2139795852","n185958647","n185958649","n185958651","n185958653","n185958656","n185958658","n185958660","n185958662","n185958664","n185958666","n185958668","n185958670","n185948710","n185958672"]},"w203974068":{"id":"w203974068","tags":{"highway":"footway"},"nodes":["n2139870422","n2139870423","n2139870424","n2139870425","n2139870426","n2139870427"]},"w203974063":{"id":"w203974063","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139870398","n2139870399","n2139870400","n2139870401","n2139870398"]},"w203986459":{"id":"w203986459","tags":{"amenity":"shelter","area":"yes","shelter_type":"picnic_shelter"},"nodes":["n2139989364","n2139989366","n2139989368","n2139989370","n2139989364"]},"w203988286":{"id":"w203988286","tags":{"area":"yes","leisure":"park","name":"Memory Isle Park"},"nodes":["n2140006331","n2140006334","n2140006336","n2140006338","n2140006340","n2140006342","n2140006344","n2140006346","n2140006348","n2140006351","n2140006353","n2140006355","n2140006357","n2140006359","n2140006361","n2140006363","n2140006364","n2140006365","n2140006395","n2140006366","n2140006401","n2140006397","n2140006399","n2140006331"]},"w203974073":{"id":"w203974073","tags":{"highway":"footway"},"nodes":["n2139870453","n2139870454","n2139870455"]},"w203974064":{"id":"w203974064","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139870402","n2139870403","n2139870404","n2139870405","n2139870402"]},"n185966959":{"id":"n185966959","loc":[-85.642185,41.946411]},"n1475283980":{"id":"n1475283980","loc":[-85.6398249,41.9451425]},"n1475284013":{"id":"n1475284013","loc":[-85.6396448,41.9451666]},"n1475284042":{"id":"n1475284042","loc":[-85.6386382,41.9454789]},"n185975925":{"id":"n185975925","loc":[-85.6393332,41.9452388]},"n185975919":{"id":"n185975919","loc":[-85.6391279,41.9453044]},"n185975917":{"id":"n185975917","loc":[-85.6389034,41.9453872]},"n2140006369":{"id":"n2140006369","loc":[-85.6386163,41.9451631]},"n2140006370":{"id":"n2140006370","loc":[-85.6385144,41.9449357]},"n2140006417":{"id":"n2140006417","loc":[-85.6385785,41.9450299]},"n2140006419":{"id":"n2140006419","loc":[-85.6385781,41.9452152]},"n2189123361":{"id":"n2189123361","loc":[-85.6404948,41.947015]},"n2189123363":{"id":"n2189123363","loc":[-85.6395765,41.946495]},"n2189123365":{"id":"n2189123365","loc":[-85.6389347,41.9460875]},"n185966962":{"id":"n185966962","loc":[-85.644417,41.946364]},"n185975911":{"id":"n185975911","loc":[-85.637532,41.9458276]},"n185975913":{"id":"n185975913","loc":[-85.6376323,41.9457936]},"n185975915":{"id":"n185975915","loc":[-85.6383596,41.9455425]},"n185975932":{"id":"n185975932","loc":[-85.644403,41.945088]},"n185975934":{"id":"n185975934","loc":[-85.645486,41.945084]},"n185979974":{"id":"n185979974","loc":[-85.644381,41.943831]},"n2139795809":{"id":"n2139795809","loc":[-85.6464756,41.9450813]},"n2139795810":{"id":"n2139795810","loc":[-85.6466646,41.945174]},"n2139858952":{"id":"n2139858952","loc":[-85.6383567,41.9454039]},"n2139858953":{"id":"n2139858953","loc":[-85.6380506,41.9455301]},"n2139858954":{"id":"n2139858954","loc":[-85.6377321,41.9455546]},"n2139858955":{"id":"n2139858955","loc":[-85.6376571,41.9455245]},"n2139858956":{"id":"n2139858956","loc":[-85.6375859,41.9454544]},"n2139858957":{"id":"n2139858957","loc":[-85.6376686,41.9453185]},"n2139858958":{"id":"n2139858958","loc":[-85.6378936,41.9451712]},"n2139858959":{"id":"n2139858959","loc":[-85.6379225,41.9450825]},"n2139858960":{"id":"n2139858960","loc":[-85.6379302,41.9447564]},"n2139858961":{"id":"n2139858961","loc":[-85.6379763,41.9446963]},"n2139858962":{"id":"n2139858962","loc":[-85.6380436,41.9446706]},"n2139858963":{"id":"n2139858963","loc":[-85.6381286,41.9445969]},"n2139858965":{"id":"n2139858965","loc":[-85.6382523,41.9444134]},"n2140006367":{"id":"n2140006367","loc":[-85.6380923,41.9454418]},"n2140006368":{"id":"n2140006368","loc":[-85.6384089,41.9453146]},"n2140006372":{"id":"n2140006372","loc":[-85.6383252,41.9447706]},"n2140006374":{"id":"n2140006374","loc":[-85.6381033,41.9447436]},"n2140006376":{"id":"n2140006376","loc":[-85.6379759,41.9447815]},"n2140006378":{"id":"n2140006378","loc":[-85.6379832,41.9448654]},"n2140006380":{"id":"n2140006380","loc":[-85.6380632,41.9450738]},"n2140006382":{"id":"n2140006382","loc":[-85.6380414,41.9452064]},"n2140006389":{"id":"n2140006389","loc":[-85.6379068,41.9453092]},"n2140006391":{"id":"n2140006391","loc":[-85.637925,41.9453904]},"n2140006393":{"id":"n2140006393","loc":[-85.6379977,41.94545]},"n2189123275":{"id":"n2189123275","loc":[-85.6371346,41.9462544]},"n2189123278":{"id":"n2189123278","loc":[-85.6368371,41.9466153]},"n2189123280":{"id":"n2189123280","loc":[-85.6379537,41.9489088]},"n2189123282":{"id":"n2189123282","loc":[-85.6383816,41.9497858]},"n2189123285":{"id":"n2189123285","loc":[-85.6393673,41.9512417]},"n2189123287":{"id":"n2189123287","loc":[-85.640554,41.9517766]},"n2189123289":{"id":"n2189123289","loc":[-85.6411,41.9522344]},"n2189123291":{"id":"n2189123291","loc":[-85.6417418,41.9526574]},"n2189123293":{"id":"n2189123293","loc":[-85.642321,41.9529407]},"n2189123295":{"id":"n2189123295","loc":[-85.6427697,41.9532278]},"n2189123297":{"id":"n2189123297","loc":[-85.6433332,41.9538254]},"n2189123300":{"id":"n2189123300","loc":[-85.6435785,41.9543648]},"n2189123301":{"id":"n2189123301","loc":[-85.6444394,41.9541048]},"n2189123303":{"id":"n2189123303","loc":[-85.6450603,41.954]},"n2189123312":{"id":"n2189123312","loc":[-85.6454829,41.9539108]},"n2189123314":{"id":"n2189123314","loc":[-85.6460464,41.9538526]},"n2189123315":{"id":"n2189123315","loc":[-85.6463178,41.9537167]},"n2189123316":{"id":"n2189123316","loc":[-85.646276,41.9534141]},"n2189123317":{"id":"n2189123317","loc":[-85.6459995,41.9531541]},"n2189123318":{"id":"n2189123318","loc":[-85.645222,41.9531929]},"n2189123319":{"id":"n2189123319","loc":[-85.6447316,41.9531813]},"n2189123320":{"id":"n2189123320","loc":[-85.6440637,41.9532977]},"n2189123321":{"id":"n2189123321","loc":[-85.6438185,41.9531774]},"n2189123322":{"id":"n2189123322","loc":[-85.6440011,41.9528398]},"n2189123323":{"id":"n2189123323","loc":[-85.6442672,41.9525914]},"n2189123324":{"id":"n2189123324","loc":[-85.6442881,41.9523276]},"n2189123326":{"id":"n2189123326","loc":[-85.644262,41.952153]},"n2189123328":{"id":"n2189123328","loc":[-85.6441681,41.9520404]},"n2189123330":{"id":"n2189123330","loc":[-85.6442098,41.9517494]},"n2189123333":{"id":"n2189123333","loc":[-85.6438498,41.9515864]},"n2189123336":{"id":"n2189123336","loc":[-85.6435889,41.9513225]},"n2189123339":{"id":"n2189123339","loc":[-85.6425349,41.9510315]},"n2189123342":{"id":"n2189123342","loc":[-85.6422688,41.9508802]},"n2189123345":{"id":"n2189123345","loc":[-85.6418775,41.9508142]},"n2189123348":{"id":"n2189123348","loc":[-85.6415488,41.9508064]},"n2189123351":{"id":"n2189123351","loc":[-85.6411027,41.9505488]},"n2189123353":{"id":"n2189123353","loc":[-85.6410374,41.9498208]},"n2189123355":{"id":"n2189123355","loc":[-85.6410061,41.9494327]},"n2189123357":{"id":"n2189123357","loc":[-85.6411522,41.9482569]},"n2189123359":{"id":"n2189123359","loc":[-85.6410548,41.9473036]},"n2189123368":{"id":"n2189123368","loc":[-85.6380216,41.9458974]},"n2189123370":{"id":"n2189123370","loc":[-85.6386721,41.9507782]},"w17968193":{"id":"w17968193","tags":{"highway":"residential","name":"French St"},"nodes":["n185970906","n185982877","n185967774","n185985823","n185979974"]},"w203972939":{"id":"w203972939","tags":{"highway":"path"},"nodes":["n2139858965","n2139858966"]},"w203988289":{"id":"w203988289","tags":{"area":"yes","natural":"water"},"nodes":["n2140006367","n2140006368","n2140006419","n2140006369","n2140006417","n2140006370","n2140006372","n2140006374","n2140006376","n2140006378","n2140006380","n2140006382","n2140006389","n2140006391","n2140006393","n2140006367"]},"w208640157":{"id":"w208640157","tags":{"area":"yes","natural":"wetland"},"nodes":["n1819849029","n2189123275","n2189123278","n2189123280","n2189123282","n2189123370","n2189123285","n2189123287","n2189123289","n2189123291","n2189123293","n2189123295","n2189123297","n2189123300","n2189123301","n2189123303","n2189123312","n2189123314","n2189123315","n2189123316","n2189123317","n2189123318","n2189123319","n2189123320","n2189123321","n2189123322","n2189123323","n2189123324","n2189123326","n2189123328","n2189123330","n2189123333","n2189123336","n2189123339","n2189123342","n2189123345","n2189123348","n2189123351","n2189123353","n2189123355","n2189123357","n2189123359","n2189123361","n2189123363","n2189123365","n2189123368","n1819849029"]},"w17966281":{"id":"w17966281","tags":{"highway":"residential","name":"Pealer St"},"nodes":["n185975911","n185975913","n185975915","n1475284042","n185975917","n185975919","n185975925","n185970909","n1475284013","n1475283980","n185975928","n185967775","n185975930","n185975932","n185975934","n2139795809","n2139795810"]},"w17965353":{"id":"w17965353","tags":{"highway":"residential","name":"Yauney St"},"nodes":["n185966958","n185966959","n185966960","n185966962"]},"w203972938":{"id":"w203972938","tags":{"highway":"path","name":"Riverwalk Trail"},"nodes":["n2139858964","n2139858965","n2139858963","n2139858962","n2139858961","n2139858960","n2139858959","n2139858958","n2139858957","n2139858956","n2139858955","n2139858954","n2139858953","n2139858952","n2139858951"]},"n354002665":{"id":"n354002665","loc":[-85.6366599,41.9444923],"tags":{"name":"Memory Isle","place":"island"}},"n354031301":{"id":"n354031301","loc":[-85.635,41.9463889],"tags":{"amenity":"post_office","name":"Three Rivers Post Office"}},"n185963454":{"id":"n185963454","loc":[-85.633686,41.946072]},"n185963455":{"id":"n185963455","loc":[-85.633815,41.946131]},"n185963456":{"id":"n185963456","loc":[-85.633951,41.946174]},"n185978375":{"id":"n185978375","loc":[-85.634385,41.94559]},"n185978377":{"id":"n185978377","loc":[-85.634544,41.945725]},"n185978379":{"id":"n185978379","loc":[-85.634573,41.945764]},"n185978381":{"id":"n185978381","loc":[-85.634616,41.945849]},"n185978383":{"id":"n185978383","loc":[-85.634629,41.945893]},"n185984011":{"id":"n185984011","loc":[-85.636058,41.946201]},"n185984013":{"id":"n185984013","loc":[-85.636112,41.946366]},"n185984015":{"id":"n185984015","loc":[-85.636143,41.946551]},"n185988237":{"id":"n185988237","loc":[-85.6354162,41.946044]},"n185988969":{"id":"n185988969","loc":[-85.635374,41.945325]},"n185988971":{"id":"n185988971","loc":[-85.635643,41.945585]},"n185988972":{"id":"n185988972","loc":[-85.635853,41.94586]},"n1475283992":{"id":"n1475283992","loc":[-85.6372968,41.9459007]},"n1475284011":{"id":"n1475284011","loc":[-85.6359415,41.9459797]},"n1475284019":{"id":"n1475284019","loc":[-85.6364433,41.9460423]},"n185984009":{"id":"n185984009","loc":[-85.6360524,41.9460485]},"n185988239":{"id":"n185988239","loc":[-85.6358187,41.9460423]},"n185988243":{"id":"n185988243","loc":[-85.6366156,41.9460282]},"n185988244":{"id":"n185988244","loc":[-85.6368316,41.9460046]},"n185988245":{"id":"n185988245","loc":[-85.6370133,41.9459704]},"n185988241":{"id":"n185988241","loc":[-85.636291,41.9460461]},"n185964976":{"id":"n185964976","loc":[-85.633923,41.9434157]},"n185964980":{"id":"n185964980","loc":[-85.6333656,41.9437293]},"n185978388":{"id":"n185978388","loc":[-85.6346449,41.9460571]},"n1819858504":{"id":"n1819858504","loc":[-85.6365343,41.9447926]},"n1819858506":{"id":"n1819858506","loc":[-85.6370546,41.9451882]},"n1819858516":{"id":"n1819858516","loc":[-85.6358369,41.9444654]},"n1819858519":{"id":"n1819858519","loc":[-85.6361534,41.9446176]},"n1819858525":{"id":"n1819858525","loc":[-85.6368025,41.9449442]},"n1819858527":{"id":"n1819858527","loc":[-85.6334199,41.9457495]},"n185963452":{"id":"n185963452","loc":[-85.633564,41.9458519]},"n185963453":{"id":"n185963453","loc":[-85.6336152,41.9459804]},"n185963451":{"id":"n185963451","loc":[-85.6332888,41.9456871]},"n2130304152":{"id":"n2130304152","loc":[-85.6359466,41.9454599]},"n2130304153":{"id":"n2130304153","loc":[-85.6362773,41.9452683]},"n2130304154":{"id":"n2130304154","loc":[-85.6352028,41.9442868]},"n2130304155":{"id":"n2130304155","loc":[-85.6348756,41.9444769]},"n2130304156":{"id":"n2130304156","loc":[-85.6349723,41.9444207]},"n2130304157":{"id":"n2130304157","loc":[-85.6338698,41.9434443]},"n2130304158":{"id":"n2130304158","loc":[-85.635094,41.9451026]},"n2130304160":{"id":"n2130304160","loc":[-85.6353716,41.9449322]},"n2130304162":{"id":"n2130304162","loc":[-85.6365942,41.9459352]},"n2130304163":{"id":"n2130304163","loc":[-85.6369006,41.9457469]},"n2130304164":{"id":"n2130304164","loc":[-85.6363292,41.9452278]},"n2130304165":{"id":"n2130304165","loc":[-85.6360248,41.9454175]},"n2139824683":{"id":"n2139824683","loc":[-85.6339825,41.9446441]},"n2139824689":{"id":"n2139824689","loc":[-85.6340437,41.9446925]},"n2139824702":{"id":"n2139824702","loc":[-85.6340961,41.9447551]},"n2139824705":{"id":"n2139824705","loc":[-85.6337467,41.944809]},"n2139824707":{"id":"n2139824707","loc":[-85.6341598,41.9448129]},"n2139824710":{"id":"n2139824710","loc":[-85.6342771,41.9448223]},"n2139824712":{"id":"n2139824712","loc":[-85.6346058,41.944841]},"n2139824713":{"id":"n2139824713","loc":[-85.633808,41.9448574]},"n2139824714":{"id":"n2139824714","loc":[-85.6340889,41.9448589]},"n2139824716":{"id":"n2139824716","loc":[-85.6343335,41.944871]},"n2139824717":{"id":"n2139824717","loc":[-85.6343341,41.9448717]},"n2139824720":{"id":"n2139824720","loc":[-85.6338757,41.9449069]},"n2139824721":{"id":"n2139824721","loc":[-85.6341445,41.9449071]},"n2139824724":{"id":"n2139824724","loc":[-85.6334787,41.9449262]},"n2139824726":{"id":"n2139824726","loc":[-85.6347119,41.9449332]},"n2139824727":{"id":"n2139824727","loc":[-85.6347175,41.9449418]},"n2139824728":{"id":"n2139824728","loc":[-85.6344284,41.9449538]},"n2139824729":{"id":"n2139824729","loc":[-85.6339339,41.9449573]},"n2139824730":{"id":"n2139824730","loc":[-85.6339179,41.9449682]},"n2139824732":{"id":"n2139824732","loc":[-85.6335472,41.9449895]},"n2139824733":{"id":"n2139824733","loc":[-85.6339736,41.9450164]},"n2139824735":{"id":"n2139824735","loc":[-85.6336034,41.9450415]},"n2139824736":{"id":"n2139824736","loc":[-85.6348317,41.945043]},"n2139824737":{"id":"n2139824737","loc":[-85.63403,41.9450651]},"n2139824738":{"id":"n2139824738","loc":[-85.6336611,41.9450949]},"n2139824740":{"id":"n2139824740","loc":[-85.6336582,41.9450966]},"n2139824744":{"id":"n2139824744","loc":[-85.6331702,41.9451107]},"n2139824745":{"id":"n2139824745","loc":[-85.6333388,41.9451142]},"n2139824746":{"id":"n2139824746","loc":[-85.6337131,41.9451341]},"n2139824747":{"id":"n2139824747","loc":[-85.6337021,41.9451372]},"n2139824748":{"id":"n2139824748","loc":[-85.6341244,41.9451472]},"n2139824749":{"id":"n2139824749","loc":[-85.6333952,41.945166]},"n2139824750":{"id":"n2139824750","loc":[-85.633395,41.9451661]},"n2139824751":{"id":"n2139824751","loc":[-85.6346258,41.9451725]},"n2139824752":{"id":"n2139824752","loc":[-85.6332387,41.9451741]},"n2139824753":{"id":"n2139824753","loc":[-85.6346901,41.9451853]},"n2139824754":{"id":"n2139824754","loc":[-85.6346611,41.9452035]},"n2139824755":{"id":"n2139824755","loc":[-85.6346574,41.9452059]},"n2139824756":{"id":"n2139824756","loc":[-85.6345611,41.9452133]},"n2139824757":{"id":"n2139824757","loc":[-85.633453,41.9452194]},"n2139824758":{"id":"n2139824758","loc":[-85.6335508,41.9452283]},"n2139824759":{"id":"n2139824759","loc":[-85.6347424,41.9452312]},"n2139824760":{"id":"n2139824760","loc":[-85.6342305,41.9452395]},"n2139824761":{"id":"n2139824761","loc":[-85.6342319,41.9452449]},"n2139824762":{"id":"n2139824762","loc":[-85.6334969,41.94526]},"n2139824763":{"id":"n2139824763","loc":[-85.63468,41.9452706]},"n2139824764":{"id":"n2139824764","loc":[-85.6346772,41.9452724]},"n2139824765":{"id":"n2139824765","loc":[-85.6338611,41.9452763]},"n2139824766":{"id":"n2139824766","loc":[-85.6347811,41.9452939]},"n2139824767":{"id":"n2139824767","loc":[-85.6347375,41.9453211]},"n2139824768":{"id":"n2139824768","loc":[-85.6339171,41.9453301]},"n2139824769":{"id":"n2139824769","loc":[-85.6348307,41.9453377]},"n2139824770":{"id":"n2139824770","loc":[-85.6347067,41.9453405]},"n2139824771":{"id":"n2139824771","loc":[-85.6343461,41.9453461]},"n2139824772":{"id":"n2139824772","loc":[-85.6343481,41.9453475]},"n2139824773":{"id":"n2139824773","loc":[-85.634805,41.9453538]},"n2139824774":{"id":"n2139824774","loc":[-85.6336997,41.9453692]},"n2139824775":{"id":"n2139824775","loc":[-85.6339709,41.9453818]},"n2139824776":{"id":"n2139824776","loc":[-85.6336229,41.9454134]},"n2139824777":{"id":"n2139824777","loc":[-85.6349022,41.9454141]},"n2139824778":{"id":"n2139824778","loc":[-85.6348854,41.9454246]},"n2139824779":{"id":"n2139824779","loc":[-85.6340286,41.9454373]},"n2139824780":{"id":"n2139824780","loc":[-85.6336963,41.9454572]},"n2139824781":{"id":"n2139824781","loc":[-85.6336789,41.9454672]},"n2139824782":{"id":"n2139824782","loc":[-85.6344933,41.945475]},"n2139824783":{"id":"n2139824783","loc":[-85.6340854,41.9454918]},"n2139824784":{"id":"n2139824784","loc":[-85.6350036,41.9455034]},"n2139824785":{"id":"n2139824785","loc":[-85.6337501,41.9455089]},"n2139824786":{"id":"n2139824786","loc":[-85.6337497,41.9455091]},"n2139824787":{"id":"n2139824787","loc":[-85.6345425,41.9455186]},"n2139824788":{"id":"n2139824788","loc":[-85.6341459,41.9455372]},"n2139824789":{"id":"n2139824789","loc":[-85.6341376,41.945542]},"n2139824790":{"id":"n2139824790","loc":[-85.6338394,41.9455462]},"n2139824791":{"id":"n2139824791","loc":[-85.6349171,41.9455588]},"n2139824792":{"id":"n2139824792","loc":[-85.6338074,41.9455646]},"n2139824793":{"id":"n2139824793","loc":[-85.6346229,41.9455894]},"n2139824794":{"id":"n2139824794","loc":[-85.6338983,41.9455995]},"n2139824795":{"id":"n2139824795","loc":[-85.6338962,41.9456007]},"n2139824796":{"id":"n2139824796","loc":[-85.6342475,41.9456348]},"n2139824797":{"id":"n2139824797","loc":[-85.6339505,41.9456497]},"n2139824798":{"id":"n2139824798","loc":[-85.6347243,41.9456788]},"n2139824799":{"id":"n2139824799","loc":[-85.635057,41.9456831]},"n2139824800":{"id":"n2139824800","loc":[-85.635287,41.9457056]},"n2139824801":{"id":"n2139824801","loc":[-85.6350753,41.9457068]},"n2139824802":{"id":"n2139824802","loc":[-85.6347753,41.9457252]},"n2139824803":{"id":"n2139824803","loc":[-85.6340521,41.9457473]},"n2139824804":{"id":"n2139824804","loc":[-85.6352875,41.9457611]},"n2139824805":{"id":"n2139824805","loc":[-85.6352941,41.9457611]},"n2139824806":{"id":"n2139824806","loc":[-85.6350758,41.9457623]},"n2139824807":{"id":"n2139824807","loc":[-85.6348194,41.9457638]},"n2139824808":{"id":"n2139824808","loc":[-85.635296,41.9459428]},"n2139824809":{"id":"n2139824809","loc":[-85.6348212,41.9459455]},"n2139832635":{"id":"n2139832635","loc":[-85.6354612,41.9448791]},"n2139832636":{"id":"n2139832636","loc":[-85.6360241,41.9453844]},"n2139832637":{"id":"n2139832637","loc":[-85.6361452,41.9453121]},"n2139832639":{"id":"n2139832639","loc":[-85.6355997,41.944797]},"n2139832641":{"id":"n2139832641","loc":[-85.6351346,41.9443541]},"n2139832647":{"id":"n2139832647","loc":[-85.6329883,41.9453692]},"n2139832653":{"id":"n2139832653","loc":[-85.6333643,41.9456293]},"n2139832663":{"id":"n2139832663","loc":[-85.6335394,41.9455339]},"n2139832665":{"id":"n2139832665","loc":[-85.6332375,41.9452476]},"n2139832667":{"id":"n2139832667","loc":[-85.6331664,41.9452161]},"n2139832669":{"id":"n2139832669","loc":[-85.6331144,41.9451875]},"n2139832671":{"id":"n2139832671","loc":[-85.6330779,41.9451274]},"n2139832673":{"id":"n2139832673","loc":[-85.6330664,41.9450802]},"n2139832678":{"id":"n2139832678","loc":[-85.6332218,41.9453585]},"n2139832686":{"id":"n2139832686","loc":[-85.6334246,41.945541]},"n2139832691":{"id":"n2139832691","loc":[-85.6329898,41.9454997]},"n2139832693":{"id":"n2139832693","loc":[-85.6343554,41.9443274]},"n2139832694":{"id":"n2139832694","loc":[-85.6336339,41.9437089]},"n2139832696":{"id":"n2139832696","loc":[-85.633532,41.9437708]},"n2139832697":{"id":"n2139832697","loc":[-85.6338316,41.9440868]},"n2139832698":{"id":"n2139832698","loc":[-85.6342258,41.9444141]},"n2139832699":{"id":"n2139832699","loc":[-85.6339164,41.9442166]},"n2139832700":{"id":"n2139832700","loc":[-85.6341389,41.944384]},"n2139832701":{"id":"n2139832701","loc":[-85.634235,41.9443259]},"n2139832702":{"id":"n2139832702","loc":[-85.633613,41.9437875]},"n2139832703":{"id":"n2139832703","loc":[-85.633915,41.9436132]},"n2139832704":{"id":"n2139832704","loc":[-85.6340019,41.9435613]},"n2139832706":{"id":"n2139832706","loc":[-85.6343197,41.9438427]},"n2139832708":{"id":"n2139832708","loc":[-85.6342361,41.9438936]},"n2139832709":{"id":"n2139832709","loc":[-85.6353839,41.9460401]},"n2139832710":{"id":"n2139832710","loc":[-85.6354032,41.9456763]},"n2139832711":{"id":"n2139832711","loc":[-85.6356839,41.9459252]},"n2139832712":{"id":"n2139832712","loc":[-85.6356109,41.945735]},"n2139832713":{"id":"n2139832713","loc":[-85.6353997,41.9457421]},"n2139832714":{"id":"n2139832714","loc":[-85.6353895,41.9459347]},"n2139832715":{"id":"n2139832715","loc":[-85.6334777,41.9436628]},"n2139832716":{"id":"n2139832716","loc":[-85.6333137,41.9435382]},"n2139832717":{"id":"n2139832717","loc":[-85.6330938,41.9435406]},"n2139832721":{"id":"n2139832721","loc":[-85.6333023,41.9434922]},"n2139832722":{"id":"n2139832722","loc":[-85.6330466,41.943623]},"n2139832723":{"id":"n2139832723","loc":[-85.6332746,41.9435624]},"n2139832724":{"id":"n2139832724","loc":[-85.6333511,41.9435176]},"n2139832725":{"id":"n2139832725","loc":[-85.6332241,41.9434001]},"n2139832726":{"id":"n2139832726","loc":[-85.6332355,41.9433686]},"n2139870373":{"id":"n2139870373","loc":[-85.6351783,41.9439117]},"n2139870374":{"id":"n2139870374","loc":[-85.6351431,41.9439217]},"n2139870375":{"id":"n2139870375","loc":[-85.6348853,41.9439117]},"n2139870376":{"id":"n2139870376","loc":[-85.6348317,41.9439105]},"n2139870377":{"id":"n2139870377","loc":[-85.6346384,41.944007]},"n2139870378":{"id":"n2139870378","loc":[-85.6345563,41.9440523]},"n2140006403":{"id":"n2140006403","loc":[-85.6359942,41.9450097]},"n2140006405":{"id":"n2140006405","loc":[-85.6363884,41.9446079]},"n2140006407":{"id":"n2140006407","loc":[-85.6362148,41.9447874]},"n2140006409":{"id":"n2140006409","loc":[-85.6379476,41.9445869]},"n2140006411":{"id":"n2140006411","loc":[-85.6378485,41.9445674]},"n2140006413":{"id":"n2140006413","loc":[-85.6378952,41.9444547]},"n2140006415":{"id":"n2140006415","loc":[-85.6379962,41.944477]},"n2140006421":{"id":"n2140006421","loc":[-85.6355248,41.9433702]},"n2140006423":{"id":"n2140006423","loc":[-85.6378471,41.9439233]},"n2140006425":{"id":"n2140006425","loc":[-85.6378913,41.9441238]},"n2140006426":{"id":"n2140006426","loc":[-85.6381674,41.9442289]},"n2140006427":{"id":"n2140006427","loc":[-85.6382359,41.9440975]},"n2140006428":{"id":"n2140006428","loc":[-85.6382071,41.9440252]},"n2140006429":{"id":"n2140006429","loc":[-85.6381409,41.9439973]},"n2140006430":{"id":"n2140006430","loc":[-85.6380569,41.9440153]},"n2140006433":{"id":"n2140006433","loc":[-85.6379071,41.9442467]},"n2140006435":{"id":"n2140006435","loc":[-85.6381634,41.9443125]},"n2140006436":{"id":"n2140006436","loc":[-85.6382407,41.944301]},"n2140006438":{"id":"n2140006438","loc":[-85.6382761,41.9442188]},"n2140006439":{"id":"n2140006439","loc":[-85.6382429,41.9441761]},"n2140006440":{"id":"n2140006440","loc":[-85.6382016,41.9441632]},"n2140006441":{"id":"n2140006441","loc":[-85.6378185,41.9439835]},"n2166205688":{"id":"n2166205688","loc":[-85.6349963,41.9444392]},"n2168544780":{"id":"n2168544780","loc":[-85.633944,41.945807]},"n2168544781":{"id":"n2168544781","loc":[-85.6340783,41.9458621]},"n2168544782":{"id":"n2168544782","loc":[-85.6338184,41.9457548]},"n2168544783":{"id":"n2168544783","loc":[-85.6339925,41.9459777]},"n2168544784":{"id":"n2168544784","loc":[-85.6337317,41.9458698]},"n2168544785":{"id":"n2168544785","loc":[-85.6337297,41.9460042]},"n2168544786":{"id":"n2168544786","loc":[-85.633919,41.9460797]},"n2168544787":{"id":"n2168544787","loc":[-85.6338672,41.9459263]},"n2168544788":{"id":"n2168544788","loc":[-85.6338246,41.9459853]},"n2168544789":{"id":"n2168544789","loc":[-85.6337615,41.9459601]},"n2168544790":{"id":"n2168544790","loc":[-85.6342079,41.9460399]},"n2168544791":{"id":"n2168544791","loc":[-85.6343346,41.9458503]},"n2168544792":{"id":"n2168544792","loc":[-85.6343759,41.9458116]},"n2168544793":{"id":"n2168544793","loc":[-85.6344394,41.9458109]},"n2168544795":{"id":"n2168544795","loc":[-85.6344827,41.945851]},"n2168544797":{"id":"n2168544797","loc":[-85.6344807,41.945969]},"n2168544798":{"id":"n2168544798","loc":[-85.6344404,41.9459697]},"n2168544799":{"id":"n2168544799","loc":[-85.6344413,41.9460333]},"n2168544800":{"id":"n2168544800","loc":[-85.6342173,41.9460705]},"n2168544801":{"id":"n2168544801","loc":[-85.6342162,41.9460392]},"n2168544802":{"id":"n2168544802","loc":[-85.6344251,41.9460351]},"n2168544805":{"id":"n2168544805","loc":[-85.6344257,41.9460507]},"n2168544807":{"id":"n2168544807","loc":[-85.6344721,41.9460498]},"n2168544809":{"id":"n2168544809","loc":[-85.6344754,41.9461427]},"n2168544811":{"id":"n2168544811","loc":[-85.6344311,41.9461435]},"n2168544813":{"id":"n2168544813","loc":[-85.6344317,41.9461592]},"n2168544815":{"id":"n2168544815","loc":[-85.6343708,41.9461604]},"n2168544817":{"id":"n2168544817","loc":[-85.6343715,41.9461786]},"n2168544819":{"id":"n2168544819","loc":[-85.6343229,41.9461795]},"n2168544821":{"id":"n2168544821","loc":[-85.6343222,41.9461606]},"n2168544823":{"id":"n2168544823","loc":[-85.6342476,41.9461621]},"n2168544825":{"id":"n2168544825","loc":[-85.6342444,41.94607]},"n2168544827":{"id":"n2168544827","loc":[-85.634138,41.9461632]},"n2168544829":{"id":"n2168544829","loc":[-85.6342016,41.9460703]},"n2168544830":{"id":"n2168544830","loc":[-85.6332929,41.9463092]},"n2168544831":{"id":"n2168544831","loc":[-85.633122,41.946239]},"n2168544832":{"id":"n2168544832","loc":[-85.6332954,41.9460055]},"n2168544833":{"id":"n2168544833","loc":[-85.6333954,41.9460466]},"n2168544834":{"id":"n2168544834","loc":[-85.6334044,41.9460345]},"n2168544835":{"id":"n2168544835","loc":[-85.6334594,41.9460571]},"n2168544836":{"id":"n2168544836","loc":[-85.6333871,41.9461544]},"n2168544837":{"id":"n2168544837","loc":[-85.633403,41.9461609]},"n2168544838":{"id":"n2168544838","loc":[-85.6341683,41.9464167]},"n2168544839":{"id":"n2168544839","loc":[-85.6341711,41.9463411]},"n2168544840":{"id":"n2168544840","loc":[-85.6344471,41.9463469]},"n2168544841":{"id":"n2168544841","loc":[-85.6344441,41.9464243]},"n2168544842":{"id":"n2168544842","loc":[-85.6343622,41.9464226]},"n2168544843":{"id":"n2168544843","loc":[-85.6343593,41.9464989]},"n2168544844":{"id":"n2168544844","loc":[-85.6342812,41.9464973]},"n2168544845":{"id":"n2168544845","loc":[-85.634283,41.9464504]},"n2168544846":{"id":"n2168544846","loc":[-85.6342609,41.9464499]},"n2168544847":{"id":"n2168544847","loc":[-85.6342621,41.9464187]},"n2168544848":{"id":"n2168544848","loc":[-85.6348414,41.9463396]},"n2168544849":{"id":"n2168544849","loc":[-85.6348387,41.9461872]},"n2168544850":{"id":"n2168544850","loc":[-85.6351186,41.9461844]},"n2168544851":{"id":"n2168544851","loc":[-85.635119,41.9462112]},"n2168544852":{"id":"n2168544852","loc":[-85.6351918,41.9462104]},"n2168544853":{"id":"n2168544853","loc":[-85.6351944,41.9463515]},"n2168544854":{"id":"n2168544854","loc":[-85.6351049,41.9463524]},"n2168544855":{"id":"n2168544855","loc":[-85.6351046,41.946337]},"n2189153180":{"id":"n2189153180","loc":[-85.6340369,41.9469572]},"n2189153181":{"id":"n2189153181","loc":[-85.6342531,41.946953]},"n2189153183":{"id":"n2189153183","loc":[-85.6348115,41.9465468]},"n2189153184":{"id":"n2189153184","loc":[-85.6348105,41.9464569]},"n2189153185":{"id":"n2189153185","loc":[-85.6351431,41.9464549]},"n2189153186":{"id":"n2189153186","loc":[-85.6351441,41.9465448]},"n2189153187":{"id":"n2189153187","loc":[-85.6350077,41.9465456]},"n2189153188":{"id":"n2189153188","loc":[-85.635008,41.9465721]},"n2189153189":{"id":"n2189153189","loc":[-85.6348965,41.9465727]},"n2189153190":{"id":"n2189153190","loc":[-85.6348962,41.9465463]},"n2189153191":{"id":"n2189153191","loc":[-85.6348963,41.9471586]},"n2189153192":{"id":"n2189153192","loc":[-85.6348944,41.947032]},"n2189153193":{"id":"n2189153193","loc":[-85.6350241,41.947031]},"n2189153194":{"id":"n2189153194","loc":[-85.635026,41.9471575]},"n2189153195":{"id":"n2189153195","loc":[-85.6352328,41.9471053]},"n2189153196":{"id":"n2189153196","loc":[-85.6352359,41.9469906]},"n2189153197":{"id":"n2189153197","loc":[-85.6353694,41.9469925]},"n2189153198":{"id":"n2189153198","loc":[-85.6353664,41.9471072]},"n2189153199":{"id":"n2189153199","loc":[-85.6348241,41.9469287]},"n2189153200":{"id":"n2189153200","loc":[-85.6348248,41.9468185]},"n2189153201":{"id":"n2189153201","loc":[-85.6351199,41.9468195]},"n2189153202":{"id":"n2189153202","loc":[-85.6351192,41.9469298]},"n2189153203":{"id":"n2189153203","loc":[-85.6347965,41.9468057]},"n2189153204":{"id":"n2189153204","loc":[-85.634792,41.9466044]},"n2189153205":{"id":"n2189153205","loc":[-85.6349483,41.9466025]},"n2189153206":{"id":"n2189153206","loc":[-85.6349493,41.9466448]},"n2189153207":{"id":"n2189153207","loc":[-85.6349753,41.9466445]},"n2189153208":{"id":"n2189153208","loc":[-85.6349743,41.9465995]},"n2189153209":{"id":"n2189153209","loc":[-85.6351173,41.9465977]},"n2189153210":{"id":"n2189153210","loc":[-85.6351219,41.9468015]},"n2189153211":{"id":"n2189153211","loc":[-85.6349806,41.9468032]},"n2189153212":{"id":"n2189153212","loc":[-85.6349794,41.9467519]},"n2189153213":{"id":"n2189153213","loc":[-85.6349521,41.9467523]},"n2189153214":{"id":"n2189153214","loc":[-85.6349532,41.9468037]},"n2189153215":{"id":"n2189153215","loc":[-85.6346302,41.9468381]},"n2189153216":{"id":"n2189153216","loc":[-85.6343028,41.9468449]},"n2189153217":{"id":"n2189153217","loc":[-85.6342006,41.9468297]},"n2189153218":{"id":"n2189153218","loc":[-85.6336698,41.9465918]},"n2189153219":{"id":"n2189153219","loc":[-85.6344663,41.9466639]},"n2189153220":{"id":"n2189153220","loc":[-85.6344639,41.9466015]},"n2189153221":{"id":"n2189153221","loc":[-85.6342283,41.9466065]},"n2189153222":{"id":"n2189153222","loc":[-85.6342303,41.9466587]},"n2189153223":{"id":"n2189153223","loc":[-85.6342843,41.9466575]},"n2189153224":{"id":"n2189153224","loc":[-85.6342851,41.9466794]},"n2189153225":{"id":"n2189153225","loc":[-85.6343475,41.9466781]},"n2189153226":{"id":"n2189153226","loc":[-85.634347,41.9466664]},"n2189153227":{"id":"n2189153227","loc":[-85.6354428,41.9470148]},"n2189153228":{"id":"n2189153228","loc":[-85.6354432,41.9468005]},"n2189153229":{"id":"n2189153229","loc":[-85.6360277,41.9468011]},"n2189153230":{"id":"n2189153230","loc":[-85.6360273,41.9470154]},"n2189153231":{"id":"n2189153231","loc":[-85.6354565,41.9465823]},"n2189153232":{"id":"n2189153232","loc":[-85.6354496,41.946218]},"n2189153233":{"id":"n2189153233","loc":[-85.6356355,41.9465788]},"n2189153234":{"id":"n2189153234","loc":[-85.6357155,41.9468008]},"n2189153235":{"id":"n2189153235","loc":[-85.6359539,41.9467969]},"n2189153236":{"id":"n2189153236","loc":[-85.6359561,41.9463036]},"n2189153237":{"id":"n2189153237","loc":[-85.6360129,41.9464793]},"n2189153238":{"id":"n2189153238","loc":[-85.6360152,41.9463898]},"n2189153239":{"id":"n2189153239","loc":[-85.6359607,41.9464928]},"n2189153240":{"id":"n2189153240","loc":[-85.6356903,41.9462227]},"n2189153242":{"id":"n2189153242","loc":[-85.6354163,41.946142]},"n2189153243":{"id":"n2189153243","loc":[-85.6357546,41.9462214]},"n2189153244":{"id":"n2189153244","loc":[-85.6357937,41.9462542]},"n2189153245":{"id":"n2189153245","loc":[-85.6358723,41.9467048]},"n2189153246":{"id":"n2189153246","loc":[-85.6361494,41.946757]},"n2189153247":{"id":"n2189153247","loc":[-85.6354173,41.9469082]},"n2189153248":{"id":"n2189153248","loc":[-85.635443,41.9469079]},"n2189153249":{"id":"n2189153249","loc":[-85.6360275,41.9469093]},"n2189153250":{"id":"n2189153250","loc":[-85.6361542,41.946915]},"n2189153251":{"id":"n2189153251","loc":[-85.6358654,41.9464843]},"n2189153252":{"id":"n2189153252","loc":[-85.6359549,41.9467499]},"n2189153253":{"id":"n2189153253","loc":[-85.6357172,41.9466335]},"n2189153254":{"id":"n2189153254","loc":[-85.6355644,41.9461768]},"n2189153255":{"id":"n2189153255","loc":[-85.6355655,41.946528]},"n2189153256":{"id":"n2189153256","loc":[-85.6357055,41.9465971]},"n2189153257":{"id":"n2189153257","loc":[-85.635869,41.9465971]},"n2189153259":{"id":"n2189153259","loc":[-85.6354561,41.9470278]},"n2189153260":{"id":"n2189153260","loc":[-85.6357961,41.9470233]},"n2189153261":{"id":"n2189153261","loc":[-85.6357977,41.9470907]},"n2189153262":{"id":"n2189153262","loc":[-85.6357297,41.9470916]},"n2189153263":{"id":"n2189153263","loc":[-85.635733,41.947233]},"n2189153264":{"id":"n2189153264","loc":[-85.6362674,41.9468637]},"n2189153265":{"id":"n2189153265","loc":[-85.6362646,41.9467047]},"n2189153266":{"id":"n2189153266","loc":[-85.6363267,41.9467047]},"n2189153267":{"id":"n2189153267","loc":[-85.6362633,41.9465848]},"n2189153268":{"id":"n2189153268","loc":[-85.6363805,41.9465468]},"n2189153269":{"id":"n2189153269","loc":[-85.6364604,41.9466842]},"n2189153270":{"id":"n2189153270","loc":[-85.6364604,41.9468647]},"n2199109756":{"id":"n2199109756","loc":[-85.6337134,41.9471841]},"n2199109757":{"id":"n2199109757","loc":[-85.6336514,41.94716]},"n2199109758":{"id":"n2199109758","loc":[-85.6337043,41.9470847]},"n2199109759":{"id":"n2199109759","loc":[-85.6335997,41.9470441]},"n2199109760":{"id":"n2199109760","loc":[-85.6335064,41.9471771]},"n185960195":{"id":"n185960195","loc":[-85.6295992,41.9524346]},"n185960796":{"id":"n185960796","loc":[-85.634723,41.953681]},"n185961396":{"id":"n185961396","loc":[-85.634767,41.959009]},"n185962625":{"id":"n185962625","loc":[-85.635175,41.97201]},"n185964982":{"id":"n185964982","loc":[-85.632799,41.9440543]},"n185965289":{"id":"n185965289","loc":[-85.634621,41.947323]},"n185965291":{"id":"n185965291","loc":[-85.636166,41.947296]},"n185965399":{"id":"n185965399","loc":[-85.634776,41.959834]},"n185966937":{"id":"n185966937","loc":[-85.633183,41.947315]},"n185966948":{"id":"n185966948","loc":[-85.626406,41.957188]},"n185967422":{"id":"n185967422","loc":[-85.6320229,41.9490123]},"n185967917":{"id":"n185967917","loc":[-85.634763,41.958292]},"n185967918":{"id":"n185967918","loc":[-85.636271,41.958311]},"n185968100":{"id":"n185968100","loc":[-85.630835,41.950656]},"n185970515":{"id":"n185970515","loc":[-85.634832,41.963866]},"n185971578":{"id":"n185971578","loc":[-85.634641,41.948627]},"n185971580":{"id":"n185971580","loc":[-85.6361818,41.9486135]},"n185971631":{"id":"n185971631","loc":[-85.634729,41.954667]},"n185971632":{"id":"n185971632","loc":[-85.636236,41.954656]},"n185972155":{"id":"n185972155","loc":[-85.623333,41.961987]},"n185974583":{"id":"n185974583","loc":[-85.634686,41.951158]},"n185974585":{"id":"n185974585","loc":[-85.6362059,41.9511457]},"n185975064":{"id":"n185975064","loc":[-85.636218,41.953667]},"n185975735":{"id":"n185975735","loc":[-85.634923,41.969269]},"n185978390":{"id":"n185978390","loc":[-85.634668,41.949875]},"n185978392":{"id":"n185978392","loc":[-85.634686,41.952415]},"n185978394":{"id":"n185978394","loc":[-85.634726,41.955921]},"n185978399":{"id":"n185978399","loc":[-85.6347861,41.9606613]},"n185978402":{"id":"n185978402","loc":[-85.634806,41.961485]},"n185978406":{"id":"n185978406","loc":[-85.6348298,41.964783]},"n185978410":{"id":"n185978410","loc":[-85.6348766,41.9677088]},"n185978414":{"id":"n185978414","loc":[-85.634938,41.971566]},"n185978415":{"id":"n185978415","loc":[-85.634942,41.971611]},"n185978417":{"id":"n185978417","loc":[-85.634952,41.971655]},"n185978419":{"id":"n185978419","loc":[-85.634989,41.971741]},"n185978420":{"id":"n185978420","loc":[-85.635063,41.971864]},"n185978787":{"id":"n185978787","loc":[-85.627936,41.954693]},"n185978790":{"id":"n185978790","loc":[-85.626832,41.954677]},"n185978967":{"id":"n185978967","loc":[-85.632278,41.948613]},"n185980735":{"id":"n185980735","loc":[-85.628639,41.953725]},"n185982163":{"id":"n185982163","loc":[-85.636233,41.952398]},"n185982193":{"id":"n185982193","loc":[-85.6313855,41.9499125]},"n185982195":{"id":"n185982195","loc":[-85.6304857,41.9511945]},"n185982196":{"id":"n185982196","loc":[-85.626336,41.957291]},"n185982197":{"id":"n185982197","loc":[-85.625578,41.958664]},"n185982198":{"id":"n185982198","loc":[-85.624619,41.960145]},"n185982200":{"id":"n185982200","loc":[-85.624494,41.960338]},"n185984017":{"id":"n185984017","loc":[-85.636163,41.947382]},"n185984020":{"id":"n185984020","loc":[-85.636188,41.9498803]},"n185984022":{"id":"n185984022","loc":[-85.636276,41.955919]},"n185984024":{"id":"n185984024","loc":[-85.636279,41.956901]},"n185988036":{"id":"n185988036","loc":[-85.631422,41.948294]},"n185988867":{"id":"n185988867","loc":[-85.63102,41.948805]},"n185988869":{"id":"n185988869","loc":[-85.630773,41.949209]},"n185988871":{"id":"n185988871","loc":[-85.63005,41.95016]},"n185988872":{"id":"n185988872","loc":[-85.629423,41.951016]},"n185988873":{"id":"n185988873","loc":[-85.629252,41.951256]},"n185988875":{"id":"n185988875","loc":[-85.629126,41.951489]},"n185988877":{"id":"n185988877","loc":[-85.628991,41.951704]},"n185988878":{"id":"n185988878","loc":[-85.628689,41.952112]},"n185988879":{"id":"n185988879","loc":[-85.628313,41.952666]},"n185988880":{"id":"n185988880","loc":[-85.627687,41.953529]},"n185988882":{"id":"n185988882","loc":[-85.627394,41.953947]},"n185988884":{"id":"n185988884","loc":[-85.627287,41.954128]},"n1819858502":{"id":"n1819858502","loc":[-85.6328435,41.9455473]},"n1819858510":{"id":"n1819858510","loc":[-85.6324841,41.9453438]},"n1819858515":{"id":"n1819858515","loc":[-85.6318511,41.9446409]},"n1819858520":{"id":"n1819858520","loc":[-85.6326558,41.9454708]},"n1819858522":{"id":"n1819858522","loc":[-85.6319048,41.9447407]},"n1819858524":{"id":"n1819858524","loc":[-85.6317718,41.9443666]},"n1819858530":{"id":"n1819858530","loc":[-85.632055,41.9449128]},"n2139795768":{"id":"n2139795768","loc":[-85.6243023,41.9606102]},"n2139832645":{"id":"n2139832645","loc":[-85.6324455,41.9448607]},"n2139832649":{"id":"n2139832649","loc":[-85.6328043,41.9454773]},"n2139832651":{"id":"n2139832651","loc":[-85.6322547,41.9449621]},"n2139832675":{"id":"n2139832675","loc":[-85.6327356,41.944757]},"n2139832677":{"id":"n2139832677","loc":[-85.6325433,41.9448599]},"n2139832680":{"id":"n2139832680","loc":[-85.6328885,41.9455614]},"n2139832682":{"id":"n2139832682","loc":[-85.6320913,41.9449492]},"n2139832684":{"id":"n2139832684","loc":[-85.6325366,41.9447133]},"n2139832688":{"id":"n2139832688","loc":[-85.6322786,41.94485]},"n2139832718":{"id":"n2139832718","loc":[-85.6327486,41.9432475]},"n2139832719":{"id":"n2139832719","loc":[-85.6327926,41.9431773]},"n2139832720":{"id":"n2139832720","loc":[-85.6329033,41.943153]},"n2139832727":{"id":"n2139832727","loc":[-85.6328975,41.9430783]},"n2139844839":{"id":"n2139844839","loc":[-85.6326261,41.9432308]},"n2189015992":{"id":"n2189015992","loc":[-85.6347706,41.9593383]},"n2189153179":{"id":"n2189153179","loc":[-85.6340476,41.9472565]},"n2189153182":{"id":"n2189153182","loc":[-85.6342638,41.9472522]},"n2189153241":{"id":"n2189153241","loc":[-85.6354184,41.9473091]},"n2189153258":{"id":"n2189153258","loc":[-85.6354611,41.9472366]},"n2189153277":{"id":"n2189153277","loc":[-85.6328948,41.9462374]},"n2199109755":{"id":"n2199109755","loc":[-85.6336729,41.9472417]},"w203970139":{"id":"w203970139","tags":{"building":"yes"},"nodes":["n2139824793","n2139824787","n2139824773","n2139824778","n2139824793"]},"w203970098":{"id":"w203970098","tags":{"building":"yes"},"nodes":["n2139824748","n2139824712","n2139824726","n2139824760","n2139824748"]},"w208643132":{"id":"w208643132","tags":{"area":"yes","building":"yes"},"nodes":["n2189153195","n2189153196","n2189153197","n2189153198","n2189153195"]},"w203970094":{"id":"w203970094","tags":{"building":"yes"},"nodes":["n2139824755","n2139824753","n2139824759","n2139824764","n2139824763","n2139824767","n2139824770","n2139824782","n2139824772","n2139824756","n2139824751","n2139824754","n2139824755"]},"w208643138":{"id":"w208643138","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189153231","n2189153232","n2189153240","n2189153244","n2189153236","n2189153238","n2189153237","n2189153239","n2189153252","n2189153235","n2189153234","n2189153253","n2189153233","n2189153231"]},"w203970125":{"id":"w203970125","tags":{"building":"yes"},"nodes":["n2139824735","n2139824738","n2139824757","n2139824749","n2139824735"]},"w170848823":{"id":"w170848823","tags":{"name":"Rocky River","waterway":"river"},"nodes":["n1819849189","n1819858516","n1819858519","n1819858504","n1819858525","n1819858506","n1819858513"]},"w203970898":{"id":"w203970898","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139832645","n2139832647","n2139832649","n2139832651","n2139832645"]},"w203970134":{"id":"w203970134","tags":{"building":"yes"},"nodes":["n2139824796","n2139824803","n2139824797","n2139824788","n2139824796"]},"w203970104":{"id":"w203970104","tags":{"building":"yes"},"nodes":["n2139824733","n2139824730","n2139824714","n2139824721","n2139824733"]},"w206805245":{"id":"w206805245","tags":{"area":"yes","building":"yes"},"nodes":["n2168544780","n2168544781","n2139824796","n2139824803","n2168544780"]},"w206805252":{"id":"w206805252","tags":{"area":"yes","building":"yes"},"nodes":["n2168544838","n2168544839","n2168544840","n2168544841","n2168544842","n2168544843","n2168544844","n2168544845","n2168544846","n2168544847","n2168544838"]},"w203970099":{"id":"w203970099","tags":{"building":"yes"},"nodes":["n2139824783","n2139824795","n2139824790","n2139824779","n2139824783"]},"w17967730":{"id":"w17967730","tags":{"highway":"residential","name":"Water St"},"nodes":["n185963451","n2189153277","n185988036","n185988867","n185988869","n185988871","n185988872","n185988873","n185988875","n185988877","n185988878","n185988879","n185988880","n185988882","n185988884","n185978790"]},"w208643133":{"id":"w208643133","tags":{"area":"yes","building":"yes"},"nodes":["n2189153199","n2189153200","n2189153201","n2189153202","n2189153199"]},"w203970127":{"id":"w203970127","tags":{"building":"yes"},"nodes":["n2139824794","n2139824783","n2139824789","n2139824797","n2139824794"]},"w208643139":{"id":"w208643139","tags":{"highway":"service"},"nodes":["n185988237","n2189153242","n2189153247","n2189153241"]},"w203988297":{"id":"w203988297","tags":{"amenity":"parking","area":"yes"},"nodes":["n2140006423","n2140006441","n2140006425","n2140006426","n2140006440","n2140006427","n2140006428","n2140006429","n2140006430","n2140006423"]},"w206805250":{"id":"w206805250","tags":{"area":"yes","building":"yes"},"nodes":["n2168544827","n2168544823","n2168544825","n2168544800","n2168544829","n2168544827"]},"w208643140":{"id":"w208643140","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153242","n2189153254","n2189153243","n2189153244","n2189153251","n2189153257","n2189153245","n2189153252","n2189153246"]},"w203974055":{"id":"w203974055","tags":{"bridge":"yes","highway":"path","name":"Riverwalk Trail"},"nodes":["n2139870376","n2139870377"]},"w206805247":{"id":"w206805247","tags":{"area":"yes","building":"yes"},"nodes":["n2168544785","n2168544786","n2168544783","n2168544787","n2168544788","n2168544789","n2168544785"]},"w17964996":{"id":"w17964996","tags":{"highway":"residential","name":"Foster St"},"nodes":["n1819858524","n1819858515","n1819858522","n1819858530","n2139832682","n1819858510","n1819858520","n1819858502","n2139832680","n185963451","n1819858527","n185963452","n185963453","n185963454","n185963455","n185963456"]},"w208643144":{"id":"w208643144","tags":{"area":"yes","building":"yes"},"nodes":["n2189153264","n2189153265","n2189153266","n2189153267","n2189153268","n2189153269","n2189153270","n2189153264"]},"w203970914":{"id":"w203970914","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139832722","n2139832723","n2139832724","n2139832725","n2139832726","n2139832727","n2139844839","n2139832722"]},"w208643143":{"id":"w208643143","tags":{"area":"yes","building":"yes"},"nodes":["n2189153258","n2189153259","n2189153260","n2189153261","n2189153262","n2189153263","n2189153258"]},"w203049590":{"id":"w203049590","tags":{"amenity":"parking","area":"yes"},"nodes":["n2130304152","n2130304153","n2140006403","n2130304154","n2130304156","n2130304155","n2130304160","n2130304152"]},"w203974054":{"id":"w203974054","tags":{"highway":"path","name":"Riverwalk Trail"},"nodes":["n2139858971","n2139870373","n2139870374"]},"w203049595":{"id":"w203049595","tags":{"highway":"service"},"nodes":["n2130304158","n2130304159","n2130304160","n2139832635","n2139832639"]},"w203970913":{"id":"w203970913","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2139832715","n2139832716","n2139832717","n2139832718","n2139832719","n2139832720","n2139832721","n2139832716"]},"w208643134":{"id":"w208643134","tags":{"area":"yes","building":"yes"},"nodes":["n2189153203","n2189153204","n2189153205","n2189153206","n2189153207","n2189153208","n2189153209","n2189153210","n2189153211","n2189153212","n2189153213","n2189153214","n2189153203"]},"w134150808":{"id":"w134150808","tags":{"bridge":"yes","highway":"residential","name":"Moore St"},"nodes":["n185988239","n185984009","n185988241","n1475284019"]},"w203970115":{"id":"w203970115","tags":{"building":"yes"},"nodes":["n2139824761","n2139824727","n2139824736","n2139824771","n2139824761"]},"w208643130":{"id":"w208643130","tags":{"area":"yes","building":"yes"},"nodes":["n2189153183","n2189153184","n2189153185","n2189153186","n2189153187","n2189153188","n2189153189","n2189153190","n2189153183"]},"w206805246":{"id":"w206805246","tags":{"area":"yes","building":"yes"},"nodes":["n2168544782","n2168544780","n2168544781","n2168544783","n2168544787","n2168544784","n2168544782"]},"w203970138":{"id":"w203970138","tags":{"building":"yes"},"nodes":["n2139824729","n2139824720","n2139824702","n2139824707","n2139824729"]},"w203970133":{"id":"w203970133","tags":{"building":"yes"},"nodes":["n2139824748","n2139824737","n2139824717","n2139824728","n2139824748"]},"w203970907":{"id":"w203970907","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2139832700","n2139832701","n2139832702"]},"w203974056":{"id":"w203974056","tags":{"highway":"path","name":"Riverwalk Trail"},"nodes":["n2139870377","n2139870378"]},"w203970897":{"id":"w203970897","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2130304156","n2166205688","n2139832635","n2139832636","n2139832637","n2139832639","n2139832641","n2166205688"]},"w203974057":{"id":"w203974057","tags":{"highway":"path","name":"Riverwalk Trail"},"nodes":["n2139870375","n2139870376"]},"w203049594":{"id":"w203049594","tags":{"highway":"service"},"nodes":["n2130304156","n2139870378","n2139832706","n2139832704","n2130304157"]},"w203970122":{"id":"w203970122","tags":{"building":"yes"},"nodes":["n2139824757","n2139824740","n2139824747","n2139824762","n2139824757"]},"w208643136":{"id":"w208643136","tags":{"area":"yes","building":"yes"},"nodes":["n2189153219","n2189153220","n2189153221","n2189153222","n2189153223","n2189153224","n2189153225","n2189153226","n2189153219"]},"w203970128":{"id":"w203970128","tags":{"building":"yes"},"nodes":["n2139824732","n2139824752","n2139824744","n2139824724","n2139824732"]},"w203970097":{"id":"w203970097","tags":{"building":"yes"},"nodes":["n2139824737","n2139824733","n2139824710","n2139824716","n2139824737"]},"w203970137":{"id":"w203970137","tags":{"building":"yes"},"nodes":["n2139824765","n2139824774","n2139824758","n2139824746","n2139824765"]},"w134150840":{"id":"w134150840","tags":{"highway":"residential","name":"Moore St"},"nodes":["n1475284019","n185988243","n185988244","n185988245"]},"w17967628":{"id":"w17967628","tags":{"highway":"residential","name":"Moore St"},"nodes":["n185978388","n2139832709","n185988237","n185988239"]},"w203988292":{"id":"w203988292","tags":{"bridge":"yes","highway":"footway"},"nodes":["n2140006407","n2140006405"]},"w203970118":{"id":"w203970118","tags":{"building":"yes"},"nodes":["n2139824775","n2139824785","n2139824780","n2139824768","n2139824775"]},"w203970121":{"id":"w203970121","tags":{"building":"yes"},"nodes":["n2139824768","n2139824781","n2139824776","n2139824765","n2139824768"]},"w17967752":{"id":"w17967752","tags":{"highway":"residential","name":"Railroad Drive"},"nodes":["n185964980","n2139832699","n2139832700","n2130304158","n185988969","n185988971","n185988972","n1475284011"]},"w203970136":{"id":"w203970136","tags":{"building":"yes"},"nodes":["n2139824798","n2139824793","n2139824777","n2139824784","n2139824798"]},"w203970142":{"id":"w203970142","tags":{"building":"yes"},"nodes":["n2139824808","n2139824809","n2139824807","n2139824806","n2139824801","n2139824800","n2139824804","n2139824805","n2139824808"]},"w208643137":{"id":"w208643137","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189153227","n2189153248","n2189153228","n2189153234","n2189153235","n2189153229","n2189153249","n2189153230","n2189153227"]},"w208643129":{"id":"w208643129","tags":{"area":"yes","building":"yes"},"nodes":["n2189153179","n2189153180","n2189153181","n2189153182","n2189153179"]},"w203970909":{"id":"w203970909","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139832703","n2139832704","n2139832706","n2139832708","n2139832703"]},"w203970905":{"id":"w203970905","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2139832688","n2139832691"]},"w203988298":{"id":"w203988298","tags":{"highway":"service"},"nodes":["n2140006431","n2140006433","n2140006435","n2140006436","n2140006437","n2140006438","n2140006439","n2140006440"]},"w203970106":{"id":"w203970106","tags":{"building":"yes"},"nodes":["n2139824798","n2139824791","n2139824799","n2139824802","n2139824798"]},"w203970129":{"id":"w203970129","tags":{"building":"yes"},"nodes":["n2139824787","n2139824782","n2139824766","n2139824769","n2139824787"]},"w208643131":{"id":"w208643131","tags":{"area":"yes","building":"yes"},"nodes":["n2189153191","n2189153192","n2189153193","n2189153194","n2189153191"]},"w206805249":{"id":"w206805249","tags":{"area":"yes","building":"yes"},"nodes":["n2168544800","n2168544801","n2168544802","n2168544805","n2168544807","n2168544809","n2168544811","n2168544813","n2168544815","n2168544817","n2168544819","n2168544821","n2168544823","n2168544825","n2168544800"]},"w134150800":{"id":"w134150800","tags":{"bridge":"yes","highway":"primary","name":"W Michigan Ave","old_ref":"US 131","ref":"US 131 Business;M 60"},"nodes":["n185964972","n185964976"]},"w17966984":{"id":"w17966984","tags":{"highway":"residential","name":"Portage Avenue"},"nodes":["n185978375","n185963456","n2189153218","n185966937","n185978967","n185967422","n185982193","n185968100","n185982195","n185960195","n185980735","n185978787","n185966948","n185982196","n185982197","n185982198","n185982200","n2139795768","n185972155"]},"w203988294":{"id":"w203988294","tags":{"amenity":"shelter","area":"yes","building":"yes","shelter_type":"picnic_shelter"},"nodes":["n2140006409","n2140006411","n2140006413","n2140006415","n2140006409"]},"w203970912":{"id":"w203970912","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139832711","n2139832712","n2139832713","n2139832714","n2139832711"]},"w203970119":{"id":"w203970119","tags":{"building":"yes"},"nodes":["n2139824713","n2139824705","n2139824683","n2139824689","n2139824713"]},"w203970114":{"id":"w203970114","tags":{"building":"yes"},"nodes":["n2139824735","n2139824750","n2139824745","n2139824732","n2139824735"]},"w208643142":{"id":"w208643142","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153254","n2189153255","n2189153256","n2189153257"]},"w206805253":{"id":"w206805253","tags":{"area":"yes","building":"yes"},"nodes":["n2168544848","n2168544849","n2168544850","n2168544851","n2168544852","n2168544853","n2168544854","n2168544855","n2168544848"]},"w143497377":{"id":"w143497377","tags":{"highway":"primary","name":"North Main Street","old_ref":"US 131","ref":"US 131 Business"},"nodes":["n185962625","n185978420","n185978419","n185978417","n185978415","n185978414","n185975735","n1475293254","n185978410","n185978406","n185970515","n185978402","n185978399","n185965399","n2189015992","n185961396","n185967917","n185978394","n185971631","n185960796","n185978392","n185974583","n185978390","n185971578","n185965289","n2189153215","n185978388","n185978383","n185978381","n185978379","n185978377","n185978375","n185964982"]},"w134150811":{"id":"w134150811","tags":{"highway":"primary","name":"West Michigan Avenue","old_ref":"US 131","ref":"US 131 Business;M 60"},"nodes":["n185964976","n2130304157","n1475284023","n2139832715","n185964980","n185964982"]},"w208643135":{"id":"w208643135","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153215","n2189153216","n2189153217","n2189153218"]},"w17967183":{"id":"w17967183","tags":{"highway":"residential","name":"West Street"},"nodes":["n1475284011","n185984011","n185984013","n185984015","n2189153246","n2189153250","n185965291","n185984017","n185971580","n185984020","n185974585","n185982163","n185975064","n185971632","n185984022","n185984024","n185967918"]},"w134150778":{"id":"w134150778","tags":{"bridge":"yes","highway":"residential","name":"Moore St"},"nodes":["n185988245","n1475283992","n185975911"]},"w206805248":{"id":"w206805248","tags":{"area":"yes","building":"yes"},"nodes":["n2168544790","n2168544791","n2168544792","n2168544793","n2168544795","n2168544797","n2168544798","n2168544799","n2168544802","n2168544801","n2168544790"]},"w203974058":{"id":"w203974058","tags":{"bridge":"yes","highway":"path","name":"Riverwalk Trail"},"nodes":["n2139870374","n2139870375"]},"w203970902":{"id":"w203970902","tags":{"highway":"service"},"nodes":["n2139832678","n2139832691","n2139832680"]},"w203988296":{"id":"w203988296","tags":{"highway":"path"},"nodes":["n2139858967","n2140006421","n2139858935"]},"w206805251":{"id":"w206805251","tags":{"area":"yes","building":"yes"},"nodes":["n2168544830","n2168544831","n2168544832","n2168544833","n2168544834","n2168544835","n2168544836","n2168544837","n2168544830"]},"w203970906":{"id":"w203970906","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139832693","n2139832694","n2139832696","n2139832697","n2139832698","n2139832693"]},"w203049598":{"id":"w203049598","tags":{"area":"yes","leisure":"pitch","sport":"tennis"},"nodes":["n2130304162","n2130304163","n2130304164","n2130304165","n2130304162"]},"w203970911":{"id":"w203970911","tags":{"highway":"service"},"nodes":["n2139832709","n2139832714","n2139832713","n2139832710","n185988971"]},"w203970105":{"id":"w203970105","tags":{"building":"yes"},"nodes":["n2139824779","n2139824792","n2139824786","n2139824775","n2139824779"]},"w203988290":{"id":"w203988290","tags":{"highway":"footway"},"nodes":["n2140006403","n2140006407"]},"w203970900":{"id":"w203970900","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139832653","n2139832663","n2139832665","n2139832667","n2139832669","n2139832671","n2139832673","n2139832675","n2139832677","n2139832653"]},"w209717048":{"id":"w209717048","tags":{"area":"yes","building":"yes"},"nodes":["n2199109755","n2199109756","n2199109757","n2199109758","n2199109759","n2199109760","n2199109755"]},"w208643141":{"id":"w208643141","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153247","n2189153248","n2189153249","n2189153250"]},"w203970903":{"id":"w203970903","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2139832682","n2139832688","n2139832684","n2139832678","n2139832686"]},"n354002527":{"id":"n354002527","loc":[-85.6236039,41.9458813],"tags":{"amenity":"school","name":"Barrows School"}},"n185963396":{"id":"n185963396","loc":[-85.627401,41.943496]},"n185963397":{"id":"n185963397","loc":[-85.627403,41.943625]},"n185965101":{"id":"n185965101","loc":[-85.626409,41.943215]},"n185971474":{"id":"n185971474","loc":[-85.624884,41.943508]},"n185971475":{"id":"n185971475","loc":[-85.625191,41.943509]},"n185971482":{"id":"n185971482","loc":[-85.624882,41.94382]},"n185983135":{"id":"n185983135","loc":[-85.624893,41.945616]},"n185983137":{"id":"n185983137","loc":[-85.624912,41.946524]},"n185988027":{"id":"n185988027","loc":[-85.622721,41.946535]},"n185963398":{"id":"n185963398","loc":[-85.6273993,41.9446899]},"n185983238":{"id":"n185983238","loc":[-85.6227157,41.9456321]},"n185980374":{"id":"n185980374","loc":[-85.6248856,41.9447242]},"n185980373":{"id":"n185980373","loc":[-85.6226744,41.9447371]},"n2196831342":{"id":"n2196831342","loc":[-85.6250924,41.945063]},"n2196831343":{"id":"n2196831343","loc":[-85.6252335,41.9450636]},"n2196831344":{"id":"n2196831344","loc":[-85.6252286,41.9448707]},"n2196831345":{"id":"n2196831345","loc":[-85.6250661,41.9448707]},"n2196831346":{"id":"n2196831346","loc":[-85.6250243,41.9449012]},"n2196831347":{"id":"n2196831347","loc":[-85.6250251,41.9449244]},"n2196831348":{"id":"n2196831348","loc":[-85.6250867,41.9449257]},"n2196831349":{"id":"n2196831349","loc":[-85.625349,41.9445058]},"n2196831350":{"id":"n2196831350","loc":[-85.6253471,41.9443882]},"n2196831351":{"id":"n2196831351","loc":[-85.6251516,41.94439]},"n2196831352":{"id":"n2196831352","loc":[-85.6251522,41.9444308]},"n2196831353":{"id":"n2196831353","loc":[-85.6251344,41.9444309]},"n2196831354":{"id":"n2196831354","loc":[-85.6251356,41.9445077]},"n2196831355":{"id":"n2196831355","loc":[-85.6232357,41.9463406]},"n2196831356":{"id":"n2196831356","loc":[-85.6232409,41.9460668]},"n2196831357":{"id":"n2196831357","loc":[-85.6232072,41.9460665]},"n2196831358":{"id":"n2196831358","loc":[-85.6232117,41.9458272]},"n2196831359":{"id":"n2196831359","loc":[-85.6229808,41.9458248]},"n2196831360":{"id":"n2196831360","loc":[-85.6229763,41.9460627]},"n2196831361":{"id":"n2196831361","loc":[-85.623006,41.946063]},"n2196831362":{"id":"n2196831362","loc":[-85.6230023,41.9462557]},"n2196831363":{"id":"n2196831363","loc":[-85.6230755,41.9462565]},"n2196831364":{"id":"n2196831364","loc":[-85.6230739,41.9463389]},"n185947349":{"id":"n185947349","loc":[-85.618327,41.945607]},"n185947359":{"id":"n185947359","loc":[-85.615453,41.945597]},"n185947378":{"id":"n185947378","loc":[-85.617231,41.945603]},"n185947474":{"id":"n185947474","loc":[-85.616136,41.945602]},"n185948972":{"id":"n185948972","loc":[-85.615273,41.945637]},"n185955019":{"id":"n185955019","loc":[-85.620172,41.945627]},"n185960682":{"id":"n185960682","loc":[-85.622759,41.951845]},"n185961369":{"id":"n185961369","loc":[-85.622758,41.947444]},"n185961371":{"id":"n185961371","loc":[-85.624908,41.947416]},"n185963392":{"id":"n185963392","loc":[-85.6270462,41.9409953]},"n185963393":{"id":"n185963393","loc":[-85.627295,41.941304]},"n185963394":{"id":"n185963394","loc":[-85.627352,41.94148]},"n185963395":{"id":"n185963395","loc":[-85.62737,41.942261]},"n185965099":{"id":"n185965099","loc":[-85.6264,41.942263]},"n185965108":{"id":"n185965108","loc":[-85.622769,41.949224]},"n185965110":{"id":"n185965110","loc":[-85.624937,41.949237]},"n185966295":{"id":"n185966295","loc":[-85.6299942,41.9446689]},"n185966342":{"id":"n185966342","loc":[-85.624873,41.942022]},"n185970222":{"id":"n185970222","loc":[-85.622761,41.948357]},"n185970224":{"id":"n185970224","loc":[-85.624924,41.9483338]},"n185971477":{"id":"n185971477","loc":[-85.620051,41.94383]},"n185971478":{"id":"n185971478","loc":[-85.621219,41.943801]},"n185971481":{"id":"n185971481","loc":[-85.621812,41.943807]},"n185973866":{"id":"n185973866","loc":[-85.627629,41.946498]},"n185974699":{"id":"n185974699","loc":[-85.6227688,41.950119]},"n185978800":{"id":"n185978800","loc":[-85.623953,41.954684]},"n185980372":{"id":"n185980372","loc":[-85.621459,41.944756]},"n185980378":{"id":"n185980378","loc":[-85.6286375,41.9446764]},"n185980380":{"id":"n185980380","loc":[-85.630139,41.944661]},"n185980382":{"id":"n185980382","loc":[-85.630298,41.944635]},"n185980384":{"id":"n185980384","loc":[-85.630759,41.94454]},"n185980386":{"id":"n185980386","loc":[-85.6312369,41.9444548]},"n185983133":{"id":"n185983133","loc":[-85.6248672,41.9415903]},"n185983139":{"id":"n185983139","loc":[-85.624951,41.950239]},"n185983140":{"id":"n185983140","loc":[-85.624934,41.950681]},"n185983141":{"id":"n185983141","loc":[-85.624813,41.950983]},"n185983143":{"id":"n185983143","loc":[-85.6246225,41.951591]},"n185983144":{"id":"n185983144","loc":[-85.623908,41.9539165]},"n185983145":{"id":"n185983145","loc":[-85.6238903,41.9540956]},"n185983146":{"id":"n185983146","loc":[-85.623898,41.95431]},"n185983236":{"id":"n185983236","loc":[-85.628481,41.945611]},"n185985914":{"id":"n185985914","loc":[-85.620072,41.946538]},"n185986812":{"id":"n185986812","loc":[-85.6227785,41.9510005]},"n185988028":{"id":"n185988028","loc":[-85.6281401,41.9469632]},"n185988030":{"id":"n185988030","loc":[-85.6282451,41.9470314]},"n185988032":{"id":"n185988032","loc":[-85.6283312,41.9470656]},"w17964989":{"id":"w17964989","tags":{"highway":"residential","name":"Middle St"},"nodes":["n185963392","n185963393","n185963394","n185963395","n185963396","n185963397","n185963398"]},"w17965158":{"id":"w17965158","tags":{"access":"private","highway":"service","name":"Battle St"},"nodes":["n185965099","n185965101"]},"w41074896":{"id":"w41074896","tags":{"highway":"secondary","name":"East Michigan Avenue","name_1":"State Highway 60","ref":"M 60"},"nodes":["n185980372","n185980373","n185980374","n185963398","n185980378","n185966295","n185980380","n185980382","n185980384","n185980386"]},"w17965846":{"id":"w17965846","tags":{"highway":"residential","name":"2nd Ave"},"nodes":["n185971477","n185971478","n185971481","n185971482"]},"w209470306":{"id":"w209470306","tags":{"area":"yes","building":"yes"},"nodes":["n2196831349","n2196831350","n2196831351","n2196831352","n2196831353","n2196831354","n2196831349"]},"w17965845":{"id":"w17965845","tags":{"highway":"residential","name":"2nd Ave"},"nodes":["n185971474","n185971475","n185963396"]},"w209470307":{"id":"w209470307","tags":{"area":"yes","building":"yes"},"nodes":["n2196831355","n2196831356","n2196831357","n2196831358","n2196831359","n2196831360","n2196831361","n2196831362","n2196831363","n2196831364","n2196831355"]},"w17968192":{"id":"w17968192","tags":{"highway":"residential","name":"Washington St"},"nodes":["n185980373","n185983238","n185988027","n185961369","n185970222","n185965108","n185974699","n185986812","n185960682"]},"w17967603":{"id":"w17967603","tags":{"highway":"residential","name":"5th Ave"},"nodes":["n185985914","n185988027","n185983137","n185973866","n185988028","n185988030","n185988032"]},"w209470305":{"id":"w209470305","tags":{"area":"yes","building":"yes"},"nodes":["n2196831342","n2196831343","n2196831344","n2196831345","n2196831346","n2196831347","n2196831348","n2196831342"]},"w17967092":{"id":"w17967092","tags":{"highway":"residential","name":"Wood St"},"nodes":["n185983133","n185966342","n185971474","n185971482","n185980374","n185983135","n185983137","n185961371","n185970224","n185965110","n185983139","n185983140","n185983141","n185983143","n185983144","n185983145","n185983146","n185978800"]},"w17967107":{"id":"w17967107","tags":{"highway":"residential","name":"4th Ave"},"nodes":["n185983236","n185983135","n185983238","n185955019","n185947349","n185947378","n185947474","n185947359","n185948972"]},"n354030330":{"id":"n354030330","loc":[-85.6297222,41.9444444],"tags":{"leisure":"park","name":"Scouter Park"}},"n185966296":{"id":"n185966296","loc":[-85.629998,41.944078]},"n185966298":{"id":"n185966298","loc":[-85.629972,41.943927]},"n185966300":{"id":"n185966300","loc":[-85.629948,41.943783]},"n185980391":{"id":"n185980391","loc":[-85.6322992,41.9442766]},"n185980393":{"id":"n185980393","loc":[-85.6324925,41.9442136]},"n185980389":{"id":"n185980389","loc":[-85.6320272,41.9443281]},"n185980388":{"id":"n185980388","loc":[-85.6315778,41.9443959]},"n354031320":{"id":"n354031320","loc":[-85.6280556,41.9447222],"tags":{"amenity":"place_of_worship","name":"Riverside Church","religion":"christian"}},"n185987309":{"id":"n185987309","loc":[-85.6286497,41.9453531]},"n185987311":{"id":"n185987311","loc":[-85.6285942,41.9454805]},"n185988034":{"id":"n185988034","loc":[-85.6285815,41.9471692]},"n185988896":{"id":"n185988896","loc":[-85.6318433,41.9437929]},"n185977764":{"id":"n185977764","loc":[-85.6322988,41.943472]},"n1819848852":{"id":"n1819848852","loc":[-85.6315188,41.9448808]},"n1819848912":{"id":"n1819848912","loc":[-85.6284289,41.9472189]},"n1819848925":{"id":"n1819848925","loc":[-85.6314501,41.9451617]},"n1819848949":{"id":"n1819848949","loc":[-85.6309394,41.9455192]},"n1819848951":{"id":"n1819848951","loc":[-85.6290297,41.9457187]},"n1819848963":{"id":"n1819848963","loc":[-85.630521,41.9455591]},"n1819848981":{"id":"n1819848981","loc":[-85.6292936,41.9455846]},"n1819848989":{"id":"n1819848989","loc":[-85.6298451,41.9455431]},"n1819848998":{"id":"n1819848998","loc":[-85.6314973,41.9446254]},"n1819849018":{"id":"n1819849018","loc":[-85.6302807,41.9455527]},"n1819849043":{"id":"n1819849043","loc":[-85.6285533,41.9469731]},"n1819849087":{"id":"n1819849087","loc":[-85.6314501,41.9453532]},"n1819849090":{"id":"n1819849090","loc":[-85.628843,41.9461033]},"n1819849109":{"id":"n1819849109","loc":[-85.6311926,41.9454729]},"n1819849116":{"id":"n1819849116","loc":[-85.6288967,41.9459437]},"n1819849177":{"id":"n1819849177","loc":[-85.6287894,41.9464544]},"n1819858529":{"id":"n1819858529","loc":[-85.6325485,41.9445625]},"n2189112797":{"id":"n2189112797","loc":[-85.6275271,41.944555]},"n2189112798":{"id":"n2189112798","loc":[-85.6275196,41.9437258]},"n2189112799":{"id":"n2189112799","loc":[-85.6278937,41.943723]},"n2189112800":{"id":"n2189112800","loc":[-85.6278969,41.9439191]},"n2189112801":{"id":"n2189112801","loc":[-85.6279907,41.9439345]},"n2189112802":{"id":"n2189112802","loc":[-85.6280817,41.9439663]},"n2189112803":{"id":"n2189112803","loc":[-85.6281768,41.9440145]},"n2189112804":{"id":"n2189112804","loc":[-85.6281933,41.9440483]},"n2189112805":{"id":"n2189112805","loc":[-85.6281671,41.9440535]},"n2189112806":{"id":"n2189112806","loc":[-85.6281933,41.9440935]},"n2189112807":{"id":"n2189112807","loc":[-85.6282126,41.9441437]},"n2189112808":{"id":"n2189112808","loc":[-85.628214,41.9441991]},"n2189112809":{"id":"n2189112809","loc":[-85.6283298,41.944196]},"n2189112810":{"id":"n2189112810","loc":[-85.6283285,41.9442616]},"n2189112811":{"id":"n2189112811","loc":[-85.6281727,41.9442616]},"n2189112812":{"id":"n2189112812","loc":[-85.6281713,41.9442934]},"n2189112813":{"id":"n2189112813","loc":[-85.6280386,41.9442963]},"n2189112814":{"id":"n2189112814","loc":[-85.6280405,41.9443292]},"n2189112815":{"id":"n2189112815","loc":[-85.627829,41.9443349]},"n2189112816":{"id":"n2189112816","loc":[-85.6278347,41.9445495]},"n2189153271":{"id":"n2189153271","loc":[-85.6321053,41.9460342]},"n2189153272":{"id":"n2189153272","loc":[-85.632278,41.9457841]},"n2189153273":{"id":"n2189153273","loc":[-85.632823,41.9459936]},"n2189153274":{"id":"n2189153274","loc":[-85.6326845,41.9461963]},"n2189153275":{"id":"n2189153275","loc":[-85.6325664,41.9461507]},"n2189153276":{"id":"n2189153276","loc":[-85.6325323,41.946198]},"n2189153278":{"id":"n2189153278","loc":[-85.6321916,41.9459733]},"n2189153279":{"id":"n2189153279","loc":[-85.6322598,41.9458703]},"n2189153280":{"id":"n2189153280","loc":[-85.6327208,41.9460358]},"n2189153281":{"id":"n2189153281","loc":[-85.6326413,41.9461422]},"n185959079":{"id":"n185959079","loc":[-85.6293702,41.9474668]},"n185966301":{"id":"n185966301","loc":[-85.629692,41.943136]},"n185966304":{"id":"n185966304","loc":[-85.629565,41.942916]},"n185966308":{"id":"n185966308","loc":[-85.629501,41.942751]},"n185966315":{"id":"n185966315","loc":[-85.629472,41.942578]},"n185966319":{"id":"n185966319","loc":[-85.629444,41.942414]},"n185966321":{"id":"n185966321","loc":[-85.629391,41.94205]},"n185966323":{"id":"n185966323","loc":[-85.629369,41.941858]},"n185966327":{"id":"n185966327","loc":[-85.629297,41.941604]},"n185966331":{"id":"n185966331","loc":[-85.629233,41.941549]},"n185966336":{"id":"n185966336","loc":[-85.628504,41.941364]},"n185966338":{"id":"n185966338","loc":[-85.628275,41.941303]},"n185966340":{"id":"n185966340","loc":[-85.6269038,41.9410983]},"n185973867":{"id":"n185973867","loc":[-85.626843,41.947333]},"n185977762":{"id":"n185977762","loc":[-85.6318441,41.9429453]},"n1819848853":{"id":"n1819848853","loc":[-85.625854,41.9492218]},"n1819848861":{"id":"n1819848861","loc":[-85.6251459,41.9552376]},"n1819848874":{"id":"n1819848874","loc":[-85.6267445,41.9482961]},"n1819848882":{"id":"n1819848882","loc":[-85.6257209,41.9552396]},"n1819848883":{"id":"n1819848883","loc":[-85.624706,41.9523173]},"n1819848907":{"id":"n1819848907","loc":[-85.62609,41.9561471]},"n1819848908":{"id":"n1819848908","loc":[-85.6244013,41.9549284]},"n1819848911":{"id":"n1819848911","loc":[-85.6265578,41.9553672]},"n1819848923":{"id":"n1819848923","loc":[-85.6246802,41.9550959]},"n1819848936":{"id":"n1819848936","loc":[-85.6241588,41.9539291]},"n1819848940":{"id":"n1819848940","loc":[-85.62506,41.9511129]},"n1819848944":{"id":"n1819848944","loc":[-85.624942,41.9515912]},"n1819848950":{"id":"n1819848950","loc":[-85.6273989,41.9475461]},"n1819848957":{"id":"n1819848957","loc":[-85.627695,41.947404]},"n1819849009":{"id":"n1819849009","loc":[-85.6259248,41.94896]},"n1819849037":{"id":"n1819849037","loc":[-85.6257252,41.9502112]},"n1819849061":{"id":"n1819849061","loc":[-85.6270084,41.9479626]},"n1819849073":{"id":"n1819849073","loc":[-85.6243734,41.9534583]},"n1819849091":{"id":"n1819849091","loc":[-85.6241373,41.9543918]},"n1819849130":{"id":"n1819849130","loc":[-85.6282572,41.9473067]},"n1819849143":{"id":"n1819849143","loc":[-85.625281,41.9506596]},"n1819849153":{"id":"n1819849153","loc":[-85.6258647,41.9498043]},"n1819849168":{"id":"n1819849168","loc":[-85.6265084,41.9559317]},"n1819849173":{"id":"n1819849173","loc":[-85.6263325,41.9552156]},"n1819849175":{"id":"n1819849175","loc":[-85.6266372,41.9556764]},"n1819849178":{"id":"n1819849178","loc":[-85.6242232,41.9545993]},"n1819849181":{"id":"n1819849181","loc":[-85.6262187,41.9486712]},"n1819849188":{"id":"n1819849188","loc":[-85.6245558,41.9530434]},"n1819849190":{"id":"n1819849190","loc":[-85.6255982,41.9563017]},"n2168544738":{"id":"n2168544738","loc":[-85.6245707,41.9529711]},"w208643145":{"id":"w208643145","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189153271","n2189153272","n2189153273","n2189153274","n2189153275","n2189153276","n2189153271"]},"w17967561":{"id":"w17967561","tags":{"highway":"residential","name":"Garden St"},"nodes":["n185980378","n185987309","n185987311","n185983236","n185973866"]},"w134150802":{"id":"w134150802","tags":{"bridge":"yes","highway":"secondary","name":"East Michigan Avenue","name_1":"State Highway 60","ref":"M 60"},"nodes":["n185980386","n185980388"]},"w208639462":{"id":"w208639462","tags":{"area":"yes","building":"yes"},"nodes":["n2189112797","n2189112798","n2189112799","n2189112800","n2189112801","n2189112802","n2189112803","n2189112804","n2189112805","n2189112806","n2189112807","n2189112808","n2189112809","n2189112810","n2189112811","n2189112812","n2189112813","n2189112814","n2189112815","n2189112816","n2189112797"]},"w134150830":{"id":"w134150830","tags":{"bridge":"yes","highway":"secondary","name":"South Main Street","old_ref":"US 131","ref":"M 86"},"nodes":["n185977762","n185977764"]},"w134150801":{"id":"w134150801","tags":{"highway":"secondary","name":"South Main Street","old_ref":"US 131","ref":"M 86"},"nodes":["n185977764","n185964982"]},"w208643146":{"id":"w208643146","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2189153277","n2189153281","n2189153278","n2189153279","n2189153280","n2189153281"]},"w17966061":{"id":"w17966061","tags":{"highway":"residential","name":"John Glenn Ct"},"nodes":["n185973866","n185973867"]},"w134150772":{"id":"w134150772","tags":{"highway":"residential","name":"5th Ave"},"nodes":["n185988034","n185959079","n185988036","n185978967"]},"w134150836":{"id":"w134150836","tags":{"highway":"secondary","name":"East Michigan Avenue","name_1":"State Highway 60","ref":"M 60"},"nodes":["n185980388","n1819858524","n185980389","n185980391","n185980393","n185964982"]},"w17967734":{"id":"w17967734","tags":{"highway":"residential","name":"Water Street"},"nodes":["n185988896","n185980391","n1819858529"]},"w17965305":{"id":"w17965305","tags":{"highway":"residential","name":"River Dr"},"nodes":["n185966295","n185966296","n185966298","n185966300","n185966301","n185966304","n185966308","n185966315","n185966319","n185966321","n185966323","n185966327","n185966331","n185966336","n185966338","n185963392","n185966340","n185966342"]},"w134150826":{"id":"w134150826","tags":{"bridge":"yes","highway":"residential","name":"5th Ave"},"nodes":["n185988032","n185988034"]},"w170848330":{"id":"w170848330","tags":{"name":"Portage River","waterway":"river"},"nodes":["n1819849190","n1819848907","n1819849168","n1819849175","n1819848911","n1819849173","n1819848882","n1819848861","n1819848923","n1819848908","n1819849178","n1819849091","n1819848936","n1819849073","n1819849188","n2168544738","n1819848883","n1819848944","n1819848940","n1819849143","n1819849037","n1819849153","n1819848853","n1819849009","n1819849181","n1819848874","n1819849061","n1819848950","n1819848957","n1819849130","n1819848912","n1819849043","n1819849177","n1819849090","n1819849116","n1819848951","n1819848981","n1819848989","n1819849018","n1819848963","n1819848949","n1819849109","n1819849087","n1819848925","n1819848852","n1819848998","n1819849057"]},"r270264":{"id":"r270264","tags":{"network":"US:MI","ref":"86","route":"road","state_id":"MI","type":"route","url":"http://en.wikipedia.org/wiki/M-86_%28Michigan_highway%29"},"members":[{"id":"w17737723","type":"way","role":""},{"id":"w17735949","type":"way","role":""},{"id":"w17740404","type":"way","role":""},{"id":"w17966273","type":"way","role":""},{"id":"w17964745","type":"way","role":""},{"id":"w151538068","type":"way","role":""},{"id":"w151538067","type":"way","role":""},{"id":"w17964960","type":"way","role":""},{"id":"w17966099","type":"way","role":""},{"id":"w17968009","type":"way","role":""},{"id":"w41259499","type":"way","role":""},{"id":"w151540401","type":"way","role":""},{"id":"w151540418","type":"way","role":""},{"id":"w17967997","type":"way","role":""},{"id":"w17966029","type":"way","role":""},{"id":"w17964801","type":"way","role":""},{"id":"w41259496","type":"way","role":""},{"id":"w151540399","type":"way","role":""},{"id":"w17968004","type":"way","role":""},{"id":"w17966462","type":"way","role":""},{"id":"w134150830","type":"way","role":""},{"id":"w134150801","type":"way","role":""},{"id":"w17732295","type":"way","role":""}]},"n185980093":{"id":"n185980093","loc":[-85.6271414,41.9407274]},"n185964330":{"id":"n185964330","loc":[-85.6235688,41.9399111]},"n185964328":{"id":"n185964328","loc":[-85.6235609,41.9391301]},"n185958034":{"id":"n185958034","loc":[-85.627102,41.939125]},"n185964331":{"id":"n185964331","loc":[-85.623571,41.940124]},"n185964329":{"id":"n185964329","loc":[-85.623562,41.9392411]},"n185972756":{"id":"n185972756","loc":[-85.623802,41.939102]},"n185972757":{"id":"n185972757","loc":[-85.623584,41.93913]},"n185975325":{"id":"n185975325","loc":[-85.624835,41.939318]},"n185975326":{"id":"n185975326","loc":[-85.624811,41.939435]},"n185975327":{"id":"n185975327","loc":[-85.624635,41.939703]},"n185975328":{"id":"n185975328","loc":[-85.624366,41.940055]},"n185975330":{"id":"n185975330","loc":[-85.624287,41.940113]},"n185975332":{"id":"n185975332","loc":[-85.624215,41.940134]},"n185980088":{"id":"n185980088","loc":[-85.627127,41.940086]},"n185988943":{"id":"n185988943","loc":[-85.622643,41.940128]},"n185988961":{"id":"n185988961","loc":[-85.627263,41.940082]},"n185990192":{"id":"n185990192","loc":[-85.622933,41.939224]},"n185990194":{"id":"n185990194","loc":[-85.621976,41.939203]},"n185991378":{"id":"n185991378","loc":[-85.622643,41.940635]},"n1475283999":{"id":"n1475283999","loc":[-85.6271165,41.9408429]},"n185980090":{"id":"n185980090","loc":[-85.6271315,41.9402001]},"n185958036":{"id":"n185958036","loc":[-85.6248366,41.9391615]},"n1819800188":{"id":"n1819800188","loc":[-85.6246947,41.9401644]},"n1819800199":{"id":"n1819800199","loc":[-85.6233686,41.9430896]},"n1819800204":{"id":"n1819800204","loc":[-85.6223236,41.9408587]},"n1819800213":{"id":"n1819800213","loc":[-85.6247526,41.9414138]},"n1819800216":{"id":"n1819800216","loc":[-85.6230961,41.9407151]},"n1819800218":{"id":"n1819800218","loc":[-85.621991,41.9429336]},"n1819800221":{"id":"n1819800221","loc":[-85.6246088,41.9424708]},"n1819800227":{"id":"n1819800227","loc":[-85.6241368,41.9403081]},"n1819800230":{"id":"n1819800230","loc":[-85.6226776,41.9431012]},"n1819800231":{"id":"n1819800231","loc":[-85.6243728,41.9401644]},"n1819800232":{"id":"n1819800232","loc":[-85.6249629,41.9408907]},"n1819800248":{"id":"n1819800248","loc":[-85.6238685,41.9405555]},"n1819800266":{"id":"n1819800266","loc":[-85.6246882,41.9418367]},"n1819800271":{"id":"n1819800271","loc":[-85.62492,41.9413695]},"n1819800294":{"id":"n1819800294","loc":[-85.6243556,41.9427465]},"n1819800304":{"id":"n1819800304","loc":[-85.6251453,41.94117]},"n1819800325":{"id":"n1819800325","loc":[-85.6248234,41.9405714]},"n1819800362":{"id":"n1819800362","loc":[-85.6239544,41.9429416]},"n1819800368":{"id":"n1819800368","loc":[-85.6243406,41.9402283]},"n1819800375":{"id":"n1819800375","loc":[-85.6226562,41.940755]},"n1819800377":{"id":"n1819800377","loc":[-85.6232033,41.9406512]},"n185945133":{"id":"n185945133","loc":[-85.623501,41.933232]},"n185945135":{"id":"n185945135","loc":[-85.624776,41.933205]},"n185945395":{"id":"n185945395","loc":[-85.624741,41.93019]},"n185952239":{"id":"n185952239","loc":[-85.615166,41.9382]},"n185954490":{"id":"n185954490","loc":[-85.624721,41.929278]},"n185957831":{"id":"n185957831","loc":[-85.625041,41.938662]},"n185958030":{"id":"n185958030","loc":[-85.629033,41.93913]},"n185958032":{"id":"n185958032","loc":[-85.628429,41.939143]},"n185958498":{"id":"n185958498","loc":[-85.621605,41.940143]},"n185961186":{"id":"n185961186","loc":[-85.624792,41.935214]},"n185963099":{"id":"n185963099","loc":[-85.6204461,41.9401485]},"n185963698":{"id":"n185963698","loc":[-85.6297342,41.9400783]},"n185964320":{"id":"n185964320","loc":[-85.623511,41.934216]},"n185964322":{"id":"n185964322","loc":[-85.6235312,41.9362084]},"n185964324":{"id":"n185964324","loc":[-85.6235488,41.9371726]},"n185964326":{"id":"n185964326","loc":[-85.6235512,41.9381718]},"n185967077":{"id":"n185967077","loc":[-85.617359,41.940161]},"n185967634":{"id":"n185967634","loc":[-85.6248039,41.9362012]},"n185970833":{"id":"n185970833","loc":[-85.6248019,41.9381684]},"n185972752":{"id":"n185972752","loc":[-85.624582,41.938848]},"n185972754":{"id":"n185972754","loc":[-85.6242,41.939008]},"n185973251":{"id":"n185973251","loc":[-85.602727,41.936012]},"n185974509":{"id":"n185974509","loc":[-85.62478,41.93217]},"n185975315":{"id":"n185975315","loc":[-85.624703,41.925597]},"n185975316":{"id":"n185975316","loc":[-85.624716,41.927359]},"n185975317":{"id":"n185975317","loc":[-85.62475,41.93119]},"n185975318":{"id":"n185975318","loc":[-85.624782,41.934218]},"n185975320":{"id":"n185975320","loc":[-85.6247949,41.9371708]},"n185977754":{"id":"n185977754","loc":[-85.6276,41.937412]},"n185980075":{"id":"n185980075","loc":[-85.627451,41.937549]},"n185980077":{"id":"n185980077","loc":[-85.627375,41.937618]},"n185980078":{"id":"n185980078","loc":[-85.627278,41.937728]},"n185980079":{"id":"n185980079","loc":[-85.627199,41.937842]},"n185980081":{"id":"n185980081","loc":[-85.627141,41.937981]},"n185980083":{"id":"n185980083","loc":[-85.627109,41.938153]},"n185980085":{"id":"n185980085","loc":[-85.627101,41.938699]},"n185981173":{"id":"n185981173","loc":[-85.61433,41.940167]},"n185987021":{"id":"n185987021","loc":[-85.628311,41.942261]},"n185988963":{"id":"n185988963","loc":[-85.628439,41.940086]},"n185990195":{"id":"n185990195","loc":[-85.621225,41.939143]},"n185990196":{"id":"n185990196","loc":[-85.620576,41.939033]},"n185990198":{"id":"n185990198","loc":[-85.619081,41.938804]},"n185990200":{"id":"n185990200","loc":[-85.617593,41.938552]},"n185990202":{"id":"n185990202","loc":[-85.617372,41.938535]},"n185990204":{"id":"n185990204","loc":[-85.616087,41.93832]},"n185990206":{"id":"n185990206","loc":[-85.615754,41.938289]},"n185990209":{"id":"n185990209","loc":[-85.615438,41.938251]},"n185990211":{"id":"n185990211","loc":[-85.613469,41.937867]},"n185990212":{"id":"n185990212","loc":[-85.610172,41.937298]},"n185990213":{"id":"n185990213","loc":[-85.605537,41.936497]},"n185990214":{"id":"n185990214","loc":[-85.604014,41.936234]},"n1819800180":{"id":"n1819800180","loc":[-85.588775,41.9455032]},"n1819800181":{"id":"n1819800181","loc":[-85.6074212,41.9408827]},"n1819800182":{"id":"n1819800182","loc":[-85.6131397,41.9427022]},"n1819800183":{"id":"n1819800183","loc":[-85.6171523,41.9416807]},"n1819800184":{"id":"n1819800184","loc":[-85.602465,41.9397415]},"n1819800185":{"id":"n1819800185","loc":[-85.6109296,41.9410583]},"n1819800186":{"id":"n1819800186","loc":[-85.6165729,41.9418004]},"n1819800189":{"id":"n1819800189","loc":[-85.5866293,41.9458224]},"n1819800191":{"id":"n1819800191","loc":[-85.5853311,41.9466603]},"n1819800201":{"id":"n1819800201","loc":[-85.6101142,41.9433406]},"n1819800202":{"id":"n1819800202","loc":[-85.600963,41.9428618]},"n1819800206":{"id":"n1819800206","loc":[-85.6154357,41.9427501]},"n1819800207":{"id":"n1819800207","loc":[-85.6040309,41.9414094]},"n1819800209":{"id":"n1819800209","loc":[-85.6113694,41.943189]},"n1819800211":{"id":"n1819800211","loc":[-85.618032,41.9416408]},"n1819800214":{"id":"n1819800214","loc":[-85.5959419,41.9402602]},"n1819800219":{"id":"n1819800219","loc":[-85.5972117,41.9420043]},"n1819800223":{"id":"n1819800223","loc":[-85.6117171,41.9430019]},"n1819800224":{"id":"n1819800224","loc":[-85.5977873,41.9395579]},"n1819800226":{"id":"n1819800226","loc":[-85.5917362,41.9432209]},"n1819800228":{"id":"n1819800228","loc":[-85.6055759,41.9419122]},"n1819800229":{"id":"n1819800229","loc":[-85.6203395,41.9425595]},"n1819800233":{"id":"n1819800233","loc":[-85.6107579,41.9433007]},"n1819800234":{"id":"n1819800234","loc":[-85.6039773,41.9412498]},"n1819800235":{"id":"n1819800235","loc":[-85.6000977,41.9412861]},"n1819800236":{"id":"n1819800236","loc":[-85.6026689,41.9407231]},"n1819800237":{"id":"n1819800237","loc":[-85.615161,41.9428662]},"n1819800238":{"id":"n1819800238","loc":[-85.5878953,41.9454314]},"n1819800239":{"id":"n1819800239","loc":[-85.6035267,41.941569]},"n1819800240":{"id":"n1819800240","loc":[-85.5929738,41.9450208]},"n1819800241":{"id":"n1819800241","loc":[-85.6186329,41.9416488]},"n1819800242":{"id":"n1819800242","loc":[-85.5881136,41.9483963]},"n1819800243":{"id":"n1819800243","loc":[-85.5909208,41.9466922]},"n1819800244":{"id":"n1819800244","loc":[-85.5997721,41.9394941]},"n1819800245":{"id":"n1819800245","loc":[-85.6202064,41.9425712]},"n1819800246":{"id":"n1819800246","loc":[-85.591071,41.9448808]},"n1819800247":{"id":"n1819800247","loc":[-85.5866078,41.9490622]},"n1819800250":{"id":"n1819800250","loc":[-85.602383,41.9420841]},"n1819800251":{"id":"n1819800251","loc":[-85.5957418,41.9426906]},"n1819800255":{"id":"n1819800255","loc":[-85.6157039,41.9416727]},"n1819800256":{"id":"n1819800256","loc":[-85.6080328,41.9410982]},"n1819800258":{"id":"n1819800258","loc":[-85.6192551,41.9414892]},"n1819800260":{"id":"n1819800260","loc":[-85.6104253,41.94117]},"n1819800261":{"id":"n1819800261","loc":[-85.6204503,41.9425709]},"n1819800263":{"id":"n1819800263","loc":[-85.5872194,41.9455431]},"n1819800264":{"id":"n1819800264","loc":[-85.616176,41.9418244]},"n1819800268":{"id":"n1819800268","loc":[-85.6120883,41.9426703]},"n1819800269":{"id":"n1819800269","loc":[-85.5894547,41.9474946]},"n1819800272":{"id":"n1819800272","loc":[-85.6209181,41.9425027]},"n1819800274":{"id":"n1819800274","loc":[-85.6122814,41.9412817]},"n1819800276":{"id":"n1819800276","loc":[-85.5895153,41.9452798]},"n1819800277":{"id":"n1819800277","loc":[-85.5884317,41.9455272]},"n1819800279":{"id":"n1819800279","loc":[-85.5884103,41.9480966]},"n1819800287":{"id":"n1819800287","loc":[-85.5904917,41.9453915]},"n1819800288":{"id":"n1819800288","loc":[-85.6212292,41.9412977]},"n1819800289":{"id":"n1819800289","loc":[-85.5954377,41.9406832]},"n1819800290":{"id":"n1819800290","loc":[-85.593721,41.9420957]},"n1819800291":{"id":"n1819800291","loc":[-85.6162832,41.9427102]},"n1819800292":{"id":"n1819800292","loc":[-85.605018,41.9401804]},"n1819800293":{"id":"n1819800293","loc":[-85.6086443,41.941146]},"n1819800296":{"id":"n1819800296","loc":[-85.6204675,41.9413775]},"n1819800297":{"id":"n1819800297","loc":[-85.612496,41.9424947]},"n1819800299":{"id":"n1819800299","loc":[-85.6065629,41.9423431]},"n1819800301":{"id":"n1819800301","loc":[-85.6036125,41.9398452]},"n1819800303":{"id":"n1819800303","loc":[-85.6114767,41.94117]},"n1819800306":{"id":"n1819800306","loc":[-85.592616,41.9428139]},"n1819800308":{"id":"n1819800308","loc":[-85.6023041,41.9419521]},"n1819800310":{"id":"n1819800310","loc":[-85.6218944,41.9411061]},"n1819800311":{"id":"n1819800311","loc":[-85.6097816,41.941162]},"n1819800312":{"id":"n1819800312","loc":[-85.5922549,41.9457869]},"n1819800313":{"id":"n1819800313","loc":[-85.5986027,41.9417206]},"n1819800314":{"id":"n1819800314","loc":[-85.5918687,41.946138]},"n1819800315":{"id":"n1819800315","loc":[-85.5872875,41.948883]},"n1819800316":{"id":"n1819800316","loc":[-85.594272,41.9436642]},"n1819800317":{"id":"n1819800317","loc":[-85.6176351,41.941577]},"n1819800318":{"id":"n1819800318","loc":[-85.6137834,41.9430853]},"n1819800319":{"id":"n1819800319","loc":[-85.6195383,41.942622],"tags":{"leisure":"slipway"}},"n1819800320":{"id":"n1819800320","loc":[-85.5971006,41.9398053]},"n1819800321":{"id":"n1819800321","loc":[-85.601714,41.9406752]},"n1819800322":{"id":"n1819800322","loc":[-85.5908028,41.9453117]},"n1819800323":{"id":"n1819800323","loc":[-85.6062732,41.9404597]},"n1819800324":{"id":"n1819800324","loc":[-85.62124,41.9425905]},"n1819800327":{"id":"n1819800327","loc":[-85.6008664,41.942766]},"n1819800328":{"id":"n1819800328","loc":[-85.6179355,41.9428538]},"n1819800330":{"id":"n1819800330","loc":[-85.6045566,41.9415131]},"n1819800331":{"id":"n1819800331","loc":[-85.5944935,41.9414653]},"n1819800333":{"id":"n1819800333","loc":[-85.6088911,41.943181]},"n1819800334":{"id":"n1819800334","loc":[-85.5946367,41.943369]},"n1819800336":{"id":"n1819800336","loc":[-85.6150494,41.9429656]},"n1819800343":{"id":"n1819800343","loc":[-85.6096099,41.9433326]},"n1819800345":{"id":"n1819800345","loc":[-85.5915216,41.9435401]},"n1819800347":{"id":"n1819800347","loc":[-85.607786,41.9428698]},"n1819800349":{"id":"n1819800349","loc":[-85.6187616,41.9426623]},"n1819800350":{"id":"n1819800350","loc":[-85.6012527,41.9426064]},"n1819800352":{"id":"n1819800352","loc":[-85.6214867,41.9428379]},"n1819800354":{"id":"n1819800354","loc":[-85.61338,41.94293]},"n1819800355":{"id":"n1819800355","loc":[-85.5923156,41.9428139]},"n1819800357":{"id":"n1819800357","loc":[-85.5901591,41.9453197]},"n1819800359":{"id":"n1819800359","loc":[-85.6033979,41.9408827]},"n1819800360":{"id":"n1819800360","loc":[-85.6186543,41.9414653]},"n1819800363":{"id":"n1819800363","loc":[-85.6128607,41.9425665]},"n1819800365":{"id":"n1819800365","loc":[-85.614234,41.9412977]},"n1819800367":{"id":"n1819800367","loc":[-85.6089662,41.9410902]},"n1819800369":{"id":"n1819800369","loc":[-85.6197379,41.9413695]},"n1819800370":{"id":"n1819800370","loc":[-85.6037348,41.941733]},"n1819800371":{"id":"n1819800371","loc":[-85.5993467,41.9415654]},"n1819800372":{"id":"n1819800372","loc":[-85.598077,41.94196]},"n1819800373":{"id":"n1819800373","loc":[-85.5984203,41.9394781]},"n1819800374":{"id":"n1819800374","loc":[-85.6013315,41.9427066]},"n1819800376":{"id":"n1819800376","loc":[-85.5934673,41.944167]},"n1819800378":{"id":"n1819800378","loc":[-85.6011062,41.9407753]},"n1819800379":{"id":"n1819800379","loc":[-85.6150602,41.9415131]},"n1819800380":{"id":"n1819800380","loc":[-85.6132148,41.9412338]},"n1819800381":{"id":"n1819800381","loc":[-85.5889038,41.9453835]},"n2139966621":{"id":"n2139966621","loc":[-85.6198719,41.9426184]},"n2139966622":{"id":"n2139966622","loc":[-85.6197551,41.9426123]},"n2139966623":{"id":"n2139966623","loc":[-85.6196467,41.9426279]},"n2139966624":{"id":"n2139966624","loc":[-85.6191519,41.9426221]},"n2139966625":{"id":"n2139966625","loc":[-85.6194153,41.9426256]},"n2139966626":{"id":"n2139966626","loc":[-85.6200497,41.9425812]},"n2139966629":{"id":"n2139966629","loc":[-85.6192123,41.9426229]},"n2203933101":{"id":"n2203933101","loc":[-85.6030009,41.9360592]},"w17967539":{"id":"w17967539","tags":{"highway":"residential","name":"1st Ave"},"nodes":["n185965099","n185963395","n185987021"]},"w17967751":{"id":"w17967751","tags":{"highway":"residential","name":"River St"},"nodes":["n185980088","n185988961","n185988963","n185963698"]},"w17965088":{"id":"w17965088","tags":{"highway":"residential","name":"9th St"},"nodes":["n185945133","n185964320","n185964322","n185964324","n185964326","n185964328","n185964329","n185964330","n185964331"]},"w17964467":{"id":"w17964467","tags":{"highway":"residential","name":"Mechanic St"},"nodes":["n185958030","n185958032","n185958034","n185958036"]},"w134150842":{"id":"w134150842","tags":{"bridge":"yes","highway":"residential","name":"6th St"},"nodes":["n185980090","n185980093"]},"w17966740":{"id":"w17966740","tags":{"highway":"residential","name":"6th St"},"nodes":["n185977754","n185980075","n185980077","n185980078","n185980079","n185980081","n185980083","n185980085","n185958034","n185980088","n185980090"]},"w170844765":{"id":"w170844765","tags":{"waterway":"dam"},"nodes":["n1819800304","n1819800232","n1819800325","n1819800188"]},"w17967745":{"id":"w17967745","tags":{"highway":"residential","name":"River St"},"nodes":["n185981173","n185967077","n185963099","n185958498","n185988943","n185964331","n185975332"]},"w17968113":{"id":"w17968113","tags":{"highway":"residential","name":"Green St"},"nodes":["n185988943","n185991378"]},"w134150833":{"id":"w134150833","tags":{"highway":"residential","name":"6th St"},"nodes":["n185980093","n1475283999","n185963392"]},"w17967935":{"id":"w17967935","tags":{"name":"Michigan Central Railroad","railway":"abandoned"},"nodes":["n185972757","n185990192","n185990194","n185990195","n185990196","n185990198","n185990200","n185990202","n185990204","n185990206","n185990209","n185952239","n185990211","n185990212","n185990213","n185990214","n2203933101","n185973251"]},"w17965993":{"id":"w17965993","tags":{"name":"Conrail Railroad","railway":"abandoned"},"nodes":["n185957831","n185972752","n185972754","n185972756","n185972757"]},"w17966211":{"id":"w17966211","tags":{"highway":"residential","name":"8th St"},"nodes":["n185975315","n185975316","n185954490","n185945395","n185975317","n185974509","n185945135","n185975318","n185961186","n185967634","n185975320","n185970833","n185958036","n185975325","n185975326","n185975327","n185975328","n185975330","n185975332"]},"w170844766":{"id":"w170844766","tags":{"waterway":"riverbank"},"nodes":["n1819800229","n1819800245","n2139966626","n2139966621","n2139966622","n2139966623","n1819800319","n2139966625","n2139966629","n2139966624","n1819800349","n1819800328","n1819800291","n1819800206","n1819800237","n1819800336","n1819800318","n1819800354","n1819800182","n1819800363","n1819800297","n1819800268","n1819800223","n1819800209","n1819800233","n1819800201","n1819800343","n1819800333","n1819800347","n1819800299","n1819800228","n1819800330","n1819800370","n1819800250","n1819800374","n1819800202","n1819800327","n1819800350","n1819800308","n1819800239","n1819800207","n1819800234","n1819800359","n1819800236","n1819800321","n1819800378","n1819800235","n1819800371","n1819800313","n1819800372","n1819800219","n1819800251","n1819800334","n1819800316","n1819800376","n1819800240","n1819800312","n1819800314","n1819800243","n1819800269","n1819800279","n1819800242","n1819800315","n1819800247","n1819800191","n1819800189","n1819800263","n1819800238","n1819800277","n1819800180","n1819800381","n1819800276","n1819800357","n1819800287","n1819800322","n1819800246","n1819800345","n1819800226","n1819800355","n1819800306","n1819800290","n1819800331","n1819800289","n1819800214","n1819800320","n1819800224","n1819800373","n1819800244","n1819800184","n1819800301","n1819800292","n1819800323","n1819800181","n1819800256","n1819800293","n1819800367","n1819800311","n1819800260","n1819800185","n1819800303","n1819800274","n1819800380","n1819800365","n1819800379","n1819800255","n1819800264","n1819800186","n1819800183","n1819800317","n1819800211","n1819800241","n1819800360","n1819800258","n1819800369","n1819800296","n1819800288","n1819800310","n1819800204","n1819800375","n1819800216","n1819800377","n1819800248","n1819800227","n1819800368","n1819800231","n1819800188","n1819800325","n1819800232","n1819800304","n1819800271","n1819800213","n1819800266","n1819800221","n1819800294","n1819800362","n1819800199","n1819800230","n1819800218","n1819800352","n1819800324","n1819800272","n1819800261","n1819800229"]},"n1875654132":{"id":"n1875654132","loc":[-85.6297439,41.939808]},"n1475293263":{"id":"n1475293263","loc":[-85.6296235,41.939922]},"n185947850":{"id":"n185947850","loc":[-85.631594,41.942613]},"n185952745":{"id":"n185952745","loc":[-85.630986,41.941786]},"n185972907":{"id":"n185972907","loc":[-85.631797,41.9420055]},"n185972911":{"id":"n185972911","loc":[-85.6309723,41.9411623]},"n185972915":{"id":"n185972915","loc":[-85.6295971,41.939267]},"n1475293223":{"id":"n1475293223","loc":[-85.6313962,41.9416114],"tags":{"railway":"level_crossing"}},"n1475293231":{"id":"n1475293231","loc":[-85.6318779,41.9415447]},"n1475293241":{"id":"n1475293241","loc":[-85.6304613,41.9405499]},"n1475293246":{"id":"n1475293246","loc":[-85.6297512,41.9395393],"tags":{"railway":"level_crossing"}},"n1475293251":{"id":"n1475293251","loc":[-85.6316633,41.9415128]},"n2139982404":{"id":"n2139982404","loc":[-85.6313283,41.9413748]},"n2139982407":{"id":"n2139982407","loc":[-85.6325545,41.9417787]},"n2139982408":{"id":"n2139982408","loc":[-85.6324499,41.9417693]},"n2139982409":{"id":"n2139982409","loc":[-85.6324753,41.9416444]},"n2139982410":{"id":"n2139982410","loc":[-85.6325814,41.9416538]},"n2139982411":{"id":"n2139982411","loc":[-85.6319572,41.9413515]},"n2139982412":{"id":"n2139982412","loc":[-85.6322925,41.941139]},"n2139982413":{"id":"n2139982413","loc":[-85.6323153,41.941153]},"n2139982414":{"id":"n2139982414","loc":[-85.6323019,41.9412617]},"n2139982415":{"id":"n2139982415","loc":[-85.6323703,41.9412667]},"n2139982416":{"id":"n2139982416","loc":[-85.6323555,41.941538]},"n2139982417":{"id":"n2139982417","loc":[-85.6321343,41.9416777]},"n2139982418":{"id":"n2139982418","loc":[-85.6319425,41.9416866]},"n2139982419":{"id":"n2139982419","loc":[-85.6320303,41.9416941]},"n2139982420":{"id":"n2139982420","loc":[-85.6321665,41.9415554]},"n2139982421":{"id":"n2139982421","loc":[-85.632412,41.9414164]},"n2139982422":{"id":"n2139982422","loc":[-85.6324801,41.9413421]},"n2139982423":{"id":"n2139982423","loc":[-85.6325023,41.9412585]},"n2139982424":{"id":"n2139982424","loc":[-85.6324532,41.9411607]},"n2139982425":{"id":"n2139982425","loc":[-85.6323502,41.941103]},"n2139982426":{"id":"n2139982426","loc":[-85.6322362,41.9411183]},"n2139982427":{"id":"n2139982427","loc":[-85.6318941,41.9413551]},"n2139982428":{"id":"n2139982428","loc":[-85.6318592,41.9414105]},"n2139982429":{"id":"n2139982429","loc":[-85.6320111,41.9415866]},"n2139982430":{"id":"n2139982430","loc":[-85.632446,41.9413792]},"n2139982431":{"id":"n2139982431","loc":[-85.6325112,41.941416]},"n2139982432":{"id":"n2139982432","loc":[-85.6325449,41.9416345]},"n2139982433":{"id":"n2139982433","loc":[-85.6326122,41.94164]},"n2139982434":{"id":"n2139982434","loc":[-85.6325954,41.9421966]},"n2139982435":{"id":"n2139982435","loc":[-85.6325655,41.9422411]},"n2139982436":{"id":"n2139982436","loc":[-85.632515,41.9422564]},"n2139982437":{"id":"n2139982437","loc":[-85.6324495,41.94223]},"n2139982438":{"id":"n2139982438","loc":[-85.6324009,41.9421743]},"n2139982439":{"id":"n2139982439","loc":[-85.6323915,41.9421145]},"n2139982440":{"id":"n2139982440","loc":[-85.6320287,41.9418585]},"n2139982441":{"id":"n2139982441","loc":[-85.6318285,41.9416387]},"n1475293258":{"id":"n1475293258","loc":[-85.6318289,41.9415077]},"n2168544754":{"id":"n2168544754","loc":[-85.6312814,41.9431198]},"n2168544755":{"id":"n2168544755","loc":[-85.6314212,41.9430646]},"n2168544756":{"id":"n2168544756","loc":[-85.6313387,41.942949]},"n2168544757":{"id":"n2168544757","loc":[-85.6311989,41.9430041]},"n2168544758":{"id":"n2168544758","loc":[-85.6311024,41.9429313]},"n2168544759":{"id":"n2168544759","loc":[-85.6310087,41.9428087]},"n2168544760":{"id":"n2168544760","loc":[-85.6313831,41.9426504]},"n2168544761":{"id":"n2168544761","loc":[-85.6314768,41.9427729]},"n2168544762":{"id":"n2168544762","loc":[-85.6306376,41.942809]},"n2168544763":{"id":"n2168544763","loc":[-85.6307378,41.9429427]},"n2168544764":{"id":"n2168544764","loc":[-85.630841,41.9428998]},"n2168544765":{"id":"n2168544765","loc":[-85.6307408,41.9427662]},"n2168544766":{"id":"n2168544766","loc":[-85.6305404,41.9426029]},"n2168544767":{"id":"n2168544767","loc":[-85.6304976,41.9426194]},"n2168544768":{"id":"n2168544768","loc":[-85.6305673,41.9427184]},"n2168544769":{"id":"n2168544769","loc":[-85.6306164,41.9426984]},"n2168544770":{"id":"n2168544770","loc":[-85.6306418,41.9427302]},"n2168544771":{"id":"n2168544771","loc":[-85.6306861,41.9427137]},"n2168544772":{"id":"n2168544772","loc":[-85.6307146,41.9427537]},"n2168544773":{"id":"n2168544773","loc":[-85.6308999,41.9426807]},"n2168544774":{"id":"n2168544774","loc":[-85.6308429,41.9426053]},"n2168544775":{"id":"n2168544775","loc":[-85.6308999,41.9425806]},"n2168544776":{"id":"n2168544776","loc":[-85.6308318,41.9424875]},"n2168544777":{"id":"n2168544777","loc":[-85.6307732,41.9425087]},"n2168544778":{"id":"n2168544778","loc":[-85.6307178,41.9424357]},"n2168544779":{"id":"n2168544779","loc":[-85.630485,41.942524]},"n2189099387":{"id":"n2189099387","loc":[-85.631203,41.9393371]},"n2189099404":{"id":"n2189099404","loc":[-85.6301963,41.9391363]},"n2189099405":{"id":"n2189099405","loc":[-85.6304447,41.9391352]},"n2189099406":{"id":"n2189099406","loc":[-85.6304463,41.9393391]},"n2189099407":{"id":"n2189099407","loc":[-85.6308435,41.9393373]},"n2189099408":{"id":"n2189099408","loc":[-85.6308418,41.9391251]},"n2189099409":{"id":"n2189099409","loc":[-85.6310929,41.939124]},"n2189099410":{"id":"n2189099410","loc":[-85.6310946,41.9393376]},"n2189112720":{"id":"n2189112720","loc":[-85.6314677,41.9412327]},"n2189112721":{"id":"n2189112721","loc":[-85.6313337,41.9411397]},"n2189112722":{"id":"n2189112722","loc":[-85.6320521,41.9405678]},"n2189112723":{"id":"n2189112723","loc":[-85.6321899,41.9406633]},"n2189112724":{"id":"n2189112724","loc":[-85.6313229,41.9408344]},"n2189112725":{"id":"n2189112725","loc":[-85.6311223,41.9410018]},"n2189112726":{"id":"n2189112726","loc":[-85.6313205,41.9411333]},"n2189112727":{"id":"n2189112727","loc":[-85.6315211,41.9409659]},"n2189112728":{"id":"n2189112728","loc":[-85.6311035,41.9402529]},"n2189112729":{"id":"n2189112729","loc":[-85.631226,41.9402107]},"n2189112730":{"id":"n2189112730","loc":[-85.6315966,41.9408051]},"n2189112731":{"id":"n2189112731","loc":[-85.6314741,41.9408473]},"n2189112732":{"id":"n2189112732","loc":[-85.6318114,41.940534]},"n2189112733":{"id":"n2189112733","loc":[-85.631588,41.94061]},"n2189112734":{"id":"n2189112734","loc":[-85.6314379,41.940366]},"n2189112735":{"id":"n2189112735","loc":[-85.6316613,41.94029]},"n2189112736":{"id":"n2189112736","loc":[-85.6306214,41.9400415]},"n2189112737":{"id":"n2189112737","loc":[-85.6304362,41.9397728]},"n2189112738":{"id":"n2189112738","loc":[-85.6305899,41.9397142]},"n2189112739":{"id":"n2189112739","loc":[-85.6307751,41.9399828]},"n2189112740":{"id":"n2189112740","loc":[-85.6304695,41.9401673]},"n2189112741":{"id":"n2189112741","loc":[-85.6301298,41.9396855]},"n2189112742":{"id":"n2189112742","loc":[-85.6303016,41.9396184]},"n2189112743":{"id":"n2189112743","loc":[-85.6306413,41.9401003]},"n2189112744":{"id":"n2189112744","loc":[-85.6309656,41.9406189]},"n2189112745":{"id":"n2189112745","loc":[-85.6308738,41.940493]},"n2189112746":{"id":"n2189112746","loc":[-85.6309333,41.940469]},"n2189112747":{"id":"n2189112747","loc":[-85.6307634,41.9402358]},"n2189112748":{"id":"n2189112748","loc":[-85.6308798,41.9401889]},"n2189112749":{"id":"n2189112749","loc":[-85.6311416,41.940548]},"n2189112750":{"id":"n2189112750","loc":[-85.6309577,41.9408708]},"n2189112751":{"id":"n2189112751","loc":[-85.630874,41.9407777]},"n2189112752":{"id":"n2189112752","loc":[-85.6310622,41.9406841]},"n2189112753":{"id":"n2189112753","loc":[-85.6311459,41.9407772]},"n2189112754":{"id":"n2189112754","loc":[-85.6320308,41.9405747]},"n2189112755":{"id":"n2189112755","loc":[-85.6317769,41.9401857]},"n2189112756":{"id":"n2189112756","loc":[-85.6313462,41.9401785]},"n2189112757":{"id":"n2189112757","loc":[-85.6313423,41.9401199]},"n2189112758":{"id":"n2189112758","loc":[-85.6318308,41.9401184]},"n2189112759":{"id":"n2189112759","loc":[-85.6321154,41.9405433]},"n2189112760":{"id":"n2189112760","loc":[-85.6310307,41.941683]},"n2189112761":{"id":"n2189112761","loc":[-85.6309808,41.9416078]},"n2189112762":{"id":"n2189112762","loc":[-85.6312094,41.9415156]},"n2189112763":{"id":"n2189112763","loc":[-85.6312636,41.9415865]},"n2189112764":{"id":"n2189112764","loc":[-85.6309384,41.94155]},"n2189112765":{"id":"n2189112765","loc":[-85.631156,41.9414619]},"n2189112766":{"id":"n2189112766","loc":[-85.6311968,41.94152]},"n2189112767":{"id":"n2189112767","loc":[-85.6308946,41.9414851]},"n2189112768":{"id":"n2189112768","loc":[-85.6308237,41.9413888]},"n2189112769":{"id":"n2189112769","loc":[-85.6309858,41.9413228]},"n2189112770":{"id":"n2189112770","loc":[-85.6310567,41.9414192]},"n2189112771":{"id":"n2189112771","loc":[-85.6307774,41.9413276]},"n2189112772":{"id":"n2189112772","loc":[-85.6309068,41.9412735]},"n2189112773":{"id":"n2189112773","loc":[-85.6309531,41.9413347]},"n2189112774":{"id":"n2189112774","loc":[-85.6307975,41.9412466]},"n2189112775":{"id":"n2189112775","loc":[-85.6307006,41.9411699]},"n2189112776":{"id":"n2189112776","loc":[-85.6308289,41.941113]},"n2189112777":{"id":"n2189112777","loc":[-85.6308997,41.9412012]},"n2189112778":{"id":"n2189112778","loc":[-85.630765,41.9412062]},"n2189112779":{"id":"n2189112779","loc":[-85.630739,41.9412177]},"n2189112780":{"id":"n2189112780","loc":[-85.6305822,41.9410391]},"n2189112781":{"id":"n2189112781","loc":[-85.6304117,41.9408177]},"n2189112782":{"id":"n2189112782","loc":[-85.6305086,41.9407769]},"n2189112783":{"id":"n2189112783","loc":[-85.6306779,41.9410044]},"n2189112784":{"id":"n2189112784","loc":[-85.6307734,41.9421663]},"n2189112785":{"id":"n2189112785","loc":[-85.630708,41.9420741]},"n2189112786":{"id":"n2189112786","loc":[-85.630863,41.9420133]},"n2189112787":{"id":"n2189112787","loc":[-85.6309285,41.9421055]},"n2189112788":{"id":"n2189112788","loc":[-85.6307014,41.9420263]},"n2189112789":{"id":"n2189112789","loc":[-85.6306648,41.941971]},"n2189112790":{"id":"n2189112790","loc":[-85.6307927,41.9419178]},"n2189112791":{"id":"n2189112791","loc":[-85.6308366,41.9419696]},"n2189112792":{"id":"n2189112792","loc":[-85.6307574,41.9418708]},"n2189112793":{"id":"n2189112793","loc":[-85.6306288,41.9419231]},"n2189112794":{"id":"n2189112794","loc":[-85.6306943,41.9417835]},"n2189112795":{"id":"n2189112795","loc":[-85.6305344,41.9418474]},"n2189112796":{"id":"n2189112796","loc":[-85.6305981,41.9419355]},"n2189123410":{"id":"n2189123410","loc":[-85.6315476,41.9393801]},"n2189123412":{"id":"n2189123412","loc":[-85.6315247,41.9399188]},"n2189123415":{"id":"n2189123415","loc":[-85.6316484,41.9400433]},"n185945138":{"id":"n185945138","loc":[-85.627073,41.93319]},"n185945142":{"id":"n185945142","loc":[-85.6296891,41.9331674]},"n185945401":{"id":"n185945401","loc":[-85.6269,41.930199]},"n185945405":{"id":"n185945405","loc":[-85.6296598,41.9301676]},"n185956891":{"id":"n185956891","loc":[-85.6251617,41.9255049]},"n185959979":{"id":"n185959979","loc":[-85.626333,41.928347]},"n185959983":{"id":"n185959983","loc":[-85.6296419,41.9283288]},"n185961192":{"id":"n185961192","loc":[-85.627053,41.9352031]},"n185961200":{"id":"n185961200","loc":[-85.6297088,41.9351902]},"n185963655":{"id":"n185963655","loc":[-85.6296112,41.9273948]},"n185963665":{"id":"n185963665","loc":[-85.626047,41.92737]},"n185963688":{"id":"n185963688","loc":[-85.6296503,41.9292199]},"n185963689":{"id":"n185963689","loc":[-85.6296694,41.931157]},"n185963690":{"id":"n185963690","loc":[-85.6296791,41.9321485]},"n185963691":{"id":"n185963691","loc":[-85.6296991,41.9341973]},"n185967638":{"id":"n185967638","loc":[-85.627089,41.9361884]},"n185972917":{"id":"n185972917","loc":[-85.6293759,41.9388605]},"n185972919":{"id":"n185972919","loc":[-85.6290337,41.9380234]},"n185972921":{"id":"n185972921","loc":[-85.628424,41.936212]},"n185972923":{"id":"n185972923","loc":[-85.628367,41.936029]},"n185974511":{"id":"n185974511","loc":[-85.627064,41.932169]},"n185977728":{"id":"n185977728","loc":[-85.625605,41.925842]},"n185977729":{"id":"n185977729","loc":[-85.625685,41.926163]},"n185977731":{"id":"n185977731","loc":[-85.6257845,41.9264872]},"n185977733":{"id":"n185977733","loc":[-85.62663,41.929251]},"n185977734":{"id":"n185977734","loc":[-85.627008,41.930642]},"n185977736":{"id":"n185977736","loc":[-85.627029,41.930775]},"n185977738":{"id":"n185977738","loc":[-85.627041,41.930946]},"n185977739":{"id":"n185977739","loc":[-85.6270379,41.9311746]},"n185977742":{"id":"n185977742","loc":[-85.627055,41.934206]},"n185977744":{"id":"n185977744","loc":[-85.627084,41.936804]},"n185977746":{"id":"n185977746","loc":[-85.627104,41.936914]},"n185977748":{"id":"n185977748","loc":[-85.627156,41.937026]},"n185977750":{"id":"n185977750","loc":[-85.6272406,41.9371672]},"n185977752":{"id":"n185977752","loc":[-85.627317,41.93723]},"n185977753":{"id":"n185977753","loc":[-85.627422,41.937312]},"n185977755":{"id":"n185977755","loc":[-85.627754,41.937504]},"n185977757":{"id":"n185977757","loc":[-85.627883,41.937623]},"n185977761":{"id":"n185977761","loc":[-85.627984,41.93773]},"n1475283996":{"id":"n1475283996","loc":[-85.6270514,41.9317122],"tags":{"railway":"level_crossing"}},"n1475284004":{"id":"n1475284004","loc":[-85.6278177,41.9342117],"tags":{"railway":"level_crossing"}},"n1475284014":{"id":"n1475284014","loc":[-85.6251877,41.9255913],"tags":{"railway":"level_crossing"}},"n1475284017":{"id":"n1475284017","loc":[-85.6274992,41.9331816],"tags":{"railway":"level_crossing"}},"n1475284021":{"id":"n1475284021","loc":[-85.6297108,41.9353939],"tags":{"railway":"level_crossing"}},"n1475284027":{"id":"n1475284027","loc":[-85.62811,41.935198],"tags":{"railway":"level_crossing"}},"n1475284035":{"id":"n1475284035","loc":[-85.626888,41.9311757],"tags":{"railway":"level_crossing"}},"n1475293245":{"id":"n1475293245","loc":[-85.6286047,41.9367881]},"n1875654302":{"id":"n1875654302","loc":[-85.6296367,41.927491]},"n2189099388":{"id":"n2189099388","loc":[-85.6312007,41.9389988]},"n2189099389":{"id":"n2189099389","loc":[-85.6311003,41.9389992]},"n2189099390":{"id":"n2189099390","loc":[-85.6310988,41.9387847]},"n2189099391":{"id":"n2189099391","loc":[-85.6312165,41.9387843]},"n2189099392":{"id":"n2189099392","loc":[-85.6312152,41.9385857]},"n2189099393":{"id":"n2189099393","loc":[-85.6310877,41.9385862]},"n2189099394":{"id":"n2189099394","loc":[-85.6310858,41.9383161]},"n2189099395":{"id":"n2189099395","loc":[-85.6302002,41.9383196]},"n2189099396":{"id":"n2189099396","loc":[-85.6302011,41.9384472]},"n2189099397":{"id":"n2189099397","loc":[-85.6301018,41.9384476]},"n2189099398":{"id":"n2189099398","loc":[-85.6301025,41.9385419]},"n2189099399":{"id":"n2189099399","loc":[-85.6299275,41.9385427]},"n2189099400":{"id":"n2189099400","loc":[-85.62993,41.9388653]},"n2189099401":{"id":"n2189099401","loc":[-85.630107,41.9388645]},"n2189099402":{"id":"n2189099402","loc":[-85.6301079,41.9389908]},"n2189099403":{"id":"n2189099403","loc":[-85.6301951,41.9389904]},"n2189123382":{"id":"n2189123382","loc":[-85.6336279,41.9354365]},"n2189123384":{"id":"n2189123384","loc":[-85.6328492,41.9355177]},"n2189123387":{"id":"n2189123387","loc":[-85.6323762,41.9357396]},"n2189123388":{"id":"n2189123388","loc":[-85.6315174,41.9358966]},"n2189123389":{"id":"n2189123389","loc":[-85.6304331,41.936124]},"n2189123390":{"id":"n2189123390","loc":[-85.6302075,41.9364271]},"n2189123391":{"id":"n2189123391","loc":[-85.6303458,41.9367953]},"n2189123392":{"id":"n2189123392","loc":[-85.6299601,41.9369739]},"n2189123393":{"id":"n2189123393","loc":[-85.6299164,41.9374882]},"n2189123394":{"id":"n2189123394","loc":[-85.6299455,41.9378022]},"n2189123395":{"id":"n2189123395","loc":[-85.6299771,41.9379053]},"n2189123396":{"id":"n2189123396","loc":[-85.6301597,41.9379091]},"n2189123397":{"id":"n2189123397","loc":[-85.6308042,41.9377913]},"n2189123398":{"id":"n2189123398","loc":[-85.6316885,41.9378082]},"n2189123399":{"id":"n2189123399","loc":[-85.6316848,41.9380079]},"n2189123400":{"id":"n2189123400","loc":[-85.6318449,41.9381161]},"n2189123401":{"id":"n2189123401","loc":[-85.6320705,41.9381811]},"n2189123402":{"id":"n2189123402","loc":[-85.6321433,41.9383706]},"n2189123404":{"id":"n2189123404","loc":[-85.632056,41.9384355]},"n2189123406":{"id":"n2189123406","loc":[-85.6317867,41.9384572]},"n2189123409":{"id":"n2189123409","loc":[-85.6316572,41.9387281]},"n2189123417":{"id":"n2189123417","loc":[-85.6315946,41.93775]},"n2189123419":{"id":"n2189123419","loc":[-85.6302641,41.9378393]},"w208640158":{"id":"w208640158","tags":{"area":"yes","natural":"wetland"},"nodes":["n2189123379","n2189123382","n2189123384","n2189123387","n2189123388","n2189123389","n2189123390","n2189123391","n2189123392","n2189123393","n2189123394","n2189123395","n2189123396","n2189123419","n2189123397","n2189123417","n2189123398","n2189123399","n2189123400","n2189123401","n2189123402","n2189123404","n2189123406","n2189123409","n2189123410","n2189123412","n2189123415","n1819805722","n1819805861","n1819805887","n1819805760","n1819805641","n1819805632","n2189123379"]},"w134150787":{"id":"w134150787","tags":{"name":"Conrail Railroad","railway":"rail"},"nodes":["n185972905","n185972907","n1475293223","n185972911","n1475293241","n1475293246","n185972915","n185972917","n185972919","n1475293245","n185972921","n185972923","n1475284027","n1475284004","n1475284017","n1475283996","n1475284035","n1475284014","n185956891"]},"w208639443":{"id":"w208639443","tags":{"area":"yes","building":"yes"},"nodes":["n2189112720","n2189112721","n2189112722","n2189112723","n2189112720"]},"w17966462":{"id":"w17966462","tags":{"highway":"secondary","name":"South Main Street","old_ref":"US 131","ref":"M 86"},"nodes":["n185977728","n185977729","n185977731","n185963665","n185959979","n185977733","n185945401","n185977734","n185977736","n185977738","n185977739","n1475283996","n185974511","n185945138","n185977742","n185961192","n185967638","n185977744","n185977746","n185977748","n185977750","n185977752","n185977753","n185977754","n185977755","n185977757","n185977761","n185958030","n1475293263","n185963698","n185952745","n185947850","n185977762"]},"w203985741":{"id":"w203985741","tags":{"area":"yes","leisure":"park","name":"Conservation Park"},"nodes":["n2139982404","n2139982405","n2139982399","n2139982400","n1819805770","n2139982402","n2139982403","n2139982401","n1819805780","n1819805834","n2139982406","n2139982404"]},"w17963676":{"id":"w17963676","tags":{"highway":"service"},"nodes":["n1475293258","n2139982428","n2139982427","n2139982426","n2139982425","n2139982424","n2139982423","n2139982422","n2139982430","n2139982421","n2139982420","n2139982429","n1475293231","n1475293258","n1475293251","n1475293223","n185952745"]},"w203985745":{"id":"w203985745","tags":{"highway":"footway"},"nodes":["n2139982430","n2139982431","n2139982432","n2139982433","n2139982434","n2139982435","n2139982436","n2139982437","n2139982438","n2139982439","n2139982440","n2139982441","n1475293231"]},"w208639451":{"id":"w208639451","tags":{"area":"yes","building":"yes"},"nodes":["n2189112754","n2189112755","n2189112756","n2189112757","n2189112758","n2189112759","n2189112754"]},"w208639452":{"id":"w208639452","tags":{"area":"yes","building":"yes"},"nodes":["n2189112760","n2189112761","n2189112766","n2189112762","n2189112763","n2189112760"]},"w206805244":{"id":"w206805244","tags":{"area":"yes","building":"yes"},"nodes":["n2168544766","n2168544767","n2168544768","n2168544769","n2168544770","n2168544771","n2168544772","n2168544773","n2168544774","n2168544775","n2168544776","n2168544777","n2168544778","n2168544779","n2168544766"]},"w208639444":{"id":"w208639444","tags":{"area":"yes","building":"yes"},"nodes":["n2189112724","n2189112725","n2189112726","n2189112727","n2189112724"]},"w208639450":{"id":"w208639450","tags":{"area":"yes","building":"yes"},"nodes":["n2189112750","n2189112751","n2189112752","n2189112753","n2189112750"]},"w208639448":{"id":"w208639448","tags":{"area":"yes","building":"yes"},"nodes":["n2189112740","n2189112741","n2189112742","n2189112743","n2189112740"]},"w208637859":{"id":"w208637859","tags":{"area":"yes","building":"yes"},"nodes":["n2189099387","n2189099388","n2189099389","n2189099390","n2189099391","n2189099392","n2189099393","n2189099394","n2189099395","n2189099396","n2189099397","n2189099398","n2189099399","n2189099400","n2189099401","n2189099402","n2189099403","n2189099404","n2189099405","n2189099406","n2189099407","n2189099408","n2189099409","n2189099410","n2189099387"]},"w208639453":{"id":"w208639453","tags":{"area":"yes","building":"yes"},"nodes":["n2189112764","n2189112765","n2189112766","n2189112761","n2189112764"]},"w208639456":{"id":"w208639456","tags":{"area":"yes","building":"yes"},"nodes":["n2189112774","n2189112778","n2189112779","n2189112775","n2189112776","n2189112777","n2189112774"]},"w208639445":{"id":"w208639445","tags":{"area":"yes","building":"yes"},"nodes":["n2189112728","n2189112729","n2189112730","n2189112731","n2189112728"]},"w17967776":{"id":"w17967776","tags":{"highway":"residential","name":"5th St"},"nodes":["n185958032","n185988963"]},"w208639461":{"id":"w208639461","tags":{"area":"yes","building":"yes"},"nodes":["n2189112792","n2189112794","n2189112795","n2189112796","n2189112793","n2189112792"]},"w206805241":{"id":"w206805241","tags":{"area":"yes","building":"yes"},"nodes":["n2168544754","n2168544755","n2168544756","n2168544757","n2168544754"]},"w208639449":{"id":"w208639449","tags":{"area":"yes","building":"yes"},"nodes":["n2189112744","n2189112745","n2189112746","n2189112747","n2189112748","n2189112749","n2189112744"]},"w208639455":{"id":"w208639455","tags":{"area":"yes","building":"yes"},"nodes":["n2189112771","n2189112772","n2189112773","n2189112768","n2189112771"]},"w208639457":{"id":"w208639457","tags":{"area":"yes","building":"yes"},"nodes":["n2189112780","n2189112781","n2189112782","n2189112783","n2189112780"]},"w208639446":{"id":"w208639446","tags":{"area":"yes","building":"yes"},"nodes":["n2189112732","n2189112733","n2189112734","n2189112735","n2189112732"]},"w208639454":{"id":"w208639454","tags":{"area":"yes","building":"yes"},"nodes":["n2189112767","n2189112768","n2189112773","n2189112769","n2189112770","n2189112767"]},"w203985743":{"id":"w203985743","tags":{"amenity":"parking","area":"yes"},"nodes":["n2139982411","n2139982412","n2139982413","n2139982414","n2139982415","n2139982416","n2139982417","n2139982419","n2139982418","n2139982411"]},"w17965023":{"id":"w17965023","tags":{"highway":"residential","name":"4th St"},"nodes":["n185963655","n1875654302","n185959983","n185963688","n185945405","n185963689","n185963690","n185945142","n185963691","n185961200","n1475284021","n1475293246","n1875654132","n1475293263"]},"w206805242":{"id":"w206805242","tags":{"area":"yes","building":"yes"},"nodes":["n2168544758","n2168544759","n2168544760","n2168544761","n2168544758"]},"w208639460":{"id":"w208639460","tags":{"area":"yes","building":"yes"},"nodes":["n2189112792","n2189112793","n2189112789","n2189112790","n2189112792"]},"w208639447":{"id":"w208639447","tags":{"area":"yes","building":"yes"},"nodes":["n2189112736","n2189112737","n2189112738","n2189112739","n2189112736"]},"w208639458":{"id":"w208639458","tags":{"area":"yes","building":"yes"},"nodes":["n2189112784","n2189112785","n2189112786","n2189112787","n2189112784"]},"w203985744":{"id":"w203985744","tags":{"highway":"service"},"nodes":["n2139982425","n2139982400"]},"w208639459":{"id":"w208639459","tags":{"area":"yes","building":"yes"},"nodes":["n2189112788","n2189112789","n2189112790","n2189112791","n2189112788"]},"w203985742":{"id":"w203985742","tags":{"amenity":"shelter","area":"yes","shelter_type":"picnic_shelter"},"nodes":["n2139982407","n2139982408","n2139982409","n2139982410","n2139982407"]},"w206805243":{"id":"w206805243","tags":{"area":"yes","building":"yes"},"nodes":["n2168544762","n2168544763","n2168544764","n2168544765","n2168544762"]},"n185959081":{"id":"n185959081","loc":[-85.628469,41.948674]},"n185967427":{"id":"n185967427","loc":[-85.632054,41.951174]},"n185967424":{"id":"n185967424","loc":[-85.6320391,41.9499109]},"n185968101":{"id":"n185968101","loc":[-85.6308395,41.9511969]},"n185960792":{"id":"n185960792","loc":[-85.632074,41.953707]},"n185961389":{"id":"n185961389","loc":[-85.630935,41.959037]},"n185961391":{"id":"n185961391","loc":[-85.632169,41.959025]},"n185965395":{"id":"n185965395","loc":[-85.63216,41.959859]},"n185966953":{"id":"n185966953","loc":[-85.630894,41.957428]},"n185966955":{"id":"n185966955","loc":[-85.632122,41.957427]},"n185967430":{"id":"n185967430","loc":[-85.632077,41.952453]},"n185967432":{"id":"n185967432","loc":[-85.632095,41.954685]},"n185967434":{"id":"n185967434","loc":[-85.632121,41.955914]},"n185967436":{"id":"n185967436","loc":[-85.632128,41.9583]},"n185967438":{"id":"n185967438","loc":[-85.632187,41.960681]},"n185967440":{"id":"n185967440","loc":[-85.632182,41.961493]},"n185968102":{"id":"n185968102","loc":[-85.630855,41.952452]},"n185968104":{"id":"n185968104","loc":[-85.630887,41.953714]},"n185968106":{"id":"n185968106","loc":[-85.630883,41.954692]},"n185968108":{"id":"n185968108","loc":[-85.630904,41.955913]},"n185968110":{"id":"n185968110","loc":[-85.630904,41.958058]},"n185968112":{"id":"n185968112","loc":[-85.630952,41.960667]},"n185968114":{"id":"n185968114","loc":[-85.630972,41.961495]},"n185968116":{"id":"n185968116","loc":[-85.630962,41.961967]},"n185978969":{"id":"n185978969","loc":[-85.633214,41.948618]},"n185985812":{"id":"n185985812","loc":[-85.633274,41.951159]},"n185986155":{"id":"n185986155","loc":[-85.633258,41.949893]},"n2208608826":{"id":"n2208608826","loc":[-85.6339222,41.9486225]},"w17964531":{"id":"w17964531","tags":{"highway":"residential","name":"Willow Dr"},"nodes":["n185959079","n185959081"]},"w17967386":{"id":"w17967386","tags":{"highway":"residential","name":"East Armitage Street"},"nodes":["n185982195","n185968101","n185967427","n185985812","n185974583"]},"w17965502":{"id":"w17965502","tags":{"highway":"residential","name":"Elm Street"},"nodes":["n185968100","n185968101","n185968102","n185968104","n185968106","n185968108","n185966953","n185968110","n185961389","n185968112","n185968114","n185968116"]},"w17967844":{"id":"w17967844","tags":{"highway":"residential","name":"East Bennett Street"},"nodes":["n185982193","n185967424","n185986155","n185978390"]},"w17966581":{"id":"w17966581","tags":{"highway":"residential","name":"E Kelsey St"},"nodes":["n185978967","n185978969","n2208608826","n185971578"]},"w17965402":{"id":"w17965402","tags":{"highway":"residential","name":"Walnut Street"},"nodes":["n185967422","n185967424","n185967427","n185967430","n185960792","n185967432","n185967434","n185966955","n185967436","n185961391","n185965395","n185967438","n185967440"]},"n2199093506":{"id":"n2199093506","loc":[-85.6251879,41.9478322]},"n2199093505":{"id":"n2199093505","loc":[-85.6252076,41.9477749]},"n2199093504":{"id":"n2199093504","loc":[-85.6252289,41.9477602]},"n2199093503":{"id":"n2199093503","loc":[-85.625201,41.9477492]},"n2199093502":{"id":"n2199093502","loc":[-85.6251682,41.9477066]},"n2199093501":{"id":"n2199093501","loc":[-85.6251715,41.947609]},"n2199093500":{"id":"n2199093500","loc":[-85.6252125,41.9475639]},"n2199093499":{"id":"n2199093499","loc":[-85.6252896,41.9475602]},"n2199093498":{"id":"n2199093498","loc":[-85.6253027,41.9475334]},"n2199093497":{"id":"n2199093497","loc":[-85.6253437,41.9474822]},"n2199093496":{"id":"n2199093496","loc":[-85.6254421,41.9474675]},"n2199093495":{"id":"n2199093495","loc":[-85.6256503,41.9474944]},"n2199093494":{"id":"n2199093494","loc":[-85.6257257,41.9476127]},"n2199093493":{"id":"n2199093493","loc":[-85.6257028,41.9477285]},"n2199093492":{"id":"n2199093492","loc":[-85.6255339,41.9478102]},"n2199093491":{"id":"n2199093491","loc":[-85.6253912,41.9478224]},"n2199093490":{"id":"n2199093490","loc":[-85.6253043,41.947859]},"n2199093489":{"id":"n2199093489","loc":[-85.6252027,41.9478846]},"n2199093458":{"id":"n2199093458","loc":[-85.6246876,41.9486617]},"n2199093457":{"id":"n2199093457","loc":[-85.6243127,41.9486583]},"n2199093456":{"id":"n2199093456","loc":[-85.624306,41.9490569]},"n2199093455":{"id":"n2199093455","loc":[-85.624681,41.9490603]},"n2199093514":{"id":"n2199093514","loc":[-85.6236228,41.9496059]},"n2199093513":{"id":"n2199093513","loc":[-85.6236231,41.9496997]},"n2199093512":{"id":"n2199093512","loc":[-85.623357,41.9497002]},"n2199093511":{"id":"n2199093511","loc":[-85.6233567,41.9496136]},"n2199093508":{"id":"n2199093508","loc":[-85.6239735,41.9494287]},"n2199093507":{"id":"n2199093507","loc":[-85.6239741,41.9496052]},"n2199093488":{"id":"n2199093488","loc":[-85.624497,41.9512286]},"n2199093487":{"id":"n2199093487","loc":[-85.6244966,41.9511259]},"n2199093486":{"id":"n2199093486","loc":[-85.6243151,41.9511263]},"n2199093485":{"id":"n2199093485","loc":[-85.6243154,41.951229]},"n2199093484":{"id":"n2199093484","loc":[-85.6241205,41.9508665]},"n2199093483":{"id":"n2199093483","loc":[-85.624115,41.9505249]},"n2199093482":{"id":"n2199093482","loc":[-85.6243149,41.9505231]},"n2199093481":{"id":"n2199093481","loc":[-85.6243203,41.9508648]},"n2199093480":{"id":"n2199093480","loc":[-85.624393,41.9508668]},"n2199093479":{"id":"n2199093479","loc":[-85.6243904,41.9505956]},"n2199093478":{"id":"n2199093478","loc":[-85.6246727,41.950594]},"n2199093477":{"id":"n2199093477","loc":[-85.624675,41.9508203]},"n2199093476":{"id":"n2199093476","loc":[-85.6245097,41.9508212]},"n2199093475":{"id":"n2199093475","loc":[-85.6245101,41.9508662]},"n2199093474":{"id":"n2199093474","loc":[-85.6241008,41.9493459]},"n2199093473":{"id":"n2199093473","loc":[-85.6242442,41.9493459]},"n2199093472":{"id":"n2199093472","loc":[-85.6242442,41.9493681]},"n2199093471":{"id":"n2199093471","loc":[-85.6243397,41.9493681]},"n2199093470":{"id":"n2199093470","loc":[-85.6243417,41.9493511]},"n2199093469":{"id":"n2199093469","loc":[-85.6247251,41.9493485]},"n2199093468":{"id":"n2199093468","loc":[-85.6247548,41.9504949]},"n2199093467":{"id":"n2199093467","loc":[-85.6241214,41.9505017]},"n2199093466":{"id":"n2199093466","loc":[-85.6254398,41.950174]},"n2199093465":{"id":"n2199093465","loc":[-85.6254412,41.9499872]},"n2199093464":{"id":"n2199093464","loc":[-85.6255363,41.9499876]},"n2199093463":{"id":"n2199093463","loc":[-85.6255374,41.9498439]},"n2199093462":{"id":"n2199093462","loc":[-85.6255638,41.949844]},"n2199093461":{"id":"n2199093461","loc":[-85.6255652,41.9496672]},"n2199093460":{"id":"n2199093460","loc":[-85.6251823,41.9496656]},"n2199093459":{"id":"n2199093459","loc":[-85.6251785,41.9501729]},"n2199093510":{"id":"n2199093510","loc":[-85.6229922,41.9496143]},"n2199093509":{"id":"n2199093509","loc":[-85.6229915,41.9494306]},"n185948903":{"id":"n185948903","loc":[-85.616514,41.947449]},"n185955120":{"id":"n185955120","loc":[-85.620103,41.951]},"n185955143":{"id":"n185955143","loc":[-85.619784,41.94746]},"n185960124":{"id":"n185960124","loc":[-85.615238,41.947468]},"n185961362":{"id":"n185961362","loc":[-85.617437,41.947451]},"n185961364":{"id":"n185961364","loc":[-85.61861,41.947456]},"n185961367":{"id":"n185961367","loc":[-85.620088,41.947458]},"n185965105":{"id":"n185965105","loc":[-85.620087,41.94924]},"n185970220":{"id":"n185970220","loc":[-85.62156,41.948333]},"n185974697":{"id":"n185974697","loc":[-85.6201059,41.950132]},"n2138420778":{"id":"n2138420778","loc":[-85.616948,41.9474499]},"w17967535":{"id":"w17967535","tags":{"highway":"residential","name":"10th Ave"},"nodes":["n185955120","n185986812","n185983141"]},"w209716130":{"id":"w209716130","tags":{"area":"yes","building":"yes"},"nodes":["n2199093485","n2199093486","n2199093487","n2199093488","n2199093485"]},"w17964788":{"id":"w17964788","tags":{"highway":"residential","name":"6th Ave"},"nodes":["n185960124","n185948903","n2138420778","n185961362","n185961364","n185955143","n185961367","n185961369","n185961371"]},"w17965159":{"id":"w17965159","tags":{"highway":"residential","name":"8th Ave"},"nodes":["n185965105","n185965108","n185965110"]},"w209716125":{"id":"w209716125","tags":{"area":"yes","building":"yes"},"nodes":["n2199093459","n2199093460","n2199093461","n2199093462","n2199093463","n2199093464","n2199093465","n2199093466","n2199093459"]},"w17965699":{"id":"w17965699","tags":{"highway":"residential","name":"7th Ave"},"nodes":["n185970220","n185970222","n185970224"]},"w209716132":{"id":"w209716132","tags":{"area":"yes","building":"yes"},"nodes":["n2199093507","n2199093508","n2199093509","n2199093510","n2199093511","n2199093512","n2199093513","n2199093514","n2199093507"]},"w17966129":{"id":"w17966129","tags":{"highway":"residential","name":"9th Ave"},"nodes":["n185974697","n185974699"]},"w209716127":{"id":"w209716127","tags":{"area":"yes","building":"yes"},"nodes":["n2199093475","n2199093476","n2199093477","n2199093478","n2199093479","n2199093480","n2199093475"]},"w209716131":{"id":"w209716131","tags":{"area":"yes","natural":"water","water":"pond"},"nodes":["n2199093489","n2199093490","n2199093491","n2199093492","n2199093493","n2199093494","n2199093495","n2199093496","n2199093497","n2199093498","n2199093499","n2199093500","n2199093501","n2199093502","n2199093503","n2199093504","n2199093505","n2199093506","n2199093489"]},"w209716126":{"id":"w209716126","tags":{"area":"yes","building":"yes"},"nodes":["n2199093467","n2199093468","n2199093469","n2199093470","n2199093471","n2199093472","n2199093473","n2199093474","n2199093467"]},"w209716124":{"id":"w209716124","tags":{"area":"yes","building":"yes"},"nodes":["n2199093455","n2199093456","n2199093457","n2199093458","n2199093455"]},"w209716128":{"id":"w209716128","tags":{"area":"yes","building":"yes"},"nodes":["n2199093481","n2199093482","n2199093483","n2199093484","n2199093481"]},"n185949872":{"id":"n185949872","loc":[-85.643009,41.949264]},"n185949875":{"id":"n185949875","loc":[-85.642598,41.94929]},"n185949877":{"id":"n185949877","loc":[-85.642127,41.949382]},"n185949881":{"id":"n185949881","loc":[-85.64169,41.949936]},"n185988165":{"id":"n185988165","loc":[-85.642167,41.947657]},"n185988167":{"id":"n185988167","loc":[-85.642347,41.947662]},"n185988169":{"id":"n185988169","loc":[-85.642621,41.947659]},"n185965019":{"id":"n185965019","loc":[-85.6385084,41.951127]},"n1475293248":{"id":"n1475293248","loc":[-85.6386095,41.9512214]},"n185962639":{"id":"n185962639","loc":[-85.649669,41.949161]},"n185962810":{"id":"n185962810","loc":[-85.649907,41.949157]},"n185964355":{"id":"n185964355","loc":[-85.637412,41.9511359]},"n185965021":{"id":"n185965021","loc":[-85.638661,41.952386]},"n185965023":{"id":"n185965023","loc":[-85.638654,41.953665]},"n185965025":{"id":"n185965025","loc":[-85.638694,41.954649]},"n185965027":{"id":"n185965027","loc":[-85.638724,41.955913]},"n185971415":{"id":"n185971415","loc":[-85.644466,41.949246]},"n185971417":{"id":"n185971417","loc":[-85.647021,41.949193]},"n185971420":{"id":"n185971420","loc":[-85.648476,41.949169]},"n185979975":{"id":"n185979975","loc":[-85.644429,41.947633]},"n185988171":{"id":"n185988171","loc":[-85.645377,41.947622]},"w17963211":{"id":"w17963211","tags":{"highway":"residential"},"nodes":["n185949870","n185949872","n185949875","n185949877","n185949881"]},"w17965839":{"id":"w17965839","tags":{"highway":"residential","name":"Arnold St"},"nodes":["n185949870","n185971415","n185971417","n185971420","n185962639","n185962810"]},"w17967618":{"id":"w17967618","tags":{"highway":"residential","name":"Pierson St"},"nodes":["n185967777","n185988165","n185988167","n185988169","n185985824","n185979975","n185988171"]},"w17965149":{"id":"w17965149","tags":{"highway":"residential","name":"Oak St"},"nodes":["n185965019","n1475293248","n185965021","n185965023","n185965025","n185965027"]},"w17966118":{"id":"w17966118","tags":{"highway":"residential","name":"West Armitage Street"},"nodes":["n185974583","n185974585","n185964355","n185965019"]},"n2208608800":{"id":"n2208608800","loc":[-85.6354294,41.9486201]},"n2199109806":{"id":"n2199109806","loc":[-85.6350474,41.9477884]},"n2199109804":{"id":"n2199109804","loc":[-85.6350476,41.9477962]},"n2199109802":{"id":"n2199109802","loc":[-85.635002,41.9477969]},"n2199109799":{"id":"n2199109799","loc":[-85.6350018,41.9477883]},"n2199109797":{"id":"n2199109797","loc":[-85.6349141,41.9477897]},"n2199109795":{"id":"n2199109795","loc":[-85.6349131,41.9477535]},"n2199109793":{"id":"n2199109793","loc":[-85.6349395,41.9477531]},"n2199109791":{"id":"n2199109791","loc":[-85.6349382,41.9477077]},"n2199109789":{"id":"n2199109789","loc":[-85.6351236,41.9477049]},"n2199109787":{"id":"n2199109787","loc":[-85.6351259,41.9477872]},"n2199109785":{"id":"n2199109785","loc":[-85.634972,41.9475992]},"n2199109783":{"id":"n2199109783","loc":[-85.6349206,41.9475997]},"n2199109770":{"id":"n2199109770","loc":[-85.6348499,41.9475461]},"n2199109768":{"id":"n2199109768","loc":[-85.6348499,41.9475084]},"n2199109765":{"id":"n2199109765","loc":[-85.6349241,41.9474569]},"n2199109763":{"id":"n2199109763","loc":[-85.634967,41.9474564]},"n2199109762":{"id":"n2199109762","loc":[-85.6350405,41.9475121]},"n2199109761":{"id":"n2199109761","loc":[-85.6350405,41.9475419]},"n2199109753":{"id":"n2199109753","loc":[-85.6342443,41.9478391]},"n2199109751":{"id":"n2199109751","loc":[-85.6342427,41.9477927]},"n2199109745":{"id":"n2199109745","loc":[-85.6342439,41.9476859]},"n2199109743":{"id":"n2199109743","loc":[-85.6342429,41.9476575]},"n2199109741":{"id":"n2199109741","loc":[-85.6344615,41.9476533]},"n2199109739":{"id":"n2199109739","loc":[-85.6344678,41.9478348]},"n2199109737":{"id":"n2199109737","loc":[-85.634416,41.9480059]},"n2199109735":{"id":"n2199109735","loc":[-85.6344145,41.9478983]},"n2199109733":{"id":"n2199109733","loc":[-85.6342749,41.9478993]},"n2199109731":{"id":"n2199109731","loc":[-85.6342753,41.9479272]},"n2199109729":{"id":"n2199109729","loc":[-85.6342498,41.9479274]},"n2199109727":{"id":"n2199109727","loc":[-85.6342505,41.9479762]},"n2199109725":{"id":"n2199109725","loc":[-85.6342743,41.947976]},"n2199109723":{"id":"n2199109723","loc":[-85.6342747,41.948007]},"n2199109721":{"id":"n2199109721","loc":[-85.6343415,41.9476355]},"n2199109719":{"id":"n2199109719","loc":[-85.6343391,41.9474973]},"n2199109717":{"id":"n2199109717","loc":[-85.6343133,41.9474798]},"n2199109715":{"id":"n2199109715","loc":[-85.6342874,41.9474737]},"n2199109709":{"id":"n2199109709","loc":[-85.6349804,41.94815]},"n2199109707":{"id":"n2199109707","loc":[-85.6348915,41.9481505]},"n2199109705":{"id":"n2199109705","loc":[-85.6348917,41.9481692]},"n2199109702":{"id":"n2199109702","loc":[-85.6348522,41.9481694]},"n2199109700":{"id":"n2199109700","loc":[-85.6348532,41.9482679]},"n2199109698":{"id":"n2199109698","loc":[-85.6348315,41.948268]},"n2199109696":{"id":"n2199109696","loc":[-85.6348318,41.9482955]},"n2199109694":{"id":"n2199109694","loc":[-85.6349653,41.9482946]},"n2199109692":{"id":"n2199109692","loc":[-85.6349656,41.9483211]},"n2199109690":{"id":"n2199109690","loc":[-85.634999,41.9483209]},"n2199109688":{"id":"n2199109688","loc":[-85.6349987,41.9482947]},"n2199109686":{"id":"n2199109686","loc":[-85.6351753,41.9482935]},"n2199109684":{"id":"n2199109684","loc":[-85.6351749,41.9482617]},"n2199109682":{"id":"n2199109682","loc":[-85.6351588,41.9482618]},"n2199109680":{"id":"n2199109680","loc":[-85.6351575,41.9481518]},"n2199109678":{"id":"n2199109678","loc":[-85.6350671,41.9481524]},"n2199109676":{"id":"n2199109676","loc":[-85.6350649,41.9479659]},"n2199109674":{"id":"n2199109674","loc":[-85.6349785,41.9479665]},"n2199109671":{"id":"n2199109671","loc":[-85.6343069,41.9483263]},"n2199109669":{"id":"n2199109669","loc":[-85.6343052,41.9482981]},"n2199109658":{"id":"n2199109658","loc":[-85.6343314,41.9480549]},"n2199109656":{"id":"n2199109656","loc":[-85.6343305,41.9480461]},"n2199109654":{"id":"n2199109654","loc":[-85.634435,41.9480468]},"n2199109652":{"id":"n2199109652","loc":[-85.6344342,41.9483746]},"n2199109650":{"id":"n2199109650","loc":[-85.6344629,41.9483727]},"n2199109648":{"id":"n2199109648","loc":[-85.6344637,41.9484561]},"n2199109645":{"id":"n2199109645","loc":[-85.63443,41.9484567]},"n2199109642":{"id":"n2199109642","loc":[-85.6344317,41.948505]},"n185964352":{"id":"n185964352","loc":[-85.6373958,41.9489943]},"n185964351":{"id":"n185964351","loc":[-85.637113,41.9486]},"n2208608825":{"id":"n2208608825","loc":[-85.6354483,41.9494241]},"n2208608823":{"id":"n2208608823","loc":[-85.6360418,41.949416]},"n2208608821":{"id":"n2208608821","loc":[-85.6360458,41.9495802]},"n2208608811":{"id":"n2208608811","loc":[-85.6357458,41.9495843]},"n2208608808":{"id":"n2208608808","loc":[-85.6357508,41.9497835]},"n2208608806":{"id":"n2208608806","loc":[-85.6354573,41.9497875]},"n2208608795":{"id":"n2208608795","loc":[-85.6354595,41.9498778]},"n2199109638":{"id":"n2199109638","loc":[-85.6349605,41.949749]},"n2199109636":{"id":"n2199109636","loc":[-85.6349605,41.9497639]},"n2199109634":{"id":"n2199109634","loc":[-85.6349061,41.94971]},"n2199109632":{"id":"n2199109632","loc":[-85.6349048,41.9496569]},"n2199109630":{"id":"n2199109630","loc":[-85.6348835,41.9496571]},"n2199109628":{"id":"n2199109628","loc":[-85.6348829,41.9497103]},"n2199109626":{"id":"n2199109626","loc":[-85.635227,41.9497738]},"n2199109624":{"id":"n2199109624","loc":[-85.6352184,41.9497787]},"n2199109622":{"id":"n2199109622","loc":[-85.6351181,41.9497806]},"n2199109620":{"id":"n2199109620","loc":[-85.6351181,41.9497456]},"n2199109618":{"id":"n2199109618","loc":[-85.6348842,41.9497651]},"n2199109616":{"id":"n2199109616","loc":[-85.6348827,41.9496238]},"n2199109615":{"id":"n2199109615","loc":[-85.6351268,41.9496206]},"n2199109614":{"id":"n2199109614","loc":[-85.6351261,41.9495891]},"n2199109613":{"id":"n2199109613","loc":[-85.6351957,41.9495881]},"n2199109612":{"id":"n2199109612","loc":[-85.6351924,41.9494515]},"n2199109611":{"id":"n2199109611","loc":[-85.6353997,41.9494488]},"n2199109610":{"id":"n2199109610","loc":[-85.6354074,41.9497715]},"n2189015681":{"id":"n2189015681","loc":[-85.6344229,41.9509639]},"n2189015677":{"id":"n2189015677","loc":[-85.634424,41.9507396]},"n2138493843":{"id":"n2138493843","loc":[-85.6343935,41.9502836]},"n2138493840":{"id":"n2138493840","loc":[-85.634398,41.9506264]},"n354002838":{"id":"n354002838","loc":[-85.6345197,41.9510631]},"n2114807590":{"id":"n2114807590","loc":[-85.634511,41.9499767]},"n185964353":{"id":"n185964353","loc":[-85.6374092,41.9498755]},"n1819849180":{"id":"n1819849180","loc":[-85.6348236,41.94996]},"n1819849115":{"id":"n1819849115","loc":[-85.6354372,41.9499538]},"n1819848921":{"id":"n1819848921","loc":[-85.6348439,41.951064]},"n1819848885":{"id":"n1819848885","loc":[-85.6354575,41.9510578]},"n185984281":{"id":"n185984281","loc":[-85.638075,41.949872]},"n2208608827":{"id":"n2208608827","loc":[-85.6339169,41.9473191]},"n2199109749":{"id":"n2199109749","loc":[-85.6342082,41.9477934]},"n2199109747":{"id":"n2199109747","loc":[-85.6342045,41.9476867]},"n2199109713":{"id":"n2199109713","loc":[-85.6342404,41.9474746]},"n2199109711":{"id":"n2199109711","loc":[-85.6342404,41.9476355]},"n2199109673":{"id":"n2199109673","loc":[-85.6340886,41.9483282]},"n2199109667":{"id":"n2199109667","loc":[-85.6342403,41.9482988]},"n2199109665":{"id":"n2199109665","loc":[-85.6342386,41.9482116]},"n2199109662":{"id":"n2199109662","loc":[-85.6340861,41.9482135]},"n2199109660":{"id":"n2199109660","loc":[-85.6340802,41.9480562]},"n2199109640":{"id":"n2199109640","loc":[-85.6340928,41.9485063]},"n354031366":{"id":"n354031366","loc":[-85.6341667,41.9477778],"tags":{"amenity":"place_of_worship","name":"Faith Tabernacle Church","religion":"christian"}},"n2189015686":{"id":"n2189015686","loc":[-85.6337798,41.95099]},"n2189015684":{"id":"n2189015684","loc":[-85.6337794,41.9509674]},"n2189015673":{"id":"n2189015673","loc":[-85.6337501,41.9507457]},"n2189015669":{"id":"n2189015669","loc":[-85.6337501,41.9506974]},"n2189015665":{"id":"n2189015665","loc":[-85.6339034,41.9506959]},"n2189015662":{"id":"n2189015662","loc":[-85.6339015,41.950436]},"n2189015658":{"id":"n2189015658","loc":[-85.6334916,41.9504376]},"n2189015655":{"id":"n2189015655","loc":[-85.6334939,41.9507558]},"n2189015650":{"id":"n2189015650","loc":[-85.6334543,41.950756]},"n2189015649":{"id":"n2189015649","loc":[-85.633456,41.9509915]},"n2138493842":{"id":"n2138493842","loc":[-85.6339937,41.9502836]},"n2138493841":{"id":"n2138493841","loc":[-85.6339983,41.9506281]},"n2114807579":{"id":"n2114807579","loc":[-85.6333644,41.9510682]},"n2114807573":{"id":"n2114807573","loc":[-85.6333557,41.9499819]},"n354031330":{"id":"n354031330","loc":[-85.6341667,41.9497222],"tags":{"amenity":"place_of_worship","name":"Trinity Episcopal Church","religion":"christian"}},"n185960794":{"id":"n185960794","loc":[-85.633307,41.9537]},"n185964357":{"id":"n185964357","loc":[-85.637432,41.952399]},"n185964358":{"id":"n185964358","loc":[-85.637452,41.953665]},"n185964359":{"id":"n185964359","loc":[-85.63746,41.954658]},"n185964360":{"id":"n185964360","loc":[-85.637473,41.95592]},"n185964361":{"id":"n185964361","loc":[-85.637468,41.956906]},"n185964362":{"id":"n185964362","loc":[-85.637483,41.958313]},"n185966957":{"id":"n185966957","loc":[-85.633361,41.957422]},"n185975351":{"id":"n185975351","loc":[-85.63334,41.9559]},"n185978784":{"id":"n185978784","loc":[-85.633311,41.954679]},"n185986157":{"id":"n185986157","loc":[-85.633287,41.952426]},"n185986158":{"id":"n185986158","loc":[-85.6333607,41.9582301],"tags":{"highway":"turning_circle"}},"w17965182":{"id":"w17965182","tags":{"highway":"residential","name":"W Prutzman St"},"nodes":["n185965289","n2189153241","n185965291"]},"w208627205":{"id":"w208627205","tags":{"area":"yes","building":"yes"},"nodes":["n2189015649","n2189015650","n2189015655","n2189015658","n2189015662","n2189015665","n2189015669","n2189015673","n2189015677","n2189015681","n2189015684","n2189015686","n2189015649"]},"w209717042":{"id":"w209717042","tags":{"amenity":"place_of_worship","area":"yes","building":"yes","denomination":"presbyterian","name":"First Presbyterian Church","religion":"christian"},"nodes":["n2199109610","n2199109611","n2199109612","n2199109613","n2199109614","n2199109615","n2199109616","n2199109630","n2199109632","n2199109634","n2199109628","n2199109618","n2199109636","n2199109638","n2199109620","n2199109622","n2199109624","n2199109626","n2199109610"]},"w209717045":{"id":"w209717045","tags":{"area":"yes","building":"yes"},"nodes":["n2199109711","n2199109713","n2199109715","n2199109717","n2199109719","n2199109721","n2199109711"]},"w209717047":{"id":"w209717047","tags":{"area":"yes","building":"yes"},"nodes":["n2199109739","n2199109741","n2199109743","n2199109745","n2199109747","n2199109749","n2199109751","n2199109753","n2199109739"]},"w209717044":{"id":"w209717044","tags":{"area":"yes","building":"yes"},"nodes":["n2199109674","n2199109676","n2199109678","n2199109680","n2199109682","n2199109684","n2199109686","n2199109688","n2199109690","n2199109692","n2199109694","n2199109696","n2199109698","n2199109700","n2199109702","n2199109705","n2199109707","n2199109709","n2199109674"]},"w210822776":{"id":"w210822776","tags":{"highway":"service","service":"alley","surface":"unpaved"},"nodes":["n2208608795","n2208608806","n2208608825","n2208608800","n2189153241"]},"w210822778":{"id":"w210822778","tags":{"highway":"service","service":"alley"},"nodes":["n2208608826","n2208608827"]},"w209717050":{"id":"w209717050","tags":{"area":"yes","building":"yes"},"nodes":["n2199109787","n2199109789","n2199109791","n2199109793","n2199109795","n2199109797","n2199109799","n2199109802","n2199109804","n2199109806","n2199109787"]},"w17965097":{"id":"w17965097","tags":{"highway":"residential","name":"Maple Street"},"nodes":["n185964351","n185964352","n185964353","n185964355","n185964357","n185964358","n185964359","n185964360","n185964361","n185964362"]},"w17965856":{"id":"w17965856","tags":{"highway":"residential","name":"W Kelsey St"},"nodes":["n185971578","n2208608800","n185971580","n185964351"]},"w17967444":{"id":"w17967444","tags":{"highway":"residential","name":"East Street"},"nodes":["n185966937","n185978969","n185986155","n185985812","n185986157","n185960794","n185978784","n185975351","n185966957","n185986158"]},"w17967764":{"id":"w17967764","tags":{"highway":"residential","name":"Rock River Ave"},"nodes":["n185984017","n185964351"]},"w170848329":{"id":"w170848329","tags":{"leisure":"park","name":"LaFayette Park"},"nodes":["n1819849180","n1819849115","n1819848885","n1819848921","n1819849180"]},"w17967208":{"id":"w17967208","tags":{"highway":"residential","name":"West Bennett Street"},"nodes":["n185978390","n2208608795","n185984020","n185964353","n185984281"]},"w17965349":{"id":"w17965349","tags":{"highway":"residential","name":"E Prutzman St"},"nodes":["n185966937","n2208608827","n185965289"]},"w209717049":{"id":"w209717049","tags":{"area":"yes","building":"yes"},"nodes":["n2199109761","n2199109762","n2199109763","n2199109765","n2199109768","n2199109770","n2199109783","n2199109785","n2199109761"]},"w203841840":{"id":"w203841840","tags":{"area":"yes","leisure":"playground"},"nodes":["n2138493840","n2138493841","n2138493842","n2138493843","n2138493840"]},"w209717043":{"id":"w209717043","tags":{"amenity":"place_of_worship","area":"yes","building":"church","denomination":"methodist","name":"First United Methodist Church","religion":"christian"},"nodes":["n2199109640","n2199109642","n2199109645","n2199109648","n2199109650","n2199109652","n2199109654","n2199109656","n2199109658","n2199109660","n2199109662","n2199109665","n2199109667","n2199109669","n2199109671","n2199109673","n2199109640"]},"w201484341":{"id":"w201484341","tags":{"amenity":"school","name":"Hoppin School"},"nodes":["n354002838","n2114807579","n2114807573","n2114807590","n354002838"]},"w209717046":{"id":"w209717046","tags":{"area":"yes","building":"yes"},"nodes":["n2199109723","n2199109725","n2199109727","n2199109729","n2199109731","n2199109733","n2199109735","n2199109737","n2199109723"]},"w210822777":{"id":"w210822777","tags":{"amenity":"parking","area":"yes"},"nodes":["n2208608806","n2208608808","n2208608811","n2208608821","n2208608823","n2208608825","n2208608806"]},"n185954965":{"id":"n185954965","loc":[-85.6191189,41.9441922]},"n185954968":{"id":"n185954968","loc":[-85.6194384,41.9442405]},"n185954970":{"id":"n185954970","loc":[-85.6196543,41.9443252]},"n185954972":{"id":"n185954972","loc":[-85.6197862,41.9444539]},"n354002931":{"id":"n354002931","loc":[-85.6198991,41.9455269]},"n354030853":{"id":"n354030853","loc":[-85.6219444,41.9455556],"tags":{"amenity":"place_of_worship","name":"Grant Chapel","religion":"christian"}},"n367815963":{"id":"n367815963","loc":[-85.6202778,41.9461111],"tags":{"building":"yes","name":"George Washington Carver Community Center"}},"n185947331":{"id":"n185947331","loc":[-85.618779,41.943269]},"n185947333":{"id":"n185947333","loc":[-85.618795,41.943511]},"n185947336":{"id":"n185947336","loc":[-85.618711,41.94413]},"n185947338":{"id":"n185947338","loc":[-85.618704,41.944189]},"n185947339":{"id":"n185947339","loc":[-85.618597,41.944337]},"n185947340":{"id":"n185947340","loc":[-85.618485,41.944528]},"n185947343":{"id":"n185947343","loc":[-85.618442,41.944716]},"n185947345":{"id":"n185947345","loc":[-85.618457,41.945107]},"n185947347":{"id":"n185947347","loc":[-85.618296,41.945338]},"n185947374":{"id":"n185947374","loc":[-85.616748,41.944453]},"n185947375":{"id":"n185947375","loc":[-85.616813,41.944646]},"n185947376":{"id":"n185947376","loc":[-85.616859,41.945196]},"n185947377":{"id":"n185947377","loc":[-85.616941,41.945352]},"n185947406":{"id":"n185947406","loc":[-85.618184,41.944227]},"n185947409":{"id":"n185947409","loc":[-85.617911,41.943875]},"n185947410":{"id":"n185947410","loc":[-85.617579,41.943682]},"n185947411":{"id":"n185947411","loc":[-85.61713,41.943589]},"n185947412":{"id":"n185947412","loc":[-85.616549,41.943559]},"n185947414":{"id":"n185947414","loc":[-85.616482,41.943556]},"n185947464":{"id":"n185947464","loc":[-85.616526,41.943788]},"n185947466":{"id":"n185947466","loc":[-85.616504,41.944002]},"n185948863":{"id":"n185948863","loc":[-85.619017,41.943391]},"n185948865":{"id":"n185948865","loc":[-85.619059,41.943368]},"n185955022":{"id":"n185955022","loc":[-85.620088,41.945571]},"n185955025":{"id":"n185955025","loc":[-85.620051,41.945505]},"n185955028":{"id":"n185955028","loc":[-85.62001,41.94541]},"n185980371":{"id":"n185980371","loc":[-85.620982,41.944742]},"n185980398":{"id":"n185980398","loc":[-85.621305,41.944782]},"n185980401":{"id":"n185980401","loc":[-85.621174,41.944819]},"n185980403":{"id":"n185980403","loc":[-85.621029,41.944871]},"n185980405":{"id":"n185980405","loc":[-85.620741,41.945011]},"n185980407":{"id":"n185980407","loc":[-85.620616,41.945085]},"n185980409":{"id":"n185980409","loc":[-85.620506,41.945172]},"n185980411":{"id":"n185980411","loc":[-85.620394,41.945273]},"n185980413":{"id":"n185980413","loc":[-85.620316,41.94536]},"n185980415":{"id":"n185980415","loc":[-85.620257,41.945452]},"n185980417":{"id":"n185980417","loc":[-85.620212,41.945535]},"n185985910":{"id":"n185985910","loc":[-85.620101,41.945811]},"n185985912":{"id":"n185985912","loc":[-85.620081,41.945937]},"n1475283972":{"id":"n1475283972","loc":[-85.6198991,41.9437179]},"n1475283982":{"id":"n1475283982","loc":[-85.6195022,41.9433463]},"n1475284007":{"id":"n1475284007","loc":[-85.6193037,41.9433383]},"n1475284040":{"id":"n1475284040","loc":[-85.6197329,41.9434121]},"n1475284044":{"id":"n1475284044","loc":[-85.6198756,41.9435363]},"n1475284050":{"id":"n1475284050","loc":[-85.6199689,41.9432106]},"n1475284053":{"id":"n1475284053","loc":[-85.6198943,41.9432921]},"n185954974":{"id":"n185954974","loc":[-85.6198296,41.94473]},"n185954977":{"id":"n185954977","loc":[-85.6200474,41.9447384]},"n2196831365":{"id":"n2196831365","loc":[-85.6202259,41.9460883]},"n2196831366":{"id":"n2196831366","loc":[-85.6202245,41.9458642]},"n2196831367":{"id":"n2196831367","loc":[-85.6205184,41.9458631]},"n2196831368":{"id":"n2196831368","loc":[-85.6205189,41.9459437]},"n2196831369":{"id":"n2196831369","loc":[-85.6203879,41.9459441]},"n2196831370":{"id":"n2196831370","loc":[-85.6203888,41.9460878]},"n2196831371":{"id":"n2196831371","loc":[-85.6184046,41.9465663]},"n2196831372":{"id":"n2196831372","loc":[-85.6191563,41.9465618]},"n2196831373":{"id":"n2196831373","loc":[-85.6191536,41.946319]},"n2196831374":{"id":"n2196831374","loc":[-85.6187356,41.9463216]},"n2196831375":{"id":"n2196831375","loc":[-85.6187334,41.9461197]},"n2196831376":{"id":"n2196831376","loc":[-85.6193167,41.9461162]},"n2196831377":{"id":"n2196831377","loc":[-85.6193156,41.9460229]},"n2196831378":{"id":"n2196831378","loc":[-85.619622,41.946021]},"n2196831379":{"id":"n2196831379","loc":[-85.6196237,41.9461712]},"n2196831380":{"id":"n2196831380","loc":[-85.6197702,41.9461703]},"n2196831381":{"id":"n2196831381","loc":[-85.6197685,41.9460202]},"n2196831382":{"id":"n2196831382","loc":[-85.6197323,41.9460204]},"n2196831383":{"id":"n2196831383","loc":[-85.6197305,41.9458563]},"n2196831384":{"id":"n2196831384","loc":[-85.6196165,41.945857]},"n2196831385":{"id":"n2196831385","loc":[-85.6196156,41.9457764]},"n2196831386":{"id":"n2196831386","loc":[-85.6194472,41.9457775]},"n2196831387":{"id":"n2196831387","loc":[-85.6194151,41.9457777]},"n2196831388":{"id":"n2196831388","loc":[-85.6183779,41.9457883]},"n2196831389":{"id":"n2196831389","loc":[-85.6183842,41.9461317]},"n2196831390":{"id":"n2196831390","loc":[-85.6185026,41.9461304]},"n2196831391":{"id":"n2196831391","loc":[-85.6185061,41.9463194]},"n2196831392":{"id":"n2196831392","loc":[-85.6184001,41.9463205]},"n2196831393":{"id":"n2196831393","loc":[-85.6182482,41.9464163]},"n2196831394":{"id":"n2196831394","loc":[-85.6182467,41.9463193]},"n2196831395":{"id":"n2196831395","loc":[-85.6180389,41.946321]},"n2196831397":{"id":"n2196831397","loc":[-85.6180404,41.946418]},"n185947303":{"id":"n185947303","loc":[-85.611074,41.943389]},"n185947304":{"id":"n185947304","loc":[-85.611332,41.943267]},"n185947305":{"id":"n185947305","loc":[-85.611635,41.943218]},"n185947306":{"id":"n185947306","loc":[-85.612762,41.943311]},"n185947308":{"id":"n185947308","loc":[-85.613027,41.943327]},"n185947310":{"id":"n185947310","loc":[-85.615377,41.942996]},"n185947312":{"id":"n185947312","loc":[-85.615701,41.943007]},"n185947314":{"id":"n185947314","loc":[-85.61604,41.943067]},"n185947315":{"id":"n185947315","loc":[-85.61626,41.943083]},"n185947316":{"id":"n185947316","loc":[-85.616507,41.943048]},"n185947319":{"id":"n185947319","loc":[-85.616702,41.94299]},"n185947321":{"id":"n185947321","loc":[-85.617078,41.942918]},"n185947322":{"id":"n185947322","loc":[-85.617366,41.942973]},"n185947323":{"id":"n185947323","loc":[-85.617601,41.943033]},"n185947325":{"id":"n185947325","loc":[-85.617799,41.943027]},"n185947327":{"id":"n185947327","loc":[-85.618264,41.942961]},"n185947328":{"id":"n185947328","loc":[-85.618508,41.942972]},"n185947329":{"id":"n185947329","loc":[-85.618707,41.943076]},"n185947361":{"id":"n185947361","loc":[-85.615356,41.944922]},"n185947363":{"id":"n185947363","loc":[-85.61536,41.944893]},"n185947365":{"id":"n185947365","loc":[-85.615406,41.944547]},"n185947367":{"id":"n185947367","loc":[-85.61548,41.944351]},"n185947369":{"id":"n185947369","loc":[-85.615805,41.94419]},"n185947371":{"id":"n185947371","loc":[-85.616166,41.944156]},"n185947373":{"id":"n185947373","loc":[-85.616411,41.944197]},"n185947416":{"id":"n185947416","loc":[-85.616335,41.94343]},"n185947417":{"id":"n185947417","loc":[-85.616069,41.943293]},"n185947419":{"id":"n185947419","loc":[-85.615803,41.943249]},"n185947420":{"id":"n185947420","loc":[-85.615524,41.943342]},"n185947421":{"id":"n185947421","loc":[-85.615311,41.94353]},"n185947422":{"id":"n185947422","loc":[-85.614338,41.943558]},"n185947423":{"id":"n185947423","loc":[-85.61422,41.94369]},"n185947425":{"id":"n185947425","loc":[-85.614221,41.944224]},"n185947427":{"id":"n185947427","loc":[-85.614198,41.944888]},"n185947429":{"id":"n185947429","loc":[-85.614221,41.945439]},"n185947468":{"id":"n185947468","loc":[-85.615908,41.944756]},"n185947470":{"id":"n185947470","loc":[-85.615871,41.944888]},"n185947472":{"id":"n185947472","loc":[-85.615878,41.94507]},"n185955153":{"id":"n185955153","loc":[-85.620087,41.947701]},"n185960690":{"id":"n185960690","loc":[-85.620141,41.951901]},"n185978817":{"id":"n185978817","loc":[-85.617193,41.954706]},"n185985916":{"id":"n185985916","loc":[-85.620088,41.94758]},"n185985918":{"id":"n185985918","loc":[-85.620133,41.951538]},"n185985919":{"id":"n185985919","loc":[-85.62013,41.952104]},"n185985920":{"id":"n185985920","loc":[-85.620104,41.952305]},"n185985921":{"id":"n185985921","loc":[-85.620062,41.952499]},"n185985922":{"id":"n185985922","loc":[-85.619993,41.952702]},"n185985925":{"id":"n185985925","loc":[-85.619879,41.952986]},"n185985927":{"id":"n185985927","loc":[-85.619689,41.95329]},"n185985928":{"id":"n185985928","loc":[-85.619508,41.953521]},"n185985929":{"id":"n185985929","loc":[-85.619286,41.953728]},"n185985930":{"id":"n185985930","loc":[-85.618925,41.954007]},"n185985931":{"id":"n185985931","loc":[-85.618638,41.954189]},"n185985932":{"id":"n185985932","loc":[-85.61831,41.954358]},"n185985934":{"id":"n185985934","loc":[-85.618015,41.954485]},"n185985936":{"id":"n185985936","loc":[-85.617606,41.954611]},"n1475283975":{"id":"n1475283975","loc":[-85.6150935,41.9434118]},"n1475283979":{"id":"n1475283979","loc":[-85.6193367,41.9430252]},"n1475283989":{"id":"n1475283989","loc":[-85.6104771,41.9455269]},"n1475283990":{"id":"n1475283990","loc":[-85.6104771,41.9437179]},"n1475283994":{"id":"n1475283994","loc":[-85.6198042,41.9429763]},"n1475283998":{"id":"n1475283998","loc":[-85.6192101,41.9426716]},"n1475284000":{"id":"n1475284000","loc":[-85.6198622,41.942836]},"n1475284002":{"id":"n1475284002","loc":[-85.6163262,41.9427688]},"n1475284006":{"id":"n1475284006","loc":[-85.6179527,41.9429168]},"n1475284029":{"id":"n1475284029","loc":[-85.6197195,41.9427278]},"n1475284038":{"id":"n1475284038","loc":[-85.6194405,41.9427837]},"n1475284052":{"id":"n1475284052","loc":[-85.6153225,41.942841]},"n1475284055":{"id":"n1475284055","loc":[-85.6129233,41.9437179]},"n2139966627":{"id":"n2139966627","loc":[-85.61958,41.9427558]},"w17966773":{"id":"w17966773","tags":{"highway":"secondary","name":"E Michigan Ave","ref":"M 60"},"nodes":["n185980372","n185980398","n185980401","n185980403","n185980405","n185980407","n185980409","n185980411","n185980413","n185980415","n185980417","n185955019"]},"w17964043":{"id":"w17964043","tags":{"highway":"residential"},"nodes":["n185955019","n185955022","n185955025","n185955028","n185954977","n185971477","n1475284050","n1475284000","n1475284029","n2139966627","n1475284038"]},"w17962834":{"id":"w17962834","tags":{"highway":"service"},"nodes":["n185947316","n185947414","n185947464","n185947466","n185947373","n185947468","n185947470","n185947472","n185947474"]},"w209470310":{"id":"w209470310","tags":{"area":"yes","building":"yes"},"nodes":["n2196831393","n2196831394","n2196831395","n2196831397","n2196831393"]},"w17963058":{"id":"w17963058","tags":{"highway":"service"},"nodes":["n185947333","n185948863","n185948865","n1475284007","n1475283982","n1475284040","n1475284044"]},"w17962823":{"id":"w17962823","tags":{"highway":"service"},"nodes":["n185947359","n185947361","n185947363","n185947365","n185947367","n185947369","n185947371","n185947373","n185947374","n185947375","n185947376","n185947377","n185947378"]},"w17962821":{"id":"w17962821","tags":{"highway":"service"},"nodes":["n185947303","n185947304","n185947305","n185947306","n185947308","n185947310","n185947312","n185947314","n185947315","n185947316","n185947319","n185947321","n185947322","n185947323","n185947325","n185947327","n185947328","n185947329","n185947331","n185947333","n185947336","n185947338","n185947339","n185947340","n185947343","n185947345","n185947347","n185947349"]},"w134150798":{"id":"w134150798","tags":{"amenity":"grave_yard","name":"Riverside Cemetery"},"nodes":["n354002931","n1475283972","n1475284053","n1475283994","n1475283979","n1475283998","n1475284006","n1475284002","n1475284052","n1475283975","n1475284055","n1475283990","n1475283989","n354002931"]},"w17964040":{"id":"w17964040","tags":{"highway":"service"},"nodes":["n185947336","n185954965","n185954968","n185954970","n185954972","n185954974","n185954977"]},"w209470308":{"id":"w209470308","tags":{"area":"yes","building":"yes"},"nodes":["n2196831365","n2196831366","n2196831367","n2196831368","n2196831369","n2196831370","n2196831365"]},"w17962828":{"id":"w17962828","tags":{"highway":"service"},"nodes":["n185947340","n185947406","n185947409","n185947410","n185947411","n185947412","n185947414","n185947416","n185947417","n185947419","n185947420","n185947421","n185947422","n185947423","n185947425","n185947427","n185947429"]},"w209470309":{"id":"w209470309","tags":{"area":"yes","building":"yes"},"nodes":["n2196831371","n2196831372","n2196831373","n2196831374","n2196831375","n2196831376","n2196831377","n2196831378","n2196831379","n2196831380","n2196831381","n2196831382","n2196831383","n2196831384","n2196831385","n2196831386","n2196831387","n2196831388","n2196831389","n2196831390","n2196831391","n2196831392","n2196831371"]},"w17967415":{"id":"w17967415","tags":{"highway":"secondary","name":"Jefferson St","name_1":"State Highway 60","ref":"M 60"},"nodes":["n185955019","n185985910","n185985912","n185985914","n185961367","n185985916","n185955153","n185965105","n185974697","n185955120","n185985918","n185960690","n185985919","n185985920","n185985921","n185985922","n185985925","n185985927","n185985928","n185985929","n185985930","n185985931","n185985932","n185985934","n185985936","n185978817"]},"w17966772":{"id":"w17966772","tags":{"highway":"unclassified","name":"E Michigan Ave","name_1":"State Highway 60"},"nodes":["n185954977","n185980371","n185980372"]},"n185958500":{"id":"n185958500","loc":[-85.621591,41.941075]},"n185963110":{"id":"n185963110","loc":[-85.6204416,41.9408882]},"n2139966628":{"id":"n2139966628","loc":[-85.6196431,41.9426467],"tags":{"leisure":"fishing"}},"n2139966630":{"id":"n2139966630","loc":[-85.6199354,41.9429616]},"n2199127051":{"id":"n2199127051","loc":[-85.6170556,41.939696]},"n2199127052":{"id":"n2199127052","loc":[-85.6170536,41.9392909]},"n2199127053":{"id":"n2199127053","loc":[-85.6172067,41.9392905]},"n2199127054":{"id":"n2199127054","loc":[-85.6172061,41.9391853]},"n2199127055":{"id":"n2199127055","loc":[-85.6171481,41.9391854]},"n2199127060":{"id":"n2199127060","loc":[-85.6167389,41.9392896]},"n2199127061":{"id":"n2199127061","loc":[-85.6168728,41.9392892]},"n2199127062":{"id":"n2199127062","loc":[-85.6168747,41.9396965]},"n2199127071":{"id":"n2199127071","loc":[-85.620196,41.9399446]},"n2199127072":{"id":"n2199127072","loc":[-85.620193,41.9397316]},"n2199127073":{"id":"n2199127073","loc":[-85.6200381,41.9397328]},"n2199127074":{"id":"n2199127074","loc":[-85.6200412,41.9399458]},"n2199127075":{"id":"n2199127075","loc":[-85.6203606,41.9399939]},"n2199127076":{"id":"n2199127076","loc":[-85.6205527,41.9399922]},"n2199127077":{"id":"n2199127077","loc":[-85.6205482,41.9397115]},"n2199127078":{"id":"n2199127078","loc":[-85.6204132,41.9397124]},"n2199127079":{"id":"n2199127079","loc":[-85.6204144,41.9396341]},"n2199127080":{"id":"n2199127080","loc":[-85.6205699,41.9396324]},"n2199127081":{"id":"n2199127081","loc":[-85.6205722,41.939498]},"n2199127082":{"id":"n2199127082","loc":[-85.6204064,41.9394997]},"n2199127083":{"id":"n2199127083","loc":[-85.6204087,41.939561]},"n2199127084":{"id":"n2199127084","loc":[-85.6203103,41.9395618]},"n2199127085":{"id":"n2199127085","loc":[-85.620308,41.9396069]},"n2199127086":{"id":"n2199127086","loc":[-85.6200347,41.9396086]},"n2199127087":{"id":"n2199127087","loc":[-85.6200382,41.9397141]},"n2199127088":{"id":"n2199127088","loc":[-85.6202257,41.9397149]},"n2199127089":{"id":"n2199127089","loc":[-85.6202269,41.9399182]},"n2199127090":{"id":"n2199127090","loc":[-85.6203595,41.9399199]},"n2199127091":{"id":"n2199127091","loc":[-85.6212335,41.939688]},"n2199127092":{"id":"n2199127092","loc":[-85.6212328,41.939595]},"n2199127093":{"id":"n2199127093","loc":[-85.6208807,41.9395966]},"n2199127094":{"id":"n2199127094","loc":[-85.6208815,41.9396896]},"n2199127095":{"id":"n2199127095","loc":[-85.6208676,41.9396872]},"n2199127096":{"id":"n2199127096","loc":[-85.6208583,41.9393539]},"n2199127097":{"id":"n2199127097","loc":[-85.6207006,41.9393563]},"n2199127098":{"id":"n2199127098","loc":[-85.6207099,41.9396896]},"n185967054":{"id":"n185967054","loc":[-85.6173384,41.9356126]},"n185967063":{"id":"n185967063","loc":[-85.617371,41.936243]},"n185967065":{"id":"n185967065","loc":[-85.617337,41.936299]},"n185967068":{"id":"n185967068","loc":[-85.617321,41.936373]},"n185967070":{"id":"n185967070","loc":[-85.6173562,41.9366969]},"n185967074":{"id":"n185967074","loc":[-85.6173635,41.9377414]},"n185967075":{"id":"n185967075","loc":[-85.6173696,41.9381886]},"n185967076":{"id":"n185967076","loc":[-85.617372,41.938535]},"n2199127056":{"id":"n2199127056","loc":[-85.617147,41.9389616]},"n2199127057":{"id":"n2199127057","loc":[-85.6172136,41.9389614]},"n2199127058":{"id":"n2199127058","loc":[-85.6172123,41.9386909]},"n2199127059":{"id":"n2199127059","loc":[-85.616736,41.9386922]},"n2203921041":{"id":"n2203921041","loc":[-85.6173018,41.9346369]},"w203983952":{"id":"w203983952","tags":{"highway":"service"},"nodes":["n2139966627","n1819800319"]},"w209718301":{"id":"w209718301","tags":{"area":"yes","building":"yes"},"nodes":["n2199127051","n2199127052","n2199127053","n2199127054","n2199127055","n2199127056","n2199127057","n2199127058","n2199127059","n2199127060","n2199127061","n2199127062","n2199127051"]},"w209718304":{"id":"w209718304","tags":{"area":"yes","building":"yes"},"nodes":["n2199127071","n2199127072","n2199127073","n2199127074","n2199127071"]},"w17964961":{"id":"w17964961","tags":{"highway":"residential","name":"Whipple St"},"nodes":["n185963099","n185963110"]},"w17964489":{"id":"w17964489","tags":{"highway":"residential","name":"Jackson St"},"nodes":["n185958498","n185958500"]},"w203983953":{"id":"w203983953","tags":{"area":"yes","leisure":"park","name":"Marina Park"},"nodes":["n1475283994","n1475283979","n1475283998","n2139966629","n2139966625","n1819800319","n2139966623","n2139966622","n2139966621","n2139966630","n1475283994"]},"w17965366":{"id":"w17965366","tags":{"highway":"residential","name":"14th St"},"nodes":["n2203921041","n185967054","n185967063","n185967065","n185967068","n185967070","n185967074","n185967075","n185967076","n185967077"]},"w209718306":{"id":"w209718306","tags":{"area":"yes","building":"yes"},"nodes":["n2199127091","n2199127092","n2199127093","n2199127094","n2199127091"]},"w209718307":{"id":"w209718307","tags":{"area":"yes","building":"yes"},"nodes":["n2199127095","n2199127096","n2199127097","n2199127098","n2199127095"]},"w209718305":{"id":"w209718305","tags":{"area":"yes","building":"yes"},"nodes":["n2199127075","n2199127076","n2199127077","n2199127078","n2199127079","n2199127080","n2199127081","n2199127082","n2199127083","n2199127084","n2199127085","n2199127086","n2199127087","n2199127088","n2199127089","n2199127090","n2199127075"]},"n185960199":{"id":"n185960199","loc":[-85.62965,41.95469]},"n185980737":{"id":"n185980737","loc":[-85.629083,41.953725]},"n2114807561":{"id":"n2114807561","loc":[-85.6297681,41.9524688]},"n2114807597":{"id":"n2114807597","loc":[-85.6296517,41.952563]},"n185960197":{"id":"n185960197","loc":[-85.629676,41.9537314]},"n185978791":{"id":"n185978791","loc":[-85.6244542,41.9547066]},"w17967573":{"id":"w17967573","tags":{"highway":"residential","name":"E Wheeler St"},"nodes":["n185960195","n2114807561","n185968102","n185967430","n185986157","n185978392"]},"w17966553":{"id":"w17966553","tags":{"highway":"residential","name":"East Hoffman Street"},"nodes":["n185971631","n185978784","n185967432","n185968106","n185960199","n185978787","n185978790","n185978791"]},"w17966787":{"id":"w17966787","tags":{"highway":"residential","name":"East Cushman Street"},"nodes":["n185980735","n185980737","n185960197","n185968104","n185960792"]},"w17964723":{"id":"w17964723","tags":{"highway":"residential","name":"Cushman Street"},"nodes":["n185960792","n185960794","n185960796"]},"w17964654":{"id":"w17964654","tags":{"highway":"residential","name":"Pine Street"},"nodes":["n185960195","n2114807597","n185960197","n185960199"]},"n1819848862":{"id":"n1819848862","loc":[-85.6346087,41.9545845]},"n1819848935":{"id":"n1819848935","loc":[-85.6345948,41.9537717]},"n1819848973":{"id":"n1819848973","loc":[-85.6334247,41.9537827]},"n1819848997":{"id":"n1819848997","loc":[-85.6334386,41.9545956]},"n2189015861":{"id":"n2189015861","loc":[-85.6375906,41.954836]},"n2189015865":{"id":"n2189015865","loc":[-85.6383307,41.9548291]},"n2189015867":{"id":"n2189015867","loc":[-85.6383337,41.9550072]},"n2189015868":{"id":"n2189015868","loc":[-85.6380986,41.9550094]},"n2189015869":{"id":"n2189015869","loc":[-85.6381005,41.9551226]},"n2199109808":{"id":"n2199109808","loc":[-85.6372702,41.9522894]},"n2199109810":{"id":"n2199109810","loc":[-85.6372677,41.9521583]},"n2199109812":{"id":"n2199109812","loc":[-85.6369505,41.9521617]},"n2199109814":{"id":"n2199109814","loc":[-85.636953,41.9522927]},"n185952156":{"id":"n185952156","loc":[-85.640983,41.9546557]},"n185953423":{"id":"n185953423","loc":[-85.641871,41.954652]},"n185971637":{"id":"n185971637","loc":[-85.641583,41.95465]},"n185971639":{"id":"n185971639","loc":[-85.6421344,41.9546444]},"n185971642":{"id":"n185971642","loc":[-85.6428264,41.9545612]},"n185971648":{"id":"n185971648","loc":[-85.6436023,41.9544262]},"n185975066":{"id":"n185975066","loc":[-85.640532,41.953638]},"n185975067":{"id":"n185975067","loc":[-85.64079,41.953638]},"n185982166":{"id":"n185982166","loc":[-85.6399012,41.9523817]},"n2189015858":{"id":"n2189015858","loc":[-85.6376104,41.9560138]},"n2189015870":{"id":"n2189015870","loc":[-85.6386794,41.9551172]},"n2189015871":{"id":"n2189015871","loc":[-85.6386817,41.955256]},"n2189015873":{"id":"n2189015873","loc":[-85.6385437,41.9552573]},"n2189015876":{"id":"n2189015876","loc":[-85.638555,41.9559278]},"n2189015879":{"id":"n2189015879","loc":[-85.6384954,41.9559283]},"n2189015882":{"id":"n2189015882","loc":[-85.6384965,41.9559935]},"n2189015885":{"id":"n2189015885","loc":[-85.6383533,41.9559949]},"n2189015888":{"id":"n2189015888","loc":[-85.638351,41.9558607]},"n2189015891":{"id":"n2189015891","loc":[-85.6382178,41.9558619]},"n2189015894":{"id":"n2189015894","loc":[-85.6382203,41.956008]},"w208627223":{"id":"w208627223","tags":{"area":"yes","building":"yes"},"nodes":["n2189015858","n2189015861","n2189015865","n2189015867","n2189015868","n2189015869","n2189015870","n2189015871","n2189015873","n2189015876","n2189015879","n2189015882","n2189015885","n2189015888","n2189015891","n2189015894","n2189015858"]},"w170848328":{"id":"w170848328","tags":{"leisure":"park","name":"Bowman Park"},"nodes":["n1819848935","n1819848973","n1819848997","n1819848862","n1819848935"]},"w17965866":{"id":"w17965866","tags":{"highway":"residential","name":"West Hoffman Street"},"nodes":["n185971631","n185971632","n185964359","n185965025","n1475293264","n185952156","n185971637","n185953423","n185971639","n185971642","n185971648"]},"w209717051":{"id":"w209717051","tags":{"amenity":"place_of_worship","area":"yes","building":"yes","denomination":"baptist","name":"Calvary Missionary Baptist Church","religion":"christian"},"nodes":["n2199109808","n2199109810","n2199109812","n2199109814","n2199109808"]},"w17966172":{"id":"w17966172","tags":{"highway":"residential","name":"West Cushman Street"},"nodes":["n185960796","n185975064","n185964358","n185965023","n1475293222","n185975066","n185975067"]},"w17966975":{"id":"w17966975","tags":{"highway":"residential","name":"W Wheeler St"},"nodes":["n185978392","n185982163","n185964357","n185965021","n1475293261","n185982166"]},"n185960684":{"id":"n185960684","loc":[-85.622687,41.951885]},"n185960686":{"id":"n185960686","loc":[-85.622492,41.951901]},"n185978795":{"id":"n185978795","loc":[-85.6240991,41.954708]},"n185978803":{"id":"n185978803","loc":[-85.623348,41.954547]},"n185978806":{"id":"n185978806","loc":[-85.623123,41.954502]},"n185978808":{"id":"n185978808","loc":[-85.622923,41.954469]},"n185978810":{"id":"n185978810","loc":[-85.622787,41.954457]},"n185978811":{"id":"n185978811","loc":[-85.622612,41.954458]},"n185978813":{"id":"n185978813","loc":[-85.622368,41.954472]},"n1819790545":{"id":"n1819790545","loc":[-85.6240295,41.9548949]},"n1819790621":{"id":"n1819790621","loc":[-85.6235789,41.954855]},"n1819790664":{"id":"n1819790664","loc":[-85.6238363,41.9549507]},"n1819790683":{"id":"n1819790683","loc":[-85.6224727,41.9545921]},"n1819790730":{"id":"n1819790730","loc":[-85.6227527,41.9545795]},"n1819790740":{"id":"n1819790740","loc":[-85.6240402,41.9550784]},"n1819790831":{"id":"n1819790831","loc":[-85.624126,41.9549986]},"n1819790861":{"id":"n1819790861","loc":[-85.6231712,41.9546872]},"n1819790887":{"id":"n1819790887","loc":[-85.6242762,41.955206]},"n2168544739":{"id":"n2168544739","loc":[-85.6249102,41.952801]},"n2168544740":{"id":"n2168544740","loc":[-85.6251859,41.9527564]},"n2168544741":{"id":"n2168544741","loc":[-85.6255515,41.9527921]},"n2168544742":{"id":"n2168544742","loc":[-85.626001,41.9529481]},"n2168544743":{"id":"n2168544743","loc":[-85.6265284,41.9529838]},"n2168544744":{"id":"n2168544744","loc":[-85.626942,41.9528857]},"n2168544745":{"id":"n2168544745","loc":[-85.6270918,41.9526851]},"n2168544746":{"id":"n2168544746","loc":[-85.6272117,41.95244]},"n2168544747":{"id":"n2168544747","loc":[-85.6271578,41.952226]},"n2168544748":{"id":"n2168544748","loc":[-85.6270019,41.9519719]},"n2168544749":{"id":"n2168544749","loc":[-85.6268221,41.9518382]},"n2168544750":{"id":"n2168544750","loc":[-85.6265284,41.951807]},"n2168544751":{"id":"n2168544751","loc":[-85.6256534,41.9518516]},"n2168544752":{"id":"n2168544752","loc":[-85.6253477,41.9518338]},"n2168544753":{"id":"n2168544753","loc":[-85.6251139,41.9517669]},"n185955747":{"id":"n185955747","loc":[-85.620674,41.954709]},"n185960688":{"id":"n185960688","loc":[-85.621032,41.951913]},"n185972054":{"id":"n185972054","loc":[-85.6186728,41.9547335]},"n185978814":{"id":"n185978814","loc":[-85.6201708,41.9547403]},"n1819790532":{"id":"n1819790532","loc":[-85.6244908,41.9555731]},"n1819790536":{"id":"n1819790536","loc":[-85.6217925,41.9583135]},"n1819790538":{"id":"n1819790538","loc":[-85.6233954,41.9600014]},"n1819790539":{"id":"n1819790539","loc":[-85.6204611,41.9562117]},"n1819790546":{"id":"n1819790546","loc":[-85.6210898,41.9567657]},"n1819790548":{"id":"n1819790548","loc":[-85.6202465,41.9562237]},"n1819790550":{"id":"n1819790550","loc":[-85.6250165,41.9560677]},"n1819790551":{"id":"n1819790551","loc":[-85.6227946,41.9597023]},"n1819790553":{"id":"n1819790553","loc":[-85.6215726,41.9584571]},"n1819790556":{"id":"n1819790556","loc":[-85.6196306,41.9573002]},"n1819790557":{"id":"n1819790557","loc":[-85.6209503,41.9563109]},"n1819790558":{"id":"n1819790558","loc":[-85.6196939,41.9574085]},"n1819790561":{"id":"n1819790561","loc":[-85.621079,41.957751]},"n1819790562":{"id":"n1819790562","loc":[-85.6224255,41.9611417]},"n1819790565":{"id":"n1819790565","loc":[-85.6232506,41.9604841]},"n1819790566":{"id":"n1819790566","loc":[-85.6190835,41.9562909]},"n1819790567":{"id":"n1819790567","loc":[-85.622227,41.9593028]},"n1819790569":{"id":"n1819790569","loc":[-85.620976,41.9591039]},"n1819790571":{"id":"n1819790571","loc":[-85.6212078,41.9565303]},"n1819790572":{"id":"n1819790572","loc":[-85.6235306,41.9595102]},"n1819790581":{"id":"n1819790581","loc":[-85.6235563,41.9579351]},"n1819790584":{"id":"n1819790584","loc":[-85.6230371,41.9574598]},"n1819790586":{"id":"n1819790586","loc":[-85.6211748,41.9564272]},"n1819790588":{"id":"n1819790588","loc":[-85.6226508,41.9601086]},"n1819790591":{"id":"n1819790591","loc":[-85.6218032,41.9607468]},"n1819790593":{"id":"n1819790593","loc":[-85.6207915,41.9618735]},"n1819790596":{"id":"n1819790596","loc":[-85.6252955,41.9567858]},"n1819790598":{"id":"n1819790598","loc":[-85.6196618,41.9568939]},"n1819790600":{"id":"n1819790600","loc":[-85.6224416,41.9587084]},"n1819790602":{"id":"n1819790602","loc":[-85.6217442,41.9558641]},"n1819790603":{"id":"n1819790603","loc":[-85.6213355,41.9592116]},"n1819790604":{"id":"n1819790604","loc":[-85.622801,41.9573042]},"n1819790608":{"id":"n1819790608","loc":[-85.6199729,41.9574325]},"n1819790610":{"id":"n1819790610","loc":[-85.6195555,41.9557165]},"n1819790611":{"id":"n1819790611","loc":[-85.622978,41.9586007]},"n1819790613":{"id":"n1819790613","loc":[-85.6253963,41.9562636]},"n1819790614":{"id":"n1819790614","loc":[-85.6235252,41.9580342]},"n1819790616":{"id":"n1819790616","loc":[-85.6232988,41.9596305]},"n1819790617":{"id":"n1819790617","loc":[-85.6226776,41.9598732]},"n1819790619":{"id":"n1819790619","loc":[-85.625553,41.9561794]},"n1819790620":{"id":"n1819790620","loc":[-85.6235574,41.959231]},"n1819790624":{"id":"n1819790624","loc":[-85.6228429,41.9573726]},"n1819790626":{"id":"n1819790626","loc":[-85.6193785,41.9556766]},"n1819790628":{"id":"n1819790628","loc":[-85.620092,41.9554253]},"n1819790630":{"id":"n1819790630","loc":[-85.6226658,41.9604402]},"n1819790638":{"id":"n1819790638","loc":[-85.6219964,41.9602561]},"n1819790640":{"id":"n1819790640","loc":[-85.6232731,41.9599969]},"n1819790643":{"id":"n1819790643","loc":[-85.6247698,41.9568895]},"n1819790650":{"id":"n1819790650","loc":[-85.6216412,41.9550149]},"n1819790652":{"id":"n1819790652","loc":[-85.6224952,41.9603918]},"n1819790656":{"id":"n1819790656","loc":[-85.61918,41.9555649]},"n1819790661":{"id":"n1819790661","loc":[-85.6200169,41.955505]},"n1819790662":{"id":"n1819790662","loc":[-85.6217389,41.9563149]},"n1819790666":{"id":"n1819790666","loc":[-85.6229566,41.9598373]},"n1819790667":{"id":"n1819790667","loc":[-85.6209117,41.9609189]},"n1819790669":{"id":"n1819790669","loc":[-85.6252311,41.9562353]},"n1819790670":{"id":"n1819790670","loc":[-85.6209758,41.961868]},"n1819790672":{"id":"n1819790672","loc":[-85.6209557,41.9589078]},"n1819790673":{"id":"n1819790673","loc":[-85.6190352,41.9561393]},"n1819790675":{"id":"n1819790675","loc":[-85.6236432,41.9586685]},"n1819790676":{"id":"n1819790676","loc":[-85.6194901,41.9565389]},"n1819790678":{"id":"n1819790678","loc":[-85.6219266,41.9582417]},"n1819790680":{"id":"n1819790680","loc":[-85.6208258,41.9557211]},"n1819790681":{"id":"n1819790681","loc":[-85.6212024,41.9613212]},"n1819790682":{"id":"n1819790682","loc":[-85.624877,41.9559401]},"n1819790684":{"id":"n1819790684","loc":[-85.6206499,41.9583693]},"n1819790699":{"id":"n1819790699","loc":[-85.6215243,41.956279]},"n1819790701":{"id":"n1819790701","loc":[-85.6246625,41.9559321]},"n1819790703":{"id":"n1819790703","loc":[-85.6230478,41.9585089]},"n1819790708":{"id":"n1819790708","loc":[-85.6211102,41.9575402]},"n1819790710":{"id":"n1819790710","loc":[-85.6215082,41.9548468]},"n1819790711":{"id":"n1819790711","loc":[-85.6206552,41.9586007]},"n1819790713":{"id":"n1819790713","loc":[-85.6215404,41.9549705]},"n1819790715":{"id":"n1819790715","loc":[-85.6216906,41.955521]},"n1819790717":{"id":"n1819790717","loc":[-85.6215404,41.9547391]},"n1819790722":{"id":"n1819790722","loc":[-85.6219964,41.9599131]},"n1819790723":{"id":"n1819790723","loc":[-85.622286,41.9606989]},"n1819790725":{"id":"n1819790725","loc":[-85.6228439,41.9572005]},"n1819790727":{"id":"n1819790727","loc":[-85.6202518,41.9554458]},"n1819790728":{"id":"n1819790728","loc":[-85.623434,41.9575276]},"n1819790729":{"id":"n1819790729","loc":[-85.6234287,41.9568576]},"n1819790732":{"id":"n1819790732","loc":[-85.6229566,41.9571369]},"n1819790733":{"id":"n1819790733","loc":[-85.6225543,41.9590275]},"n1819790734":{"id":"n1819790734","loc":[-85.6232892,41.9583135]},"n1819790736":{"id":"n1819790736","loc":[-85.622977,41.9608551]},"n1819790737":{"id":"n1819790737","loc":[-85.624008,41.9569533]},"n1819790741":{"id":"n1819790741","loc":[-85.6212775,41.9608545]},"n1819790742":{"id":"n1819790742","loc":[-85.6231282,41.9569932]},"n1819790743":{"id":"n1819790743","loc":[-85.6224523,41.9591831]},"n1819790744":{"id":"n1819790744","loc":[-85.6210951,41.9610819]},"n1819790745":{"id":"n1819790745","loc":[-85.6220114,41.960544]},"n1819790755":{"id":"n1819790755","loc":[-85.6216369,41.9553854]},"n1819790757":{"id":"n1819790757","loc":[-85.6209986,41.9592709]},"n1819790758":{"id":"n1819790758","loc":[-85.6200437,41.9563468]},"n1819790764":{"id":"n1819790764","loc":[-85.6219363,41.9596823]},"n1819790765":{"id":"n1819790765","loc":[-85.6237612,41.9568496]},"n1819790769":{"id":"n1819790769","loc":[-85.6212389,41.9593433]},"n1819790771":{"id":"n1819790771","loc":[-85.6210726,41.9560123]},"n1819790772":{"id":"n1819790772","loc":[-85.6212711,41.9561838]},"n1819790776":{"id":"n1819790776","loc":[-85.6234437,41.9577795]},"n1819790777":{"id":"n1819790777","loc":[-85.6212502,41.9618599]},"n1819790783":{"id":"n1819790783","loc":[-85.6216895,41.9610585]},"n1819790784":{"id":"n1819790784","loc":[-85.6200115,41.9556367]},"n1819790785":{"id":"n1819790785","loc":[-85.6210576,41.9573002]},"n1819790786":{"id":"n1819790786","loc":[-85.621138,41.9576632]},"n1819790788":{"id":"n1819790788","loc":[-85.6207733,41.9578946]},"n1819790789":{"id":"n1819790789","loc":[-85.6200705,41.9571566]},"n1819790790":{"id":"n1819790790","loc":[-85.6245337,41.9558443]},"n1819790792":{"id":"n1819790792","loc":[-85.621932,41.9608066]},"n1819790793":{"id":"n1819790793","loc":[-85.6233578,41.9581385]},"n1819790794":{"id":"n1819790794","loc":[-85.6204557,41.9555136]},"n1819790797":{"id":"n1819790797","loc":[-85.6235038,41.9576074]},"n1819790800":{"id":"n1819790800","loc":[-85.6214438,41.9607508]},"n1819790801":{"id":"n1819790801","loc":[-85.623492,41.9602129]},"n1819790802":{"id":"n1819790802","loc":[-85.6216691,41.9546553]},"n1819790803":{"id":"n1819790803","loc":[-85.6231057,41.9586851]},"n1819790804":{"id":"n1819790804","loc":[-85.6209224,41.9578673]},"n1819790813":{"id":"n1819790813","loc":[-85.620092,41.9572962]},"n1819790814":{"id":"n1819790814","loc":[-85.6216691,41.9552218]},"n1819790816":{"id":"n1819790816","loc":[-85.6216144,41.9609668]},"n1819790818":{"id":"n1819790818","loc":[-85.6216906,41.9557324]},"n1819790820":{"id":"n1819790820","loc":[-85.6192069,41.9564186]},"n1819790823":{"id":"n1819790823","loc":[-85.6211155,41.9566027]},"n1819790825":{"id":"n1819790825","loc":[-85.6233106,41.9569294]},"n1819790839":{"id":"n1819790839","loc":[-85.625671,41.9564986]},"n1819790842":{"id":"n1819790842","loc":[-85.6235252,41.9567379]},"n1819790844":{"id":"n1819790844","loc":[-85.6253813,41.9566342]},"n1819790847":{"id":"n1819790847","loc":[-85.6200963,41.9567702]},"n1819790849":{"id":"n1819790849","loc":[-85.6238031,41.9587449]},"n1819790851":{"id":"n1819790851","loc":[-85.6234984,41.9584571]},"n1819790856":{"id":"n1819790856","loc":[-85.6242226,41.9570092]},"n1819790865":{"id":"n1819790865","loc":[-85.6200265,41.9569458]},"n1819790869":{"id":"n1819790869","loc":[-85.6230049,41.9601245]},"n1819790871":{"id":"n1819790871","loc":[-85.6190727,41.9558322]},"n1819790873":{"id":"n1819790873","loc":[-85.6217442,41.9550104]},"n1819790875":{"id":"n1819790875","loc":[-85.6208044,41.9587808]},"n1819790879":{"id":"n1819790879","loc":[-85.6198444,41.9574484]},"n1819790883":{"id":"n1819790883","loc":[-85.623713,41.9588719]},"n1819790885":{"id":"n1819790885","loc":[-85.6223289,41.9605075]},"n1819790889":{"id":"n1819790889","loc":[-85.6208044,41.9562437]},"n1819790893":{"id":"n1819790893","loc":[-85.6218183,41.9559684]},"n1819790906":{"id":"n1819790906","loc":[-85.6214052,41.958697]},"n1819790913":{"id":"n1819790913","loc":[-85.6209981,41.9609957]},"n1819790917":{"id":"n1819790917","loc":[-85.6216208,41.9604436]},"n1819790919":{"id":"n1819790919","loc":[-85.6209406,41.9616373]},"n1819790920":{"id":"n1819790920","loc":[-85.6221948,41.9583334]},"n1819790922":{"id":"n1819790922","loc":[-85.6216681,41.9615292]},"n1819790924":{"id":"n1819790924","loc":[-85.6210147,41.9570489]},"n1819790929":{"id":"n1819790929","loc":[-85.6193678,41.955521]},"w17964707":{"id":"w17964707","tags":{"highway":"residential","name":"11th Ave"},"nodes":["n185960682","n185960684","n185960686","n185960688","n185960690"]},"w201484345":{"id":"w201484345","tags":{"bridge":"yes","highway":"residential","name":"E Hoffman St"},"nodes":["n185978791","n185978795"]},"w201484348":{"id":"w201484348","tags":{"highway":"residential","name":"E Hoffman St"},"nodes":["n185978795","n185978800","n185978803","n185978806","n185978808","n185978810","n185978811","n185978813","n185955747","n185978814","n185972054","n185978817"]},"w170843845":{"id":"w170843845","tags":{"landuse":"reservoir","name":"Hoffman Pond","natural":"water"},"nodes":["n1819790732","n1819790742","n1819790825","n1819790729","n1819790842","n1819790765","n1819790737","n1819790856","n1819790643","n1819790596","n1819790844","n1819790839","n1819849190","n1819790619","n1819790613","n1819790669","n1819790550","n1819790682","n1819790701","n1819790790","n1819790532","n1819790887","n1819790740","n1819790831","n1819790545","n1819790664","n1819790621","n1819790861","n1819790730","n1819790683","n1819790802","n1819790717","n1819790710","n1819790713","n1819790650","n1819790873","n1819790814","n1819790755","n1819790715","n1819790818","n1819790602","n1819790893","n1819790662","n1819790699","n1819790772","n1819790771","n1819790680","n1819790794","n1819790727","n1819790628","n1819790661","n1819790784","n1819790610","n1819790626","n1819790929","n1819790656","n1819790871","n1819790673","n1819790566","n1819790820","n1819790676","n1819790598","n1819790556","n1819790558","n1819790879","n1819790608","n1819790813","n1819790789","n1819790865","n1819790847","n1819790758","n1819790548","n1819790539","n1819790889","n1819790557","n1819790586","n1819790571","n1819790823","n1819790546","n1819790924","n1819790785","n1819790708","n1819790786","n1819790561","n1819790804","n1819790788","n1819790684","n1819790711","n1819790875","n1819790672","n1819790569","n1819790757","n1819790769","n1819790603","n1819790906","n1819790553","n1819790536","n1819790678","n1819790920","n1819790600","n1819790733","n1819790743","n1819790567","n1819790764","n1819790722","n1819790638","n1819790917","n1819790800","n1819790741","n1819790667","n1819790913","n1819790744","n1819790816","n1819790591","n1819790745","n1819790885","n1819790652","n1819790588","n1819790617","n1819790551","n1819790666","n1819790869","n1819790630","n1819790723","n1819790792","n1819790783","n1819790681","n1819790919","n1819790593","n1819790670","n1819790777","n1819790922","n1819790562","n1819790736","n1819790565","n1819790801","n1819790538","n1819790640","n1819790616","n1819790572","n1819790620","n1819790883","n1819790849","n1819790675","n1819790851","n1819790803","n1819790611","n1819790703","n1819790734","n1819790793","n1819790614","n1819790581","n1819790776","n1819790797","n1819790728","n1819790584","n1819790624","n1819790604","n1819790725","n1819790732"]},"w206805240":{"id":"w206805240","tags":{"waterway":"river"},"nodes":["n2168544738","n2168544739","n2168544740","n2168544741","n2168544742","n2168544743","n2168544744","n2168544745","n2168544746","n2168544747","n2168544748","n2168544749","n2168544750","n2168544751","n2168544752","n2168544753","n1819848944"]},"n394490429":{"id":"n394490429","loc":[-85.643883,41.954365]},"n185953421":{"id":"n185953421","loc":[-85.641876,41.954946]},"n185953417":{"id":"n185953417","loc":[-85.6418306,41.9551597]},"n185977233":{"id":"n185977233","loc":[-85.642987,41.95486]},"n185977232":{"id":"n185977232","loc":[-85.642894,41.9547842]},"n1475293244":{"id":"n1475293244","loc":[-85.63974,41.9521543]},"n1819848890":{"id":"n1819848890","loc":[-85.6410004,41.9552822]},"n1819848965":{"id":"n1819848965","loc":[-85.6409795,41.9553892]},"n2189015846":{"id":"n2189015846","loc":[-85.6420457,41.9549528]},"n2189015849":{"id":"n2189015849","loc":[-85.6425867,41.9551392]},"n2189015852":{"id":"n2189015852","loc":[-85.6426877,41.9549771]},"n2199109816":{"id":"n2199109816","loc":[-85.6399215,41.9540925]},"n2199109818":{"id":"n2199109818","loc":[-85.6399182,41.9538236]},"n2199109820":{"id":"n2199109820","loc":[-85.6402201,41.9538216]},"n2199109822":{"id":"n2199109822","loc":[-85.640222,41.9539771]},"n2199109825":{"id":"n2199109825","loc":[-85.6402904,41.9539766]},"n2199109827":{"id":"n2199109827","loc":[-85.6402918,41.95409]},"n2199109829":{"id":"n2199109829","loc":[-85.6395845,41.9544626]},"n2199109831":{"id":"n2199109831","loc":[-85.6395792,41.9540671]},"n2199109833":{"id":"n2199109833","loc":[-85.6397173,41.9540661]},"n2199109835":{"id":"n2199109835","loc":[-85.6397226,41.9544616]},"n2199109837":{"id":"n2199109837","loc":[-85.6399641,41.9545058]},"n2199109839":{"id":"n2199109839","loc":[-85.6399637,41.9541859]},"n2199109841":{"id":"n2199109841","loc":[-85.6401098,41.9541858]},"n2199109843":{"id":"n2199109843","loc":[-85.64011,41.9543272]},"n2199109845":{"id":"n2199109845","loc":[-85.6400783,41.9543273]},"n2199109847":{"id":"n2199109847","loc":[-85.6400785,41.9545058]},"n2199109853":{"id":"n2199109853","loc":[-85.6396184,41.9554049]},"n2199109855":{"id":"n2199109855","loc":[-85.6396825,41.9553713]},"n185949745":{"id":"n185949745","loc":[-85.6442727,41.9553112]},"n185949748":{"id":"n185949748","loc":[-85.6448804,41.9555238]},"n185949755":{"id":"n185949755","loc":[-85.6420011,41.9603536]},"n185949763":{"id":"n185949763","loc":[-85.6408843,41.9555822]},"n185949765":{"id":"n185949765","loc":[-85.6414548,41.9557751]},"n185952158":{"id":"n185952158","loc":[-85.640066,41.956854]},"n185952160":{"id":"n185952160","loc":[-85.639848,41.957229]},"n185952161":{"id":"n185952161","loc":[-85.6396089,41.9576192]},"n185952163":{"id":"n185952163","loc":[-85.63892,41.957957]},"n185953413":{"id":"n185953413","loc":[-85.64162,41.955475]},"n185971651":{"id":"n185971651","loc":[-85.6440766,41.9543462]},"n185977234":{"id":"n185977234","loc":[-85.645044,41.955581]},"n394490395":{"id":"n394490395","loc":[-85.657336,41.936762]},"n394490396":{"id":"n394490396","loc":[-85.653896,41.936978]},"n394490397":{"id":"n394490397","loc":[-85.653732,41.937386]},"n394490398":{"id":"n394490398","loc":[-85.65182,41.937378]},"n394490399":{"id":"n394490399","loc":[-85.651843,41.938445]},"n394490400":{"id":"n394490400","loc":[-85.652536,41.938447]},"n394490401":{"id":"n394490401","loc":[-85.652533,41.938901]},"n394490402":{"id":"n394490402","loc":[-85.652084,41.9389]},"n394490403":{"id":"n394490403","loc":[-85.6521,41.939627]},"n394490404":{"id":"n394490404","loc":[-85.652301,41.939628]},"n394490405":{"id":"n394490405","loc":[-85.652302,41.939755]},"n394490406":{"id":"n394490406","loc":[-85.652783,41.939747]},"n394490407":{"id":"n394490407","loc":[-85.652835,41.94112]},"n394490408":{"id":"n394490408","loc":[-85.651968,41.941123]},"n394490409":{"id":"n394490409","loc":[-85.651983,41.941969]},"n394490410":{"id":"n394490410","loc":[-85.652908,41.941961]},"n394490411":{"id":"n394490411","loc":[-85.65292,41.94278]},"n394490412":{"id":"n394490412","loc":[-85.651698,41.942816]},"n394490413":{"id":"n394490413","loc":[-85.651509,41.942823]},"n394490414":{"id":"n394490414","loc":[-85.651272,41.942837]},"n394490415":{"id":"n394490415","loc":[-85.651272,41.943325]},"n394490416":{"id":"n394490416","loc":[-85.65122,41.944053]},"n394490417":{"id":"n394490417","loc":[-85.651193,41.944449]},"n394490418":{"id":"n394490418","loc":[-85.651088,41.944969]},"n394490419":{"id":"n394490419","loc":[-85.650949,41.945554]},"n394490420":{"id":"n394490420","loc":[-85.650907,41.945719]},"n394490421":{"id":"n394490421","loc":[-85.650808,41.946016]},"n394490422":{"id":"n394490422","loc":[-85.650712,41.946516]},"n394490423":{"id":"n394490423","loc":[-85.650493,41.947166]},"n394490424":{"id":"n394490424","loc":[-85.650626,41.947213]},"n394490425":{"id":"n394490425","loc":[-85.650201,41.948109]},"n394490426":{"id":"n394490426","loc":[-85.649868,41.948797]},"n394490427":{"id":"n394490427","loc":[-85.649669,41.949161]},"n394490428":{"id":"n394490428","loc":[-85.64659,41.954067]},"n394490430":{"id":"n394490430","loc":[-85.644034,41.95444]},"n394490431":{"id":"n394490431","loc":[-85.644248,41.954507]},"n394490432":{"id":"n394490432","loc":[-85.64491,41.954481]},"n394490433":{"id":"n394490433","loc":[-85.645213,41.954433]},"n394490434":{"id":"n394490434","loc":[-85.645426,41.954477]},"n394490435":{"id":"n394490435","loc":[-85.6458,41.954704]},"n394490436":{"id":"n394490436","loc":[-85.64605,41.954804]},"n394490437":{"id":"n394490437","loc":[-85.646125,41.954817]},"n394490438":{"id":"n394490438","loc":[-85.646002,41.954997]},"n394490439":{"id":"n394490439","loc":[-85.645764,41.955366]},"n394490440":{"id":"n394490440","loc":[-85.645525,41.955734]},"n394490441":{"id":"n394490441","loc":[-85.64443,41.957424]},"n394490442":{"id":"n394490442","loc":[-85.641712,41.961723]},"n394490443":{"id":"n394490443","loc":[-85.640747,41.963246]},"n394490444":{"id":"n394490444","loc":[-85.637803,41.967894]},"n394490445":{"id":"n394490445","loc":[-85.637673,41.967861]},"n394490446":{"id":"n394490446","loc":[-85.636637,41.969275]},"n394490447":{"id":"n394490447","loc":[-85.634923,41.969269]},"n394490448":{"id":"n394490448","loc":[-85.634893,41.968537]},"n394490449":{"id":"n394490449","loc":[-85.634544,41.96927]},"n394490450":{"id":"n394490450","loc":[-85.630835,41.969274]},"n394490451":{"id":"n394490451","loc":[-85.630834,41.968348]},"n394490452":{"id":"n394490452","loc":[-85.630857,41.968179]},"n394490453":{"id":"n394490453","loc":[-85.630924,41.968044]},"n394490454":{"id":"n394490454","loc":[-85.631004,41.967925]},"n394490455":{"id":"n394490455","loc":[-85.631143,41.967811]},"n394490456":{"id":"n394490456","loc":[-85.631311,41.967736]},"n394490457":{"id":"n394490457","loc":[-85.631595,41.967693]},"n394490458":{"id":"n394490458","loc":[-85.63325,41.967702]},"n394490459":{"id":"n394490459","loc":[-85.633247,41.967021]},"n394490460":{"id":"n394490460","loc":[-85.634858,41.967021]},"n394490461":{"id":"n394490461","loc":[-85.634865,41.967711]},"n394490462":{"id":"n394490462","loc":[-85.634884,41.968231]},"n394490463":{"id":"n394490463","loc":[-85.636559,41.963867]},"n394490464":{"id":"n394490464","loc":[-85.634832,41.963866]},"n394490465":{"id":"n394490465","loc":[-85.63481,41.961899]},"n394490466":{"id":"n394490466","loc":[-85.637219,41.961842]},"n394490467":{"id":"n394490467","loc":[-85.637837,41.960019]},"n394490468":{"id":"n394490468","loc":[-85.637459,41.960022]},"n394490469":{"id":"n394490469","loc":[-85.635295,41.959987]},"n394490470":{"id":"n394490470","loc":[-85.634783,41.959979]},"n394490471":{"id":"n394490471","loc":[-85.634776,41.959834]},"n394490472":{"id":"n394490472","loc":[-85.634767,41.959009]},"n394490473":{"id":"n394490473","loc":[-85.634763,41.958292]},"n394490474":{"id":"n394490474","loc":[-85.633346,41.958287]},"n394490475":{"id":"n394490475","loc":[-85.632128,41.9583]},"n394490476":{"id":"n394490476","loc":[-85.631414,41.958318]},"n394490477":{"id":"n394490477","loc":[-85.63137,41.959033]},"n394490478":{"id":"n394490478","loc":[-85.631325,41.959753]},"n394490479":{"id":"n394490479","loc":[-85.631494,41.95977]},"n394490480":{"id":"n394490480","loc":[-85.631456,41.960673]},"n394490481":{"id":"n394490481","loc":[-85.631421,41.961494]},"n394490482":{"id":"n394490482","loc":[-85.631404,41.961887]},"n394490483":{"id":"n394490483","loc":[-85.631401,41.961968]},"n394490484":{"id":"n394490484","loc":[-85.630962,41.961967]},"n394490485":{"id":"n394490485","loc":[-85.6299,41.961973]},"n394490486":{"id":"n394490486","loc":[-85.624929,41.962002]},"n394490487":{"id":"n394490487","loc":[-85.623333,41.961987]},"n394490488":{"id":"n394490488","loc":[-85.621894,41.963956]},"n394490489":{"id":"n394490489","loc":[-85.62131,41.963727]},"n394490490":{"id":"n394490490","loc":[-85.621216,41.963868]},"n394490491":{"id":"n394490491","loc":[-85.620356,41.965119]},"n394490492":{"id":"n394490492","loc":[-85.620848,41.965341]},"n394490493":{"id":"n394490493","loc":[-85.620684,41.965558]},"n394490494":{"id":"n394490494","loc":[-85.620621,41.965658]},"n394490495":{"id":"n394490495","loc":[-85.618165,41.965759]},"n394490496":{"id":"n394490496","loc":[-85.618071,41.965759]},"n394490497":{"id":"n394490497","loc":[-85.617986,41.965759]},"n394490498":{"id":"n394490498","loc":[-85.605673,41.965764]},"n394490499":{"id":"n394490499","loc":[-85.605668,41.963548]},"n394490500":{"id":"n394490500","loc":[-85.605664,41.962094]},"n394490501":{"id":"n394490501","loc":[-85.595828,41.962159]},"n394490502":{"id":"n394490502","loc":[-85.587869,41.962169]},"n394490503":{"id":"n394490503","loc":[-85.586289,41.962179]},"n394490504":{"id":"n394490504","loc":[-85.583774,41.962178]},"n394490505":{"id":"n394490505","loc":[-85.583774,41.961789]},"n394490506":{"id":"n394490506","loc":[-85.581303,41.961783]},"n394490507":{"id":"n394490507","loc":[-85.581304,41.961616]},"n394490508":{"id":"n394490508","loc":[-85.581292,41.961616]},"n394490509":{"id":"n394490509","loc":[-85.581247,41.959244]},"n394490510":{"id":"n394490510","loc":[-85.581245,41.958394]},"n394490511":{"id":"n394490511","loc":[-85.581276,41.958372]},"n394490512":{"id":"n394490512","loc":[-85.581302,41.958353]},"n394490513":{"id":"n394490513","loc":[-85.581376,41.9583]},"n394490514":{"id":"n394490514","loc":[-85.582256,41.957663]},"n394490515":{"id":"n394490515","loc":[-85.585299,41.955483]},"n394490516":{"id":"n394490516","loc":[-85.585588,41.955331]},"n394490517":{"id":"n394490517","loc":[-85.586053,41.955163]},"n394490518":{"id":"n394490518","loc":[-85.58632,41.955076]},"n394490519":{"id":"n394490519","loc":[-85.586478,41.955025]},"n394490520":{"id":"n394490520","loc":[-85.58692,41.954947]},"n394490521":{"id":"n394490521","loc":[-85.587327,41.954914]},"n394490522":{"id":"n394490522","loc":[-85.587345,41.954913]},"n394490523":{"id":"n394490523","loc":[-85.587358,41.954913]},"n394490524":{"id":"n394490524","loc":[-85.58963,41.954877]},"n394490525":{"id":"n394490525","loc":[-85.591077,41.954865]},"n394490526":{"id":"n394490526","loc":[-85.594824,41.954843]},"n394490527":{"id":"n394490527","loc":[-85.594804,41.95331]},"n394490528":{"id":"n394490528","loc":[-85.599336,41.95331]},"n394490529":{"id":"n394490529","loc":[-85.599336,41.954825]},"n394490530":{"id":"n394490530","loc":[-85.597828,41.954839]},"n394490531":{"id":"n394490531","loc":[-85.597833,41.95614]},"n394490532":{"id":"n394490532","loc":[-85.596586,41.956151]},"n394490533":{"id":"n394490533","loc":[-85.596586,41.956394]},"n394490534":{"id":"n394490534","loc":[-85.595933,41.956394]},"n394490535":{"id":"n394490535","loc":[-85.595933,41.958176]},"n394490536":{"id":"n394490536","loc":[-85.597635,41.958179]},"n394490537":{"id":"n394490537","loc":[-85.597717,41.958177]},"n394490538":{"id":"n394490538","loc":[-85.601671,41.958194]},"n394490539":{"id":"n394490539","loc":[-85.605619,41.958194]},"n394490540":{"id":"n394490540","loc":[-85.608054,41.958187]},"n394490542":{"id":"n394490542","loc":[-85.6080762,41.9547864]},"n394490545":{"id":"n394490545","loc":[-85.6104354,41.9548263]},"n394490546":{"id":"n394490546","loc":[-85.610274,41.951106]},"n394490547":{"id":"n394490547","loc":[-85.610278,41.950829]},"n394490548":{"id":"n394490548","loc":[-85.610309,41.948377]},"n394490549":{"id":"n394490549","loc":[-85.610314,41.947986]},"n394490550":{"id":"n394490550","loc":[-85.610464,41.947985]},"n394490551":{"id":"n394490551","loc":[-85.610447,41.947468]},"n394490552":{"id":"n394490552","loc":[-85.612469,41.947471]},"n394490553":{"id":"n394490553","loc":[-85.612494,41.945576]},"n394490554":{"id":"n394490554","loc":[-85.610292,41.94558]},"n394490555":{"id":"n394490555","loc":[-85.608412,41.945625]},"n394490556":{"id":"n394490556","loc":[-85.608412,41.943036]},"n394490557":{"id":"n394490557","loc":[-85.608702,41.943087]},"n394490558":{"id":"n394490558","loc":[-85.609196,41.943224]},"n394490559":{"id":"n394490559","loc":[-85.609571,41.943263]},"n394490560":{"id":"n394490560","loc":[-85.610116,41.943295]},"n394490561":{"id":"n394490561","loc":[-85.610273,41.943275]},"n394490562":{"id":"n394490562","loc":[-85.611339,41.943075]},"n394490563":{"id":"n394490563","loc":[-85.611575,41.942997]},"n394490564":{"id":"n394490564","loc":[-85.611847,41.942849]},"n394490565":{"id":"n394490565","loc":[-85.612164,41.942568]},"n394490566":{"id":"n394490566","loc":[-85.612341,41.942529]},"n394490567":{"id":"n394490567","loc":[-85.612562,41.942524]},"n394490568":{"id":"n394490568","loc":[-85.612768,41.942546]},"n394490569":{"id":"n394490569","loc":[-85.612938,41.942633]},"n394490570":{"id":"n394490570","loc":[-85.6131,41.942782]},"n394490571":{"id":"n394490571","loc":[-85.613299,41.942919]},"n394490572":{"id":"n394490572","loc":[-85.613498,41.942996]},"n394490573":{"id":"n394490573","loc":[-85.614698,41.942842]},"n394490574":{"id":"n394490574","loc":[-85.615288,41.942698]},"n394490575":{"id":"n394490575","loc":[-85.616054,41.942693]},"n394490576":{"id":"n394490576","loc":[-85.61603,41.942175]},"n394490577":{"id":"n394490577","loc":[-85.616004,41.941741]},"n394490578":{"id":"n394490578","loc":[-85.615994,41.940156]},"n394490579":{"id":"n394490579","loc":[-85.615144,41.940159]},"n394490580":{"id":"n394490580","loc":[-85.614915,41.940161]},"n394490582":{"id":"n394490582","loc":[-85.614875,41.938532]},"n394490583":{"id":"n394490583","loc":[-85.616167,41.938787]},"n394490585":{"id":"n394490585","loc":[-85.616176,41.938589]},"n394490586":{"id":"n394490586","loc":[-85.614537,41.938282]},"n394490588":{"id":"n394490588","loc":[-85.610141,41.937459]},"n394490589":{"id":"n394490589","loc":[-85.610172,41.937298]},"n394490590":{"id":"n394490590","loc":[-85.609918,41.935495]},"n394490592":{"id":"n394490592","loc":[-85.610092,41.935451]},"n394490594":{"id":"n394490594","loc":[-85.610681,41.935247]},"n394490595":{"id":"n394490595","loc":[-85.611446,41.934955]},"n394490596":{"id":"n394490596","loc":[-85.612057,41.934696]},"n394490598":{"id":"n394490598","loc":[-85.613256,41.934084]},"n394490599":{"id":"n394490599","loc":[-85.613948,41.933682]},"n394490601":{"id":"n394490601","loc":[-85.61436,41.933417]},"n394490602":{"id":"n394490602","loc":[-85.614638,41.933212]},"n394490604":{"id":"n394490604","loc":[-85.615249,41.9332]},"n394490605":{"id":"n394490605","loc":[-85.618218,41.933223]},"n394490607":{"id":"n394490607","loc":[-85.618241,41.933479]},"n394490608":{"id":"n394490608","loc":[-85.618257,41.93365]},"n394490609":{"id":"n394490609","loc":[-85.618298,41.935067]},"n394490611":{"id":"n394490611","loc":[-85.619791,41.935067]},"n394490612":{"id":"n394490612","loc":[-85.619794,41.933301]},"n394490613":{"id":"n394490613","loc":[-85.619795,41.932692]},"n394490614":{"id":"n394490614","loc":[-85.619729,41.929517]},"n394490615":{"id":"n394490615","loc":[-85.619801,41.929305]},"n394490616":{"id":"n394490616","loc":[-85.619809,41.927391]},"n394490617":{"id":"n394490617","loc":[-85.620883,41.927378]},"n394490618":{"id":"n394490618","loc":[-85.620988,41.927368]},"n394490619":{"id":"n394490619","loc":[-85.621076,41.927368]},"n394490620":{"id":"n394490620","loc":[-85.621156,41.927376]},"n394490621":{"id":"n394490621","loc":[-85.621685,41.92737]},"n394490622":{"id":"n394490622","loc":[-85.624716,41.927359]},"n394490623":{"id":"n394490623","loc":[-85.625308,41.92737]},"n394490624":{"id":"n394490624","loc":[-85.625655,41.927377]},"n394490625":{"id":"n394490625","loc":[-85.625093,41.925591]},"n394490626":{"id":"n394490626","loc":[-85.625174,41.92559]},"n394490627":{"id":"n394490627","loc":[-85.625249,41.925597]},"n394490628":{"id":"n394490628","loc":[-85.625532,41.925604]},"n394490629":{"id":"n394490629","loc":[-85.625761,41.925597]},"n394490630":{"id":"n394490630","loc":[-85.625955,41.926153]},"n394490631":{"id":"n394490631","loc":[-85.626209,41.926155]},"n394490632":{"id":"n394490632","loc":[-85.627757,41.926151]},"n394490633":{"id":"n394490633","loc":[-85.627825,41.926298]},"n394490634":{"id":"n394490634","loc":[-85.627994,41.926315]},"n394490635":{"id":"n394490635","loc":[-85.628049,41.927196]},"n394490636":{"id":"n394490636","loc":[-85.62949,41.927221]},"n394490637":{"id":"n394490637","loc":[-85.629602,41.927277]},"n394490638":{"id":"n394490638","loc":[-85.6297102,41.9273279]},"n394490639":{"id":"n394490639","loc":[-85.630958,41.927398]},"n394490699":{"id":"n394490699","loc":[-85.632741,41.927388]},"n394490700":{"id":"n394490700","loc":[-85.632997,41.927391]},"n394490701":{"id":"n394490701","loc":[-85.633149,41.927393]},"n394490702":{"id":"n394490702","loc":[-85.633334,41.927393]},"n394490703":{"id":"n394490703","loc":[-85.633468,41.927561]},"n394490704":{"id":"n394490704","loc":[-85.633563,41.927755]},"n394490705":{"id":"n394490705","loc":[-85.633662,41.928192]},"n394490706":{"id":"n394490706","loc":[-85.633679,41.928807]},"n394490707":{"id":"n394490707","loc":[-85.633687,41.929107]},"n394490708":{"id":"n394490708","loc":[-85.633927,41.929109]},"n394490709":{"id":"n394490709","loc":[-85.634126,41.929111]},"n394490710":{"id":"n394490710","loc":[-85.634207,41.92911]},"n394490711":{"id":"n394490711","loc":[-85.634323,41.929111]},"n394490712":{"id":"n394490712","loc":[-85.636712,41.929128]},"n394490713":{"id":"n394490713","loc":[-85.63808,41.9291]},"n394490714":{"id":"n394490714","loc":[-85.639213,41.929088]},"n394490715":{"id":"n394490715","loc":[-85.639189,41.92852]},"n394490716":{"id":"n394490716","loc":[-85.639204,41.925488]},"n394490717":{"id":"n394490717","loc":[-85.644204,41.925452]},"n394490718":{"id":"n394490718","loc":[-85.651425,41.925406]},"n394490719":{"id":"n394490719","loc":[-85.651449,41.926321]},"n394490720":{"id":"n394490720","loc":[-85.651451,41.926969]},"n394490721":{"id":"n394490721","loc":[-85.651458,41.928052]},"n394490722":{"id":"n394490722","loc":[-85.651446,41.928892]},"n394490723":{"id":"n394490723","loc":[-85.651456,41.929447]},"n394490724":{"id":"n394490724","loc":[-85.651707,41.929454]},"n394490725":{"id":"n394490725","loc":[-85.652369,41.929473]},"n394490726":{"id":"n394490726","loc":[-85.6525,41.929452]},"n394490727":{"id":"n394490727","loc":[-85.654066,41.92946]},"n394490728":{"id":"n394490728","loc":[-85.654816,41.92946]},"n394490729":{"id":"n394490729","loc":[-85.654816,41.930337]},"n394490730":{"id":"n394490730","loc":[-85.654587,41.930337]},"n394490731":{"id":"n394490731","loc":[-85.654548,41.931072]},"n394490732":{"id":"n394490732","loc":[-85.654538,41.931701]},"n394490733":{"id":"n394490733","loc":[-85.654898,41.931689]},"n394490734":{"id":"n394490734","loc":[-85.654898,41.932505]},"n394490735":{"id":"n394490735","loc":[-85.654854,41.932514]},"n394490736":{"id":"n394490736","loc":[-85.655497,41.932499]},"n394490737":{"id":"n394490737","loc":[-85.656405,41.932493]},"n394490738":{"id":"n394490738","loc":[-85.656422,41.933416]},"n394490739":{"id":"n394490739","loc":[-85.657322,41.933438]},"n1475293233":{"id":"n1475293233","loc":[-85.6385522,41.9585167]},"n1475293242":{"id":"n1475293242","loc":[-85.64609,41.9540815]},"n1475293249":{"id":"n1475293249","loc":[-85.6358079,41.9692721]},"n1475293256":{"id":"n1475293256","loc":[-85.6387369,41.9581583]},"n1475293259":{"id":"n1475293259","loc":[-85.6455882,41.9541138]},"n1475293266":{"id":"n1475293266","loc":[-85.6451008,41.9541821]},"n1819800253":{"id":"n1819800253","loc":[-85.6134286,41.9429692]},"n2114807558":{"id":"n2114807558","loc":[-85.6365609,41.963866],"tags":{"railway":"level_crossing"}},"n2189015728":{"id":"n2189015728","loc":[-85.6383956,41.9590576]},"n2189015838":{"id":"n2189015838","loc":[-85.6435144,41.9563705]},"n2189015842":{"id":"n2189015842","loc":[-85.6415782,41.9557035]},"n2189015855":{"id":"n2189015855","loc":[-85.6440829,41.9554577]},"n2199109849":{"id":"n2199109849","loc":[-85.6393434,41.9565591]},"n2199109851":{"id":"n2199109851","loc":[-85.6393208,41.9565002]},"n2199109857":{"id":"n2199109857","loc":[-85.6401986,41.955545]},"n2199109859":{"id":"n2199109859","loc":[-85.6402362,41.955587]},"n2199109861":{"id":"n2199109861","loc":[-85.6395958,41.9565675]},"n2199109863":{"id":"n2199109863","loc":[-85.639528,41.9566011]},"w209717053":{"id":"w209717053","tags":{"area":"yes","building":"yes"},"nodes":["n2199109829","n2199109831","n2199109833","n2199109835","n2199109829"]},"w17966415":{"id":"w17966415","tags":{"access":"private","highway":"service","name":"Manufacturing Way"},"nodes":["n185971642","n185977232","n185977233","n185949745","n185949748","n185977234"]},"w209717054":{"id":"w209717054","tags":{"area":"yes","building":"yes"},"nodes":["n2199109837","n2199109839","n2199109841","n2199109843","n2199109845","n2199109847","n2199109837"]},"w208627214":{"id":"w208627214","tags":{"highway":"service"},"nodes":["n185949755","n2189015728","n1475293233","n1475293256","n185952163","n185952161","n185952160","n185952158","n185949763","n1819848965","n1819848890","n185952156"]},"w17963817":{"id":"w17963817","tags":{"access":"private","highway":"service"},"nodes":["n185949765","n185953413","n185953417","n185953421","n185953423"]},"w34369809":{"id":"w34369809","tags":{"admin_level":"8","boundary":"administrative","landuse":"residential"},"nodes":["n394490395","n394490396","n394490397","n394490398","n394490399","n394490400","n394490401","n394490402","n394490403","n394490404","n394490405","n394490406","n394490407","n394490408","n394490409","n394490410","n394490411","n394490412","n394490413","n394490414","n394490415","n394490416","n394490417","n394490418","n394490419","n394490420","n394490421","n394490422","n394490423","n394490424","n394490425","n394490426","n394490427","n394490428","n1475293242","n1475293259","n1475293266","n394490429","n394490430","n394490431","n394490432","n394490433","n394490434","n394490435","n394490436","n394490437","n394490438","n394490439","n394490440","n394490441","n394490442","n394490443","n394490444","n394490445","n394490446","n1475293249","n394490447","n394490448","n394490449","n394490450","n394490451","n394490452","n394490453","n394490454","n394490455","n394490456","n394490457","n394490458","n394490459","n394490460","n394490461","n394490462","n2114807558","n394490463","n1475293226","n394490464","n394490465","n394490466","n394490467","n394490468","n394490469","n394490470","n394490471","n394490472","n394490473","n394490474","n394490475","n394490476","n394490477","n394490478","n394490479","n394490480","n394490481","n394490482","n394490483","n394490484","n394490485","n394490486","n394490487","n394490488","n394490489","n394490490","n394490491","n394490492","n394490493","n394490494","n394490495","n394490496","n394490497","n394490498","n394490499","n394490500","n394490501","n394490502","n394490503","n394490504","n394490505","n394490506","n394490507","n394490508","n394490509","n394490510","n394490511","n394490512","n394490513","n394490514","n394490515","n394490516","n394490517","n394490518","n394490519","n394490520","n394490521","n394490522","n394490523","n394490524","n394490525","n394490526","n394490527","n394490528","n394490529","n394490530","n394490531","n394490532","n394490533","n394490534","n394490535","n394490536","n394490537","n394490538","n394490539","n394490540","n394490542","n394490545","n394490546","n394490547","n394490548","n394490549","n394490550","n394490551","n394490552","n394490553","n394490554","n394490555","n394490556","n394490557","n394490558","n394490559","n394490560","n394490561","n394490562","n394490563","n394490564","n394490565","n394490566","n394490567","n394490568","n394490569","n394490570","n394490571","n1819800253","n394490572","n394490573","n394490574","n394490575","n394490576","n394490577","n394490578","n394490579","n394490580","n394490582","n394490583","n394490585","n394490586","n394490588","n394490589","n394490590","n394490592","n394490594","n394490595","n394490596","n394490598","n394490599","n394490601","n394490602","n394490604","n394490605","n394490607","n394490608","n394490609","n394490611","n394490612","n394490613","n394490614","n394490615","n394490616","n394490617","n394490618","n394490619","n394490620","n394490621","n394490622","n394490623","n394490624","n394490625","n394490626","n394490627","n394490628","n394490629","n394490630","n394490631","n394490632","n394490633","n394490634","n394490635","n394490636","n394490637","n394490638","n394490639","n394490699","n394490700","n394490701","n394490702","n394490703","n394490704","n394490705","n394490706","n394490707","n394490708","n394490709","n394490710","n394490711","n394490712","n394490713","n394490714","n394490715","n394490716","n394490717","n394490718","n394490719","n394490720","n394490721","n394490722","n394490723","n394490724","n394490725","n394490726","n394490727","n394490728","n394490729","n394490730","n394490731","n394490732","n394490733","n394490734","n394490735","n394490736","n394490737","n394490738","n394490739","n394490395"]},"w208627221":{"id":"w208627221","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189015838","n2189015842","n2189015846","n2189015849","n2189015852","n2189015855","n2189015838"]},"w209717052":{"id":"w209717052","tags":{"area":"yes","building":"yes"},"nodes":["n2199109816","n2199109818","n2199109820","n2199109822","n2199109825","n2199109827","n2199109816"]},"w134151784":{"id":"w134151784","tags":{"bridge":"yes","highway":"residential","name":"W Hoffman St"},"nodes":["n185971648","n185971651"]},"w209717055":{"id":"w209717055","tags":{"area":"yes","landuse":"basin"},"nodes":["n2199109849","n2199109851","n2199109853","n2199109855","n2199109857","n2199109859","n2199109861","n2199109863","n2199109849"]},"w17967763":{"id":"w17967763","tags":{"highway":"residential","name":"Rock River Ave"},"nodes":["n1475293244","n185982166","n185975067","n185971637"]},"r134949":{"id":"r134949","tags":{"admin_level":"8","border_type":"city","boundary":"administrative","name":"Three Rivers","place":"city","type":"boundary"},"members":[{"id":"w34369809","type":"way","role":"outer"},{"id":"w34369821","type":"way","role":"outer"},{"id":"w34369822","type":"way","role":"outer"},{"id":"w34369823","type":"way","role":"outer"},{"id":"w34369824","type":"way","role":"outer"},{"id":"w34369825","type":"way","role":"outer"},{"id":"w34369826","type":"way","role":"outer"},{"id":"w34369810","type":"way","role":"inner"},{"id":"w34369811","type":"way","role":"inner"},{"id":"w34369812","type":"way","role":"inner"},{"id":"w34367079","type":"way","role":"inner"},{"id":"w34369814","type":"way","role":"inner"},{"id":"w34367080","type":"way","role":"inner"},{"id":"w34369815","type":"way","role":"inner"},{"id":"w34369820","type":"way","role":"inner"}]},"n1819848881":{"id":"n1819848881","loc":[-85.638562,41.9569965]},"n1819848947":{"id":"n1819848947","loc":[-85.6384348,41.9576565]},"n1819849044":{"id":"n1819849044","loc":[-85.6385749,41.9573345]},"n2114807547":{"id":"n2114807547","loc":[-85.6384626,41.9583756]},"n2114807564":{"id":"n2114807564","loc":[-85.638535,41.9581283]},"n2189015691":{"id":"n2189015691","loc":[-85.6435584,41.9565243]},"n2189015696":{"id":"n2189015696","loc":[-85.6435805,41.9566049]},"n2189015722":{"id":"n2189015722","loc":[-85.6435035,41.9567438]},"n2189015744":{"id":"n2189015744","loc":[-85.6437991,41.9569582]},"n2189015747":{"id":"n2189015747","loc":[-85.6433042,41.9567742]},"n2189015750":{"id":"n2189015750","loc":[-85.6433827,41.9566844]},"n2189015753":{"id":"n2189015753","loc":[-85.6430447,41.9565588]},"n2189015756":{"id":"n2189015756","loc":[-85.6431111,41.956451]},"n2189015759":{"id":"n2189015759","loc":[-85.6420247,41.956083]},"n2189015760":{"id":"n2189015760","loc":[-85.6419945,41.9561369]},"n2189015764":{"id":"n2189015764","loc":[-85.6413729,41.9558945]},"n2189015766":{"id":"n2189015766","loc":[-85.6412884,41.9560606]},"n2189015770":{"id":"n2189015770","loc":[-85.6411798,41.9560112]},"n2189015771":{"id":"n2189015771","loc":[-85.6410651,41.9562132]},"n2189015774":{"id":"n2189015774","loc":[-85.6409504,41.9561728]},"n2189015778":{"id":"n2189015778","loc":[-85.6407996,41.9564241]},"n2189015781":{"id":"n2189015781","loc":[-85.6406889,41.9563892]},"n2189015785":{"id":"n2189015785","loc":[-85.6404857,41.9567024]},"n2189015789":{"id":"n2189015789","loc":[-85.6406909,41.9567877]},"n2189015793":{"id":"n2189015793","loc":[-85.6405642,41.9570165]},"n2189015796":{"id":"n2189015796","loc":[-85.6415359,41.9573711]},"n2189015800":{"id":"n2189015800","loc":[-85.6411738,41.9579501]},"n2189015804":{"id":"n2189015804","loc":[-85.6411119,41.957921]},"n2189015808":{"id":"n2189015808","loc":[-85.6403186,41.9591751]},"n2189015909":{"id":"n2189015909","loc":[-85.6389293,41.9564636]},"n2189015926":{"id":"n2189015926","loc":[-85.6385431,41.9564617]},"n2189015929":{"id":"n2189015929","loc":[-85.6385457,41.9561823]},"n2189015932":{"id":"n2189015932","loc":[-85.6389319,41.9561843]},"n2199109865":{"id":"n2199109865","loc":[-85.6400768,41.956776]},"n2199109867":{"id":"n2199109867","loc":[-85.639902,41.9567153]},"n2199109869":{"id":"n2199109869","loc":[-85.640004,41.956553]},"n2199109871":{"id":"n2199109871","loc":[-85.6401788,41.9566137]},"n2199109873":{"id":"n2199109873","loc":[-85.6399316,41.9564506],"tags":{"man_made":"water_tower"}},"n2199109876":{"id":"n2199109876","loc":[-85.6397689,41.9572354]},"n2199109878":{"id":"n2199109878","loc":[-85.6399229,41.9569826]},"n2199109880":{"id":"n2199109880","loc":[-85.639706,41.9569095]},"n2199109882":{"id":"n2199109882","loc":[-85.639552,41.9571623]},"n2199109884":{"id":"n2199109884","loc":[-85.6391028,41.9569517]},"n2199109886":{"id":"n2199109886","loc":[-85.6392876,41.956646]},"n2199109888":{"id":"n2199109888","loc":[-85.639484,41.9567117]},"n2199109889":{"id":"n2199109889","loc":[-85.6394322,41.9567973]},"n2199109890":{"id":"n2199109890","loc":[-85.6393718,41.9567771]},"n2199109891":{"id":"n2199109891","loc":[-85.6392387,41.9569972]},"n1819848900":{"id":"n1819848900","loc":[-85.638281,41.9576578]},"n1819848978":{"id":"n1819848978","loc":[-85.6377186,41.9580867]},"n1819849039":{"id":"n1819849039","loc":[-85.6384217,41.9573405]},"n1819849050":{"id":"n1819849050","loc":[-85.6377011,41.9570042]},"n1819849088":{"id":"n1819849088","loc":[-85.6382879,41.9580817]},"n2114807549":{"id":"n2114807549","loc":[-85.6362551,41.96473]},"n2114807587":{"id":"n2114807587","loc":[-85.6368694,41.9629829]},"n2189015725":{"id":"n2189015725","loc":[-85.644156,41.9569753]},"n2189015741":{"id":"n2189015741","loc":[-85.6419825,41.9597632]},"w208627217":{"id":"w208627217","tags":{"area":"yes","building":"yes"},"nodes":["n2189015741","n2189015744","n2189015747","n2189015750","n2189015753","n2189015756","n2189015759","n2189015760","n2189015764","n2189015766","n2189015770","n2189015771","n2189015774","n2189015778","n2189015781","n2189015785","n2189015789","n2189015793","n2189015796","n2189015800","n2189015804","n2189015808","n2189015741"]},"w208627212":{"id":"w208627212","tags":{"highway":"service"},"nodes":["n2189015691","n2189015696","n2189015722","n2189015725"]},"w209717057":{"id":"w209717057","tags":{"area":"yes","building":"yes"},"nodes":["n2199109876","n2199109878","n2199109880","n2199109882","n2199109876"]},"w209717056":{"id":"w209717056","tags":{"area":"yes","building":"yes"},"nodes":["n2199109865","n2199109867","n2199109869","n2199109871","n2199109865"]},"w208627231":{"id":"w208627231","tags":{"area":"yes","building":"yes"},"nodes":["n2189015909","n2189015926","n2189015929","n2189015932","n2189015909"]},"w170848326":{"id":"w170848326","tags":{"building":"yes"},"nodes":["n1819848881","n1819849050","n1819848978","n1819849088","n1819848900","n1819848947","n1819849039","n1819849044","n1819848881"]},"w17963182":{"id":"w17963182","tags":{"highway":"service"},"nodes":["n185949763","n185949765","n2189015691","n185949745"]},"w201484340":{"id":"w201484340","tags":{"railway":"rail","service":"siding"},"nodes":["n2114807565","n2114807564","n2114807547","n2114807587","n2114807558","n2114807549","n2114807593"]},"w209717058":{"id":"w209717058","tags":{"area":"yes","building":"yes"},"nodes":["n2199109884","n2199109886","n2199109888","n2199109889","n2199109890","n2199109891","n2199109884"]},"n185954650":{"id":"n185954650","loc":[-85.627331,41.957439]},"n185966949":{"id":"n185966949","loc":[-85.626868,41.957314]},"n185989335":{"id":"n185989335","loc":[-85.62529,41.958568]},"n185989337":{"id":"n185989337","loc":[-85.624962,41.958453]},"n185989339":{"id":"n185989339","loc":[-85.624832,41.958399]},"n185989340":{"id":"n185989340","loc":[-85.624707,41.958325]},"n185989342":{"id":"n185989342","loc":[-85.624636,41.958251]},"n185989345":{"id":"n185989345","loc":[-85.624578,41.95818]},"n185989347":{"id":"n185989347","loc":[-85.624533,41.958099]},"n185989349":{"id":"n185989349","loc":[-85.624507,41.957985]},"n185989351":{"id":"n185989351","loc":[-85.624495,41.957807]},"n185989353":{"id":"n185989353","loc":[-85.624514,41.957663]},"n185989354":{"id":"n185989354","loc":[-85.624577,41.957593]},"n185989356":{"id":"n185989356","loc":[-85.624685,41.95754]},"n185989357":{"id":"n185989357","loc":[-85.624802,41.957523]},"n185989359":{"id":"n185989359","loc":[-85.624996,41.957524]},"n185989361":{"id":"n185989361","loc":[-85.625409,41.957515]},"n185989364":{"id":"n185989364","loc":[-85.625634,41.957496]},"n185989367":{"id":"n185989367","loc":[-85.625832,41.957453]},"n185989368":{"id":"n185989368","loc":[-85.626044,41.957394]},"n354031352":{"id":"n354031352","loc":[-85.6252778,41.9586111],"tags":{"amenity":"place_of_worship","denomination":"baptist","name":"First Baptist Church","religion":"christian"}},"n2199109892":{"id":"n2199109892","loc":[-85.6261578,41.9589963]},"n2199109893":{"id":"n2199109893","loc":[-85.6263191,41.9586865]},"n2199109894":{"id":"n2199109894","loc":[-85.6261186,41.9586288]},"n2199109895":{"id":"n2199109895","loc":[-85.6260644,41.9587329]},"n2199109896":{"id":"n2199109896","loc":[-85.6261547,41.9587589]},"n2199109898":{"id":"n2199109898","loc":[-85.6260476,41.9589646]},"n185966951":{"id":"n185966951","loc":[-85.628404,41.957438]},"w17965351":{"id":"w17965351","tags":{"highway":"residential","name":"Flower Street"},"nodes":["n185966948","n185966949","n185954650","n185966951","n185966953","n185966955","n185966957"]},"w17967809":{"id":"w17967809","tags":{"highway":"residential","name":"Azaleamum Drive"},"nodes":["n185982197","n185989335","n185989337","n185989339","n185989340","n185989342","n185989345","n185989347","n185989349","n185989351","n185989353","n185989354","n185989356","n185989357","n185989359","n185989361","n185989364","n185989367","n185989368","n185982196"]},"w209717059":{"id":"w209717059","tags":{"area":"yes","building":"yes"},"nodes":["n2199109892","n2199109893","n2199109894","n2199109895","n2199109896","n2199109898","n2199109892"]},"n185961390":{"id":"n185961390","loc":[-85.63137,41.959033]},"n185961393":{"id":"n185961393","loc":[-85.634315,41.959017]},"w17966214":{"id":"w17966214","tags":{"highway":"residential","name":"East Adams Street"},"nodes":["n185975351","n185967434","n185968108"]},"w17964793":{"id":"w17964793","tags":{"highway":"residential","name":"Morris Ave"},"nodes":["n185961389","n185961390","n185961391","n185961393","n185961396"]},"n185952166":{"id":"n185952166","loc":[-85.638174,41.95831]},"n2114807552":{"id":"n2114807552","loc":[-85.6383526,41.9593788]},"n2114807591":{"id":"n2114807591","loc":[-85.6383741,41.9593968]},"n2189015731":{"id":"n2189015731","loc":[-85.6368404,41.9592785]},"n2189015734":{"id":"n2189015734","loc":[-85.6368404,41.9585918]},"n2189015737":{"id":"n2189015737","loc":[-85.6376009,41.9585918]},"n2189015738":{"id":"n2189015738","loc":[-85.6376009,41.9592785]},"n2189015897":{"id":"n2189015897","loc":[-85.6376839,41.9566137]},"n2189015900":{"id":"n2189015900","loc":[-85.6376831,41.9564865]},"n2189015903":{"id":"n2189015903","loc":[-85.6381161,41.9564851]},"n2189015906":{"id":"n2189015906","loc":[-85.6381168,41.9566122]},"n2189015937":{"id":"n2189015937","loc":[-85.6364789,41.9590634]},"n2189015940":{"id":"n2189015940","loc":[-85.6361137,41.9590672]},"n2189015943":{"id":"n2189015943","loc":[-85.6361169,41.9594033]},"n2189015945":{"id":"n2189015945","loc":[-85.6363456,41.9594021]},"n2189015952":{"id":"n2189015952","loc":[-85.636112,41.958892]},"n2189015955":{"id":"n2189015955","loc":[-85.6364757,41.9588894]},"n2189015957":{"id":"n2189015957","loc":[-85.6364729,41.9586747]},"n2189015958":{"id":"n2189015958","loc":[-85.6361103,41.9586765]},"n2189015959":{"id":"n2189015959","loc":[-85.6364719,41.9585562]},"n2189015960":{"id":"n2189015960","loc":[-85.6361093,41.958558]},"n2189015961":{"id":"n2189015961","loc":[-85.6355494,41.9586403]},"n2189015962":{"id":"n2189015962","loc":[-85.635549,41.9584711]},"n2189015963":{"id":"n2189015963","loc":[-85.6351831,41.9584715]},"n2189015964":{"id":"n2189015964","loc":[-85.6351834,41.9586408]},"n2189015966":{"id":"n2189015966","loc":[-85.6359579,41.9586359]},"n2189015968":{"id":"n2189015968","loc":[-85.6359561,41.9585465]},"n2189015971":{"id":"n2189015971","loc":[-85.6355476,41.9585509]},"n2189015974":{"id":"n2189015974","loc":[-85.6359516,41.9592934]},"n2189015977":{"id":"n2189015977","loc":[-85.635949,41.9586697]},"n2189015980":{"id":"n2189015980","loc":[-85.6351329,41.9586716]},"n2189015983":{"id":"n2189015983","loc":[-85.6351318,41.9583949]},"n2189015986":{"id":"n2189015986","loc":[-85.6349148,41.9583954]},"n2189015989":{"id":"n2189015989","loc":[-85.6349186,41.9592958]},"n2189015995":{"id":"n2189015995","loc":[-85.6360173,41.9593286]},"n2189015998":{"id":"n2189015998","loc":[-85.6360278,41.9583079]},"n2114807550":{"id":"n2114807550","loc":[-85.6383392,41.9595404]},"n2114807551":{"id":"n2114807551","loc":[-85.6375855,41.9616107]},"n2114807559":{"id":"n2114807559","loc":[-85.6373978,41.9621273]},"n2114807562":{"id":"n2114807562","loc":[-85.6373361,41.9622609]},"n2114807563":{"id":"n2114807563","loc":[-85.6376472,41.9613953]},"n2114807574":{"id":"n2114807574","loc":[-85.636974,41.9627695]},"n2114807589":{"id":"n2114807589","loc":[-85.6383017,41.9595005]},"n2114807592":{"id":"n2114807592","loc":[-85.6377169,41.9613494]},"n2114807595":{"id":"n2114807595","loc":[-85.6371081,41.962574]},"n2189015934":{"id":"n2189015934","loc":[-85.6364855,41.9595098]},"n2189015949":{"id":"n2189015949","loc":[-85.6363466,41.9595105]},"w208627244":{"id":"w208627244","tags":{"highway":"service"},"nodes":["n2189015992","n2189015995","n2189015998"]},"w208627240":{"id":"w208627240","tags":{"area":"yes","building":"yes"},"nodes":["n2189015961","n2189015971","n2189015962","n2189015963","n2189015964","n2189015961"]},"w17967437":{"id":"w17967437","tags":{"highway":"residential","name":"Lyman St"},"nodes":["n185964361","n185984024"]},"w208627237":{"id":"w208627237","tags":{"area":"yes","building":"yes"},"nodes":["n2189015955","n2189015957","n2189015958","n2189015952","n2189015955"]},"w17967465":{"id":"w17967465","tags":{"highway":"residential","name":"W Adams St"},"nodes":["n185978394","n185984022","n185964360"]},"w208627228":{"id":"w208627228","tags":{"area":"yes","building":"yes"},"nodes":["n2189015897","n2189015900","n2189015903","n2189015906","n2189015897"]},"w201484351":{"id":"w201484351","tags":{"railway":"rail","service":"siding"},"nodes":["n2114807587","n2114807574","n2114807595","n2114807562","n2114807559","n2114807551","n2114807563","n2114807589","n2114807552"]},"w208627239":{"id":"w208627239","tags":{"area":"yes","building":"yes"},"nodes":["n2189015957","n2189015959","n2189015960","n2189015958","n2189015957"]},"w208627233":{"id":"w208627233","tags":{"area":"yes","building":"yes"},"nodes":["n2189015934","n2189015937","n2189015940","n2189015943","n2189015945","n2189015949","n2189015934"]},"w208627241":{"id":"w208627241","tags":{"area":"yes","building":"yes"},"nodes":["n2189015961","n2189015966","n2189015968","n2189015971","n2189015961"]},"w17967970":{"id":"w17967970","tags":{"highway":"residential","name":"Adams St"},"nodes":["n185975351","n185978394"]},"w208627235":{"id":"w208627235","tags":{"area":"yes","building":"yes"},"nodes":["n2189015940","n2189015952","n2189015955","n2189015937","n2189015940"]},"w17965468":{"id":"w17965468","tags":{"highway":"residential","name":"Armstrong Blvd"},"nodes":["n185967917","n2189015998","n185967918","n185964362","n185952166"]},"w201484346":{"id":"w201484346","tags":{"railway":"rail","service":"siding"},"nodes":["n2114807551","n2114807592","n2114807550","n2114807591"]},"w208627242":{"id":"w208627242","tags":{"amenity":"parking","area":"yes"},"nodes":["n2189015974","n2189015977","n2189015980","n2189015983","n2189015986","n2189015989","n2189015974"]},"w208627216":{"id":"w208627216","tags":{"area":"yes","building":"yes"},"nodes":["n2189015731","n2189015734","n2189015737","n2189015738","n2189015731"]},"n185984309":{"id":"n185984309","loc":[-85.631421,41.961494]},"n185987987":{"id":"n185987987","loc":[-85.631456,41.960673]},"n185965397":{"id":"n185965397","loc":[-85.634603,41.959838]},"w17965196":{"id":"w17965196","tags":{"highway":"residential","name":"Burke Ave"},"nodes":["n185965395","n185965397","n185965399"]},"w17967215":{"id":"w17967215","tags":{"highway":"residential","name":"Kellogg Ave"},"nodes":["n185968114","n185984309","n185967440","n185978402"]},"w17967597":{"id":"w17967597","tags":{"highway":"residential","name":"Barnard Ave"},"nodes":["n185968112","n185987987","n185967438","n185978399"]},"n394490857":{"id":"n394490857","loc":[-85.633952,41.960664]},"n394490858":{"id":"n394490858","loc":[-85.633938,41.960227]},"n394490859":{"id":"n394490859","loc":[-85.634794,41.960212]},"n394490860":{"id":"n394490860","loc":[-85.634815,41.960662]},"n394490861":{"id":"n394490861","loc":[-85.634103,41.961268]},"n394490862":{"id":"n394490862","loc":[-85.634103,41.961001]},"n394490863":{"id":"n394490863","loc":[-85.634504,41.961003]},"n394490864":{"id":"n394490864","loc":[-85.634561,41.961269]},"n1057629869":{"id":"n1057629869","loc":[-85.6382599,41.9612134]},"n1057629937":{"id":"n1057629937","loc":[-85.6380035,41.9616137]},"n2189016014":{"id":"n2189016014","loc":[-85.6360365,41.9626496]},"n2189016017":{"id":"n2189016017","loc":[-85.6360374,41.9623228]},"n2189016020":{"id":"n2189016020","loc":[-85.6367557,41.9623239]},"n2189016022":{"id":"n2189016022","loc":[-85.6367566,41.9619919]},"n2189016025":{"id":"n2189016025","loc":[-85.6351794,41.9619893]},"n2189016028":{"id":"n2189016028","loc":[-85.6351788,41.9622011]},"n2189016031":{"id":"n2189016031","loc":[-85.6350855,41.9622009]},"n2189016034":{"id":"n2189016034","loc":[-85.6350845,41.962527]},"n2189016037":{"id":"n2189016037","loc":[-85.6352732,41.9625273]},"n2189016039":{"id":"n2189016039","loc":[-85.6352738,41.9623178]},"n2189016042":{"id":"n2189016042","loc":[-85.6357712,41.9623186]},"n2189016044":{"id":"n2189016044","loc":[-85.6357702,41.9626492]},"n1057629880":{"id":"n1057629880","loc":[-85.638817,41.9619017]},"n1057629923":{"id":"n1057629923","loc":[-85.6390733,41.9615014]},"w91092312":{"id":"w91092312","tags":{"power":"station"},"nodes":["n1057629923","n1057629869","n1057629937","n1057629880","n1057629923"]},"w34369826":{"id":"w34369826","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394490861","n394490862","n394490863","n394490864","n394490861"]},"w34369825":{"id":"w34369825","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394490857","n394490858","n394490859","n394490860","n394490857"]},"w208627248":{"id":"w208627248","tags":{"area":"yes","building":"yes"},"nodes":["n2189016014","n2189016017","n2189016020","n2189016022","n2189016025","n2189016028","n2189016031","n2189016034","n2189016037","n2189016039","n2189016042","n2189016044","n2189016014"]},"n394490766":{"id":"n394490766","loc":[-85.616777,41.955642]},"n394490768":{"id":"n394490768","loc":[-85.617239,41.955644]},"n394490792":{"id":"n394490792","loc":[-85.619034,41.95543]},"n185972055":{"id":"n185972055","loc":[-85.6185905,41.9568211]},"n185972057":{"id":"n185972057","loc":[-85.6186688,41.9570086]},"n185972059":{"id":"n185972059","loc":[-85.6186924,41.9581453]},"n185972060":{"id":"n185972060","loc":[-85.6187082,41.9588211],"tags":{"highway":"turning_circle"}},"n1819790724":{"id":"n1819790724","loc":[-85.6182155,41.9555703]},"n1819790735":{"id":"n1819790735","loc":[-85.6184059,41.9566188]},"n1819790799":{"id":"n1819790799","loc":[-85.6182372,41.9563771]},"n1819790896":{"id":"n1819790896","loc":[-85.6181431,41.9557227]},"n185971405":{"id":"n185971405","loc":[-85.6186766,41.9577468]},"n185971565":{"id":"n185971565","loc":[-85.6181613,41.9560879]},"n185967985":{"id":"n185967985","loc":[-85.6186798,41.9585791]},"n185955753":{"id":"n185955753","loc":[-85.620773,41.9555854]},"n185955755":{"id":"n185955755","loc":[-85.6212652,41.9559891]},"n185955748":{"id":"n185955748","loc":[-85.620722,41.954858]},"n185955751":{"id":"n185955751","loc":[-85.6206912,41.955367]},"n185967987":{"id":"n185967987","loc":[-85.6159351,41.9585809]},"n185971407":{"id":"n185971407","loc":[-85.6159142,41.9577578]},"n185971570":{"id":"n185971570","loc":[-85.6162248,41.95603]},"n185971572":{"id":"n185971572","loc":[-85.6160402,41.9560749]},"n185971574":{"id":"n185971574","loc":[-85.61593,41.956201]},"n185981301":{"id":"n185981301","loc":[-85.6158973,41.9581601]},"n394490762":{"id":"n394490762","loc":[-85.617193,41.954706]},"n394490764":{"id":"n394490764","loc":[-85.616773,41.954737]},"n394490787":{"id":"n394490787","loc":[-85.618972,41.954737]},"n394490790":{"id":"n394490790","loc":[-85.619046,41.954929]},"n394490794":{"id":"n394490794","loc":[-85.619922,41.955296]},"n394490796":{"id":"n394490796","loc":[-85.61991,41.95501]},"n394490798":{"id":"n394490798","loc":[-85.619974,41.954751]},"n1819790677":{"id":"n1819790677","loc":[-85.6187031,41.9550522]},"n1819790787":{"id":"n1819790787","loc":[-85.6186436,41.9552022]},"n1819790828":{"id":"n1819790828","loc":[-85.6185127,41.9553393]},"w17966857":{"id":"w17966857","tags":{"access":"private","highway":"service","name":"Sable River Rd"},"nodes":["n185972059","n185981301"]},"w34369814":{"id":"w34369814","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394490787","n394490790","n394490792","n394490794","n394490796","n394490798","n394490787"]},"w17964176":{"id":"w17964176","tags":{"highway":"residential"},"nodes":["n185955747","n185955748","n185955751","n185955753","n185955755"]},"w17965838":{"id":"w17965838","tags":{"access":"private","highway":"service","name":"Pine River Rd"},"nodes":["n185971405","n185971407"]},"w17965476":{"id":"w17965476","tags":{"access":"private","highway":"service","name":"Raisin River Rd"},"nodes":["n185967985","n185967987"]},"w17965913":{"id":"w17965913","tags":{"access":"private","highway":"service","name":"Shiawassee River Rd"},"nodes":["n185972054","n1819790677","n1819790787","n1819790828","n1819790724","n1819790896","n185971565","n1819790799","n1819790735","n185972055","n185972057","n185971405","n185972059","n185967985","n185972060"]},"w34369811":{"id":"w34369811","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394490762","n394490764","n394490766","n394490768","n394490762"]},"w17965854":{"id":"w17965854","tags":{"access":"private","highway":"service","name":"Sturgeon River Rd"},"nodes":["n185971565","n185971570","n185971572","n185971574"]},"n2139795769":{"id":"n2139795769","loc":[-85.6250804,41.9608796]},"n2139795770":{"id":"n2139795770","loc":[-85.6250315,41.9613684]},"n2139795771":{"id":"n2139795771","loc":[-85.6249671,41.9614362]},"n2139795772":{"id":"n2139795772","loc":[-85.6249698,41.961522]},"n2139795773":{"id":"n2139795773","loc":[-85.6250798,41.9615838]},"n2139795774":{"id":"n2139795774","loc":[-85.6252273,41.9615639]},"n2139795775":{"id":"n2139795775","loc":[-85.6252863,41.9614622]},"n2139795776":{"id":"n2139795776","loc":[-85.6252273,41.9613764]},"n2139795777":{"id":"n2139795777","loc":[-85.6251227,41.9613525]},"n2139795778":{"id":"n2139795778","loc":[-85.6249564,41.9612527]},"n2139795779":{"id":"n2139795779","loc":[-85.6249846,41.9610254]},"n2139795780":{"id":"n2139795780","loc":[-85.6266725,41.9599647]},"n2139795781":{"id":"n2139795781","loc":[-85.6259162,41.9599711]},"n2139795782":{"id":"n2139795782","loc":[-85.6257185,41.960019]},"n2139795783":{"id":"n2139795783","loc":[-85.6255509,41.9601213]},"n185963539":{"id":"n185963539","loc":[-85.615718,41.983893]},"n185964418":{"id":"n185964418","loc":[-85.616626,42.049512]},"n185966614":{"id":"n185966614","loc":[-85.615514,41.976603]},"n185966635":{"id":"n185966635","loc":[-85.616118,42.013017]},"n185969040":{"id":"n185969040","loc":[-85.615632,41.972357]},"n185969070":{"id":"n185969070","loc":[-85.619145,41.967648]},"n185972156":{"id":"n185972156","loc":[-85.621894,41.963956]},"n185972157":{"id":"n185972157","loc":[-85.621806,41.964077]},"n185972158":{"id":"n185972158","loc":[-85.620848,41.965341]},"n185972159":{"id":"n185972159","loc":[-85.620684,41.965558]},"n185972160":{"id":"n185972160","loc":[-85.620621,41.965658]},"n185972161":{"id":"n185972161","loc":[-85.617844,41.969359]},"n185972162":{"id":"n185972162","loc":[-85.616843,41.97068]},"n185972164":{"id":"n185972164","loc":[-85.616714,41.970839]},"n185972166":{"id":"n185972166","loc":[-85.615879,41.971969]},"n185972168":{"id":"n185972168","loc":[-85.615748,41.972159]},"n185972170":{"id":"n185972170","loc":[-85.615589,41.972502]},"n185972172":{"id":"n185972172","loc":[-85.615542,41.972733]},"n185972175":{"id":"n185972175","loc":[-85.615524,41.972947]},"n185972177":{"id":"n185972177","loc":[-85.615512,41.973715]},"n185972179":{"id":"n185972179","loc":[-85.615513,41.976496]},"n185972180":{"id":"n185972180","loc":[-85.615538,41.977246]},"n185972181":{"id":"n185972181","loc":[-85.61558,41.982139]},"n185972184":{"id":"n185972184","loc":[-85.61557,41.983317]},"n185972186":{"id":"n185972186","loc":[-85.615591,41.983463]},"n185972188":{"id":"n185972188","loc":[-85.615763,41.984146]},"n185972190":{"id":"n185972190","loc":[-85.615814,41.98435]},"n185972192":{"id":"n185972192","loc":[-85.615965,41.998453]},"n185972194":{"id":"n185972194","loc":[-85.615982,42.001237]},"n185972195":{"id":"n185972195","loc":[-85.616055,42.00555]},"n185972197":{"id":"n185972197","loc":[-85.616134,42.014887]},"n185972199":{"id":"n185972199","loc":[-85.616177,42.018465]},"n185972201":{"id":"n185972201","loc":[-85.616298,42.027627]},"n185972203":{"id":"n185972203","loc":[-85.616513,42.042212]},"w203968015":{"id":"w203968015","tags":{"highway":"residential"},"nodes":["n2139795768","n2139795769"]},"w17965932":{"id":"w17965932","tags":{"highway":"residential","name":"Buckhorn Road","name_1":"County Highway 122"},"nodes":["n185972155","n185972156","n185972157","n185972158","n185972159","n185972160","n185969070","n185972161","n185972162","n185972164","n185972166","n185972168","n185969040","n185972170","n185972172","n185972175","n185972177","n185972179","n185966614","n185972180","n185972181","n185972184","n185972186","n185963539","n185972188","n185972190","n185972192","n185972194","n185972195","n185966635","n185972197","n185972199","n185972201","n185972203","n185964418"]},"w203968016":{"id":"w203968016","tags":{"highway":"residential","name":"New Jersey Court"},"nodes":["n2139795770","n2139795771","n2139795772","n2139795773","n2139795774","n2139795775","n2139795776","n2139795777","n2139795770","n2139795778","n2139795779","n2139795769"]},"w203968017":{"id":"w203968017","tags":{"highway":"residential","name":"Oklahoma Drive"},"nodes":["n2139795780","n2139795781","n2139795782","n2139795783","n2139795769"]},"n1819790528":{"id":"n1819790528","loc":[-85.6184827,41.960025]},"n1819790530":{"id":"n1819790530","loc":[-85.6168626,41.9605834]},"n1819790534":{"id":"n1819790534","loc":[-85.6197379,41.9617163]},"n1819790541":{"id":"n1819790541","loc":[-85.6198881,41.9620833]},"n1819790543":{"id":"n1819790543","loc":[-85.619695,41.9619397]},"n1819790547":{"id":"n1819790547","loc":[-85.6190298,41.9609504]},"n1819790555":{"id":"n1819790555","loc":[-85.6180471,41.9609788]},"n1819790559":{"id":"n1819790559","loc":[-85.6203817,41.9605436]},"n1819790583":{"id":"n1819790583","loc":[-85.6201564,41.9603282]},"n1819790590":{"id":"n1819790590","loc":[-85.617045,41.9598894]},"n1819790609":{"id":"n1819790609","loc":[-85.6177638,41.9598495]},"n1819790618":{"id":"n1819790618","loc":[-85.6195234,41.9610143]},"n1819790642":{"id":"n1819790642","loc":[-85.6181179,41.9627933]},"n1819790659":{"id":"n1819790659","loc":[-85.6174634,41.962897]},"n1819790665":{"id":"n1819790665","loc":[-85.6170343,41.9630885]},"n1819790674":{"id":"n1819790674","loc":[-85.6194697,41.9601925]},"n1819790685":{"id":"n1819790685","loc":[-85.6207722,41.9610665]},"n1819790687":{"id":"n1819790687","loc":[-85.6202315,41.9622109]},"n1819790697":{"id":"n1819790697","loc":[-85.6184505,41.9624662]},"n1819790726":{"id":"n1819790726","loc":[-85.6178926,41.9628492]},"n1819790738":{"id":"n1819790738","loc":[-85.6173347,41.9598016]},"n1819790762":{"id":"n1819790762","loc":[-85.6186221,41.9609105]},"n1819790774":{"id":"n1819790774","loc":[-85.6175922,41.9608308]},"n1819790781":{"id":"n1819790781","loc":[-85.6167768,41.9633198]},"n1819790796":{"id":"n1819790796","loc":[-85.619856,41.961461]},"n1819790811":{"id":"n1819790811","loc":[-85.6208215,41.9620195]},"n1819790833":{"id":"n1819790833","loc":[-85.618311,41.9612536]},"n1819790854":{"id":"n1819790854","loc":[-85.6183646,41.9626417]},"n1819790863":{"id":"n1819790863","loc":[-85.6204997,41.9608547]},"n1819790867":{"id":"n1819790867","loc":[-85.6184934,41.9621391]},"n1819790877":{"id":"n1819790877","loc":[-85.6206928,41.9621152]},"n1819790881":{"id":"n1819790881","loc":[-85.6170879,41.960735]},"n1819790891":{"id":"n1819790891","loc":[-85.6168304,41.9601207]},"n1819790898":{"id":"n1819790898","loc":[-85.619813,41.9612297]},"n1819790909":{"id":"n1819790909","loc":[-85.6167982,41.960376]},"n1819790912":{"id":"n1819790912","loc":[-85.6205855,41.9610462]},"n1819790544":{"id":"n1819790544","loc":[-85.612968,41.9707781]},"n1819790549":{"id":"n1819790549","loc":[-85.614395,41.9697172]},"n1819790552":{"id":"n1819790552","loc":[-85.6180535,41.9655536]},"n1819790554":{"id":"n1819790554","loc":[-85.6111227,41.9703713]},"n1819790560":{"id":"n1819790560","loc":[-85.6112729,41.9701958]},"n1819790563":{"id":"n1819790563","loc":[-85.6137512,41.9689917]},"n1819790564":{"id":"n1819790564","loc":[-85.6181072,41.9659205]},"n1819790595":{"id":"n1819790595","loc":[-85.6170021,41.9666863]},"n1819790605":{"id":"n1819790605","loc":[-85.6168948,41.9644527]},"n1819790606":{"id":"n1819790606","loc":[-85.6128071,41.9701081]},"n1819790607":{"id":"n1819790607","loc":[-85.6129251,41.9704032]},"n1819790612":{"id":"n1819790612","loc":[-85.6177638,41.9663912]},"n1819790615":{"id":"n1819790615","loc":[-85.6152533,41.9670373]},"n1819790622":{"id":"n1819790622","loc":[-85.6146739,41.9673804]},"n1819790623":{"id":"n1819790623","loc":[-85.6180428,41.9661838]},"n1819790625":{"id":"n1819790625","loc":[-85.6172918,41.9646202]},"n1819790645":{"id":"n1819790645","loc":[-85.6178067,41.965043]},"n1819790647":{"id":"n1819790647","loc":[-85.6143306,41.9712488]},"n1819790649":{"id":"n1819790649","loc":[-85.6147383,41.9707702]},"n1819790654":{"id":"n1819790654","loc":[-85.6157361,41.9668459]},"n1819790657":{"id":"n1819790657","loc":[-85.6145666,41.9710733]},"n1819790668":{"id":"n1819790668","loc":[-85.6166909,41.9642692]},"n1819790671":{"id":"n1819790671","loc":[-85.6141482,41.9696538]},"n1819790679":{"id":"n1819790679","loc":[-85.6148349,41.9705388]},"n1819790686":{"id":"n1819790686","loc":[-85.6139551,41.9695501]},"n1819790696":{"id":"n1819790696","loc":[-85.6119703,41.9699087]},"n1819790704":{"id":"n1819790704","loc":[-85.6140731,41.9684174]},"n1819790706":{"id":"n1819790706","loc":[-85.6124745,41.9699246]},"n1819790718":{"id":"n1819790718","loc":[-85.6165407,41.9636868]},"n1819790720":{"id":"n1819790720","loc":[-85.61388,41.9687365]},"n1819790731":{"id":"n1819790731","loc":[-85.6165193,41.9639421]},"n1819790739":{"id":"n1819790739","loc":[-85.6146739,41.9699964]},"n1819790753":{"id":"n1819790753","loc":[-85.6173883,41.9665747]},"n1819790760":{"id":"n1819790760","loc":[-85.6133221,41.9712089]},"n1819790767":{"id":"n1819790767","loc":[-85.6116698,41.9699246]},"n1819790779":{"id":"n1819790779","loc":[-85.6130753,41.9710573]},"n1819790791":{"id":"n1819790791","loc":[-85.6137083,41.9692869]},"n1819790795":{"id":"n1819790795","loc":[-85.6141482,41.9679627]},"n1819790798":{"id":"n1819790798","loc":[-85.6137727,41.9694305]},"n1819790836":{"id":"n1819790836","loc":[-85.6143842,41.9676037]},"n1819790915":{"id":"n1819790915","loc":[-85.6148456,41.9702756]},"n1819790926":{"id":"n1819790926","loc":[-85.6138371,41.9713525]},"n1819790927":{"id":"n1819790927","loc":[-85.6141053,41.9713525]},"n1819790931":{"id":"n1819790931","loc":[-85.6162832,41.966814]},"n1821014625":{"id":"n1821014625","loc":[-85.5960611,41.9808498]},"n1821014627":{"id":"n1821014627","loc":[-85.5565843,42.010982]},"n1821014629":{"id":"n1821014629","loc":[-85.5971541,41.9805808]},"n1821014632":{"id":"n1821014632","loc":[-85.6061837,41.9725907]},"n1821014633":{"id":"n1821014633","loc":[-85.5247773,42.025766]},"n1821014635":{"id":"n1821014635","loc":[-85.5908938,41.9902384]},"n1821014636":{"id":"n1821014636","loc":[-85.5917682,41.9860637]},"n1821014637":{"id":"n1821014637","loc":[-85.5456556,42.0166797]},"n1821014638":{"id":"n1821014638","loc":[-85.5795749,42.0032352]},"n1821014639":{"id":"n1821014639","loc":[-85.6103988,41.9723456]},"n1821014642":{"id":"n1821014642","loc":[-85.5818816,42.0022466]},"n1821014643":{"id":"n1821014643","loc":[-85.5570604,42.0091586]},"n1821014644":{"id":"n1821014644","loc":[-85.5952886,41.9803792]},"n1821014645":{"id":"n1821014645","loc":[-85.5780366,42.0040343]},"n1821014646":{"id":"n1821014646","loc":[-85.6050505,41.9751971]},"n1821014647":{"id":"n1821014647","loc":[-85.5854435,41.9946162]},"n1821014648":{"id":"n1821014648","loc":[-85.5452278,42.0168768]},"n1821014649":{"id":"n1821014649","loc":[-85.6023254,41.9780166]},"n1821014651":{"id":"n1821014651","loc":[-85.5761899,42.0046783]},"n1821014653":{"id":"n1821014653","loc":[-85.5897351,41.9876707]},"n1821014657":{"id":"n1821014657","loc":[-85.5963601,41.9808998]},"n1821014658":{"id":"n1821014658","loc":[-85.5892952,41.9951983]},"n1821014660":{"id":"n1821014660","loc":[-85.5778328,42.0037194]},"n1821014661":{"id":"n1821014661","loc":[-85.5541475,42.0125705]},"n1821014663":{"id":"n1821014663","loc":[-85.5914047,41.9856469]},"n1821014664":{"id":"n1821014664","loc":[-85.6101681,41.9727723]},"n1821014665":{"id":"n1821014665","loc":[-85.5910172,41.9854696]},"n1821014666":{"id":"n1821014666","loc":[-85.5398688,42.0187699]},"n1821014667":{"id":"n1821014667","loc":[-85.5218752,42.0282884]},"n1821014668":{"id":"n1821014668","loc":[-85.5159582,42.0329384]},"n1821014669":{"id":"n1821014669","loc":[-85.5898102,41.9847319]},"n1821014670":{"id":"n1821014670","loc":[-85.5734809,42.0066235]},"n1821014671":{"id":"n1821014671","loc":[-85.5922939,41.980852]},"n1821014672":{"id":"n1821014672","loc":[-85.6023629,41.9781163]},"n1821014674":{"id":"n1821014674","loc":[-85.5409953,42.0191724]},"n1821014676":{"id":"n1821014676","loc":[-85.584435,41.9949909]},"n1821014677":{"id":"n1821014677","loc":[-85.5972399,41.9783835]},"n1821014678":{"id":"n1821014678","loc":[-85.5616738,42.0071337]},"n1821014681":{"id":"n1821014681","loc":[-85.5202994,42.0310755]},"n1821014682":{"id":"n1821014682","loc":[-85.5915912,41.9857767]},"n1821014684":{"id":"n1821014684","loc":[-85.6022288,41.977897]},"n1821014687":{"id":"n1821014687","loc":[-85.5933024,41.9846362]},"n1821014688":{"id":"n1821014688","loc":[-85.5846871,41.9956169]},"n1821014689":{"id":"n1821014689","loc":[-85.5898209,41.99037]},"n1821014691":{"id":"n1821014691","loc":[-85.5448939,42.0149261]},"n1821014692":{"id":"n1821014692","loc":[-85.5977763,41.9786348]},"n1821014694":{"id":"n1821014694","loc":[-85.5767706,42.0034523]},"n1821014695":{"id":"n1821014695","loc":[-85.6103559,41.9726766]},"n1821014697":{"id":"n1821014697","loc":[-85.5922134,41.9809876]},"n1821014698":{"id":"n1821014698","loc":[-85.5935277,41.9831728]},"n1821014700":{"id":"n1821014700","loc":[-85.5674674,42.0078273]},"n1821014703":{"id":"n1821014703","loc":[-85.6021,41.9778053]},"n1821014704":{"id":"n1821014704","loc":[-85.5756763,42.0053737]},"n1821014705":{"id":"n1821014705","loc":[-85.5887695,41.9895207]},"n1821014707":{"id":"n1821014707","loc":[-85.6061073,41.9746866]},"n1821014708":{"id":"n1821014708","loc":[-85.6033446,41.9751692]},"n1821014710":{"id":"n1821014710","loc":[-85.5180986,42.0322332]},"n1821014711":{"id":"n1821014711","loc":[-85.543365,42.0163569]},"n1821014712":{"id":"n1821014712","loc":[-85.6030656,41.9753646]},"n1821014713":{"id":"n1821014713","loc":[-85.6104417,41.9704792]},"n1821014714":{"id":"n1821014714","loc":[-85.5205716,42.030998]},"n1821014716":{"id":"n1821014716","loc":[-85.516382,42.032536]},"n1821014717":{"id":"n1821014717","loc":[-85.5932863,41.9820882]},"n1821014718":{"id":"n1821014718","loc":[-85.5361928,42.0194974]},"n1821014720":{"id":"n1821014720","loc":[-85.6011613,41.9773586]},"n1821014721":{"id":"n1821014721","loc":[-85.554287,42.0109124]},"n1821014722":{"id":"n1821014722","loc":[-85.5577524,42.0103425]},"n1821014725":{"id":"n1821014725","loc":[-85.5867256,41.9921004]},"n1821014726":{"id":"n1821014726","loc":[-85.5856045,41.9968807]},"n1821014727":{"id":"n1821014727","loc":[-85.5545445,42.0106454]},"n1821014728":{"id":"n1821014728","loc":[-85.5923797,41.9842534]},"n1821014729":{"id":"n1821014729","loc":[-85.5696346,42.0081462]},"n1821014730":{"id":"n1821014730","loc":[-85.5998322,41.9786884]},"n1821014735":{"id":"n1821014735","loc":[-85.5337426,42.0218266]},"n1821014736":{"id":"n1821014736","loc":[-85.5847944,41.994672]},"n1821014740":{"id":"n1821014740","loc":[-85.5315271,42.0238669]},"n1821014741":{"id":"n1821014741","loc":[-85.5248846,42.027085]},"n1821014742":{"id":"n1821014742","loc":[-85.5853376,41.997018]},"n1821014743":{"id":"n1821014743","loc":[-85.5894883,41.988811]},"n1821014745":{"id":"n1821014745","loc":[-85.6095311,41.9726226]},"n1821014746":{"id":"n1821014746","loc":[-85.5531511,42.0133416]},"n1821014747":{"id":"n1821014747","loc":[-85.5735882,42.007058]},"n1821014749":{"id":"n1821014749","loc":[-85.5428554,42.0164366]},"n1821014751":{"id":"n1821014751","loc":[-85.5395255,42.0186304]},"n1821014752":{"id":"n1821014752","loc":[-85.571378,42.0083176]},"n1821014754":{"id":"n1821014754","loc":[-85.5541918,42.0113925]},"n1821014755":{"id":"n1821014755","loc":[-85.5278029,42.0250806]},"n1821014756":{"id":"n1821014756","loc":[-85.5936725,41.9827102]},"n1821014757":{"id":"n1821014757","loc":[-85.5176266,42.0346677]},"n1821014758":{"id":"n1821014758","loc":[-85.6096692,41.9714245]},"n1821014759":{"id":"n1821014759","loc":[-85.5770321,42.0034266]},"n1821014761":{"id":"n1821014761","loc":[-85.5988921,41.9779369]},"n1821014762":{"id":"n1821014762","loc":[-85.5811788,42.0024499]},"n1821014763":{"id":"n1821014763","loc":[-85.5154003,42.0381101]},"n1821014764":{"id":"n1821014764","loc":[-85.5155827,42.0374089]},"n1821014765":{"id":"n1821014765","loc":[-85.5891249,41.9884978]},"n1821014766":{"id":"n1821014766","loc":[-85.5313863,42.0238293]},"n1821014768":{"id":"n1821014768","loc":[-85.593297,41.9833363]},"n1821014769":{"id":"n1821014769","loc":[-85.5849446,41.9957245]},"n1821014770":{"id":"n1821014770","loc":[-85.5537774,42.0130847]},"n1821014771":{"id":"n1821014771","loc":[-85.6111766,41.9706069]},"n1821014772":{"id":"n1821014772","loc":[-85.5585477,42.008989]},"n1821014774":{"id":"n1821014774","loc":[-85.5928142,41.9852623]},"n1821014777":{"id":"n1821014777","loc":[-85.5891933,41.9882608]},"n1821014778":{"id":"n1821014778","loc":[-85.5926909,41.9817532]},"n1821014779":{"id":"n1821014779","loc":[-85.5260272,42.0252201]},"n1821014781":{"id":"n1821014781","loc":[-85.5894615,41.9950468]},"n1821014782":{"id":"n1821014782","loc":[-85.5461063,42.0143242]},"n1821014783":{"id":"n1821014783","loc":[-85.5711527,42.0085886]},"n1821014784":{"id":"n1821014784","loc":[-85.5329379,42.0218624]},"n1821014786":{"id":"n1821014786","loc":[-85.583047,42.0020252]},"n1821014787":{"id":"n1821014787","loc":[-85.5758962,42.0054095]},"n1821014788":{"id":"n1821014788","loc":[-85.5626354,42.0077733]},"n1821014789":{"id":"n1821014789","loc":[-85.6029852,41.9755999]},"n1821014790":{"id":"n1821014790","loc":[-85.5892362,41.9886755]},"n1821014791":{"id":"n1821014791","loc":[-85.5157597,42.0372017]},"n1821014793":{"id":"n1821014793","loc":[-85.6054582,41.9751094]},"n1821014794":{"id":"n1821014794","loc":[-85.5986936,41.9778412]},"n1821014795":{"id":"n1821014795","loc":[-85.5880775,41.98976]},"n1821014796":{"id":"n1821014796","loc":[-85.5858727,41.9963624]},"n1821014798":{"id":"n1821014798","loc":[-85.5792543,42.0035958]},"n1821014799":{"id":"n1821014799","loc":[-85.5921665,41.9838326]},"n1821014801":{"id":"n1821014801","loc":[-85.599214,41.9782599]},"n1821014802":{"id":"n1821014802","loc":[-85.5571905,42.0090967]},"n1821014803":{"id":"n1821014803","loc":[-85.5426891,42.0173612]},"n1821014804":{"id":"n1821014804","loc":[-85.5889626,41.9896404]},"n1821014805":{"id":"n1821014805","loc":[-85.5491264,42.0141648]},"n1821014806":{"id":"n1821014806","loc":[-85.5618897,42.0072631]},"n1821014808":{"id":"n1821014808","loc":[-85.5573501,42.0109802]},"n1821014809":{"id":"n1821014809","loc":[-85.5983463,41.9778031]},"n1821014810":{"id":"n1821014810","loc":[-85.5885173,41.9895128]},"n1821014811":{"id":"n1821014811","loc":[-85.6084998,41.9721143]},"n1821014812":{"id":"n1821014812","loc":[-85.5737598,42.0056389]},"n1821014814":{"id":"n1821014814","loc":[-85.5542173,42.0118132]},"n1821014816":{"id":"n1821014816","loc":[-85.5277868,42.024451]},"n1821014817":{"id":"n1821014817","loc":[-85.5403999,42.0191724]},"n1821014819":{"id":"n1821014819","loc":[-85.5983879,41.9791452]},"n1821014820":{"id":"n1821014820","loc":[-85.5891302,41.9897578]},"n1821014822":{"id":"n1821014822","loc":[-85.5930731,41.9805108]},"n1821014824":{"id":"n1821014824","loc":[-85.515395,42.0378471]},"n1821014825":{"id":"n1821014825","loc":[-85.5352755,42.0205136]},"n1821014826":{"id":"n1821014826","loc":[-85.5502744,42.0133398]},"n1821014828":{"id":"n1821014828","loc":[-85.5701295,42.0088256]},"n1821014830":{"id":"n1821014830","loc":[-85.5888929,41.9953099]},"n1821014832":{"id":"n1821014832","loc":[-85.5880077,41.9901547]},"n1821014833":{"id":"n1821014833","loc":[-85.5451192,42.0157072]},"n1821014834":{"id":"n1821014834","loc":[-85.6096478,41.9711932]},"n1821014835":{"id":"n1821014835","loc":[-85.5806424,42.0026532]},"n1821014836":{"id":"n1821014836","loc":[-85.5911674,41.9868732]},"n1821014838":{"id":"n1821014838","loc":[-85.5930302,41.9836571]},"n1821014839":{"id":"n1821014839","loc":[-85.588925,41.9938148]},"n1821014840":{"id":"n1821014840","loc":[-85.6111874,41.9705311]},"n1821014841":{"id":"n1821014841","loc":[-85.5680843,42.0075842]},"n1821014842":{"id":"n1821014842","loc":[-85.6012793,41.9775062]},"n1821014843":{"id":"n1821014843","loc":[-85.5855562,41.9989777]},"n1821014844":{"id":"n1821014844","loc":[-85.5506137,42.0131662]},"n1821014845":{"id":"n1821014845","loc":[-85.5270049,42.025457]},"n1821014846":{"id":"n1821014846","loc":[-85.5257054,42.025244]},"n1821014847":{"id":"n1821014847","loc":[-85.6011184,41.9771832]},"n1821014848":{"id":"n1821014848","loc":[-85.515534,42.0389234]},"n1821014850":{"id":"n1821014850","loc":[-85.5847032,42.0010347]},"n1821014853":{"id":"n1821014853","loc":[-85.5361499,42.019063]},"n1821014854":{"id":"n1821014854","loc":[-85.5439176,42.0165721]},"n1821014855":{"id":"n1821014855","loc":[-85.5838825,42.0017284]},"n1821014857":{"id":"n1821014857","loc":[-85.5542173,42.0122317]},"n1821014859":{"id":"n1821014859","loc":[-85.5708201,42.0089195]},"n1821014860":{"id":"n1821014860","loc":[-85.5844833,41.9954415]},"n1821014862":{"id":"n1821014862","loc":[-85.5223204,42.0295396]},"n1821014863":{"id":"n1821014863","loc":[-85.5777898,42.0035918]},"n1821014864":{"id":"n1821014864","loc":[-85.591044,41.9898078]},"n1821014865":{"id":"n1821014865","loc":[-85.5973204,41.980182]},"n1821014866":{"id":"n1821014866","loc":[-85.5699578,42.0085825]},"n1821014867":{"id":"n1821014867","loc":[-85.5210598,42.0305278]},"n1821014868":{"id":"n1821014868","loc":[-85.5929108,41.9819008]},"n1821014869":{"id":"n1821014869","loc":[-85.5279799,42.0242995]},"n1821014870":{"id":"n1821014870","loc":[-85.5196114,42.0320539]},"n1821014871":{"id":"n1821014871","loc":[-85.5785449,42.0040883]},"n1821014872":{"id":"n1821014872","loc":[-85.588292,41.9895766]},"n1821014873":{"id":"n1821014873","loc":[-85.5160172,42.0331775]},"n1821014874":{"id":"n1821014874","loc":[-85.5688849,42.0077016]},"n1821014876":{"id":"n1821014876","loc":[-85.5857976,41.9996036]},"n1821014879":{"id":"n1821014879","loc":[-85.5990906,41.9780765]},"n1821014881":{"id":"n1821014881","loc":[-85.5483647,42.0144279]},"n1821014883":{"id":"n1821014883","loc":[-85.5691209,42.0077972]},"n1821014885":{"id":"n1821014885","loc":[-85.6076844,41.9721103]},"n1821014886":{"id":"n1821014886","loc":[-85.6015489,41.9766147]},"n1821014887":{"id":"n1821014887","loc":[-85.574822,42.0052802]},"n1821014888":{"id":"n1821014888","loc":[-85.5880024,41.9899593]},"n1821014890":{"id":"n1821014890","loc":[-85.5909421,41.9893772]},"n1821014892":{"id":"n1821014892","loc":[-85.5497326,42.0138141]},"n1821014893":{"id":"n1821014893","loc":[-85.5167106,42.0357811]},"n1821014895":{"id":"n1821014895","loc":[-85.5844404,41.9952501]},"n1821014896":{"id":"n1821014896","loc":[-85.5362465,42.0192662]},"n1821014898":{"id":"n1821014898","loc":[-85.5906095,41.9889147]},"n1821014899":{"id":"n1821014899","loc":[-85.5590667,42.0089354]},"n1821014900":{"id":"n1821014900","loc":[-85.5921598,41.9844209]},"n1821014902":{"id":"n1821014902","loc":[-85.5778971,42.0039266]},"n1821014903":{"id":"n1821014903","loc":[-85.603012,41.9761981]},"n1821014904":{"id":"n1821014904","loc":[-85.6108977,41.9706787]},"n1821014905":{"id":"n1821014905","loc":[-85.5685738,42.0076139]},"n1821014906":{"id":"n1821014906","loc":[-85.5392787,42.0186304]},"n1821014907":{"id":"n1821014907","loc":[-85.5227885,42.0274972]},"n1821014908":{"id":"n1821014908","loc":[-85.5857547,41.9961431]},"n1821014910":{"id":"n1821014910","loc":[-85.5610354,42.0072812]},"n1821014911":{"id":"n1821014911","loc":[-85.5209632,42.0308705]},"n1821014912":{"id":"n1821014912","loc":[-85.5709757,42.0087959]},"n1821014913":{"id":"n1821014913","loc":[-85.59231,41.9839344]},"n1821014914":{"id":"n1821014914","loc":[-85.5375245,42.0185865]},"n1821014916":{"id":"n1821014916","loc":[-85.5901548,41.9839841]},"n1821014917":{"id":"n1821014917","loc":[-85.5611213,42.0086405]},"n1821014918":{"id":"n1821014918","loc":[-85.5360426,42.0198122]},"n1821014919":{"id":"n1821014919","loc":[-85.5862817,41.9948691]},"n1821014921":{"id":"n1821014921","loc":[-85.5469807,42.0144438]},"n1821014922":{"id":"n1821014922","loc":[-85.5761309,42.0053838]},"n1821014924":{"id":"n1821014924","loc":[-85.516264,42.0332971]},"n1821014925":{"id":"n1821014925","loc":[-85.5277224,42.0246661]},"n1821014926":{"id":"n1821014926","loc":[-85.5980016,41.9798231]},"n1821014928":{"id":"n1821014928","loc":[-85.5924548,41.9806965]},"n1821014930":{"id":"n1821014930","loc":[-85.5899121,41.985023]},"n1821014931":{"id":"n1821014931","loc":[-85.5706015,42.0089492]},"n1821014932":{"id":"n1821014932","loc":[-85.515926,42.033046]},"n1821014933":{"id":"n1821014933","loc":[-85.5982377,41.9796796]},"n1821014936":{"id":"n1821014936","loc":[-85.5475721,42.0145253]},"n1821014938":{"id":"n1821014938","loc":[-85.5895701,41.9902323]},"n1821014939":{"id":"n1821014939","loc":[-85.6030495,41.9759947]},"n1821014942":{"id":"n1821014942","loc":[-85.6094721,41.9724989]},"n1821014944":{"id":"n1821014944","loc":[-85.5921973,41.9811112]},"n1821014945":{"id":"n1821014945","loc":[-85.5223526,42.0291332]},"n1821014946":{"id":"n1821014946","loc":[-85.5965103,41.9808998]},"n1821014948":{"id":"n1821014948","loc":[-85.517766,42.0349227]},"n1821014950":{"id":"n1821014950","loc":[-85.5889894,41.990996]},"n1821014951":{"id":"n1821014951","loc":[-85.5601932,42.0092902]},"n1821014954":{"id":"n1821014954","loc":[-85.6028135,41.9764055]},"n1821014955":{"id":"n1821014955","loc":[-85.5520621,42.0130666]},"n1821014956":{"id":"n1821014956","loc":[-85.593002,41.9839344]},"n1821014957":{"id":"n1821014957","loc":[-85.515926,42.0369666]},"n1821014960":{"id":"n1821014960","loc":[-85.5761255,42.003877]},"n1821014961":{"id":"n1821014961","loc":[-85.5716355,42.007911]},"n1821014962":{"id":"n1821014962","loc":[-85.5575378,42.0109045]},"n1821014963":{"id":"n1821014963","loc":[-85.5735667,42.0068188]},"n1821014964":{"id":"n1821014964","loc":[-85.5915214,41.9865861]},"n1821014965":{"id":"n1821014965","loc":[-85.5866344,41.9923157]},"n1821014967":{"id":"n1821014967","loc":[-85.5283138,42.0242256]},"n1821014968":{"id":"n1821014968","loc":[-85.5177875,42.0355801]},"n1821014969":{"id":"n1821014969","loc":[-85.548071,42.0144934]},"n1821014972":{"id":"n1821014972","loc":[-85.5611159,42.0088557]},"n1821014973":{"id":"n1821014973","loc":[-85.541686,42.0188757]},"n1821014974":{"id":"n1821014974","loc":[-85.5917628,41.9862631]},"n1821014975":{"id":"n1821014975","loc":[-85.5854864,41.9959478]},"n1821014977":{"id":"n1821014977","loc":[-85.609102,41.9722317]},"n1821014980":{"id":"n1821014980","loc":[-85.5761202,42.0042438]},"n1821014982":{"id":"n1821014982","loc":[-85.5465944,42.0143601]},"n1821014983":{"id":"n1821014983","loc":[-85.5173261,42.0342732]},"n1821014984":{"id":"n1821014984","loc":[-85.5897297,41.9888509]},"n1821014985":{"id":"n1821014985","loc":[-85.5856688,41.999181]},"n1821014986":{"id":"n1821014986","loc":[-85.5344011,42.0217251]},"n1821014987":{"id":"n1821014987","loc":[-85.601467,41.9768203]},"n1821014988":{"id":"n1821014988","loc":[-85.5457254,42.0165123]},"n1821014989":{"id":"n1821014989","loc":[-85.6023482,41.9784332]},"n1821014991":{"id":"n1821014991","loc":[-85.5361606,42.01823]},"n1821014992":{"id":"n1821014992","loc":[-85.5178465,42.0351139]},"n1821014995":{"id":"n1821014995","loc":[-85.5634293,42.0078092]},"n1821014996":{"id":"n1821014996","loc":[-85.573497,42.0072015]},"n1821014997":{"id":"n1821014997","loc":[-85.5976328,41.9799725]},"n1821014998":{"id":"n1821014998","loc":[-85.5210651,42.0303166]},"n1821015003":{"id":"n1821015003","loc":[-85.5222131,42.0288064]},"n1821015004":{"id":"n1821015004","loc":[-85.5897941,41.984405]},"n1821015005":{"id":"n1821015005","loc":[-85.5975725,41.9776099]},"n1821015006":{"id":"n1821015006","loc":[-85.5765708,42.0034903]},"n1821015007":{"id":"n1821015007","loc":[-85.5250187,42.026559]},"n1821015009":{"id":"n1821015009","loc":[-85.5426998,42.0166279]},"n1821015010":{"id":"n1821015010","loc":[-85.5957606,41.9806584]},"n1821015011":{"id":"n1821015011","loc":[-85.5262753,42.0252497]},"n1821015012":{"id":"n1821015012","loc":[-85.5266455,42.0253374]},"n1821015014":{"id":"n1821015014","loc":[-85.5515632,42.0130187]},"n1821015015":{"id":"n1821015015","loc":[-85.6024058,41.9765212]},"n1821015017":{"id":"n1821015017","loc":[-85.5175032,42.0357156]},"n1821015018":{"id":"n1821015018","loc":[-85.5302718,42.0236039]},"n1821015019":{"id":"n1821015019","loc":[-85.6024005,41.9782759]},"n1821015020":{"id":"n1821015020","loc":[-85.5907758,41.9890821]},"n1821015021":{"id":"n1821015021","loc":[-85.6019445,41.9777215]},"n1821015022":{"id":"n1821015022","loc":[-85.5942854,41.9800881]},"n1821015024":{"id":"n1821015024","loc":[-85.5325826,42.0222711]},"n1821015029":{"id":"n1821015029","loc":[-85.555093,42.0105316]},"n1821015033":{"id":"n1821015033","loc":[-85.5249704,42.0270372]},"n1821015034":{"id":"n1821015034","loc":[-85.5243965,42.0272205]},"n1821015038":{"id":"n1821015038","loc":[-85.5413426,42.0190749]},"n1821015039":{"id":"n1821015039","loc":[-85.5920431,41.9848175]},"n1821015041":{"id":"n1821015041","loc":[-85.5577685,42.0106015]},"n1821015042":{"id":"n1821015042","loc":[-85.5453606,42.0158866]},"n1821015045":{"id":"n1821015045","loc":[-85.5333228,42.0217889]},"n1821015046":{"id":"n1821015046","loc":[-85.5426891,42.0175924]},"n1821015048":{"id":"n1821015048","loc":[-85.5886836,41.9936474]},"n1821015050":{"id":"n1821015050","loc":[-85.6001152,41.9786467]},"n1821015051":{"id":"n1821015051","loc":[-85.6094064,41.9723655]},"n1821015053":{"id":"n1821015053","loc":[-85.605721,41.9749738]},"n1821015055":{"id":"n1821015055","loc":[-85.6106791,41.9705048]},"n1821015057":{"id":"n1821015057","loc":[-85.5210437,42.0307071]},"n1821015059":{"id":"n1821015059","loc":[-85.5995694,41.9786725]},"n1821015060":{"id":"n1821015060","loc":[-85.5371638,42.0182938]},"n1821015062":{"id":"n1821015062","loc":[-85.6111766,41.9704593]},"n1821015065":{"id":"n1821015065","loc":[-85.577704,42.0034921]},"n1821015067":{"id":"n1821015067","loc":[-85.5570067,42.0093699]},"n1821015068":{"id":"n1821015068","loc":[-85.5920364,41.9845525]},"n1821015069":{"id":"n1821015069","loc":[-85.5252065,42.0253954]},"n1821015072":{"id":"n1821015072","loc":[-85.5664159,42.0088517]},"n1821015073":{"id":"n1821015073","loc":[-85.5880399,41.991905]},"n1821015075":{"id":"n1821015075","loc":[-85.6099871,41.9727861]},"n1821015076":{"id":"n1821015076","loc":[-85.5319603,42.0231478]},"n1821015078":{"id":"n1821015078","loc":[-85.6036088,41.9751112]},"n1821015080":{"id":"n1821015080","loc":[-85.5983128,41.9789179]},"n1821015082":{"id":"n1821015082","loc":[-85.5614069,42.0071395]},"n1821015083":{"id":"n1821015083","loc":[-85.60968,41.9709738]},"n1821015086":{"id":"n1821015086","loc":[-85.5914195,41.9837351]},"n1821015087":{"id":"n1821015087","loc":[-85.5895473,41.9948036]},"n1821015090":{"id":"n1821015090","loc":[-85.5929913,41.9851905]},"n1821015093":{"id":"n1821015093","loc":[-85.5907396,41.9838485]},"n1821015095":{"id":"n1821015095","loc":[-85.5893864,41.9880176]},"n1821015096":{"id":"n1821015096","loc":[-85.5788024,42.0039807]},"n1821015097":{"id":"n1821015097","loc":[-85.5630592,42.0078411]},"n1821015098":{"id":"n1821015098","loc":[-85.5350609,42.0211274]},"n1821015099":{"id":"n1821015099","loc":[-85.5967195,41.9808679]},"n1821015100":{"id":"n1821015100","loc":[-85.5666734,42.0088119]},"n1821015101":{"id":"n1821015101","loc":[-85.564694,42.0077675]},"n1821015103":{"id":"n1821015103","loc":[-85.6066544,41.9726527]},"n1821015104":{"id":"n1821015104","loc":[-85.6011827,41.9769838]},"n1821015105":{"id":"n1821015105","loc":[-85.5972131,41.9776697]},"n1821015106":{"id":"n1821015106","loc":[-85.5880828,41.9903341]},"n1821015107":{"id":"n1821015107","loc":[-85.5510268,42.0130626]},"n1821015108":{"id":"n1821015108","loc":[-85.6102164,41.970543]},"n1821015109":{"id":"n1821015109","loc":[-85.5905344,41.9853899]},"n1821015111":{"id":"n1821015111","loc":[-85.5888821,41.9913429]},"n1821015112":{"id":"n1821015112","loc":[-85.606295,41.9741921]},"n1821015114":{"id":"n1821015114","loc":[-85.5969556,41.9807443]},"n1821015115":{"id":"n1821015115","loc":[-85.5882223,41.9934081]},"n1821015116":{"id":"n1821015116","loc":[-85.6104471,41.9724971]},"n1821015118":{"id":"n1821015118","loc":[-85.5406091,42.0192162]},"n1821015120":{"id":"n1821015120","loc":[-85.589955,41.9888429]},"n1821015121":{"id":"n1821015121","loc":[-85.5598821,42.0092304]},"n1821015122":{"id":"n1821015122","loc":[-85.545598,42.0144097]},"n1821015123":{"id":"n1821015123","loc":[-85.5649528,42.0079965]},"n1821015125":{"id":"n1821015125","loc":[-85.5883993,41.9917814]},"n1821015126":{"id":"n1821015126","loc":[-85.5295785,42.0239967]},"n1821015129":{"id":"n1821015129","loc":[-85.5648723,42.0078809]},"n1821015132":{"id":"n1821015132","loc":[-85.564989,42.0081103]},"n1821015133":{"id":"n1821015133","loc":[-85.5946127,41.9800841]},"n1821015134":{"id":"n1821015134","loc":[-85.583448,42.0019078]},"n1821015135":{"id":"n1821015135","loc":[-85.5905934,41.9871842]},"n1821015137":{"id":"n1821015137","loc":[-85.610608,41.9704752]},"n1821015138":{"id":"n1821015138","loc":[-85.5752257,42.0052939]},"n1821015139":{"id":"n1821015139","loc":[-85.5893864,41.9943491]},"n1821015140":{"id":"n1821015140","loc":[-85.5426247,42.0169866]},"n1821015141":{"id":"n1821015141","loc":[-85.562001,42.0074526]},"n1821015142":{"id":"n1821015142","loc":[-85.5212046,42.0301094]},"n1821015143":{"id":"n1821015143","loc":[-85.602214,41.9784531]},"n1821015144":{"id":"n1821015144","loc":[-85.5858687,41.9948293]},"n1821015145":{"id":"n1821015145","loc":[-85.5608477,42.0074805]},"n1821015146":{"id":"n1821015146","loc":[-85.5651607,42.0083614]},"n1821015147":{"id":"n1821015147","loc":[-85.5288288,42.0242495]},"n1821015149":{"id":"n1821015149","loc":[-85.5450334,42.0146989]},"n1821015151":{"id":"n1821015151","loc":[-85.5578275,42.0092304]},"n1821015154":{"id":"n1821015154","loc":[-85.6056634,41.9724511]},"n1821015155":{"id":"n1821015155","loc":[-85.5902179,41.9852742]},"n1821015156":{"id":"n1821015156","loc":[-85.5156256,42.0387157]},"n1821015157":{"id":"n1821015157","loc":[-85.5734433,42.0059459]},"n1821015158":{"id":"n1821015158","loc":[-85.6050773,41.9731273]},"n1821015160":{"id":"n1821015160","loc":[-85.5223419,42.0275233]},"n1821015163":{"id":"n1821015163","loc":[-85.6053562,41.972525]},"n1821015164":{"id":"n1821015164","loc":[-85.5850412,41.9946082]},"n1821015165":{"id":"n1821015165","loc":[-85.5359031,42.0186326]},"n1821015166":{"id":"n1821015166","loc":[-85.5608745,42.0077635]},"n1821015169":{"id":"n1821015169","loc":[-85.572876,42.0073189]},"n1821015171":{"id":"n1821015171","loc":[-85.5875424,41.9919188]},"n1821015172":{"id":"n1821015172","loc":[-85.5240116,42.0272581]},"n1821015173":{"id":"n1821015173","loc":[-85.5318369,42.0236818]},"n1821015174":{"id":"n1821015174","loc":[-85.566888,42.0086923]},"n1821015175":{"id":"n1821015175","loc":[-85.5931522,41.9850669]},"n1821015176":{"id":"n1821015176","loc":[-85.5604842,42.0093199]},"n1821015177":{"id":"n1821015177","loc":[-85.5868168,41.9927543]},"n1821015178":{"id":"n1821015178","loc":[-85.6052275,41.9732549]},"n1821015179":{"id":"n1821015179","loc":[-85.5910118,41.9900431]},"n1821015182":{"id":"n1821015182","loc":[-85.5610032,42.0082897]},"n1821015183":{"id":"n1821015183","loc":[-85.5425443,42.0179431]},"n1821015184":{"id":"n1821015184","loc":[-85.5843277,42.0014055]},"n1821015186":{"id":"n1821015186","loc":[-85.5733307,42.0063564]},"n1821015188":{"id":"n1821015188","loc":[-85.5277385,42.0248694]},"n1821015189":{"id":"n1821015189","loc":[-85.5558427,42.0108168]},"n1821015190":{"id":"n1821015190","loc":[-85.5650587,42.0082618]},"n1821015191":{"id":"n1821015191","loc":[-85.5660351,42.0088278]},"n1821015192":{"id":"n1821015192","loc":[-85.5849768,41.9980049]},"n1821015194":{"id":"n1821015194","loc":[-85.5359139,42.0188199]},"n1821015195":{"id":"n1821015195","loc":[-85.593238,41.9849194]},"n1821015197":{"id":"n1821015197","loc":[-85.5850841,41.9983239]},"n1821015199":{"id":"n1821015199","loc":[-85.5983396,41.9794283]},"n1821015204":{"id":"n1821015204","loc":[-85.5452801,42.0145355]},"n1821015205":{"id":"n1821015205","loc":[-85.5340685,42.0218407]},"n1821015207":{"id":"n1821015207","loc":[-85.5773272,42.0034186]},"n1821015209":{"id":"n1821015209","loc":[-85.5535212,42.0132419]},"n1821015211":{"id":"n1821015211","loc":[-85.6107703,41.9706045]},"n1821015212":{"id":"n1821015212","loc":[-85.6030066,41.9758193]},"n1821015213":{"id":"n1821015213","loc":[-85.5359943,42.0184213]},"n1821015214":{"id":"n1821015214","loc":[-85.5922993,41.9813305]},"n1821015215":{"id":"n1821015215","loc":[-85.5672689,42.0080465]},"n1821015217":{"id":"n1821015217","loc":[-85.5160494,42.0365682]},"n1821015218":{"id":"n1821015218","loc":[-85.5401142,42.0190351]},"n1821015219":{"id":"n1821015219","loc":[-85.5607632,42.0092282]},"n1821015220":{"id":"n1821015220","loc":[-85.5866197,41.9947894]},"n1821015221":{"id":"n1821015221","loc":[-85.6017889,41.9765132]},"n1821015222":{"id":"n1821015222","loc":[-85.5595978,42.009059]},"n1821015226":{"id":"n1821015226","loc":[-85.5871494,41.9929018]},"n1821015227":{"id":"n1821015227","loc":[-85.5857708,41.9998866]},"n1821015228":{"id":"n1821015228","loc":[-85.5317135,42.0238094]},"n1821015231":{"id":"n1821015231","loc":[-85.5733521,42.0061372]},"n1821015233":{"id":"n1821015233","loc":[-85.5855991,42.0001936]},"n1821015234":{"id":"n1821015234","loc":[-85.5213924,42.029962]},"n1821015235":{"id":"n1821015235","loc":[-85.6052221,41.9726567]},"n1821015236":{"id":"n1821015236","loc":[-85.5763723,42.0035422]},"n1821015237":{"id":"n1821015237","loc":[-85.5858512,41.9966215]},"n1821015238":{"id":"n1821015238","loc":[-85.567061,42.008439]},"n1821015239":{"id":"n1821015239","loc":[-85.5250563,42.0269057]},"n1821015240":{"id":"n1821015240","loc":[-85.5347551,42.0214263]},"n1821015241":{"id":"n1821015241","loc":[-85.6098463,41.9707066]},"n1821015242":{"id":"n1821015242","loc":[-85.5676927,42.0076519]},"n1821015243":{"id":"n1821015243","loc":[-85.516775,42.0322669]},"n1821015244":{"id":"n1821015244","loc":[-85.5762275,42.0036538]},"n1821015245":{"id":"n1821015245","loc":[-85.5583639,42.0090949]},"n1821015246":{"id":"n1821015246","loc":[-85.5554041,42.0106432]},"n1821015247":{"id":"n1821015247","loc":[-85.5973364,41.9776099]},"n1821015248":{"id":"n1821015248","loc":[-85.6098945,41.9717513]},"n1821015249":{"id":"n1821015249","loc":[-85.6045315,41.9751511]},"n1821015250":{"id":"n1821015250","loc":[-85.5579938,42.0092264]},"n1821015253":{"id":"n1821015253","loc":[-85.6058873,41.9724652]},"n1821015254":{"id":"n1821015254","loc":[-85.5869456,41.9947517]},"n1821015255":{"id":"n1821015255","loc":[-85.5936565,41.9823713]},"n1821015256":{"id":"n1821015256","loc":[-85.5218269,42.0278102]},"n1821015258":{"id":"n1821015258","loc":[-85.5887802,41.9905534]},"n1821015259":{"id":"n1821015259","loc":[-85.5901924,41.9904515]},"n1821015263":{"id":"n1821015263","loc":[-85.5249222,42.0255787]},"n1821015265":{"id":"n1821015265","loc":[-85.5175206,42.0321672]},"n1821015266":{"id":"n1821015266","loc":[-85.5275722,42.0254034]},"n1821015267":{"id":"n1821015267","loc":[-85.6016226,41.9765451]},"n1821015269":{"id":"n1821015269","loc":[-85.5569316,42.011032]},"n1821015271":{"id":"n1821015271","loc":[-85.6010714,41.9785209]},"n1821015272":{"id":"n1821015272","loc":[-85.6050666,41.9729917]},"n1821015273":{"id":"n1821015273","loc":[-85.5891235,41.99529]},"n1821015274":{"id":"n1821015274","loc":[-85.515454,42.0376439]},"n1821015276":{"id":"n1821015276","loc":[-85.5776021,42.0034443]},"n1821015277":{"id":"n1821015277","loc":[-85.6041707,41.9751453]},"n1821015278":{"id":"n1821015278","loc":[-85.5444701,42.0167435]},"n1821015280":{"id":"n1821015280","loc":[-85.5923274,41.9852202]},"n1821015283":{"id":"n1821015283","loc":[-85.5893649,41.9900271]},"n1821015284":{"id":"n1821015284","loc":[-85.5933453,41.9804412]},"n1821015285":{"id":"n1821015285","loc":[-85.5247237,42.026017]},"n1821015286":{"id":"n1821015286","loc":[-85.5286182,42.0242477]},"n1821015287":{"id":"n1821015287","loc":[-85.5904003,41.9888549]},"n1821015288":{"id":"n1821015288","loc":[-85.6062146,41.9739369]},"n1821015290":{"id":"n1821015290","loc":[-85.5762596,42.0052602]},"n1821015292":{"id":"n1821015292","loc":[-85.5849715,41.9975465]},"n1821015293":{"id":"n1821015293","loc":[-85.585229,42.0006241]},"n1821015294":{"id":"n1821015294","loc":[-85.5926922,41.9805946]},"n1821015295":{"id":"n1821015295","loc":[-85.5703387,42.0089133]},"n1821015299":{"id":"n1821015299","loc":[-85.5789955,42.0038611]},"n1821015301":{"id":"n1821015301","loc":[-85.6072888,41.9721918]},"n1821015302":{"id":"n1821015302","loc":[-85.5356349,42.0200992]},"n1821015304":{"id":"n1821015304","loc":[-85.5891772,41.994066]},"n1821015306":{"id":"n1821015306","loc":[-85.606295,41.9744952]},"n1821015307":{"id":"n1821015307","loc":[-85.538871,42.0186583]},"n1821015308":{"id":"n1821015308","loc":[-85.587997,41.994971]},"n1821015311":{"id":"n1821015311","loc":[-85.606869,41.9725809]},"n1821015312":{"id":"n1821015312","loc":[-85.5171974,42.0339943]},"n1821015314":{"id":"n1821015314","loc":[-85.5327435,42.0220479]},"n1821015315":{"id":"n1821015315","loc":[-85.5383439,42.0187282]},"n1821015316":{"id":"n1821015316","loc":[-85.5248095,42.0263119]},"n1821015318":{"id":"n1821015318","loc":[-85.5732502,42.0073051]},"n1821015319":{"id":"n1821015319","loc":[-85.5924226,41.9852663]},"n1821015321":{"id":"n1821015321","loc":[-85.5179001,42.0353052]},"n1821015322":{"id":"n1821015322","loc":[-85.5456771,42.0162413]},"n1821015323":{"id":"n1821015323","loc":[-85.5936618,41.9829096]},"n1821015325":{"id":"n1821015325","loc":[-85.5656931,42.0086582]},"n1821015326":{"id":"n1821015326","loc":[-85.5448456,42.0150975]},"n1821015327":{"id":"n1821015327","loc":[-85.5220039,42.027615]},"n1821015329":{"id":"n1821015329","loc":[-85.517884,42.0354885]},"n1821015330":{"id":"n1821015330","loc":[-85.5576666,42.0101671]},"n1821015332":{"id":"n1821015332","loc":[-85.5368754,42.0181402]},"n1821015333":{"id":"n1821015333","loc":[-85.5367078,42.0181145]},"n1821015334":{"id":"n1821015334","loc":[-85.5903909,41.9904316]},"n1821015335":{"id":"n1821015335","loc":[-85.5430767,42.0163587]},"n1821015336":{"id":"n1821015336","loc":[-85.5277492,42.0252878]},"n1821015337":{"id":"n1821015337","loc":[-85.5312146,42.0236898]},"n1821015338":{"id":"n1821015338","loc":[-85.5886568,41.991614]},"n1821015339":{"id":"n1821015339","loc":[-85.5782498,42.0040883]},"n1821015341":{"id":"n1821015341","loc":[-85.562233,42.0076457]},"n1821015342":{"id":"n1821015342","loc":[-85.588626,41.9952479]},"n1821015343":{"id":"n1821015343","loc":[-85.5762865,42.005033]},"n1821015344":{"id":"n1821015344","loc":[-85.5850841,41.9971478]},"n1821015346":{"id":"n1821015346","loc":[-85.5643144,42.0076936]},"n1821015347":{"id":"n1821015347","loc":[-85.5164893,42.0359467]},"n1821015348":{"id":"n1821015348","loc":[-85.5906846,41.9903541]},"n1821015349":{"id":"n1821015349","loc":[-85.557688,42.0107769]},"n1821015350":{"id":"n1821015350","loc":[-85.5363698,42.0181424]},"n1821015351":{"id":"n1821015351","loc":[-85.5939636,41.9801918]},"n1821015352":{"id":"n1821015352","loc":[-85.5524041,42.0131644]},"n1821015354":{"id":"n1821015354","loc":[-85.5308606,42.0236221]},"n1821015355":{"id":"n1821015355","loc":[-85.5877449,41.9932367]},"n1821015356":{"id":"n1821015356","loc":[-85.519885,42.0318586]},"n1821015357":{"id":"n1821015357","loc":[-85.5454035,42.0168431]},"n1821015358":{"id":"n1821015358","loc":[-85.5970629,41.9781881]},"n1821015359":{"id":"n1821015359","loc":[-85.5932541,41.9844767]},"n1821015360":{"id":"n1821015360","loc":[-85.5970736,41.9778252]},"n1821015361":{"id":"n1821015361","loc":[-85.537031,42.0181601]},"n1821015362":{"id":"n1821015362","loc":[-85.5548355,42.0105156]},"n1821015363":{"id":"n1821015363","loc":[-85.5168648,42.0336158]},"n1821015365":{"id":"n1821015365","loc":[-85.5870435,41.9919507]},"n1821015366":{"id":"n1821015366","loc":[-85.5719681,42.0075443]},"n1821015367":{"id":"n1821015367","loc":[-85.5969985,41.9780446]},"n1821015368":{"id":"n1821015368","loc":[-85.5926761,41.98528]},"n1821015369":{"id":"n1821015369","loc":[-85.5224009,42.0293444]},"n1821015371":{"id":"n1821015371","loc":[-85.518737,42.0322651]},"n1821015372":{"id":"n1821015372","loc":[-85.6064573,41.9726465]},"n1821015373":{"id":"n1821015373","loc":[-85.5201103,42.0313088]},"n1821015375":{"id":"n1821015375","loc":[-85.5378182,42.0186844]},"n1821015376":{"id":"n1821015376","loc":[-85.6109741,41.9706882]},"n1821015377":{"id":"n1821015377","loc":[-85.5993333,41.9785488]},"n1821015378":{"id":"n1821015378","loc":[-85.5889787,41.9907368]},"n1821015380":{"id":"n1821015380","loc":[-85.6060161,41.9737375]},"n1821015381":{"id":"n1821015381","loc":[-85.5743016,42.0053679]},"n1821015382":{"id":"n1821015382","loc":[-85.6014724,41.9776099]},"n1821015383":{"id":"n1821015383","loc":[-85.5574426,42.0091644]},"n1821015385":{"id":"n1821015385","loc":[-85.5208613,42.0309302]},"n1821015386":{"id":"n1821015386","loc":[-85.5919023,41.9837789]},"n1821015387":{"id":"n1821015387","loc":[-85.5455484,42.0160221]},"n1821015392":{"id":"n1821015392","loc":[-85.5801757,42.0028964]},"n1821015395":{"id":"n1821015395","loc":[-85.5493785,42.0139974]},"n1821015396":{"id":"n1821015396","loc":[-85.5449475,42.015488]},"n1821015398":{"id":"n1821015398","loc":[-85.611123,41.9706627]},"n1821015400":{"id":"n1821015400","loc":[-85.5935706,41.9822477]},"n1821015401":{"id":"n1821015401","loc":[-85.5724254,42.0073508]},"n1821015403":{"id":"n1821015403","loc":[-85.5486812,42.0143442]},"n1821015404":{"id":"n1821015404","loc":[-85.5161835,42.0327711]},"n1821015406":{"id":"n1821015406","loc":[-85.5921705,41.9851107]},"n1821015407":{"id":"n1821015407","loc":[-85.531912,42.0234069]},"n1821015410":{"id":"n1821015410","loc":[-85.5292566,42.024176]},"n1821015411":{"id":"n1821015411","loc":[-85.5845316,41.9948315]},"n1821015413":{"id":"n1821015413","loc":[-85.5217947,42.0280413]},"n1821015414":{"id":"n1821015414","loc":[-85.5527367,42.013272]},"n1821015415":{"id":"n1821015415","loc":[-85.5191179,42.0321973]},"n1821015416":{"id":"n1821015416","loc":[-85.5540241,42.0128655]},"n1821015418":{"id":"n1821015418","loc":[-85.5272892,42.0254849]},"n1821015419":{"id":"n1821015419","loc":[-85.5449744,42.016867]},"n1821015420":{"id":"n1821015420","loc":[-85.5852665,41.9986787]},"n1821015421":{"id":"n1821015421","loc":[-85.6102701,41.972186]},"n1821015423":{"id":"n1821015423","loc":[-85.6026365,41.9764972]},"n1821015427":{"id":"n1821015427","loc":[-85.5898692,41.9841498]},"n1821015429":{"id":"n1821015429","loc":[-85.5422546,42.0183855]},"n1821015430":{"id":"n1821015430","loc":[-85.5866505,41.9925549]},"n1821015431":{"id":"n1821015431","loc":[-85.5234376,42.0273577]},"n1821015432":{"id":"n1821015432","loc":[-85.6096746,41.9727284]},"n1821015433":{"id":"n1821015433","loc":[-85.5824891,42.0021567]},"n1821015434":{"id":"n1821015434","loc":[-85.5923905,41.9841139]},"n1821015435":{"id":"n1821015435","loc":[-85.5874565,41.9948014]},"n1821015437":{"id":"n1821015437","loc":[-85.6055279,41.9734423]},"n1821015438":{"id":"n1821015438","loc":[-85.5299379,42.0237376]},"n1821015439":{"id":"n1821015439","loc":[-85.5155022,42.0383651]},"n1821015442":{"id":"n1821015442","loc":[-85.527422,42.0254711]},"n1821015443":{"id":"n1821015443","loc":[-85.5920699,41.9849291]},"n1821015444":{"id":"n1821015444","loc":[-85.5639711,42.0077494]},"n1821015445":{"id":"n1821015445","loc":[-85.5162586,42.0361777]},"n1821015446":{"id":"n1821015446","loc":[-85.5220039,42.029695]},"n1821015448":{"id":"n1821015448","loc":[-85.5176641,42.0356956]},"n1821015449":{"id":"n1821015449","loc":[-85.5930556,41.9841577]},"n1821015451":{"id":"n1821015451","loc":[-85.5320783,42.0228848]},"n1821015452":{"id":"n1821015452","loc":[-85.5170096,42.0357235]},"n1821015453":{"id":"n1821015453","loc":[-85.5571355,42.009613]},"n1821015454":{"id":"n1821015454","loc":[-85.5609979,42.009059]},"n1821015455":{"id":"n1821015455","loc":[-85.6097336,41.9708342]},"n1821015456":{"id":"n1821015456","loc":[-85.5884476,41.9904218]},"w170843846":{"id":"w170843846","tags":{"waterway":"river"},"nodes":["n1819790555","n1819790762","n1819790547","n1819790618","n1819790898","n1819790796","n1819790534","n1819790543","n1819790541","n1819790687","n1819790877","n1819790811","n1819790670"]},"w209083541":{"id":"w209083541","tags":{"name":"Portage River","waterway":"river"},"nodes":["n1821014848","n1821015156","n1821015439","n1821014763","n1821014824","n1821015274","n1821014764","n1821014791","n1821014957","n1821015217","n1821015445","n1821015347","n1821014893","n1821015452","n1821015017","n1821015448","n1821014968","n1821015329","n1821015321","n1821014992","n1821014948","n1821014757","n1821014983","n1821015312","n1821015363","n1821014924","n1821014873","n1821014932","n1821014668","n1821015404","n1821014716","n1821015243","n1821015265","n1821014710","n1821015371","n1821015415","n1821014870","n1821015356","n1821015373","n1821014681","n1821014714","n1821015385","n1821014911","n1821015057","n1821014867","n1821014998","n1821015142","n1821015234","n1821015446","n1821014862","n1821015369","n1821014945","n1821015003","n1821014667","n1821015413","n1821015256","n1821015327","n1821015160","n1821014907","n1821015431","n1821015172","n1821015034","n1821014741","n1821015033","n1821015239","n1821015007","n1821015316","n1821015285","n1821014633","n1821015263","n1821015069","n1821014846","n1821014779","n1821015011","n1821015012","n1821014845","n1821015418","n1821015442","n1821015266","n1821015336","n1821014755","n1821015188","n1821014925","n1821014816","n1821014869","n1821014967","n1821015286","n1821015147","n1821015410","n1821015126","n1821015438","n1821015018","n1821015354","n1821015337","n1821014766","n1821014740","n1821015228","n1821015173","n1821015407","n1821015076","n1821015451","n1821015024","n1821015314","n1821014784","n1821015045","n1821014735","n1821015205","n1821014986","n1821015240","n1821015098","n1821014825","n1821015302","n1821014918","n1821014718","n1821014896","n1821014853","n1821015194","n1821015165","n1821015213","n1821014991","n1821015350","n1821015333","n1821015332","n1821015361","n1821015060","n1821014914","n1821015375","n1821015315","n1821015307","n1821014906","n1821014751","n1821014666","n1821015218","n1821014817","n1821015118","n1821014674","n1821015038","n1821014973","n1821015429","n1821015183","n1821015046","n1821014803","n1821015140","n1821015009","n1821014749","n1821015335","n1821014711","n1821014854","n1821015278","n1821015419","n1821014648","n1821015357","n1821014637","n1821014988","n1821015322","n1821015387","n1821015042","n1821014833","n1821015396","n1821015326","n1821014691","n1821015149","n1821015204","n1821015122","n1821014782","n1821014982","n1821014921","n1821014936","n1821014969","n1821014881","n1821015403","n1821014805","n1821015395","n1821014892","n1821014826","n1821014844","n1821015107","n1821015014","n1821014955","n1821015352","n1821015414","n1821014746","n1821015209","n1821014770","n1821015416","n1821014661","n1821014857","n1821014814","n1821014754","n1821014721","n1821014727","n1821015362","n1821015029","n1821015246","n1821015189","n1821014627","n1821015269","n1821014808","n1821014962","n1821015349","n1821015041","n1821014722","n1821015330","n1821015453","n1821015067","n1821014643","n1821014802","n1821015383","n1821015151","n1821015250","n1821015245","n1821014772","n1821014899","n1821015222","n1821015121","n1821014951","n1821015176","n1821015219","n1821015454","n1821014972","n1821014917","n1821015182","n1821015166","n1821015145","n1821014910","n1821015082","n1821014678","n1821014806","n1821015141","n1821015341","n1821014788","n1821015097","n1821014995","n1821015444","n1821015346","n1821015101","n1821015129","n1821015123","n1821015132","n1821015190","n1821015146","n1821015325","n1821015191","n1821015072","n1821015100","n1821015174","n1821015238","n1821015215","n1821014700","n1821015242","n1821014841","n1821014905","n1821014874","n1821014883","n1821014729","n1821014866","n1821014828","n1821015295","n1821014931","n1821014859","n1821014912","n1821014783","n1821014752","n1821014961","n1821015366","n1821015401","n1821015169","n1821015318","n1821014996","n1821014747","n1821014963","n1821014670","n1821015186","n1821015231","n1821015157","n1821014812","n1821015381","n1821014887","n1821015138","n1821014704","n1821014787","n1821014922","n1821015290","n1821015343","n1821014651","n1821014980","n1821014960","n1821015244","n1821015236","n1821015006","n1821014694","n1821014759","n1821015207","n1821015276","n1821015065","n1821014863","n1821014660","n1821014902","n1821014645","n1821015339","n1821014871","n1821015096","n1821015299","n1821014798","n1821014638","n1821015392","n1821014835","n1821014762","n1821014642","n1821015433","n1821014786","n1821015134","n1821014855","n1821015184","n1821014850","n1821015293","n1821015233","n1821015227","n1821014876","n1821014985","n1821014843","n1821015420","n1821015197","n1821015192","n1821015292","n1821015344","n1821014742","n1821014726","n1821015237","n1821014796","n1821014908","n1821014975","n1821014769","n1821014688","n1821014860","n1821014895","n1821014676","n1821015411","n1821014736","n1821015164","n1821014647","n1821015144","n1821014919","n1821015220","n1821015254","n1821015435","n1821015308","n1821015342","n1821014830","n1821015273","n1821014658","n1821014781","n1821015087","n1821015139","n1821015304","n1821014839","n1821015048","n1821015115","n1821015355","n1821015226","n1821015177","n1821015430","n1821014965","n1821014725","n1821015365","n1821015171","n1821015073","n1821015125","n1821015338","n1821015111","n1821014950","n1821015378","n1821015258","n1821015456","n1821015106","n1821014832","n1821014888","n1821014795","n1821014872","n1821014810","n1821014705","n1821014804","n1821014820","n1821015283","n1821014938","n1821014689","n1821015259","n1821015334","n1821015348","n1821014635","n1821015179","n1821014864","n1821014890","n1821015020","n1821014898","n1821015287","n1821015120","n1821014984","n1821014743","n1821014790","n1821014765","n1821014777","n1821015095","n1821014653","n1821015135","n1821014836","n1821014964","n1821014974","n1821014636","n1821014682","n1821014663","n1821014665","n1821015109","n1821015155","n1821014930","n1821014669","n1821015004","n1821015427","n1821014916","n1821015093","n1821015086","n1821015386","n1821014799","n1821014913","n1821015434","n1821014728","n1821014900","n1821015068","n1821015039","n1821015443","n1821015406","n1821015280","n1821015319","n1821015368","n1821014774","n1821015090","n1821015175","n1821015195","n1821014687","n1821015359","n1821015449","n1821014956","n1821014838","n1821014768","n1821014698","n1821015323","n1821014756","n1821015255","n1821015400","n1821014717","n1821014868","n1821014778","n1821015214","n1821014944","n1821014697","n1821014671","n1821014928","n1821015294","n1821014822","n1821015284","n1821015351","n1821015022","n1821015133","n1821014644","n1821015010","n1821014625","n1821014657","n1821014946","n1821015099","n1821015114","n1821014629","n1821014865","n1821014997","n1821014926","n1821014933","n1821015199","n1821014819","n1821015080","n1821014692","n1821014677","n1821015358","n1821015367","n1821015360","n1821015105","n1821015247","n1821015005","n1821014809","n1821014794","n1821014761","n1821014879","n1821014801","n1821015377","n1821015059","n1821014730","n1821015050","n1821015271","n1821015143","n1821014989","n1821015019","n1821014672","n1821014649","n1821014684","n1821014703","n1821015021","n1821015382","n1821014842","n1821014720","n1821014847","n1821015104","n1821014987","n1821014886","n1821015267","n1821015221","n1821015015","n1821015423","n1821014954","n1821014903","n1821014939","n1821015212","n1821014789","n1821014712","n1821014708","n1821015078","n1821015277","n1821015249","n1821014646","n1821014793","n1821015053","n1821014707","n1821015306","n1821015112","n1821015288","n1821015380","n1821015437","n1821015178","n1821015158","n1821015272","n1821015235","n1821015163","n1821015154","n1821015253","n1821014632","n1821015372","n1821015103","n1821015311","n1821015301","n1821014885","n1821014811","n1821014977","n1821015051","n1821014942","n1821014745","n1821015432","n1821015075","n1821014664","n1821014695","n1821015116","n1821014639","n1821015421","n1821015248","n1821014758","n1821014834","n1821015083","n1821015455","n1821015241","n1821015108","n1821014713","n1821015137","n1821015055","n1821015211","n1821014904","n1821015376","n1821015398","n1821014771","n1821014840","n1821015062","n1819790554","n1819790560","n1819790767","n1819790696","n1819790706","n1819790606","n1819790607","n1819790544","n1819790779","n1819790760","n1819790926","n1819790927","n1819790647","n1819790657","n1819790649","n1819790679","n1819790915","n1819790739","n1819790549","n1819790671","n1819790686","n1819790798","n1819790791","n1819790563","n1819790720","n1819790704","n1819790795","n1819790836","n1819790622","n1819790615","n1819790654","n1819790931","n1819790595","n1819790753","n1819790612","n1819790623","n1819790564","n1819790552","n1819790645","n1819790625","n1819790605","n1819790668","n1819790731","n1819790718","n1819790781","n1819790665","n1819790659","n1819790726","n1819790642","n1819790854","n1819790697","n1819790867","n1819790833","n1819790555","n1819790774","n1819790881","n1819790530","n1819790909","n1819790891","n1819790590","n1819790738","n1819790609","n1819790528","n1819790674","n1819790583","n1819790559","n1819790863","n1819790912","n1819790685","n1819790913"]},"n185955128":{"id":"n185955128","loc":[-85.6189367,41.9519432]},"n185948818":{"id":"n185948818","loc":[-85.616755,41.952231]},"n185978819":{"id":"n185978819","loc":[-85.616773,41.954737]},"n185978821":{"id":"n185978821","loc":[-85.616699,41.954742]},"n2138420714":{"id":"n2138420714","loc":[-85.6176304,41.9515154]},"n2138420715":{"id":"n2138420715","loc":[-85.6177355,41.9515717]},"n2138420716":{"id":"n2138420716","loc":[-85.6192901,41.951573]},"n2138420718":{"id":"n2138420718","loc":[-85.6171481,41.9513579]},"n2138420719":{"id":"n2138420719","loc":[-85.6165981,41.9519199]},"n2138420720":{"id":"n2138420720","loc":[-85.6165719,41.9519922]},"n2138420721":{"id":"n2138420721","loc":[-85.6165832,41.9520757]},"n2138420722":{"id":"n2138420722","loc":[-85.6166355,41.9521453]},"n2138420723":{"id":"n2138420723","loc":[-85.6169161,41.9522788]},"n2138420724":{"id":"n2138420724","loc":[-85.6170882,41.9522538]},"n2138420725":{"id":"n2138420725","loc":[-85.6189204,41.9514674]},"n2138420726":{"id":"n2138420726","loc":[-85.6180346,41.9514735]},"n2138420727":{"id":"n2138420727","loc":[-85.6180362,41.9515719]},"n2138420728":{"id":"n2138420728","loc":[-85.6189204,41.9515727]},"n2138420744":{"id":"n2138420744","loc":[-85.618919,41.9519571]},"n2138420745":{"id":"n2138420745","loc":[-85.6194575,41.9522374]},"n2138420746":{"id":"n2138420746","loc":[-85.6181777,41.9536179]},"n2138420747":{"id":"n2138420747","loc":[-85.6176582,41.9533658]},"n2138420748":{"id":"n2138420748","loc":[-85.6179871,41.9530242]},"n2138420749":{"id":"n2138420749","loc":[-85.618429,41.9532476]},"n2138420750":{"id":"n2138420750","loc":[-85.6185538,41.9531194]},"n2138420751":{"id":"n2138420751","loc":[-85.6180765,41.9528677]},"n2138420752":{"id":"n2138420752","loc":[-85.6180394,41.9528855]},"n2138420753":{"id":"n2138420753","loc":[-85.6193752,41.9521695]},"n2138420754":{"id":"n2138420754","loc":[-85.6181374,41.9535376]},"n2138420755":{"id":"n2138420755","loc":[-85.6179898,41.9535545]},"n2138420756":{"id":"n2138420756","loc":[-85.6177286,41.9534228]},"n2138420757":{"id":"n2138420757","loc":[-85.6181011,41.9530292]},"n2138420759":{"id":"n2138420759","loc":[-85.6185158,41.9531194]},"n2138420760":{"id":"n2138420760","loc":[-85.6191318,41.9520425]},"n2138420761":{"id":"n2138420761","loc":[-85.6182348,41.9529815]},"n2138420762":{"id":"n2138420762","loc":[-85.6184853,41.9524248]},"n2138420763":{"id":"n2138420763","loc":[-85.6186764,41.9525193]},"n2138420764":{"id":"n2138420764","loc":[-85.6189421,41.9526483]},"n2138420765":{"id":"n2138420765","loc":[-85.6182875,41.9531222]},"n2138420766":{"id":"n2138420766","loc":[-85.6179141,41.9535163]},"n2138420767":{"id":"n2138420767","loc":[-85.6178363,41.9535735]},"n185948824":{"id":"n185948824","loc":[-85.6165667,41.9529715]},"n2138420758":{"id":"n2138420758","loc":[-85.6184408,41.953201]},"n2138422349":{"id":"n2138422349","loc":[-85.6175136,41.9533346]},"n2138422350":{"id":"n2138422350","loc":[-85.6171867,41.9531679]},"n2138422351":{"id":"n2138422351","loc":[-85.61722,41.9531305]},"n2138422352":{"id":"n2138422352","loc":[-85.6171889,41.9531158]},"n2138422353":{"id":"n2138422353","loc":[-85.6171733,41.9531284]},"n2138422354":{"id":"n2138422354","loc":[-85.616765,41.9529207]},"n2138422355":{"id":"n2138422355","loc":[-85.6167565,41.9529355]},"n2138422356":{"id":"n2138422356","loc":[-85.6164772,41.9527911]},"n2138422357":{"id":"n2138422357","loc":[-85.6168227,41.9524261]},"n2138422358":{"id":"n2138422358","loc":[-85.6171913,41.9526158]},"n2138422359":{"id":"n2138422359","loc":[-85.6172403,41.9525589]},"n2138422360":{"id":"n2138422360","loc":[-85.6172097,41.952542]},"n2138422361":{"id":"n2138422361","loc":[-85.6173948,41.9523512]},"n2138422362":{"id":"n2138422362","loc":[-85.6174256,41.9523678]},"n2138422363":{"id":"n2138422363","loc":[-85.6174831,41.9523086]},"n2138422364":{"id":"n2138422364","loc":[-85.6173316,41.9522289]},"n2138422365":{"id":"n2138422365","loc":[-85.6174507,41.9521024]},"n2138422366":{"id":"n2138422366","loc":[-85.6174773,41.9521155]},"n2138422367":{"id":"n2138422367","loc":[-85.6176577,41.9519232]},"n2138422368":{"id":"n2138422368","loc":[-85.6176336,41.9519105]},"n2138422369":{"id":"n2138422369","loc":[-85.617747,41.9517861]},"n2138422370":{"id":"n2138422370","loc":[-85.6182675,41.9520559]},"n2138422371":{"id":"n2138422371","loc":[-85.6182105,41.9521219]},"n2138422372":{"id":"n2138422372","loc":[-85.6183863,41.9522203]},"n2138422373":{"id":"n2138422373","loc":[-85.6180984,41.9525266]},"n2138422374":{"id":"n2138422374","loc":[-85.6179159,41.9524295]},"n2138422375":{"id":"n2138422375","loc":[-85.617854,41.9524979]},"n2138422376":{"id":"n2138422376","loc":[-85.6177686,41.9524531]},"n2138422377":{"id":"n2138422377","loc":[-85.6174716,41.9527765]},"n2138422378":{"id":"n2138422378","loc":[-85.6178545,41.9529756]},"n2138425424":{"id":"n2138425424","loc":[-85.6171736,41.9536385]},"n2138425425":{"id":"n2138425425","loc":[-85.6180159,41.9535782]},"n2138425426":{"id":"n2138425426","loc":[-85.6181068,41.9536282]},"n2138425427":{"id":"n2138425427","loc":[-85.6180673,41.9542678]},"n2138425428":{"id":"n2138425428","loc":[-85.6178636,41.9542634]},"n2138425429":{"id":"n2138425429","loc":[-85.6176204,41.9542046]},"n2138425430":{"id":"n2138425430","loc":[-85.6174366,41.9541031]},"n2138425431":{"id":"n2138425431","loc":[-85.6172942,41.9539781]},"n2138425432":{"id":"n2138425432","loc":[-85.6172171,41.9538399]},"n2138425433":{"id":"n2138425433","loc":[-85.6168138,41.9543266]},"n2138425434":{"id":"n2138425434","loc":[-85.6167779,41.9538098]},"n2138425435":{"id":"n2138425435","loc":[-85.6165849,41.9537073]},"n2138425441":{"id":"n2138425441","loc":[-85.616458,41.9543184]},"n2138425442":{"id":"n2138425442","loc":[-85.6166428,41.954345]},"n2138425445":{"id":"n2138425445","loc":[-85.6181332,41.9514117]},"n2138425446":{"id":"n2138425446","loc":[-85.6183263,41.9514111]},"n2138425447":{"id":"n2138425447","loc":[-85.6185033,41.9514102]},"n2138425449":{"id":"n2138425449","loc":[-85.6186809,41.9514093]},"n2138425451":{"id":"n2138425451","loc":[-85.6188681,41.9514082]},"n2138436008":{"id":"n2138436008","loc":[-85.6170474,41.9513604]},"n2138436009":{"id":"n2138436009","loc":[-85.6164937,41.9519586]},"n2138436010":{"id":"n2138436010","loc":[-85.616497,41.9520725]},"n2138436011":{"id":"n2138436011","loc":[-85.6165654,41.9521645]},"n2138436012":{"id":"n2138436012","loc":[-85.6166631,41.9522178]},"n2138436013":{"id":"n2138436013","loc":[-85.6167327,41.9522554]},"n2138436014":{"id":"n2138436014","loc":[-85.6172383,41.9525125]},"n2138439319":{"id":"n2138439319","loc":[-85.6170432,41.9524057]},"n2138439320":{"id":"n2138439320","loc":[-85.617691,41.9517107]},"n2138439321":{"id":"n2138439321","loc":[-85.6177727,41.9516794]},"n2138439322":{"id":"n2138439322","loc":[-85.619085,41.9516811]},"n2138439323":{"id":"n2138439323","loc":[-85.6179432,41.952895]},"n2138439324":{"id":"n2138439324","loc":[-85.6180389,41.9529384]},"n2138439325":{"id":"n2138439325","loc":[-85.6176303,41.9533604]},"n2138439326":{"id":"n2138439326","loc":[-85.6175538,41.9534396]},"n2138439327":{"id":"n2138439327","loc":[-85.6173806,41.9523658]},"n2138439328":{"id":"n2138439328","loc":[-85.6171841,41.9522542]},"n2138439329":{"id":"n2138439329","loc":[-85.6172077,41.9524958]},"n2138439330":{"id":"n2138439330","loc":[-85.6171235,41.9525809]},"n2138439331":{"id":"n2138439331","loc":[-85.6180938,41.9527349]},"n2138439332":{"id":"n2138439332","loc":[-85.6177023,41.9525253]},"n2138439333":{"id":"n2138439333","loc":[-85.6175543,41.9526865]},"n2138439334":{"id":"n2138439334","loc":[-85.6179589,41.9528783]},"n185948820":{"id":"n185948820","loc":[-85.6163249,41.952701]},"n185948822":{"id":"n185948822","loc":[-85.6163757,41.952855]},"n185955123":{"id":"n185955123","loc":[-85.6198103,41.9510408]},"n185958839":{"id":"n185958839","loc":[-85.611651,41.954761]},"n185965033":{"id":"n185965033","loc":[-85.614195,41.954754]},"n185976502":{"id":"n185976502","loc":[-85.617375,41.947559]},"n185976504":{"id":"n185976504","loc":[-85.6174164,41.9510804]},"n185978828":{"id":"n185978828","loc":[-85.613542,41.954756]},"n185978830":{"id":"n185978830","loc":[-85.610373,41.954774]},"n2138420713":{"id":"n2138420713","loc":[-85.6174641,41.9506942]},"n2138420717":{"id":"n2138420717","loc":[-85.6173027,41.9512895]},"n2138420768":{"id":"n2138420768","loc":[-85.61745,41.9501974]},"n2138420773":{"id":"n2138420773","loc":[-85.6174135,41.9489136]},"n2138425436":{"id":"n2138425436","loc":[-85.6159148,41.9538036]},"n2138425437":{"id":"n2138425437","loc":[-85.6159534,41.9539677]},"n2138425438":{"id":"n2138425438","loc":[-85.6160306,41.9540846]},"n2138425439":{"id":"n2138425439","loc":[-85.6161354,41.954181]},"n2138425440":{"id":"n2138425440","loc":[-85.6162733,41.954263]},"n2138425443":{"id":"n2138425443","loc":[-85.6183273,41.9510826]},"n2138425444":{"id":"n2138425444","loc":[-85.6181354,41.9510835]},"n2138425448":{"id":"n2138425448","loc":[-85.6185033,41.9510816]},"n2138425450":{"id":"n2138425450","loc":[-85.6186816,41.9510808]},"n2138425452":{"id":"n2138425452","loc":[-85.6188641,41.9510818]},"n2138435984":{"id":"n2138435984","loc":[-85.6167607,41.9501009]},"n2138436000":{"id":"n2138436000","loc":[-85.6173169,41.947558]},"n2138436001":{"id":"n2138436001","loc":[-85.6173362,41.948883]},"n2138436002":{"id":"n2138436002","loc":[-85.6167791,41.9492952]},"n2138436003":{"id":"n2138436003","loc":[-85.6167543,41.949349]},"n2138436004":{"id":"n2138436004","loc":[-85.6167648,41.9509125]},"n2138436005":{"id":"n2138436005","loc":[-85.6168832,41.9510412]},"n2138436006":{"id":"n2138436006","loc":[-85.6170045,41.9511417]},"n2138436007":{"id":"n2138436007","loc":[-85.6170624,41.9512483]},"n2138436017":{"id":"n2138436017","loc":[-85.6168094,41.9492729]},"n2138436021":{"id":"n2138436021","loc":[-85.6167553,41.9494886]},"n2138436023":{"id":"n2138436023","loc":[-85.6167585,41.9499707]},"n2138436025":{"id":"n2138436025","loc":[-85.6167567,41.9497018]},"w203838284":{"id":"w203838284","tags":{"area":"yes","leisure":"pitch","sport":"baseball"},"nodes":["n2138425424","n2138425425","n2138425426","n2138425427","n2138425428","n2138425429","n2138425430","n2138425431","n2138425432","n2138425424"]},"w203837928":{"id":"w203837928","tags":{"highway":"service"},"nodes":["n2138420717","n2138420718","n2138420719","n2138420720","n2138420721","n2138420722","n185948818","n2138420723","n2138420724","n2138420715"]},"w203839364":{"id":"w203839364","tags":{"highway":"footway"},"nodes":["n2138439331","n2138439332"]},"w203837932":{"id":"w203837932","tags":{"amenity":"parking","area":"yes"},"nodes":["n2138420744","n2138420745","n2138420746","n2138420747","n2138420748","n2138420749","n2138420750","n2138420751","n2138420744"]},"w203839362":{"id":"w203839362","tags":{"highway":"footway"},"nodes":["n2138439327","n2138439328"]},"w203839363":{"id":"w203839363","tags":{"highway":"footway"},"nodes":["n2138439329","n2138439330"]},"w203837933":{"id":"w203837933","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n185955128","n2138420760","n2138420753","n2138420764","n2138420759","n2138420758","n2138420754","n2138420755","n2138420766","n2138420756"]},"w203837936":{"id":"w203837936","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2138420765","n2138420766"]},"w17966364":{"id":"w17966364","tags":{"access":"private","highway":"service","name":"Collins Dr"},"nodes":["n185961362","n185976502","n2138420773","n2138420768","n2138420713","n185976504","n2138420717","n2138420714","n2138420715","n2138420727","n2138420728","n2138420716"]},"w203838040":{"id":"w203838040","tags":{"amenity":"school","area":"yes","building":"yes","name":"Three Rivers Middle School"},"nodes":["n2138422349","n2138422350","n2138422351","n2138422352","n2138422353","n2138422354","n2138422355","n2138422356","n2138422357","n2138439330","n2138422358","n2138422359","n2138422360","n2138436014","n2138439327","n2138422361","n2138422362","n2138422363","n2138422364","n2138422365","n2138422366","n2138422367","n2138422368","n2138422369","n2138422370","n2138422371","n2138422372","n2138422373","n2138422374","n2138422375","n2138422376","n2138439332","n2138439333","n2138422377","n2138422378","n2138422349"]},"w17964049":{"id":"w17964049","tags":{"highway":"service"},"nodes":["n185955120","n185955123","n2138420716","n185955128","n2138420762","n2138420752","n2138420761","n2138420759"]},"w41074899":{"id":"w41074899","tags":{"highway":"secondary","name":"E Hoffman St","ref":"M 60"},"nodes":["n185978817","n185978819","n185978821","n185965033","n185978828","n185958839","n185978830"]},"w203839365":{"id":"w203839365","tags":{"highway":"footway"},"nodes":["n2138439333","n2138439334"]},"w203837935":{"id":"w203837935","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2138420762","n2138420763","n2138420764"]},"w203838287":{"id":"w203838287","tags":{"area":"yes","leisure":"pitch","sport":"tennis"},"nodes":["n2138425446","n2138425447","n2138425448","n2138425443","n2138425446"]},"w203837934":{"id":"w203837934","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2138420760","n2138420763","n2138420761"]},"w203838289":{"id":"w203838289","tags":{"area":"yes","leisure":"pitch","sport":"tennis"},"nodes":["n2138425449","n2138425451","n2138425452","n2138425450","n2138425449"]},"w17963047":{"id":"w17963047","tags":{"highway":"service"},"nodes":["n185948818","n2138436013","n185948820","n185948822","n185948824","n2138439326","n2138420767","n2138420766"]},"w203839091":{"id":"w203839091","tags":{"highway":"footway"},"nodes":["n185976502","n2138436000","n2138436001","n2138436017","n2138436002","n2138436003","n2138436021","n2138436025","n2138436023","n2138435984","n2138436004","n2138436005","n2138436006","n2138436007","n2138436008","n2138436009","n2138436010","n2138436011","n2138436012","n2138436013","n2138439319","n2138439329","n2138436014"]},"w204830797":{"id":"w204830797","tags":{"highway":"service","service":"parking_aisle"},"nodes":["n2138420756","n2138420757","n2138420765","n2138420758"]},"w203838288":{"id":"w203838288","tags":{"area":"yes","leisure":"pitch","sport":"tennis"},"nodes":["n2138425447","n2138425449","n2138425450","n2138425448","n2138425447"]},"w203838285":{"id":"w203838285","tags":{"area":"yes","leisure":"pitch","sport":"baseball"},"nodes":["n2138425433","n2138425434","n2138425435","n2138425436","n2138425437","n2138425438","n2138425439","n2138425440","n2138425441","n2138425442","n2138425433"]},"w203838286":{"id":"w203838286","tags":{"area":"yes","leisure":"pitch","sport":"tennis"},"nodes":["n2138425443","n2138425444","n2138425445","n2138425446","n2138425443"]},"w203837929":{"id":"w203837929","tags":{"amenity":"parking","area":"yes"},"nodes":["n2138420725","n2138420726","n2138420727","n2138420728","n2138420725"]},"w203839361":{"id":"w203839361","tags":{"highway":"footway"},"nodes":["n2138439319","n2138439328","n2138439320","n2138439321","n2138439322","n2138439331","n2138439334","n2138439323","n2138439324","n2138439325","n2138439326"]},"n394381698":{"id":"n394381698","loc":[-85.614471,41.954755]},"n394381699":{"id":"n394381699","loc":[-85.6152,41.954744]},"n394381700":{"id":"n394381700","loc":[-85.615201,41.954081]},"n394381701":{"id":"n394381701","loc":[-85.614426,41.954042]},"n394381702":{"id":"n394381702","loc":[-85.616319,41.954749]},"n394381704":{"id":"n394381704","loc":[-85.616152,41.954752]},"n394381706":{"id":"n394381706","loc":[-85.615201,41.95483]},"n394490775":{"id":"n394490775","loc":[-85.613971,41.954839]},"n394490782":{"id":"n394490782","loc":[-85.614372,41.954841]},"n185958835":{"id":"n185958835","loc":[-85.611615,41.953704]},"n185958837":{"id":"n185958837","loc":[-85.611636,41.953938]},"n185958842":{"id":"n185958842","loc":[-85.611187,41.951686]},"n185958844":{"id":"n185958844","loc":[-85.611087,41.951741]},"n185958845":{"id":"n185958845","loc":[-85.611034,41.951852]},"n185958847":{"id":"n185958847","loc":[-85.611016,41.95196]},"n185958849":{"id":"n185958849","loc":[-85.610989,41.95328]},"n185958851":{"id":"n185958851","loc":[-85.611021,41.953484]},"n185958852":{"id":"n185958852","loc":[-85.611091,41.953603]},"n185958853":{"id":"n185958853","loc":[-85.6112,41.953661]},"n185958855":{"id":"n185958855","loc":[-85.611364,41.953686]},"n185965031":{"id":"n185965031","loc":[-85.614204,41.953696]},"n185965032":{"id":"n185965032","loc":[-85.6142,41.953978]},"n185965062":{"id":"n185965062","loc":[-85.614617,41.951639]},"n185965064":{"id":"n185965064","loc":[-85.61463,41.951852]},"n185965066":{"id":"n185965066","loc":[-85.614642,41.953436]},"n185965068":{"id":"n185965068","loc":[-85.6146,41.953551]},"n185965071":{"id":"n185965071","loc":[-85.614487,41.95363]},"n185965073":{"id":"n185965073","loc":[-85.614354,41.953672]},"n185966288":{"id":"n185966288","loc":[-85.61179,41.953695]},"n185966290":{"id":"n185966290","loc":[-85.612232,41.953685]},"n185966293":{"id":"n185966293","loc":[-85.613438,41.953677]},"n185966349":{"id":"n185966349","loc":[-85.611323,41.951653]},"n185966351":{"id":"n185966351","loc":[-85.611892,41.951642]},"n185966352":{"id":"n185966352","loc":[-85.612216,41.951641]},"n185966353":{"id":"n185966353","loc":[-85.613111,41.951639]},"n185966354":{"id":"n185966354","loc":[-85.613396,41.95164]},"n185966355":{"id":"n185966355","loc":[-85.614221,41.95164]},"n185973839":{"id":"n185973839","loc":[-85.61341,41.951919]},"n185973840":{"id":"n185973840","loc":[-85.613438,41.953308]},"n185980222":{"id":"n185980222","loc":[-85.613781,41.955164]},"n185980223":{"id":"n185980223","loc":[-85.613815,41.955237]},"n185980225":{"id":"n185980225","loc":[-85.613837,41.955316]},"n185990345":{"id":"n185990345","loc":[-85.612211,41.951977]},"n185955743":{"id":"n185955743","loc":[-85.613873,41.95635]},"n185980227":{"id":"n185980227","loc":[-85.613851,41.955415]},"n185980229":{"id":"n185980229","loc":[-85.613918,41.957134]},"n394381703":{"id":"n394381703","loc":[-85.616287,41.955674]},"n394381705":{"id":"n394381705","loc":[-85.615164,41.955676]},"n394490777":{"id":"n394490777","loc":[-85.613973,41.955979]},"n394490780":{"id":"n394490780","loc":[-85.614364,41.955987]},"w17965307":{"id":"w17965307","tags":{"highway":"residential","name":"Bates Ave"},"nodes":["n185958842","n185966349","n185966351","n185966352","n185966353","n185966354","n185966355","n185965062"]},"w17967957":{"id":"w17967957","tags":{"highway":"residential","name":"Krum Ave"},"nodes":["n185966352","n185990345","n185966290"]},"w17964508":{"id":"w17964508","tags":{"highway":"residential","name":"Blossom Dr"},"nodes":["n185958842","n185958844","n185958845","n185958847","n185958849","n185958851","n185958852","n185958853","n185958855","n185958835"]},"w17964507":{"id":"w17964507","tags":{"highway":"residential","name":"Blossom Dr"},"nodes":["n185958835","n185958837","n185958839"]},"w34367080":{"id":"w34367080","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394381699","n394381706","n394381705","n394381703","n394381702","n394381704","n394381699"]},"w17965302":{"id":"w17965302","tags":{"highway":"residential","name":"Clausen Ave"},"nodes":["n185958835","n185966288","n185966290","n185966293","n185965031"]},"w17965156":{"id":"w17965156","tags":{"highway":"residential","name":"Orchard Dr"},"nodes":["n185965062","n185965064","n185965066","n185965068","n185965071","n185965073","n185965031"]},"w34369812":{"id":"w34369812","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394490775","n394490777","n394490780","n394490782","n394490775"]},"w17965151":{"id":"w17965151","tags":{"highway":"residential","name":"Orchard Dr"},"nodes":["n185965031","n185965032","n185965033"]},"w17966756":{"id":"w17966756","tags":{"access":"private","highway":"service","name":"Lockport Dr"},"nodes":["n185978828","n185980222","n185980223","n185980225","n185980227","n185955743","n185980229"]},"w17966056":{"id":"w17966056","tags":{"highway":"residential","name":"Angell Ave"},"nodes":["n185966354","n185973839","n185973840","n185966293"]},"w34367079":{"id":"w34367079","tags":{"admin_level":"8","boundary":"administrative"},"nodes":["n394381700","n394381701","n394381698","n394381699","n394381700"]},"n185955744":{"id":"n185955744","loc":[-85.611753,41.956208]},"n185988932":{"id":"n185988932","loc":[-85.6159,41.956336]},"n185988934":{"id":"n185988934","loc":[-85.6159158,41.9590646]},"n185988935":{"id":"n185988935","loc":[-85.6157358,41.959364],"tags":{"highway":"turning_circle"}},"n2138447007":{"id":"n2138447007","loc":[-85.6130784,41.9590689]},"n2138447008":{"id":"n2138447008","loc":[-85.6133328,41.9593805]},"n2138447003":{"id":"n2138447003","loc":[-85.610238,41.9547745]},"n2138447004":{"id":"n2138447004","loc":[-85.6102652,41.9566041]},"n2138447005":{"id":"n2138447005","loc":[-85.610325,41.9568823]},"n2138447006":{"id":"n2138447006","loc":[-85.6105644,41.9571383]},"n2138447009":{"id":"n2138447009","loc":[-85.6135946,41.959948]},"n2138447010":{"id":"n2138447010","loc":[-85.6136071,41.9629372]},"n2138447011":{"id":"n2138447011","loc":[-85.6134392,41.9633182]},"n2138447012":{"id":"n2138447012","loc":[-85.6130151,41.9636073]},"n2138447013":{"id":"n2138447013","loc":[-85.6122729,41.9637125]},"n2138447014":{"id":"n2138447014","loc":[-85.6056682,41.963752]},"w17964174":{"id":"w17964174","tags":{"access":"private","highway":"service"},"nodes":["n185955743","n185955744"]},"w17967743":{"id":"w17967743","tags":{"access":"private","highway":"service","name":"Manistee River Rd"},"nodes":["n185971574","n185988932","n185971407","n185981301","n185967987","n185988934","n185988935"]},"w203839666":{"id":"w203839666","tags":{"highway":"residential","name":"Hov Aire Drive"},"nodes":["n2138447003","n2138447004","n2138447005","n2138447006","n2138447007","n2138447008","n2138447009","n2138447010","n2138447011","n2138447012","n2138447013","n2138447014"]}}';iD.data = {"deprecated":[{"old":{"amenity":"firepit"},"replace":{"leisure":"firepit"}},{"old":{"barrier":"wire_fence"},"replace":{"barrier":"fence","fence_type":"chain"}},{"old":{"barrier":"wood_fence"},"replace":{"barrier":"fence","fence_type":"wood"}},{"old":{"highway":"ford"},"replace":{"ford":"yes"}},{"old":{"highway":"stile"},"replace":{"barrier":"stile"}},{"old":{"highway":"incline"},"replace":{"highway":"road","incline":"up"}},{"old":{"highway":"incline_steep"},"replace":{"highway":"road","incline":"up"}},{"old":{"highway":"unsurfaced"},"replace":{"highway":"road","incline":"unpaved"}},{"old":{"landuse":"wood"},"replace":{"landuse":"forest","natural":"wood"}},{"old":{"natural":"marsh"},"replace":{"natural":"wetland","wetland":"marsh"}},{"old":{"power_source":"*"},"replace":{"generator:source":"$1"}},{"old":{"power_rating":"*"},"replace":{"generator:output":"$1"}},{"old":{"shop":"organic"},"replace":{"shop":"supermarket","organic":"only"}}],"discarded":["created_by","odbl","odbl:note","tiger:upload_uuid","tiger:tlid","tiger:source","tiger:separated","geobase:datasetName","geobase:uuid","sub_sea:type","KSJ2:ADS","KSJ2:ARE","KSJ2:AdminArea","KSJ2:COP_label","KSJ2:DFD","KSJ2:INT","KSJ2:INT_label","KSJ2:LOC","KSJ2:LPN","KSJ2:OPC","KSJ2:PubFacAdmin","KSJ2:RAC","KSJ2:RAC_label","KSJ2:RIC","KSJ2:RIN","KSJ2:WSC","KSJ2:coordinate","KSJ2:curve_id","KSJ2:curve_type","KSJ2:filename","KSJ2:lake_id","KSJ2:lat","KSJ2:long","KSJ2:river_id","yh:LINE_NAME","yh:LINE_NUM","yh:STRUCTURE","yh:TOTYUMONO","yh:TYPE","yh:WIDTH","yh:WIDTH_RANK","SK53_bulk:load"],"wikipedia":[["Abkhazian","ÐÒ§ÑÑÓа","ab"],["Achinese","Acèh","ace"],["Adyghe","адÑгабзÑ","ady"],["Afrikaans","Afrikaans","af"],["Akan","Akan","ak"],["Alemannisch","Alemannisch","als"],["Amharic","á ááá","am"],["Aragonese","aragonés","an"],["Old English","Ãnglisc","ang"],["Arabic","اÙعربÙØ©","ar"],["Aramaic","ÜܪܡÜÜ","arc"],["Egyptian Arabic","Ù
صرÙ","arz"],["Assamese","à¦
সমà§à¦¯à¦¼à¦¾","as"],["Asturian","asturianu","ast"],["Avaric","аваÑ","av"],["Aymara","Aymar aru","ay"],["Azerbaijani","azÉrbaycanca","az"],["تÛرکجÙ","تÛرکجÙ","azb"],["Bashkir","баÑҡоÑÑÑа","ba"],["Bavarian","Boarisch","bar"],["Samogitian","žemaitÄÅ¡ka","bat-smg"],["Bikol Central","Bikol Central","bcl"],["Belarusian","белаÑÑÑкаÑ","be"],["белаÑÑÑÐºÐ°Ñ (ÑаÑаÑкевÑÑа)â","белаÑÑÑÐºÐ°Ñ (ÑаÑаÑкевÑÑа)â","be-x-old"],["Bulgarian","бÑлгаÑÑки","bg"],["à¤à¥à¤à¤ªà¥à¤°à¥","à¤à¥à¤à¤ªà¥à¤°à¥","bh"],["Bislama","Bislama","bi"],["Banjar","Bahasa Banjar","bjn"],["Bambara","bamanankan","bm"],["Bengali","বাà¦à¦²à¦¾","bn"],["Tibetan","à½à½¼à½à¼à½¡à½²à½","bo"],["Bishnupriya","বিষà§à¦£à§à¦ªà§à¦°à¦¿à¦¯à¦¼à¦¾ মণিপà§à¦°à§","bpy"],["Breton","brezhoneg","br"],["Bosnian","bosanski","bs"],["Buginese","á¨
ᨠá¨á¨á¨á¨","bug"],["бÑÑÑад","бÑÑÑад","bxr"],["Catalan","català ","ca"],["Chavacano de Zamboanga","Chavacano de Zamboanga","cbk-zam"],["Min Dong Chinese","Mìng-dÄ̤ng-ngá¹³Ì","cdo"],["Chechen","ноÑ
Ñийн","ce"],["Cebuano","Cebuano","ceb"],["Chamorro","Chamoru","ch"],["Cherokee","á£á³á©","chr"],["Cheyenne","Tsetsêhestâhese","chy"],["Central Kurdish","Ú©ÙردÛÛ ÙاÙÛÙدÛ","ckb"],["Corsican","corsu","co"],["Cree","NÄhiyawÄwin / áá¦ááááá£","cr"],["Crimean Turkish","qırımtatarca","crh"],["Czech","ÄeÅ¡tina","cs"],["Kashubian","kaszëbsczi","csb"],["Church Slavic","ÑловѣнÑÑÐºÑ / â°â°â°â°â°¡â°â° â°â°â°","cu"],["Chuvash","ЧÓваÑла","cv"],["Welsh","Cymraeg","cy"],["Danish","dansk","da"],["German","Deutsch","de"],["Zazaki","Zazaki","diq"],["Lower Sorbian","dolnoserbski","dsb"],["Divehi","ÞÞ¨ÞÞ¬ÞÞ¨ÞÞ¦ÞÞ°","dv"],["Dzongkha","à½à½¼à½à¼à½","dz"],["Ewe","eÊegbe","ee"],["Greek","Îλληνικά","el"],["Emiliano-Romagnolo","emilià n e rumagnòl","eml"],["English","English","en"],["Esperanto","Esperanto","eo"],["Spanish","español","es"],["Estonian","eesti","et"],["Basque","euskara","eu"],["Extremaduran","estremeñu","ext"],["Persian","ÙارسÛ","fa"],["Fulah","Fulfulde","ff"],["Finnish","suomi","fi"],["Võro","Võro","fiu-vro"],["Fijian","Na Vosa Vakaviti","fj"],["Faroese","føroyskt","fo"],["French","français","fr"],["Arpitan","arpetan","frp"],["Northern Frisian","Nordfriisk","frr"],["Friulian","furlan","fur"],["Western Frisian","Frysk","fy"],["Irish","Gaeilge","ga"],["Gagauz","Gagauz","gag"],["Gan Chinese","è´èª","gan"],["Scottish Gaelic","Gà idhlig","gd"],["Galician","galego","gl"],["Gilaki","Ú¯ÛÙÚ©Û","glk"],["Guarani","Avañe'ẽ","gn"],["Goan Konkani","à¤à¥à¤à¤¯à¤à¥ à¤à¥à¤à¤à¤£à¥ / Gõychi Konknni","gom"],["Gothic","ð²ð¿ðð¹ððº","got"],["Gujarati","àªà«àªàª°àª¾àª¤à«","gu"],["Manx","Gaelg","gv"],["Hausa","Hausa","ha"],["Hakka Chinese","客家èª/Hak-kâ-ngî","hak"],["Hawaiian","HawaiÊ»i","haw"],["Hebrew","×¢×ר×ת","he"],["Hindi","हिनà¥à¤¦à¥","hi"],["Fiji Hindi","Fiji Hindi","hif"],["Croatian","hrvatski","hr"],["Upper Sorbian","hornjoserbsce","hsb"],["Haitian Creole","Kreyòl ayisyen","ht"],["Hungarian","magyar","hu"],["Armenian","ÕÕ¡ÕµÕ¥ÖÕ¥Õ¶","hy"],["Interlingua","interlingua","ia"],["Indonesian","Bahasa Indonesia","id"],["Interlingue","Interlingue","ie"],["Igbo","Igbo","ig"],["Inupiaq","Iñupiak","ik"],["Iloko","Ilokano","ilo"],["Ido","Ido","io"],["Icelandic","Ãslenska","is"],["Italian","italiano","it"],["Inuktitut","áááááá¦/inuktitut","iu"],["Japanese","æ¥æ¬èª","ja"],["Jamaican Creole English","Patois","jam"],["Lojban","la .lojban.","jbo"],["Javanese","Basa Jawa","jv"],["Georgian","á¥áá áá£áá","ka"],["Kara-Kalpak","Qaraqalpaqsha","kaa"],["Kabyle","Taqbaylit","kab"],["Kabardian","ÐдÑгÑбзÑ","kbd"],["Kongo","Kongo","kg"],["Kikuyu","GÄ©kÅ©yÅ©","ki"],["Kazakh","ÒазаÒÑа","kk"],["Kalaallisut","kalaallisut","kl"],["Khmer","áá¶áá¶ááááá","km"],["Kannada","à²à²¨à³à²¨à²¡","kn"],["Korean","íêµì´","ko"],["Komi-Permyak","ÐеÑем Ðоми","koi"],["Karachay-Balkar","кÑаÑаÑай-малкÑаÑ","krc"],["Kashmiri","à¤à¥à¤¶à¥à¤° / کٲشÙر","ks"],["Colognian","Ripoarisch","ksh"],["Kurdish","Kurdî","ku"],["Komi","коми","kv"],["Cornish","kernowek","kw"],["Kyrgyz","ÐÑÑгÑзÑа","ky"],["Latin","Latina","la"],["Ladino","Ladino","lad"],["Luxembourgish","Lëtzebuergesch","lb"],["лаккÑ","лаккÑ","lbe"],["Lezghian","лезги","lez"],["Ganda","Luganda","lg"],["Limburgish","Limburgs","li"],["Ligurian","Ligure","lij"],["Lombard","lumbaart","lmo"],["Lingala","lingála","ln"],["Lao","ລາວ","lo"],["Northern Luri","ÙÛØ±Û Ø´ÙÙ
اÙÛ","lrc"],["Lithuanian","lietuvių","lt"],["Latgalian","latgaļu","ltg"],["Latvian","latvieÅ¡u","lv"],["Maithili","मà¥à¤¥à¤¿à¤²à¥","mai"],["Basa Banyumasan","Basa Banyumasan","map-bms"],["Moksha","мокÑенÑ","mdf"],["Malagasy","Malagasy","mg"],["Eastern Mari","олÑк маÑий","mhr"],["Maori","MÄori","mi"],["Minangkabau","Baso Minangkabau","min"],["Macedonian","македонÑки","mk"],["Malayalam","മലയാളà´","ml"],["Mongolian","монгол","mn"],["Marathi","मराठà¥","mr"],["Western Mari","кÑÑÑк маÑÑ","mrj"],["Malay","Bahasa Melayu","ms"],["Maltese","Malti","mt"],["Mirandese","Mirandés","mwl"],["Burmese","áá¼ááºáá¬áá¬áá¬","my"],["Erzya","ÑÑзÑнÑ","myv"],["Mazanderani","Ù
ازÙرÙÙÛ","mzn"],["Nauru","Dorerin Naoero","na"],["NÄhuatl","NÄhuatl","nah"],["Neapolitan","Napulitano","nap"],["Low German","Plattdüütsch","nds"],["Low Saxon","Nedersaksies","nds-nl"],["Nepali","नà¥à¤ªà¤¾à¤²à¥","ne"],["Newari","नà¥à¤ªà¤¾à¤² à¤à¤¾à¤·à¤¾","new"],["Dutch","Nederlands","nl"],["Norwegian Nynorsk","norsk nynorsk","nn"],["Norwegian","norsk bokmÃ¥l","no"],["Novial","Novial","nov"],["Nouormand","Nouormand","nrm"],["Northern Sotho","Sesotho sa Leboa","nso"],["Navajo","Diné bizaad","nv"],["Nyanja","Chi-Chewa","ny"],["Occitan","occitan","oc"],["Oromo","Oromoo","om"],["Oriya","à¬à¬¡à¬¼à¬¿à¬","or"],["Ossetic","ÐÑон","os"],["Punjabi","ਪੰà¨à¨¾à¨¬à©","pa"],["Pangasinan","Pangasinan","pag"],["Pampanga","Kapampangan","pam"],["Papiamento","Papiamentu","pap"],["Picard","Picard","pcd"],["Pennsylvania German","Deitsch","pdc"],["Palatine German","Pälzisch","pfl"],["Pali","पालि","pi"],["Norfuk / Pitkern","Norfuk / Pitkern","pih"],["Polish","polski","pl"],["Piedmontese","Piemontèis","pms"],["Western Punjabi","Ù¾ÙجابÛ","pnb"],["Pontic","ΠονÏιακά","pnt"],["Pashto","Ù¾ÚتÙ","ps"],["Portuguese","português","pt"],["Quechua","Runa Simi","qu"],["Romansh","rumantsch","rm"],["Romani","Romani","rmy"],["Rundi","Kirundi","rn"],["Romanian","românÄ","ro"],["Aromanian","armãneashti","roa-rup"],["tarandÃne","tarandÃne","roa-tara"],["Russian","ÑÑÑÑкий","ru"],["Rusyn","ÑÑÑинÑÑкÑй","rue"],["Kinyarwanda","Kinyarwanda","rw"],["Sanskrit","सà¤à¤¸à¥à¤à¥à¤¤à¤®à¥","sa"],["Sakha","ÑаÑ
а ÑÑла","sah"],["Sardinian","sardu","sc"],["Sicilian","sicilianu","scn"],["Scots","Scots","sco"],["Sindhi","سÙÚÙ","sd"],["Northern Sami","sámegiella","se"],["Sango","Sängö","sg"],["Serbo-Croatian","srpskohrvatski / ÑÑпÑкоÑ
ÑваÑÑки","sh"],["Sinhala","à·à·à¶à·à¶½","si"],["Simple English","Simple English","simple"],["Slovak","slovenÄina","sk"],["Slovenian","slovenÅ¡Äina","sl"],["Samoan","Gagana Samoa","sm"],["Shona","chiShona","sn"],["Somali","Soomaaliga","so"],["Albanian","shqip","sq"],["Serbian","ÑÑпÑки / srpski","sr"],["Sranan Tongo","Sranantongo","srn"],["Swati","SiSwati","ss"],["Southern Sotho","Sesotho","st"],["Saterland Frisian","Seeltersk","stq"],["Sundanese","Basa Sunda","su"],["Swedish","svenska","sv"],["Swahili","Kiswahili","sw"],["Silesian","Ålůnski","szl"],["Tamil","தமிழà¯","ta"],["Telugu","à°¤à±à°²à±à°à±","te"],["Tetum","tetun","tet"],["Tajik","Ñоҷикӣ","tg"],["Thai","à¹à¸à¸¢","th"],["Tigrinya","áµááá","ti"],["Turkmen","Türkmençe","tk"],["Tagalog","Tagalog","tl"],["Tswana","Setswana","tn"],["Tongan","lea faka-Tonga","to"],["Tok Pisin","Tok Pisin","tpi"],["Turkish","Türkçe","tr"],["Tsonga","Xitsonga","ts"],["Tatar","ÑаÑаÑÑа/tatarça","tt"],["Tumbuka","chiTumbuka","tum"],["Twi","Twi","tw"],["Tahitian","reo tahiti","ty"],["Tuvinian","ÑÑва дÑл","tyv"],["Udmurt","ÑдмÑÑÑ","udm"],["Uyghur","ئÛÙغÛرÚÛ / Uyghurche","ug"],["Ukrainian","ÑкÑаÑнÑÑка","uk"],["Urdu","اردÙ","ur"],["Uzbek","oÊ»zbekcha/ÑзбекÑа","uz"],["Venda","Tshivenda","ve"],["Venetian","vèneto","vec"],["Veps","vepsän kelâ","vep"],["Vietnamese","Tiếng Viá»t","vi"],["West Flemish","West-Vlams","vls"],["Volapük","Volapük","vo"],["Walloon","walon","wa"],["Waray","Winaray","war"],["Wolof","Wolof","wo"],["Wu Chinese","å´è¯","wuu"],["Kalmyk","Ñ
алÑмг","xal"],["Xhosa","isiXhosa","xh"],["Mingrelian","ááá áááá£á á","xmf"],["Yiddish","××Ö´××ש","yi"],["Yoruba","Yorùbá","yo"],["Zhuang","Vahcuengh","za"],["Zeelandic","Zeêuws","zea"],["Chinese","ä¸æ","zh"],["Classical Chinese","æè¨","zh-classical"],["Chinese (Min Nan)","Bân-lâm-gú","zh-min-nan"],["Cantonese","ç²µèª","zh-yue"],["Zulu","isiZulu","zu"]],"imperial":{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[1.97754,51.13111],[1.8457,63.45051],[-10.45898,57.01681],[-6.82251,55.26503],[-7.25583,55.06525],[-7.26546,55.0665],[-7.26992,55.06419],[-7.2725,55.06346],[-7.27818,55.05362],[-7.2893,55.04735],[-7.29939,55.0561],[-7.31835,55.04475],[-7.3447,55.05079],[-7.38831,55.02389],[-7.40547,55.00292],[-7.39157,54.99507],[-7.40075,54.98892],[-7.40706,54.98291],[-7.40363,54.97963],[-7.40633,54.97813],[-7.39835,54.97013],[-7.40745,54.96357],[-7.40178,54.95961],[-7.40727,54.95515],[-7.3944,54.94376],[-7.44444,54.93858],[-7.45216,54.89793],[-7.44204,54.87532],[-7.4713,54.83431],[-7.48092,54.83093],[-7.49216,54.82185],[-7.55121,54.79054],[-7.5443,54.78609],[-7.54958,54.75653],[-7.5349,54.74917],[-7.54881,54.74068],[-7.55941,54.74556],[-7.57894,54.74221],[-7.57507,54.7494],[-7.58606,54.75039],[-7.58872,54.74377],[-7.60031,54.74603],[-7.60632,54.74405],[-7.61662,54.74459],[-7.63593,54.75108],[-7.68854,54.72968],[-7.72064,54.72155],[-7.75094,54.70469],[-7.79094,54.71942],[-7.8051,54.71932],[-7.83497,54.73632],[-7.85419,54.72745],[-7.91496,54.67582],[-7.90174,54.66182],[-7.83832,54.63401],[-7.7433,54.6188],[-7.70863,54.63485],[-7.70682,54.6189],[-7.69386,54.6188],[-7.69631,54.61125],[-7.75845,54.59509],[-7.78708,54.58],[-7.79446,54.58141],[-7.79969,54.57704],[-7.79673,54.56915],[-7.8184,54.56315],[-7.83334,54.55227],[-7.82737,54.54299],[-7.85007,54.53363],[-7.90741,54.53722],[-7.93213,54.53388],[-8.00487,54.54568],[-8.03727,54.51162],[-8.04285,54.48759],[-8.08027,54.48829],[-8.09988,54.48395],[-8.09126,54.4765],[-8.111,54.47807],[-8.11512,54.46904],[-8.16542,54.46914],[-8.1776,54.46485],[-8.14293,54.45003],[-8.16284,54.4413],[-8.08731,54.4002],[-8.06062,54.37051],[-8.03289,54.35711],[-8.00054,54.34835],[-7.93333,54.30561],[-7.85849,54.29151],[-7.87067,54.28794],[-7.87265,54.26648],[-7.86123,54.25931],[-7.85917,54.21256],[-7.71043,54.20307],[-7.70193,54.20776],[-7.68828,54.202],[-7.67644,54.18906],[-7.66082,54.1871],[-7.62554,54.16545],[-7.62541,54.15319],[-7.61026,54.14353],[-7.57421,54.14142],[-7.57181,54.13287],[-7.56228,54.12704],[-7.51379,54.12998],[-7.47944,54.122],[-7.47169,54.12665],[-7.47075,54.13318],[-7.44684,54.15168],[-7.40792,54.156],[-7.42579,54.14092],[-7.41903,54.13629],[-7.3744,54.14172],[-7.37234,54.13881],[-7.39509,54.12624],[-7.39182,54.12017],[-7.36341,54.13157],[-7.34518,54.11577],[-7.32471,54.12123],[-7.32003,54.11379],[-7.3078,54.11718],[-7.30548,54.12347],[-7.31591,54.12697],[-7.31213,54.13162],[-7.3187,54.13411],[-7.31857,54.13745],[-7.32222,54.13836],[-7.32737,54.13544],[-7.3399,54.14585],[-7.30827,54.16716],[-7.30024,54.16625],[-7.29029,54.1715],[-7.28158,54.16839],[-7.2863,54.14919],[-7.29874,54.14904],[-7.30162,54.14411],[-7.28411,54.13971],[-7.29192,54.13071],[-7.29737,54.133],[-7.30883,54.13242],[-7.30333,54.12251],[-7.29218,54.11929],[-7.27844,54.12282],[-7.27707,54.12986],[-7.26613,54.13624],[-7.2566,54.16354],[-7.24015,54.17125],[-7.2575,54.17678],[-7.2581,54.19257],[-7.25179,54.19403],[-7.23608,54.1935],[-7.23338,54.19792],[-7.24317,54.20076],[-7.24892,54.1977],[-7.25183,54.20201],[-7.24119,54.20623],[-7.23094,54.20578],[-7.23269,54.20912],[-7.22188,54.21607],[-7.20643,54.2117],[-7.18506,54.22485],[-7.17055,54.21742],[-7.14721,54.22488],[-7.14633,54.23008],[-7.15051,54.23165],[-7.14613,54.23983],[-7.15802,54.24434],[-7.13985,54.25298],[-7.15255,54.26235],[-7.16064,54.27405],[-7.17991,54.27144],[-7.17201,54.28627],[-7.21252,54.2985],[-7.19888,54.31117],[-7.17918,54.30946],[-7.1812,54.3397],[-7.15339,54.33514],[-7.10253,54.35811],[-7.10811,54.36677],[-7.06927,54.3899],[-7.05593,54.41056],[-7.02898,54.42135],[-7.00198,54.40832],[-6.98683,54.40829],[-6.97562,54.40014],[-6.96774,54.40145],[-6.90682,54.36966],[-6.89772,54.35075],[-6.87527,54.33853],[-6.86512,54.32568],[-6.85163,54.29137],[-6.87452,54.28677],[-6.87791,54.27918],[-6.86673,54.27522],[-6.85177,54.26489],[-6.83693,54.26658],[-6.82165,54.24346],[-6.81633,54.22299],[-6.80045,54.22108],[-6.80122,54.21338],[-6.77599,54.19965],[-6.75573,54.1987],[-6.74316,54.18258],[-6.73406,54.18566],[-6.72445,54.18127],[-6.70295,54.20036],[-6.69166,54.20018],[-6.68673,54.19398],[-6.669,54.19584],[-6.65248,54.18102],[-6.6433,54.17801],[-6.63467,54.16449],[-6.63179,54.14766],[-6.64081,54.14238],[-6.63935,54.13599],[-6.66149,54.1205],[-6.6481,54.10153],[-6.66119,54.0934],[-6.66458,54.06629],[-6.64681,54.05873],[-6.62501,54.03737],[-6.59291,54.04755],[-6.58905,54.05808],[-6.5597,54.0481],[-6.52897,54.05888],[-6.50442,54.05566],[-6.47824,54.07004],[-6.47919,54.07762],[-6.43601,54.05959],[-6.36314,54.07057],[-6.36589,54.09338],[-6.36293,54.09758],[-6.37104,54.11497],[-6.3522,54.11084],[-6.34242,54.1114],[-6.33589,54.10833],[-6.33636,54.09469],[-6.31808,54.09096],[-6.30903,54.10463],[-6.29165,54.11235],[-6.28246,54.11145],[-6.26272,54.09786],[-5.35583,53.72597],[-7.0752,49.23912],[-1.83472,49.02346],[-2.12036,49.94415],[1.97754,51.13111]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-65.2,18.7],[-65,16.3],[-63.7,19.2],[-65.2,18.7]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-63,-50.5],[-55,-51],[-60,-54],[-63,-50.5]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-139.19952,60.08402],[-141,60.30621],[-141,76],[-169,68.63655],[-169,65.20147],[-180,61],[-180,-4],[-154,9],[-133.76404,54.54021],[-130.73868,54.71986],[-129.96277,55.29163],[-130.15228,55.7758],[-130.01787,55.90688],[-130.00362,56.00798],[-130.10284,56.12336],[-130.24498,56.09656],[-130.42625,56.14249],[-131.87439,56.79787],[-135.02884,59.56285],[-135.11759,59.62306],[-135.15827,59.6261],[-135.47928,59.79822],[-136.28677,59.57955],[-136.30531,59.46462],[-136.36836,59.44898],[-136.47697,59.46558],[-137.19727,59.01935],[-139.19952,60.08402]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-111.96064,48.99841],[-121.22623,49.00049],[-122.26513,49.00246],[-122.7565,49.00208],[-123.32218,49.00218],[-122.97821,48.76524],[-123.2666,48.69821],[-123.21991,48.21186],[-125.80444,48.60749],[-124.32129,31.54109],[-117.125,32.53429],[-116.82417,32.55996],[-115.88036,32.63735],[-115.49738,32.66486],[-114.71984,32.71877],[-114.7649,32.64602],[-114.80885,32.60959],[-114.81481,32.49451],[-112.81743,31.88004],[-111.07481,31.33224],[-109.56051,31.33402],[-108.20847,31.33384],[-108.20838,31.78363],[-106.52847,31.78391],[-106.52781,31.78086],[-106.52249,31.77501],[-106.51249,31.76933],[-106.50988,31.7612],[-106.50709,31.76123],[-106.48896,31.74806],[-106.48473,31.74769],[-106.4719,31.75101],[-106.46816,31.75897],[-106.45434,31.76466],[-106.45035,31.76426],[-106.43516,31.75492],[-106.41484,31.75101],[-106.37864,31.73021],[-106.37225,31.71174],[-106.34924,31.69633],[-106.33289,31.66178],[-106.3068,31.62459],[-106.28079,31.56179],[-106.24775,31.54226],[-106.2329,31.49982],[-106.2105,31.46857],[-106.08201,31.39863],[-106.00554,31.39233],[-105.76401,31.17051],[-105.58548,31.06117],[-105.56419,30.98526],[-104.99153,30.6639],[-104.97162,30.60896],[-104.90639,30.57822],[-104.83772,30.38117],[-104.70177,30.20567],[-104.68048,29.92399],[-104.57611,29.77838],[-104.51157,29.63674],[-104.39758,29.57047],[-104.39278,29.55293],[-104.05769,29.32173],[-103.79883,29.2581],[-103.78196,29.26555],[-103.76759,29.22799],[-103.14102,28.93666],[-102.86087,29.2217],[-102.65076,29.79418],[-101.41068,29.73457],[-101.26511,29.51372],[-101.05997,29.452],[-101.04083,29.38038],[-100.96303,29.34735],[-100.94406,29.34369],[-100.94071,29.33351],[-100.92775,29.32663],[-100.89814,29.30957],[-100.87818,29.28086],[-100.80076,29.2238],[-100.76437,29.15981],[-100.67047,29.08663],[-100.6412,28.91299],[-100.63236,28.90255],[-100.61296,28.89939],[-100.534,28.75622],[-100.51495,28.74531],[-100.50705,28.7143],[-100.51203,28.70666],[-100.51014,28.69127],[-100.50048,28.66186],[-100.45547,28.6381],[-100.44697,28.60743],[-100.35599,28.45239],[-100.34946,28.39653],[-100.29488,28.31315],[-100.29591,28.27324],[-100.17197,28.17493],[-99.93645,27.9568],[-99.87722,27.80173],[-99.79671,27.73338],[-99.772,27.72532],[-99.74556,27.69979],[-99.71947,27.65981],[-99.5957,27.59974],[-99.54094,27.60537],[-99.53055,27.57973],[-99.52034,27.55782],[-99.52802,27.49773],[-99.50141,27.49986],[-99.48755,27.49518],[-99.47897,27.48421],[-99.48661,27.46453],[-99.49534,27.44861],[-99.48927,27.40941],[-99.53957,27.31565],[-99.43588,27.19678],[-99.46404,27.01968],[-99.16698,26.56039],[-99.17474,26.53939],[-99.12698,26.51958],[-99.1135,26.42954],[-99.08355,26.39625],[-99.06007,26.39737],[-99.03634,26.41255],[-99.02042,26.40598],[-99.01291,26.39364],[-98.95686,26.38641],[-98.9566,26.37365],[-98.94523,26.36949],[-98.90013,26.36419],[-98.89905,26.35454],[-98.80305,26.36626],[-98.78254,26.30511],[-98.66667,26.23457],[-98.58496,26.24647],[-98.57951,26.23434],[-98.56519,26.23987],[-98.56294,26.22464],[-98.50599,26.20858],[-98.44806,26.21236],[-98.38617,26.15721],[-98.34176,26.15278],[-98.33579,26.1388],[-98.30626,26.10003],[-98.28841,26.10512],[-98.26524,26.0914],[-98.19898,26.06411],[-98.09577,26.05698],[-98.07568,26.06667],[-98.08302,26.03396],[-97.9771,26.04136],[-97.9532,26.06179],[-97.81643,26.04475],[-97.77017,26.02439],[-97.73884,26.02902],[-97.5289,25.90648],[-97.52151,25.88625],[-97.50615,25.89031],[-97.49851,25.89903],[-97.49637,25.89641],[-97.49748,25.88008],[-97.49422,25.87981],[-97.48847,25.88564],[-97.46409,25.88174],[-97.42607,25.842],[-97.36856,25.8396],[-97.26231,25.94724],[-80.81543,24.00633],[-66.87378,44.77794],[-67.16148,45.16715],[-67.2286,45.16739],[-67.26246,45.18797],[-67.28311,45.19175],[-67.28959,45.18784],[-67.29332,45.17568],[-67.29049,45.17317],[-67.3001,45.16776],[-67.3025,45.16122],[-67.29761,45.14766],[-67.33975,45.1255],[-67.40524,45.16122],[-67.40387,45.17139],[-67.4818,45.27682],[-67.42172,45.38543],[-67.45262,45.41008],[-67.50498,45.4889],[-67.41623,45.50105],[-67.42219,45.55661],[-67.42902,45.56833],[-67.42331,45.57154],[-67.42498,45.57836],[-67.45193,45.60323],[-67.77981,45.6738],[-67.79019,47.06776],[-67.88006,47.1067],[-67.91319,47.14793],[-67.92598,47.15418],[-67.95181,47.1875],[-68.02374,47.23915],[-68.13017,47.29309],[-68.17669,47.32893],[-68.24046,47.35354],[-68.32809,47.36005],[-68.36363,47.35476],[-68.38054,47.34167],[-68.38509,47.30321],[-68.37367,47.28796],[-68.4377,47.28232],[-68.47916,47.29623],[-68.51074,47.29885],[-68.54593,47.28441],[-68.58408,47.28482],[-68.59777,47.27134],[-68.59271,47.25762],[-68.61889,47.24148],[-68.68936,47.24125],[-68.71768,47.23676],[-68.80128,47.21423],[-68.89629,47.17676],[-69.05354,47.24847],[-69.04924,47.41798],[-69.22425,47.45961],[-69.99729,46.69558],[-70.0569,46.4149],[-70.25551,46.10871],[-70.29001,46.09431],[-70.39919,45.80667],[-70.83229,45.40062],[-70.80794,45.37878],[-70.82663,45.2367],[-70.87538,45.23453],[-70.92138,45.28099],[-70.90645,45.30918],[-71.0109,45.34798],[-71.08429,45.30556],[-71.1454,45.24226],[-71.20525,45.25278],[-71.28925,45.30097],[-71.41405,45.23513],[-71.43044,45.12381],[-71.49692,45.06991],[-71.50623,45.04878],[-71.49284,45.03629],[-71.50027,45.01372],[-71.79359,45.01075],[-72.08774,45.00581],[-72.14155,45.00568],[-72.15282,45.00609],[-72.17142,45.00584],[-72.25847,45.00436],[-72.38795,45.00626],[-72.4496,45.00863],[-72.5356,45.00936],[-72.66257,45.01523],[-72.82537,45.01642],[-73.08466,45.01561],[-73.45219,45.00875],[-74.14699,44.99145],[-74.33753,44.9923],[-74.50786,44.99798],[-74.66158,44.99949],[-74.71244,44.99734],[-74.75887,44.98708],[-74.76368,45.00632],[-74.78977,45.00365],[-74.82376,45.01773],[-74.94186,44.98229],[-75.30098,44.83883],[-75.30304,44.82836],[-75.59418,44.6457],[-75.97269,44.33502],[-75.97295,44.34595],[-76.00059,44.34797],[-76.17645,44.2865],[-76.18744,44.22158],[-76.88782,43.82759],[-79.16851,43.32168],[-79.05487,43.25371],[-79.05092,43.169],[-79.04603,43.16093],[-79.04208,43.13942],[-79.07002,43.12038],[-79.06015,43.114],[-79.0568,43.10474],[-79.0774,43.07861],[-78.9996,43.05484],[-79.02311,43.02071],[-79.02552,42.99473],[-78.96235,42.9573],[-78.91188,42.9426],[-78.90398,42.89181],[-82.42767,41.47978],[-83.14316,42.03807],[-83.12805,42.23843],[-83.09715,42.29052],[-83.07252,42.31515],[-82.94575,42.34332],[-82.59676,42.5479],[-82.51368,42.61785],[-82.5108,42.66464],[-82.4675,42.76415],[-82.48055,42.80573],[-82.45497,42.9284],[-82.41334,42.97099],[-82.42596,42.99536],[-82.15851,43.39507],[-83.53729,46.098],[-83.96301,46.05036],[-84.11021,46.23851],[-84.09794,46.25656],[-84.11613,46.26878],[-84.11905,46.31516],[-84.10721,46.3218],[-84.14394,46.41076],[-84.11682,46.51576],[-84.13536,46.53218],[-84.16162,46.5284],[-84.21621,46.53891],[-84.26994,46.49189],[-84.36092,46.50997],[-84.55284,46.4407],[-84.95178,46.77185],[-89.59179,48.00307],[-89.67547,48.00371],[-90.87204,48.25943],[-91.41312,48.06753],[-92.99377,48.62474],[-93.34877,48.62604],[-93.35529,48.61124],[-93.37074,48.60584],[-93.39812,48.60369],[-93.40542,48.61089],[-93.43846,48.59478],[-93.46859,48.59205],[-93.45735,48.56667],[-93.46533,48.54593],[-93.64763,48.51751],[-93.80625,48.51888],[-93.80642,48.58047],[-93.83328,48.62582],[-93.84865,48.63064],[-93.93388,48.6326],[-94.01327,48.64471],[-94.16176,48.64697],[-94.25025,48.65463],[-94.24931,48.67827],[-94.26046,48.69816],[-94.30578,48.71073],[-94.32758,48.70433],[-94.36123,48.70478],[-94.38406,48.71135],[-94.41629,48.71067],[-94.44294,48.69266],[-94.53615,48.7024],[-94.55031,48.71419],[-94.58894,48.71928],[-94.69425,48.77938],[-94.70129,48.83376],[-94.68996,48.83953],[-94.68395,48.99914],[-111.96064,48.99841]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[180,55],[170,53],[180,49],[180,55]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[143,22],[147,22],[147,12],[143,12],[143,22]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-171.5,-10],[-171,-15],[-167,-15],[-171.5,-10]]]}}]},"featureIcons":{"circle-stroked-24":{"x":0,"y":0,"width":24,"height":24},"circle-stroked-18":{"x":24,"y":0,"width":18,"height":18},"circle-stroked-12":{"x":42,"y":0,"width":12,"height":12},"circle-24":{"x":54,"y":0,"width":24,"height":24},"circle-18":{"x":78,"y":0,"width":18,"height":18},"circle-12":{"x":96,"y":0,"width":12,"height":12},"square-stroked-24":{"x":108,"y":0,"width":24,"height":24},"square-stroked-18":{"x":132,"y":0,"width":18,"height":18},"square-stroked-12":{"x":150,"y":0,"width":12,"height":12},"square-24":{"x":162,"y":0,"width":24,"height":24},"square-18":{"x":186,"y":0,"width":18,"height":18},"square-12":{"x":204,"y":0,"width":12,"height":12},"triangle-stroked-24":{"x":216,"y":0,"width":24,"height":24},"triangle-stroked-18":{"x":240,"y":0,"width":18,"height":18},"triangle-stroked-12":{"x":258,"y":0,"width":12,"height":12},"triangle-24":{"x":0,"y":24,"width":24,"height":24},"triangle-18":{"x":24,"y":24,"width":18,"height":18},"triangle-12":{"x":42,"y":24,"width":12,"height":12},"star-stroked-24":{"x":54,"y":24,"width":24,"height":24},"star-stroked-18":{"x":78,"y":24,"width":18,"height":18},"star-stroked-12":{"x":96,"y":24,"width":12,"height":12},"star-24":{"x":108,"y":24,"width":24,"height":24},"star-18":{"x":132,"y":24,"width":18,"height":18},"star-12":{"x":150,"y":24,"width":12,"height":12},"cross-24":{"x":162,"y":24,"width":24,"height":24},"cross-18":{"x":186,"y":24,"width":18,"height":18},"cross-12":{"x":204,"y":24,"width":12,"height":12},"marker-stroked-24":{"x":216,"y":24,"width":24,"height":24},"marker-stroked-18":{"x":240,"y":24,"width":18,"height":18},"marker-stroked-12":{"x":258,"y":24,"width":12,"height":12},"marker-24":{"x":0,"y":48,"width":24,"height":24},"marker-18":{"x":24,"y":48,"width":18,"height":18},"marker-12":{"x":42,"y":48,"width":12,"height":12},"religious-jewish-24":{"x":54,"y":48,"width":24,"height":24},"religious-jewish-18":{"x":78,"y":48,"width":18,"height":18},"religious-jewish-12":{"x":96,"y":48,"width":12,"height":12},"religious-christian-24":{"x":108,"y":48,"width":24,"height":24},"religious-christian-18":{"x":132,"y":48,"width":18,"height":18},"religious-christian-12":{"x":150,"y":48,"width":12,"height":12},"religious-muslim-24":{"x":162,"y":48,"width":24,"height":24},"religious-muslim-18":{"x":186,"y":48,"width":18,"height":18},"religious-muslim-12":{"x":204,"y":48,"width":12,"height":12},"cemetery-24":{"x":216,"y":48,"width":24,"height":24},"cemetery-18":{"x":240,"y":48,"width":18,"height":18},"cemetery-12":{"x":258,"y":48,"width":12,"height":12},"rocket-24":{"x":0,"y":72,"width":24,"height":24},"rocket-18":{"x":24,"y":72,"width":18,"height":18},"rocket-12":{"x":42,"y":72,"width":12,"height":12},"airport-24":{"x":54,"y":72,"width":24,"height":24},"airport-18":{"x":78,"y":72,"width":18,"height":18},"airport-12":{"x":96,"y":72,"width":12,"height":12},"heliport-24":{"x":108,"y":72,"width":24,"height":24},"heliport-18":{"x":132,"y":72,"width":18,"height":18},"heliport-12":{"x":150,"y":72,"width":12,"height":12},"rail-24":{"x":162,"y":72,"width":24,"height":24},"rail-18":{"x":186,"y":72,"width":18,"height":18},"rail-12":{"x":204,"y":72,"width":12,"height":12},"rail-metro-24":{"x":216,"y":72,"width":24,"height":24},"rail-metro-18":{"x":240,"y":72,"width":18,"height":18},"rail-metro-12":{"x":258,"y":72,"width":12,"height":12},"rail-light-24":{"x":0,"y":96,"width":24,"height":24},"rail-light-18":{"x":24,"y":96,"width":18,"height":18},"rail-light-12":{"x":42,"y":96,"width":12,"height":12},"bus-24":{"x":54,"y":96,"width":24,"height":24},"bus-18":{"x":78,"y":96,"width":18,"height":18},"bus-12":{"x":96,"y":96,"width":12,"height":12},"fuel-24":{"x":108,"y":96,"width":24,"height":24},"fuel-18":{"x":132,"y":96,"width":18,"height":18},"fuel-12":{"x":150,"y":96,"width":12,"height":12},"parking-24":{"x":162,"y":96,"width":24,"height":24},"parking-18":{"x":186,"y":96,"width":18,"height":18},"parking-12":{"x":204,"y":96,"width":12,"height":12},"parking-garage-24":{"x":216,"y":96,"width":24,"height":24},"parking-garage-18":{"x":240,"y":96,"width":18,"height":18},"parking-garage-12":{"x":258,"y":96,"width":12,"height":12},"airfield-24":{"x":0,"y":120,"width":24,"height":24},"airfield-18":{"x":24,"y":120,"width":18,"height":18},"airfield-12":{"x":42,"y":120,"width":12,"height":12},"roadblock-24":{"x":54,"y":120,"width":24,"height":24},"roadblock-18":{"x":78,"y":120,"width":18,"height":18},"roadblock-12":{"x":96,"y":120,"width":12,"height":12},"ferry-24":{"x":108,"y":120,"width":24,"height":24},"ferry-18":{"x":132,"y":120,"width":18,"height":18},"ferry-12":{"x":150,"y":120,"width":12,"height":12},"harbor-24":{"x":162,"y":120,"width":24,"height":24},"harbor-18":{"x":186,"y":120,"width":18,"height":18},"harbor-12":{"x":204,"y":120,"width":12,"height":12},"bicycle-24":{"x":216,"y":120,"width":24,"height":24},"bicycle-18":{"x":240,"y":120,"width":18,"height":18},"bicycle-12":{"x":258,"y":120,"width":12,"height":12},"park-24":{"x":0,"y":144,"width":24,"height":24},"park-18":{"x":24,"y":144,"width":18,"height":18},"park-12":{"x":42,"y":144,"width":12,"height":12},"park2-24":{"x":54,"y":144,"width":24,"height":24},"park2-18":{"x":78,"y":144,"width":18,"height":18},"park2-12":{"x":96,"y":144,"width":12,"height":12},"museum-24":{"x":108,"y":144,"width":24,"height":24},"museum-18":{"x":132,"y":144,"width":18,"height":18},"museum-12":{"x":150,"y":144,"width":12,"height":12},"lodging-24":{"x":162,"y":144,"width":24,"height":24},"lodging-18":{"x":186,"y":144,"width":18,"height":18},"lodging-12":{"x":204,"y":144,"width":12,"height":12},"monument-24":{"x":216,"y":144,"width":24,"height":24},"monument-18":{"x":240,"y":144,"width":18,"height":18},"monument-12":{"x":258,"y":144,"width":12,"height":12},"zoo-24":{"x":0,"y":168,"width":24,"height":24},"zoo-18":{"x":24,"y":168,"width":18,"height":18},"zoo-12":{"x":42,"y":168,"width":12,"height":12},"garden-24":{"x":54,"y":168,"width":24,"height":24},"garden-18":{"x":78,"y":168,"width":18,"height":18},"garden-12":{"x":96,"y":168,"width":12,"height":12},"campsite-24":{"x":108,"y":168,"width":24,"height":24},"campsite-18":{"x":132,"y":168,"width":18,"height":18},"campsite-12":{"x":150,"y":168,"width":12,"height":12},"theatre-24":{"x":162,"y":168,"width":24,"height":24},"theatre-18":{"x":186,"y":168,"width":18,"height":18},"theatre-12":{"x":204,"y":168,"width":12,"height":12},"art-gallery-24":{"x":216,"y":168,"width":24,"height":24},"art-gallery-18":{"x":240,"y":168,"width":18,"height":18},"art-gallery-12":{"x":258,"y":168,"width":12,"height":12},"pitch-24":{"x":0,"y":192,"width":24,"height":24},"pitch-18":{"x":24,"y":192,"width":18,"height":18},"pitch-12":{"x":42,"y":192,"width":12,"height":12},"soccer-24":{"x":54,"y":192,"width":24,"height":24},"soccer-18":{"x":78,"y":192,"width":18,"height":18},"soccer-12":{"x":96,"y":192,"width":12,"height":12},"america-football-24":{"x":108,"y":192,"width":24,"height":24},"america-football-18":{"x":132,"y":192,"width":18,"height":18},"america-football-12":{"x":150,"y":192,"width":12,"height":12},"tennis-24":{"x":162,"y":192,"width":24,"height":24},"tennis-18":{"x":186,"y":192,"width":18,"height":18},"tennis-12":{"x":204,"y":192,"width":12,"height":12},"basketball-24":{"x":216,"y":192,"width":24,"height":24},"basketball-18":{"x":240,"y":192,"width":18,"height":18},"basketball-12":{"x":258,"y":192,"width":12,"height":12},"baseball-24":{"x":0,"y":216,"width":24,"height":24},"baseball-18":{"x":24,"y":216,"width":18,"height":18},"baseball-12":{"x":42,"y":216,"width":12,"height":12},"golf-24":{"x":54,"y":216,"width":24,"height":24},"golf-18":{"x":78,"y":216,"width":18,"height":18},"golf-12":{"x":96,"y":216,"width":12,"height":12},"swimming-24":{"x":108,"y":216,"width":24,"height":24},"swimming-18":{"x":132,"y":216,"width":18,"height":18},"swimming-12":{"x":150,"y":216,"width":12,"height":12},"cricket-24":{"x":162,"y":216,"width":24,"height":24},"cricket-18":{"x":186,"y":216,"width":18,"height":18},"cricket-12":{"x":204,"y":216,"width":12,"height":12},"skiing-24":{"x":216,"y":216,"width":24,"height":24},"skiing-18":{"x":240,"y":216,"width":18,"height":18},"skiing-12":{"x":258,"y":216,"width":12,"height":12},"school-24":{"x":0,"y":240,"width":24,"height":24},"school-18":{"x":24,"y":240,"width":18,"height":18},"school-12":{"x":42,"y":240,"width":12,"height":12},"college-24":{"x":54,"y":240,"width":24,"height":24},"college-18":{"x":78,"y":240,"width":18,"height":18},"college-12":{"x":96,"y":240,"width":12,"height":12},"library-24":{"x":108,"y":240,"width":24,"height":24},"library-18":{"x":132,"y":240,"width":18,"height":18},"library-12":{"x":150,"y":240,"width":12,"height":12},"post-24":{"x":162,"y":240,"width":24,"height":24},"post-18":{"x":186,"y":240,"width":18,"height":18},"post-12":{"x":204,"y":240,"width":12,"height":12},"fire-station-24":{"x":216,"y":240,"width":24,"height":24},"fire-station-18":{"x":240,"y":240,"width":18,"height":18},"fire-station-12":{"x":258,"y":240,"width":12,"height":12},"town-hall-24":{"x":0,"y":264,"width":24,"height":24},"town-hall-18":{"x":24,"y":264,"width":18,"height":18},"town-hall-12":{"x":42,"y":264,"width":12,"height":12},"police-24":{"x":54,"y":264,"width":24,"height":24},"police-18":{"x":78,"y":264,"width":18,"height":18},"police-12":{"x":96,"y":264,"width":12,"height":12},"prison-24":{"x":108,"y":264,"width":24,"height":24},"prison-18":{"x":132,"y":264,"width":18,"height":18},"prison-12":{"x":150,"y":264,"width":12,"height":12},"embassy-24":{"x":162,"y":264,"width":24,"height":24},"embassy-18":{"x":186,"y":264,"width":18,"height":18},"embassy-12":{"x":204,"y":264,"width":12,"height":12},"beer-24":{"x":216,"y":264,"width":24,"height":24},"beer-18":{"x":240,"y":264,"width":18,"height":18},"beer-12":{"x":258,"y":264,"width":12,"height":12},"restaurant-24":{"x":0,"y":288,"width":24,"height":24},"restaurant-18":{"x":24,"y":288,"width":18,"height":18},"restaurant-12":{"x":42,"y":288,"width":12,"height":12},"cafe-24":{"x":54,"y":288,"width":24,"height":24},"cafe-18":{"x":78,"y":288,"width":18,"height":18},"cafe-12":{"x":96,"y":288,"width":12,"height":12},"shop-24":{"x":108,"y":288,"width":24,"height":24},"shop-18":{"x":132,"y":288,"width":18,"height":18},"shop-12":{"x":150,"y":288,"width":12,"height":12},"fast-food-24":{"x":162,"y":288,"width":24,"height":24},"fast-food-18":{"x":186,"y":288,"width":18,"height":18},"fast-food-12":{"x":204,"y":288,"width":12,"height":12},"bar-24":{"x":216,"y":288,"width":24,"height":24},"bar-18":{"x":240,"y":288,"width":18,"height":18},"bar-12":{"x":258,"y":288,"width":12,"height":12},"bank-24":{"x":0,"y":312,"width":24,"height":24},"bank-18":{"x":24,"y":312,"width":18,"height":18},"bank-12":{"x":42,"y":312,"width":12,"height":12},"grocery-24":{"x":54,"y":312,"width":24,"height":24},"grocery-18":{"x":78,"y":312,"width":18,"height":18},"grocery-12":{"x":96,"y":312,"width":12,"height":12},"cinema-24":{"x":108,"y":312,"width":24,"height":24},"cinema-18":{"x":132,"y":312,"width":18,"height":18},"cinema-12":{"x":150,"y":312,"width":12,"height":12},"pharmacy-24":{"x":162,"y":312,"width":24,"height":24},"pharmacy-18":{"x":186,"y":312,"width":18,"height":18},"pharmacy-12":{"x":204,"y":312,"width":12,"height":12},"hospital-24":{"x":216,"y":312,"width":24,"height":24},"hospital-18":{"x":240,"y":312,"width":18,"height":18},"hospital-12":{"x":258,"y":312,"width":12,"height":12},"danger-24":{"x":0,"y":336,"width":24,"height":24},"danger-18":{"x":24,"y":336,"width":18,"height":18},"danger-12":{"x":42,"y":336,"width":12,"height":12},"industrial-24":{"x":54,"y":336,"width":24,"height":24},"industrial-18":{"x":78,"y":336,"width":18,"height":18},"industrial-12":{"x":96,"y":336,"width":12,"height":12},"warehouse-24":{"x":108,"y":336,"width":24,"height":24},"warehouse-18":{"x":132,"y":336,"width":18,"height":18},"warehouse-12":{"x":150,"y":336,"width":12,"height":12},"commercial-24":{"x":162,"y":336,"width":24,"height":24},"commercial-18":{"x":186,"y":336,"width":18,"height":18},"commercial-12":{"x":204,"y":336,"width":12,"height":12},"building-24":{"x":216,"y":336,"width":24,"height":24},"building-18":{"x":240,"y":336,"width":18,"height":18},"building-12":{"x":258,"y":336,"width":12,"height":12},"place-of-worship-24":{"x":0,"y":360,"width":24,"height":24},"place-of-worship-18":{"x":24,"y":360,"width":18,"height":18},"place-of-worship-12":{"x":42,"y":360,"width":12,"height":12},"alcohol-shop-24":{"x":54,"y":360,"width":24,"height":24},"alcohol-shop-18":{"x":78,"y":360,"width":18,"height":18},"alcohol-shop-12":{"x":96,"y":360,"width":12,"height":12},"logging-24":{"x":108,"y":360,"width":24,"height":24},"logging-18":{"x":132,"y":360,"width":18,"height":18},"logging-12":{"x":150,"y":360,"width":12,"height":12},"oil-well-24":{"x":162,"y":360,"width":24,"height":24},"oil-well-18":{"x":186,"y":360,"width":18,"height":18},"oil-well-12":{"x":204,"y":360,"width":12,"height":12},"slaughterhouse-24":{"x":216,"y":360,"width":24,"height":24},"slaughterhouse-18":{"x":240,"y":360,"width":18,"height":18},"slaughterhouse-12":{"x":258,"y":360,"width":12,"height":12},"dam-24":{"x":0,"y":384,"width":24,"height":24},"dam-18":{"x":24,"y":384,"width":18,"height":18},"dam-12":{"x":42,"y":384,"width":12,"height":12},"water-24":{"x":54,"y":384,"width":24,"height":24},"water-18":{"x":78,"y":384,"width":18,"height":18},"water-12":{"x":96,"y":384,"width":12,"height":12},"wetland-24":{"x":108,"y":384,"width":24,"height":24},"wetland-18":{"x":132,"y":384,"width":18,"height":18},"wetland-12":{"x":150,"y":384,"width":12,"height":12},"disability-24":{"x":162,"y":384,"width":24,"height":24},"disability-18":{"x":186,"y":384,"width":18,"height":18},"disability-12":{"x":204,"y":384,"width":12,"height":12},"telephone-24":{"x":216,"y":384,"width":24,"height":24},"telephone-18":{"x":240,"y":384,"width":18,"height":18},"telephone-12":{"x":258,"y":384,"width":12,"height":12},"emergency-telephone-24":{"x":0,"y":408,"width":24,"height":24},"emergency-telephone-18":{"x":24,"y":408,"width":18,"height":18},"emergency-telephone-12":{"x":42,"y":408,"width":12,"height":12},"toilets-24":{"x":54,"y":408,"width":24,"height":24},"toilets-18":{"x":78,"y":408,"width":18,"height":18},"toilets-12":{"x":96,"y":408,"width":12,"height":12},"waste-basket-24":{"x":108,"y":408,"width":24,"height":24},"waste-basket-18":{"x":132,"y":408,"width":18,"height":18},"waste-basket-12":{"x":150,"y":408,"width":12,"height":12},"music-24":{"x":162,"y":408,"width":24,"height":24},"music-18":{"x":186,"y":408,"width":18,"height":18},"music-12":{"x":204,"y":408,"width":12,"height":12},"land-use-24":{"x":216,"y":408,"width":24,"height":24},"land-use-18":{"x":240,"y":408,"width":18,"height":18},"land-use-12":{"x":258,"y":408,"width":12,"height":12},"city-24":{"x":0,"y":432,"width":24,"height":24},"city-18":{"x":24,"y":432,"width":18,"height":18},"city-12":{"x":42,"y":432,"width":12,"height":12},"town-24":{"x":54,"y":432,"width":24,"height":24},"town-18":{"x":78,"y":432,"width":18,"height":18},"town-12":{"x":96,"y":432,"width":12,"height":12},"village-24":{"x":108,"y":432,"width":24,"height":24},"village-18":{"x":132,"y":432,"width":18,"height":18},"village-12":{"x":150,"y":432,"width":12,"height":12},"farm-24":{"x":162,"y":432,"width":24,"height":24},"farm-18":{"x":186,"y":432,"width":18,"height":18},"farm-12":{"x":204,"y":432,"width":12,"height":12},"bakery-24":{"x":216,"y":432,"width":24,"height":24},"bakery-18":{"x":240,"y":432,"width":18,"height":18},"bakery-12":{"x":258,"y":432,"width":12,"height":12},"dog-park-24":{"x":0,"y":456,"width":24,"height":24},"dog-park-18":{"x":24,"y":456,"width":18,"height":18},"dog-park-12":{"x":42,"y":456,"width":12,"height":12},"lighthouse-24":{"x":54,"y":456,"width":24,"height":24},"lighthouse-18":{"x":78,"y":456,"width":18,"height":18},"lighthouse-12":{"x":96,"y":456,"width":12,"height":12},"clothing-store-24":{"x":108,"y":456,"width":24,"height":24},"clothing-store-18":{"x":132,"y":456,"width":18,"height":18},"clothing-store-12":{"x":150,"y":456,"width":12,"height":12},"polling-place-24":{"x":162,"y":456,"width":24,"height":24},"polling-place-18":{"x":186,"y":456,"width":18,"height":18},"polling-place-12":{"x":204,"y":456,"width":12,"height":12},"playground-24":{"x":216,"y":456,"width":24,"height":24},"playground-18":{"x":240,"y":456,"width":18,"height":18},"playground-12":{"x":258,"y":456,"width":12,"height":12},"entrance-24":{"x":0,"y":480,"width":24,"height":24},"entrance-18":{"x":24,"y":480,"width":18,"height":18},"entrance-12":{"x":42,"y":480,"width":12,"height":12},"heart-24":{"x":54,"y":480,"width":24,"height":24},"heart-18":{"x":78,"y":480,"width":18,"height":18},"heart-12":{"x":96,"y":480,"width":12,"height":12},"london-underground-24":{"x":108,"y":480,"width":24,"height":24},"london-underground-18":{"x":132,"y":480,"width":18,"height":18},"london-underground-12":{"x":150,"y":480,"width":12,"height":12},"minefield-24":{"x":162,"y":480,"width":24,"height":24},"minefield-18":{"x":186,"y":480,"width":18,"height":18},"minefield-12":{"x":204,"y":480,"width":12,"height":12},"rail-underground-24":{"x":216,"y":480,"width":24,"height":24},"rail-underground-18":{"x":240,"y":480,"width":18,"height":18},"rail-underground-12":{"x":258,"y":480,"width":12,"height":12},"rail-above-24":{"x":0,"y":504,"width":24,"height":24},"rail-above-18":{"x":24,"y":504,"width":18,"height":18},"rail-above-12":{"x":42,"y":504,"width":12,"height":12},"camera-24":{"x":54,"y":504,"width":24,"height":24},"camera-18":{"x":78,"y":504,"width":18,"height":18},"camera-12":{"x":96,"y":504,"width":12,"height":12},"laundry-24":{"x":108,"y":504,"width":24,"height":24},"laundry-18":{"x":132,"y":504,"width":18,"height":18},"laundry-12":{"x":150,"y":504,"width":12,"height":12},"car-24":{"x":162,"y":504,"width":24,"height":24},"car-18":{"x":186,"y":504,"width":18,"height":18},"car-12":{"x":204,"y":504,"width":12,"height":12},"suitcase-24":{"x":216,"y":504,"width":24,"height":24},"suitcase-18":{"x":240,"y":504,"width":18,"height":18},"suitcase-12":{"x":258,"y":504,"width":12,"height":12},"hairdresser-24":{"x":0,"y":528,"width":24,"height":24},"hairdresser-18":{"x":24,"y":528,"width":18,"height":18},"hairdresser-12":{"x":42,"y":528,"width":12,"height":12},"chemist-24":{"x":54,"y":528,"width":24,"height":24},"chemist-18":{"x":78,"y":528,"width":18,"height":18},"chemist-12":{"x":96,"y":528,"width":12,"height":12},"mobilephone-24":{"x":108,"y":528,"width":24,"height":24},"mobilephone-18":{"x":132,"y":528,"width":18,"height":18},"mobilephone-12":{"x":150,"y":528,"width":12,"height":12},"scooter-24":{"x":162,"y":528,"width":24,"height":24},"scooter-18":{"x":186,"y":528,"width":18,"height":18},"scooter-12":{"x":204,"y":528,"width":12,"height":12},"gift-24":{"x":216,"y":528,"width":24,"height":24},"gift-18":{"x":240,"y":528,"width":18,"height":18},"gift-12":{"x":258,"y":528,"width":12,"height":12},"ice-cream-24":{"x":0,"y":552,"width":24,"height":24},"ice-cream-18":{"x":24,"y":552,"width":18,"height":18},"ice-cream-12":{"x":42,"y":552,"width":12,"height":12}},"locales":["af","sq","ar","ar-AA","hy","ast","bn","bs","bg-BG","ca","zh","zh-CN","zh-HK","zh-TW","yue","hr","cs","da","nl","en-GB","eo","et","fi","fr","gl","de","el","hi","hu","is","id","it","ja","kn","ko","lv","lij","lt","no","fa","pl","pt","pt-BR","ro","ru","sc","sr","si","sk","sl","es","sv","tl","ta","te","th","tr","uk","vi"],"en":{"modes":{"add_area":{"title":"Area","description":"Add parks, buildings, lakes or other areas to the map.","tail":"Click on the map to start drawing an area, like a park, lake, or building."},"add_line":{"title":"Line","description":"Add highways, streets, pedestrian paths, canals or other lines to the map.","tail":"Click on the map to start drawing a road, path, or route."},"add_point":{"title":"Point","description":"Add restaurants, monuments, postal boxes or other points to the map.","tail":"Click on the map to add a point."},"browse":{"title":"Browse","description":"Pan and zoom the map."},"draw_area":{"tail":"Click to add nodes to your area. Click the first node to finish the area."},"draw_line":{"tail":"Click to add more nodes to the line. Click on other lines to connect to them, and double-click to end the line."}},"operations":{"add":{"annotation":{"point":"Added a point.","vertex":"Added a node to a way.","relation":"Added a relation."}},"start":{"annotation":{"line":"Started a line.","area":"Started an area."}},"continue":{"key":"A","title":"Continue","description":"Continue this line.","not_eligible":"No line can be continued here.","multiple":"Several lines can be continued here. To choose a line, press the Shift key and click on it to select it.","annotation":{"line":"Continued a line.","area":"Continued an area."}},"cancel_draw":{"annotation":"Canceled drawing."},"change_role":{"annotation":"Changed the role of a relation member."},"change_tags":{"annotation":"Changed tags."},"circularize":{"title":"Circularize","description":{"line":"Make this line circular.","area":"Make this area circular."},"key":"O","annotation":{"line":"Made a line circular.","area":"Made an area circular."},"not_closed":"This can't be made circular because it's not a loop.","too_large":"This can't be made circular because not enough of it is currently visible.","connected_to_hidden":"This can't be made circular because it is connected to a hidden feature."},"orthogonalize":{"title":"Square","description":{"line":"Square the corners of this line.","area":"Square the corners of this area."},"key":"S","annotation":{"line":"Squared the corners of a line.","area":"Squared the corners of an area."},"not_squarish":"This can't be made square because it is not squarish.","too_large":"This can't be made square because not enough of it is currently visible.","connected_to_hidden":"This can't be made square because it is connected to a hidden feature."},"straighten":{"title":"Straighten","description":"Straighten this line.","key":"S","annotation":"Straightened a line.","too_bendy":"This can't be straightened because it bends too much.","connected_to_hidden":"This line can't be straightened because it is connected to a hidden feature."},"delete":{"title":"Delete","description":"Delete object 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."},"incomplete_relation":"This feature can't be deleted because it hasn't been fully downloaded.","part_of_relation":"This feature can't be deleted because it's part of a larger relation. You must remove it from the relation first.","connected_to_hidden":"This can't be deleted because it is connected to a hidden feature."},"add_member":{"annotation":"Added a member to a relation."},"delete_member":{"annotation":"Removed a member from a relation."},"connect":{"annotation":{"point":"Connected a way to a point.","vertex":"Connected a way to another.","line":"Connected a way to a line.","area":"Connected a way to an area."}},"disconnect":{"title":"Disconnect","description":"Disconnect these lines/areas from each other.","key":"D","annotation":"Disconnected lines/areas.","not_connected":"There aren't enough lines/areas here to disconnect.","connected_to_hidden":"This can't be disconnected because it is connected to a hidden feature.","relation":"This can't be disconnected because it connects members of a relation."},"merge":{"title":"Merge","description":"Merge these features.","key":"C","annotation":"Merged {n} features.","not_eligible":"These features can't be merged.","not_adjacent":"These features can't be merged because they aren't connected.","restriction":"These features can't be merged because at least one is a member of a \"{relation}\" relation.","incomplete_relation":"These features can't be merged because at least one hasn't been fully downloaded.","conflicting_tags":"These features can't be merged because some of their tags have conflicting values."},"move":{"title":"Move","description":"Move this 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."},"incomplete_relation":"This feature can't be moved because it hasn't been fully downloaded.","too_large":"This can't be moved because not enough of it is currently visible.","connected_to_hidden":"This can't be moved because it is connected to a hidden feature."},"rotate":{"title":"Rotate","description":"Rotate this object around its center point.","key":"R","annotation":{"line":"Rotated a line.","area":"Rotated an area."},"too_large":"This can't be rotated because not enough of it is currently visible.","connected_to_hidden":"This can't be rotated because it is connected to a hidden feature."},"reverse":{"title":"Reverse","description":"Make this line go in the opposite direction.","key":"V","annotation":"Reversed a line."},"split":{"title":"Split","description":{"line":"Split this line into two at this node.","area":"Split the boundary of this area into two.","multiple":"Split the lines/area boundaries at this node into two."},"key":"X","annotation":{"line":"Split a line.","area":"Split an area boundary.","multiple":"Split {n} lines/area boundaries."},"not_eligible":"Lines can't be split at their beginning or end.","multiple_ways":"There are too many lines here to split.","connected_to_hidden":"This can't be split because it is connected to a hidden feature."},"restriction":{"help":{"select":"Click to select a road segment.","toggle":"Click to toggle turn restrictions.","toggle_on":"Click to add a \"{restriction}\" restriction.","toggle_off":"Click to remove the \"{restriction}\" restriction."},"annotation":{"create":"Added a turn restriction","delete":"Deleted a turn restriction"}}},"undo":{"tooltip":"Undo: {action}","nothing":"Nothing to undo."},"redo":{"tooltip":"Redo: {action}","nothing":"Nothing to redo."},"tooltip_keyhint":"Shortcut:","browser_notice":"This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 11 and above. Please upgrade your browser or use Potlatch 2 to edit the map.","translate":{"translate":"Translate","localized_translation_label":"Multilingual name","localized_translation_language":"Choose language","localized_translation_name":"Name"},"zoom_in_edit":"Zoom in to Edit","logout":"logout","loading_auth":"Connecting to OpenStreetMap...","report_a_bug":"Report a bug","help_translate":"Help translate","feature_info":{"hidden_warning":"{count} hidden features","hidden_details":"These features are currently hidden: {details}"},"status":{"error":"Unable to connect to API.","offline":"The API is offline. Please try editing later.","readonly":"The API is read-only. You will need to wait to save your changes."},"commit":{"title":"Save Changes","description_placeholder":"Brief description of your contributions (required)","message_label":"Changeset comment","upload_explanation":"The changes you upload will be visible on all maps that use OpenStreetMap data.","upload_explanation_with_user":"The changes you upload as {user} will be visible on all maps that use OpenStreetMap data.","save":"Save","cancel":"Cancel","changes":"{count} Changes","warnings":"Warnings","modified":"Modified","deleted":"Deleted","created":"Created","about_changeset_comments":"About changeset comments","about_changeset_comments_link":"//wiki.openstreetmap.org/wiki/Good_changeset_comments","google_warning":"You mentioned Google in this comment: remember that copying from Google Maps is strictly forbidden.","google_warning_link":"http://www.openstreetmap.org/copyright"},"contributors":{"list":"Edits by {users}","truncated_list":"Edits by {users} and {count} others"},"infobox":{"selected":"{n} selected","geometry":"Geometry","closed":"closed","center":"Center","perimeter":"Perimeter","length":"Length","area":"Area","centroid":"Centroid","location":"Location","metric":"Metric","imperial":"Imperial"},"geometry":{"point":"point","vertex":"vertex","line":"line","area":"area","relation":"relation"},"geocoder":{"search":"Search worldwide...","no_results_visible":"No results in visible map area","no_results_worldwide":"No results found"},"geolocate":{"title":"Show My Location","locating":"Locating, please wait..."},"inspector":{"no_documentation_combination":"There is no documentation available for this tag combination","no_documentation_key":"There is no documentation available for this key","show_more":"Show More","view_on_osm":"View on openstreetmap.org","all_fields":"All fields","all_tags":"All tags","all_members":"All members","all_relations":"All relations","new_relation":"New relation...","role":"Role","choose":"Select feature type","results":"{n} results for {search}","reference":"View on OpenStreetMap Wiki","back_tooltip":"Change feature","remove":"Remove","search":"Search","multiselect":"Selected items","unknown":"Unknown","incomplete":"","feature_list":"Search features","edit":"Edit feature","check":{"yes":"Yes","no":"No"},"add":"Add","none":"None","node":"Node","way":"Way","relation":"Relation","location":"Location","add_fields":"Add field:"},"background":{"title":"Background","description":"Background settings","percent_brightness":"{opacity}% brightness","none":"None","best_imagery":"Best known imagery source for this location","switch":"Switch back to this background","custom":"Custom","custom_button":"Edit custom background","custom_prompt":"Enter a tile URL template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.","fix_misalignment":"Adjust imagery offset","imagery_source_faq":"Where does this imagery come from?","reset":"reset","offset":"Drag anywhere in the gray area below to adjust the imagery offset, or enter the offset values in meters.","minimap":{"description":"Minimap","tooltip":"Show a zoomed out map to help locate the area currently displayed."}},"map_data":{"title":"Map Data","description":"Map Data","data_layers":"Data Layers","fill_area":"Fill Areas","map_features":"Map Features","autohidden":"These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them."},"feature":{"points":{"description":"Points","tooltip":"Points of Interest"},"traffic_roads":{"description":"Traffic Roads","tooltip":"Highways, Streets, etc."},"service_roads":{"description":"Service Roads","tooltip":"Service Roads, Parking Aisles, Tracks, etc."},"paths":{"description":"Paths","tooltip":"Sidewalks, Foot Paths, Cycle Paths, etc."},"buildings":{"description":"Buildings","tooltip":"Buildings, Shelters, Garages, etc."},"landuse":{"description":"Landuse Features","tooltip":"Forests, Farmland, Parks, Residential, Commercial, etc."},"boundaries":{"description":"Boundaries","tooltip":"Administrative Boundaries"},"water":{"description":"Water Features","tooltip":"Rivers, Lakes, Ponds, Basins, etc."},"rail":{"description":"Rail Features","tooltip":"Railways"},"power":{"description":"Power Features","tooltip":"Power Lines, Power Plants, Substations, etc."},"past_future":{"description":"Past/Future","tooltip":"Proposed, Construction, Abandoned, Demolished, etc."},"others":{"description":"Others","tooltip":"Everything Else"}},"area_fill":{"wireframe":{"description":"No Fill (Wireframe)","tooltip":"Enabling wireframe mode makes it easy to see the background imagery."},"partial":{"description":"Partial Fill","tooltip":"Areas are drawn with fill only around their inner edges. (Recommended for beginner mappers)"},"full":{"description":"Full Fill","tooltip":"Areas are drawn fully filled."}},"restore":{"heading":"You have unsaved changes","description":"Do you wish to restore unsaved changes from a previous editing session?","restore":"Restore","reset":"Reset"},"save":{"title":"Save","help":"Save changes to OpenStreetMap, making them visible to other users.","no_changes":"No changes to save.","error":"Errors occurred while trying to save","status_code":"Server returned status code {code}","unknown_error_details":"Please ensure you are connected to the internet.","uploading":"Uploading changes to OpenStreetMap.","unsaved_changes":"You have unsaved changes","conflict":{"header":"Resolve conflicting edits","count":"Conflict {num} of {total}","previous":"< Previous","next":"Next >","keep_local":"Keep mine","keep_remote":"Use theirs","restore":"Restore","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"}},"merge_remote_changes":{"conflict":{"deleted":"This object has been deleted by {user}.","location":"This object 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}\"."}},"success":{"edited_osm":"Edited OSM!","just_edited":"You just edited OpenStreetMap!","view_on_osm":"View on OSM","facebook":"Share on Facebook","twitter":"Share on Twitter","google":"Share on Google+","help_html":"Your changes should appear in the \"Standard\" layer in a few minutes. Other layers, and certain features, may take longer.","help_link_text":"Details","help_link_url":"https://wiki.openstreetmap.org/wiki/FAQ#I_have_just_made_some_changes_to_the_map._How_do_I_get_to_see_my_changes.3F"},"confirm":{"okay":"Okay","cancel":"Cancel"},"splash":{"welcome":"Welcome to the iD OpenStreetMap editor","text":"iD is a friendly but powerful tool for contributing to the world's best free world map. This is version {version}. For more information see {website} and report bugs at {github}.","walkthrough":"Start the Walkthrough","start":"Edit Now"},"source_switch":{"live":"live","lose_changes":"You have unsaved changes. Switching the map server will discard them. Are you sure you want to switch servers?","dev":"dev"},"tag_reference":{"description":"Description","on_wiki":"{tag} on wiki.osm.org","used_with":"used with {type}"},"validations":{"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.","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.","untagged_area_tooltip":"Select a feature type that describes what this area is.","deprecated_tags":"Deprecated tags: {tags}"},"zoom":{"in":"Zoom In","out":"Zoom Out"},"cannot_zoom":"Cannot zoom out further in current mode.","full_screen":"Toggle Full Screen","gpx":{"local_layer":"Local GPX file","drag_drop":"Drag and drop a .gpx file on the page, or click the button to the right to browse","zoom":"Zoom to GPX track","browse":"Browse for a .gpx file"},"mapillary_images":{"tooltip":"Street-level photos from Mapillary","title":"Photo Overlay (Mapillary)"},"mapillary_signs":{"tooltip":"Traffic signs from Mapillary (must enable Photo Overlay)","title":"Traffic Sign Overlay (Mapillary)"},"mapillary":{"view_on_mapillary":"View this image on Mapillary"},"help":{"title":"Help","help":"# Help\n\nThis is an editor for [OpenStreetMap](http://www.openstreetmap.org/), the\nfree and editable map of the world. You can use it to add and update\ndata in your area, making an open-source and open-data map of the world\nbetter for everyone.\n\nEdits that you make on this map will be visible to everyone who uses\nOpenStreetMap. In order to make an edit, you'll need to\n[log in](https://www.openstreetmap.org/login).\n\nThe [iD editor](http://ideditor.com/) is a collaborative project with [source\ncode available on GitHub](https://github.com/openstreetmap/iD).\n","editing_saving":"# Editing & Saving\n\nThis editor is designed to work primarily online, and you're accessing\nit through a website right now.\n\n### Selecting Features\n\nTo select a map feature, like a road or point of interest, click\non it on the map. This will highlight the selected feature, open a panel with\ndetails about it, and show a menu of things you can do with the feature.\n\nTo select multiple features, hold down the 'Shift' key. Then either click\non the features you want to select, or drag on the map to draw a rectangle.\nThis will draw a box and select all the points within it.\n\n### Saving Edits\n\nWhen you make changes like editing roads, buildings, and places, these are\nstored locally until you save them to the server. Don't worry if you make\na mistake - you can undo changes by clicking the undo button, and redo\nchanges by clicking the redo button.\n\nClick 'Save' to finish a group of edits - for instance, if you've completed\nan area of town and would like to start on a new area. You'll have a chance\nto review what you've done, and the editor supplies helpful suggestions\nand warnings if something doesn't seem right about the changes.\n\nIf everything looks good, you can enter a short comment explaining the change\nyou made, and click 'Save' again to post the changes\nto [OpenStreetMap.org](http://www.openstreetmap.org/), where they are visible\nto all other users and available for others to build and improve upon.\n\nIf you can't finish your edits in one sitting, you can leave the editor\nwindow and come back (on the same browser and computer), and the\neditor application will offer to restore your work.\n\n### Using the editor\n\nA list of available keyboard shortcuts can be found [here](http://wiki.openstreetmap.org/wiki/ID/Shortcuts).\n","roads":"# Roads\n\nYou can create, fix, and delete roads with this editor. Roads can be all\nkinds: paths, highways, trails, cycleways, and more - any often-crossed\nsegment should be mappable.\n\n### Selecting\n\nClick on a road to select it. An outline should become visible, along\nwith a small tools menu on the map and a sidebar showing more information\nabout the road.\n\n### Modifying\n\nOften you'll see roads that aren't aligned to the imagery behind them\nor to a GPS track. You can adjust these roads so they are in the correct\nplace.\n\nFirst click on the road you want to change. This will highlight it and show\ncontrol points along it that you can drag to better locations. If\nyou want to add new control points for more detail, double-click a part\nof the road without a node, and one will be added.\n\nIf the road connects to another road, but doesn't properly connect on\nthe map, you can drag one of its control points onto the other road in\norder to join them. Having roads connect is important for the map\nand essential for providing driving directions.\n\nYou can also click the 'Move' tool or press the `M` shortcut key to move the entire road at\none time, and then click again to save that movement.\n\n### Deleting\n\nIf a road is entirely incorrect - you can see that it doesn't exist in satellite\nimagery and ideally have confirmed locally that it's not present - you can delete\nit, which removes it from the map. Be cautious when deleting features -\nlike any other edit, the results are seen by everyone and satellite imagery\nis often out of date, so the road could simply be newly built.\n\nYou can delete a road by clicking on it to select it, then clicking the\ntrash can icon or pressing the 'Delete' key.\n\n### Creating\n\nFound somewhere there should be a road but there isn't? Click the 'Line'\nicon in the top-left of the editor or press the shortcut key `2` to start drawing\na line.\n\nClick on the start of the road on the map to start drawing. If the road\nbranches off from an existing road, start by clicking on the place where they connect.\n\nThen click on points along the road so that it follows the right path, according\nto satellite imagery or GPS. If the road you are drawing crosses another road, connect\nit by clicking on the intersection point. When you're done drawing, double-click\nor press 'Return' or 'Enter' on your keyboard.\n","gps":"# GPS\n\nCollected GPS traces are one valuable source of data for OpenStreetMap. This editor\nsupports local traces - `.gpx` files on your local computer. You can collect\nthis kind of GPS trace with a number of smartphone applications as well as\npersonal GPS hardware.\n\nFor information on how to perform a GPS survey, read\n[Mapping with a smartphone, GPS, or paper](http://learnosm.org/en/mobile-mapping/).\n\nTo use a GPX track for mapping, drag and drop the GPX file onto the map\neditor. If it's recognized, it will be added to the map as a bright purple\nline. Click on the 'Map Data' menu on the right side to enable,\ndisable, or zoom to this new GPX-powered layer.\n\nThe GPX track isn't directly uploaded to OpenStreetMap - the best way to\nuse it is to draw on the map, using it as a guide for the new features that\nyou add, and also to [upload it to OpenStreetMap](http://www.openstreetmap.org/trace/create)\nfor other users to use.\n","imagery":"# Imagery\n\nAerial imagery is an important resource for mapping. A combination of\nairplane flyovers, satellite views, and freely-compiled sources are available\nin the editor under the 'Background Settings' menu on the right.\n\nBy default a [Bing Maps](http://www.bing.com/maps/) satellite layer is\npresented in the editor, but as you pan and zoom the map to new geographical\nareas, new sources will become available. Some countries, like the United\nStates, France, and Denmark have very high-quality imagery available for some areas.\n\nImagery is sometimes offset from the map data because of a mistake on the\nimagery provider's side. If you see a lot of roads shifted from the background,\ndon't immediately move them all to match the background. Instead you can adjust\nthe imagery so that it matches the existing data by clicking 'Fix alignment' at\nthe bottom of the Background Settings UI.\n","addresses":"# Addresses\n\nAddresses are some of the most useful information for the map.\n\nAlthough addresses are often represented as parts of streets, in OpenStreetMap\nthey're recorded as attributes of buildings and places along streets.\n\nYou can add address information to places mapped as building outlines\nas well as those mapped as single points. The optimal source of address\ndata is from an on-the-ground survey or personal knowledge - as with any\nother feature, copying from commercial sources like Google Maps is strictly\nforbidden.\n","inspector":"# Using the Inspector\n\nThe inspector is the section on the left side of the page that allows you to\nedit the details of the selected feature.\n\n### Selecting a Feature Type\n\nAfter you add a point, line, or area, you can choose what type of feature it\nis, like whether it's a highway or residential road, supermarket or cafe.\nThe inspector will display buttons for common feature types, and you can\nfind others by typing what you're looking for in the search box.\n\nClick the 'i' in the bottom-right-hand corner of a feature type button to\nlearn more about it. Click a button to choose that type.\n\n### Using Forms and Editing Tags\n\nAfter you choose a feature type, or when you select a feature that already\nhas a type assigned, the inspector will display fields with details about\nthe feature like its name and address.\n\nBelow the fields you see, you can click the 'Add field' dropdown to add\nother details, like a Wikipedia link, wheelchair access, and more.\n\nAt the bottom of the inspector, click 'Additional tags' to add arbitrary\nother tags to the element. [Taginfo](http://taginfo.openstreetmap.org/) is a\ngreat resource for learn more about popular tag combinations.\n\nChanges you make in the inspector are automatically applied to the map.\nYou can undo them at any time by clicking the 'Undo' button.\n","buildings":"# Buildings\n\nOpenStreetMap is the world's largest database of buildings. You can create\nand improve this database.\n\n### Selecting\n\nYou can select a building by clicking on its border. This will highlight the\nbuilding and open a small tools menu and a sidebar showing more information\nabout the building.\n\n### Modifying\n\nSometimes buildings are incorrectly placed or have incorrect tags.\n\nTo move an entire building, select it, then click the 'Move' tool. Move your\nmouse to shift the building, and click when it's correctly placed.\n\nTo fix the specific shape of a building, click and drag the nodes that form\nits border into better places.\n\n### Creating\n\nOne of the main questions around adding buildings to the map is that\nOpenStreetMap records buildings both as shapes and points. The rule of thumb\nis to _map a building as a shape whenever possible_, and map companies, homes,\namenities, and other things that operate out of buildings as points placed\nwithin the building shape.\n\nStart drawing a building as a shape by clicking the 'Area' button in the top\nleft of the interface, and end it either by pressing 'Return' on your keyboard\nor clicking on the first node drawn to close the shape.\n\n### Deleting\n\nIf a building is entirely incorrect - you can see that it doesn't exist in satellite\nimagery and ideally have confirmed locally that it's not present - you can delete\nit, which removes it from the map. Be cautious when deleting features -\nlike any other edit, the results are seen by everyone and satellite imagery\nis often out of date, so the building could simply be newly built.\n\nYou can delete a building by clicking on it to select it, then clicking the\ntrash can icon or pressing the 'Delete' key.\n","relations":"# Relations\n\nA relation is a special type of feature in OpenStreetMap that groups together\nother features. For example, two common types of relations are *route relations*,\nwhich group together sections of road that belong to a specific freeway or\nhighway, and *multipolygons*, which group together several lines that define\na complex area (one with several pieces or holes in it like a donut).\n\nThe group of features in a relation are called *members*. In the sidebar, you can\nsee which relations a feature is a member of, and click on a relation there\nto select the it. When the relation is selected, you can see all of its\nmembers listed in the sidebar and highlighted on the map.\n\nFor the most part, iD will take care of maintaining relations automatically\nwhile you edit. The main thing you should be aware of is that if you delete a\nsection of road to redraw it more accurately, you should make sure that the\nnew section is a member of the same relations as the original.\n\n## Editing Relations\n\nIf you want to edit relations, here are the basics.\n\nTo add a feature to a relation, select the feature, click the \"+\" button in the\n\"All relations\" section of the sidebar, and select or type the name of the relation.\n\nTo create a new relation, select the first feature that should be a member,\nclick the \"+\" button in the \"All relations\" section, and select \"New relation...\".\n\nTo remove a feature from a relation, select the feature and click the trash\nbutton next to the relation you want to remove it from.\n\nYou can create multipolygons with holes using the \"Merge\" tool. Draw two areas (inner\nand outer), hold the Shift key and click on each of them to select them both, and then\nclick the \"Merge\" (+) button.\n"},"intro":{"graph":{"city_hall":"Three Rivers City Hall","fire_department":"Three Rivers Fire Department","memory_isle_park":"Memory Isle Park","riverwalk_trail":"Riverwalk Trail","w_michigan_ave":"West Michigan Avenue","e_michigan_ave":"East Michigan Avenue","spring_st":"Spring Street","scidmore_park":"Scidmore Park","petting_zoo":"Scidmore Park Petting Zoo","n_andrews_st":"North Andrews Street","s_andrews_st":"South Andrews Street","n_constantine_st":"North Constantine Street","s_constantine_st":"South Constantine Street","rocky_river":"Rocky River","railroad_dr":"Railroad Drive","conrail_rr":"Conrail Railroad","st_joseph_river":"Saint Joseph River","n_main_st":"North Main Street","s_main_st":"South Main Street","water_st":"Water Street","foster_st":"Foster Street","portage_river":"Portage River","flower_st":"Flower Street","elm_st":"Elm Street","walnut_st":"Walnut Street","morris_ave":"Morris Avenue","east_st":"East Street","portage_ave":"Portage Avenue"},"navigation":{"title":"Navigation","drag":"The main map area shows OpenStreetMap data on top of a background. You can navigate by dragging and scrolling, just like any web map. **Drag the map!**","select":"Map features are represented three ways: using points, lines or areas. All features can be selected by clicking on them. **Click on the point to select it.**","pane":"When a feature is selected, the feature editor is displayed. The header shows us the feature type and the main pane shows the feature's attributes, such as its name and address. **Close the feature editor by pressing the {button} button in the top right.**","search":"You can also search for features in the current view, or worldwide. **Search for '{name}'**","choose":"**Choose {name} from the list to select it.**","chosen":"Great! {name} is now selected. **Close the feature editor by pressing the {button} button.**"},"points":{"title":"Points","add":"Points can be used to represent features such as shops, restaurants, and monuments. They mark a specific location, and describe what's there. **Click the {button} Point button to add a new point.**","place":"The point can be placed by clicking on the map. **Click the map to place the new point on top of the building.**","search":"There are many different features that can be represented by points. The point you just added is a Cafe. **Search for '{name}'**","choose":"**Choose Cafe from the list.**","describe":"The point is now marked as a cafe. Using the feature editor, we can add more information about the feature. **Add a name**","close":"The feature editor will remember all of your changes automatically. When you change a feature, the close button will change to a checkmark. **Click the {button} button to close the feature editor**","reselect":"Often points will already exist, but have mistakes or be incomplete. We can edit existing points. **Click to select the point you just created.**","fixname":"**Change the name, then click the {button} button to close the feature editor.**","reselect_delete":"All features on the map can be deleted. **Click to select the point you created.**","delete":"The menu around the point contains operations that can be performed on it, including delete. **Click on the {button} button to delete the point.**"},"areas":{"title":"Areas","add":"Areas are used to show the boundaries of features like lakes, buildings, and residential areas. They can be also be used for more detailed mapping of many features you might normally map as points. **Click the {button} Area button to add a new area.**","corner":"Areas are drawn by placing nodes that mark the boundary of the area. **Click to place a starting node on one of the corners of the playground.**","place":"Draw the area by placing more nodes. Finish the area by clicking on the starting node. **Draw an area for the playground.**","search":"**Search for '{name}'.**","choose":"**Choose Playground from the list.**","describe":"**Add a name, then click the {button} button to close the feature editor**"},"lines":{"title":"Lines","add":"Lines are used to represent features such as roads, railroads, and rivers. **Click the {button} Line button to add a new line.**","start":"**Start the line by clicking on the end of the road.**","intersect":"Click to add more nodes to the line. You can drag the map while drawing if necessary. Roads, and many other types of lines, are part of a larger network. It is important for these lines to be connected properly in order for routing applications to work. **Click on {name} to create an intersection connecting the two lines.**","finish":"Lines can be finished by clicking on the last node again. **Finish drawing the road.**","road":"**Select Road from the list**","residential":"There are different types of roads, the most common of which is Residential. **Choose the Residential road type**","describe":"**Name the road, then click the {button} button to close the feature editor.**","restart":"The road needs to intersect {name}.","wrong_preset":"You didn't select the Residential road type. **Click here to choose again**"},"startediting":{"title":"Start Editing","help":"You can replay this walkthrough or view more documentation by clicking the {button} Help button.","save":"Don't forget to regularly save your changes!","start":"Start mapping!"}},"presets":{"categories":{"category-barrier":{"name":"Barrier Features"},"category-building":{"name":"Building Features"},"category-golf":{"name":"Golf Features"},"category-landuse":{"name":"Land Use Features"},"category-path":{"name":"Path Features"},"category-rail":{"name":"Rail Features"},"category-restriction":{"name":"Restriction Features"},"category-road":{"name":"Road Features"},"category-route":{"name":"Route Features"},"category-water-area":{"name":"Water Features"},"category-water-line":{"name":"Water Features"}},"fields":{"access":{"label":"Allowed Access","placeholder":"Not Specified","types":{"access":"All","foot":"Foot","motor_vehicle":"Motor Vehicles","bicycle":"Bicycles","horse":"Horses"},"options":{"yes":{"title":"Allowed","description":"Access permitted by law; a right of way"},"no":{"title":"Prohibited","description":"Access not permitted to the general public"},"permissive":{"title":"Permissive","description":"Access permitted until such time as the owner revokes the permission"},"private":{"title":"Private","description":"Access permitted only with permission of the owner on an individual basis"},"designated":{"title":"Designated","description":"Access permitted according to signs or specific local laws"},"destination":{"title":"Destination","description":"Access permitted only to reach a destination"},"dismount":{"title":"Dismount","description":"Access permitted but rider must dismount"}}},"access_simple":{"label":"Allowed Access","placeholder":"yes"},"access_toilets":{"label":"Access"},"address":{"label":"Address","placeholders":{"housename":"Housename","housenumber":"123","conscriptionnumber":"123","street":"Street","city":"City","postcode":"Postcode","place":"Place","hamlet":"Hamlet","suburb":"Suburb","subdistrict":"Subdistrict","district":"District","province":"Province","state":"State","country":"Country"}},"admin_level":{"label":"Admin Level"},"aerialway":{"label":"Type"},"aerialway/access":{"label":"Access","options":{"entry":"Entry","exit":"Exit","both":"Both"}},"aerialway/bubble":{"label":"Bubble"},"aerialway/capacity":{"label":"Capacity (per hour)","placeholder":"500, 2500, 5000..."},"aerialway/duration":{"label":"Duration (minutes)","placeholder":"1, 2, 3..."},"aerialway/heating":{"label":"Heated"},"aerialway/occupancy":{"label":"Occupancy","placeholder":"2, 4, 8..."},"aerialway/summer/access":{"label":"Access (summer)","options":{"entry":"Entry","exit":"Exit","both":"Both"}},"aeroway":{"label":"Type"},"amenity":{"label":"Type"},"area/highway":{"label":"Type"},"artist":{"label":"Artist"},"artwork_type":{"label":"Type"},"atm":{"label":"ATM"},"backrest":{"label":"Backrest"},"barrier":{"label":"Type"},"bench":{"label":"Bench"},"bicycle_parking":{"label":"Type"},"bin":{"label":"Waste Bin"},"boundary":{"label":"Type"},"brand":{"label":"Brand"},"building":{"label":"Building"},"building_area":{"label":"Building"},"capacity":{"label":"Capacity","placeholder":"50, 100, 200..."},"cardinal_direction":{"label":"Direction","options":{"N":"North","E":"East","S":"South","W":"West","NE":"Northeast","SE":"Southeast","SW":"Southwest","NW":"Northwest","NNE":"North-northeast","ENE":"East-northeast","ESE":"East-southeast","SSE":"South-southeast","SSW":"South-southwest","WSW":"West-southwest","WNW":"West-northwest","NNW":"North-northwest"}},"clock_direction":{"label":"Direction","options":{"clockwise":"Clockwise","anticlockwise":"Counterclockwise"}},"collection_times":{"label":"Collection Times"},"construction":{"label":"Type"},"content":{"label":"Contents"},"country":{"label":"Country"},"covered":{"label":"Covered"},"craft":{"label":"Type"},"crop":{"label":"Crop"},"crossing":{"label":"Type"},"cuisine":{"label":"Cuisine"},"currency_multi":{"label":"Currency Types"},"cycleway":{"label":"Bike Lanes","placeholder":"none","types":{"cycleway:left":"Left side","cycleway:right":"Right side"},"options":{"none":{"title":"None","description":"No bike lane"},"lane":{"title":"Standard bike lane","description":"A bike lane separated from auto traffic by a painted line"},"shared_lane":{"title":"Shared bike lane","description":"A bike lane with no separation from auto traffic"},"track":{"title":"Bike track","description":"A bike lane separated from traffic by a physical barrier"},"share_busway":{"title":"Bike lane shared with bus","description":"A bike lane shared with a bus lane"},"opposite_lane":{"title":"Opposite bike lane","description":"A bike lane that travels in the opposite direction of traffic"},"opposite":{"title":"Contraflow bike lane","description":"A bike lane that travels in both directions on a one-way street"}}},"delivery":{"label":"Delivery"},"denomination":{"label":"Denomination"},"denotation":{"label":"Denotation"},"description":{"label":"Description"},"diaper":{"label":"Diaper Changing Available"},"dock":{"label":"Type"},"drive_through":{"label":"Drive-Through"},"electrified":{"label":"Electrification","placeholder":"Contact Line, Electrified Rail...","options":{"contact_line":"Contact Line","rail":"Electrified Rail","yes":"Yes (unspecified)","no":"No"}},"elevation":{"label":"Elevation"},"emergency":{"label":"Emergency"},"entrance":{"label":"Type"},"except":{"label":"Exceptions"},"fax":{"label":"Fax","placeholder":"+31 42 123 4567"},"fee":{"label":"Fee"},"fire_hydrant/type":{"label":"Type","options":{"pillar":"Pillar/Aboveground","underground":"Underground","wall":"Wall","pond":"Pond"}},"fixme":{"label":"Fix Me"},"fuel":{"label":"Fuel"},"fuel_multi":{"label":"Fuel Types"},"gauge":{"label":"Gauge"},"gender":{"label":"Gender","placeholder":"Unknown","options":{"male":"Male","female":"Female","unisex":"Unisex"}},"generator/method":{"label":"Method"},"generator/source":{"label":"Source"},"generator/type":{"label":"Type"},"golf_hole":{"label":"Reference","placeholder":"Hole number (1-18)"},"handicap":{"label":"Handicap","placeholder":"1-18"},"handrail":{"label":"Handrail"},"highway":{"label":"Type"},"historic":{"label":"Type"},"hoops":{"label":"Hoops","placeholder":"1, 2, 4..."},"iata":{"label":"IATA"},"icao":{"label":"ICAO"},"incline":{"label":"Incline"},"incline_steps":{"label":"Incline","options":{"up":"Up","down":"Down"}},"information":{"label":"Type"},"internet_access":{"label":"Internet Access","options":{"yes":"Yes","no":"No","wlan":"Wifi","wired":"Wired","terminal":"Terminal"}},"lamp_type":{"label":"Type"},"landuse":{"label":"Type"},"lanes":{"label":"Lanes","placeholder":"1, 2, 3..."},"layer":{"label":"Layer"},"leaf_cycle":{"label":"Leaf Cycle","options":{"evergreen":"Evergreen","deciduous":"Deciduous","semi_evergreen":"Semi-Evergreen","semi_deciduous":"Semi-Deciduous","mixed":"Mixed"}},"leaf_cycle_singular":{"label":"Leaf Cycle","options":{"evergreen":"Evergreen","deciduous":"Deciduous","semi_evergreen":"Semi-Evergreen","semi_deciduous":"Semi-Deciduous"}},"leaf_type":{"label":"Leaf Type","options":{"broadleaved":"Broadleaved","needleleaved":"Needleleaved","mixed":"Mixed","leafless":"Leafless"}},"leaf_type_singular":{"label":"Leaf Type","options":{"broadleaved":"Broadleaved","needleleaved":"Needleleaved","leafless":"Leafless"}},"leisure":{"label":"Type"},"length":{"label":"Length (Meters)"},"level":{"label":"Level"},"levels":{"label":"Levels","placeholder":"2, 4, 6..."},"lit":{"label":"Lit"},"location":{"label":"Location"},"man_made":{"label":"Type"},"maxspeed":{"label":"Speed Limit","placeholder":"40, 50, 60..."},"maxstay":{"label":"Max Stay"},"mtb/scale":{"label":"Mountain Biking Difficulty","placeholder":"0, 1, 2, 3...","options":{"0":"0: Solid gravel/packed earth, no obstacles, wide curves","1":"1: Some loose surface, small obstacles, wide curves","2":"2: Much loose surface, large obstacles, easy hairpins","3":"3: Slippery surface, large obstacles, tight hairpins","4":"4: Loose surface or boulders, dangerous hairpins","5":"5: Maximum difficulty, boulder fields, landslides","6":"6: Not rideable except by the very best mountain bikers"}},"mtb/scale/imba":{"label":"IMBA Trail Difficulty","placeholder":"Easy, Medium, Difficult...","options":{"0":"Easiest (white circle)","1":"Easy (green circle)","2":"Medium (blue square)","3":"Difficult (black diamond)","4":"Extremely Difficult (double black diamond)"}},"mtb/scale/uphill":{"label":"Mountain Biking Uphill Difficulty","placeholder":"0, 1, 2, 3...","options":{"0":"0: Avg. incline <10%, gravel/packed earth, no obstacles","1":"1: Avg. incline <15%, gravel/packed earth, few small objects","2":"2: Avg. incline <20%, stable surface, fistsize rocks/roots","3":"3: Avg. incline <25%, variable surface, fistsize rocks/branches","4":"4: Avg. incline <30%, poor condition, big rocks/branches","5":"5: Very steep, bike generally needs to be pushed or carried"}},"name":{"label":"Name","placeholder":"Common name (if any)"},"natural":{"label":"Natural"},"network":{"label":"Network"},"note":{"label":"Note"},"office":{"label":"Type"},"oneway":{"label":"One Way","options":{"undefined":"Assumed to be No","yes":"Yes","no":"No"}},"oneway_yes":{"label":"One Way","options":{"undefined":"Assumed to be Yes","yes":"Yes","no":"No"}},"opening_hours":{"label":"Hours"},"operator":{"label":"Operator"},"par":{"label":"Par","placeholder":"3, 4, 5..."},"park_ride":{"label":"Park and Ride"},"parking":{"label":"Type","options":{"surface":"Surface","multi-storey":"Multilevel","underground":"Underground","sheds":"Sheds","carports":"Carports","garage_boxes":"Garage Boxes","lane":"Roadside Lane"}},"payment_multi":{"label":"Payment Types"},"phone":{"label":"Phone","placeholder":"+31 42 123 4567"},"piste/difficulty":{"label":"Difficulty","placeholder":"Easy, Intermediate, Advanced...","options":{"novice":"Novice (instructional)","easy":"Easy (green circle)","intermediate":"Intermediate (blue square)","advanced":"Advanced (black diamond)","expert":"Expert (double black diamond)","freeride":"Freeride (off-piste)","extreme":"Extreme (climbing equipment required)"}},"piste/grooming":{"label":"Grooming","options":{"classic":"Classic","mogul":"Mogul","backcountry":"Backcountry","classic+skating":"Classic and Skating","scooter":"Scooter/Snowmobile","skating":"Skating"}},"piste/type":{"label":"Type","options":{"downhill":"Downhill","nordic":"Nordic","skitour":"Skitour","sled":"Sled","hike":"Hike","sleigh":"Sleigh","ice_skate":"Ice Skate","snow_park":"Snow Park","playground":"Playground"}},"place":{"label":"Type"},"population":{"label":"Population"},"power":{"label":"Type"},"power_supply":{"label":"Power Supply"},"railway":{"label":"Type"},"recycling_accepts":{"label":"Accepts"},"ref":{"label":"Reference"},"relation":{"label":"Type"},"religion":{"label":"Religion"},"restriction":{"label":"Type"},"restrictions":{"label":"Turn Restrictions"},"route":{"label":"Type"},"route_master":{"label":"Type"},"sac_scale":{"label":"Hiking Difficulty","placeholder":"Mountain Hiking, Alpine Hiking...","options":{"hiking":"T1: Hiking","mountain_hiking":"T2: Mountain Hiking","demanding_mountain_hiking":"T3: Demanding Mountain Hiking","alpine_hiking":"T4: Alpine Hiking","demanding_alpine_hiking":"T5: Demanding Alpine Hiking","difficult_alpine_hiking":"T6: Difficult Alpine Hiking"}},"sanitary_dump_station":{"label":"Toilet Disposal"},"seasonal":{"label":"Seasonal"},"service":{"label":"Type"},"service/bicycle/chain_tool":{"label":"Chain Tool","options":{"undefined":"Assumed to be No","yes":"Yes","no":"No"}},"service/bicycle/pump":{"label":"Air Pump","options":{"undefined":"Assumed to be No","yes":"Yes","no":"No"}},"service_rail":{"label":"Service Type","options":{"spur":"Spur","yard":"Yard","siding":"Siding","crossover":"Crossover"}},"shelter":{"label":"Shelter"},"shelter_type":{"label":"Type"},"shop":{"label":"Type"},"site":{"label":"Type"},"sloped_curb":{"label":"Sloped Curb"},"smoking":{"label":"Smoking","placeholder":"No, Separated, Yes...","options":{"no":"No smoking anywhere","separated":"In smoking areas, not physically isolated","isolated":"In smoking areas, physically isolated","outside":"Allowed outside","yes":"Allowed everywhere","dedicated":"Dedicated to smokers (e.g. smokers' club)"}},"smoothness":{"label":"Smoothness","placeholder":"Thin Rollers, Wheels, Off-Road...","options":{"excellent":"Thin Rollers: rollerblade, skateboard","good":"Thin Wheels: racing bike","intermediate":"Wheels: city bike, wheelchair, scooter","bad":"Robust Wheels: trekking bike, car, rickshaw","very_bad":"High Clearance: light duty off-road vehicle","horrible":"Off-Road: heavy duty off-road vehicle","very_horrible":"Specialized off-road: tractor, ATV","impassable":"Impassable / No wheeled vehicle"}},"social_facility_for":{"label":"People served","placeholder":"Homeless, Disabled, Child, etc"},"source":{"label":"Source"},"sport":{"label":"Sport"},"sport_ice":{"label":"Sport"},"sport_racing":{"label":"Sport"},"structure":{"label":"Structure","placeholder":"Unknown","options":{"bridge":"Bridge","tunnel":"Tunnel","embankment":"Embankment","cutting":"Cutting","ford":"Ford"}},"studio":{"label":"Type"},"substation":{"label":"Type"},"supervised":{"label":"Supervised"},"surface":{"label":"Surface"},"tactile_paving":{"label":"Tactile Paving"},"takeaway":{"label":"Takeaway","placeholder":"Yes, No, Takeaway Only...","options":{"yes":"Yes","no":"No","only":"Takeaway Only"}},"toilets/disposal":{"label":"Disposal","options":{"flush":"Flush","pitlatrine":"Pit/Latrine","chemical":"Chemical","bucket":"Bucket"}},"tourism":{"label":"Type"},"towertype":{"label":"Tower type"},"tracktype":{"label":"Track Type","placeholder":"Solid, Mostly Solid, Soft...","options":{"grade1":"Solid: paved or heavily compacted hardcore surface","grade2":"Mostly Solid: gravel/rock with some soft material mixed in","grade3":"Even mixture of hard and soft materials","grade4":"Mostly Soft: soil/sand/grass with some hard material mixed in","grade5":"Soft: soil/sand/grass"}},"traffic_signals":{"label":"Type"},"trail_visibility":{"label":"Trail Visibility","placeholder":"Excellent, Good, Bad...","options":{"excellent":"Excellent: unambiguous path or markers everywhere","good":"Good: markers visible, sometimes require searching","intermediate":"Intermediate: few markers, path mostly visible","bad":"Bad: no markers, path sometimes invisible/pathless","horrible":"Horrible: often pathless, some orientation skills required","no":"No: pathless, excellent orientation skills required"}},"trees":{"label":"Trees"},"tunnel":{"label":"Tunnel"},"vending":{"label":"Type of Goods"},"water":{"label":"Type"},"water_point":{"label":"Water Point"},"waterway":{"label":"Type"},"website":{"label":"Website","placeholder":"http://example.com/"},"wetland":{"label":"Type"},"wheelchair":{"label":"Wheelchair Access"},"width":{"label":"Width (Meters)"},"wikipedia":{"label":"Wikipedia"}},"presets":{"address":{"name":"Address","terms":""},"aerialway":{"name":"Aerialway","terms":"ski lift,funifor,funitel"},"aerialway/cable_car":{"name":"Cable Car","terms":"tramway,ropeway"},"aerialway/chair_lift":{"name":"Chair Lift","terms":""},"aerialway/gondola":{"name":"Gondola","terms":""},"aerialway/magic_carpet":{"name":"Magic Carpet Lift","terms":""},"aerialway/platter":{"name":"Platter Lift","terms":"button lift,poma lift"},"aerialway/pylon":{"name":"Aerialway Pylon","terms":""},"aerialway/rope_tow":{"name":"Rope Tow Lift","terms":"handle tow,bugel lift"},"aerialway/station":{"name":"Aerialway Station","terms":""},"aerialway/t-bar":{"name":"T-bar Lift","terms":""},"aeroway":{"name":"Aeroway","terms":""},"aeroway/aerodrome":{"name":"Airport","terms":"airplane,airport,aerodrome"},"aeroway/apron":{"name":"Apron","terms":"ramp"},"aeroway/gate":{"name":"Airport gate","terms":""},"aeroway/hangar":{"name":"Hangar","terms":""},"aeroway/helipad":{"name":"Helipad","terms":"helicopter,helipad,heliport"},"aeroway/runway":{"name":"Runway","terms":"landing strip"},"aeroway/taxiway":{"name":"Taxiway","terms":""},"aeroway/terminal":{"name":"Airport terminal","terms":"airport,aerodrome"},"amenity":{"name":"Amenity","terms":""},"amenity/arts_centre":{"name":"Arts Center","terms":""},"amenity/atm":{"name":"ATM","terms":"money,cash,machine"},"amenity/bank":{"name":"Bank","terms":"credit union,check,deposit,fund,investment,repository,reserve,safe,savings,stock,treasury,trust,vault"},"amenity/bar":{"name":"Bar","terms":"dive,beer,bier,booze"},"amenity/bbq":{"name":"Barbecue/Grill","terms":"bbq,grill"},"amenity/bench":{"name":"Bench","terms":"seat"},"amenity/bicycle_parking":{"name":"Bicycle Parking","terms":"bike"},"amenity/bicycle_rental":{"name":"Bicycle Rental","terms":"bike"},"amenity/bicycle_repair_station":{"name":"Bicycle Repair Tool Stand","terms":"bike,repair,chain,pump"},"amenity/biergarten":{"name":"Beer Garden","terms":"beer,bier,booze"},"amenity/boat_rental":{"name":"Boat Rental","terms":""},"amenity/bureau_de_change":{"name":"Currency Exchange","terms":"bureau de change,money changer"},"amenity/bus_station":{"name":"Bus Station","terms":""},"amenity/cafe":{"name":"Cafe","terms":"bistro,coffee,tea"},"amenity/car_rental":{"name":"Car Rental","terms":""},"amenity/car_sharing":{"name":"Car Sharing","terms":""},"amenity/car_wash":{"name":"Car Wash","terms":""},"amenity/casino":{"name":"Casino","terms":"gambling,roulette,craps,poker,blackjack"},"amenity/charging_station":{"name":"Charging Station","terms":"EV,Electric Vehicle,Supercharger"},"amenity/childcare":{"name":"Nursery/Childcare","terms":"daycare,orphanage,playgroup"},"amenity/cinema":{"name":"Cinema","terms":"drive-in,film,flick,movie,theater,picture,show,screen"},"amenity/clinic":{"name":"Clinic","terms":"medical,urgentcare"},"amenity/clock":{"name":"Clock","terms":""},"amenity/college":{"name":"College Grounds","terms":"university"},"amenity/community_centre":{"name":"Community Center","terms":"event,hall"},"amenity/compressed_air":{"name":"Compressed Air","terms":""},"amenity/courthouse":{"name":"Courthouse","terms":""},"amenity/dentist":{"name":"Dentist","terms":"tooth,teeth"},"amenity/doctors":{"name":"Doctor","terms":"medic*"},"amenity/dojo":{"name":"Dojo / Martial Arts Academy","terms":"martial arts,dojang"},"amenity/drinking_water":{"name":"Drinking Water","terms":"fountain,potable"},"amenity/embassy":{"name":"Embassy","terms":""},"amenity/fast_food":{"name":"Fast Food","terms":"restaurant"},"amenity/ferry_terminal":{"name":"Ferry Terminal","terms":""},"amenity/fire_station":{"name":"Fire Station","terms":""},"amenity/fountain":{"name":"Fountain","terms":""},"amenity/fuel":{"name":"Gas Station","terms":"petrol,fuel,gasoline,propane,diesel,lng,cng,biodiesel"},"amenity/grave_yard":{"name":"Graveyard","terms":""},"amenity/grit_bin":{"name":"Grit Bin","terms":"salt,sand"},"amenity/hospital":{"name":"Hospital Grounds","terms":"clinic,doctor,emergency room,health service,hospice,infirmary,institution,nursing home,sanatorium,sanitarium,sick,surgery,ward"},"amenity/hunting_stand":{"name":"Hunting Stand","terms":""},"amenity/kindergarten":{"name":"Preschool/Kindergarten Grounds","terms":"kindergarden,pre-school"},"amenity/library":{"name":"Library","terms":"book"},"amenity/marketplace":{"name":"Marketplace","terms":""},"amenity/motorcycle_parking":{"name":"Motorcycle Parking","terms":""},"amenity/nightclub":{"name":"Nightclub","terms":"disco*,night club,dancing,dance club"},"amenity/parking":{"name":"Car Parking","terms":""},"amenity/parking_entrance":{"name":"Parking Garage Entrance/Exit","terms":""},"amenity/parking_space":{"name":"Parking Space","terms":""},"amenity/pharmacy":{"name":"Pharmacy","terms":"drug,medicine"},"amenity/place_of_worship":{"name":"Place of Worship","terms":"abbey,basilica,bethel,cathedral,chancel,chantry,chapel,church,fold,house of God,house of prayer,house of worship,minster,mission,mosque,oratory,parish,sacellum,sanctuary,shrine,synagogue,tabernacle,temple"},"amenity/place_of_worship/buddhist":{"name":"Buddhist Temple","terms":"stupa,vihara,monastery,temple,pagoda,zendo,dojo"},"amenity/place_of_worship/christian":{"name":"Church","terms":"christian,abbey,basilica,bethel,cathedral,chancel,chantry,chapel,fold,house of God,house of prayer,house of worship,minster,mission,oratory,parish,sacellum,sanctuary,shrine,tabernacle,temple"},"amenity/place_of_worship/jewish":{"name":"Synagogue","terms":"jewish"},"amenity/place_of_worship/muslim":{"name":"Mosque","terms":"muslim"},"amenity/police":{"name":"Police","terms":"badge,constable,constabulary,cop,detective,fed,law,enforcement,officer,patrol"},"amenity/post_box":{"name":"Mailbox","terms":"letter,post"},"amenity/post_office":{"name":"Post Office","terms":"letter,mail"},"amenity/prison":{"name":"Prison Grounds","terms":"cell,jail"},"amenity/pub":{"name":"Pub","terms":"dive,beer,bier,booze"},"amenity/public_bookcase":{"name":"Public Bookcase","terms":"library,bookcrossing"},"amenity/ranger_station":{"name":"Ranger Station","terms":"visitor center,visitor centre,permit center,permit centre,backcountry office,warden office,warden center"},"amenity/recycling":{"name":"Recycling","terms":"can,bottle,garbage,scrap,trash"},"amenity/register_office":{"name":"Register Office","terms":""},"amenity/restaurant":{"name":"Restaurant","terms":"bar,breakfast,cafe,café,canteen,coffee,dine,dining,dinner,drive-in,eat,grill,lunch,table"},"amenity/sanitary_dump_station":{"name":"RV Toilet Disposal","terms":"Motor Home,Camper,Sanitary,Dump Station,Elsan,CDP,CTDP,Chemical Toilet"},"amenity/school":{"name":"School Grounds","terms":"academy,elementary school,middle school,high school"},"amenity/shelter":{"name":"Shelter","terms":"lean-to,gazebo,picnic"},"amenity/social_facility":{"name":"Social Facility","terms":""},"amenity/social_facility/food_bank":{"name":"Food Bank","terms":""},"amenity/social_facility/group_home":{"name":"Elderly Group Home","terms":"old,senior,living"},"amenity/social_facility/homeless_shelter":{"name":"Homeless Shelter","terms":"houseless,unhoused,displaced"},"amenity/studio":{"name":"Studio","terms":"recording,radio,television"},"amenity/swimming_pool":{"name":"Swimming Pool","terms":""},"amenity/taxi":{"name":"Taxi Stand","terms":"cab"},"amenity/telephone":{"name":"Telephone","terms":"phone"},"amenity/theatre":{"name":"Theater","terms":"theatre,performance,play,musical"},"amenity/toilets":{"name":"Toilets","terms":"bathroom,restroom,outhouse,privy,head,lavatory,latrine,water closet,WC,W.C."},"amenity/townhall":{"name":"Town Hall","terms":"village,city,government,courthouse,municipal"},"amenity/university":{"name":"University Grounds","terms":"college"},"amenity/vending_machine/cigarettes":{"name":"Cigarette Vending Machine","terms":"cigarette"},"amenity/vending_machine/condoms":{"name":"Condom Vending Machine","terms":"condom"},"amenity/vending_machine/drinks":{"name":"Drink Vending Machine","terms":"drink,soda,beverage,juice,pop"},"amenity/vending_machine/excrement_bags":{"name":"Excrement Bag Vending Machine","terms":"excrement bags,poop,dog,animal"},"amenity/vending_machine/news_papers":{"name":"Newspaper Vending Machine","terms":"newspaper"},"amenity/vending_machine/parcel_pickup_dropoff":{"name":"Parcel Pickup/Dropoff Vending Machine","terms":"parcel,mail,pickup"},"amenity/vending_machine/parking_tickets":{"name":"Parking Ticket Vending Machine","terms":"parking,ticket"},"amenity/vending_machine/public_transport_tickets":{"name":"Transit Ticket Vending Machine","terms":"bus,train,ferry,rail,ticket,transportation"},"amenity/vending_machine/sweets":{"name":"Snack Vending Machine","terms":"candy,gum,chip,pretzel,cookie,cracker"},"amenity/vending_machine/vending_machine":{"name":"Vending Machine","terms":""},"amenity/veterinary":{"name":"Veterinary","terms":"pet clinic,veterinarian,animal hospital,pet doctor"},"amenity/waste_basket":{"name":"Waste Basket","terms":"bin,rubbish,litter,trash,garbage"},"amenity/waste_disposal":{"name":"Garbage Dumpster","terms":"rubbish,litter,trash"},"amenity/water_point":{"name":"RV Drinking Water","terms":""},"area":{"name":"Area","terms":""},"area/highway":{"name":"Road Surface","terms":""},"barrier":{"name":"Barrier","terms":""},"barrier/block":{"name":"Block","terms":""},"barrier/bollard":{"name":"Bollard","terms":""},"barrier/cattle_grid":{"name":"Cattle Grid","terms":""},"barrier/city_wall":{"name":"City Wall","terms":""},"barrier/cycle_barrier":{"name":"Cycle Barrier","terms":""},"barrier/ditch":{"name":"Trench","terms":""},"barrier/entrance":{"name":"Entrance","terms":""},"barrier/fence":{"name":"Fence","terms":""},"barrier/gate":{"name":"Gate","terms":""},"barrier/hedge":{"name":"Hedge","terms":""},"barrier/kissing_gate":{"name":"Kissing Gate","terms":""},"barrier/lift_gate":{"name":"Lift Gate","terms":""},"barrier/retaining_wall":{"name":"Retaining Wall","terms":""},"barrier/stile":{"name":"Stile","terms":""},"barrier/toll_booth":{"name":"Toll Booth","terms":""},"barrier/wall":{"name":"Wall","terms":""},"boundary/administrative":{"name":"Administrative Boundary","terms":""},"building":{"name":"Building","terms":""},"building/apartments":{"name":"Apartments","terms":""},"building/barn":{"name":"Barn","terms":""},"building/bunker":{"name":"Bunker","terms":""},"building/cabin":{"name":"Cabin","terms":""},"building/cathedral":{"name":"Cathedral Building","terms":""},"building/chapel":{"name":"Chapel Building","terms":""},"building/church":{"name":"Church Building","terms":""},"building/college":{"name":"College Building","terms":"university"},"building/commercial":{"name":"Commercial Building","terms":""},"building/construction":{"name":"Building Under Construction","terms":""},"building/detached":{"name":"Detached House","terms":"home,single,family,residence,dwelling"},"building/dormitory":{"name":"Dormitory","terms":""},"building/entrance":{"name":"Entrance/Exit","terms":""},"building/garage":{"name":"Garage","terms":""},"building/garages":{"name":"Garages","terms":""},"building/greenhouse":{"name":"Greenhouse","terms":""},"building/hospital":{"name":"Hospital Building","terms":""},"building/hotel":{"name":"Hotel Building","terms":""},"building/house":{"name":"House","terms":"home,family,residence,dwelling"},"building/hut":{"name":"Hut","terms":""},"building/industrial":{"name":"Industrial Building","terms":""},"building/kindergarten":{"name":"Preschool/Kindergarten Building","terms":"kindergarden,pre-school"},"building/public":{"name":"Public Building","terms":""},"building/residential":{"name":"Residential Building","terms":""},"building/retail":{"name":"Retail Building","terms":""},"building/roof":{"name":"Roof","terms":""},"building/school":{"name":"School Building","terms":"academy,elementary school,middle school,high school"},"building/semidetached_house":{"name":"Semi-Detached House","terms":"home,double,duplex,twin,family,residence,dwelling"},"building/shed":{"name":"Shed","terms":""},"building/stable":{"name":"Stable","terms":""},"building/static_caravan":{"name":"Static Mobile Home","terms":""},"building/terrace":{"name":"Row Houses","terms":"home,terrace,brownstone,family,residence,dwelling"},"building/train_station":{"name":"Train Station","terms":""},"building/university":{"name":"University Building","terms":"college"},"building/warehouse":{"name":"Warehouse","terms":""},"craft":{"name":"Craft","terms":""},"craft/basket_maker":{"name":"Basket Maker","terms":""},"craft/beekeeper":{"name":"Beekeeper","terms":""},"craft/blacksmith":{"name":"Blacksmith","terms":""},"craft/boatbuilder":{"name":"Boat Builder","terms":""},"craft/bookbinder":{"name":"Bookbinder","terms":"book repair"},"craft/brewery":{"name":"Brewery","terms":"beer,bier"},"craft/carpenter":{"name":"Carpenter","terms":"woodworker"},"craft/carpet_layer":{"name":"Carpet Layer","terms":""},"craft/caterer":{"name":"Caterer","terms":""},"craft/clockmaker":{"name":"Clockmaker","terms":""},"craft/confectionery":{"name":"Confectionery","terms":"sweets,candy"},"craft/dressmaker":{"name":"Dressmaker","terms":"seamstress"},"craft/electrician":{"name":"Electrician","terms":"power,wire"},"craft/gardener":{"name":"Gardener","terms":"landscaper,grounds keeper"},"craft/glaziery":{"name":"Glaziery","terms":"glass,stained-glass,window"},"craft/handicraft":{"name":"Handicraft","terms":""},"craft/hvac":{"name":"HVAC","terms":"heat*,vent*,air conditioning"},"craft/insulator":{"name":"Insulator","terms":""},"craft/jeweler":{"name":"Jeweler","terms":""},"craft/key_cutter":{"name":"Key Cutter","terms":""},"craft/locksmith":{"name":"Locksmith","terms":""},"craft/metal_construction":{"name":"Metal Construction","terms":""},"craft/optician":{"name":"Optician","terms":""},"craft/painter":{"name":"Painter","terms":""},"craft/photographer":{"name":"Photographer","terms":""},"craft/photographic_laboratory":{"name":"Photographic Laboratory","terms":"film"},"craft/plasterer":{"name":"Plasterer","terms":""},"craft/plumber":{"name":"Plumber","terms":"pipe"},"craft/pottery":{"name":"Pottery","terms":"ceramic"},"craft/rigger":{"name":"Rigger","terms":""},"craft/roofer":{"name":"Roofer","terms":""},"craft/saddler":{"name":"Saddler","terms":""},"craft/sailmaker":{"name":"Sailmaker","terms":""},"craft/sawmill":{"name":"Sawmill","terms":"lumber"},"craft/scaffolder":{"name":"Scaffolder","terms":""},"craft/sculpter":{"name":"Sculpter","terms":""},"craft/shoemaker":{"name":"Shoemaker","terms":"cobbler"},"craft/stonemason":{"name":"Stonemason","terms":"masonry"},"craft/sweep":{"name":"Chimney Sweep","terms":""},"craft/tailor":{"name":"Tailor","terms":"clothes,suit"},"craft/tiler":{"name":"Tiler","terms":""},"craft/tinsmith":{"name":"Tinsmith","terms":""},"craft/upholsterer":{"name":"Upholsterer","terms":""},"craft/watchmaker":{"name":"Watchmaker","terms":""},"craft/window_construction":{"name":"Window Construction","terms":"glass"},"craft/winery":{"name":"Winery","terms":""},"embankment":{"name":"Embankment","terms":""},"emergency/ambulance_station":{"name":"Ambulance Station","terms":"EMS,EMT,rescue"},"emergency/fire_hydrant":{"name":"Fire Hydrant","terms":""},"emergency/phone":{"name":"Emergency Phone","terms":""},"entrance":{"name":"Entrance/Exit","terms":""},"footway/crossing":{"name":"Street Crossing","terms":""},"footway/crosswalk":{"name":"Pedestrian Crosswalk","terms":"zebra crossing"},"footway/sidewalk":{"name":"Sidewalk","terms":""},"ford":{"name":"Ford","terms":""},"golf/bunker":{"name":"Sand Trap","terms":"hazard,bunker"},"golf/fairway":{"name":"Fairway","terms":""},"golf/green":{"name":"Putting Green","terms":""},"golf/hole":{"name":"Golf Hole","terms":""},"golf/lateral_water_hazard":{"name":"Lateral Water Hazard","terms":""},"golf/rough":{"name":"Rough","terms":""},"golf/tee":{"name":"Tee Box","terms":"teeing ground"},"golf/water_hazard":{"name":"Water Hazard","terms":""},"highway":{"name":"Highway","terms":""},"highway/bridleway":{"name":"Bridle Path","terms":"bridleway,equestrian,horse"},"highway/bus_stop":{"name":"Bus Stop","terms":""},"highway/corridor":{"name":"Indoor Corridor","terms":"gallery,hall,hallway,indoor,passage,passageway"},"highway/crossing":{"name":"Street Crossing","terms":""},"highway/crosswalk":{"name":"Pedestrian Crosswalk","terms":"zebra crossing"},"highway/cycleway":{"name":"Cycle Path","terms":"bike"},"highway/footway":{"name":"Foot Path","terms":"hike,hiking,trackway,trail,walk"},"highway/living_street":{"name":"Living Street","terms":""},"highway/mini_roundabout":{"name":"Mini-Roundabout","terms":""},"highway/motorway":{"name":"Motorway","terms":""},"highway/motorway_junction":{"name":"Motorway Junction / Exit","terms":""},"highway/motorway_link":{"name":"Motorway Link","terms":"ramp,on ramp,off ramp"},"highway/path":{"name":"Path","terms":"hike,hiking,trackway,trail,walk"},"highway/pedestrian":{"name":"Pedestrian Street","terms":""},"highway/primary":{"name":"Primary Road","terms":""},"highway/primary_link":{"name":"Primary Link","terms":"ramp,on ramp,off ramp"},"highway/raceway":{"name":"Motor Raceway","terms":"auto*,race*,nascar"},"highway/residential":{"name":"Residential Road","terms":""},"highway/rest_area":{"name":"Rest Area","terms":"rest stop"},"highway/road":{"name":"Unknown Road","terms":""},"highway/secondary":{"name":"Secondary Road","terms":""},"highway/secondary_link":{"name":"Secondary Link","terms":"ramp,on ramp,off ramp"},"highway/service":{"name":"Service Road","terms":""},"highway/service/alley":{"name":"Alley","terms":""},"highway/service/drive-through":{"name":"Drive-Through","terms":""},"highway/service/driveway":{"name":"Driveway","terms":""},"highway/service/emergency_access":{"name":"Emergency Access","terms":""},"highway/service/parking_aisle":{"name":"Parking Aisle","terms":""},"highway/services":{"name":"Service Area","terms":"services,travel plaza,service station"},"highway/steps":{"name":"Steps","terms":"stairs,staircase"},"highway/stop":{"name":"Stop Sign","terms":"stop sign"},"highway/street_lamp":{"name":"Street Lamp","terms":"streetlight,street light,lamp,light,gaslight"},"highway/tertiary":{"name":"Tertiary Road","terms":""},"highway/tertiary_link":{"name":"Tertiary Link","terms":"ramp,on ramp,off ramp"},"highway/track":{"name":"Unmaintained Track Road","terms":"woods road,forest road,logging road,fire road,farm road,agricultural road,ranch road,carriage road,primitive,unmaintained,rut,offroad,4wd,4x4,four wheel drive,atv,quad,jeep,double track,two track"},"highway/traffic_signals":{"name":"Traffic Signals","terms":"light,stoplight,traffic light"},"highway/trunk":{"name":"Trunk Road","terms":""},"highway/trunk_link":{"name":"Trunk Link","terms":"ramp,on ramp,off ramp"},"highway/turning_circle":{"name":"Turning Circle","terms":"cul-de-sac"},"highway/unclassified":{"name":"Minor/Unclassified Road","terms":""},"historic":{"name":"Historic Site","terms":""},"historic/archaeological_site":{"name":"Archaeological Site","terms":""},"historic/boundary_stone":{"name":"Boundary Stone","terms":""},"historic/castle":{"name":"Castle","terms":""},"historic/memorial":{"name":"Memorial","terms":""},"historic/monument":{"name":"Monument","terms":""},"historic/ruins":{"name":"Ruins","terms":""},"historic/wayside_cross":{"name":"Wayside Cross","terms":""},"historic/wayside_shrine":{"name":"Wayside Shrine","terms":""},"junction":{"name":"Junction","terms":""},"landuse":{"name":"Land Use","terms":""},"landuse/allotments":{"name":"Community Garden","terms":"allotment,garden"},"landuse/basin":{"name":"Basin","terms":""},"landuse/cemetery":{"name":"Cemetery","terms":""},"landuse/churchyard":{"name":"Churchyard","terms":""},"landuse/commercial":{"name":"Commercial Area","terms":""},"landuse/construction":{"name":"Construction","terms":""},"landuse/farm":{"name":"Farmland","terms":""},"landuse/farmland":{"name":"Farmland","terms":""},"landuse/farmyard":{"name":"Farmyard","terms":""},"landuse/forest":{"name":"Forest","terms":"tree"},"landuse/garages":{"name":"Garages","terms":""},"landuse/grass":{"name":"Grass","terms":""},"landuse/industrial":{"name":"Industrial Area","terms":""},"landuse/landfill":{"name":"Landfill","terms":"dump"},"landuse/meadow":{"name":"Meadow","terms":""},"landuse/military":{"name":"Military Area","terms":""},"landuse/orchard":{"name":"Orchard","terms":""},"landuse/plant_nursery":{"name":"Plant Nursery","terms":"vivero"},"landuse/quarry":{"name":"Quarry","terms":""},"landuse/residential":{"name":"Residential Area","terms":""},"landuse/retail":{"name":"Retail Area","terms":""},"landuse/vineyard":{"name":"Vineyard","terms":""},"leisure":{"name":"Leisure","terms":""},"leisure/adult_gaming_centre":{"name":"Adult Gaming Center","terms":"gambling,slot machine"},"leisure/bird_hide":{"name":"Bird Hide","terms":"machan,ornithology"},"leisure/bowling_alley":{"name":"Bowling Alley","terms":""},"leisure/common":{"name":"Common","terms":"open space"},"leisure/dog_park":{"name":"Dog Park","terms":""},"leisure/firepit":{"name":"Firepit","terms":"fireplace,campfire"},"leisure/garden":{"name":"Garden","terms":""},"leisure/golf_course":{"name":"Golf Course","terms":"links"},"leisure/ice_rink":{"name":"Ice Rink","terms":"hockey,skating,curling"},"leisure/marina":{"name":"Marina","terms":"boat"},"leisure/nature_reserve":{"name":"Nature Reserve","terms":"protected,wildlife"},"leisure/park":{"name":"Park","terms":"esplanade,estate,forest,garden,grass,green,grounds,lawn,lot,meadow,parkland,place,playground,plaza,pleasure garden,recreation area,square,tract,village green,woodland"},"leisure/picnic_table":{"name":"Picnic Table","terms":"bench"},"leisure/pitch":{"name":"Sport Pitch","terms":"field"},"leisure/pitch/american_football":{"name":"American Football Field","terms":""},"leisure/pitch/baseball":{"name":"Baseball Diamond","terms":""},"leisure/pitch/basketball":{"name":"Basketball Court","terms":""},"leisure/pitch/rugby_league":{"name":"Rugby League Field","terms":""},"leisure/pitch/rugby_union":{"name":"Rugby Union Field","terms":""},"leisure/pitch/skateboard":{"name":"Skate Park","terms":""},"leisure/pitch/soccer":{"name":"Soccer Field","terms":""},"leisure/pitch/tennis":{"name":"Tennis Court","terms":""},"leisure/pitch/volleyball":{"name":"Volleyball Court","terms":""},"leisure/playground":{"name":"Playground","terms":"jungle gym,play area"},"leisure/running_track":{"name":"Running Track","terms":""},"leisure/slipway":{"name":"Slipway","terms":"boat launch,boat ramp"},"leisure/sports_centre":{"name":"Sports Center / Gym","terms":"gym"},"leisure/sports_centre/swimming":{"name":"Swimming Pool Facility","terms":"dive,water"},"leisure/stadium":{"name":"Stadium","terms":""},"leisure/swimming_pool":{"name":"Swimming Pool","terms":"dive,water"},"leisure/track":{"name":"Racetrack (non-Motorsport)","terms":""},"leisure/water_park":{"name":"Water Park","terms":"swim,pool,dive"},"line":{"name":"Line","terms":""},"man_made":{"name":"Man Made","terms":""},"man_made/adit":{"name":"Adit","terms":"entrance,underground,mine,cave"},"man_made/breakwater":{"name":"Breakwater","terms":""},"man_made/chimney":{"name":"Chimney","terms":""},"man_made/cutline":{"name":"Cut line","terms":""},"man_made/embankment":{"name":"Embankment","terms":""},"man_made/flagpole":{"name":"Flagpole","terms":""},"man_made/gasometer":{"name":"Gasometer","terms":"gas holder"},"man_made/groyne":{"name":"Groyne","terms":""},"man_made/lighthouse":{"name":"Lighthouse","terms":""},"man_made/mast":{"name":"Radio Mast","terms":"broadcast tower,cell phone tower,cell tower,guyed tower,mobile phone tower,radio tower,television tower,transmission mast,transmission tower,tv tower"},"man_made/observation":{"name":"Observation Tower","terms":"lookout tower,fire tower"},"man_made/petroleum_well":{"name":"Oil Well","terms":"drilling rig,oil derrick,oil drill,oil horse,oil rig,oil pump,petroleum well,pumpjack"},"man_made/pier":{"name":"Pier","terms":"dock"},"man_made/pipeline":{"name":"Pipeline","terms":""},"man_made/silo":{"name":"Silo","terms":"grain,corn,wheat"},"man_made/storage_tank":{"name":"Storage Tank","terms":"water,oil,gas,petrol"},"man_made/surveillance":{"name":"Surveillance","terms":""},"man_made/survey_point":{"name":"Survey Point","terms":""},"man_made/tower":{"name":"Tower","terms":""},"man_made/wastewater_plant":{"name":"Wastewater Plant","terms":"sewage*,water treatment plant,reclamation plant"},"man_made/water_tower":{"name":"Water Tower","terms":""},"man_made/water_well":{"name":"Water Well","terms":""},"man_made/water_works":{"name":"Water Works","terms":""},"man_made/works":{"name":"Works","terms":"car assembly plant,aluminium processing plant,brewery,furniture manufacture factory,oil refinery,plastic recycling"},"military/airfield":{"name":"Airfield","terms":""},"military/barracks":{"name":"Barracks","terms":""},"military/bunker":{"name":"Bunker","terms":""},"military/checkpoint":{"name":"Checkpoint","terms":""},"military/danger_area":{"name":"Danger Area","terms":""},"military/naval_base":{"name":"Naval Base","terms":""},"military/obstacle_course":{"name":"Obstacle Course","terms":""},"military/range":{"name":"Military Range","terms":""},"military/training_area":{"name":"Training area","terms":""},"natural":{"name":"Natural","terms":""},"natural/bay":{"name":"Bay","terms":""},"natural/beach":{"name":"Beach","terms":""},"natural/cave_entrance":{"name":"Cave Entrance","terms":"cavern,hollow,grotto,shelter,cavity"},"natural/cliff":{"name":"Cliff","terms":""},"natural/coastline":{"name":"Coastline","terms":"shore"},"natural/fell":{"name":"Fell","terms":""},"natural/glacier":{"name":"Glacier","terms":""},"natural/grassland":{"name":"Grassland","terms":""},"natural/heath":{"name":"Heath","terms":""},"natural/peak":{"name":"Peak","terms":"acme,aiguille,alp,climax,crest,crown,hill,mount,mountain,pinnacle,summit,tip,top"},"natural/saddle":{"name":"Saddle","terms":"pass,mountain pass,top"},"natural/scree":{"name":"Scree","terms":"loose rocks"},"natural/scrub":{"name":"Scrub","terms":"bush,shrubs"},"natural/spring":{"name":"Spring","terms":""},"natural/tree":{"name":"Tree","terms":""},"natural/tree_row":{"name":"Tree row","terms":""},"natural/volcano":{"name":"Volcano","terms":"mountain,crater"},"natural/water":{"name":"Water","terms":""},"natural/water/lake":{"name":"Lake","terms":"lakelet,loch,mere"},"natural/water/pond":{"name":"Pond","terms":"lakelet,millpond,tarn,pool,mere"},"natural/water/reservoir":{"name":"Reservoir","terms":""},"natural/wetland":{"name":"Wetland","terms":""},"natural/wood":{"name":"Wood","terms":"tree"},"office":{"name":"Office","terms":""},"office/accountant":{"name":"Accountant","terms":""},"office/administrative":{"name":"Administrative Office","terms":""},"office/architect":{"name":"Architect","terms":""},"office/company":{"name":"Company Office","terms":""},"office/educational_institution":{"name":"Educational Institution","terms":""},"office/employment_agency":{"name":"Employment Agency","terms":"job"},"office/estate_agent":{"name":"Real Estate Office","terms":""},"office/financial":{"name":"Financial Office","terms":""},"office/government":{"name":"Government Office","terms":""},"office/insurance":{"name":"Insurance Office","terms":""},"office/it":{"name":"IT Office","terms":""},"office/lawyer":{"name":"Law Office","terms":""},"office/newspaper":{"name":"Newspaper","terms":""},"office/ngo":{"name":"NGO Office","terms":""},"office/physician":{"name":"Physician","terms":""},"office/political_party":{"name":"Political Party","terms":""},"office/research":{"name":"Research Office","terms":""},"office/telecommunication":{"name":"Telecom Office","terms":""},"office/therapist":{"name":"Therapist","terms":""},"office/travel_agent":{"name":"Travel Agency","terms":""},"piste":{"name":"Piste/Ski Trail","terms":"ski,sled,sleigh,snowboard,nordic,downhill,snowmobile"},"place":{"name":"Place","terms":""},"place/city":{"name":"City","terms":""},"place/farm":{"name":"Farm","terms":""},"place/hamlet":{"name":"Hamlet","terms":""},"place/island":{"name":"Island","terms":"archipelago,atoll,bar,cay,isle,islet,key,reef"},"place/isolated_dwelling":{"name":"Isolated Dwelling","terms":""},"place/locality":{"name":"Locality","terms":""},"place/neighbourhood":{"name":"Neighborhood","terms":"neighbourhood"},"place/suburb":{"name":"Borough","terms":"Boro,Quarter"},"place/town":{"name":"Town","terms":""},"place/village":{"name":"Village","terms":""},"point":{"name":"Point","terms":""},"power":{"name":"Power","terms":""},"power/generator":{"name":"Power Generator","terms":""},"power/line":{"name":"Power Line","terms":""},"power/minor_line":{"name":"Minor Power Line","terms":""},"power/pole":{"name":"Power Pole","terms":""},"power/sub_station":{"name":"Substation","terms":""},"power/substation":{"name":"Substation","terms":""},"power/tower":{"name":"High-Voltage Tower","terms":""},"power/transformer":{"name":"Transformer","terms":""},"public_transport/platform":{"name":"Platform","terms":""},"public_transport/stop_position":{"name":"Stop Position","terms":""},"railway":{"name":"Railway","terms":""},"railway/abandoned":{"name":"Abandoned Railway","terms":""},"railway/disused":{"name":"Disused Railway","terms":""},"railway/funicular":{"name":"Funicular","terms":"venicular,cliff railway,cable car,cable railway,funicular railway"},"railway/halt":{"name":"Railway Halt","terms":"break,interrupt,rest,wait,interruption"},"railway/level_crossing":{"name":"Railway Crossing","terms":"crossing,railroad crossing,level crossing,grade crossing,road through railroad,train crossing"},"railway/monorail":{"name":"Monorail","terms":""},"railway/narrow_gauge":{"name":"Narrow Gauge Rail","terms":"narrow gauge railway,narrow gauge railroad"},"railway/platform":{"name":"Railway Platform","terms":""},"railway/rail":{"name":"Rail","terms":""},"railway/station":{"name":"Railway Station","terms":"train station,station"},"railway/subway":{"name":"Subway","terms":""},"railway/subway_entrance":{"name":"Subway Entrance","terms":""},"railway/tram":{"name":"Tram","terms":"streetcar"},"relation":{"name":"Relation","terms":""},"roundabout":{"name":"Roundabout","terms":""},"route/ferry":{"name":"Ferry Route","terms":""},"shop":{"name":"Shop","terms":""},"shop/alcohol":{"name":"Liquor Store","terms":"alcohol,beer,booze,wine"},"shop/anime":{"name":"Anime Shop","terms":""},"shop/antiques":{"name":"Antiques Shop","terms":""},"shop/art":{"name":"Art Store","terms":"art*,exhibit*,gallery"},"shop/baby_goods":{"name":"Baby Goods Store","terms":""},"shop/bag":{"name":"Bag/Luggage Store","terms":"handbag,purse"},"shop/bakery":{"name":"Bakery","terms":""},"shop/bathroom_furnishing":{"name":"Bathroom Furnishing Store","terms":""},"shop/beauty":{"name":"Beauty Shop","terms":"nail spa,spa,salon,tanning"},"shop/bed":{"name":"Bedding/Mattress Store","terms":""},"shop/beverages":{"name":"Beverage Store","terms":""},"shop/bicycle":{"name":"Bicycle Shop","terms":"bike,repair"},"shop/bookmaker":{"name":"Bookmaker","terms":""},"shop/books":{"name":"Book Store","terms":""},"shop/boutique":{"name":"Boutique","terms":""},"shop/butcher":{"name":"Butcher","terms":"meat"},"shop/candles":{"name":"Candle Shop","terms":""},"shop/car":{"name":"Car Dealership","terms":"auto"},"shop/car_parts":{"name":"Car Parts Store","terms":"auto"},"shop/car_repair":{"name":"Car Repair Shop","terms":"auto"},"shop/carpet":{"name":"Carpet Store","terms":"rug"},"shop/cheese":{"name":"Cheese Store","terms":""},"shop/chemist":{"name":"Chemist","terms":""},"shop/chocolate":{"name":"Chocolate Store","terms":""},"shop/clothes":{"name":"Clothing Store","terms":""},"shop/coffee":{"name":"Coffee Store","terms":""},"shop/computer":{"name":"Computer Store","terms":""},"shop/confectionery":{"name":"Candy Store","terms":""},"shop/convenience":{"name":"Convenience Store","terms":""},"shop/copyshop":{"name":"Copy Store","terms":""},"shop/cosmetics":{"name":"Cosmetics Store","terms":""},"shop/craft":{"name":"Arts and Crafts Store","terms":"art*,paint*,frame"},"shop/curtain":{"name":"Curtain Store","terms":"drape*,window"},"shop/dairy":{"name":"Dairy Store","terms":"milk,egg,cheese"},"shop/deli":{"name":"Deli","terms":"lunch,meat,sandwich"},"shop/department_store":{"name":"Department Store","terms":""},"shop/doityourself":{"name":"DIY Store","terms":""},"shop/dry_cleaning":{"name":"Dry Cleaner","terms":""},"shop/electronics":{"name":"Electronics Store","terms":"appliance,audio,computer,tv"},"shop/erotic":{"name":"Erotic Store","terms":"sex,porn"},"shop/fabric":{"name":"Fabric Store","terms":"sew"},"shop/farm":{"name":"Produce Stand","terms":"farm shop,farm stand"},"shop/fashion":{"name":"Fashion Store","terms":""},"shop/fishmonger":{"name":"Fishmonger","terms":""},"shop/florist":{"name":"Florist","terms":"flower"},"shop/frame":{"name":"Framing Shop","terms":"art*,paint*,photo*,frame"},"shop/funeral_directors":{"name":"Funeral Home","terms":"undertaker,memorial home"},"shop/furnace":{"name":"Furnace Store","terms":"oven,stove"},"shop/furniture":{"name":"Furniture Store","terms":"chair,sofa,table"},"shop/garden_centre":{"name":"Garden Center","terms":"landscape,mulch,shrub,tree"},"shop/gift":{"name":"Gift Shop","terms":""},"shop/greengrocer":{"name":"Greengrocer","terms":"fruit,vegetable"},"shop/hairdresser":{"name":"Hairdresser","terms":""},"shop/hardware":{"name":"Hardware Store","terms":""},"shop/hearing_aids":{"name":"Hearing Aids Store","terms":""},"shop/herbalist":{"name":"Herbalist","terms":""},"shop/hifi":{"name":"Hifi Store","terms":"stereo,video"},"shop/houseware":{"name":"Houseware Store","terms":"home,household"},"shop/interior_decoration":{"name":"Interior Decoration Store","terms":""},"shop/jewelry":{"name":"Jeweler","terms":"diamond,gem,ring"},"shop/kiosk":{"name":"News Kiosk","terms":""},"shop/kitchen":{"name":"Kitchen Design Store","terms":""},"shop/laundry":{"name":"Laundry","terms":""},"shop/leather":{"name":"Leather Store","terms":""},"shop/locksmith":{"name":"Locksmith","terms":"key,lockpick"},"shop/lottery":{"name":"Lottery Shop","terms":""},"shop/mall":{"name":"Mall","terms":""},"shop/massage":{"name":"Massage Shop","terms":""},"shop/medical_supply":{"name":"Medical Supply Store","terms":""},"shop/mobile_phone":{"name":"Mobile Phone Store","terms":""},"shop/money_lender":{"name":"Money Lender","terms":""},"shop/motorcycle":{"name":"Motorcycle Dealership","terms":""},"shop/music":{"name":"Music Store","terms":"CD,vinyl"},"shop/musical_instrument":{"name":"Musical Instrument Store","terms":""},"shop/newsagent":{"name":"Newspaper/Magazine Shop","terms":""},"shop/nutrition_supplements":{"name":"Nutrition Supplements Store","terms":""},"shop/optician":{"name":"Optician","terms":"eye,glasses"},"shop/organic":{"name":"Organic Goods Store","terms":""},"shop/outdoor":{"name":"Outdoors Store","terms":"camping,climbing,hiking"},"shop/paint":{"name":"Paint Store","terms":""},"shop/pawnbroker":{"name":"Pawn Shop","terms":""},"shop/pet":{"name":"Pet Store","terms":"cat,dog,fish"},"shop/photo":{"name":"Photography Store","terms":"camera,film"},"shop/pyrotechnics":{"name":"Fireworks Store","terms":""},"shop/radiotechnics":{"name":"Radio/Electronic Component Store","terms":""},"shop/religion":{"name":"Religious Store","terms":""},"shop/scuba_diving":{"name":"Scuba Diving Shop","terms":""},"shop/seafood":{"name":"Seafood Shop","terms":"fishmonger"},"shop/second_hand":{"name":"Consignment/Thrift Store","terms":"secondhand,second hand,resale,thrift,used"},"shop/shoes":{"name":"Shoe Store","terms":""},"shop/sports":{"name":"Sporting Goods Store","terms":""},"shop/stationery":{"name":"Stationery Store","terms":"card,paper"},"shop/storage_rental":{"name":"Storage Rental","terms":""},"shop/supermarket":{"name":"Supermarket","terms":"grocery,store,shop"},"shop/tailor":{"name":"Tailor","terms":"clothes,suit"},"shop/tattoo":{"name":"Tattoo Parlor","terms":""},"shop/tea":{"name":"Tea Store","terms":""},"shop/ticket":{"name":"Ticket Seller","terms":""},"shop/tobacco":{"name":"Tobacco Shop","terms":""},"shop/toys":{"name":"Toy Store","terms":""},"shop/travel_agency":{"name":"Travel Agency","terms":""},"shop/tyres":{"name":"Tire Store","terms":""},"shop/vacant":{"name":"Vacant Shop","terms":""},"shop/vacuum_cleaner":{"name":"Vacuum Cleaner Store","terms":""},"shop/variety_store":{"name":"Variety Store","terms":""},"shop/video":{"name":"Video Store","terms":"DVD"},"shop/video_games":{"name":"Video Game Store","terms":""},"shop/water_sports":{"name":"Watersport/Swim Shop","terms":""},"shop/weapons":{"name":"Weapon Shop","terms":"ammo,gun,knife,knives"},"shop/window_blind":{"name":"Window Blind Store","terms":""},"shop/wine":{"name":"Wine Shop","terms":""},"tourism":{"name":"Tourism","terms":""},"tourism/alpine_hut":{"name":"Alpine Hut","terms":""},"tourism/artwork":{"name":"Artwork","terms":"mural,sculpture,statue"},"tourism/attraction":{"name":"Tourist Attraction","terms":""},"tourism/camp_site":{"name":"Camp Site","terms":"Tent"},"tourism/caravan_site":{"name":"RV Park","terms":"Motor Home,Camper"},"tourism/chalet":{"name":"Chalet","terms":""},"tourism/gallery":{"name":"Art Gallery","terms":"art*,exhibit*,paint*,photo*,sculpt*"},"tourism/guest_house":{"name":"Guest House","terms":"B&B,Bed and Breakfast"},"tourism/hostel":{"name":"Hostel","terms":""},"tourism/hotel":{"name":"Hotel","terms":""},"tourism/information":{"name":"Information","terms":""},"tourism/motel":{"name":"Motel","terms":""},"tourism/museum":{"name":"Museum","terms":"art*,exhibit*,gallery,foundation,hall,institution,paint*,photo*,sculpt*"},"tourism/picnic_site":{"name":"Picnic Site","terms":"camp"},"tourism/theme_park":{"name":"Theme Park","terms":""},"tourism/viewpoint":{"name":"Viewpoint","terms":""},"tourism/zoo":{"name":"Zoo","terms":""},"traffic_calming/bump":{"name":"Speed Bump","terms":"speed hump"},"traffic_calming/hump":{"name":"Speed Hump","terms":"speed bump"},"traffic_calming/rumble_strip":{"name":"Rumble Strip","terms":"sleeper lines,audible lines,growlers"},"traffic_calming/table":{"name":"Raised Pedestrian Crossing","terms":"speed table,flat top hump"},"type/boundary":{"name":"Boundary","terms":""},"type/boundary/administrative":{"name":"Administrative Boundary","terms":""},"type/multipolygon":{"name":"Multipolygon","terms":""},"type/restriction":{"name":"Restriction","terms":""},"type/restriction/no_left_turn":{"name":"No Left Turn","terms":""},"type/restriction/no_right_turn":{"name":"No Right Turn","terms":""},"type/restriction/no_straight_on":{"name":"No Straight On","terms":""},"type/restriction/no_u_turn":{"name":"No U-turn","terms":""},"type/restriction/only_left_turn":{"name":"Left Turn Only","terms":""},"type/restriction/only_right_turn":{"name":"Right Turn Only","terms":""},"type/restriction/only_straight_on":{"name":"No Turns","terms":""},"type/route":{"name":"Route","terms":""},"type/route/bicycle":{"name":"Cycle Route","terms":""},"type/route/bus":{"name":"Bus Route","terms":""},"type/route/detour":{"name":"Detour Route","terms":""},"type/route/ferry":{"name":"Ferry Route","terms":""},"type/route/foot":{"name":"Foot Route","terms":""},"type/route/hiking":{"name":"Hiking Route","terms":""},"type/route/horse":{"name":"Riding Route","terms":""},"type/route/pipeline":{"name":"Pipeline Route","terms":""},"type/route/power":{"name":"Power Route","terms":""},"type/route/road":{"name":"Road Route","terms":""},"type/route/train":{"name":"Train Route","terms":""},"type/route/tram":{"name":"Tram Route","terms":""},"type/route_master":{"name":"Route Master","terms":""},"type/site":{"name":"Site","terms":""},"vertex":{"name":"Other","terms":""},"waterway":{"name":"Waterway","terms":""},"waterway/boatyard":{"name":"Boatyard","terms":""},"waterway/canal":{"name":"Canal","terms":""},"waterway/dam":{"name":"Dam","terms":""},"waterway/ditch":{"name":"Ditch","terms":""},"waterway/dock":{"name":"Wet Dock / Dry Dock","terms":"boat,ship,vessel,marine"},"waterway/drain":{"name":"Drain","terms":""},"waterway/fuel":{"name":"Marine Fuel Station","terms":"petrol,gas,diesel,boat"},"waterway/river":{"name":"River","terms":"beck,branch,brook,course,creek,estuary,rill,rivulet,run,runnel,stream,tributary,watercourse"},"waterway/riverbank":{"name":"Riverbank","terms":""},"waterway/sanitary_dump_station":{"name":"Marine Toilet Disposal","terms":"Boat,Watercraft,Sanitary,Dump Station,Pumpout,Pump out,Elsan,CDP,CTDP,Chemical Toilet"},"waterway/stream":{"name":"Stream","terms":"beck,branch,brook,burn,course,creek,current,drift,flood,flow,freshet,race,rill,rindle,rivulet,run,runnel,rush,spate,spritz,surge,tide,torrent,tributary,watercourse"},"waterway/water_point":{"name":"Marine Drinking Water","terms":""},"waterway/weir":{"name":"Weir","terms":""}}}},"suggestions":{"amenity":{"fuel":{"76":{"count":314},"Neste":{"count":189},"BP":{"count":2511},"Shell":{"count":8380},"Agip":{"count":2651},"Migrol":{"count":65},"Avia":{"count":897},"Texaco":{"count":680},"Total":{"count":2607},"Statoil":{"count":596},"Esso":{"count":3652},"Jet":{"count":441},"Avanti":{"count":90},"Sainsbury's":{"count":58},"OMV":{"count":701},"Aral":{"count":1339},"Tesco":{"count":197},"JET":{"count":180},"Morrisons":{"count":111},"United":{"count":91},"Canadian Tire":{"count":66},"Mobil":{"count":613},"Caltex":{"count":1001},"Sunoco":{"count":355},"Q8":{"count":1161},"ABC":{"count":79},"ARAL":{"count":375},"CEPSA":{"count":1018},"BFT":{"count":89},"Petron":{"count":878},"Intermarché":{"count":434},"Total Access":{"count":51},"Super U":{"count":124},"Auchan":{"count":53},"Elf":{"count":129},"Carrefour":{"count":205},"Station Service E. Leclerc":{"count":530},"Shell Express":{"count":131},"Hess":{"count":127},"Flying V":{"count":129},"bft":{"count":168},"Gulf":{"count":199},"PTT":{"count":191},"St1":{"count":100},"Teboil":{"count":115},"HEM":{"count":212},"GALP":{"count":626},"OK":{"count":163},"ÃMV":{"count":101},"Tinq":{"count":215},"OKQ8":{"count":186},"Repsol":{"count":424},"Westfalen":{"count":96},"Esso Express":{"count":98},"Raiffeisenbank":{"count":117},"Tamoil":{"count":866},"Engen":{"count":241},"Sasol":{"count":59},"Topaz":{"count":78},"LPG":{"count":174},"Coop":{"count":62},"Orlen":{"count":598},"Oilibya":{"count":68},"Tango":{"count":122},"Star":{"count":319},"ÐеÑÑол":{"count":84},"Cepsa":{"count":96},"OIL!":{"count":63},"Ultramar":{"count":125},"Irving":{"count":87},"Lukoil":{"count":701},"Petro-Canada":{"count":489},"7-Eleven":{"count":488},"Agrola":{"count":69},"Husky":{"count":126},"Slovnaft":{"count":219},"Sheetz":{"count":134},"Mol":{"count":61},"Petronas":{"count":159},"ÐазпÑомнеÑÑÑ":{"count":748},"ÐÑкойл":{"count":1477},"Elan":{"count":112},"РоÑнеÑÑÑ":{"count":638},"Turmöl":{"count":57},"Neste A24":{"count":55},"Marathon":{"count":189},"Valero":{"count":366},"Eni":{"count":236},"Chevron":{"count":954},"ТÐÐ":{"count":520},"REPSOL":{"count":1603},"MOL":{"count":228},"Bliska":{"count":150},"Api":{"count":302},"Arco":{"count":179},"Pemex":{"count":423},"Exxon":{"count":506},"Coles Express":{"count":115},"Petrom":{"count":259},"PETRONOR":{"count":207},"Rompetrol":{"count":174},"Lotos":{"count":178},"ÐÐÐ":{"count":60},"BR":{"count":129},"Copec":{"count":505},"Petrobras":{"count":270},"Liberty":{"count":55},"IP":{"count":871},"Erg":{"count":596},"Eneos":{"count":97},"Citgo":{"count":279},"Metano":{"count":208},"СÑÑгÑÑнеÑÑегаз":{"count":61},"EKO":{"count":59},"Eko":{"count":58},"Indipend.":{"count":172},"IES":{"count":63},"TotalErg":{"count":89},"Cenex":{"count":115},"ÐТÐ":{"count":82},"HP":{"count":79},"Phillips 66":{"count":216},"CARREFOUR":{"count":74},"ERG":{"count":76},"Speedway":{"count":148},"Benzina":{"count":96},"ТаÑнеÑÑÑ":{"count":264},"Terpel":{"count":259},"WOG":{"count":189},"Seaoil":{"count":54},"ÐÐС":{"count":1077},"Kwik Trip":{"count":108},"Wawa":{"count":89},"Pertamina":{"count":186},"COSMO":{"count":64},"Z":{"count":76},"Indian Oil":{"count":183},"ÐÐÐС":{"count":494},"INA":{"count":121},"JOMO":{"count":62},"Holiday":{"count":97},"YPF":{"count":70},"IDEMITSU":{"count":87},"ENEOS":{"count":736},"Bharat Petroleum":{"count":64},"CAMPSA":{"count":615},"Casey's General Store":{"count":190},"ÐаÑнеÑÑÑ":{"count":60},"Kangaroo":{"count":60},"ã³ã¹ã¢ç³æ²¹ (COSMO)":{"count":136},"MEROIL":{"count":77},"1-2-3":{"count":71},"åºå
":{"count":228,"tags":{"name:en":"IDEMITSU"}},"ÐÐ ÐлÑÑнÑ":{"count":88},"Sinclair":{"count":100},"Conoco":{"count":189},"SPBU":{"count":54},"ÐакпеÑÑол":{"count":109},"Circle K":{"count":166},"Posto Ipiranga":{"count":70},"Posto Shell":{"count":54},"Phoenix":{"count":144},"Ipiranga":{"count":119},"OKKO":{"count":85},"ÐÐÐÐ":{"count":119},"à¸à¸²à¸à¸à¸²à¸":{"count":60},"QuikTrip":{"count":105},"Stewart's":{"count":63},"Posto BR":{"count":68},"ภภà¸":{"count":152},"à¸à¸à¸":{"count":88},"ANP":{"count":80},"Kum & Go":{"count":80},"Petrolimex":{"count":55},"Sokimex":{"count":66},"Tela":{"count":154},"Posto":{"count":71},"H-E-B":{"count":182},"УкÑнаÑÑа":{"count":58},"ТаÑнеÑÑепÑодÑкÑ":{"count":54},"Afriquia":{"count":88},"Murphy USA":{"count":67},"æåã·ã§ã« (Showa-shell)":{"count":94},"ã¨ããªã¹":{"count":53},"CNG":{"count":94}},"pub":{"Kings Arms":{"count":67},"The Ship":{"count":89},"The White Horse":{"count":204},"The White Hart":{"count":226},"Royal Oak":{"count":150},"The Red Lion":{"count":233},"The Kings Arms":{"count":58},"The Star":{"count":73},"The Anchor":{"count":64},"The Cross Keys":{"count":55},"The Wheatsheaf":{"count":117},"The Crown Inn":{"count":67},"The Kings Head":{"count":53},"The Castle":{"count":62},"The Railway":{"count":102},"The White Lion":{"count":118},"The Bell":{"count":121},"The Bull":{"count":68},"The Plough":{"count":179},"The George":{"count":110},"The Royal Oak":{"count":209},"The Fox":{"count":74},"Prince of Wales":{"count":77},"The Rising Sun":{"count":71},"The Prince of Wales":{"count":51},"The Crown":{"count":244},"The Chequers":{"count":66},"The Swan":{"count":152},"Rose and Crown":{"count":79},"The Victoria":{"count":67},"New Inn":{"count":90},"Royal Hotel":{"count":57},"Red Lion":{"count":207},"Cross Keys":{"count":61},"The Greyhound":{"count":96},"The Black Horse":{"count":94},"The New Inn":{"count":105},"Kings Head":{"count":59},"The Albion":{"count":51},"The Angel":{"count":52},"The Queens Head":{"count":52},"The Ship Inn":{"count":83},"Rose & Crown":{"count":51},"Queens Head":{"count":52},"Irish Pub":{"count":76}},"fast_food":{"Quick":{"count":484},"McDonald's":{"count":12376,"tags":{"cuisine":"burger"}},"Subway":{"count":5576,"tags":{"cuisine":"sandwich"}},"Burger King":{"count":3734,"tags":{"cuisine":"burger"}},"Ali Baba":{"count":61},"Hungry Jacks":{"count":173,"tags":{"cuisine":"burger"}},"Red Rooster":{"count":148},"KFC":{"count":3198,"tags":{"cuisine":"chicken"}},"Domino's Pizza":{"count":985,"tags":{"cuisine":"pizza"}},"Chowking":{"count":142},"Jollibee":{"count":396},"Hesburger":{"count":102},"è¯å¾·åº":{"count":86},"Wendy's":{"count":1621,"tags":{"cuisine":"burger"}},"Tim Hortons":{"count":323},"Steers":{"count":151},"Hardee's":{"count":268,"tags":{"cuisine":"burger"}},"Arby's":{"count":782},"A&W":{"count":283},"Dairy Queen":{"count":791},"Hallo Pizza":{"count":76},"Fish & Chips":{"count":93},"Harvey's":{"count":90},"麥ç¶å":{"count":65},"Pizza Pizza":{"count":215},"Kotipizza":{"count":74},"Jack in the Box":{"count":546,"tags":{"cuisine":"burger"}},"Istanbul":{"count":56},"Kochlöffel":{"count":68},"Döner":{"count":228},"Telepizza":{"count":201},"Sibylla":{"count":61},"Carl's Jr.":{"count":298,"tags":{"cuisine":"burger"}},"Quiznos":{"count":266,"tags":{"cuisine":"sandwich"}},"Wimpy":{"count":141},"Sonic":{"count":566,"tags":{"cuisine":"burger"}},"Taco Bell":{"count":1423,"tags":{"cuisine":"mexican"}},"Pizza Nova":{"count":63},"Papa John's":{"count":304,"tags":{"cuisine":"pizza"}},"Nordsee":{"count":159},"Mr. Sub":{"count":103},"ÐакдоналдÑ":{"count":324,"tags":{"name:en":"McDonald's"}},"Asia Imbiss":{"count":111},"Chipotle":{"count":290,"tags":{"cuisine":"mexican"}},"ãã¯ããã«ã":{"count":692,"tags":{"name:en":"McDonald's","cuisine":"burger"}},"In-N-Out Burger":{"count":65},"Jimmy John's":{"count":141},"Jamba Juice":{"count":68},"Робин Сдобин":{"count":82},"Baskin Robbins":{"count":74},"ã±ã³ã¿ããã¼ãã©ã¤ãããã³":{"count":164,"tags":{"name:en":"KFC","cuisine":"chicken"}},"åé家":{"count":191},"Taco Time":{"count":88},"æ¾å±":{"count":281,"tags":{"name:en":"Matsuya"}},"Little Caesars":{"count":81},"El Pollo Loco":{"count":63},"Del Taco":{"count":141},"White Castle":{"count":80},"Boston Market":{"count":66},"Chick-fil-A":{"count":257,"tags":{"cuisine":"chicken"}},"Panda Express":{"count":238,"tags":{"cuisine":"chinese"}},"Whataburger":{"count":364},"Taco John's":{"count":78},"ТеÑемок":{"count":68},"Culver's":{"count":425},"Five Guys":{"count":141},"Church's Chicken":{"count":95},"Popeye's":{"count":167,"tags":{"cuisine":"chicken"}},"Long John Silver's":{"count":93},"Pollo Campero":{"count":62},"Zaxby's":{"count":51},"ãã家":{"count":276,"tags":{"name:en":"SUKIYA"}},"ã¢ã¹ãã¼ã¬ã¼":{"count":257,"tags":{"name:en":"MOS BURGER"}},"Ð ÑÑÑкий ÐппеÑиÑ":{"count":69},"ãªãå¯":{"count":63}},"restaurant":{"Pizza Hut":{"count":1180,"tags":{"cuisine":"pizza"}},"Little Chef":{"count":64},"Adler":{"count":158},"Zur Krone":{"count":90},"Deutsches Haus":{"count":90},"Krone":{"count":171},"Akropolis":{"count":152},"Schützenhaus":{"count":124},"Kreuz":{"count":74},"Waldschänke":{"count":55},"La Piazza":{"count":69},"Lamm":{"count":66},"Zur Sonne":{"count":73},"Zur Linde":{"count":204},"Poseidon":{"count":110},"Shanghai":{"count":82},"Red Lobster":{"count":235},"Zum Löwen":{"count":84},"Swiss Chalet":{"count":107},"Olympia":{"count":74},"Wagamama":{"count":64},"Frankie & Benny's":{"count":66},"Hooters":{"count":103},"Sternen":{"count":78},"Hirschen":{"count":79},"Denny's":{"count":450},"Athen":{"count":68},"Sonne":{"count":126},"Hirsch":{"count":79},"Ratskeller":{"count":150},"La Cantina":{"count":56},"Gasthaus Krone":{"count":56},"El Greco":{"count":86},"Gasthof zur Post":{"count":79},"Nando's":{"count":246},"Löwen":{"count":112},"La Pataterie":{"count":51},"Bella Napoli":{"count":53},"Pizza Express":{"count":262},"Mandarin":{"count":65},"Hong Kong":{"count":83},"Zizzi":{"count":68},"Cracker Barrel":{"count":183},"Rhodos":{"count":81},"Lindenhof":{"count":79},"Milano":{"count":54},"Dolce Vita":{"count":77},"Kirchenwirt":{"count":81},"Kantine":{"count":52},"Ochsen":{"count":95},"Spur":{"count":62},"Mykonos":{"count":59},"Lotus":{"count":66},"Applebee's":{"count":531},"Flunch":{"count":72},"Zur Post":{"count":116},"China Town":{"count":76},"La Dolce Vita":{"count":73},"Waffle House":{"count":207},"Delphi":{"count":88},"Linde":{"count":103},"Outback Steakhouse":{"count":218},"Dionysos":{"count":69},"Kelsey's":{"count":57},"Boston Pizza":{"count":165},"Bella Italia":{"count":132},"Sizzler":{"count":53},"Grüner Baum":{"count":116},"Taj Mahal":{"count":104},"Rössli":{"count":68},"Wimpy":{"count":51},"Traube":{"count":65},"Adria":{"count":52},"Red Robin":{"count":185},"Roma":{"count":61},"San Marco":{"count":67},"Hellas":{"count":55},"La Perla":{"count":67},"Vips":{"count":53},"Panera Bread":{"count":218},"Da Vinci":{"count":54},"Hippopotamus":{"count":96},"Prezzo":{"count":75},"Courtepaille":{"count":106},"Hard Rock Cafe":{"count":70},"Panorama":{"count":61},"ããã¼ãº":{"count":82},"Sportheim":{"count":65},"é¤åã®çå°":{"count":57},"Bären":{"count":60},"Alte Post":{"count":60},"Pizzeria Roma":{"count":51},"China Garden":{"count":66},"Vapiano":{"count":82},"Mamma Mia":{"count":64},"Schwarzer Adler":{"count":57},"IHOP":{"count":317},"Chili's":{"count":328},"Asia":{"count":51},"Olive Garden":{"count":279},"TGI Friday's":{"count":159},"Friendly's":{"count":78},"Buffalo Grill":{"count":202},"Texas Roadhouse":{"count":110},"ã¬ã¹ã":{"count":230,"tags":{"name:en":"Gusto"}},"Sakura":{"count":75},"Mensa":{"count":99},"The Keg":{"count":53},"ãµã¤ã¼ãªã¤":{"count":93},"La Strada":{"count":52},"Village Inn":{"count":92},"Buffalo Wild Wings":{"count":176},"Peking":{"count":59},"Boston Market":{"count":61},"Round Table Pizza":{"count":53},"Jimmy John's":{"count":69},"California Pizza Kitchen":{"count":61},"ЯкиÑоÑиÑ":{"count":77},"Golden Corral":{"count":101},"Perkins":{"count":105},"Ruby Tuesday":{"count":162},"Shari's":{"count":65},"Bob Evans":{"count":129},"ë°ë¤íì§ (Bada Fish Restaurant)":{"count":55},"Mang Inasal":{"count":84},"ÐвÑазиÑ":{"count":102},"ã¸ã§ããµã³":{"count":59},"Longhorn Steakhouse":{"count":66}},"bank":{"Chase":{"count":721},"Commonwealth Bank":{"count":232},"Citibank":{"count":277},"HSBC":{"count":1102},"Barclays":{"count":965},"Westpac":{"count":208},"NAB":{"count":131},"ANZ":{"count":218},"Lloyds Bank":{"count":547},"Landbank":{"count":81},"Sparkasse":{"count":4555},"UCPB":{"count":92},"PNB":{"count":244},"Metrobank":{"count":269},"BDO":{"count":290},"Volksbank":{"count":2591},"BPI":{"count":415},"Postbank":{"count":443},"NatWest":{"count":628},"Raiffeisenbank":{"count":2119},"Yorkshire Bank":{"count":63},"ABSA":{"count":95},"Standard Bank":{"count":109},"FNB":{"count":97},"Deutsche Bank":{"count":855},"SEB":{"count":133},"Commerzbank":{"count":806},"Targobank":{"count":166},"ABN AMRO":{"count":130},"Handelsbanken":{"count":184},"Swedbank":{"count":223},"Kreissparkasse":{"count":600},"UniCredit Bank":{"count":408},"Monte dei Paschi di Siena":{"count":132},"Caja Rural":{"count":99},"Dresdner Bank":{"count":66},"Sparda-Bank":{"count":320},"VÃB":{"count":107},"Slovenská sporiteľÅa":{"count":134},"Bank of Montreal":{"count":118},"KBC":{"count":203},"Royal Bank of Scotland":{"count":111},"TSB":{"count":80},"US Bank":{"count":256},"HypoVereinsbank":{"count":561},"Bank Austria":{"count":176},"ING":{"count":496},"Erste Bank":{"count":180},"CIBC":{"count":326},"Scotiabank":{"count":413},"Caisse d'Ãpargne":{"count":882},"Santander":{"count":1323},"Bank of Scotland":{"count":89},"TD Canada Trust":{"count":450},"BMO":{"count":169},"Danske Bank":{"count":131},"OTP":{"count":192},"Crédit Agricole":{"count":1239},"LCL":{"count":553},"VR-Bank":{"count":430},"ÄSOB":{"count":160},"Äeská spoÅitelna":{"count":212},"BNP":{"count":112},"Royal Bank":{"count":65},"Nationwide":{"count":209},"Halifax":{"count":225},"BAWAG PSK":{"count":102},"National Bank":{"count":84},"Nedbank":{"count":80},"First National Bank":{"count":85},"Nordea":{"count":319},"Rabobank":{"count":609},"Sparkasse KölnBonn":{"count":69},"Tatra banka":{"count":67},"Berliner Sparkasse":{"count":62},"Berliner Volksbank":{"count":77},"Wells Fargo":{"count":874},"Credit Suisse":{"count":71},"Société Générale":{"count":634},"Osuuspankki":{"count":75},"Sparkasse Aachen":{"count":56},"Hamburger Sparkasse":{"count":156},"Cassa di Risparmio del Veneto":{"count":68},"BNP Paribas":{"count":617},"Banque Populaire":{"count":433},"BNP Paribas Fortis":{"count":209},"Banco Popular":{"count":291},"Bancaja":{"count":55},"Banesto":{"count":208},"La Caixa":{"count":583},"Santander Consumer Bank":{"count":88},"BRD":{"count":191},"BCR":{"count":143},"Banca Transilvania":{"count":141},"BW-Bank":{"count":97},"KomerÄnà banka":{"count":132},"Banco Pastor":{"count":64},"Stadtsparkasse":{"count":86},"Ulster Bank":{"count":86},"Sberbank":{"count":58},"CIC":{"count":427},"Bancpost":{"count":56},"Caja Madrid":{"count":115},"Maybank":{"count":94},"ä¸å½é¶è¡":{"count":85},"Unicredit Banca":{"count":243},"Crédit Mutuel":{"count":690},"BBVA":{"count":647},"Intesa San Paolo":{"count":69},"TD Bank":{"count":206},"Belfius":{"count":231},"Bank of America":{"count":924},"RBC":{"count":230},"Alpha Bank":{"count":123},"СбеÑбанк":{"count":4794},"РоÑÑелÑÑ
озбанк":{"count":201},"Crédit du Nord":{"count":96},"BancoEstado":{"count":80},"Millennium Bank":{"count":414},"State Bank of India":{"count":151},"ÐелаÑÑÑбанк":{"count":242},"ING Bank ÅlÄ
ski":{"count":67},"Caixa Geral de Depósitos":{"count":129},"Kreissparkasse Köln":{"count":65},"Banco BCI":{"count":51},"Banco de Chile":{"count":98},"ÐТÐ24":{"count":326},"UBS":{"count":134},"PKO BP":{"count":265},"Chinabank":{"count":55},"PSBank":{"count":59},"Union Bank":{"count":124},"China Bank":{"count":66},"RCBC":{"count":122},"Unicaja":{"count":83},"BBK":{"count":79},"Ibercaja":{"count":69},"RBS":{"count":143},"Commercial Bank of Ceylon PLC":{"count":79},"Bank of Ireland":{"count":109},"BNL":{"count":87},"Banco Santander":{"count":138},"Banco Itaú":{"count":111},"AIB":{"count":72},"BZ WBK":{"count":77},"Banco do Brasil":{"count":557},"Caixa Econômica Federal":{"count":184},"Fifth Third Bank":{"count":84},"Banca Popolare di Vicenza":{"count":81},"Wachovia":{"count":58},"OLB":{"count":53},"ã¿ãã»éè¡":{"count":78},"BES":{"count":72},"ICICI Bank":{"count":91},"HDFC Bank":{"count":91},"La Banque Postale":{"count":67},"Pekao SA":{"count":56},"Oberbank":{"count":90},"Bradesco":{"count":295},"Oldenburgische Landesbank":{"count":56},"Bendigo Bank":{"count":93},"Argenta":{"count":86},"AXA":{"count":68},"Axis Bank":{"count":61},"Banco Nación":{"count":67},"GE Money Bank":{"count":72},"ÐлÑÑа-Ðанк":{"count":185},"ÐелагÑопÑомбанк":{"count":70},"Caja CÃrculo":{"count":65},"Banco Galicia":{"count":51},"Eurobank":{"count":97},"Banca Intesa":{"count":62},"Canara Bank":{"count":92},"Cajamar":{"count":77},"Banamex":{"count":149},"Crédit Mutuel de Bretagne":{"count":335},"Davivienda":{"count":83},"Bank SpóÅdzielczy":{"count":159},"Credit Agricole":{"count":157},"Bankinter":{"count":59},"Banque Nationale":{"count":63},"Bank of the West":{"count":96},"Key Bank":{"count":155},"Western Union":{"count":88},"Citizens Bank":{"count":115},"ÐÑиваÑÐанк":{"count":513},"Security Bank":{"count":78},"Millenium":{"count":60},"Bankia":{"count":149},"ä¸è±æ±äº¬UFJéè¡":{"count":159},"Caixa":{"count":117},"Banco de Costa Rica":{"count":63},"SunTrust Bank":{"count":73},"Itaú":{"count":338},"PBZ":{"count":52},"ä¸å½å·¥åé¶è¡":{"count":51},"Bancolombia":{"count":89},"РайÑÑайзен Ðанк ÐвалÑ":{"count":64},"Bancomer":{"count":115},"Banorte":{"count":80},"Alior Bank":{"count":81},"BOC":{"count":51},"Ðанк ÐоÑквÑ":{"count":118},"ÐТÐ":{"count":59},"Getin Bank":{"count":55},"Caja Duero":{"count":57},"Regions Bank":{"count":62},"РоÑбанк":{"count":177},"Banco Estado":{"count":72},"BCI":{"count":68},"SunTrust":{"count":68},"PNC Bank":{"count":254},"ì íìí":{"count":217,"tags":{"name:en":"Sinhan Bank"}},"ì°ë¦¬ìí":{"count":291,"tags":{"name:en":"Uri Bank"}},"êµë¯¼ìí":{"count":165,"tags":{"name:en":"Gungmin Bank"}},"ì¤ì기ì
ìí":{"count":52,"tags":{"name:en":"Industrial Bank of Korea"}},"ê´ì£¼ìí":{"count":51,"tags":{"name:en":"Gwangju Bank"}},"ÐазпÑомбанк":{"count":100},"M&T Bank":{"count":92},"Caja de Burgos":{"count":51},"Santander Totta":{"count":69},"УкÑСиббанк":{"count":192},"ÐÑадбанк":{"count":364},"УÑалÑиб":{"count":85},"ãããªéè¡":{"count":225,"tags":{"name:en":"Mizuho Bank"}},"Ecobank":{"count":66},"Cajero Automatico Bancared":{"count":145},"ÐÑомÑвÑзÑбанк":{"count":93},"ä¸äºä½åéè¡":{"count":129},"Banco Provincia":{"count":67},"BB&T":{"count":147},"ÐозÑождение":{"count":59},"Capital One":{"count":59},"横æµéè¡":{"count":51},"Bank Mandiri":{"count":62},"Banco de la Nación":{"count":92},"Banco G&T Continental":{"count":62},"Peoples Bank":{"count":60},"å·¥åé¶è¡":{"count":51},"Совкомбанк":{"count":55},"Provincial":{"count":56},"Banco de Desarrollo Banrural":{"count":73},"Banco Bradesco":{"count":65},"Bicentenario":{"count":182},"ááááá áá ááááá":{"count":54,"tags":{"name:en":"Liberty Bank"}},"Banesco":{"count":108},"Mercantil":{"count":75},"Bank BRI":{"count":53},"Del Tesoro":{"count":91},"íëìí":{"count":77},"CityCommerce Bank":{"count":71},"De Venezuela":{"count":117}},"car_rental":{"Europcar":{"count":291},"Budget":{"count":92},"Sixt":{"count":161},"Avis":{"count":282},"Hertz":{"count":293},"Enterprise":{"count":199},"stadtmobil CarSharing-Station":{"count":148}},"pharmacy":{"Rowlands Pharmacy":{"count":71},"Boots":{"count":840},"Marien-Apotheke":{"count":314},"Mercury Drug":{"count":426},"Löwen-Apotheke":{"count":356},"Superdrug":{"count":117},"Sonnen-Apotheke":{"count":311},"Rathaus-Apotheke":{"count":132},"Engel-Apotheke":{"count":123},"Hirsch-Apotheke":{"count":83},"Stern-Apotheke":{"count":67},"Lloyds Pharmacy":{"count":295},"Rosen-Apotheke":{"count":208},"Stadt-Apotheke":{"count":302},"Markt-Apotheke":{"count":164},"ÐпÑека":{"count":1989},"Pharmasave":{"count":64},"Brunnen-Apotheke":{"count":53},"Shoppers Drug Mart":{"count":430},"Apotheke am Markt":{"count":60},"Alte Apotheke":{"count":88},"Neue Apotheke":{"count":109},"GintarinÄ vaistinÄ":{"count":101},"Rats-Apotheke":{"count":84},"Adler Apotheke":{"count":313},"Pharmacie Centrale":{"count":64},"Walgreens":{"count":1619},"Rite Aid":{"count":745},"Apotheke":{"count":165},"Linden-Apotheke":{"count":211},"Bahnhof-Apotheke":{"count":66},"Burg-Apotheke":{"count":55},"Jean Coutu":{"count":62},"Pharmaprix":{"count":60},"Farmacias Ahumada":{"count":104},"Farmacia Comunale":{"count":113},"Farmacias Cruz Verde":{"count":86},"Cruz Verde":{"count":99},"Hubertus Apotheke":{"count":52},"CVS":{"count":1560},"Farmacias SalcoBrand":{"count":133},"ФаÑмаÑиÑ":{"count":120},"Bären-Apotheke":{"count":74},"Clicks":{"count":113},"ã»ã¤ã¸ã§ã¼":{"count":53},"ããã¢ããã¨ã·":{"count":115},"Dr. Max":{"count":51},"ÐиÑа":{"count":106},"РадÑга":{"count":70},"ãµã³ãã©ãã°":{"count":61},"Apteka":{"count":366},"ÐеÑÐ²Ð°Ñ Ð¿Ð¾Ð¼Ð¾ÑÑ":{"count":74},"Ригла":{"count":113},"ÐмплозиÑ":{"count":63},"Kinney Drugs":{"count":68},"ÐлаÑÑика":{"count":67},"Ljekarna":{"count":53},"SalcoBrand":{"count":88},"ÐпÑека 36,6":{"count":224},"ФаÑмакоÑ":{"count":75},"ã¹ã®è¬å±":{"count":84},"ÐпÑеÑнÑй пÑнкÑ":{"count":148},"ÐевиÑ":{"count":60},"ãã¢ãº (Tomod's)":{"count":83},"EurovaistinÄ":{"count":65},"Farmacity":{"count":68},"апÑека":{"count":96},"The Generics Pharmacy":{"count":95},"Farmatodo":{"count":123},"Duane Reade":{"count":61},"H-E-B":{"count":262},"ФаÑмленд":{"count":82},"ãã©ãã°ã¦ããã¾ (Drug Terashima)":{"count":96},"ÐÑнÑка":{"count":125},"áááá á¡á (Aversi)":{"count":62},"Farmahorro":{"count":58}},"cafe":{"Starbucks":{"count":4238,"tags":{"cuisine":"coffee_shop"}},"Cafeteria":{"count":115},"Costa":{"count":618},"Caffè Nero":{"count":169},"ÐаÑе":{"count":226},"Café Central":{"count":61},"Second Cup":{"count":193},"Dunkin Donuts":{"count":428,"tags":{"cuisine":"donut"}},"Espresso House":{"count":53},"Segafredo":{"count":69},"Coffee Time":{"count":94},"Cafe Coffee Day":{"count":120},"Eiscafe Venezia":{"count":180},"ã¹ã¿ã¼ããã¯ã¹":{"count":251,"tags":{"name:en":"Starbucks"}},"ШоколадниÑа":{"count":145},"Pret A Manger":{"count":119},"СÑоловаÑ":{"count":391},"Jamba Juice":{"count":53},"ããã¼ã«":{"count":164,"tags":{"name:en":"DOUTOR"}},"Tchibo":{"count":100},"ÐоÑе ХаÑз":{"count":104},"Caribou Coffee":{"count":100},"УÑÑ":{"count":51},"ШаÑлÑÑнаÑ":{"count":58},"à¸à¸²à¹à¸à¹ à¸à¹à¸¡à¸à¸à¸":{"count":62},"Traveler's Coffee":{"count":60},"ã«ãã§ã»ãã»ã¯ãªã¨":{"count":67,"tags":{"name:en":"Cafe de CRIE"}},"Cafe Amazon":{"count":65}}},"shop":{"supermarket":{"Budgens":{"count":88},"Morrisons":{"count":411},"Interspar":{"count":142},"Merkur":{"count":107},"Sainsbury's":{"count":547},"Lidl":{"count":7130},"Edeka":{"count":2293},"Coles":{"count":400},"Iceland":{"count":315},"Coop":{"count":2100},"Tesco":{"count":1297},"Woolworths":{"count":541},"Zielpunkt":{"count":239},"Nahkauf":{"count":170},"Billa":{"count":1432},"Kaufland":{"count":1004},"Plus":{"count":120},"ALDI":{"count":5172},"Checkers":{"count":128},"Tesco Metro":{"count":137},"NP":{"count":153},"Penny":{"count":1759},"Norma":{"count":1068},"Asda":{"count":225},"Netto":{"count":4379},"Rewe":{"count":2645},"Aldi Süd":{"count":594},"Real":{"count":246},"Tesco Express":{"count":406},"King Soopers":{"count":72},"Kiwi":{"count":167},"Pick n Pay":{"count":241},"ICA":{"count":192},"Tengelmann":{"count":188},"Carrefour":{"count":1640},"Waitrose":{"count":258},"Spar":{"count":2386},"Hofer":{"count":442},"M-Preis":{"count":76},"tegut":{"count":210},"Sainsbury's Local":{"count":118},"E-Center":{"count":66},"Aldi Nord":{"count":210},"nahkauf":{"count":84},"Meijer":{"count":76},"Safeway":{"count":410},"Costco":{"count":152},"Albert":{"count":185},"Jumbo":{"count":194},"Shoprite":{"count":244},"MPreis":{"count":54},"Penny Market":{"count":429},"Tesco Extra":{"count":123},"Albert Heijn":{"count":476},"IGA":{"count":363},"Super U":{"count":488},"Metro":{"count":260},"Neukauf":{"count":77},"Migros":{"count":459},"Marktkauf":{"count":121},"Delikatesy Centrum":{"count":59},"C1000":{"count":307},"Hoogvliet":{"count":53},"Food Basics":{"count":75},"Casino":{"count":264},"Penny Markt":{"count":466},"Giant":{"count":191},"COOP Jednota":{"count":73},"Rema 1000":{"count":368},"Kaufpark":{"count":96},"ALDI SÃD":{"count":113},"Simply Market":{"count":330},"Konzum":{"count":230},"Carrefour Express":{"count":353},"Eurospar":{"count":270},"Mercator":{"count":125},"Famila":{"count":130},"Hemköp":{"count":82},"real,-":{"count":81},"Markant":{"count":88},"Volg":{"count":135},"Leader Price":{"count":267},"Treff 3000":{"count":94},"SuperBrugsen":{"count":67},"Kaiser's":{"count":256},"K+K":{"count":106},"Unimarkt":{"count":86},"Carrefour City":{"count":126},"Sobeys":{"count":122},"S-Market":{"count":109},"Combi":{"count":55},"Denner":{"count":276},"Konsum":{"count":133},"Franprix":{"count":312},"Monoprix":{"count":198},"Diska":{"count":69},"PENNY":{"count":79},"Dia":{"count":835},"Giant Eagle":{"count":85},"NORMA":{"count":115},"AD Delhaize":{"count":63},"Auchan":{"count":152},"Mercadona":{"count":769},"Consum":{"count":130},"Carrefour Market":{"count":80},"Whole Foods":{"count":210,"tags":{"shop":"supermarket"}},"Pam":{"count":56},"sky":{"count":105},"Despar":{"count":146},"Eroski":{"count":208},"Costcutter":{"count":63},"Maxi":{"count":108},"Colruyt":{"count":180},"The Co-operative":{"count":64},"Intermarché":{"count":1210},"Delhaize":{"count":207},"CBA":{"count":176},"Shopi":{"count":53},"Walmart":{"count":644},"Kroger":{"count":317},"Albertsons":{"count":242},"Trader Joe's":{"count":235},"Feneberg":{"count":58},"denn's Biomarkt":{"count":52},"dm":{"count":114},"Kvickly":{"count":55},"Makro":{"count":140},"Dico":{"count":53},"Nah & Frisch":{"count":73},"Champion":{"count":59},"ICA Supermarket":{"count":51},"Fakta":{"count":235},"ÐагниÑ":{"count":1760},"Caprabo":{"count":103},"Famiglia Cooperativa":{"count":64},"ÐаÑÐ¾Ð´Ð½Ð°Ñ 7Я ÑемÑЯ":{"count":154},"Esselunga":{"count":85},"Maxima":{"count":102},"Petit Casino":{"count":111},"Wasgau":{"count":60},"Pingo Doce":{"count":253},"Match":{"count":140},"Profi":{"count":60},"Lider":{"count":65},"Unimarc":{"count":177},"The Co-operative Food":{"count":190},"Santa Isabel":{"count":128},"СедÑмой конÑиненÑ":{"count":79},"HIT":{"count":59},"Rimi":{"count":106},"Conad":{"count":304},"ФÑÑÑеÑ":{"count":76},"Willys":{"count":56},"Farmfoods":{"count":64},"U Express":{"count":51},"ФоÑа":{"count":52},"Dunnes Stores":{"count":73},"СÑлÑпо":{"count":125},"ãã«ã¨ã":{"count":59},"Piggly Wiggly":{"count":57},"Crai":{"count":54},"El Ãrbol":{"count":73},"Centre Commercial E. Leclerc":{"count":549},"Foodland":{"count":100},"Super Brugsen":{"count":67},"ÐикÑи":{"count":683},"ÐÑÑÑÑоÑка":{"count":1344},"Publix":{"count":339},"Føtex":{"count":66},"coop":{"count":73},"Fressnapf":{"count":69},"Coop Konsum":{"count":79},"Carrefour Contact":{"count":83},"No Frills":{"count":105},"Plodine":{"count":52},"ADEG":{"count":68},"Minipreço":{"count":111},"Biedronka":{"count":1335},"Eurospin":{"count":155},"СемÑÑ":{"count":62},"Gadis":{"count":53},"ÐвÑоопÑ":{"count":68},"Centra":{"count":51},"ÐваÑÑал":{"count":82},"New World":{"count":69},"Countdown":{"count":95},"Reliance Fresh":{"count":61},"Stokrotka":{"count":98},"Coop Jednota":{"count":74},"Fred Meyer":{"count":64},"Irma":{"count":58},"Continente":{"count":75},"Price Chopper":{"count":99},"Game":{"count":52},"Soriana":{"count":93},"Alimerka":{"count":64},"Piotr i PaweÅ":{"count":53},"ÐеÑекÑеÑÑок":{"count":312},"Maxima X":{"count":117},"ÐаÑÑÑелÑ":{"count":55},"ALDI Nord":{"count":51},"Condis":{"count":67},"Sam's Club":{"count":138},"Ðопейка":{"count":87},"Géant Casino":{"count":54},"ASDA":{"count":180},"Intermarche":{"count":115},"Stop & Shop":{"count":66},"Food Lion":{"count":216},"Harris Teeter":{"count":92},"Foodworks":{"count":62},"Polo Market":{"count":86},"ÐенÑа":{"count":51},"西å (SEIYU)":{"count":58},"H-E-B":{"count":293},"ÐÑак":{"count":53},"ÐолÑÑка":{"count":139},"Extra":{"count":82},"Lewiatan":{"count":94},"Sigma":{"count":51},"ÐТÐ":{"count":322},"SpoÅem":{"count":55},"Bodega Aurrera":{"count":82},"Tesco Lotus":{"count":77},"ÐаÑиÑ-Ра":{"count":108},"ÐагнолиÑ":{"count":72},"Ðагазин":{"count":120},"ÐонеÑка":{"count":174},"Hy-Vee":{"count":75},"Walmart Supercenter":{"count":133},"Hannaford":{"count":57},"Wegmans":{"count":83},"æ¥åã¹ã¼ãã¼":{"count":61},"Norfa XL":{"count":55},"ã¨ã¼ã¯ãã¼ã (YorkMart)":{"count":64},"Leclerc Drive":{"count":76}},"electronics":{"Media Markt":{"count":285},"Maplin":{"count":65},"Best Buy":{"count":345},"Future Shop":{"count":73},"Saturn":{"count":134},"Currys":{"count":80},"Radio Shack":{"count":269},"Euronics":{"count":115},"Expert":{"count":123},"ÐлÑдоÑадо":{"count":184},"Darty":{"count":74},"Ð.Ðидео":{"count":89},"ã¤ããé»æ©":{"count":51}},"convenience":{"Shell":{"count":255},"Spar":{"count":1119},"McColl's":{"count":100},"Tesco Express":{"count":426},"Sainsbury's Local":{"count":104},"Aral":{"count":56},"One Stop":{"count":146},"The Co-operative Food":{"count":115},"Londis":{"count":352},"7-Eleven":{"count":4440},"CBA":{"count":135},"Coop":{"count":678},"Sale":{"count":80},"Statoil":{"count":69},"Sheetz":{"count":54},"Konzum":{"count":173},"Siwa":{"count":216},"Mercator":{"count":57},"Esso":{"count":67},"COOP Jednota":{"count":181},"Mac's":{"count":152},"Alepa":{"count":62},"Hasty Market":{"count":54},"K-Market":{"count":54},"Costcutter":{"count":292},"Valintatalo":{"count":62},"Casino":{"count":90},"Franprix":{"count":61},"Circle K":{"count":289},"ã»ãã³ã¤ã¬ãã³":{"count":3011,"tags":{"name:en":"7-Eleven"}},"ãã¼ã½ã³":{"count":1596,"tags":{"name:en":"LAWSON"}},"BP":{"count":163},"Tesco":{"count":55},"Petit Casino":{"count":233},"Volg":{"count":116},"Mace":{"count":115},"Mini Market":{"count":272},"Nisa Local":{"count":77},"Dorfladen":{"count":75},"ÐÑодÑкÑÑ":{"count":4285},"Mini Stop":{"count":228},"LAWSON":{"count":419},"ãã¤ãªã¼ã¤ãã¶ã":{"count":141},"Biedronka":{"count":83},"Ðадежда":{"count":56},"Mobil":{"count":66},"Nisa":{"count":51},"Premier":{"count":129},"ABC":{"count":152},"ããã¹ããã":{"count":316,"tags":{"name:en":"MINISTOP"}},"ãµã³ã¯ã¹":{"count":560,"tags":{"name:en":"sunkus"}},"ã¹ãªã¼ã¨ã":{"count":88},"8 à Huit":{"count":61},"Tchibo":{"count":56},"Å»abka":{"count":546},"Almacen":{"count":229},"Vival":{"count":194},"FamilyMart":{"count":529},"ãã¡ããªã¼ãã¼ã":{"count":1608,"tags":{"name:en":"FamilyMart"}},"Carrefour City":{"count":57},"Sunkus":{"count":62},"Casey's General Store":{"count":95},"ã»ãã³ã¤ã¬ãã³(Seven-Eleven)":{"count":65},"Jednota":{"count":58},"Ðагазин":{"count":915},"ÐаÑÑÑоном":{"count":152},"Centra":{"count":111},"ÐагниÑ":{"count":701},"ãµã¼ã¯ã«K":{"count":538,"tags":{"name:en":"Circle K"}},"Wawa":{"count":135},"Proxi":{"count":123},"УнивеÑÑам":{"count":78},"ÐеÑекÑеÑÑок":{"count":51},"Groszek":{"count":65},"Select":{"count":62},"VeÄerka":{"count":51},"Potraviny":{"count":249},"Смак":{"count":78},"Ðконом":{"count":55},"ÐеÑезка":{"count":77},"SpoÅem":{"count":93},"Carrefour Express":{"count":84},"Cumberland Farms":{"count":63},"Chevron":{"count":59},"Coop Jednota":{"count":66},"Tesco Lotus Express":{"count":67},"Kiosk":{"count":55},"Sklep spożywczy":{"count":130},"24 ÑаÑа":{"count":58},"ÐинимаÑкеÑ":{"count":102},"Oxxo":{"count":669},"ÐÑÑÑÑоÑка":{"count":398},"abc":{"count":74},"7/11":{"count":51},"Stewart's":{"count":255},"ÐÑодÑкÑи":{"count":171},"ãã¼ã½ã³ã¹ãã¢100 (LAWSON STORE 100)":{"count":85},"ÐикÑи":{"count":119},"РадÑга":{"count":86},"ãã¼ã½ã³ã¹ãã¢100":{"count":76},"à¹à¸à¹à¸§à¹à¸à¸à¸µà¹à¸¥à¸à¹à¸§à¹à¸":{"count":185},"Delikatesy Centrum":{"count":53},"Citgo":{"count":62},"ФоÑÑÑна":{"count":51},"Kum & Go":{"count":59},"ÐаÑиÑ-Ра":{"count":76},"Picard":{"count":57},"Four Square":{"count":52},"ÐизиÑ":{"count":57},"ÐвоÑÑка":{"count":55},"Dollar General":{"count":127},"Studenac":{"count":76},"Central Convenience Store":{"count":55},"ÐонеÑка":{"count":62},"пÑодÑкÑÑ":{"count":114},"ТеÑемок":{"count":56},"Kwik Trip":{"count":69},"ÐÑлинаÑиÑ":{"count":55},"å
¨å®¶":{"count":90},"ÐеÑÑа":{"count":54},"Epicerie":{"count":102},"ÐиÑовÑкий":{"count":67},"Food Mart":{"count":117},"Delikatesy":{"count":81},"ããã©":{"count":54},"Lewiatan":{"count":135},"ÐÑодÑкÑовÑй магазин":{"count":149},"ÐÑодÑкÑовÑй":{"count":84},"ã»ã¤ã³ã¼ãã¼ã (Seicomart)":{"count":72},"ÐикÑоÑиÑ":{"count":70},"ÐеÑна":{"count":57},"Mini Market Non-Stop":{"count":60},"QuikTrip":{"count":75},"ÐопееÑка":{"count":51},"Royal Farms":{"count":51},"Alfamart":{"count":103},"Indomaret":{"count":141},"магазин":{"count":171},"å
¨å®¶ä¾¿å©ååº":{"count":156},"Boutique":{"count":59},"ááá ááá¢á (Market)":{"count":144},"Stores":{"count":61}},"chemist":{"dm":{"count":939},"Müller":{"count":212},"Schlecker":{"count":187},"Etos":{"count":467},"Bipa":{"count":289},"Rossmann":{"count":1669},"DM Drogeriemarkt":{"count":55},"Ihr Platz":{"count":73},"Douglas":{"count":62},"Kruidvat":{"count":123}},"car_repair":{"Peugeot":{"count":83},"Kwik Fit":{"count":128},"ATU":{"count":261},"Midas":{"count":202},"Feu Vert":{"count":113},"Norauto":{"count":152},"Speedy":{"count":115},"ÐвÑозапÑаÑÑи":{"count":212},"Renault":{"count":171},"Pit Stop":{"count":58},"Jiffy Lube":{"count":198},"ШиномонÑаж":{"count":1157},"СТÐ":{"count":395},"O'Reilly Auto Parts":{"count":81},"Carglass":{"count":112},"ÑиномонÑаж":{"count":62},"Citroen":{"count":51},"Euromaster":{"count":87},"Firestone":{"count":88},"ÐвÑоÑеÑвиÑ":{"count":361},"Advance Auto Parts":{"count":52},"Roady":{"count":56}},"furniture":{"IKEA":{"count":169},"Jysk":{"count":109},"Roller":{"count":78},"Dänisches Bettenlager":{"count":309},"Conforama":{"count":99},"Matratzen Concord":{"count":52},"ÐебелÑ":{"count":210},"But":{"count":63}},"doityourself":{"Hornbach":{"count":123},"B&Q":{"count":225},"Hubo":{"count":77},"Mr Bricolage":{"count":88},"Gamma":{"count":111},"OBI":{"count":422},"Lowes":{"count":1152},"Wickes":{"count":123},"Hagebau":{"count":59},"Max Bahr":{"count":79},"Castorama":{"count":153},"Rona":{"count":61},"Home Depot":{"count":865},"Toom Baumarkt":{"count":71},"Homebase":{"count":225},"Baumax":{"count":95},"Lagerhaus":{"count":79},"Bauhaus":{"count":186},"Canadian Tire":{"count":97},"Leroy Merlin":{"count":209},"Hellweg":{"count":58},"Brico":{"count":98},"Bricomarché":{"count":235},"Toom":{"count":67},"Hagebaumarkt":{"count":107},"Praktiker":{"count":122},"Menards":{"count":70},"Weldom":{"count":73},"Bunnings Warehouse":{"count":91},"Ace Hardware":{"count":147},"Home Hardware":{"count":72},"ХозÑоваÑÑ":{"count":86},"СÑÑоймаÑеÑиалÑ":{"count":197},"Bricorama":{"count":60},"Point P":{"count":59}},"stationery":{"Staples":{"count":299},"McPaper":{"count":83},"Office Depot":{"count":98},"ÐанÑÑоваÑÑ":{"count":63}},"car":{"Skoda":{"count":97},"BMW":{"count":149},"Citroen":{"count":277},"Renault":{"count":382},"Mercedes-Benz":{"count":235},"Volvo":{"count":96},"Ford":{"count":239},"Volkswagen":{"count":217},"Mazda":{"count":105},"Mitsubishi":{"count":73},"Fiat":{"count":93},"ÐвÑозапÑаÑÑи":{"count":277},"Opel":{"count":165},"Audi":{"count":121},"Toyota":{"count":271},"Nissan":{"count":189},"Suzuki":{"count":75},"Honda":{"count":157},"Peugeot":{"count":308},"ШиномонÑаж":{"count":259},"Hyundai":{"count":166},"Subaru":{"count":58},"Chevrolet":{"count":86},"ÐвÑомагазин":{"count":72}},"clothes":{"Matalan":{"count":90},"KiK":{"count":1219},"H&M":{"count":658},"Urban Outfitters":{"count":63},"Vögele":{"count":132},"Zeeman":{"count":121},"Takko":{"count":515},"Adler":{"count":55},"C&A":{"count":506},"Zara":{"count":217},"Vero Moda":{"count":95},"NKD":{"count":486},"Ernsting's family":{"count":312},"Winners":{"count":65},"River Island":{"count":59},"Next":{"count":176},"Gap":{"count":81},"Adidas":{"count":92},"Woolworths":{"count":117},"Mr Price":{"count":88},"Jet":{"count":61},"Pep":{"count":134},"Edgars":{"count":110},"Ackermans":{"count":91},"Truworths":{"count":65},"Ross":{"count":93},"Burton":{"count":51},"Dorothy Perkins":{"count":53},"Deichmann":{"count":61},"Lindex":{"count":73},"s.Oliver":{"count":56},"Cecil":{"count":51},"Dress Barn":{"count":52},"Old Navy":{"count":174},"Jack & Jones":{"count":52},"Pimkie":{"count":73},"Esprit":{"count":231},"Primark":{"count":92},"Bonita":{"count":155},"Mexx":{"count":67},"Gerry Weber":{"count":71},"Tally Weijl":{"count":70},"Mango":{"count":133},"TK Maxx":{"count":84},"Benetton":{"count":101},"Ulla Popken":{"count":61},"AWG":{"count":66},"Tommy Hilfiger":{"count":75},"New Yorker":{"count":180},"Orsay":{"count":73},"Jeans Fritz":{"count":51},"Charles Vögele":{"count":69},"New Look":{"count":126},"Lacoste":{"count":78},"Etam":{"count":53},"Kiabi":{"count":148},"Jack Wolfskin":{"count":60},"American Apparel":{"count":57},"Men's Wearhouse":{"count":54},"Intimissimi":{"count":52},"United Colors of Benetton":{"count":96},"Jules":{"count":63},"Second Hand":{"count":53},"AOKI":{"count":57},"Calzedonia":{"count":68},"æ´æã®éå±±":{"count":100},"Levi's":{"count":63},"Celio":{"count":74},"TJ Maxx":{"count":57},"Promod":{"count":82},"Street One":{"count":72},"ã¦ãã¯ã":{"count":59},"Banana Republic":{"count":57},"Ðдежда":{"count":75},"Marshalls":{"count":56},"La Halle":{"count":62},"Peacocks":{"count":89},"ãã¾ãã":{"count":60}},"books":{"Bruna":{"count":58},"Waterstones":{"count":90},"Libro":{"count":57},"Barnes & Noble":{"count":267},"Weltbild":{"count":74},"Thalia":{"count":121},"Ðниги":{"count":112}},"department_store":{"Debenhams":{"count":67},"Canadian Tire":{"count":75},"Karstadt":{"count":64},"Walmart":{"count":517},"Kmart":{"count":143},"Target":{"count":574},"Galeria Kaufhof":{"count":61},"Marks & Spencer":{"count":66},"Big W":{"count":57},"Woolworth":{"count":78},"УнивеÑмаг":{"count":72},"Sears":{"count":235},"Walmart Supercenter":{"count":101},"Kohl's":{"count":153},"Macy's":{"count":147},"Sam's Club":{"count":54},"JCPenney":{"count":66}},"alcohol":{"Alko":{"count":145},"The Beer Store":{"count":150},"Systembolaget":{"count":210},"LCBO":{"count":239},"ÐÑомаÑнÑй миÑ":{"count":62},"Bargain Booze":{"count":62},"Nicolas":{"count":119},"BWS":{"count":70},"Botilleria":{"count":77},"SAQ":{"count":72},"Gall & Gall":{"count":512},"Ðивое пиво":{"count":70}},"bakery":{"Kamps":{"count":252},"Banette":{"count":52},"Bäckerei Schmidt":{"count":57},"Anker":{"count":73},"Hofpfisterei":{"count":111},"Greggs":{"count":276},"Oebel":{"count":57},"Boulangerie":{"count":266},"Stadtbäckerei":{"count":57},"Steinecke":{"count":145},"Ihle":{"count":76},"Goldilocks":{"count":59},"Dat Backhus":{"count":67},"K&U":{"count":61},"Der Beck":{"count":96},"Thürmann":{"count":54},"Backwerk":{"count":95},"Schäfer's":{"count":51},"Panaderia":{"count":168},"Goeken backen":{"count":51},"Stadtbäckerei Junge":{"count":51},"Boulangerie Patisserie":{"count":119},"Paul":{"count":81},"Хлеб":{"count":89},"ÐекаÑнÑ":{"count":52},"ÐÑлиниÑи":{"count":51}},"sports":{"Sports Direct":{"count":57},"Decathlon":{"count":309},"Intersport":{"count":283},"Sports Authority":{"count":75},"СпоÑÑмаÑÑеÑ":{"count":87},"Sport 2000":{"count":90},"Dick's Sporting Goods":{"count":77}},"variety_store":{"Tedi":{"count":157},"Dollarama":{"count":103},"Family Dollar":{"count":61},"Dollar Tree":{"count":110},"Dollar General":{"count":80}},"pet":{"Fressnapf":{"count":318},"PetSmart":{"count":177},"Das Futterhaus":{"count":69},"Pets at Home":{"count":62},"Petco":{"count":101},"Ðоомагазин":{"count":100}},"shoes":{"Deichmann":{"count":622},"Reno":{"count":183},"Ecco":{"count":55},"Clarks":{"count":109},"La Halle aux Chaussures":{"count":69},"Brantano":{"count":71},"Geox":{"count":51},"Salamander":{"count":51},"ÐбÑвÑ":{"count":100},"Payless Shoe Source":{"count":67},"Famous Footwear":{"count":59},"Quick Schuh":{"count":72},"Shoe Zone":{"count":55},"Foot Locker":{"count":82},"Bata":{"count":101},"ЦенÑÑÐбÑвÑ":{"count":51}},"toys":{"La Grande Récré":{"count":56},"Toys R Us":{"count":151,"tags":{"shop":"toys"}},"Intertoys":{"count":57},"ÐеÑÑкий миÑ":{"count":86},"ÐгÑÑÑки":{"count":58}},"travel_agency":{"Flight Centre":{"count":92},"Thomas Cook":{"count":119}},"jewelry":{"Bijou Brigitte":{"count":57},"Christ":{"count":57},"Swarovski":{"count":74}},"optician":{"Fielmann":{"count":232},"Apollo Optik":{"count":150},"Vision Express":{"count":58},"ÐпÑика":{"count":182},"Optic 2000":{"count":98},"Alain Afflelou":{"count":73},"Specsavers":{"count":124},"Krys":{"count":77},"Atol":{"count":55}},"video":{"Blockbuster":{"count":184},"World of Video":{"count":64}},"mobile_phone":{"Ðилайн":{"count":128},"ã½ãããã³ã¯ã·ã§ãã (SoftBank shop)":{"count":255},"Vodafone":{"count":355},"O2":{"count":208},"Carphone Warehouse":{"count":127},"Orange":{"count":246},"Verizon Wireless":{"count":125},"Sprint":{"count":109},"T-Mobile":{"count":175},"ÐТС":{"count":352},"ÐвÑоÑеÑÑ":{"count":506},"Bell":{"count":190},"The Phone House":{"count":83},"SFR":{"count":71},"СвÑзной":{"count":439},"ÐегаÑон":{"count":251},"AT&T":{"count":124},"ãã³ã¢ã·ã§ãã (docomo shop)":{"count":114},"au":{"count":65},"Movistar":{"count":77},"BitÄ":{"count":72}},"hifi":{},"computer":{"PC World":{"count":55},"DNS":{"count":128}},"hairdresser":{"Klier":{"count":119},"Supercuts":{"count":106},"Hairkiller":{"count":51},"Great Clips":{"count":182},"ÐаÑикмаÑ
еÑÑкаÑ":{"count":510},"СÑилÑ":{"count":51},"Franck Provost":{"count":70},"Салон кÑаÑоÑÑ":{"count":70}},"hardware":{"1000 мелоÑей":{"count":61},"ХозÑоваÑÑ":{"count":151},"СÑÑоймаÑеÑиалÑ":{"count":54}},"motorcycle":{"Yamaha":{"count":67},"Honda":{"count":69}}}},"addressFormats":[{"format":[["housenumber","street"],["city","postcode"]]},{"countryCodes":["gb"],"format":[["housename"],["housenumber","street"],["city","postcode"]]},{"countryCodes":["ie"],"format":[["housename"],["housenumber","street"],["city"],["postcode"]]},{"countryCodes":["ad","at","ba","be","ch","cz","de","dk","es","fi","gr","hr","is","it","li","nl","no","pl","pt","se","si","sk","sm","va"],"format":[["street","housenumber"],["postcode","city"]]},{"countryCodes":["fr","lu","mo"],"format":[["housenumber","street"],["postcode","city"]]},{"countryCodes":["br"],"format":[["street"],["housenumber","suburb"],["city","postcode"]]},{"countryCodes":["vn"],"format":[["housenumber","street"],["subdistrict"],["district"],["city"],["province","postcode"]]},{"countryCodes":["us"],"format":[["housenumber","street"],["city","state","postcode"]]},{"countryCodes":["ca"],"format":[["housenumber","street"],["city","province","postcode"]]}],"phoneFormats":{"us":"+1-202-555-1234","ca":"+1-226-555-1234","bs":"+1-242-555-1234","bb":"+1-246-555-1234","ai":"+1-264-555-1234","ag":"+1-268-555-1234","vg":"+1-284-555-1234","vi":"+1-340-555-1234","ky":"+1-345-555-1234","bm":"+1-441-555-1234","gd":"+1-473-555-1234","tc":"+1-649-555-1234","ms":"+1-664-555-1234","mp":"+1-670-555-1234","gu":"+1-671-555-1234","as":"+1-684-555-1234","sx":"+1-721-555-1234","lc":"+1-758-555-1234","dm":"+1-767-555-1234","vc":"+1-784-555-1234","pr":"+1-787-555-1234","do":"+1-809-555-1234","tt":"+1-868-555-1234","kn":"+1-869-555-1234","jm":"+1-876-555-1234","za":"+27 11 907 1111","nl":"+31 42 123 4567","fr":"+33 1 23 45 67 89","es":"+34 989 12 34 56","pt":"+351 211 123456","fi":"+358 40 123 4567","hu":"+36 1 123 45 67","hr":"+385 01 123 4567","si":"+386 31 123 4567","it":"+39 01 123 456","va":"+39 01 123 456","gb":"+44 207 123456","gg":"+44 207 123456","im":"+44 207 123456","je":"+44 207 123456","se":"+46 31 123 4567","no":"+47 22 12 34 56","sj":"+47 22 12 34 56","pl":"+48 42 123 4567","de":"+49 89 1234567","br":"+55 11 0982 1098","ru":"+7 495 1234567","kz":"+7 495 1234567","vn":"+84 1 234 5678","hk":"+852 12345678"},"driveLeft":{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-75.38818,18.62542],[-80.09033,20.32402],[-82.24365,19.26967],[-77.36572,16.42555],[-75.38818,18.62542]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-64.33594,32.86113],[-79.39819,27.21067],[-80.63965,23.71998],[-73.39966,20.40642],[-65.1709,19.20743],[-65.09399,16.23577],[-59.13391,16.80454],[-62.64404,15.16228],[-59.43054,14.85985],[-62.83081,13.64599],[-61.80359,10.73752],[-62.08649,10.04729],[-61.06201,9.85522],[-59.81369,8.31274],[-59.8027,8.27469],[-59.83498,8.22712],[-59.94141,8.21149],[-59.99771,8.15576],[-59.97986,8.13265],[-59.99771,8.12041],[-60.00183,8.07147],[-60.05127,8.02524],[-60.09933,8.03747],[-60.12268,8.02388],[-60.14053,7.98988],[-60.36163,7.83345],[-60.53467,7.81713],[-60.5896,7.6375],[-60.72144,7.54493],[-60.5896,7.31888],[-60.63904,7.24532],[-60.54703,7.12542],[-60.46875,7.20309],[-60.37262,7.18401],[-60.29984,7.1445],[-60.2916,7.06819],[-60.39871,6.95097],[-60.66513,6.83235],[-60.71869,6.75053],[-60.91232,6.81735],[-60.94254,6.72053],[-61.14441,6.72326],[-61.23093,6.5773],[-61.1554,6.45314],[-61.14441,6.20199],[-61.39709,5.95619],[-60.71045,5.20036],[-60.21606,5.23319],[-59.99634,5.06906],[-60.13916,4.51071],[-59.69971,4.40118],[-59.5459,3.93002],[-59.87549,3.56825],[-59.7876,3.37086],[-60.01831,2.83332],[-59.90845,2.38335],[-59.69971,2.2626],[-59.77661,1.87833],[-59.65302,1.85087],[-59.69147,1.75754],[-59.61456,1.71361],[-59.55139,1.73283],[-59.36188,1.49123],[-59.26575,1.39238],[-58.92242,1.30726],[-58.83728,1.17271],[-58.71918,1.23037],[-58.71094,1.29902],[-58.49121,1.26058],[-58.461,1.37591],[-58.50494,1.38689],[-58.51044,1.46102],[-58.38135,1.4775],[-58.32642,1.57359],[-58.00507,1.49946],[-57.99133,1.65321],[-57.79907,1.69165],[-57.70844,1.71087],[-57.54364,1.68341],[-57.41455,1.94421],[-57.10693,1.97715],[-56.8103,1.85636],[-56.48071,1.92225],[-55.90942,1.81244],[-55.90942,2.04302],[-56.14014,2.26534],[-55.94788,2.53701],[-55.70892,2.39981],[-55.37933,2.43274],[-55.19257,2.53976],[-54.98108,2.57268],[-54.88495,2.43548],[-54.71191,2.46293],[-54.69543,2.34767],[-54.58832,2.32846],[-54.43451,2.43548],[-54.20654,2.76748],[-54.17358,3.12955],[-53.96484,3.57921],[-54.33838,4.00674],[-54.44412,4.52577],[-54.46884,4.91036],[-54.36653,5.13061],[-54.27727,5.26191],[-54.19968,5.3084],[-54.01222,5.54457],[-54.0239,5.64605],[-53.86322,5.94936],[-64.33594,32.86113]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-14.5459,-5.92204],[11.79657,-17.27197],[12.03415,-17.14866],[12.38159,-17.22213],[12.58484,-17.22476],[13.01193,-16.97405],[13.24951,-17.00098],[13.38135,-16.98522],[13.93341,-17.38734],[18.42476,-17.38996],[18.47763,-17.46857],[18.62663,-17.64599],[18.79211,-17.76177],[18.92944,-17.82061],[19.33044,-17.84806],[19.66278,-17.8644],[19.74792,-17.90557],[19.85161,-17.87486],[20.10361,-17.90296],[20.18394,-17.88401],[20.34737,-17.88466],[20.44693,-17.91733],[20.51697,-17.96698],[20.83008,-18.03032],[20.95711,-17.97285],[21.16997,-17.93497],[21.42677,-18.0264],[23.45032,-17.63879],[22.00012,-16.38866],[21.99944,-13.00523],[24.03809,-12.99118],[24.03809,-10.91962],[24.43359,-11.09217],[24.45557,-11.48002],[25.37842,-11.19996],[25.42236,-11.60919],[26.96045,-11.97484],[27.18018,-11.60919],[28.125,-12.42048],[29.11377,-13.36824],[29.1687,-13.43771],[29.55872,-13.19716],[29.68506,-13.2239],[29.62463,-13.41099],[29.80591,-13.44305],[29.81415,-12.14809],[29.31152,-12.55456],[28.41064,-11.78133],[28.63037,-10.70379],[28.65234,-9.73071],[28.37219,-9.24309],[28.89748,-8.47916],[30.78644,-8.26857],[29.39941,-6.05316],[29.4873,-4.45595],[29.75922,-4.46759],[29.81415,-4.36421],[29.88007,-4.36832],[30.04074,-4.26699],[30.07919,-4.1629],[30.18356,-4.08311],[30.1918,-4.05126],[30.21566,-4.04595],[30.22923,-4.01136],[30.21326,-3.99612],[30.25978,-3.88755],[30.29274,-3.86288],[30.34424,-3.77245],[30.39848,-3.79095],[30.40878,-3.76765],[30.39548,-3.7304],[30.39054,-3.72821],[30.3896,-3.71918],[30.39093,-3.7101],[30.39514,-3.70444],[30.42028,-3.64963],[30.46886,-3.53501],[30.67108,-3.41335],[30.63297,-3.34892],[30.84206,-3.25535],[30.84549,-3.16108],[30.83485,-3.09698],[30.7933,-3.06235],[30.82111,-3.02258],[30.84515,-2.9739],[30.74764,-2.99618],[30.7037,-2.97013],[30.66422,-2.98967],[30.57632,-2.90738],[30.49393,-2.94441],[30.41016,-2.87172],[30.52002,-2.39432],[30.77545,-2.38883],[30.8606,-2.31199],[30.84961,-2.19398],[30.89081,-2.07322],[30.81116,-1.96068],[30.83862,-1.6587],[30.73425,-1.4418],[30.56259,-1.33884],[30.4541,-1.05737],[30.35797,-1.06287],[30.34149,-1.13152],[30.16571,-1.34296],[29.91852,-1.48024],[29.83887,-1.31824],[29.58344,-1.39238],[29.729,0.05493],[29.96796,0.5136],[29.9707,0.8569],[30.22339,0.92281],[30.24536,1.15349],[30.47745,1.20772],[31.30966,2.15693],[31.20255,2.22211],[31.20255,2.29278],[31.16409,2.27906],[31.13937,2.28318],[31.13113,2.26534],[31.07826,2.30033],[31.0714,2.34767],[31.00479,2.4005],[30.97183,2.40461],[30.94711,2.38746],[30.94849,2.36276],[30.9375,2.33532],[30.88531,2.34012],[30.83038,2.42176],[30.74112,2.43274],[30.76035,2.5864],[30.90179,2.88132],[30.76447,3.04178],[30.93613,3.40239],[30.94059,3.50588],[30.85236,3.48601],[30.90866,3.5936],[30.95055,3.63918],[30.94677,3.65391],[30.9866,3.70187],[31.00582,3.70701],[31.02058,3.69708],[31.16547,3.7954],[31.28838,3.79643],[31.52699,3.66282],[31.7038,3.72449],[31.82671,3.82794],[31.96198,3.65596],[31.95854,3.57099],[32.04987,3.59155],[32.07733,3.57099],[32.0842,3.53672],[32.20093,3.50657],[32.21672,3.56448],[32.19578,3.59977],[32.41516,3.74504],[32.72055,3.76782],[32.89307,3.81219],[33.02782,3.89371],[33.18146,3.7793],[33.51173,3.75258],[33.98758,4.23309],[34.05762,4.28342],[34.38721,4.61065],[35.94452,4.62023],[35.95688,4.53467],[36.04134,4.44568],[36.89621,4.4491],[38.14728,3.62992],[38.55927,3.62033],[38.92181,3.51068],[39.56039,3.43392],[39.87076,3.87522],[40.76752,4.28753],[41.16371,3.94372],[41.89774,3.97797],[41.31271,3.14463],[40.98896,2.82869],[40.99548,-0.84042],[41.72607,-1.81244],[41.57227,-48.80686],[-27.11426,-60.23981],[-65.78613,-52.5897],[-14.5459,-5.92204]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[31.33301,35.47856],[33.0249,33.75175],[35.44189,36.02245],[31.33301,35.47856]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[13.86475,36.46105],[15.271,35.8935],[14.17786,35.40248],[13.86475,36.46105]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[0.13184,61.89758],[2.41699,51.26191],[-2.03247,49.91763],[-1.90338,48.93333],[-20.12695,53.33087],[0.13184,61.89758]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[180,-35.35322],[161.41113,-19.68397],[167.00317,-12.26486],[180,-21.7697],[180,4.62023],[170.85938,3.77656],[127.08435,5.74171],[118.21289,2.76748],[119.52026,5.30977],[117.26807,7.51498],[102.6123,8.47781],[102.9158,11.74099],[102.76268,12.07357],[102.70226,12.17158],[102.74139,12.46474],[102.53128,12.68857],[102.49557,12.9256],[102.49763,13.0064],[102.4597,13.08199],[102.43412,13.09026],[102.39155,13.16407],[102.35481,13.29341],[102.35893,13.30945],[102.34503,13.34837],[102.35928,13.39797],[102.3567,13.48095],[102.36168,13.50582],[102.33559,13.53787],[102.33971,13.56023],[102.35498,13.5649],[102.36511,13.5785],[102.40047,13.5679],[102.42537,13.56891],[102.44614,13.56123],[102.48047,13.57091],[102.53849,13.56757],[102.5699,13.58526],[102.57806,13.60486],[102.62501,13.60845],[102.62132,13.61295],[102.60767,13.61562],[102.57231,13.63331],[102.56922,13.64082],[102.54879,13.658],[102.56252,13.68552],[102.5972,13.70803],[102.67084,13.74472],[102.68818,13.75172],[102.7014,13.7684],[102.73161,13.77082],[102.76543,13.85541],[102.78397,13.93207],[102.80388,13.94406],[102.81607,13.96639],[102.90705,14.02119],[102.89726,14.0535],[102.90095,14.0838],[102.92421,14.10744],[102.92378,14.12838],[102.94147,14.15035],[102.92953,14.17952],[103.17535,14.33774],[103.19939,14.32992],[103.68553,14.44],[103.94508,14.34157],[104.05756,14.34589],[104.06636,14.3419],[104.26025,14.37749],[104.50058,14.36984],[104.57817,14.36019],[104.6422,14.42387],[104.66632,14.40234],[104.68357,14.39877],[104.71138,14.43169],[104.72305,14.42188],[104.71687,14.40043],[104.75344,14.40459],[104.80408,14.43867],[104.83429,14.41573],[104.99239,14.3838],[105.05402,14.19783],[105.47905,14.49186],[105.60883,15.0005],[105.46703,15.13005],[105.48866,15.20237],[105.59269,15.2716],[105.58617,15.32823],[105.50308,15.31912],[105.46703,15.33948],[105.49175,15.37921],[105.59372,15.42869],[105.59372,15.50927],[105.60986,15.54871],[105.62616,15.56492],[105.62702,15.59129],[105.63518,15.62742],[105.63612,15.66056],[105.5975,15.72088],[105.49965,15.76681],[105.46291,15.74517],[105.43819,15.75459],[105.40489,15.79424],[105.34241,15.92039],[105.37811,15.98344],[105.39167,15.99136],[105.41931,15.98608],[105.42652,15.99764],[105.41468,16.01661],[105.21263,16.05076],[105.04955,16.10552],[105.01316,16.24401],[104.88235,16.37812],[104.8391,16.45782],[104.77936,16.49041],[104.73919,16.53287],[104.74228,16.62205],[104.76391,16.70953],[104.73953,16.80323],[104.76425,16.85088],[104.73782,16.90968],[104.744,17.0128],[104.81266,17.21853],[104.79841,17.39274],[104.70348,17.52833],[104.46384,17.65515],[104.34368,17.83564],[104.27776,17.8559],[104.22661,17.98069],[104.1116,18.10735],[104.06525,18.21174],[103.97392,18.33823],[103.9286,18.33237],[103.88809,18.29456],[103.85582,18.28673],[103.83659,18.32715],[103.79128,18.3467],[103.70201,18.34214],[103.60931,18.40405],[103.57292,18.40437],[103.51593,18.42978],[103.45963,18.42587],[103.41568,18.44802],[103.30479,18.43206],[103.24265,18.37082],[103.24333,18.34133],[103.29123,18.32357],[103.28899,18.29521],[103.23595,18.28299],[103.16608,18.25511],[103.02429,17.98135],[102.6535,17.83237],[102.40631,17.99963],[102.10968,18.22413],[101.548,17.81538],[101.30493,17.64991],[101.14563,17.46595],[100.95886,17.61654],[101.01757,17.88858],[101.18752,18.05121],[101.16863,18.10409],[101.18134,18.33595],[101.08727,18.38287],[101.05499,18.43988],[101.23215,18.73015],[101.35265,19.04524],[101.25927,19.12733],[101.2373,19.32637],[101.25824,19.58438],[101.11954,19.56836],[101.08898,19.58777],[101.08624,19.59715],[101.03165,19.6185],[100.89844,19.62125],[100.77827,19.49249],[100.63751,19.56432],[100.58258,19.49313],[100.47478,19.5944],[100.42929,19.67152],[100.43341,19.7024],[100.4147,19.7255],[100.40525,19.7646],[100.43907,19.80345],[100.45555,19.84843],[100.50636,19.87264],[100.51709,19.93027],[100.58653,20.1599],[100.56576,20.1757],[100.54945,20.17473],[100.52731,20.14379],[100.51065,20.14895],[100.48697,20.17956],[100.46774,20.196],[100.45246,20.20147],[100.45521,20.22129],[100.44783,20.23546],[100.41607,20.25286],[100.40594,20.28184],[100.38397,20.31082],[100.37556,20.35187],[100.36165,20.35638],[100.35736,20.37408],[100.33195,20.39902],[100.27805,20.40224],[100.25917,20.39677],[100.2475,20.37263],[100.22535,20.35509],[100.22346,20.31839],[100.16579,20.29988],[100.17162,20.24545],[100.10845,20.25221],[100.09266,20.2696],[100.09798,20.31485],[100.07961,20.3678],[99.9567,20.46417],[99.91636,20.44925],[99.90765,20.44977],[99.89121,20.44511],[99.87276,20.44406],[99.86212,20.44326],[99.80186,20.33948],[99.46472,20.3884],[99.56085,20.20035],[99.43691,20.08882],[99.27727,20.11623],[99.06921,20.1101],[98.97789,19.74538],[98.24387,19.68656],[97.85934,19.57014],[97.76733,18.57336],[97.39655,18.47179],[97.62451,18.30238],[97.73849,17.97743],[97.66502,17.87943],[97.90947,17.56745],[98.52951,16.82557],[98.51303,16.69276],[98.69293,16.26873],[98.87421,16.43609],[98.93394,16.3353],[98.84743,16.13356],[98.74512,16.12037],[98.58307,16.07287],[98.5762,15.79754],[98.54736,15.37557],[98.17383,15.15167],[98.3606,14.63674],[99.08295,13.89208],[99.16534,13.72204],[99.18182,13.00723],[99.39331,12.56797],[99.64153,11.78973],[99.32156,11.30266],[98.77859,10.67849],[98.80597,10.47642],[98.76657,10.40459],[98.74924,10.34194],[96.85547,6.40265],[92.42523,20.54794],[92.2728,20.96272],[92.18353,21.16072],[92.21718,21.23434],[92.19727,21.32968],[92.26318,21.36485],[92.27142,21.43326],[92.32635,21.41919],[92.34695,21.47032],[92.37717,21.48246],[92.42592,21.43453],[92.43073,21.3706],[92.50763,21.35654],[92.51793,21.38979],[92.55913,21.37892],[92.60376,21.24074],[92.68135,21.29129],[92.62642,21.43262],[92.60925,21.99908],[93.21899,22.2586],[93.1366,23.05446],[93.34534,23.05952],[93.43323,23.68729],[93.33572,24.07154],[93.4964,23.94359],[93.62549,24.00758],[94.15524,23.84675],[94.17068,23.92821],[94.25171,24.07405],[94.27952,24.17307],[94.28844,24.23037],[94.30175,24.2371],[94.32561,24.2731],[94.32587,24.32457],[94.58199,24.72282],[94.73648,25.13783],[94.78455,25.47799],[94.88823,25.58054],[95.14709,26.07035],[95.1004,26.51482],[96.3446,27.28393],[97.36359,27.91919],[96.14136,29.38218],[95.41626,29.08498],[94.79004,29.20971],[92.40051,27.81964],[91.6452,27.76376],[91.40625,28.0138],[89.57977,28.18824],[88.90961,27.3242],[88.77228,27.54602],[88.90961,27.884],[88.70361,28.1059],[88.12134,27.87793],[85.92957,27.94103],[81.62292,30.44157],[81.19995,30.03343],[78.75,31.50363],[78.77197,31.96148],[78.39844,32.50513],[78.95325,32.37068],[79.3158,32.49586],[79.16199,33.0363],[79.01367,34.33436],[78.26111,34.6558],[78.01392,35.46067],[76.16821,35.79108],[76.00342,36.5626],[75.16846,37.01133],[74.53674,36.99817],[72.52075,36.84006],[71.19141,36.08906],[71.65283,35.44725],[71.50452,34.9805],[70.98541,34.54955],[71.17905,34.36271],[71.09253,34.11522],[70.8783,33.97298],[70.51849,33.94336],[69.90807,34.04697],[69.86893,33.96614],[69.97055,33.75746],[70.13123,33.72662],[70.33997,33.342],[70.02136,33.13985],[69.5723,33.09614],[69.23859,32.46227],[69.31274,31.9172],[68.11798,31.75153],[66.39313,30.93875],[66.26404,29.80252],[62.49023,29.41089],[60.87524,29.86447],[61.5303,29.01174],[61.65802,28.77609],[61.96632,28.5405],[62.43256,28.42341],[62.6049,28.2548],[62.7951,28.28141],[62.86789,27.23448],[63.25996,27.2473],[63.32726,27.1334],[63.25241,27.09092],[63.25241,26.83755],[63.18787,26.83816],[63.18993,26.65237],[62.30896,26.51974],[62.21558,26.27371],[61.85303,26.22937],[61.83105,25.75042],[61.68274,25.67124],[56.55762,-21.18697],[180,-65],[180,-35.35322]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[138.75732,46.69467],[145.5249,44.48475],[145.27771,43.68376],[145.86548,43.39307],[142.84424,18.22935],[122.09106,24.37712],[138.75732,46.69467]]]}},{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-180,7],[-148,7],[-151,-12],[-171.5,-10.75],[-171,-16],[-152,-19],[-180,-55],[-180,7]]]}}]}};
\ No newline at end of file
+ // modules/id.js
+ window.requestIdleCallback = window.requestIdleCallback || function(cb) {
+ var start2 = Date.now();
+ return window.requestAnimationFrame(function() {
+ cb({
+ didTimeout: false,
+ timeRemaining: function() {
+ return Math.max(0, 50 - (Date.now() - start2));
+ }
+ });
+ });
+ };
+ window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
+ window.cancelAnimationFrame(id2);
+ };
+ window.iD = modules_exports;
+})();
+//# sourceMappingURL=iD.js.map