improvements in UI and Icons

This commit is contained in:
2024-04-14 14:23:48 +02:00
parent 8a8ba163c6
commit 4461eb428b
8 changed files with 198 additions and 97 deletions

View File

@@ -22,6 +22,7 @@ class ViewController: UIViewController {
var captureSession: AVCaptureSession!
var videoPreviewLayer: AVCaptureVideoPreviewLayer!
var globalQueue: OperationQueue!
@IBOutlet weak var distanceText: UITextView!
var backCamera: AVCaptureDevice!
// VariablesForCalculations
@@ -88,6 +89,16 @@ class ViewController: UIViewController {
motionManager.stopDeviceMotionUpdates()
}
@IBAction func reset() {
topTree = 0
bottomPole = 0
topPole = 0
statusText.text = "To start, please snapshot the top of the reference height."
distanceText.text = ""
}
@IBAction func addMarker() {
let l = Double(inputRefHeight.text ?? "1.0") ?? 1.0
@@ -99,7 +110,7 @@ class ViewController: UIViewController {
topPole = globalAttitude * -1
}
statusText.text = "Snaphost Angle: " + String(format: "%.2f", globalDegrees) + "°.\nNext, snapshot the bottom of the reference height."
statusText.text = "Snaphost Angle: " + String(format: "%.2f", globalDegrees) + "°.\nNext, snapshot bottom of reference height."
return;
}
@@ -109,7 +120,12 @@ class ViewController: UIViewController {
if globalGravityAngle < 0 {
bottomPole = bottomPole * -1
}
statusText.text = "Snapshot Angle: " + String(format: "%.2f", globalDegrees) + "°\nFinally, snapshot the top of the tree."
statusText.text = "Snapshot Angle: " + String(format: "%.2f", globalDegrees) + "°\nFinally, snapshot top ofx tree."
let alpha3 = topPole - Double.pi / 2
let alpha2 = bottomPole - Double.pi / 2
let e = abs(l / ( tan(alpha3) - tan(alpha2)))
distanceText.text = "Distance: " + String(format: "%.2f", e) + " m"
return;
}
@@ -131,7 +147,7 @@ class ViewController: UIViewController {
let h = abs(h1 - h2)
statusText.text = "Height: " + String( format: "%.4f", h) + " m\nSnapshot top of the reference height to measure again."
statusText.text = "Height: " + String( format: "%.4f", h) + " m"
//reset
topTree = 0