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

Add Bus Stop Name Suggestions, generalize Name Suggestions #6097

Merged
merged 15 commits into from
Jan 22, 2025

Conversation

kmpoppe
Copy link
Collaborator

@kmpoppe kmpoppe commented Jan 12, 2025

Resolves #5187 (Blocks #5934)

Finds Bus Stop Names around 250 m of the point the quest is asked for.
UI changed from a left-aligned simple text-input to a centered suggestion-enabled input just like road names.

Quest asked for this node, suggestions from https://www.openstreetmap.org/node/123368775 and https://www.openstreetmap.org/node/418728678

Screenshot_20250112_211335

Thoughts? I'd like to get this implemented before I put #5934 to work.

mnalis added a commit to mnalis/StreetComplete that referenced this pull request Jan 12, 2025
@mnalis
Copy link
Member

mnalis commented Jan 12, 2025

FYI I've built a debug APK at https://github.com/mnalis/StreetComplete/actions/runs/12737099313 (if somebody else wants to test but can't compile their own)...

You @kmpoppe could click on Actions / Build debug APK in your GitHub fork (or otherwise build / upload debug APK version so other people can help test it without having to build their own)


Back to the PR, I've noticed the colors are broken in dark mode (white box, too dark dropdownlist triangle) - PR version on the right:

small_Screenshot_20250112_223047_SCEE Dev small_Screenshot_20250112_223013_StreetComplete Dev

Other than that, it seems to work as advertised: on that specific example node, it offers (and applies when selected) name=B72/Kirchweg tag

It would also be interesting how it handles if more than one language (e.g. currently it says only de) is offered (do you know of such location)?

@mnalis
Copy link
Member

mnalis commented Jan 12, 2025

And also in Light theme, it seems that the flashing cursor / text / spacing / area for input text got bigger, and text is now centered?

small_Screenshot_20250112_224908_SCEE Dev small_Screenshot_20250112_224840_StreetComplete Dev

@mnalis
Copy link
Member

mnalis commented Jan 12, 2025

It would also be interesting how it handles if more than one language (e.g. currently it says only de) is offered (do you know of such location)?

https://overpass-turbo.eu/s/1X3K might be helpful in finding them. My quick test seems to indicate it works fine there too (e.g. https://www.openstreetmap.org/node/3839537126):

small_Screen_Recording_20250112_233032_StreetComplete.Dev.mp4

@kmpoppe
Copy link
Collaborator Author

kmpoppe commented Jan 13, 2025

And also in Light theme, it seems that the flashing cursor / text / spacing / area for input text got bigger, and text is now centered?\n\n

Yes, the quest_localizedname_row layout is a copy of ...roadname... which looks like that. I think it looks good, it might just look weird when comparing them side by side?

Removed forced colors to make quest_localizedname_row layout work with Light and Dark themes.
@kmpoppe
Copy link
Collaborator Author

kmpoppe commented Jan 13, 2025

Removed the forced colours, lo and behold: Dark and Light views now work as expected. See Debug APK

Light:
Screenshot_20250113_123258
Dark:
Screenshot_20250113_123324

@mnalis
Copy link
Member

mnalis commented Jan 13, 2025

Removed the forced colours, lo and behold: Dark and Light views now work as expected

Hooray!

And also in Light theme, it seems that the flashing cursor / text / spacing / area for input text got bigger, and text is now centered?\n\n

Yes, the quest_localizedname_row layout is a copy of ...roadname... which looks like that. I think it looks good, it might just look weird when comparing them side by side?

It was also a loss of general decoration around text that made the empty margins look excessive. With your newest debug APK, it got that underline, so it looks better already.

small_Screenshot_20250113_134235_StreetComplete Dev small_Screenshot_20250113_134042_StreetComplete Dev

I would probably look even nicer (and waste less screen real estate) if that empty space between hr and en lines was smaller, but that is just a minor cosmetic detail. (big spacing look OK on that "blue table" as it simulates how the sign might look in reality, but looks strange for regular fields - like I've enabled some fat-finger accessibility feature or something)

But not a showstopper for me (unless it is easy to fix)

@kmpoppe kmpoppe requested a review from westnordost January 15, 2025 12:08
@westnordost westnordost self-assigned this Jan 15, 2025
@kmpoppe kmpoppe marked this pull request as draft January 16, 2025 14:38
Adding a centralized NameSuggestionSource, Bus- and RoadNameSuggestionSource now use their functions.
De-Clutter BusNameSuggestionSource
@kmpoppe kmpoppe requested a review from westnordost January 19, 2025 10:40
@kmpoppe
Copy link
Collaborator Author

kmpoppe commented Jan 19, 2025

Reworked for a central NameSuggestionSource, @mnalis could you please find another example to test with more than one name?

@westnordost
Copy link
Member

kmpoppe requested a review from westnordost

Could you first review the code yourself? Glancing over it, I am sure you will still find something.

@westnordost
Copy link
Member

Also, generally, I'd prefer if the bus stop name and road name quests would use the name suggestions source directly rather than having a class in-between (unless there is a good reason for it - at a glance, I don't see a good reason).

@westnordost westnordost removed their assignment Jan 19, 2025
@kmpoppe
Copy link
Collaborator Author

kmpoppe commented Jan 19, 2025

Also, generally, I'd prefer if the bus stop name and road name quests would use the name suggestions source directly rather than having a class in-between (unless there is a good reason for it - at a glance, I don't see a good reason).

I was debating that with myself and thought that specific classes would make more sense but alas, if you don't, I'll remove the specific classes and just work with NameSuggestion

@mnalis
Copy link
Member

mnalis commented Jan 19, 2025

@mnalis could you please find another example to test with more than one name?

Sure, e.g. https://www.openstreetmap.org/node/9207779395 or https://www.openstreetmap.org/node/8208818583

(Found by some manual looking at https://overpass-turbo.eu/s/1XnZ)

@kmpoppe kmpoppe changed the title Add Bus Stop Name Suggestions Add Bus Stop Name Suggestions, generalize Name Suggestions Jan 21, 2025
@kmpoppe kmpoppe marked this pull request as ready for review January 21, 2025 11:23
@westnordost westnordost self-assigned this Jan 21, 2025
(List<LatLon>.distanceTo(List<LatLon>, ...) is documented as distance of two polylines. It is only by "coincidence" that this is equal to minimum distance of two sets of points to each other)
…explanatory comments as for the parameters chosen
Copy link
Member

@westnordost westnordost left a comment

Choose a reason for hiding this comment

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

There were a few minor things, but since I had to dig into the code anyway and you certainly want to get on with the fixme name stuff to which this PR is merely the prerequisite, I just did those myself.

Other than small stuff like adding some explanatory comments and doc comments, the more important things I changed were:

  • added fun ElementGeometry.distance(point: LatLon): Double instead of having to do this manually in the getNames function (stopped short of a more generic ElementGeometry.distance(other: ElementGeometry) function, because this complexity is not necessary for this purpose)
  • no linking to some static val of AddRoadNameForm from some other class
  • properly typed filter parameter in getNames

@westnordost westnordost removed their assignment Jan 22, 2025
@kmpoppe
Copy link
Collaborator Author

kmpoppe commented Jan 22, 2025

Thanks for the edits @westnordost, the ElementGeometry.distance(points) function wouldn't have occured to me.

@westnordost westnordost merged commit 86256a6 into streetcomplete:master Jan 22, 2025
@kmpoppe kmpoppe deleted the bus-stop-name-suggest branch January 22, 2025 13:44
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.

[FR] give a hint for a bus-stop name
4 participants