mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
71 lines
1.1 KiB
Swift
71 lines
1.1 KiB
Swift
//
|
|
// TraceRouteEntityExtension.swift
|
|
// Meshtastic
|
|
//
|
|
// Copyright(c) Garth Vander Houwen 12/7/23.
|
|
//
|
|
|
|
import CoreData
|
|
import CoreLocation
|
|
import MapKit
|
|
import SwiftUI
|
|
|
|
extension TraceRouteEntity {
|
|
|
|
var latitude: Double? {
|
|
|
|
let d = Double(latitudeI)
|
|
if d == 0 {
|
|
return 0
|
|
}
|
|
return d / 1e7
|
|
}
|
|
|
|
var longitude: Double? {
|
|
|
|
let d = Double(longitudeI)
|
|
if d == 0 {
|
|
return 0
|
|
}
|
|
return d / 1e7
|
|
}
|
|
|
|
var coordinate: CLLocationCoordinate2D? {
|
|
if latitudeI != 0 && longitudeI != 0 {
|
|
let coord = CLLocationCoordinate2D(latitude: latitude!, longitude: longitude!)
|
|
return coord
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
|
|
extension TraceRouteHopEntity {
|
|
|
|
var latitude: Double? {
|
|
|
|
let d = Double(latitudeI)
|
|
if d == 0 {
|
|
return 0
|
|
}
|
|
return d / 1e7
|
|
}
|
|
|
|
var longitude: Double? {
|
|
|
|
let d = Double(longitudeI)
|
|
if d == 0 {
|
|
return 0
|
|
}
|
|
return d / 1e7
|
|
}
|
|
|
|
var coordinate: CLLocationCoordinate2D? {
|
|
if latitudeI != 0 && longitudeI != 0 {
|
|
let coord = CLLocationCoordinate2D(latitude: latitude!, longitude: longitude!)
|
|
return coord
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|
|
}
|