Skip to content

Commit

Permalink
Added ARC Support to Project
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels Hansen committed Jan 12, 2013
1 parent dc0940c commit b603e85
Show file tree
Hide file tree
Showing 24 changed files with 62 additions and 187 deletions.
9 changes: 1 addition & 8 deletions ARKit/ARCoordinate.h
Expand Up @@ -12,14 +12,7 @@
#define degreesToRadians(x) (M_PI * x / 180.0)
#define radiansToDegrees(x) (x * (180.0/M_PI))

@interface ARCoordinate : NSObject {
double radialDistance;
double inclination;
double azimuth;

NSString *title;
NSString *subtitle;
}
@interface ARCoordinate : NSObject

- (NSUInteger) hash;
- (BOOL) isEqual:(id)other;
Expand Down
4 changes: 1 addition & 3 deletions ARKit/ARCoordinate.m
Expand Up @@ -24,7 +24,7 @@ + (ARCoordinate *)coordinateWithRadialDistance:(double)newRadialDistance inclina
[newCoordinate setAzimuth: newAzimuth];
[newCoordinate setTitle: @""];

return [newCoordinate autorelease];
return newCoordinate;
}

- (NSUInteger)hash {
Expand Down Expand Up @@ -58,10 +58,8 @@ - (BOOL)isEqualToCoordinate:(ARCoordinate *)otherCoordinate {
}

- (void)dealloc {

[self setTitle: nil];
[self setSubtitle: nil];
[super dealloc];
}

- (NSString *)description {
Expand Down
7 changes: 1 addition & 6 deletions ARKit/ARGeoCoordinate.h
Expand Up @@ -10,12 +10,7 @@
#import <CoreLocation/CoreLocation.h>
#import "ARCoordinate.h"

@interface ARGeoCoordinate : ARCoordinate {
CLLocation *geoLocation;
double distanceFromOrigin;
UIView *displayView;

}
@interface ARGeoCoordinate : ARCoordinate

@property (nonatomic, retain) CLLocation *geoLocation;
@property (nonatomic, retain) UIView *displayView;
Expand Down
2 changes: 1 addition & 1 deletion ARKit/ARGeoCoordinate.m
Expand Up @@ -54,7 +54,7 @@ + (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location locationTitle
[newCoordinate setGeoLocation: location];
[newCoordinate setTitle: titleOfLocation];

return [newCoordinate autorelease];
return newCoordinate;
}

+ (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location fromOrigin:(CLLocation *)origin {
Expand Down
4 changes: 1 addition & 3 deletions ARKit/ARKit.h
Expand Up @@ -12,9 +12,7 @@
#import "ARViewController.h"
#import "ARLocationDelegate.h"

@interface ARKit : NSObject {

}
@interface ARKit : NSObject

+(BOOL)deviceSupportsAR;

Expand Down
1 change: 0 additions & 1 deletion ARKit/ARViewProtocol.h
Expand Up @@ -11,7 +11,6 @@

@class ARGeoCoordinate;


@protocol ARMarkerDelegate <NSObject>
-(void) didTapMarker:(ARGeoCoordinate *) coordinate;
@end
Expand Down
13 changes: 0 additions & 13 deletions ARKit/AugmentedRealityController.h
Expand Up @@ -16,24 +16,11 @@

@interface AugmentedRealityController : NSObject <UIAccelerometerDelegate, CLLocationManagerDelegate> {

id<ARDelegate> delegate;

BOOL scaleViewsBasedOnDistance;
BOOL rotateViewsBasedOnPerspective;

double maximumScaleDistance;
double minimumScaleFactor;
double maximumRotationAngle;

ARCoordinate *centerCoordinate;
CLLocationManager *locationManager;
UIViewController *rootViewController;

@private
double latestHeading;
double degreeRange;

BOOL debugMode;

float viewAngle;
float prevHeading;
Expand Down
19 changes: 3 additions & 16 deletions ARKit/AugmentedRealityController.m
Expand Up @@ -128,19 +128,17 @@ - (id)initWithViewController:(UIViewController *)vc withDelgate:(id<ARDelegate>)
[[camView layer] insertSublayer:newCaptureVideoPreviewLayer below:[[[camView layer] sublayers] objectAtIndex:0]];

[self setPreviewLayer:newCaptureVideoPreviewLayer];
[newCaptureVideoPreviewLayer release];

[avCaptureSession setSessionPreset:AVCaptureSessionPresetLow];
[avCaptureSession startRunning];

[self setCaptureSession:avCaptureSession];
[avCaptureSession release];

#endif

CLLocation *newCenter = [[CLLocation alloc] initWithLatitude:37.41711 longitude:-122.02528]; //TODO: We should get the latest heading here.

[self setCenterLocation: newCenter];
[newCenter release];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:)
name: UIDeviceOrientationDidChangeNotification object:nil];
Expand All @@ -150,9 +148,6 @@ - (id)initWithViewController:(UIViewController *)vc withDelgate:(id<ARDelegate>)
[self setCameraView:camView];
[self setDisplayView:displayV];

[camView release];
[displayV release];

return self;
}

Expand All @@ -169,15 +164,9 @@ - (void)dealloc {
[self stopListening];
[self unloadAV];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[centerLocation release];
[cameraView release];
[displayView release];

locationManager.delegate = nil;
[UIAccelerometer sharedAccelerometer].delegate = nil;
[locationManager release];
[coordinates release];
[debugView release];
[super dealloc];
}

#pragma mark -
Expand All @@ -196,7 +185,6 @@ - (void)startListening {
[newLocationManager setDelegate: self];

[self setLocationManager: newLocationManager];
[newLocationManager release];
}

if (![self accelerometerManager]) {
Expand Down Expand Up @@ -270,8 +258,7 @@ - (void)updateCenterCoordinate {
}

- (void)setCenterLocation:(CLLocation *)newLocation {
[centerLocation release];
centerLocation = [newLocation retain];
centerLocation = newLocation;

for (ARGeoCoordinate *geoLocation in [self coordinates]) {

Expand Down
8 changes: 1 addition & 7 deletions ARKit/GEOLocations.h
Expand Up @@ -11,18 +11,12 @@

@class ARCoordinate;

@interface GEOLocations : NSObject {


id<ARLocationDelegate> delegate;
}
@interface GEOLocations : NSObject

@property(nonatomic,assign) id<ARLocationDelegate> delegate;

- (id)initWithDelegate:(id<ARLocationDelegate>) aDelegate;
-(NSMutableArray*) returnLocations;




@end
6 changes: 2 additions & 4 deletions ARKit/GEOLocations.m
Expand Up @@ -13,7 +13,6 @@

@implementation GEOLocations


@synthesize delegate;

- (id)initWithDelegate:(id<ARLocationDelegate>) aDelegate{
Expand All @@ -27,10 +26,9 @@ -(NSMutableArray*) returnLocations
return [delegate geoLocations];
}

- (void)dealloc {
- (void)dealloc
{


[super dealloc];
}


Expand Down
13 changes: 8 additions & 5 deletions ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj
Expand Up @@ -241,7 +241,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 0420;
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = "Agilite Software";
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ARKitDemo" */;
Expand Down Expand Up @@ -303,6 +303,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
Expand All @@ -327,8 +328,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ARKitDemo_Prefix.pch;
Expand Down Expand Up @@ -367,8 +369,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ARKitDemo_Prefix.pch;
Expand Down
Binary file not shown.
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
LastUpgradeVersion = "0450"
version = "1.8">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -22,21 +23,24 @@
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -55,7 +59,8 @@
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release">
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
3 changes: 1 addition & 2 deletions ARKitDemo/Classes/ARKitDemoAppDelegate.h
Expand Up @@ -12,8 +12,7 @@
@class MainViewController;

@interface ARKitDemoAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
MainViewController *viewController;

}


Expand Down
4 changes: 0 additions & 4 deletions ARKitDemo/Classes/ARKitDemoAppDelegate.m
Expand Up @@ -20,15 +20,11 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
[self setViewController:vc];

[window addSubview:[viewController view]];
[vc release];
[window makeKeyAndVisible];
}

- (void)dealloc {

[viewController release];
[window release];
[super dealloc];
}


Expand Down
5 changes: 1 addition & 4 deletions ARKitDemo/Classes/ARViewController.h
Expand Up @@ -13,10 +13,7 @@

@class AugmentedRealityController;

@interface ARViewController : UIViewController<ARMarkerDelegate, ARDelegate> {
AugmentedRealityController *agController;
id<ARLocationDelegate> delegate;
}
@interface ARViewController : UIViewController<ARMarkerDelegate, ARDelegate>

@property (nonatomic, retain) AugmentedRealityController *agController;
@property (nonatomic, assign) id<ARLocationDelegate> delegate;
Expand Down
11 changes: 3 additions & 8 deletions ARKitDemo/Classes/ARViewController.m
Expand Up @@ -46,9 +46,7 @@ - (void)loadView {
[closeBtn setBackgroundColor:[UIColor greenColor]];
[closeBtn addTarget:self action:@selector(closeButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
[[self view] addSubview:closeBtn];

[closeBtn release];


GEOLocations* locations = [[GEOLocations alloc] initWithDelegate:delegate];

if ([[locations returnLocations] count] > 0) {
Expand All @@ -57,13 +55,11 @@ - (void)loadView {
[coordinate setDisplayView:cv];

[arc addCoordinate:coordinate];
[cv release];
}
}

[self setAgController:arc];
[arc release];
[locations release];

}

- (IBAction)closeButtonClicked:(id)sender {
Expand Down Expand Up @@ -114,12 +110,11 @@ - (void)didReceiveMemoryWarning {
}

- (void)viewDidUnload {
[agController release];
agController = nil;
}

- (void)dealloc {
[super dealloc];

}


Expand Down

0 comments on commit b603e85

Please sign in to comment.