From 2966a207dc6241f40ea4ea23cdd5748875ff58f8 Mon Sep 17 00:00:00 2001 From: fatalhck Date: Thu, 3 Nov 2016 11:31:20 -0200 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 222fcfe..a722bce 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Findr is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby -pod "Findr" , :git => 'https://github.com/fatalhck/findr' +pod "Findr" , :git => 'https://github.com/fatalhck/findr/releases/tag/0.2' ``` ## Author From a022a80c788f7123fee5757a7223de83e8a4693b Mon Sep 17 00:00:00 2001 From: fatalhck Date: Mon, 7 Nov 2016 21:37:26 -0200 Subject: [PATCH 2/6] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a722bce..fecf72a 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![License](https://img.shields.io/cocoapods/l/Findr.svg?style=flat)](http://cocoapods.org/pods/Findr) [![Platform](https://img.shields.io/cocoapods/p/Findr.svg?style=flat)](http://cocoapods.org/pods/Findr) +Findr was developed in a AIS Hackathon ## Requirements ## Installation @@ -20,6 +21,11 @@ pod "Findr" , :git => 'https://github.com/fatalhck/findr/releases/tag/0.2' Lucas Neves, Pedro Fabrino, Jonathan Nobre +## Contributors + +Victor Cotrim +Luciano Almeida + ## How to use 1. Create a Capture Session with FindrViewController and verify if result don't have any error From 66d0cd8118377a0198282c8bc91491052b9880f6 Mon Sep 17 00:00:00 2001 From: fatalhck Date: Mon, 7 Nov 2016 21:38:03 -0200 Subject: [PATCH 3/6] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fecf72a..acdc6eb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,9 @@ pod "Findr" , :git => 'https://github.com/fatalhck/findr/releases/tag/0.2' ## Author -Lucas Neves, Pedro Fabrino, Jonathan Nobre +Lucas Neves, +Pedro Fabrino, +Jonathan Nobre ## Contributors From 14e7e66bfe65b0bc889b41a29404644081655b30 Mon Sep 17 00:00:00 2001 From: fatalhck Date: Mon, 7 Nov 2016 21:38:17 -0200 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index acdc6eb..8443740 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Jonathan Nobre ## Contributors -Victor Cotrim +Victor Cotrim \n Luciano Almeida ## How to use From b133a2a0732713f46bb32dc83ca7c100d3f39b48 Mon Sep 17 00:00:00 2001 From: fatalhck Date: Mon, 7 Nov 2016 21:38:27 -0200 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8443740..34f6ed1 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Jonathan Nobre ## Contributors -Victor Cotrim \n +Victor Cotrim Luciano Almeida ## How to use From ec17988b134440dc6ca78386a6297dfaee272917 Mon Sep 17 00:00:00 2001 From: LucianoAlmeida Date: Fri, 25 Nov 2016 15:49:12 -0200 Subject: [PATCH 6/6] Adding a new delegate method that tells the angle of annotation to the user point and bug fix when findr goes to background --- Findr/Classes/FindrConfiguration.swift | 1 + Findr/Classes/FindrTrackingManager.swift | 4 +- Findr/Classes/FindrViewController.swift | 48 ++++++++++++------------ 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/Findr/Classes/FindrConfiguration.swift b/Findr/Classes/FindrConfiguration.swift index a9d31c6..e7ce741 100644 --- a/Findr/Classes/FindrConfiguration.swift +++ b/Findr/Classes/FindrConfiguration.swift @@ -71,6 +71,7 @@ internal func deltaAngle(_ angle1: Double, angle2: Double) -> Double //MARK: FindrViewController Delegate protocol FindrViewControllerDelegate { + func findrViewControllerUpdateAngleForAnnotation(findrViewController: FindrViewController,annotation: FindrAnnotation , angle: CGFloat) func findrViewControllerFixedVerticalPositionForAnnotation(findrViewController: FindrViewController)-> CGFloat? func findrViewControllerWillShowAnnotationView(findrViewController: FindrViewController, annotationView: FindrAnnotationView) func findrViewControllerWillReloadAnnotations(findrViewController: FindrViewController, annotations: [FindrAnnotation]) diff --git a/Findr/Classes/FindrTrackingManager.swift b/Findr/Classes/FindrTrackingManager.swift index c1ef2bc..a360048 100644 --- a/Findr/Classes/FindrTrackingManager.swift +++ b/Findr/Classes/FindrTrackingManager.swift @@ -270,7 +270,6 @@ open class FindrTrackingManager: NSObject, CLLocationManagerDelegate { angle = atan2(-self.lastAcceleration.x, self.lastAcceleration.z) } - angle += M_PI_2 angle = (self.pitchPrevious + angle) / 2.0 self.pitchPrevious = angle @@ -295,9 +294,8 @@ open class FindrTrackingManager: NSObject, CLLocationManagerDelegate // Simplified azimuth calculation azimuth = radiansToDegrees(atan2(longitudeDistance, (latitudeDistance * Double(LAT_LON_FACTOR)))) -// TODO: Não TIREI 40 azimuth += 180.0 - + return azimuth; } diff --git a/Findr/Classes/FindrViewController.swift b/Findr/Classes/FindrViewController.swift index 9e836be..af0a3b4 100644 --- a/Findr/Classes/FindrViewController.swift +++ b/Findr/Classes/FindrViewController.swift @@ -198,14 +198,13 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate NotificationCenter.default.addObserver(self, selector: #selector(FindrViewController.locationNotification(_:)), name: NSNotification.Name(rawValue: "kNotificationLocationSet"), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(FindrViewController.appWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil) - + NotificationCenter.default.addObserver(self, selector: #selector(FindrViewController.appWillResignActive(_:)), name: NSNotification.Name.UIApplicationWillResignActive, object: nil) self.initialize() } /// Intended for use in subclasses, no need to call super internal func initialize() { - } deinit @@ -337,24 +336,30 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate self.degreesPerScreen = (self.view.bounds.size.width / OVERLAY_VIEW_WIDTH) * 360.0 } + internal func appWillResignActive(_ notification: Notification){ +// debugPrint(#function) + self.trackingManager.stopTracking() + + } + + internal func appWillEnterForeground(_ notification: Notification) { if(self.view.window != nil) { // Removing all from screen and restarting location manager. - for annotation in self.annotations - { - annotation.annotationView = nil - } - - for annotationView in self.annotationViews - { - annotationView.removeFromSuperview() - } - - self.annotationViews = [] - shouldReloadAnnotations = true; - self.trackingManager.stopTracking() +// for annotation in self.annotations +// { +// annotation.annotationView = nil +// } +// +// for annotationView in self.annotationViews +// { +// annotationView.removeFromSuperview() +// } +// +// self.annotationViews = [] +// shouldReloadAnnotations = true self.trackingManager.startTracking() } } @@ -512,7 +517,7 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate { //minor distance between two angles let delta = deltaAngle(currentHeading, angle2: annotationView.annotation!.azimuth) - +// debugPrint("delta = \(delta), degreesDelta = \(degreesDelta), currentHeading = \(currentHeading)") if fabs(delta) < degreesDelta && annotationView.annotation!.verticalLevel <= self.maxVerticalLevel { // put head annotation on view @@ -539,6 +544,8 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate } } } + delegate?.findrViewControllerUpdateAngleForAnnotation(findrViewController: self, annotation: annotationView.annotation!, angle: CGFloat(delta) + 180) + } } @@ -576,7 +583,6 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate let x = self.xPositionForAnnotationView(annotationView, heading: self.trackingManager.heading) let y = self.yPositionForAnnotationView(annotationView) - print("x= \(x), y = \(y)") annotationView.frame = CGRect(x: x, y: y, width: annotationView.bounds.size.width, height: annotationView.bounds.size.height) } } @@ -585,10 +591,6 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate { if annotationView.annotation == nil { return 0 } -// if let fixedPosition = delegate?.findrViewControllerFixedPositionForAnnotation(findrViewController: self){ -// return fixedPosition.x -// } - let annotation = annotationView.annotation! // Azimuth @@ -624,10 +626,6 @@ open class FindrViewController: UIViewController, FindrTrackingManagerDelegate fileprivate func yPositionForAnnotationView(_ annotationView: FindrAnnotationView) -> CGFloat { -// if let fixedPosition = delegate?.findrViewControllerFixedPositionForAnnotation(findrViewController: self){ -// return fixedPosition.y -// } - var distanceInM = annotationView.annotation?.beaconDistance let initialScale = 5.0