Skip to content

Commit de12418

Browse files
Provide alternate ID in pin creator on Red Window (#50)
1 parent 873b31a commit de12418

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

MCMaps/Red Window/Views/Search/RedWindowSearchLandmarkResultCell.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ struct RedWindowSearchLandmarkResultCell: View {
7474
Button("Create Pin", systemImage: "mappin") {
7575
request.position = landmark.position
7676
request.name = landmark.name
77+
if landmarkType == .integratedPin {
78+
request.alternateIDs = landmark.alternateIDs
79+
}
7780
request.displayForm = true
7881
}
7982
} else {

MCMaps/Red Window/Views/Search/RedWindowSearchView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ struct RedWindowSearchView: View {
2222
/// The pin's suggested location.
2323
var position = CGPoint.zero
2424

25+
/// The proposed alternate IDs for this pin.
26+
var alternateIDs: Set<String>?
27+
2528
/// Whether the form should be displayed.
2629
var displayForm = false
2730
}
@@ -58,7 +61,9 @@ struct RedWindowSearchView: View {
5861
location: pinCreationRequest.position,
5962
initialName: pinCreationRequest.name
6063
) { newPin in
61-
file.pins.append(newPin)
64+
var transformedPin = newPin
65+
transformedPin.alternateIDs = pinCreationRequest.alternateIDs
66+
file.pins.append(transformedPin)
6267
}
6368
#if os(macOS)
6469
.formStyle(.grouped)

MCMaps/Shared/Services/CartographySearchService.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,12 @@ class CartographySearchService {
127127
}
128128
let allMarkers = markers.map(\.value)
129129
return allMarkers.flatMap { group in
130-
group.markers.map { (_, marker) in
130+
group.markers.map { (id, marker) in
131131
CartographyMapPin(
132132
named: marker.label,
133133
at: CGPoint(x: marker.position.x, y: marker.position.z),
134-
color: .gray
134+
color: .gray,
135+
alternateIDs: [id]
135136
)
136137
}
137138
}

0 commit comments

Comments
 (0)