Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Examples/Cassini/ContentView+Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,24 @@ extension ContentView {
case naturalEarth
case orthographic
case azimuthal

var id: String { rawValue }

/// Whether the projection's output depends on the reference latitude.
var usesReferenceLatitude: Bool {
switch self {
case .orthographic, .azimuthal: return true
case .equirectangular, .cassini, .mercator, .gallPeters, .equalEarth, .naturalEarth: return false
}
}

/// Whether the projection's output depends on the reference longitude.
var usesReferenceLongitude: Bool {
switch self {
case .cassini: return false
case .equirectangular, .mercator, .gallPeters, .equalEarth, .naturalEarth, .orthographic, .azimuthal: return true
}
}
}

struct Layer: Identifiable {
Expand Down
8 changes: 5 additions & 3 deletions Examples/Cassini/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,27 @@ struct OptionsView: View {
.frame(width: 100, alignment: .trailing)
}
.frame(minWidth: 200)

TextField(value: $model.refLat, format: .number.precision(.fractionLength(1))) {
EmptyView()
}
.frame(maxWidth: 55)
}

.disabled(!model.projectionType.usesReferenceLatitude)

HStack {
Slider(value: $model.refLng, in: -180...180) {
Text("Longitude")
.frame(width: 100, alignment: .trailing)
}
.frame(minWidth: 200)

TextField(value: $model.refLng, format: .number.precision(.fractionLength(1))) {
EmptyView()
}
.frame(maxWidth: 55)
}
.disabled(!model.projectionType.usesReferenceLongitude)
}

GroupBox("Edge Insets") {
Expand Down