Skip to content

Commit

Permalink
Implemented an ARLocationDelegate protocol. This makes ARKit Model/Vi…
Browse files Browse the repository at this point in the history
…ew/Controller compliant.
  • Loading branch information
Jared Crawford authored and nielswh committed Apr 19, 2010
1 parent f3ad837 commit 7cba07a
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 164 deletions.
19 changes: 19 additions & 0 deletions ARKit/ARLocationDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// ARLocationDelegate.h
// ARKitDemo
//
// Created by Jared Crawford on 2/13/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ARGeoCoordinate.h"


@protocol ARLocationDelegate

//returns an array of ARGeoCoordinates
-(NSMutableArray *)getLocations;

@end

14 changes: 14 additions & 0 deletions ARKit/ARLocationDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ARLocationDelegate.m
// ARKitDemo
//
// Created by Jared Crawford on 2/13/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ARLocationDelegate.h"


@implementation ARLocationDelegate

@end
10 changes: 6 additions & 4 deletions ARKit/GEOLocations.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
//

#import <Foundation/Foundation.h>

#import "ARLocationDelegate.h"

@class ARCoordinate;

@interface GEOLocations : NSObject {

NSMutableArray *locationArray;

id<ARLocationDelegate> delegate;
}

- (id)init;
-(void) LoadLocations;
@property(nonatomic,assign) id<ARLocationDelegate> delegate;

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


Expand Down
135 changes: 5 additions & 130 deletions ARKit/GEOLocations.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,141 +13,15 @@

@implementation GEOLocations

- (id)init {

locationArray = [[NSMutableArray alloc] initWithCapacity:20];
[self LoadLocations];
return self;
}
- (id)initWithDelegate:(id<ARLocationDelegate>) aDelegate{
self.delegate = aDelegate;

-(void) LoadLocations {

ARGeoCoordinate *tempCoordinate;
CLLocation *tempLocation;

tempLocation = [[CLLocation alloc] initWithLatitude:39.550051 longitude:-105.782067];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Denver"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:45.523875 longitude:-122.670399];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Portland"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:41.879535 longitude:-87.624333];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Chicago"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:30.268735 longitude:-97.745209];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Austin"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:51.500152 longitude:-0.126236];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"London"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:48.856667 longitude:2.350987];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Paris"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:55.676294 longitude:12.568116];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Copenhagen"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:52.373801 longitude:4.890935];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Amsterdam"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:19.611544 longitude:-155.665283];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Hawaii"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:-40.900557 longitude:174.885971];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"New Zealand"];
tempCoordinate.inclination = M_PI/40;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:40.756054 longitude:-73.986951];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"New York City"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:42.35892 longitude:-71.05781];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Boston"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:49.817492 longitude:15.472962];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Czech Republic"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:53.41291 longitude:-8.24389];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Ireland"];
tempCoordinate.inclination = M_PI/30;
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:38.892091 longitude:-77.024055];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Washington, DC"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:45.545447 longitude:-73.639076];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Montreal"];
[locationArray addObject:tempCoordinate];
[tempLocation release];


tempLocation = [[CLLocation alloc] initWithLatitude:32.78 longitude:-117.15];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"San Diego"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:-40.900557 longitude:174.885971];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Munich"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:33.5033333 longitude:-117.126611];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Temecula"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:19.26 longitude:-99.8];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Mexico City"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:53.566667 longitude:-113.516667];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Edmonton"];
[locationArray addObject:tempCoordinate];
[tempLocation release];

tempLocation = [[CLLocation alloc] initWithLatitude:47.620973 longitude:-122.347276];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation locationTitle:@"Seattle"];
[locationArray addObject:tempCoordinate];
[tempLocation release];
return self;
}

-(NSMutableArray*) getLocations
{
return locationArray;
[delegate getLocations];
}

- (void)dealloc {
Expand All @@ -158,4 +32,5 @@ - (void)dealloc {


@synthesize locationArray;
@synthesize delegate;
@end
36 changes: 17 additions & 19 deletions ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 45;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -22,7 +22,8 @@
69E66638111BAF3500BD3E6D /* AugmentedRealityController.m in Sources */ = {isa = PBXBuildFile; fileRef = 69E66631111BAF3500BD3E6D /* AugmentedRealityController.m */; };
69E66639111BAF3500BD3E6D /* CoordinateView.m in Sources */ = {isa = PBXBuildFile; fileRef = 69E66633111BAF3500BD3E6D /* CoordinateView.m */; };
69E6663A111BAF3500BD3E6D /* GEOLocations.m in Sources */ = {isa = PBXBuildFile; fileRef = 69E66635111BAF3500BD3E6D /* GEOLocations.m */; };
8CA1AC27110B86240087D1DD /* ARDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA1AC26110B86240087D1DD /* ARDemoViewController.m */; };
7F4C19A1112674030093704B /* ARLocationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F4C19A0112674030093704B /* ARLocationDelegate.m */; };
8CA1AC27110B86240087D1DD /* ARViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA1AC26110B86240087D1DD /* ARViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -49,8 +50,10 @@
69E66633111BAF3500BD3E6D /* CoordinateView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoordinateView.m; sourceTree = "<group>"; };
69E66634111BAF3500BD3E6D /* GEOLocations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GEOLocations.h; sourceTree = "<group>"; };
69E66635111BAF3500BD3E6D /* GEOLocations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GEOLocations.m; sourceTree = "<group>"; };
8CA1AC25110B86240087D1DD /* ARDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARDemoViewController.h; sourceTree = "<group>"; };
8CA1AC26110B86240087D1DD /* ARDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARDemoViewController.m; sourceTree = "<group>"; };
7F4C199F112674030093704B /* ARLocationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARLocationDelegate.h; sourceTree = "<group>"; };
7F4C19A0112674030093704B /* ARLocationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARLocationDelegate.m; sourceTree = "<group>"; };
8CA1AC25110B86240087D1DD /* ARViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARViewController.h; path = Classes/ARViewController.h; sourceTree = SOURCE_ROOT; };
8CA1AC26110B86240087D1DD /* ARViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ARViewController.m; path = Classes/ARViewController.m; sourceTree = SOURCE_ROOT; };
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>"; };
/* End PBXFileReference section */

Expand All @@ -74,7 +77,6 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
8C901A4A10DE878700E8052F /* ViewControllers */,
1D3623240D0F684500981E51 /* ARKitDemoAppDelegate.h */,
1D3623250D0F684500981E51 /* ARKitDemoAppDelegate.m */,
);
Expand Down Expand Up @@ -137,6 +139,8 @@
69E6662B111BAF3500BD3E6D /* ARKit */ = {
isa = PBXGroup;
children = (
8CA1AC25110B86240087D1DD /* ARViewController.h */,
8CA1AC26110B86240087D1DD /* ARViewController.m */,
69E6662C111BAF3500BD3E6D /* ARCoordinate.h */,
69E6662D111BAF3500BD3E6D /* ARCoordinate.m */,
69E6662E111BAF3500BD3E6D /* ARGeoCoordinate.h */,
Expand All @@ -147,20 +151,13 @@
69E66633111BAF3500BD3E6D /* CoordinateView.m */,
69E66634111BAF3500BD3E6D /* GEOLocations.h */,
69E66635111BAF3500BD3E6D /* GEOLocations.m */,
7F4C199F112674030093704B /* ARLocationDelegate.h */,
7F4C19A0112674030093704B /* ARLocationDelegate.m */,
);
name = ARKit;
path = ../ARKit;
sourceTree = SOURCE_ROOT;
};
8C901A4A10DE878700E8052F /* ViewControllers */ = {
isa = PBXGroup;
children = (
8CA1AC25110B86240087D1DD /* ARDemoViewController.h */,
8CA1AC26110B86240087D1DD /* ARDemoViewController.m */,
);
name = ViewControllers;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -191,7 +188,7 @@
ORGANIZATIONNAME = "Mike Tigas";
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ARKitDemo" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
Expand Down Expand Up @@ -221,12 +218,13 @@
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1D3623260D0F684500981E51 /* ARKitDemoAppDelegate.m in Sources */,
8CA1AC27110B86240087D1DD /* ARDemoViewController.m in Sources */,
8CA1AC27110B86240087D1DD /* ARViewController.m in Sources */,
69E66636111BAF3500BD3E6D /* ARCoordinate.m in Sources */,
69E66637111BAF3500BD3E6D /* ARGeoCoordinate.m in Sources */,
69E66638111BAF3500BD3E6D /* AugmentedRealityController.m in Sources */,
69E66639111BAF3500BD3E6D /* CoordinateView.m in Sources */,
69E6663A111BAF3500BD3E6D /* GEOLocations.m in Sources */,
7F4C19A1112674030093704B /* ARLocationDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -247,7 +245,7 @@
INFOPLIST_FILE = "ARKitDemo-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../iPhoneAugmentedRealityLib/build/Debug-iphoneos\"",
"\\\"$(SRCROOT)/../iPhoneAugmentedRealityLib/build/Debug-iphoneos\\\"",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = ARKitDemo;
Expand All @@ -265,7 +263,7 @@
INFOPLIST_FILE = "ARKitDemo-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../iPhoneAugmentedRealityLib/build/Debug-iphoneos\"",
"\\\"$(SRCROOT)/../iPhoneAugmentedRealityLib/build/Debug-iphoneos\\\"",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = ARKitDemo;
Expand Down Expand Up @@ -298,7 +296,7 @@
INFOPLIST_FILE = "ARKitDemo-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../iPhoneAugmentedRealityLib/build/Debug-iphoneos\"",
"\\\"$(SRCROOT)/../iPhoneAugmentedRealityLib/build/Debug-iphoneos\\\"",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = ARKitDemo;
Expand Down
3 changes: 2 additions & 1 deletion ARKitDemo/Classes/ARKitDemoAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
//

#import <UIKit/UIKit.h>
#import "ARLocationDelegate.h"


@interface ARKitDemoAppDelegate : NSObject <UIApplicationDelegate> {
@interface ARKitDemoAppDelegate : NSObject <UIApplicationDelegate, ARLocationDelegate> {
UIWindow *window;
}

Expand Down
Loading

0 comments on commit 7cba07a

Please sign in to comment.