diff --git a/DroneModels b/DroneModels index 29a12f3..bf57da0 160000 --- a/DroneModels +++ b/DroneModels @@ -1 +1 @@ -Subproject commit 29a12f35a75f3379a2824f3947304fdca7ea9a80 +Subproject commit bf57da01e55e3591b58702f14106d68ceea95765 diff --git a/OpenAthenaIOS.xcodeproj/project.pbxproj b/OpenAthenaIOS.xcodeproj/project.pbxproj index 075da21..4ee1dc8 100644 --- a/OpenAthenaIOS.xcodeproj/project.pbxproj +++ b/OpenAthenaIOS.xcodeproj/project.pbxproj @@ -207,10 +207,10 @@ isa = PBXGroup; children = ( 59BEF5E92AB61C3700D5A56D /* OpenAthenaIOSRelease.entitlements */, - 59A2554C2AB4A5C5009EB5BC /* OpenAthenaIOS.entitlements */, - 596E92782AA7B090003E35CD /* droneModels.json */, 597089DA2A3FD35600B5E1BF /* Cubic.swift */, + 59A2554C2AB4A5C5009EB5BC /* OpenAthenaIOS.entitlements */, 597089DB2A3FD35600B5E1BF /* EGM96complete.bin */, + 596E92782AA7B090003E35CD /* droneModels.json */, 597089DC2A3FD35600B5E1BF /* EGM96Geoid.swift */, 59DBFF0F2AD0C456003C4B33 /* FisheyeDistortionCorrector.swift */, 59DBFF112AD0C48A003C4B33 /* PerspectiveDistortionCorrector.swift */, @@ -708,7 +708,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = OpenAthenaIOS/OpenAthenaIOS.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 787; + CURRENT_PROJECT_VERSION = 842; DEVELOPMENT_TEAM = S9737SV7NZ; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = OpenAthenaIOS/Info.plist; @@ -726,7 +726,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.50; + MARKETING_VERSION = 2.52; NEW_SETTING = ""; PRODUCT_BUNDLE_IDENTIFIER = com.openathena.OpenAthenaIOS; PRODUCT_NAME = OpenAthena; @@ -745,7 +745,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = OpenAthenaIOS/OpenAthenaIOSRelease.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 787; + CURRENT_PROJECT_VERSION = 842; DEVELOPMENT_TEAM = S9737SV7NZ; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = OpenAthenaIOS/Info.plist; @@ -763,7 +763,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.50; + MARKETING_VERSION = 2.52; NEW_SETTING = ""; PRODUCT_BUNDLE_IDENTIFIER = com.openathena.OpenAthenaIOS; PRODUCT_NAME = OpenAthena; @@ -781,7 +781,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 787; + CURRENT_PROJECT_VERSION = 842; DEVELOPMENT_TEAM = S9737SV7NZ; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -801,7 +801,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 787; + CURRENT_PROJECT_VERSION = 842; DEVELOPMENT_TEAM = S9737SV7NZ; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 14.0; diff --git a/OpenAthenaIOS.xcodeproj/xcshareddata/xcschemes/OpenAthenaIOSTests.xcscheme b/OpenAthenaIOS.xcodeproj/xcshareddata/xcschemes/OpenAthenaIOSTests.xcscheme index 6e6cd86..279dad1 100644 --- a/OpenAthenaIOS.xcodeproj/xcshareddata/xcschemes/OpenAthenaIOSTests.xcscheme +++ b/OpenAthenaIOS.xcodeproj/xcshareddata/xcschemes/OpenAthenaIOSTests.xcscheme @@ -1,7 +1,7 @@ + version = "2.1"> diff --git a/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/UserInterfaceState.xcuserstate b/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/UserInterfaceState.xcuserstate index 42166b9..78dadef 100644 Binary files a/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/UserInterfaceState.xcuserstate and b/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index de65026..35b4777 100644 --- a/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/OpenAthenaIOS.xcworkspace/xcuserdata/rdk.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -14,8 +14,8 @@ filePath = "OpenAthenaIOS/DroneImage.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "1353" - endingLineNumber = "1353" + startingLineNumber = "1357" + endingLineNumber = "1357" landmarkName = "resolveTarget(dem:altReference:)" landmarkType = "7"> diff --git a/OpenAthenaIOS/AboutViewController.swift b/OpenAthenaIOS/AboutViewController.swift index 81cf1fa..9214431 100644 --- a/OpenAthenaIOS/AboutViewController.swift +++ b/OpenAthenaIOS/AboutViewController.swift @@ -168,8 +168,11 @@ class AboutViewController: UIViewController, UIScrollViewDelegate { // we want private func setTextViewText(htmlStr hString: String) { - if let attribString = vc.htmlToAttributedString(fromHTML: hString) { - self.textView.attributedText = attribString + // re issue #37, run entire on dispatchqueue + DispatchQueue.main.async { + if let attribString = self.vc.htmlToAttributedString(fromHTML: hString) { + self.textView.attributedText = attribString + } } } diff --git a/OpenAthenaIOS/DebugViewController.swift b/OpenAthenaIOS/DebugViewController.swift index abcc752..9f1f670 100644 --- a/OpenAthenaIOS/DebugViewController.swift +++ b/OpenAthenaIOS/DebugViewController.swift @@ -98,7 +98,7 @@ class DebugViewController: UIViewController, UIScrollViewDelegate { self.htmlString += "Coordinate system: \(app.settings.outputMode)
" self.htmlString += "Units: \(app.settings.unitsMode)
" - self.htmlString += "Drone params date: \(vc.droneParams!.droneParamsDate ?? "unknown"))
" + self.htmlString += "Drone params date: \(vc.droneParams!.droneParamsDate ?? "unknown")
" self.htmlString += "CCD data for \(vc.droneParams!.droneCCDParams.count) drones
" self.htmlString += "Use CCD Info: \(app.settings.useCCDInfo)
" self.htmlString += "EGM96 model loaded: \(EGM96Geoid.s_model_ok)
" @@ -138,7 +138,7 @@ class DebugViewController: UIViewController, UIScrollViewDelegate { var centerLat,centerLon : Double (centerLat,centerLon) = vc.dem!.getCenter() - let urlStr = "https://maps.google.com/maps/search/?api=1&t=k&query=\(centerLat),\(centerLon)" + let urlStr = "https://www.google.com/maps/search/?api=1&t=k&query=\(centerLat),\(centerLon)" self.htmlString += "\(urlStr)
" } else { @@ -167,7 +167,7 @@ class DebugViewController: UIViewController, UIScrollViewDelegate { var lon = try self.vc.theDroneImage!.getLongitude() self.htmlString += "Latitude: \(lat)
" self.htmlString += "Longitude: \(lon)
" - let urlStr = "https://maps.google.com/maps/search/?api=1&t=k&query=\(lat),\(lon)" + let urlStr = "https://www.google.com/maps/search/?api=1&t=k&query=\(lat),\(lon)" self.htmlString += "\(urlStr)
" try self.htmlString += "Make: \(vc.theDroneImage!.getCameraMake())
" try self.htmlString += "Model: \(vc.theDroneImage!.getCameraModel())
" @@ -330,8 +330,11 @@ class DebugViewController: UIViewController, UIScrollViewDelegate { // we want private func setTextViewText(htmlStr hString: String) { - if let attribString = vc.htmlToAttributedString(fromHTML: hString) { - self.textView.attributedText = attribString + // re issue #37, run entire call on dispatchqueue main async + DispatchQueue.main.async { + if let attribString = self.vc.htmlToAttributedString(fromHTML: hString) { + self.textView.attributedText = attribString + } } } diff --git a/OpenAthenaIOS/DroneImage.swift b/OpenAthenaIOS/DroneImage.swift index 6bb89a2..bbf1ae2 100644 --- a/OpenAthenaIOS/DroneImage.swift +++ b/OpenAthenaIOS/DroneImage.swift @@ -606,10 +606,13 @@ public class DroneImage { // compass correction is merely to compensate for errors in drone's // compass calibration - public func getGimbalYawDegree() throws -> Double { + public func getGimbalYawDegree() throws -> Double + { var az: Double + print("getGimbalYawDegree starting") + if metaData == nil { throw DroneImageError.NoMetaData } @@ -620,6 +623,7 @@ public class DroneImage { } if metaData!["drone-dji:GimbalYawDegree"] != nil { + print("getGimbalYawDegree: drone-dji:GimbalYawDegree present") az = (metaData!["drone-dji:GimbalYawDegree"] as! NSString).doubleValue if settings != nil { print("Adding \(settings!.compassCorrection) to AZ") @@ -1558,7 +1562,9 @@ public class DroneImage { // parse XMP/XML data out of image throwing errors // if encountered - public func parseXmpMetaData() throws { + public func parseXmpMetaData() throws + { + print("parseXmpMetaData: starting") if rawData == nil { xmpDataRead = false @@ -1575,14 +1581,14 @@ public class DroneImage { let beginRange = dataString.range(of: "", options: .regularExpression) if beginRange == nil || endRange == nil { - //print("parseXmpMetaData: did not find tags\n") + print("parseXmpMetaData: did not find tags\n") throw DroneImageError.NoXmpMetaData } let startIndex = beginRange!.lowerBound let endIndex = endRange!.upperBound xmlString = String(dataString[startIndex.. UIView? { + return contentView + } + // when view is set to appear, reset the htmlString // if we go forward to calculate then back to selectImage, // viewDidLoad may not be called again and then we @@ -148,6 +157,8 @@ class LoadCalculateViewController: UIViewController, { super.viewWillAppear(animated) + print("LoadCalculateViewController: viewWillAppear starting") + // create a cursor on target sender and pass Athena settings cotSender = CursorOnTargetSender(params: app.settings) @@ -440,6 +451,8 @@ class LoadCalculateViewController: UIViewController, { var lat, lon: Double + print("getImageData: starting") + if vc.theDroneImage == nil { return } @@ -486,9 +499,11 @@ class LoadCalculateViewController: UIViewController, } } catch { - self.htmlString += "Drone altitude: \(error)
" + self.htmlString += "Drone altitude: \(error)
" } + print("getImageData: done, going to setTextViewText") + // display the text finally! setTextViewText(htmlStr: self.htmlString) @@ -499,8 +514,13 @@ class LoadCalculateViewController: UIViewController, // we want private func setTextViewText(htmlStr hString: String) { - if let attribString = vc.htmlToAttributedString(fromHTML: hString) { - self.textView.attributedText = attribString + // to avoid crashing due to NSInternalConsistencyException, don't set + // on calling thread; dispatch to main async + // re issue #37 + DispatchQueue.main.async { + if let attribString = self.vc.htmlToAttributedString(fromHTML: hString) { + self.textView.attributedText = attribString + } } } @@ -603,6 +623,8 @@ class LoadCalculateViewController: UIViewController, // check for [ 0,0,0,0, 0,0,0,0, 0 ] // internally, all distances/altitudes are in meters + print("resolveTarget returned \(target)") + if target == [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] { print("doCalculations: target return values all zeros, returning") setTextViewText(htmlStr: htmlString) @@ -623,14 +645,12 @@ class LoadCalculateViewController: UIViewController, target[8] = target[3] + offset //let nearestAltStr = roundDigitsToString(val: target[4] + offset, precision: 6) - - print("resolveTarget returned \(target)") - + //htmlString += "

Target Lat,Lon: \(latStr),\(lonStr)


" //htmlString += "Resolve target: \(target)
" //let urlStr = "https://maps.../maps/@?api=1&map_action=map¢er=\(target[1]),\(target[2])" - let urlStr = "https://maps.google.com/maps/search/?api=1&t=k&query=\(latStr),\(lonStr)" + let urlStr = "https://www.google.com/maps/search/?api=1&t=k&query=\(latStr),\(lonStr)" htmlString += "

Lat,Lon: \(latStr),\(lonStr)


" if app.settings.unitsMode == .Metric { htmlString += "

Alt: \(altStr)m


" @@ -685,7 +705,7 @@ class LoadCalculateViewController: UIViewController, let mgrsStr = MGRSGeodetic.WGS84_MGRS1m(Lat: target[1],Lon: target[2],Alt: target[3]) //htmlString += "

MGRS1m: \(mgrsStr)


" - let urlStr = "https://maps.google.com/maps/search/?api=1&t=k&query=\(mgrsStr)" + let urlStr = "https://www.google.com/maps/search/?api=1&t=k&query=\(mgrsStr)" htmlString += "

MGRS1m: \(mgrsStr)


" if app.settings.unitsMode == .Metric { htmlString += "

Alt: \(altStr)m


" @@ -761,6 +781,8 @@ class LoadCalculateViewController: UIViewController, htmlString += "Altitude: above ground
" } + print("doCalculations: going to get image data") + getImageData() setTextViewText(htmlStr: htmlString) diff --git a/OpenAthenaIOS/SettingsViewController.swift b/OpenAthenaIOS/SettingsViewController.swift index 3add7ac..80f353c 100644 --- a/OpenAthenaIOS/SettingsViewController.swift +++ b/OpenAthenaIOS/SettingsViewController.swift @@ -74,7 +74,7 @@ class SettingsViewController: UIViewController, UIScrollViewDelegate { // set slider parameters; keep consistent with OAAndroid newAZCorrection = app.settings.compassCorrection newAZSliderValue = app.settings.compassSliderValue - azOffsetLabel.text = "Manual Azimuth Correction \(newAZCorrection)" + azOffsetLabel.text = "Manual Azimuth Correction: \(newAZCorrection) \u{00B0}" azOffsetLabel.textAlignment = .center //azOffsetValueLabel.text = "\(newAZCorrection)" azOffsetSlider.minimumValue = 0.0 @@ -210,7 +210,7 @@ class SettingsViewController: UIViewController, UIScrollViewDelegate { newAZCorrection = 0.0 azOffsetSlider.value = 100.0 //azOffsetValueLabel.text = "Manual Azimuth Correction: \(newAZCorrection)" - azOffsetLabel.text = "Manual Azimuth Correction: \(newAZCorrection)" + azOffsetLabel.text = "Manual Azimuth Correction: \(newAZCorrection) \u{00B0}" } // user changed value via slider @@ -221,7 +221,8 @@ class SettingsViewController: UIViewController, UIScrollViewDelegate { newAZCorrection = calculateAZCorrectionOffset(sliderValue: newAZSliderValue) //correctionTextField.text = "Manual Azimuth Correction: \(newCompassCorrection)" //azOffsetValueLabel.text = "\(newAZCorrection)" - azOffsetLabel.text = "Manual Azimuth Correction: \(newAZCorrection)" + // re issue #35, add colon and degree symbol + azOffsetLabel.text = "Manual Azimuth Correction: \(newAZCorrection) \u{00B0}" } // user changed value via text view @@ -328,7 +329,7 @@ extension SettingsViewController: UIPickerViewDelegate { // newCompassCorrection = app.settings.compassCorrection // newCompassSliderValue = app.settings.compassSliderValue // compassOffsetLabel.text = "Manual Azimuth Correction" -// compassOffsetValueLabel.text = "\(newCompassCorrection)" +// compassOffsetValueLabel.text = "\(newCompassCorrection) \u{00B0}" // compassOffsetSlider.minimumValue = 0.0 // compassOffsetSlider.maximumValue = 200.0 // compassOffsetSlider.value = newCompassSliderValue diff --git a/OpenAthenaIOS/ViewController.swift b/OpenAthenaIOS/ViewController.swift index 5746555..58be296 100644 --- a/OpenAthenaIOS/ViewController.swift +++ b/OpenAthenaIOS/ViewController.swift @@ -12,7 +12,7 @@ import UIKit class ViewController: UIViewController { var app: AppDelegate = UIApplication.shared.delegate as! AppDelegate - var version: Double = 2.50 + var version: Double = 2.52 @IBOutlet var textView: UITextView! @IBOutlet var imageView: UIImageView! var dem: DigitalElevationModel? @@ -283,8 +283,11 @@ class ViewController: UIViewController { // we want private func setTextViewText(htmlStr hString: String) { - if let attribString = htmlToAttributedString(fromHTML: hString) { - self.textView.attributedText = attribString + // re issue #37, run all of this on dispatchqueue main + DispatchQueue.main.async { + if let attribString = self.htmlToAttributedString(fromHTML: hString) { + self.textView.attributedText = attribString + } } }