From b32ecfab276fb8e1dff0e1d72ed819b548323328 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Tue, 16 Jul 2024 06:45:43 +0100 Subject: Working implementation of ADSB loaded from file. Net1090 can read from dump1090 socket --- LearnMapKit/ContentView.swift | 85 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) (limited to 'LearnMapKit/ContentView.swift') diff --git a/LearnMapKit/ContentView.swift b/LearnMapKit/ContentView.swift index 08f4192..13ef64f 100644 --- a/LearnMapKit/ContentView.swift +++ b/LearnMapKit/ContentView.swift @@ -9,6 +9,31 @@ import SwiftUI import MapKit import Collections +struct FlightView: View { + + var evilClass: FlightState + + var body: some View { + //let i = evilClass.flight.count + let pos = CLLocationCoordinate2D(latitude: 55.80159, longitude:-3.13154) + Map() { + ForEach(0..<10, id:\.self) {i in + Annotation("plane\(i)", coordinate: pos) { + 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) + } + } + } +} + struct ContentView: View { @State private var region = MKCoordinateRegion() @@ -17,6 +42,7 @@ struct ContentView: View { @Binding var pos_queue: Deque @EnvironmentObject var evilClass: FlightState + let initialPosition: MapCameraPosition = { let center = CLLocationCoordinate2D(latitude: 55.90159, longitude:-3.53154) let span = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1) @@ -53,7 +79,7 @@ struct ContentView: View { } Button("7") { print("Pressed 7") - print(evilClass.update_postions.count) + //print(evilClass.update_postions.count) } } .border(.blue) @@ -61,7 +87,7 @@ struct ContentView: View { //.padding() Map(initialPosition: initialPosition) { - Annotation("plane1", coordinate: position1) { + /*Annotation("plane1", coordinate: position1) { ZStack { RoundedRectangle(cornerRadius: 10) .fill(.background) @@ -104,7 +130,46 @@ struct ContentView: View { .resizable() .frame(width:20,height: 20) } - }.annotationTitles(.hidden) + }.annotationTitles(.hidden)*//* + ForEach(0.. some View { + let c = self.evilClass.flight.count + ForEach(0..