summaryrefslogtreecommitdiff
path: root/LearnMapKit/ContentView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'LearnMapKit/ContentView.swift')
-rw-r--r--LearnMapKit/ContentView.swift86
1 files changed, 11 insertions, 75 deletions
diff --git a/LearnMapKit/ContentView.swift b/LearnMapKit/ContentView.swift
index 13ef64f..9f7fd29 100644
--- a/LearnMapKit/ContentView.swift
+++ b/LearnMapKit/ContentView.swift
@@ -9,6 +9,8 @@ import SwiftUI
import MapKit
import Collections
+
+
struct FlightView: View {
var evilClass: FlightState
@@ -41,6 +43,7 @@ struct ContentView: View {
@Binding var pos_queue: Deque<ADSBLocation>
@EnvironmentObject var evilClass: FlightState
+ @Environment(\.openWindow) private var openWindow
let initialPosition: MapCameraPosition = {
@@ -87,73 +90,6 @@ struct ContentView: View {
//.padding()
Map(initialPosition: initialPosition) {
- /*Annotation("plane1", coordinate: position1) {
- ZStack {
- RoundedRectangle(cornerRadius: 10)
- .fill(.background)
- RoundedRectangle(cornerRadius: 10)
- .stroke(.secondary,lineWidth: 5)
- Image(systemName:"airplane.circle.fill")
- .resizable()
- .frame(width:20,height: 20)
- }
- }.annotationTitles(.hidden)
- Annotation("plane2", coordinate: position2) {
- ZStack {
- RoundedRectangle(cornerRadius: 10)
- .fill(.background)
- RoundedRectangle(cornerRadius: 10)
- .stroke(.secondary,lineWidth: 5)
- Image(systemName:"airplane.circle.fill")
- .resizable()
- .frame(width:20,height: 20)
- }
- }.annotationTitles(.hidden)
- Annotation("plane3", coordinate: position3) {
- ZStack {
- RoundedRectangle(cornerRadius: 10)
- .fill(.background)
- RoundedRectangle(cornerRadius: 10)
- .stroke(.secondary,lineWidth: 5)
- Image(systemName:"airplane.circle.fill")
- .resizable()
- .frame(width:20,height: 20)
- }
- }.annotationTitles(.hidden)
- Annotation("plane4", coordinate: position4) {
- ZStack {
- RoundedRectangle(cornerRadius: 10)
- .fill(.background)
- RoundedRectangle(cornerRadius: 10)
- .stroke(.secondary,lineWidth: 5)
- Image(systemName:"airplane.circle.fill")
- .resizable()
- .frame(width:20,height: 20)
- }
- }.annotationTitles(.hidden)*//*
- ForEach(0..<evilClass.flight.count, id:\.self) { _ in
- Annotation("plane\(0)", coordinate: CLLocationCoordinate2D(latitude: evilClass.flight[0]?.lat!, longitude: evilClass.flight[0]?.long!)) {
- ZStack {
- RoundedRectangle(cornerRadius: 10)
- .fill(.background)
- RoundedRectangle(cornerRadius: 10)
- .stroke(.secondary,lineWidth: 5)
- Image(systemName:"airplane.circle.fill")
- .resizable()
- .frame(width:20,height: 20)
- }
- }.annotationTitles(.hidden)
- }*/
- //let c = self.evilClass.flight.count
- /*ForEach(0..<self.evilClass.flight.count, id:\.self) { exp in
- //print("Draw annotation")
- //Annotation("plane\(exp+4)", coordinate: CLLocationCoordinate2D(latitude: 55.80159, longitude:-3.53154+Double(exp)*0.1)) {
- Annotation("plane\(exp+4)", coordinate: CLLocationCoordinate2D(latitude: self.evilClass.flight[exp]!.lat, longitude:self.evilClass.flight[exp]!.long)) {
- Image(systemName:"airplane.circle.fill")
- .resizable()
- .frame(width:20,height: 20)
- }
- }*/
ForEach(self.evilClass.flight.sorted(by: { $0.key < $1.key} ), id:\.key) { k in
Annotation("\(k.key)", coordinate: CLLocationCoordinate2D(latitude: self.evilClass.flight[k.key]!.lat, longitude:self.evilClass.flight[k.key]!.long)) {
VStack {
@@ -183,6 +119,13 @@ struct ContentView: View {
Label("Import file", systemImage: "square.and.arrow.down")
}
}
+ ToolbarItem {
+ Button {
+ openWindow(id: "net-config")
+ } label: {
+ Label("Network config", systemImage: "network")
+ }
+ }
} .fileImporter(isPresented: $isImporting, allowedContentTypes: [.text], allowsMultipleSelection: false) {
result in switch result {
case .success(let files):
@@ -191,7 +134,7 @@ struct ContentView: View {
print(error)
}
}
- drawFlights()
+
}
.padding()
@@ -203,13 +146,6 @@ struct ContentView: View {
print("This is called")
}
- @ViewBuilder
- func drawFlights() -> some View {
- let c = self.evilClass.flight.count
- ForEach(0..<c, id:\.self) { exp in
- //Annotation("plane4", coordinate: position4)
- }
- }
}
//#Preview {