From d33bbfc04f5abd1c6f254bae2dbb31420c9707c4 Mon Sep 17 00:00:00 2001 From: Jacob Powers Date: Tue, 22 Jul 2025 06:40:43 +0000 Subject: [PATCH] display points of interest with names --- Meshtastic/Helpers/GeoJSONOverlayConfig.swift | 22 ++++++++++++++----- .../Map/MapContent/MeshMapContent.swift | 10 ++++----- .../Nodes/Helpers/Map/NodeMapSwiftUI.swift | 22 +++++++++---------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/Meshtastic/Helpers/GeoJSONOverlayConfig.swift b/Meshtastic/Helpers/GeoJSONOverlayConfig.swift index ac06b6ed..9082fcfc 100644 --- a/Meshtastic/Helpers/GeoJSONOverlayConfig.swift +++ b/Meshtastic/Helpers/GeoJSONOverlayConfig.swift @@ -19,6 +19,18 @@ struct GeoJSONFeature: Codable { // MARK: - GeoJSON Styling Properties + /// Extract feature name from properties, defaulting to empty string + var name: String { + // Check for "NAME" first (uppercase), then "name" (lowercase) + if case .string(let value) = properties?["NAME"] { + return value + } + if case .string(let value) = properties?["name"] { + return value + } + return "" + } + /// Extract layer metadata from properties var layerId: String? { if case .string(let value) = properties?["layer_id"] { @@ -147,10 +159,10 @@ struct GeoJSONFeature: Codable { /// Convert marker size to point radius var markerRadius: CGFloat { switch markerSize { - case "small": return 8.0 - case "medium": return 12.0 - case "large": return 16.0 - default: return 12.0 + case "small": return 4.0 + case "medium": return 8.0 + case "large": return 12.0 + default: return 4.0 } } } @@ -328,4 +340,4 @@ enum AnyCodableValue: Codable { } return nil } -} \ No newline at end of file +} diff --git a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift index cfaa1e89..30651e93 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/MapContent/MeshMapContent.swift @@ -247,23 +247,23 @@ struct MeshMapContent: MapContent { var overlayContent: some MapContent { // Get all features but filter by enabled configs let allStyledFeatures = GeoJSONOverlayManager.shared.loadStyledFeaturesForConfigs(enabledOverlayConfigs) - - + + return Group { ForEach(0.. 1 { Button(action: { if isLookingAround { @@ -182,7 +182,7 @@ struct NodeMapSwiftUI: View { .controlSize(.regular) .padding(5) } - + private func updateMapStyle(for layer: MapLayer) { UserDefaults.mapLayer = layer switch layer { @@ -196,7 +196,7 @@ struct NodeMapSwiftUI: View { break } } - + private func handleNodeChange() { isLookingAround = false isShowingAltitude = false @@ -212,7 +212,7 @@ struct NodeMapSwiftUI: View { } } } - + private func handleAppear() { UIApplication.shared.isIdleTimerDisabled = true updateMapStyle(for: selectedMapLayer)