Directional nodes: map Rotate updates direction / camera:direction#957
Open
tordans wants to merge 1 commit into
Open
Directional nodes: map Rotate updates direction / camera:direction#957tordans wants to merge 1 commit into
direction / camera:direction#957tordans wants to merge 1 commit into
Conversation
Standalone nodes with a parsable direction or camera:direction tag now expose Rotate in the edit menu. Rotation uses the same overlay and pinch gesture as areas but writes bearing degrees to the tag instead of moving geometry, with live direction wedge preview on the map. fix: move direction-rotate state out of extension (Swift compile error) Co-Authored-By: Tobias <t@tobiasjordans.de>
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
Mappers who tag standalone POIs with a technical bearing (
direction=*orcamera:direction=*in degrees, cardinals, or ranges—seeOsmNode+Direction.swift) can preview the aim on the map as a direction wedge, but adjusting it today means opening the POI editor and using the compass flow (DirectionViewControllerviaPresetValueTextField).Area rotation is already map-native: choose Rotate, use the cyan arc overlay and rotation gesture, and geometry updates in place. Nodes without a selected parent way only get Duplicate; Rotate on a node inside a way still rotates the whole way. Standalone nodes with a direction tag had no equivalent “aim on the map” workflow.
Goal: For a standalone selected node whose
directionorcamera:directionvalueOsmNode.directioncan parse, show Rotate in the edit menu and enter the same rotation overlay/gesture as areas—but write the tag (bearing in degrees, same convention as compass capture and the map wedge) instead of moving the node. ComplementsDirectionViewController; does not replace it.Out of scope (this PR): Nodes that only infer direction from highway
forward/backwardon a way; nodes that are members of a way (way rotation unchanged).Implementation notes (by Cursor)
When Rotate appears
EditorMapLayer.editActionsAvailable(), standalone nodes (selectedNodeonly) append.ROTATEwhentechnicalDirectionTagKey != nil.technicalDirectionTagKeyis added onOsmNodeand only matchesdirection/camera:directionvalues thatdirectionFromStringcan parse (sodirection=forwardon ahighway=stopnode does not qualify).Direction-edit rotate mode
MapView.startObjectRotation()detects standalone + technical direction and callsEditorMapLayer.rotateDirectionBegin()(undo grouping + stored initial bearing/tag key).UIRotationGestureRecognizeras geometry rotation.rotateDirectionContinue(delta:)applies total gesture rotation to the initial bearing, writes degrees viamapData.setTags, callssetNeedsLayout()anddidUpdateObject()for live wedge preview.directionvscamera:direction; numeric output like compass UI (MeasureDirectionViewModel). Arc spans (90-120) keep their width when rotated.endObjectRotation()finishes direction undo viarotateDirectionFinish().directionRotateTagKey,directionRotateInitialBearing) lives on the mainEditorMapLayerclass—not in the+Editextension (Swift disallows stored properties in extensions).Fallback behavior
Testing notes (@tordans)
Go Map!!scheme on device or simulator (Linux CI cannot run Xcode here).GoMapTests→OsmNode_DirectionTestCase(new cases fortechnicalDirectionTagKey, range formatting, highwayforwardexclusion).direction=90or(e.g. bench, surveillance, viewpoint). – Only testedcamera:direction=180direction,camera:directionassumed to also workcamera:direction→ rotation updates that key, notdirection.direction=90-120→ after rotate, still a range with same angular width.– Not tested (yet)highway=stop+direction=forward: no Rotate on standalone (no technical direction).rotate-node--before.min.mov
rotate-node--after.min.mov
Ping openstreetmap/iD#12104 and especially openstreetmap/iD#12341 where this idea comes from.