diff --git a/TreeMeasure.xcodeproj/project.pbxproj b/TreeMeasure.xcodeproj/project.pbxproj index 1c6c410..d7a0bfa 100644 --- a/TreeMeasure.xcodeproj/project.pbxproj +++ b/TreeMeasure.xcodeproj/project.pbxproj @@ -290,16 +290,19 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 774CCSDT3V; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = TreeMeasure/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Tree Height"; INFOPLIST_KEY_NSCameraUsageDescription = "Cam for images"; INFOPLIST_KEY_NSMotionUsageDescription = "uses motion"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations = ""; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait; @@ -321,16 +324,19 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 774CCSDT3V; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = TreeMeasure/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Tree Height"; INFOPLIST_KEY_NSCameraUsageDescription = "Cam for images"; INFOPLIST_KEY_NSMotionUsageDescription = "uses motion"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UIRequiresFullScreen = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations = ""; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait; diff --git a/TreeMeasure/Assets.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png b/TreeMeasure/Assets.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png new file mode 100644 index 0000000..5d23709 Binary files /dev/null and b/TreeMeasure/Assets.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png differ diff --git a/TreeMeasure/Assets.xcassets/AppIcon.appiconset/Contents.json b/TreeMeasure/Assets.xcassets/AppIcon.appiconset/Contents.json index 13613e3..16a4fbc 100644 --- a/TreeMeasure/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/TreeMeasure/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "AppIcon~ios-marketing.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" diff --git a/TreeMeasure/Assets.xcassets/Image.imageset/AppIcon~ios-marketing.png b/TreeMeasure/Assets.xcassets/Image.imageset/AppIcon~ios-marketing.png new file mode 100644 index 0000000..5d23709 Binary files /dev/null and b/TreeMeasure/Assets.xcassets/Image.imageset/AppIcon~ios-marketing.png differ diff --git a/TreeMeasure/Assets.xcassets/Image.imageset/Contents.json b/TreeMeasure/Assets.xcassets/Image.imageset/Contents.json new file mode 100644 index 0000000..705ca7b --- /dev/null +++ b/TreeMeasure/Assets.xcassets/Image.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "AppIcon~ios-marketing.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TreeMeasure/Base.lproj/LaunchScreen.storyboard b/TreeMeasure/Base.lproj/LaunchScreen.storyboard index 865e932..a0a5e24 100644 --- a/TreeMeasure/Base.lproj/LaunchScreen.storyboard +++ b/TreeMeasure/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,8 @@ - - + + + - + @@ -11,15 +12,31 @@ - + - + + + + + + + + - + + + + diff --git a/TreeMeasure/Base.lproj/Main.storyboard b/TreeMeasure/Base.lproj/Main.storyboard index 2ff2740..a00fd2a 100644 --- a/TreeMeasure/Base.lproj/Main.storyboard +++ b/TreeMeasure/Base.lproj/Main.storyboard @@ -3,7 +3,7 @@ - + @@ -18,93 +18,131 @@ - + - + - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + Status +1 +2 + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + @@ -113,7 +151,7 @@ - + @@ -127,12 +165,11 @@ - - - - - - + + + + + @@ -142,5 +179,8 @@ + + + diff --git a/TreeMeasure/ViewController.swift b/TreeMeasure/ViewController.swift index 5acbdb2..e4c56dd 100644 --- a/TreeMeasure/ViewController.swift +++ b/TreeMeasure/ViewController.swift @@ -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