Render directional points (e.g. benches, cameras, signs) as vertices

This commit is contained in:
Bryan Housel
2017-12-11 10:48:04 -05:00
parent b42c096fe5
commit 8e19474293
3 changed files with 13 additions and 8 deletions

View File

@@ -99,7 +99,7 @@ _extend(osmNode.prototype, {
var lookForward =
(this.tags['traffic_sign:forward'] || val === 'forward' || val === 'both' || val === 'all');
if (!lookForward && !lookBackward) return null;
if (!lookForward && !lookBackward) return [];
var nodeIds = {};
resolver.parentWays(this).forEach(function(parent) {

View File

@@ -22,7 +22,7 @@ export function svgPoints(projection, context) {
return function drawPoints(selection, graph, entities, filter) {
var wireframe = context.surface().classed('fill-wireframe'),
points = wireframe ? [] : _filter(entities, function(e) {
return e.geometry(graph) === 'point';
return e.geometry(graph) === 'point' && !e.directions(graph, projection).length;
});
points.sort(sortY);
@@ -41,20 +41,24 @@ export function svgPoints(projection, context) {
.attr('class', function(d) { return 'node point ' + d.id; })
.order();
enter.append('path')
enter
.append('path')
.call(markerPath, 'shadow');
enter.append('ellipse')
enter
.append('ellipse')
.attr('cx', 0.5)
.attr('cy', 1)
.attr('rx', 6.5)
.attr('ry', 3)
.attr('class', 'stroke');
enter.append('path')
enter
.append('path')
.call(markerPath, 'stroke');
enter.append('use')
enter
.append('use')
.attr('transform', 'translate(-5, -19)')
.attr('class', 'icon')
.attr('width', '11px')

View File

@@ -72,11 +72,12 @@ export function svgVertices(projection, context) {
}
// memoize directions results, return false for empty arrays (for use in filter)
function getDirections(entity) {
if (entity.id in directions) return directions[entity.id];
var angles = entity.directions(graph, projection);
if (angles) directions[entity.id] = angles;
directions[entity.id] = angles.length ? angles : false;
return angles;
}
@@ -211,7 +212,7 @@ export function svgVertices(projection, context) {
var entity = entities[i],
geometry = entity.geometry(graph);
if (wireframe && geometry === 'point') {
if ((geometry === 'point') && (wireframe || entity.directions(graph, projection).length)) {
vertices.push(entity);
continue;
}