Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rendering direction on vertices (stop sign, traffic_signals, etc) #4602

Merged
merged 70 commits into from
Jan 2, 2018

Conversation

bhousel
Copy link
Member

@bhousel bhousel commented Dec 7, 2017

Something I threw together today - I still might adjust the marker style a bit, and I'm not 100% sure if it handles all of the tag cases correctly.

highway=stop with direction=forward / direction=backward

screenshot 2017-12-07 16 42 35

This is what it does for stop=all or direction=both

screenshot 2017-12-07 16 43 04

@iandees
Copy link
Collaborator

iandees commented Dec 7, 2017

An arrow is kinda confusing to me. Is that the direction of travel or the direction the sign would be facing?

@bhousel
Copy link
Member Author

bhousel commented Dec 8, 2017

An arrow is kinda confusing to me. Is that the direction of travel or the direction the sign would be facing?

Yeah, this is a hard problem. Currently, the arrowhead faces whatever the direction tag says: "Forward" or "Backward" - so that's "direction of travel".

Even those words are not great - I don't think an untrained mapper would really be able to understand this concept, or even why stop signs (and even moreso traffic signals) would need a direction. The help text is not very helpful either.

screenshot 2017-12-07 19 02 22

I'd definitely welcome some ideas on how to make this easier.

@bhousel
Copy link
Member Author

bhousel commented Dec 8, 2017

Some other design thoughts.. whatever we do needs to:

  • have good contrast on top of everything
  • be distinct from both the oneway markers and the streetlevel photo view cones
  • look good very close to or under the vertex (even when the vertex has a selection halo)

@bhousel bhousel force-pushed the direction_vertices branch from 67d7c5b to b79b6ca Compare December 8, 2017 03:48
@bhousel
Copy link
Member Author

bhousel commented Dec 8, 2017

@iandees I do kind of like the viewfield a little better, what do you think?

screenshot 2017-12-08 11 58 32screenshot 2017-12-08 11 58 21

@iandees
Copy link
Collaborator

iandees commented Dec 8, 2017

Yea, that makes more sense I think. I was also going to suggest something like that but with a flat line perpendicular to the incoming way representing the top of the sign/signal.

@bhousel
Copy link
Member Author

bhousel commented Dec 11, 2017

So this functionality is turning out to be pretty cool. I have directions rendered for a bunch of things now (street signs, cameras, etc).

The main issue remaining is that a point with directions disappears when dragged.

nodrag-directional

I know why - it's because vertices aren't displayed during a drag, which is also #3003.

(re: #3003 / #4602)

For now, drawHover is commented out.  Still not sure what I will do with it.
This means that things flicker a bit when dragging, also connecting nodes
(and closing lines) does not currently work.

There was lot going on preventing the vertices from rendering while dragging.

1. `modeDragNode` needed a proper `selectedIDs()` function that works like other
modes.. Many other places in iD (including the vertex renderer) call `context.selectedIDs()`..
This means that `modeDragNode` needs a new function `restoreSelectedIDs()` to do what
`selectedIDs()` was previously doing (a place to store selectedIDs so that we
can reselect those entities after the user is done dragging a node in select mode)

2. Just so many things in svg/vertices.js
  - siblingAndChildVertices was missing some things for points that we render
    as vertices (points in wireframe, points with directions)
  - the sibling vertices weren't being included in the `filter` function, so
    would disappear when doing differenced/extent redraws
  - probably some other things
(re: #4271, #3636)

- better classification of "interesting" vertices
  (include tagged, selected, or child of selected)
- now we can draw labels on selected lines again (revert #3636)
  because the labels will avoid the vertices
- if debugging is on, draw a collision box for the mouse
- `nodes` are for osm nodes
- `points` are the projected locations of those node `loc` in screen space
(it's easier to just class the surface, and won't interfere with snapping)
Test for self-intersecting areas in both drag_node and draw_way
(this can get a bit expensive for large/complex multipolygons)
This makes the code a bit more consistent and lets us avoid some
hacky and probably non-performant things:
- abusing CSS classes in the draw/drag datum functions (classed `.target`)
  (is this thing target? just check d.properties)
- regexing the id for `-nope$`
  (is this thing a nope target? just check d.properties)
- using context.hasEntity to get a the real entity
  (is this thing a real osmEntity? just check d.properties)
- fixes code like the restriction editor which uses fake ids for split ways
(fixes test and allows hover on the area fills again)
@bhousel
Copy link
Member Author

bhousel commented Jan 2, 2018

Happy New Year! Time to merge this thing already! 🎉🎆🎊🍾

It will show up in http://preview.ideditor.com/master shortly, and I encourage anyone who is interested to try it out there...

@fidelis-assis
Copy link

Hi,

I like the new viewfield for direction but aren't forward and backward reversed?

@bhousel
Copy link
Member Author

bhousel commented Feb 20, 2018

I like the new viewfield for direction but aren't forward and backward reversed?

I don't think they are reversed. For example, a stop sign that affects forward travel will be pointed backwards so the cars can see it:

screenshot 2018-02-20 09 48 35

But if you found a situation that we are rendering incorrectly, please open an issue and me know!

@fidelis-assis
Copy link

fidelis-assis commented Feb 20, 2018 via email

@bhousel
Copy link
Member Author

bhousel commented Feb 20, 2018

If the stop sign points
backwards relatively to the way direction and I'm mapping its direction
(where it faces to), why tag it with 'forward' as in this example and not
'backward'?

Oh yeah, I left out an important detail in that screenshot above. The direction=forward/backward tag works relative to the direction that the way is drawn, not the direction of the sign. A funny thing about these tags - if you reverse the way, iD also needs to (and does) reverse the direction=* tag.

See:

The main reason that I started rendering these viewfields is because it's nearly impossible (especially for casual mappers) to understand how the direction apply to a way.

@fidelis-assis
Copy link

fidelis-assis commented Feb 20, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants