Map pushpin callout: kind label + preset/name two-line layout#10
Draft
tordans wants to merge 4 commits into
Draft
Map pushpin callout: kind label + preset/name two-line layout#10tordans wants to merge 4 commits into
tordans wants to merge 4 commits into
Conversation
Add pushpinCalloutLines() on OsmBaseObject so the selection balloon always shows the matched preset type first and the display name second when present. Update PushPinView for two-line layout with a smaller subheadline for the name. Add unit tests for callout line selection and redundancy handling. Co-authored-by: Tobias <t@tobiasjordans.de>
When a matched preset uses a wildcard tag (e.g. playground=*) and the object has a concrete value, use the field strings option title (Spielbagger for playground=excavator in German) for pushpin tooltips, friendlyDescription, and the POI Type row. Falls back to preset name when no strings entry exists. Co-authored-by: Tobias <t@tobiasjordans.de>
Co-authored-by: Tobias <t@tobiasjordans.de>
Co-authored-by: Tobias <t@tobiasjordans.de>
|
This looks pretty interesting. I tried testing it and the label is broken, but I think it has potential. |
Owner
Author
Glad to hear it. Will polish and test this some more soon.
Just to be clear: All the PRs I have on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
As a mapper selecting a feature on the map, I need the pushpin callout to answer two questions at a glance: what is it? and what is it called? Today those answers are inconsistent:
name=*and sometimes the preset / feature type, depending on context, so quick scanning is unreliable.playground=excavator(presetplayground=*), the callout shows the broad generic label (e.g. “Playground Equipment” / “Spielplatzgerät”) instead of the specific localized kind from preset fieldstrings(e.g. “Spielbagger”).How both cases are solved together
Both changes target the map pushpin callout but address different labeling gaps. They share one primary-label pipeline and compose cleanly.
Pushpin callout (map selection balloon)
MapView.refreshPushpinText()→OsmBaseObject.pushpinCalloutLines()→PushPinView.setCallout(primary:secondary:)PresetFeature.localizedKindLabel(for:)(wildcard presets) → ② matched presetfriendlyName()→ ③ existingfriendlyDescriptionfallbacks (restrictions,key=value, “(node)”, …). NevergivenName()on line 1.givenName()(name,name:xx,refon highways, …) only if non-empty and not redundant with line 1 (trim + case-insensitive compare). Smaller subheadline font.New objects (
selectedPrimary == nil) keep a single localized “(new object)” line.Concrete examples (pushpin callout)
Labels below are English UI unless noted. Line 2 is omitted when empty.
shop=convenienceshop/convenienceshop=convenience+name=Joe's Martshop/convenienceplayground=excavatorplayground(playground=*)strings; not “Playground Equipment”)playground=excavator+name=North Playgroundplaygroundplayground=excavator(German UI)playgroundplayground=excavator+name=Kinderplatz Nord(German UI)playgroundname=Only Name(no preset match)shop=convenience+name=Convenience Storeshop/conveniencehighway=primary+ref=A 5(way)highway/primaryrefviagivenName())Same tags elsewhere (not pushpin):
friendlyDescription()still returns a single string and prefersnamefirst. Example:shop=convenience+name=Joe's Mart→ Joe's Mart (not two lines). Voice announcements and multi-select lists keep this behavior.POI editor Type row matches pushpin line 1 for the examples above (e.g. “Excavator” / “Spielbagger”, not “Playground Equipment”).
Other UI (unchanged intent)
friendlyDescription()(voice, multi-select, relation lists, etc.) still prefersgivenName()first, then uses the same primary pipeline (kind label → preset name → fallbacks). Pushpin is the only surface that splits type and name onto two lines.Implementation notes (by Cursor)
PresetFeature.localizedKindLabel(for:)— walks presetfields; for wildcard tags (*), returnslocalizedOptions[tagValue].titlefrom id-tagging-schemastrings.OsmBaseObject.pushpinCalloutLines()—(primary, secondary?);pushpinCalloutPrimary(withDetails:)shared withfriendlyDescription()after the name-first branch.PushPinView— twoCATextLayers (headline + subheadline), 300pt max width, wrapping/truncation; balloon height grows for line 2.PresetDisplayForFeature— Type row uses kind label when available.PresetKindLabelTestCase,OsmBaseObject_PushpinCalloutTestCase(includesplayground=excavator+nameprecedence).Supersedes PR #18 (
cursor/preset-kind-label-4108), merged into this branch.Testing notes (by @tordans)
Manual — two-line layout
shop=convenience+name=Foo→ line 1 “Convenience Store”, line 2 “Foo” (smaller).name→ line 1 “(node)” (or other fallback); line 2 name when distinct.PushPinViewstill sane.refreshPushpinText().Manual — kind label
playground=excavator, German UI → line 1 “Spielbagger”, not “Spielplatzgerät”.name=…→ line 1 “Spielbagger”, line 2 name.stringsoption → generic preset name on line 1.Automated
PresetKindLabelTestCase,OsmBaseObject_PushpinCalloutTestCase.