Skip to content

Conversation

tyrasd
Copy link
Member

@tyrasd tyrasd commented Mar 7, 2025

This fixes the awkward overlaps of oneway arrows in dashed lines with inconsistent spacing, and hard to choose well contrasting colors for the arrows (see #9143). Now, for lines with dashed rendering style (e.g. railway lines, some footways/paths, runways) the oneway arrows are rendered in place of one of the line's dashes. This allows the oneway arrows to be rendered in the same color as the line itself, leading to a more elegant, less noisy rendering for these lines.

Below are rendering examples of various lines with different combinations of oneway tags (none, yes, -1, alternating), from left to right: regular roads, railways, railway bridges, pedestrian bridge, pedestrian road, runways, road under construction, footpaths/cycleway, steps and ladders, unmarked pedestrian/cycleway crossing.

after:
image

before:
image

(this PR replaces #10846)

@tyrasd tyrasd added the map-renderer An issue with how things are rendered in the map label Mar 7, 2025
@tyrasd tyrasd requested a review from k-yle March 7, 2025 16:12
@tyrasd tyrasd force-pushed the onewaymarkers-dashed-inline branch from e7835f9 to aa3a72b Compare March 7, 2025 16:20
_defsSelection
.append('marker')
.attr('id', `ideditor-oneway-marker-${name}`)
.attr('viewBox', '0 0 10 5')
.attr('refX', 2.5)
.attr('refX', 4)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a much nicer solution :) my only suggestion would be to keep the original spacing between bidirectional arrow heads, since it's a bit cramped now:

original:
image

this PR:
image

Copy link
Member Author

@tyrasd tyrasd Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the new version does look a bit squished… I needed to shrink the length of the double-sided arrows a bit though, in order to fit them into the existing dash spacings of the different line styles.

I experimented a bit with the shape of the arrows, and found two that seem to work reasonably well even in the more condensed form for the bidirectional arrows:

  1. original M 5,3 L 0,3 L 0,2 L 5,2 L 5,0 L 10,2.5 L 5,5 z (with refX=2.5)
  2. first version of this PR: same shape as above, but refX=4
  3. arrow alternative 1 M 6,3 L 0,3 L 0,2 L 6,2 L 5,0 L 10,2.5 L 5,5 z (refX=4)
  4. arrow alternative 2 M 6.5,3 L 0,3 L 0,2 L 6.5,2 L 5.5,0 L 10,2.5 L 5.5,5 z (refX=4)

image

Here's the test suite from above again with alternatives 1 and 2:

image

image

PS: I also bumped up the opacity to 100% for all arrows in the last two screenshots, as I think the slight transparency of the arrows is not necessary and only caused a minor issue where the two arrows overlap in for bidirectional lines. But maybe it would be worth toning down the color for the black arrows to something like #333 to tone down the contrast a little bit, and bring it back in line with how the arrows previously appeared on typical lines.

tyrasd added 4 commits March 9, 2025 11:39
otherwise they would be rendered out of sync of the line's dashes when the feature extends outside of the viewport
@tyrasd tyrasd merged commit 8e8c5a8 into develop Mar 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
map-renderer An issue with how things are rendered in the map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants