Organize map views, comment out un used controls

This commit is contained in:
Garth Vander Houwen 2023-01-15 10:39:08 -08:00
parent 547d250ec2
commit 3d1111972c
6 changed files with 61 additions and 61 deletions

View file

@ -280,11 +280,7 @@
isa = PBXGroup;
children = (
C9A7BC0E27759A6800760B50 /* Custom */,
C9A88B54278B503C00BD810A /* MapViewModule.swift */,
C9697F9C279336B700250207 /* LocalMBTileOverlay.swift */,
DD2AD8A7296D2DF9001FF0E7 /* MapViewSwiftUI.swift */,
DD964FBE296E76EF007C176F /* WaypointFormView.swift */,
DD964FC32974767D007C176F /* MapViewFitExtension.swift */,
);
path = Map;
sourceTree = "<group>";
@ -292,6 +288,10 @@
C9A7BC0E27759A6800760B50 /* Custom */ = {
isa = PBXGroup;
children = (
C9697F9C279336B700250207 /* LocalMBTileOverlay.swift */,
DD964FC32974767D007C176F /* MapViewFitExtension.swift */,
DD2AD8A7296D2DF9001FF0E7 /* MapViewSwiftUI.swift */,
C9A88B54278B503C00BD810A /* MapViewModule.swift */,
C9A7BC0F27759A9600760B50 /* PositionAnnotationView.swift */,
);
path = Custom;

View file

@ -1,60 +1,60 @@
////
//// PositionAnnotationView.swift
//// MeshtasticApple
////
//// Created by Joshua Pirihi on 24/12/21.
////
//
// PositionAnnotationView.swift
// MeshtasticApple
//import UIKit
//import MapKit
//import SwiftUI
//
// Created by Joshua Pirihi on 24/12/21.
//// a simple circle annotation, with a string in it
//class PositionAnnotation: NSObject, MKAnnotation {
//
import UIKit
import MapKit
import SwiftUI
// a simple circle annotation, with a string in it
class PositionAnnotation: NSObject, MKAnnotation {
// This property must be key-value observable, which the `@objc dynamic` attributes provide.
@objc dynamic var coordinate = CLLocationCoordinate2D(latitude: 0, longitude: 0)
// Required if you set the annotation view's `canShowCallout` property to `true`
// this string fills the callout label when you tap an annotation
var title: String?
// the text to appear inside the little circle
var shortName: String?
}
class PositionAnnotationView: MKAnnotationView {
private let annotationFrame = CGRect(x: 0, y: 0, width: 40, height: 40)
private let label: UILabel
override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
self.label = UILabel(frame: annotationFrame.offsetBy(dx: 0, dy: 0))
super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
self.frame = annotationFrame
self.label.font = UIFont.preferredFont(forTextStyle: .caption2)
self.label.textColor = .white
self.label.textAlignment = .center
self.backgroundColor = .clear
self.addSubview(label)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) not implemented!")
}
public var name: String = "" {
didSet {
self.label.text = name
}
}
override func draw(_ rect: CGRect) {
guard let context = UIGraphicsGetCurrentContext() else { return }
let circleRect = CGRect(x: 1, y: 1, width: 38, height: 38)
context.setFillColor(Color.accentColor.cgColor ?? CGColor(red: 0, green: 0.5, blue: 1.0, alpha: 1.0))
context.fillEllipse(in: circleRect)
}
}
// // This property must be key-value observable, which the `@objc dynamic` attributes provide.
// @objc dynamic var coordinate = CLLocationCoordinate2D(latitude: 0, longitude: 0)
//
// // Required if you set the annotation view's `canShowCallout` property to `true`
// // this string fills the callout label when you tap an annotation
// var title: String?
//
// // the text to appear inside the little circle
// var shortName: String?
//
//}
//
//class PositionAnnotationView: MKAnnotationView {
//
// private let annotationFrame = CGRect(x: 0, y: 0, width: 40, height: 40)
// private let label: UILabel
//
// override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
// self.label = UILabel(frame: annotationFrame.offsetBy(dx: 0, dy: 0))
// super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
// self.frame = annotationFrame
// self.label.font = UIFont.preferredFont(forTextStyle: .caption2)
// self.label.textColor = .white
// self.label.textAlignment = .center
// self.backgroundColor = .clear
// self.addSubview(label)
// }
//
// required init?(coder aDecoder: NSCoder) {
// fatalError("init(coder:) not implemented!")
// }
//
// public var name: String = "" {
// didSet {
// self.label.text = name
// }
// }
//
// override func draw(_ rect: CGRect) {
// guard let context = UIGraphicsGetCurrentContext() else { return }
//
// let circleRect = CGRect(x: 1, y: 1, width: 38, height: 38)
// context.setFillColor(Color.accentColor.cgColor ?? CGColor(red: 0, green: 0.5, blue: 1.0, alpha: 1.0))
// context.fillEllipse(in: circleRect)
// }
//}