3DAR Documentation
First, download the latest version of 3DAR and unzip it.
Example Apps
Project Setup
- Copy the contents of the folder named copy_into_project into your project.
- Add the following to your Other Linker Flags build setting in your app’s target. Expand the “Targets” item and double click the app name, then choose the “Build” tab and search for “Other Linker Flags”.
- -lstdc++
- -lxml2
- Add the following entry to your Header Search Paths and set the Recursive checkbox to YES.
- /usr/include/libxml2
- Include the following frameworks:
- CoreGraphics
- CoreLocation
- Foundation
- MapKit
- OpenGLES
- QuartzCore
- UIKit
Using the 3DAR API
- Decide which of your existing controllers will contain the augmented reality display and make that controller conform to the SM3DAR_Delegate protocol.
- In that controller’s viewDidLoad, add the shared singleton SM3DAR_Controller’s view as a subview.
- Implement any of the SM3DAR_Delegate methods. 3DAR will invoke loadPointsOfInterest when its coordinate system is initialized. This is a good place to load static or dynamic datasets.
- (void) sm3darViewDidLoad
- (void) loadPointsOfInterest
- (void) didChangeFocusToPOI:(SM3DAR_Point*)newPOI fromPOI:(SM3DAR_Point*)oldPOI
- (void) didChangeSelectionToPOI:(SM3DAR_Point*)newPOI fromPOI:(SM3DAR_Point*)oldPOI
- (void) didChangeOrientationYaw:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll
- (void) logoWasTapped
Loading Points of Interest
#import "SM3DAR.h"
- (void)viewDidLoad {
[super viewDidLoad];
SM3DAR_Controller *sm3dar = [SM3DAR_Controller sharedController];
[self.view addSubview:sm3dar.view];
sm3dar.delegate = self;
}
-(void)loadPointsOfInterest {
SM3DAR_Controller *sm3dar = [SM3DAR_Controller sharedController];
[sm3dar loadMarkersFromJSONFile:@"markers"];
}
Also see how SM3DAR_Common’s YahooLocalSearch loads dynamic points of interest.
Point of Interest Format
The above example demonstrates how to load a static set of geo-coordinates contained in a JSON formatted text file named markers.json. The only required fields for a 3DAR point of interest are latitude and longitude, but you may specify any number of arbitrary properties for your points of interest. Note that altitude is required unless the 3darOverridePoiAltitude configuration setting is set to YES in 3dar.plist.
[{
"title" : "AboutUs",
"longitude" : -122.664284,
"altitude" : 314,
"latitude" : 45.519027,
"subtitle" : "",
"my_custom_rating" : 4
}, {
"title" : "Floyd's Coffee Shop",
"longitude" : -122.651195,
"altitude" : 124,
"latitude" : 45.517185,
"subtitle" : "",
"my_custom_rating" : 3
}]