Skip to content

Instantly share code, notes, and snippets.

View pmark's full-sized avatar

P. Mark Anderson pmark

View GitHub Profile
run "haml --rails ."
run "compass --rails -f blueprint --sass-dir public/stylesheets/sass --css-dir public/stylesheets ."
run "rm public/index.html"
plugin 'jrails', :git => 'git://github.com/aaronchi/jrails.git'
plugin 'make_resourceful', :git => 'git://github.com/hcatlin/make_resourceful.git'
plugin 'shoulda', :git => 'git://github.com/thoughtbot/shoulda.git'
gem 'thoughtbot-factory_girl', :lib => 'factory_girl', :source => 'http://gems.github.com'
- (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
#import "SM3DAR.h"
- (void)viewDidLoad {
[super viewDidLoad];
SM3DAR_Controller *sm3dar = [SM3DAR_Controller sharedController];
[self.view addSubview:sm3dar.view];
sm3dar.delegate = self;
}
@pmark
pmark / 3DAR point of interest format
Created February 10, 2011 23:57
3DAR point of interest format
[{
"title": "AboutUs",
"longitude": -122.664284,
"altitude": 314,
"latitude": 45.519027,
"subtitle": "",
"my_custom_rating": 4,
"some_other_field": ["array value 1", "array value 2"]
}, {
"title": "Floyd's Coffee Shop",
@pmark
pmark / gist:918699
Created April 14, 2011 00:21
How to properly attribute 3DAR on your app's HTML about page.
// In the web view's controller set the UIWebView's baseURL to the resource bundle path.
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[webView loadHTMLString:htmlString baseURL:baseURL];
// Download this powered by image and put it in your app's resource bundle.
// https://spotmetrix.s3.amazonaws.com/3DAR/powered_by_3dar_310x50.png
//
@pmark
pmark / add3dObjectNortheastOfUserLocation.m
Created May 31, 2011 22:40
How to create a 3DAR POI with a 3D mesh OBJ view (requires v0.9.6+)
- (void) add3dObjectNortheastOfUserLocation
{
SM3DARTexturedGeometryView *modelView = [[[SM3DARTexturedGeometryView alloc] initWithOBJ:@"star.obj" textureNamed:nil] autorelease];
CLLocationDegrees latitude = mapView.sm3dar.userLocation.coordinate.latitude + 0.0001;
CLLocationDegrees longitude = mapView.sm3dar.userLocation.coordinate.longitude + 0.0001;
// Add a point with a 3D view to the 3DAR scene.
@pmark
pmark / gist:1064951
Created July 5, 2011 14:38
How to integrate 3DAR without using SM3DARMapView.
- (void) viewDidLoad // or awakeFromNib
{
// Retain a reference to sm3dar.
self.sm3dar = [[[SM3DARController alloc] initWithDelegate:self] autorelease];
sm3dar.map = yourArcGisMapOrSomeOtherMapView; // Optional.
UIView *containerViewFor3dar = self.view; // Common usage.
[containerViewFor3dar addSubview:sm3dar.view]
@pmark
pmark / gist:1077110
Created July 12, 2011 00:22
Changing 3DAR's frame size and logo position
// Changing 3DAR's frame will position the logo.
CGRect new3darFrame = CGRectMake(0, 0, 160, 240);
[sm3dar setFrame:new3darFrame];
// You can also set the icon's position directly.
sm3dar.iconLogo.center = CGPointMake(10, 10);
@pmark
pmark / gist:1118694
Created August 1, 2011 18:26
Polylines in 3DAR
CLLocation *polylineLocation = [[[CLLocation alloc] initWithLatitude:45.5 longitude:-122.6] autorelease];
NSMutableArray *worldCoords = [NSMutableArray array];
Coord3D coord;
coord.x = 0; // East
coord.y = 100; // North
coord.z = 0; // Up
WorldCoordinate *wc = [[[WorldCoordinate alloc] initWithCoord:coord] autorelease];
@pmark
pmark / gist:1171490
Created August 25, 2011 18:59
Position 3DAR logo in the bottom right of the view.
// This code should probably go in sm3darLoadPoints:
// Position 3DAR logo in the bottom right of the view.
CGFloat logoCenterX = sm3dar.view.frame.size.width - 10 - (sm3dar.iconLogo.frame.size.width / 2);
CGFloat logoCenterY = sm3dar.view.frame.size.height - 10 - (sm3dar.iconLogo.frame.size.height / 2);
sm3dar.iconLogo.center = CGPointMake(logoCenterX, logoCenterY);