diff --git a/Sources/MapLibreSwiftUI/Models/MapCamera/CameraPitch.swift b/Sources/MapLibreSwiftUI/Models/MapCamera/CameraPitchRange.swift similarity index 94% rename from Sources/MapLibreSwiftUI/Models/MapCamera/CameraPitch.swift rename to Sources/MapLibreSwiftUI/Models/MapCamera/CameraPitchRange.swift index 45d3cbd..9379339 100644 --- a/Sources/MapLibreSwiftUI/Models/MapCamera/CameraPitch.swift +++ b/Sources/MapLibreSwiftUI/Models/MapCamera/CameraPitchRange.swift @@ -2,7 +2,7 @@ import Foundation import MapLibre /// The current pitch state for the MapViewCamera -public enum CameraPitch: Hashable, Sendable { +public enum CameraPitchRange: Hashable, Sendable { /// The user is free to control pitch from it's default min to max. case free diff --git a/Sources/MapLibreSwiftUI/Models/MapCamera/CameraState.swift b/Sources/MapLibreSwiftUI/Models/MapCamera/CameraState.swift index bf61bc7..00cffc9 100644 --- a/Sources/MapLibreSwiftUI/Models/MapCamera/CameraState.swift +++ b/Sources/MapLibreSwiftUI/Models/MapCamera/CameraState.swift @@ -8,7 +8,7 @@ public enum CameraState: Hashable { onCoordinate: CLLocationCoordinate2D, zoom: Double, pitch: Double, - pitchRange: CameraPitch, + pitchRange: CameraPitchRange, direction: CLLocationDirection ) @@ -16,19 +16,19 @@ public enum CameraState: Hashable { /// /// This feature uses the MLNMapView's userTrackingMode to .follow which automatically /// follows the user from within the MLNMapView. - case trackingUserLocation(zoom: Double, pitch: Double, pitchRange: CameraPitch, direction: CLLocationDirection) + case trackingUserLocation(zoom: Double, pitch: Double, pitchRange: CameraPitchRange, direction: CLLocationDirection) /// Follow the user's location using the MapView's internal camera with the user's heading. /// /// This feature uses the MLNMapView's userTrackingMode to .followWithHeading which automatically /// follows the user from within the MLNMapView. - case trackingUserLocationWithHeading(zoom: Double, pitch: Double, pitchRange: CameraPitch) + case trackingUserLocationWithHeading(zoom: Double, pitch: Double, pitchRange: CameraPitchRange) /// Follow the user's location using the MapView's internal camera with the users' course /// /// This feature uses the MLNMapView's userTrackingMode to .followWithCourse which automatically /// follows the user from within the MLNMapView. - case trackingUserLocationWithCourse(zoom: Double, pitch: Double, pitchRange: CameraPitch) + case trackingUserLocationWithCourse(zoom: Double, pitch: Double, pitchRange: CameraPitchRange) /// Centered on a bounding box/rectangle. case rect( diff --git a/Sources/MapLibreSwiftUI/Models/MapCamera/MapViewCamera.swift b/Sources/MapLibreSwiftUI/Models/MapCamera/MapViewCamera.swift index a7e6c07..3029732 100644 --- a/Sources/MapLibreSwiftUI/Models/MapCamera/MapViewCamera.swift +++ b/Sources/MapLibreSwiftUI/Models/MapCamera/MapViewCamera.swift @@ -10,7 +10,7 @@ public struct MapViewCamera: Hashable { public static let coordinate = CLLocationCoordinate2D(latitude: 0, longitude: 0) public static let zoom: Double = 10 public static let pitch: Double = 0 - public static let pitchRange: CameraPitch = .free + public static let pitchRange: CameraPitchRange = .free public static let direction: CLLocationDirection = 0 } @@ -51,7 +51,7 @@ public struct MapViewCamera: Hashable { public static func center(_ coordinate: CLLocationCoordinate2D, zoom: Double, pitch: Double = Defaults.pitch, - pitchRange: CameraPitch = Defaults.pitchRange, + pitchRange: CameraPitchRange = Defaults.pitchRange, direction: CLLocationDirection = Defaults.direction, reason: CameraChangeReason? = nil) -> MapViewCamera { @@ -70,7 +70,7 @@ public struct MapViewCamera: Hashable { /// - Returns: The MapViewCamera representing the scenario public static func trackUserLocation(zoom: Double = Defaults.zoom, pitch: Double = Defaults.pitch, - pitchRange: CameraPitch = Defaults.pitchRange, + pitchRange: CameraPitchRange = Defaults.pitchRange, direction: CLLocationDirection = Defaults.direction) -> MapViewCamera { // Coordinate is ignored when tracking user location. However, pitch and zoom are valid. @@ -88,7 +88,7 @@ public struct MapViewCamera: Hashable { /// - pitch: Set the camera pitch method. /// - Returns: The MapViewCamera representing the scenario public static func trackUserLocationWithHeading(zoom: Double = Defaults.zoom, - pitch: Double = Defaults.pitch, pitchRange: CameraPitch = Defaults.pitchRange) -> MapViewCamera + pitch: Double = Defaults.pitch, pitchRange: CameraPitchRange = Defaults.pitchRange) -> MapViewCamera { // Coordinate is ignored when tracking user location. However, pitch and zoom are valid. MapViewCamera(state: .trackingUserLocationWithHeading(zoom: zoom, pitch: pitch, pitchRange: pitchRange), @@ -105,7 +105,7 @@ public struct MapViewCamera: Hashable { /// - pitch: Set the camera pitch method. /// - Returns: The MapViewCamera representing the scenario public static func trackUserLocationWithCourse(zoom: Double = Defaults.zoom, - pitch: Double = Defaults.pitch, pitchRange: CameraPitch = Defaults.pitchRange) -> MapViewCamera + pitch: Double = Defaults.pitch, pitchRange: CameraPitchRange = Defaults.pitchRange) -> MapViewCamera { // Coordinate is ignored when tracking user location. However, pitch and zoom are valid. MapViewCamera(state: .trackingUserLocationWithCourse(zoom: zoom, pitch: pitch, pitchRange: pitchRange), diff --git a/Tests/MapLibreSwiftUITests/Models/MapCamera/CameraPitchTests.swift b/Tests/MapLibreSwiftUITests/Models/MapCamera/CameraPitchTests.swift index 1cb717f..f3e0c34 100644 --- a/Tests/MapLibreSwiftUITests/Models/MapCamera/CameraPitchTests.swift +++ b/Tests/MapLibreSwiftUITests/Models/MapCamera/CameraPitchTests.swift @@ -3,19 +3,19 @@ import XCTest final class CameraPitchTests: XCTestCase { func testFreePitch() { - let pitch: CameraPitch = .free + let pitch: CameraPitchRange = .free XCTAssertEqual(pitch.rangeValue.lowerBound, 0) XCTAssertEqual(pitch.rangeValue.upperBound, 60) } func testRangePitch() { - let pitch = CameraPitch.freeWithinRange(minimum: 9, maximum: 29) + let pitch = CameraPitchRange.freeWithinRange(minimum: 9, maximum: 29) XCTAssertEqual(pitch.rangeValue.lowerBound, 9) XCTAssertEqual(pitch.rangeValue.upperBound, 29) } func testFixedPitch() { - let pitch = CameraPitch.fixed(41) + let pitch = CameraPitchRange.fixed(41) XCTAssertEqual(pitch.rangeValue.lowerBound, 41) XCTAssertEqual(pitch.rangeValue.upperBound, 41) } diff --git a/Tests/MapLibreSwiftUITests/Models/MapCamera/MapViewCameraTests.swift b/Tests/MapLibreSwiftUITests/Models/MapCamera/MapViewCameraTests.swift index b3df381..4f01c41 100644 --- a/Tests/MapLibreSwiftUITests/Models/MapCamera/MapViewCameraTests.swift +++ b/Tests/MapLibreSwiftUITests/Models/MapCamera/MapViewCameraTests.swift @@ -17,14 +17,14 @@ final class MapViewCameraTests: XCTestCase { } func testTrackingUserLocation() { - let pitch: CameraPitch = .freeWithinRange(minimum: 12, maximum: 34) + let pitch: CameraPitchRange = .freeWithinRange(minimum: 12, maximum: 34) let camera = MapViewCamera.trackUserLocation(zoom: 10, pitchRange: pitch) assertSnapshot(of: camera, as: .dump) } func testTrackUserLocationWithCourse() { - let pitchRange: CameraPitch = .freeWithinRange(minimum: 12, maximum: 34) + let pitchRange: CameraPitchRange = .freeWithinRange(minimum: 12, maximum: 34) let camera = MapViewCamera.trackUserLocationWithCourse(zoom: 18, pitchRange: pitchRange) assertSnapshot(of: camera, as: .dump)