mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-11 21:56:00 +00:00
removed formatting
This commit is contained in:
@@ -29,12 +29,12 @@ function abortRequest(controller) {
|
||||
|
||||
|
||||
function maxPageAtZoom(z) {
|
||||
if (z < 15) return 2;
|
||||
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;
|
||||
if (z > 18) return 80;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,15 +44,15 @@ function loadTiles(which, url, projection) {
|
||||
|
||||
// abort inflight requests that are no longer needed
|
||||
var cache = _oscCache[which];
|
||||
Object.keys(cache.inflight).forEach(function (k) {
|
||||
var wanted = tiles.find(function (tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
Object.keys(cache.inflight).forEach(function(k) {
|
||||
var wanted = tiles.find(function(tile) { return k.indexOf(tile.id + ',') === 0; });
|
||||
if (!wanted) {
|
||||
abortRequest(cache.inflight[k]);
|
||||
delete cache.inflight[k];
|
||||
}
|
||||
});
|
||||
|
||||
tiles.forEach(function (tile) {
|
||||
tiles.forEach(function(tile) {
|
||||
loadNextTilePage(which, currZoom, url, tile);
|
||||
});
|
||||
}
|
||||
@@ -87,14 +87,14 @@ function loadNextTilePage(which, currZoom, url, tile) {
|
||||
};
|
||||
|
||||
d3_json(url, options)
|
||||
.then(function (data) {
|
||||
.then(function(data) {
|
||||
cache.loaded[id] = true;
|
||||
delete cache.inflight[id];
|
||||
if (!data || !data.currentPageItems || !data.currentPageItems.length) {
|
||||
throw new Error('No Data');
|
||||
}
|
||||
|
||||
var features = data.currentPageItems.map(function (item) {
|
||||
var features = data.currentPageItems.map(function(item) {
|
||||
var loc = [+item.lng, +item.lat];
|
||||
var d;
|
||||
|
||||
@@ -138,7 +138,7 @@ function loadNextTilePage(which, currZoom, url, tile) {
|
||||
dispatch.call('loadedImages');
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
.catch(function() {
|
||||
cache.loaded[id] = true;
|
||||
delete cache.inflight[id];
|
||||
});
|
||||
@@ -152,7 +152,7 @@ function partitionViewport(projection) {
|
||||
var tiler = utilTiler().zoomExtent([z2, z2]);
|
||||
|
||||
return tiler.getTiles(projection)
|
||||
.map(function (tile) { return tile.extent; });
|
||||
.map(function(tile) { return tile.extent; });
|
||||
}
|
||||
|
||||
|
||||
@@ -161,10 +161,10 @@ function searchLimited(limit, projection, rtree) {
|
||||
limit = limit || 5;
|
||||
|
||||
return partitionViewport(projection)
|
||||
.reduce(function (result, extent) {
|
||||
.reduce(function(result, extent) {
|
||||
var found = rtree.search(extent.bbox())
|
||||
.slice(0, limit)
|
||||
.map(function (d) { return d.data; });
|
||||
.map(function(d) { return d.data; });
|
||||
|
||||
return (found.length ? result.concat(found) : result);
|
||||
}, []);
|
||||
@@ -173,7 +173,7 @@ function searchLimited(limit, projection, rtree) {
|
||||
|
||||
export default {
|
||||
|
||||
init: function () {
|
||||
init: function() {
|
||||
if (!_oscCache) {
|
||||
this.reset();
|
||||
}
|
||||
@@ -181,7 +181,7 @@ export default {
|
||||
this.event = utilRebind(this, dispatch, 'on');
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
reset: function() {
|
||||
if (_oscCache) {
|
||||
Object.values(_oscCache.images.inflight).forEach(abortRequest);
|
||||
}
|
||||
@@ -195,13 +195,13 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
images: function (projection) {
|
||||
images: function(projection) {
|
||||
var limit = 5;
|
||||
return searchLimited(limit, projection, _oscCache.images.rtree);
|
||||
},
|
||||
|
||||
|
||||
sequences: function (projection) {
|
||||
sequences: function(projection) {
|
||||
var viewport = projection.clipExtent();
|
||||
var min = [viewport[0][0], viewport[1][1]];
|
||||
var max = [viewport[1][0], viewport[0][1]];
|
||||
@@ -210,12 +210,12 @@ export default {
|
||||
|
||||
// all sequences for images in viewport
|
||||
_oscCache.images.rtree.search(bbox)
|
||||
.forEach(function (d) { sequenceKeys[d.data.sequence_id] = true; });
|
||||
.forEach(function(d) { sequenceKeys[d.data.sequence_id] = true; });
|
||||
|
||||
// make linestrings from those sequences
|
||||
var lineStrings = [];
|
||||
Object.keys(sequenceKeys)
|
||||
.forEach(function (sequenceKey) {
|
||||
.forEach(function(sequenceKey) {
|
||||
var seq = _oscCache.sequences[sequenceKey];
|
||||
var images = seq && seq.images;
|
||||
|
||||
@@ -224,8 +224,8 @@ export default {
|
||||
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,
|
||||
captured_at: images[0] ? images[0].captured_at: null,
|
||||
captured_by: images[0] ? images[0].captured_by: null,
|
||||
key: sequenceKey
|
||||
}
|
||||
});
|
||||
@@ -235,18 +235,18 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
cachedImage: function (imageKey) {
|
||||
cachedImage: function(imageKey) {
|
||||
return _oscCache.images.forImageKey[imageKey];
|
||||
},
|
||||
|
||||
|
||||
loadImages: function (projection) {
|
||||
loadImages: function(projection) {
|
||||
var url = apibase + '/1.0/list/nearby-photos/';
|
||||
loadTiles('images', url, projection);
|
||||
},
|
||||
|
||||
|
||||
ensureViewerLoaded: function (context) {
|
||||
ensureViewerLoaded: function(context) {
|
||||
|
||||
if (_loadViewerPromise) return _loadViewerPromise;
|
||||
|
||||
@@ -299,7 +299,7 @@ export default {
|
||||
|
||||
|
||||
// Register viewer resize handler
|
||||
context.ui().photoviewer.on('resize.openstreetcam', function (dimensions) {
|
||||
context.ui().photoviewer.on('resize.openstreetcam', function(dimensions) {
|
||||
imgZoom = d3_zoom()
|
||||
.extent([[0, 0], dimensions])
|
||||
.translateExtent([[0, 0], dimensions])
|
||||
@@ -316,7 +316,7 @@ export default {
|
||||
|
||||
|
||||
function rotate(deg) {
|
||||
return function () {
|
||||
return function() {
|
||||
if (!_oscSelectedImage) return;
|
||||
var sequenceKey = _oscSelectedImage.sequence_id;
|
||||
var sequence = _oscCache.sequences[sequenceKey];
|
||||
@@ -344,7 +344,7 @@ export default {
|
||||
}
|
||||
|
||||
function step(stepBy) {
|
||||
return function () {
|
||||
return function() {
|
||||
if (!_oscSelectedImage) return;
|
||||
var sequenceKey = _oscSelectedImage.sequence_id;
|
||||
var sequence = _oscCache.sequences[sequenceKey];
|
||||
@@ -368,7 +368,7 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
showViewer: function (context) {
|
||||
showViewer: function(context) {
|
||||
var viewer = context.container().select('.photoviewer')
|
||||
.classed('hide', false);
|
||||
|
||||
@@ -388,7 +388,7 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
hideViewer: function (context) {
|
||||
hideViewer: function(context) {
|
||||
_oscSelectedImage = null;
|
||||
|
||||
this.updateUrlImage(null);
|
||||
@@ -408,7 +408,7 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
selectImage: function (context, imageKey) {
|
||||
selectImage: function(context, imageKey) {
|
||||
|
||||
var d = this.cachedImage(imageKey);
|
||||
|
||||
@@ -494,12 +494,12 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
getSelectedImage: function () {
|
||||
getSelectedImage: function() {
|
||||
return _oscSelectedImage;
|
||||
},
|
||||
|
||||
|
||||
getSequenceKeyForImage: function (d) {
|
||||
getSequenceKeyForImage: function(d) {
|
||||
return d && d.sequence_id;
|
||||
},
|
||||
|
||||
@@ -507,7 +507,7 @@ export default {
|
||||
// Updates the currently highlighted sequence and selected bubble.
|
||||
// Reset is only necessary when interacting with the viewport because
|
||||
// this implicitly changes the currently selected bubble/sequence
|
||||
setStyles: function (context, hovered, reset) {
|
||||
setStyles: function(context, hovered, reset) {
|
||||
if (reset) { // reset all layers
|
||||
context.container().selectAll('.viewfield-group')
|
||||
.classed('highlighted', false)
|
||||
@@ -535,13 +535,13 @@ export default {
|
||||
var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
|
||||
|
||||
context.container().selectAll('.layer-openstreetcam .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; });
|
||||
.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-openstreetcam .sequence')
|
||||
.classed('highlighted', function (d) { return d.properties.key === hoveredSequenceKey; })
|
||||
.classed('currentView', function (d) { return d.properties.key === selectedSequenceKey; });
|
||||
.classed('highlighted', function(d) { return d.properties.key === hoveredSequenceKey; })
|
||||
.classed('currentView', function(d) { return d.properties.key === selectedSequenceKey; });
|
||||
|
||||
// update viewfields if needed
|
||||
context.container().selectAll('.layer-openstreetcam .viewfield-group .viewfield')
|
||||
@@ -560,7 +560,7 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
updateUrlImage: function (imageKey) {
|
||||
updateUrlImage: function(imageKey) {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
@@ -573,7 +573,7 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
cache: function () {
|
||||
cache: function() {
|
||||
return _oscCache;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@ import { actionChangeTags } from '../actions/change_tags';
|
||||
import { actionMergeNodes } from '../actions/merge_nodes';
|
||||
import { actionSplit } from '../actions/split';
|
||||
import { modeSelect } from '../modes/select';
|
||||
import {
|
||||
geoAngle, geoExtent, geoLatToMeters, geoLonToMeters, geoLineIntersection,
|
||||
geoSphericalClosestNode, geoSphericalDistance, geoVecAngle, geoVecLength, geoMetersToLat, geoMetersToLon
|
||||
} from '../geo';
|
||||
import { geoAngle, geoExtent, geoLatToMeters, geoLonToMeters, geoLineIntersection,
|
||||
geoSphericalClosestNode, geoSphericalDistance, geoVecAngle, geoVecLength, geoMetersToLat, geoMetersToLon } from '../geo';
|
||||
import { osmNode } from '../osm/node';
|
||||
import { osmFlowingWaterwayTagValues, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmRoutableHighwayTagValues } from '../osm/tags';
|
||||
import { t } from '../core/localizer';
|
||||
@@ -314,7 +312,7 @@ export function validationCrossingWays(context) {
|
||||
if (entity.type === 'way') {
|
||||
return [entity];
|
||||
} else if (entity.type === 'relation') {
|
||||
return entity.members.reduce(function (array, member) {
|
||||
return entity.members.reduce(function(array, member) {
|
||||
if (member.type === 'way' &&
|
||||
// only look at geometry ways
|
||||
(!member.role || member.role === 'outer' || member.role === 'inner')) {
|
||||
@@ -353,7 +351,7 @@ export function validationCrossingWays(context) {
|
||||
function createIssue(crossing, graph) {
|
||||
|
||||
// use the entities with the tags that define the feature type
|
||||
crossing.wayInfos.sort(function (way1Info, way2Info) {
|
||||
crossing.wayInfos.sort(function(way1Info, way2Info) {
|
||||
var type1 = way1Info.featureType;
|
||||
var type2 = way2Info.featureType;
|
||||
if (type1 === type2) {
|
||||
@@ -365,7 +363,7 @@ export function validationCrossingWays(context) {
|
||||
}
|
||||
return type1 < type2;
|
||||
});
|
||||
var entities = crossing.wayInfos.map(function (wayInfo) {
|
||||
var entities = crossing.wayInfos.map(function(wayInfo) {
|
||||
return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
|
||||
});
|
||||
var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
|
||||
@@ -378,9 +376,9 @@ export function validationCrossingWays(context) {
|
||||
|
||||
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');
|
||||
allowsTunnel(featureType2) && hasTag(entities[1].tags, 'tunnel');
|
||||
var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, 'bridge') &&
|
||||
allowsBridge(featureType2) && hasTag(entities[1].tags, 'bridge');
|
||||
allowsBridge(featureType2) && hasTag(entities[1].tags, 'bridge');
|
||||
|
||||
var subtype = [featureType1, featureType2].sort().join('-');
|
||||
|
||||
@@ -404,7 +402,7 @@ export function validationCrossingWays(context) {
|
||||
type: type,
|
||||
subtype: subtype,
|
||||
severity: 'warning',
|
||||
message: function (context) {
|
||||
message: function(context) {
|
||||
var graph = context.graph();
|
||||
var entity1 = graph.hasEntity(this.entityIds[0]),
|
||||
entity2 = graph.hasEntity(this.entityIds[1]);
|
||||
@@ -414,7 +412,7 @@ export function validationCrossingWays(context) {
|
||||
}) : '';
|
||||
},
|
||||
reference: showReference,
|
||||
entityIds: entities.map(function (entity) {
|
||||
entityIds: entities.map(function(entity) {
|
||||
return entity.id;
|
||||
}),
|
||||
data: {
|
||||
@@ -424,7 +422,7 @@ export function validationCrossingWays(context) {
|
||||
},
|
||||
hash: uniqueID,
|
||||
loc: crossing.crossPoint,
|
||||
dynamicFixes: function (context) {
|
||||
dynamicFixes: function(context) {
|
||||
var mode = context.mode();
|
||||
if (!mode || mode.id !== 'select' || mode.selectedIDs().length !== 1) return [];
|
||||
|
||||
@@ -446,12 +444,12 @@ export function validationCrossingWays(context) {
|
||||
} else if (isCrossingTunnels ||
|
||||
isCrossingBridges ||
|
||||
featureType1 === 'building' ||
|
||||
featureType2 === 'building') {
|
||||
featureType2 === 'building') {
|
||||
|
||||
fixes.push(makeChangeLayerFix('higher'));
|
||||
fixes.push(makeChangeLayerFix('lower'));
|
||||
|
||||
// can only add bridge/tunnel if both features are lines
|
||||
// can only add bridge/tunnel if both features are lines
|
||||
} else if (context.graph().geometry(this.entityIds[0]) === 'line' &&
|
||||
context.graph().geometry(this.entityIds[1]) === 'line') {
|
||||
|
||||
@@ -487,11 +485,11 @@ export function validationCrossingWays(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
|
||||
function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel){
|
||||
return new validationIssueFix({
|
||||
icon: iconName,
|
||||
title: t.html('issues.fix.' + fixTitleID + '.title'),
|
||||
onClick: function (context) {
|
||||
onClick: function(context) {
|
||||
var mode = context.mode();
|
||||
if (!mode || mode.id !== 'select') return;
|
||||
|
||||
@@ -583,10 +581,10 @@ export function validationCrossingWays(context) {
|
||||
]);
|
||||
}
|
||||
|
||||
var endpointLocGetter1 = function (lengthMeters) {
|
||||
var endpointLocGetter1 = function(lengthMeters) {
|
||||
return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
|
||||
};
|
||||
var endpointLocGetter2 = function (lengthMeters) {
|
||||
var endpointLocGetter2 = function(lengthMeters) {
|
||||
return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
|
||||
};
|
||||
|
||||
@@ -614,8 +612,8 @@ export function validationCrossingWays(context) {
|
||||
|
||||
} else {
|
||||
var edgeCount = 0;
|
||||
endNode.parentIntersectionWays(graph).forEach(function (way) {
|
||||
way.nodes.forEach(function (nodeID) {
|
||||
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())) {
|
||||
@@ -659,15 +657,15 @@ export function validationCrossingWays(context) {
|
||||
var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
|
||||
var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
|
||||
|
||||
var structureWay = resultWayIDs.map(function (id) {
|
||||
var structureWay = resultWayIDs.map(function(id) {
|
||||
return graph.entity(id);
|
||||
}).find(function (way) {
|
||||
}).find(function(way) {
|
||||
return way.nodes.indexOf(structEndNode1.id) !== -1 &&
|
||||
way.nodes.indexOf(structEndNode2.id) !== -1;
|
||||
});
|
||||
|
||||
var tags = Object.assign({}, structureWay.tags); // copy tags
|
||||
if (bridgeOrTunnel === 'bridge') {
|
||||
if (bridgeOrTunnel === 'bridge'){
|
||||
tags.bridge = 'yes';
|
||||
tags.layer = '1';
|
||||
} else {
|
||||
@@ -700,7 +698,7 @@ export function validationCrossingWays(context) {
|
||||
return new validationIssueFix({
|
||||
icon: 'iD-icon-crossing',
|
||||
title: t.html('issues.fix.' + fixTitleID + '.title'),
|
||||
onClick: function (context) {
|
||||
onClick: function(context) {
|
||||
var loc = this.issue.loc;
|
||||
var connectionTags = this.issue.data.connectionTags;
|
||||
var edges = this.issue.data.edges;
|
||||
@@ -714,16 +712,16 @@ export function validationCrossingWays(context) {
|
||||
var nodesToMerge = [node.id];
|
||||
var mergeThresholdInMeters = 0.75;
|
||||
|
||||
edges.forEach(function (edge) {
|
||||
edges.forEach(function(edge) {
|
||||
var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
|
||||
var nearby = geoSphericalClosestNode(edgeNodes, loc);
|
||||
// if there is already a suitable node nearby, use that
|
||||
// use the node if node has no interesting tags or if it is a crossing node #8326
|
||||
if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
|
||||
nodesToMerge.push(nearby.node.id);
|
||||
// else add the new node to the way
|
||||
// else add the new node to the way
|
||||
} else {
|
||||
graph = actionAddMidpoint({ loc: loc, edge: edge }, node)(graph);
|
||||
graph = actionAddMidpoint({loc: loc, edge: edge}, node)(graph);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -744,7 +742,7 @@ export function validationCrossingWays(context) {
|
||||
return new validationIssueFix({
|
||||
icon: 'iD-icon-' + (higherOrLower === 'higher' ? 'up' : 'down'),
|
||||
title: t.html('issues.fix.tag_this_as_' + higherOrLower + '.title'),
|
||||
onClick: function (context) {
|
||||
onClick: function(context) {
|
||||
|
||||
var mode = context.mode();
|
||||
if (!mode || mode.id !== 'select') return;
|
||||
@@ -753,7 +751,7 @@ export function validationCrossingWays(context) {
|
||||
if (selectedIDs.length !== 1) return;
|
||||
|
||||
var selectedID = selectedIDs[0];
|
||||
if (!this.issue.entityIds.some(function (entityId) {
|
||||
if (!this.issue.entityIds.some(function(entityId) {
|
||||
return entityId === selectedID;
|
||||
})) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user