Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
refs #24: Gyp-built iOS test app
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Feb 4, 2014
1 parent 2b2ff9f commit ca75b2a
Show file tree
Hide file tree
Showing 33 changed files with 599 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
config.gypi
config.mk
.DS_Store
out
mapnik-packaging
*.xcodeproj
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,24 @@ xapp: xcode config.gypi src macosx/llmr-app.gyp
xcodebuild -project ./macosx/llmr-app.xcodeproj
open macosx/build/Release/llmr.app

# build iOS app with xcodebuild
iapp: xcode config.gypi src ios/llmr-app.gyp
deps/run_gyp ios/llmr-app.gyp -Goutput_dir=./out/ --depth=. --generator-output=./ -f xcode
xcodebuild -project ./ios/llmr-app.xcodeproj
# launch app with ios-sim?

clean:
-rm -rf out
-rm -rf build
-rm -rf macosx/build
-rm -rf ios/build

distclean:
-rm -f config.gypi
-rm -f config.mk
-rm -rf llmr.xcodeproj
-rm -rf macosx/llmr-app.xcodeproj
-rm -rf ios/llmr-app.xcodeproj

test: all
echo test
Expand Down
23 changes: 17 additions & 6 deletions include/llmr/map/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Map {
Map &operator=(const Map&) = delete;
Map &operator=(const Map&&) = delete;

/* setup */
void setup();
void loadStyle(const uint8_t *const data, uint32_t bytes);
void loadSprite(const std::string& url);
Expand All @@ -33,19 +34,29 @@ class Map {

/* callback */
bool render();
void moveBy(double dx, double dy);
void scaleBy(double ds, double cx, double cy);
void rotateBy(double cx, double cy, double sx, double sy, double ex, double ey);
void tileLoaded(std::shared_ptr<Tile> tile);
void tileFailed(std::shared_ptr<Tile> tile);

/* position */
void resetNorth();
void resetPosition();
// void setAngle(double angle);
void moveBy(double dx, double dy);
// void setLonLat(double lon, double lat);
void resetPosition();

/* scale */
void scaleBy(double ds, double cx, double cy);
void setScale(double scale);
double getScale() const;
// void setZoom(double zoom);
// void setLonLatZoom(double lon, double lat, double zoom);
// double getZoom() const;
// void getLonLatZoom(double &lon, double &lat, double &zoom) const;
// void resetZoom();

/* rotation */
void rotateBy(double cx, double cy, double sx, double sy, double ex, double ey);
void setAngle(double angle);
double getAngle() const;
void resetNorth();

void toggleDebug();

Expand Down
4 changes: 2 additions & 2 deletions include/llmr/platform/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <functional>
#include <string>

#define kTileURL "http://localhost:3333/gl/tiles/plain/%d-%d-%d.vector.pbf"
#define kSpriteURL "http://localhost:3333/gl/debug/img/sprite"
#define kTileURL "http://mapbox:magic@kkaefer.net/gl/tiles/plain/%d-%d-%d.vector.pbf"
#define kSpriteURL "http://mapbox:magic@kkaefer.net/gl/debug/img/sprite"

namespace llmr {

Expand Down
47 changes: 47 additions & 0 deletions ios/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.mapbox.llmr.native</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>CFBundleSignature</key>
<string>LLMR</string>
<key>CFBundleVersion</key>
<string>0.0.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSHumanReadableCopyright</key>
<string>(c) 2014 Mapbox</string>
</dict>
</plist>
15 changes: 15 additions & 0 deletions ios/MBXAppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// MBXAppDelegate.h
// ios
//
// Created by Justin R. Miller on 1/27/14.
//
//

#import <UIKit/UIKit.h>

@interface MBXAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
24 changes: 24 additions & 0 deletions ios/MBXAppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MBXAppDelegate.m
// ios
//
// Created by Justin R. Miller on 1/27/14.
//
//

#import "MBXAppDelegate.h"

#import "MBXViewController.h"

@implementation MBXAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [MBXViewController new];
[self.window makeKeyAndVisible];

return YES;
}

@end
21 changes: 21 additions & 0 deletions ios/MBXSettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// MBXSettings.hpp
// llmr
//
// Created by Justin R. Miller on 1/27/14.
//
//

#import <llmr/map/settings.hpp>

namespace llmr
{
class Settings_iOS : public Settings
{
public:
Settings_iOS();
virtual void save();
virtual void load();
virtual void clear();
};
}
68 changes: 68 additions & 0 deletions ios/MBXSettings.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// MBXSettings.cpp
// llmr
//
// Created by Justin R. Miller on 1/27/14.
//
//

#import "MBXSettings.h"

#import <Foundation/Foundation.h>

using namespace llmr;

Settings_iOS::Settings_iOS() {
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:

// position
[NSNumber numberWithDouble:longitude], @"longitude",
[NSNumber numberWithDouble:latitude], @"latitude",
[NSNumber numberWithDouble:scale], @"scale",
[NSNumber numberWithDouble:angle], @"angle",

// debug
[NSNumber numberWithBool:debug], @"debug",

nil
];

[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
}

void Settings_iOS::load() {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

// position
longitude = [defaults doubleForKey:@"longitude"];
latitude = [defaults doubleForKey:@"latitude"];
scale = [defaults doubleForKey:@"scale"];
angle = [defaults doubleForKey:@"angle"];

// debug
debug = [defaults boolForKey:@"debug"];
}

void Settings_iOS::save() {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:

// position
[NSNumber numberWithDouble:longitude], @"longitude",
[NSNumber numberWithDouble:latitude], @"latitude",
[NSNumber numberWithDouble:scale], @"scale",
[NSNumber numberWithDouble:angle], @"angle",

// debug
[NSNumber numberWithBool:debug], @"debug",

nil
];
// [defaults setPersistentDomain:appDefaults forName:[[NSBundle mainBundle] bundleIdentifier]];

// [defaults synchronize];
}

void Settings_iOS::clear() {
}
14 changes: 14 additions & 0 deletions ios/MBXViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// MBXViewController.h
// ios
//
// Created by Justin R. Miller on 1/27/14.
//
//

#import <GLKit/GLKit.h>
#import <UIKit/UIKit.h>

@interface MBXViewController : GLKViewController

@end
Loading

0 comments on commit ca75b2a

Please sign in to comment.