Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit in the new repo. No old revisions. Oh well.

  • Loading branch information...
commit ed91f1cae029ba19c6ff6879b096c49c0c930b6a 0 parents
@zac authored
30 ARKitDemo/ARKitDemo-Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+</dict>
+</plist>
285 ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj
@@ -0,0 +1,285 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1118A9AA1025701300C94460 /* ChromelessImagePickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1118A9A91025701300C94460 /* ChromelessImagePickerViewController.m */; };
+ 1118AA4A10257DCE00C94460 /* location.png in Resources */ = {isa = PBXBuildFile; fileRef = 1118AA4910257DCE00C94460 /* location.png */; };
+ 111A141C1024C875002D39A1 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 111A141B1024C875002D39A1 /* CoreLocation.framework */; };
+ 111A142C1024C8A6002D39A1 /* ARViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 111A142A1024C8A6002D39A1 /* ARViewController.m */; };
+ 112543AA1024DE590086106E /* ARCoordinate.m in Sources */ = {isa = PBXBuildFile; fileRef = 112543A91024DE590086106E /* ARCoordinate.m */; };
+ 11609B0B1026014F00A964C8 /* ARGeoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 11609B0A1026014F00A964C8 /* ARGeoViewController.m */; };
+ 1D3623260D0F684500981E51 /* ARKitDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* ARKitDemoAppDelegate.m */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
+ CE169F581025704E00556F8F /* ARGeoCoordinate.m in Sources */ = {isa = PBXBuildFile; fileRef = CE169F571025704E00556F8F /* ARGeoCoordinate.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1118A9A81025701300C94460 /* ChromelessImagePickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChromelessImagePickerViewController.h; sourceTree = "<group>"; };
+ 1118A9A91025701300C94460 /* ChromelessImagePickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChromelessImagePickerViewController.m; sourceTree = "<group>"; };
+ 1118AA4910257DCE00C94460 /* location.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = location.png; sourceTree = "<group>"; };
+ 111A141B1024C875002D39A1 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
+ 111A142A1024C8A6002D39A1 /* ARViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARViewController.m; sourceTree = "<group>"; };
+ 111A142B1024C8A6002D39A1 /* ARViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARViewController.h; sourceTree = "<group>"; };
+ 112543A81024DE590086106E /* ARCoordinate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARCoordinate.h; sourceTree = "<group>"; };
+ 112543A91024DE590086106E /* ARCoordinate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARCoordinate.m; sourceTree = "<group>"; };
+ 11609B091026014F00A964C8 /* ARGeoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARGeoViewController.h; sourceTree = "<group>"; };
+ 11609B0A1026014F00A964C8 /* ARGeoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARGeoViewController.m; sourceTree = "<group>"; };
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D3623240D0F684500981E51 /* ARKitDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARKitDemoAppDelegate.h; sourceTree = "<group>"; };
+ 1D3623250D0F684500981E51 /* ARKitDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARKitDemoAppDelegate.m; sourceTree = "<group>"; };
+ 1D6058910D05DD3D006BFB54 /* ARKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ARKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* ARKitDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARKitDemo_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* ARKitDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ARKitDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+ CE169F561025704E00556F8F /* ARGeoCoordinate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARGeoCoordinate.h; sourceTree = "<group>"; };
+ CE169F571025704E00556F8F /* ARGeoCoordinate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARGeoCoordinate.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
+ 111A141C1024C875002D39A1 /* CoreLocation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 111A142D1024C8AC002D39A1 /* ARKIt */,
+ 1D3623240D0F684500981E51 /* ARKitDemoAppDelegate.h */,
+ 1D3623250D0F684500981E51 /* ARKitDemoAppDelegate.m */,
+ );
+ path = Classes;
+ sourceTree = "<group>";
+ };
+ 111A142D1024C8AC002D39A1 /* ARKIt */ = {
+ isa = PBXGroup;
+ children = (
+ 1118A9A81025701300C94460 /* ChromelessImagePickerViewController.h */,
+ 1118A9A91025701300C94460 /* ChromelessImagePickerViewController.m */,
+ 112543A81024DE590086106E /* ARCoordinate.h */,
+ 112543A91024DE590086106E /* ARCoordinate.m */,
+ 111A142B1024C8A6002D39A1 /* ARViewController.h */,
+ 111A142A1024C8A6002D39A1 /* ARViewController.m */,
+ CE169F561025704E00556F8F /* ARGeoCoordinate.h */,
+ CE169F571025704E00556F8F /* ARGeoCoordinate.m */,
+ 11609B091026014F00A964C8 /* ARGeoViewController.h */,
+ 11609B0A1026014F00A964C8 /* ARGeoViewController.m */,
+ );
+ name = ARKIt;
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* ARKitDemo.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 32CA4F630368D1EE00C91783 /* ARKitDemo_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 1118AA4910257DCE00C94460 /* location.png */,
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
+ 8D1107310486CEB800E47090 /* ARKitDemo-Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 111A141B1024C875002D39A1 /* CoreLocation.framework */,
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* ARKitDemo */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "ARKitDemo" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ARKitDemo;
+ productName = ARKitDemo;
+ productReference = 1D6058910D05DD3D006BFB54 /* ARKitDemo.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ARKitDemo" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* ARKitDemo */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
+ 1118AA4A10257DCE00C94460 /* location.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ 1D3623260D0F684500981E51 /* ARKitDemoAppDelegate.m in Sources */,
+ 111A142C1024C8A6002D39A1 /* ARViewController.m in Sources */,
+ 112543AA1024DE590086106E /* ARCoordinate.m in Sources */,
+ 1118A9AA1025701300C94460 /* ChromelessImagePickerViewController.m in Sources */,
+ CE169F581025704E00556F8F /* ARGeoCoordinate.m in Sources */,
+ 11609B0B1026014F00A964C8 /* ARGeoViewController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = ARKitDemo_Prefix.pch;
+ INFOPLIST_FILE = "ARKitDemo-Info.plist";
+ PRODUCT_NAME = ARKitDemo;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = ARKitDemo_Prefix.pch;
+ INFOPLIST_FILE = "ARKitDemo-Info.plist";
+ PRODUCT_NAME = ARKitDemo;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.0;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.0;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "ARKitDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ARKitDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
8 ARKitDemo/ARKitDemo_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'ARKitDemo' target in the 'ARKitDemo' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
34 ARKitDemo/Classes/ARCoordinate.h
@@ -0,0 +1,34 @@
+//
+// ARCoordinate.h
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface ARCoordinate : NSObject {
+ double radialDistance;
+ double inclination;
+ double azimuth;
+
+ NSString *title;
+ NSString *subtitle;
+}
+
+- (NSUInteger)hash;
+- (BOOL)isEqual:(id)other;
+- (BOOL)isEqualToCoordinate:(ARCoordinate *)otherCoordinate;
+
++ (ARCoordinate *)coordinateWithRadialDistance:(double)newRadialDistance inclination:(double)newInclination azimuth:(double)newAzimuth;
+
+@property (nonatomic, retain) NSString *title;
+@property (nonatomic, copy) NSString *subtitle;
+
+@property (nonatomic) double radialDistance;
+@property (nonatomic) double inclination;
+@property (nonatomic) double azimuth;
+
+@end
64 ARKitDemo/Classes/ARCoordinate.m
@@ -0,0 +1,64 @@
+//
+// ARCoordinate.m
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import "ARCoordinate.h"
+
+
+@implementation ARCoordinate
+
+@synthesize radialDistance, inclination, azimuth;
+
+@synthesize title, subtitle;
+
++ (ARCoordinate *)coordinateWithRadialDistance:(double)newRadialDistance inclination:(double)newInclination azimuth:(double)newAzimuth {
+ ARCoordinate *newCoordinate = [[ARCoordinate alloc] init];
+ newCoordinate.radialDistance = newRadialDistance;
+ newCoordinate.inclination = newInclination;
+ newCoordinate.azimuth = newAzimuth;
+
+ newCoordinate.title = @"Testing!";
+
+ return [newCoordinate autorelease];
+}
+
+- (NSUInteger)hash{
+ return [self.title hash];
+}
+
+- (BOOL)isEqual:(id)other {
+ if (other == self)
+ return YES;
+ if (!other || ![other isKindOfClass:[self class]])
+ return NO;
+ return [self isEqualToCoordinate:other];
+}
+
+- (BOOL)isEqualToCoordinate:(ARCoordinate *)otherCoordinate {
+ if (self == otherCoordinate) return YES;
+
+ BOOL equal = self.radialDistance == otherCoordinate.radialDistance;
+ equal = equal && self.inclination == otherCoordinate.inclination;
+ equal = equal && self.azimuth == otherCoordinate.azimuth;
+ equal = equal && [self.title isEqualToString:otherCoordinate.title];
+
+ return equal;
+}
+
+- (void)dealloc {
+
+ self.title = nil;
+ self.subtitle = nil;
+
+ [super dealloc];
+}
+
+- (NSString *)description {
+ return [NSString stringWithFormat:@"%@ r: %f φ: %f θ: %f", self.title, self.radialDistance, self.azimuth * (180.0/M_PI), self.inclination * (180.0/M_PI)];
+}
+
+@end
25 ARKitDemo/Classes/ARGeoCoordinate.h
@@ -0,0 +1,25 @@
+//
+// ARGeoCoordinate.h
+// ARKitDemo
+//
+// Created by Haseman on 8/1/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "ARCoordinate.h"
+
+#import <CoreLocation/CoreLocation.h>
+
+@interface ARGeoCoordinate : ARCoordinate {
+ CLLocation *geoLocation;
+}
+
+@property (nonatomic, retain) CLLocation *geoLocation;
+
++ (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location;
+
+- (void)calibrateUsingOrigin:(CLLocation *)origin;
++ (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location fromOrigin:(CLLocation *)origin;
+
+@end
77 ARKitDemo/Classes/ARGeoCoordinate.m
@@ -0,0 +1,77 @@
+//
+// ARGeoCoordinate.m
+// ARKitDemo
+//
+// Created by Haseman on 8/1/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import "ARGeoCoordinate.h"
+
+
+@implementation ARGeoCoordinate
+
+@synthesize geoLocation;
+
+double ToRad( double nVal )
+{
+ return nVal * (M_PI/180);
+}
+
+double CalculateDistance( double nLat1, double nLon1, double nLat2, double nLon2 )
+{
+ double nRadius = 6371; // Earth's radius in Kilometers
+
+ // Get the difference between our two points then convert the difference into radians
+ double nDLat = ToRad(nLat2 - nLat1);
+ double nDLon = ToRad(nLon2 - nLon1);
+
+ nLat1 = ToRad(nLat1);
+ nLat2 = ToRad(nLat2);
+
+ double nA = pow ( sin(nDLat/2), 2 ) +
+ cos(nLat1) * cos(nLat2) *
+ pow ( sin(nDLon/2), 2 );
+
+ double nC = 2 * atan2( sqrt(nA), sqrt( 1 - nA ));
+ double nD = nRadius * nC;
+
+ return nD; // Return our calculated distance
+}
+
+float CalculateAngle(float nLat1, float nLon1, float nLat2, float nLon2)
+{
+
+ float longitudinalDifference = nLon2 - nLon1;
+ float latitudinalDifference = nLat2 - nLat1;
+ float azimuth = (M_PI * .5f) - atan(latitudinalDifference / longitudinalDifference);
+ if (longitudinalDifference > 0) return azimuth;
+ else if (longitudinalDifference < 0) return azimuth + M_PI;
+ else if (latitudinalDifference < 0) return M_PI;
+ return 0.0f;
+}
+
+- (void)calibrateUsingOrigin:(CLLocation *)origin {
+ self.radialDistance = CalculateDistance(origin.coordinate.latitude, origin.coordinate.longitude, self.geoLocation.coordinate.latitude, self.geoLocation.coordinate.longitude);
+ //self.inclination = 0.0; // TODO: Make with altitude.
+ self.azimuth = CalculateAngle(origin.coordinate.latitude, origin.coordinate.longitude, self.geoLocation.coordinate.latitude, self.geoLocation.coordinate.longitude);
+}
+
++ (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location {
+ ARGeoCoordinate *newCoordinate = [[ARGeoCoordinate alloc] init];
+ newCoordinate.geoLocation = location;
+
+ newCoordinate.title = @"GEO!";
+
+ return [newCoordinate autorelease];
+}
+
++ (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location fromOrigin:(CLLocation *)origin {
+ ARGeoCoordinate *newCoordinate = [ARGeoCoordinate coordinateWithLocation:location];
+
+ [newCoordinate calibrateUsingOrigin:origin];
+
+ return newCoordinate;
+}
+
+@end
19 ARKitDemo/Classes/ARGeoViewController.h
@@ -0,0 +1,19 @@
+//
+// ARGeoViewController.h
+// ARKitDemo
+//
+// Created by Zac White on 8/2/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "ARViewController.h"
+
+@interface ARGeoViewController : ARViewController {
+ CLLocation *centerLocation;
+}
+
+@property (nonatomic, retain) CLLocation *centerLocation;
+
+@end
30 ARKitDemo/Classes/ARGeoViewController.m
@@ -0,0 +1,30 @@
+//
+// ARGeoViewController.m
+// ARKitDemo
+//
+// Created by Zac White on 8/2/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import "ARGeoViewController.h"
+
+#import "ARGeoCoordinate.h"
+
+@implementation ARGeoViewController
+
+@synthesize centerLocation;
+
+- (void)setCenterLocation:(CLLocation *)newLocation {
+ [centerLocation release];
+ centerLocation = [newLocation retain];
+
+ for (ARGeoCoordinate *geoLocation in self.locationItems) {
+ if ([geoLocation isKindOfClass:[ARGeoCoordinate class]]) {
+ [geoLocation calibrateUsingOrigin:centerLocation];
+
+ NSLog(@"geo: %@", geoLocation);
+ }
+ }
+}
+
+@end
22 ARKitDemo/Classes/ARKitDemoAppDelegate.h
@@ -0,0 +1,22 @@
+//
+// ARKitDemoAppDelegate.h
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright Gravity Mobile 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "ARGeoViewController.h"
+
+@interface ARKitDemoAppDelegate : NSObject <UIApplicationDelegate, ARViewDelegate> {
+ UIWindow *window;
+}
+
+- (UIView *)viewForCoordinate:(ARCoordinate *)coordinate;
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+
+@end
+
257 ARKitDemo/Classes/ARKitDemoAppDelegate.m
@@ -0,0 +1,257 @@
+//
+// ARKitDemoAppDelegate.m
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright Gravity Mobile 2009. All rights reserved.
+//
+
+#import "ARKitDemoAppDelegate.h"
+#import "ARGeoCoordinate.h"
+
+@implementation ARKitDemoAppDelegate
+
+@synthesize window;
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+
+ ARGeoViewController *viewController = [[ARGeoViewController alloc] init];
+
+ viewController.delegate = self;
+
+ NSMutableArray *tempLocationArray = [[NSMutableArray alloc] initWithCapacity:10];
+
+ CLLocation *tempLocation;
+ ARGeoCoordinate *tempCoordinate;
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:39.550051 longitude:-105.782067];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/10;
+ tempCoordinate.title = @"Denver";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:45.523875 longitude:-122.670399];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Portland";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:41.879535 longitude:-87.624333];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Chicago";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:30.268735 longitude:-97.745209];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Austin";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:51.500152 longitude:-0.126236];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/30;
+ tempCoordinate.title = @"London";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:48.856667 longitude:2.350987];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/30;
+ tempCoordinate.title = @"Paris";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:47.620973 longitude:-122.347276];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Seattle";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:20.593684 longitude:78.96288];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/32;
+ tempCoordinate.title = @"India";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:55.676294 longitude:12.568116];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/30;
+ tempCoordinate.title = @"Copenhagen";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:52.373801 longitude:4.890935];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/30;
+ tempCoordinate.title = @"Amsterdam";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:-40.900557 longitude:174.885971];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/40;
+ tempCoordinate.title = @"New Zealand";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:40.756054 longitude:-73.986951];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"New York City";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:42.35892 longitude:-71.05781];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Boston";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:49.817492 longitude:15.472962];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/30;
+ tempCoordinate.title = @"Czech Republic";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:53.41291 longitude:-8.24389];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.inclination = M_PI/30;
+ tempCoordinate.title = @"Ireland";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:45.545447 longitude:-73.639076];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Montreal";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:38.892091 longitude:-77.024055];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Washington, DC";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:-40.900557 longitude:174.885971];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Munich";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ tempLocation = [[CLLocation alloc] initWithLatitude:48.139127 longitude:11.580186];
+
+ tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
+ tempCoordinate.title = @"Dallas";
+
+ [tempLocationArray addObject:tempCoordinate];
+ [tempLocation release];
+
+
+ viewController.locationItems = tempLocationArray;
+ [tempLocationArray release];
+
+ CLLocation *newCenter = [[CLLocation alloc] initWithLatitude:37.41711 longitude:-122.02528];
+
+ viewController.centerLocation = newCenter;
+ [newCenter release];
+
+ [viewController startListening];
+
+ [window addSubview:viewController.view];
+
+ // Override point for customization after application launch
+ [window makeKeyAndVisible];
+}
+
+#define BOX_WIDTH 150
+#define BOX_HEIGHT 100
+
+- (UIView *)viewForCoordinate:(ARCoordinate *)coordinate {
+
+ CGRect theFrame = CGRectMake(0, 0, BOX_WIDTH, BOX_HEIGHT);
+ UIView *tempView = [[UIView alloc] initWithFrame:theFrame];
+
+ UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, BOX_WIDTH, 20.0)];
+ titleLabel.backgroundColor = [UIColor colorWithWhite:.3 alpha:.8];
+ titleLabel.textColor = [UIColor whiteColor];
+ titleLabel.textAlignment = UITextAlignmentCenter;
+ titleLabel.text = coordinate.title;
+ [titleLabel sizeToFit];
+
+ titleLabel.frame = CGRectMake(BOX_WIDTH / 2.0 - titleLabel.frame.size.width / 2.0 - 4.0, 0, titleLabel.frame.size.width + 8.0, titleLabel.frame.size.height + 8.0);
+
+ UIImageView *pointView = [[UIImageView alloc] initWithFrame:CGRectZero];
+ pointView.image = [UIImage imageNamed:@"location.png"];
+ pointView.frame = CGRectMake((int)(BOX_WIDTH / 2.0 - pointView.image.size.width / 2.0), (int)(BOX_HEIGHT / 2.0 - pointView.image.size.height / 2.0), pointView.image.size.width, pointView.image.size.height);
+
+ [tempView addSubview:titleLabel];
+ [tempView addSubview:pointView];
+
+ return [tempView autorelease];
+}
+
+
+- (void)dealloc {
+ [window release];
+ [super dealloc];
+}
+
+
+@end
62 ARKitDemo/Classes/ARViewController.h
@@ -0,0 +1,62 @@
+//
+// ARKViewController.h
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import <CoreLocation/CoreLocation.h>
+
+#import "ARCoordinate.h"
+
+#import "ChromelessImagePickerViewController.h"
+
+@protocol ARViewDelegate
+
+- (UIView *)viewForCoordinate:(ARCoordinate *)coordinate;
+
+@end
+
+
+@interface ARViewController : UIViewController <UIAccelerometerDelegate, CLLocationManagerDelegate> {
+ CLLocationManager *locationManager;
+ UIAccelerometer *accelerometerManager;
+
+ ARCoordinate *centerCoordinate;
+
+ NSRange *widthViewportRange;
+ NSRange *heightViewportRange;
+
+ UILabel *locationLabel;
+
+ id delegate;
+
+ ChromelessImagePickerViewController *picker;
+
+ NSArray *locationItems;
+ NSArray *locationViews;
+}
+
+- (void)startListening;
+- (void)updateLocations;
+
+- (CGPoint)pointInView:(UIView *)realityView forCoordinate:(ARCoordinate *)coordinate;
+
+- (BOOL)viewportContainsCoordinate:(ARCoordinate *)coordinate;
+
+@property (nonatomic, assign) id delegate;
+
+@property (nonatomic, retain) ChromelessImagePickerViewController *picker;
+
+@property (retain) ARCoordinate *centerCoordinate;
+
+@property (nonatomic, retain) NSArray *locationItems;
+@property (nonatomic, copy) NSArray *locationViews;
+
+@property (nonatomic, retain) UIAccelerometer *accelerometerManager;
+@property (nonatomic, retain) CLLocationManager *locationManager;
+
+@end
284 ARKitDemo/Classes/ARViewController.m
@@ -0,0 +1,284 @@
+//
+// ARKViewController.m
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright 2009 Gravity Mobile. All rights reserved.
+//
+
+#import "ARViewController.h"
+
+#import "ChromelessImagePickerViewController.h"
+
+#define VIEWPORT_WIDTH_RADIANS .7392
+#define VIEWPORT_HEIGHT_RADIANS .5
+
+@implementation ARViewController
+
+@synthesize locationManager, accelerometerManager;
+@synthesize centerCoordinate, locationItems, locationViews;
+
+@synthesize delegate;
+
+@synthesize picker;
+
+// Implement loadView to create a view hierarchy programmatically, without using a nib.
+- (void)loadView {
+ UIView *contentView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
+
+ self.picker = [[[ChromelessImagePickerViewController alloc] init] autorelease];
+ self.picker.allowsImageEditing = NO;
+
+ // make sure camera is avaialble before setting it as source
+ //
+ if ([ChromelessImagePickerViewController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
+#if !TARGET_IPHONE_SIMULATOR
+ self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
+#endif
+ }
+
+ [contentView addSubview:self.picker.view];
+
+ contentView.backgroundColor = [UIColor clearColor];
+
+ locationLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 270.0, 480.0, 30.0)];
+ locationLabel.textAlignment = UITextAlignmentCenter;
+ locationLabel.text = @"Waiting...";
+
+ [contentView addSubview:locationLabel];
+
+ self.view = contentView;
+ [contentView release];
+}
+
+- (void)viewDidLoad {
+ self.picker.view.frame = CGRectMake(0, 0, self.view.frame.size.height, self.view.frame.size.width);
+
+ NSLog(@"frame: %@", NSStringFromCGRect(self.picker.view.frame));
+
+ self.picker.view.transform = CGAffineTransformMakeRotation(- M_PI / 2.0);
+}
+
+- (BOOL)viewportContainsCoordinate:(ARCoordinate *)coordinate {
+ double centerAzimuth = self.centerCoordinate.azimuth;
+ double leftAzimuth = centerAzimuth - VIEWPORT_WIDTH_RADIANS / 2.0;
+
+ if (leftAzimuth < 0.0) {
+ leftAzimuth = 2 * M_PI + leftAzimuth;
+ }
+
+ double rightAzimuth = centerAzimuth + VIEWPORT_WIDTH_RADIANS / 2.0;
+
+ if (rightAzimuth > 2 * M_PI) {
+ rightAzimuth = rightAzimuth - 2 * M_PI;
+ }
+
+ BOOL result = (coordinate.azimuth > leftAzimuth && coordinate.azimuth < rightAzimuth);
+
+ if(leftAzimuth > rightAzimuth) {
+ result = (coordinate.azimuth < rightAzimuth || coordinate.azimuth > leftAzimuth);
+ }
+
+ double centerInclination = self.centerCoordinate.inclination;
+ double bottomInclination = centerInclination - VIEWPORT_HEIGHT_RADIANS / 2.0;
+ double topInclination = centerInclination + VIEWPORT_HEIGHT_RADIANS / 2.0;
+
+ //check the height.
+ result = result && (coordinate.inclination > bottomInclination && coordinate.inclination < topInclination);
+
+ return result;
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return interfaceOrientation == UIInterfaceOrientationLandscapeRight;
+}
+
+- (void)startListening {
+
+ //start our heading readings and our accelerometer readings.
+
+ if (!self.locationManager) {
+ self.locationManager = [[[CLLocationManager alloc] init] autorelease];
+
+ //we want every move.
+ self.locationManager.headingFilter = kCLHeadingFilterNone;
+
+ [self.locationManager startUpdatingHeading];
+ self.locationManager.delegate = self;
+ }
+
+ if (!self.accelerometerManager) {
+ self.accelerometerManager = [UIAccelerometer sharedAccelerometer];
+ self.accelerometerManager.updateInterval = 0.01;
+ self.accelerometerManager.delegate = self;
+ }
+
+ if (!self.centerCoordinate) {
+ self.centerCoordinate = [ARCoordinate coordinateWithRadialDistance:0 inclination:0 azimuth:0];
+ }
+}
+
+- (CGPoint)pointInView:(UIView *)realityView forCoordinate:(ARCoordinate *)coordinate {
+
+ CGPoint point;
+
+ //x coordinate.
+
+ double pointAzimuth = coordinate.azimuth;
+
+ //our x numbers are left based.
+ double leftAzimuth = self.centerCoordinate.azimuth - VIEWPORT_WIDTH_RADIANS / 2.0;
+
+ if (leftAzimuth < 0.0) {
+ leftAzimuth = 2 * M_PI + leftAzimuth;
+ }
+
+ if (pointAzimuth < leftAzimuth) {
+ //it's past the 0 point.
+ point.x = ((2 * M_PI - leftAzimuth + pointAzimuth) / VIEWPORT_WIDTH_RADIANS) * realityView.frame.size.height;
+ } else {
+
+ point.x = ((pointAzimuth - leftAzimuth) / VIEWPORT_WIDTH_RADIANS) * realityView.frame.size.height;
+
+ if ([coordinate.title isEqualToString:@"Portland"]) {
+ NSLog(@"point.x: %f, pointAzimuth: %f, leftAzimuth: %f", point.x, pointAzimuth, leftAzimuth);
+ }
+ }
+
+ //y coordinate.
+
+ double pointInclination = coordinate.inclination;
+
+ double topInclination = self.centerCoordinate.inclination - VIEWPORT_HEIGHT_RADIANS / 2.0;
+
+ point.y = realityView.frame.size.width - ((pointInclination - topInclination) / VIEWPORT_HEIGHT_RADIANS) * realityView.frame.size.width;
+
+ return point;
+}
+
+#define kFilteringFactor 0.05
+UIAccelerationValue rollingX, rollingZ;
+
+- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
+ // -1 face down.
+ // 1 face up.
+
+ //update the center coordinate.
+
+ rollingX = (acceleration.x * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor));
+ rollingZ = (acceleration.z * kFilteringFactor) + (rollingZ * (1.0 - kFilteringFactor));
+
+ if (rollingX > 0.0) {
+ self.centerCoordinate.inclination = - atan(rollingZ / rollingX) - M_PI;
+ } else if (rollingX < 0.0) {
+ self.centerCoordinate.inclination = - atan(rollingZ / rollingX);// + M_PI;
+ } else if (rollingZ < 0) {
+ self.centerCoordinate.inclination = M_PI/2.0;
+ } else if (rollingZ >= 0) {
+ self.centerCoordinate.inclination = 3 * M_PI/2.0;
+ }
+
+ [self updateLocations];
+}
+
+NSComparisonResult LocationSortClosestFirst(ARCoordinate *s1, ARCoordinate *s2, void *ignore) {
+ if (s1.radialDistance < s2.radialDistance) {
+ return NSOrderedAscending;
+ } else if (s1.radialDistance > s2.radialDistance) {
+ return NSOrderedDescending;
+ } else {
+ return NSOrderedSame;
+ }
+}
+
+- (void)setLocationItems:(NSArray *)newItems {
+ [locationItems release];
+ locationItems = [newItems retain];
+
+ NSMutableArray *sortedArray = [NSMutableArray arrayWithArray:newItems];
+ [sortedArray sortUsingFunction:LocationSortClosestFirst context:NULL];
+ locationItems = [sortedArray copy];
+
+ NSMutableArray *tempArray = [NSMutableArray array];
+
+ for (ARCoordinate *coordinate in newItems) {
+ //create the views here.
+
+ //call out for the delegate's view.
+ if ([self.delegate respondsToSelector:@selector(viewForCoordinate:)]) {
+ [tempArray addObject:[self.delegate viewForCoordinate:coordinate]];
+ }
+ }
+
+ self.locationViews = tempArray;
+}
+
+- (void)updateLocations {
+ //update locations!
+
+ if (!self.locationViews || self.locationViews.count == 0) {
+ return;
+ }
+
+ locationLabel.text = [self.centerCoordinate description];
+
+ int index = 0;
+ for (ARCoordinate *item in self.locationItems) {
+
+ UIView *viewToDraw = [self.locationViews objectAtIndex:index];
+
+ if ([self viewportContainsCoordinate:item]) {
+ CGPoint loc = [self pointInView:self.view forCoordinate:item];
+
+ float width = viewToDraw.frame.size.width;
+ float height = viewToDraw.frame.size.height;
+
+ viewToDraw.frame = CGRectMake(loc.x - width / 2.0, loc.y - width / 2.0, width, height);
+
+ [self.view addSubview:viewToDraw];
+
+ } else {
+ [viewToDraw removeFromSuperview];
+ }
+ index++;
+ }
+}
+
+- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
+ self.centerCoordinate.azimuth = fmod(newHeading.trueHeading + 90.0, 360.0) * (2 * (M_PI / 360.0));
+ [self updateLocations];
+}
+
+- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager {
+ return YES;
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+ [self.picker viewDidAppear:animated];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+ [self.picker viewWillAppear:animated];
+}
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ self.picker = nil;
+
+ [super dealloc];
+}
+
+
+@end
27 ARKitDemo/Classes/ChromelessImagePickerViewController.h
@@ -0,0 +1,27 @@
+//
+// SpookImagePickerViewController.h
+// Spook
+//
+// Created by Arshad Tayyeb on 8/1/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+
+// ORIGINALLY: http://www.codza.com/custom-uiimagepickercontroller-camera-view
+// CustomImagePicker.h
+// meanPhoto
+//
+// Created by lajos kamocsay on 1/10/09.
+// Copyright 2009 soymint.com. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface ChromelessImagePickerViewController : UIImagePickerController {
+ NSTimer *pTimer;
+}
+
+@property (nonatomic, retain) NSTimer *pTimer;
+
+@end
147 ARKitDemo/Classes/ChromelessImagePickerViewController.m
@@ -0,0 +1,147 @@
+//
+// SpookImagePickerViewController.m
+// Spook
+//
+// Created by Arshad Tayyeb on 8/1/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+// ORIGINALLY: http://www.codza.com/custom-uiimagepickercontroller-camera-view
+// CustomImagePicker.m
+// meanPhoto
+//
+// Created by lajos kamocsay on 1/10/09.
+// Copyright 2009 soymint.com. All rights reserved.
+//
+
+#import "ChromelessImagePickerViewController.h"
+
+
+@implementation ChromelessImagePickerViewController
+
+@synthesize pTimer;
+
+-(void)setPreviewTimer:(NSTimer *)timer {
+ if (pTimer != timer) {
+ [pTimer invalidate];
+ [pTimer release];
+ pTimer = [timer retain];
+ }
+}
+
+-(void) dealloc {
+ [pTimer release];
+ [super dealloc];
+}
+
+//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+// return interfaceOrientation == UIInterfaceOrientationLandscapeRight;
+//}
+
+#define kPreviewTimerInterval 0.2 // once every five seconds
+
+// in the default camera interface the preview is presented at a slightly different
+// scale than the camera view- this method applies a transformation to the view containg
+// the preview image to match the size to the camera view
+//
+// NOTE: tested only for portrait images
+//
+-(void)previewCheck {
+ [self inspectView:self.view depth:0 path:@""];
+ // for debug: print view hierarchy
+// [self inspectView:self.view depth:0 path:@""];
+
+#if !TARGET_IPHONE_SIMULATOR
+ UIView *cameraChrome = [[[[[[[[[[[[self.view subviews] objectAtIndex:0]
+ subviews] objectAtIndex: 0]
+ subviews] objectAtIndex: 0]
+ subviews] objectAtIndex: 0]
+ subviews] objectAtIndex: 2]
+ subviews] objectAtIndex: 0]
+ ;
+ [cameraChrome setHidden:YES];
+
+ // /0/0/0/0/1
+ UIView *focusIndicator = [[[[[[[[[[self.view subviews] objectAtIndex:0]
+ subviews] objectAtIndex: 0]
+ subviews] objectAtIndex: 0]
+ subviews] objectAtIndex: 0]
+ subviews] objectAtIndex: 1]
+ ;
+ [focusIndicator setAlpha:0.0];
+
+#endif
+
+}
+
+-(NSString *)stringPad:(int)numPad {
+ NSMutableString *pad = [NSMutableString stringWithCapacity:1024];
+ for (int i=0; i<numPad; i++) {
+ [pad appendString:@" "];
+ }
+ return pad;
+}
+
+-(void)inspectView: (UIView *)theView depth:(int)depth path:(NSString *)path {
+
+ if (depth==0) {
+ NSLog(@"-------------------- <view hierarchy> -------------------");
+ }
+
+ NSString *pad = [self stringPad:depth];
+
+ // print some information about the current view
+ //
+ NSLog([NSString stringWithFormat:@"%@.description: %@",pad,[theView description]]);
+ if ([theView isKindOfClass:[UIImageView class]]) {
+ NSLog([NSString stringWithFormat:@"%@.class: UIImageView",pad]);
+ } else if ([theView isKindOfClass:[UILabel class]]) {
+ NSLog([NSString stringWithFormat:@"%@.class: UILabel",pad]);
+ NSLog([NSString stringWithFormat:@"%@.text: ",pad,[(UILabel *)theView text]]);
+ } else if ([theView isKindOfClass:[UIButton class]]) {
+ NSLog([NSString stringWithFormat:@"%@.class: UIButton",pad]);
+ NSLog([NSString stringWithFormat:@"%@.title: ",pad,[(UIButton *)theView titleForState:UIControlStateNormal]]);
+ }
+ NSLog([NSString stringWithFormat:@"%@.frame: %.0f, %.0f, %.0f, %.0f", pad, theView.frame.origin.x, theView.frame.origin.y,
+ theView.frame.size.width, theView.frame.size.height]);
+ NSLog([NSString stringWithFormat:@"%@.subviews: %d",pad, [theView.subviews count]]);
+ NSLog(@" ");
+
+ // gotta love recursion: call this method for all subviews
+ //
+ for (int i=0; i<[theView.subviews count]; i++) {
+ NSString *subPath = [NSString stringWithFormat:@"%@/%d",path,i];
+ NSLog([NSString stringWithFormat:@"%@--subview-- %@",pad,subPath]);
+ [self inspectView:[theView.subviews objectAtIndex:i] depth:depth+1 path:subPath];
+ }
+
+ if (depth==0) {
+ NSLog(@"-------------------- </view hierarchy> -------------------");
+ }
+
+}
+
+
+- (void)viewDidDisappear:(BOOL)animated {
+ // stop the preview timer
+ //
+ self.pTimer = nil;
+
+ // make sure to call the same method on the super class!!!
+ //
+ [super viewDidDisappear:animated];
+}
+
+-(void) viewDidAppear: (BOOL)animated {
+ // make sure to call the same method on the super class!!!
+ //
+ [super viewDidAppear:animated];
+
+ // this timer will fire previewCheck
+ //
+ self.pTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/kPreviewTimerInterval
+ target:self selector:@selector(previewCheck) userInfo:nil repeats:YES];
+}
+
+
+@end
75 ARKitDemo/Locations.txt
@@ -0,0 +1,75 @@
+//Locations
+/*
+* Colorado
+ 39.550051,-105.782067
+
+* Portland
+ 45.523875,-122.670399
+
+* Chicago
+ 41.879535,-87.624333
+
+* Austin
+ 30.268735,-97.745209
+
+ * London
+ 51.500152,-0.126236
+
+* Paris
+ 48.856667,2.350987
+
+* Seattle
+ 47.620973,-122.347276
+
+* India
+ 20.593684,78.96288
+
+* Copenhagen
+ 55.676294,12.568116
+
+* Amsterdam
+ 52.373801,4.890935
+
+* New Zealand
+ -40.900557,174.885971
+
+* New York City
+ 40.756054,-73.986951
+
+* Boston
+ 42.35892,-71.05781
+
+* Czech Republic
+ 49.817492,15.472962
+
+* Ireland
+ 53.41291,-8.24389
+
+* Montreal
+ 45.545447,-73.639076
+
+* Florida
+ 27.664827,-81.515753
+
+* Washington, DC
+ 38.892091,-77.024055
+
+* Montreal
+ 45.545447,-73.639076
+
+* Brazil
+ -14.235004,-51.92528
+
+* Switzerland
+ 46.818188,8.227512
+
+* Ukraine
+ 48.379433,31.16558
+
+* Munich
+ 48.139127,11.580186
+
+* Dallas
+ 32.781078,-96.797111
+
+ */
190 ARKitDemo/MainWindow.xib
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">768</int>
+ <string key="IBDocument.SystemVersion">10A288</string>
+ <string key="IBDocument.InterfaceBuilderVersion">715</string>
+ <string key="IBDocument.AppKitVersion">1010</string>
+ <string key="IBDocument.HIToolboxVersion">411.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">46</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="2"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="841351856">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="427554174">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUICustomObject" id="664661524"/>
+ <object class="IBUIWindow" id="380026005">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">1316</int>
+ <object class="NSPSMatrix" key="NSFrameMatrix"/>
+ <string key="NSFrameSize">{320, 480}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="664661524"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="664661524"/>
+ <reference key="destination" ref="380026005"/>
+ </object>
+ <int key="connectionID">5</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="380026005"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="841351856"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="664661524"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="427554174"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>2.IBAttributePlaceholdersKey</string>
+ <string>2.IBEditorWindowLastContentRect</string>
+ <string>2.IBPluginDependency</string>
+ <string>3.CustomClassName</string>
+ <string>3.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIApplication</string>
+ <string>UIResponder</string>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <string>{{438, 320}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>ARKitDemoAppDelegate</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">9</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">ARKitDemoAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">window</string>
+ <string key="NS.object.0">UIWindow</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/ARKitDemoAppDelegate.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">ARKitDemoAppDelegate</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">ARKitDemo.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ </data>
+</archive>
BIN  ARKitDemo/location.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 ARKitDemo/main.m
@@ -0,0 +1,17 @@
+//
+// main.m
+// ARKitDemo
+//
+// Created by Zac White on 8/1/09.
+// Copyright Gravity Mobile 2009. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[]) {
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ [pool release];
+ return retVal;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.