diff --git a/.gitignore b/.gitignore index 8e63281ca..5cf9666f5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.xcodeproj *.o *.actual.png +*.diff.png /node_modules /mapnik-packaging /macosx/build diff --git a/.travis.yml b/.travis.yml index dddd096c8..62f185b2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ script: - make linux -j4 BUILDTYPE=${BUILDTYPE} - make test -j4 BUILDTYPE=${BUILDTYPE} - ./scripts/run_tests.sh +- ./scripts/compare_images.js after_script: - ./scripts/deploy_results.sh @@ -38,7 +39,7 @@ notifications: rooms: secure: "SgMjGDp8MP+UTAY/aWJwSQH2hv1Q0vhEc1BdIde59+lEL3u6gNMSexUTSJoVxRlIQTFXDJBU7v58ISdgJX8cPa+UvIC8hhLsayM+cbm+J3jgy7V9E9wllq3RpmXN33TxY7nwKgWdIms2t9YKZco3y4dKKAUyHXrtMvw8NNPQM+4=" template: - - 'Build #%{build_number}: %{author} tested %{commit} in branch %{branch} of %{repository_name}: %{commit_message}
%{message} (%{duration})' + - 'Build #%{build_number}: %{author} tested %{commit} in branch %{branch} of %{repository_name}: %{commit_message}
%{message} (%{duration}) - Compare: 1 2 3 4' format: html git: diff --git a/Makefile b/Makefile index 217132150..13af0f4ba 100644 --- a/Makefile +++ b/Makefile @@ -78,9 +78,9 @@ xproj: config.gypi macosx/llmr-app.gyp clear_xcode_cache node open ./build/macosx/llmr-app.xcodeproj # build iOS project for Xcode -iproj: config.gypi ios/llmr-app.gyp clear_xcode_cache node - deps/run_gyp ios/llmr-app.gyp --depth=. --generator-output=./build -f xcode - open ./build/ios/llmr-app.xcodeproj +iproj: config.gypi ios/mapbox-gl-cocoa/app/llmr-app.gyp clear_xcode_cache node + deps/run_gyp ios/mapbox-gl-cocoa/app/llmr-app.gyp --depth=. --generator-output=./build -f xcode + open ./build/ios/mapbox-gl-cocoa/app/llmr-app.xcodeproj # build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) lproj: config.gypi linux/llmr-app.gyp clear_xcode_cache node diff --git a/ios/Info.plist b/ios/Info.plist deleted file mode 100644 index 9c96d492a..000000000 --- a/ios/Info.plist +++ /dev/null @@ -1,47 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.mapbox.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 0.0.1 - CFBundleSignature - LLMR - CFBundleVersion - 0.0.1 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - NSHumanReadableCopyright - (c) 2014 Mapbox - - diff --git a/ios/MBXAppDelegate.h b/ios/MBXAppDelegate.h deleted file mode 100644 index 102343332..000000000 --- a/ios/MBXAppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// MBXAppDelegate.h -// ios -// -// Created by Justin R. Miller on 1/27/14. -// -// - -#import - -@interface MBXAppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end \ No newline at end of file diff --git a/ios/MBXAppDelegate.m b/ios/MBXAppDelegate.m deleted file mode 100644 index 0fbcc6e81..000000000 --- a/ios/MBXAppDelegate.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// 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 diff --git a/ios/MBXViewController.h b/ios/MBXViewController.h deleted file mode 100644 index 924d3af60..000000000 --- a/ios/MBXViewController.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface MBXViewController : UIViewController - -@end diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm deleted file mode 100644 index 33e2f6e5e..000000000 --- a/ios/MBXViewController.mm +++ /dev/null @@ -1,214 +0,0 @@ -#import "MBXViewController.h" - -#import "MGLMapView.h" - -#import "../common/settings_nsuserdefaults.hpp" - -#import - -@interface MBXViewController () - -@property (nonatomic) MGLMapView *mapView; -@property (nonatomic) BOOL debug; -@property (nonatomic) UIView *palette; -@property (nonatomic) CLLocationManager *locationManager; - -@end - -@implementation MBXViewController - -llmr::Settings_NSUserDefaults *settings = nullptr; - -#pragma mark - Setup - -- (id)init -{ - self = [super init]; - - if (self) - { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(saveState:) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(restoreState:) name:UIApplicationWillEnterForegroundNotification object:nil]; - } - - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds]; - self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self.view addSubview:self.mapView]; - - self.mapView.viewControllerForLayoutGuides = self; - - settings = new llmr::Settings_NSUserDefaults(); - [self restoreState:nil]; - - [self setupDebugUI]; - - self.locationManager = [CLLocationManager new]; - self.locationManager.delegate = self; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" - -- (void)saveState:(NSNotification *)notification -{ - if (self.mapView && settings) - { - settings->longitude = self.mapView.centerCoordinate.longitude; - settings->latitude = self.mapView.centerCoordinate.latitude; - settings->zoom = self.mapView.zoomLevel; - settings->angle = self.mapView.direction; - settings->debug = self.mapView.isDebugActive; - settings->save(); - } -} - -- (void)restoreState:(NSNotification *)notification -{ - if (self.mapView && settings) { - settings->load(); - [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(settings->latitude, settings->longitude) zoomLevel:settings->zoom animated:NO]; - self.mapView.direction = settings->angle; - [self.mapView setDebugActive:settings->debug]; - } -} - -#pragma clang diagnostic pop - -- (void)setupDebugUI -{ - UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTapGesture:)]; - singleTap.numberOfTapsRequired = 1; - [self.mapView addGestureRecognizer:singleTap]; - - NSArray *selectorNames = @[ @"unrotate", @"resetPosition", @"toggleDebug", @"toggleStyle", @"locateUser" ]; - CGFloat buttonSize = 40; - CGFloat bufferSize = 20; - CGFloat alpha = 0.75; - CGFloat paletteWidth = buttonSize + (2 * bufferSize); - CGFloat paletteHeight = [selectorNames count] * (buttonSize + bufferSize) + bufferSize; - self.palette = [[UIView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - paletteWidth, - (self.view.bounds.size.height - paletteHeight) / 2, - paletteWidth, - paletteHeight)]; - self.palette.backgroundColor = [UIColor colorWithWhite:0 alpha:alpha]; - self.palette.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; - self.palette.layer.cornerRadius = bufferSize; - [self.view addSubview:self.palette]; - for (NSString *selectorName in selectorNames) - { - UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; - button.frame = CGRectMake(bufferSize, - ([selectorNames indexOfObject:selectorName] * (buttonSize + bufferSize)) + bufferSize, - buttonSize, - buttonSize); - [button setImage:[UIImage imageNamed:[selectorName stringByAppendingString:@".png"]] forState:UIControlStateNormal]; - [button addTarget:self action:NSSelectorFromString(selectorName) forControlEvents:UIControlEventTouchUpInside]; - [self.palette addSubview:button]; - } -} - -- (NSUInteger)supportedInterfaceOrientations -{ - return UIInterfaceOrientationMaskAll; -} - -#pragma mark - Debugging UI - -- (void)handleSingleTapGesture:(UITapGestureRecognizer *)singleTap -{ - if (singleTap.state == UIGestureRecognizerStateEnded) - { - [self togglePalette]; - } -} - -- (void)togglePalette -{ - if (self.palette.alpha < 1) - { - self.palette.userInteractionEnabled = YES; - - [UIView animateWithDuration:0.25 animations:^(void) - { - self.palette.alpha = 1; - }]; - } - else - { - self.palette.userInteractionEnabled = NO; - - [UIView animateWithDuration:0.25 animations:^(void) - { - self.palette.alpha = 0; - }]; - } -} - -- (void)unrotate -{ - [self.mapView resetNorth]; -} - -- (void)resetPosition -{ - [self.mapView resetPosition]; -} - -- (void)toggleDebug -{ - [self.mapView toggleDebug]; - - self.debug = ! self.debug; -} - -- (void)toggleStyle -{ - [self.mapView toggleStyle]; -} - -- (void)locateUser -{ - [self.locationManager startUpdatingLocation]; -} - -#pragma mark - Destruction - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - if (settings) - { - [self saveState:nil]; - delete settings; - settings = nullptr; - } -} - -#pragma mark - User location - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" - -- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations -{ - CLLocation *latestLocation = locations.lastObject; - - if ([latestLocation distanceFromLocation:[[CLLocation alloc] initWithLatitude:self.mapView.centerCoordinate.latitude longitude:self.mapView.centerCoordinate.longitude]] > 100) - { - [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(latestLocation.coordinate.latitude, latestLocation.coordinate.longitude) zoomLevel:17 animated:YES]; - } - - [self.locationManager stopUpdatingLocation]; -} - -#pragma clang diagnostic pop - -@end diff --git a/ios/img/Default-568h@2x.png b/ios/img/Default-568h@2x.png deleted file mode 100644 index 0891b7aab..000000000 Binary files a/ios/img/Default-568h@2x.png and /dev/null differ diff --git a/ios/img/Icon-40.png b/ios/img/Icon-40.png deleted file mode 100644 index eca13393e..000000000 Binary files a/ios/img/Icon-40.png and /dev/null differ diff --git a/ios/img/Icon-40@2x.png b/ios/img/Icon-40@2x.png deleted file mode 100644 index 070d03753..000000000 Binary files a/ios/img/Icon-40@2x.png and /dev/null differ diff --git a/ios/img/Icon-60.png b/ios/img/Icon-60.png deleted file mode 100644 index ff4c6ab4b..000000000 Binary files a/ios/img/Icon-60.png and /dev/null differ diff --git a/ios/img/Icon-60@2x.png b/ios/img/Icon-60@2x.png deleted file mode 100644 index b7f25955f..000000000 Binary files a/ios/img/Icon-60@2x.png and /dev/null differ diff --git a/ios/img/Icon-72.png b/ios/img/Icon-72.png deleted file mode 100644 index 0c876f664..000000000 Binary files a/ios/img/Icon-72.png and /dev/null differ diff --git a/ios/img/Icon-72@2x.png b/ios/img/Icon-72@2x.png deleted file mode 100644 index 6da408204..000000000 Binary files a/ios/img/Icon-72@2x.png and /dev/null differ diff --git a/ios/img/Icon-76.png b/ios/img/Icon-76.png deleted file mode 100644 index 895b4a176..000000000 Binary files a/ios/img/Icon-76.png and /dev/null differ diff --git a/ios/img/Icon-76@2x.png b/ios/img/Icon-76@2x.png deleted file mode 100644 index 7bc520897..000000000 Binary files a/ios/img/Icon-76@2x.png and /dev/null differ diff --git a/ios/img/Icon-Small-50.png b/ios/img/Icon-Small-50.png deleted file mode 100644 index 6d17da4b0..000000000 Binary files a/ios/img/Icon-Small-50.png and /dev/null differ diff --git a/ios/img/Icon-Small-50@2x.png b/ios/img/Icon-Small-50@2x.png deleted file mode 100644 index ac4ec1928..000000000 Binary files a/ios/img/Icon-Small-50@2x.png and /dev/null differ diff --git a/ios/img/Icon-Small.png b/ios/img/Icon-Small.png deleted file mode 100644 index aecbbc8a1..000000000 Binary files a/ios/img/Icon-Small.png and /dev/null differ diff --git a/ios/img/Icon-Small@2x.png b/ios/img/Icon-Small@2x.png deleted file mode 100644 index 7773852e7..000000000 Binary files a/ios/img/Icon-Small@2x.png and /dev/null differ diff --git a/ios/img/Icon-Spotlight-40.png b/ios/img/Icon-Spotlight-40.png deleted file mode 100644 index eca13393e..000000000 Binary files a/ios/img/Icon-Spotlight-40.png and /dev/null differ diff --git a/ios/img/Icon-Spotlight-40@2x.png b/ios/img/Icon-Spotlight-40@2x.png deleted file mode 100644 index 070d03753..000000000 Binary files a/ios/img/Icon-Spotlight-40@2x.png and /dev/null differ diff --git a/ios/img/Icon.png b/ios/img/Icon.png deleted file mode 100644 index 9ca8194ee..000000000 Binary files a/ios/img/Icon.png and /dev/null differ diff --git a/ios/img/Icon@2x.png b/ios/img/Icon@2x.png deleted file mode 100644 index 7c2e8ba03..000000000 Binary files a/ios/img/Icon@2x.png and /dev/null differ diff --git a/ios/img/iTunesArtwork b/ios/img/iTunesArtwork deleted file mode 100644 index ac6a0c58e..000000000 Binary files a/ios/img/iTunesArtwork and /dev/null differ diff --git a/ios/img/iTunesArtwork.png b/ios/img/iTunesArtwork.png deleted file mode 100644 index b10824b04..000000000 Binary files a/ios/img/iTunesArtwork.png and /dev/null differ diff --git a/ios/img/iTunesArtwork@2x b/ios/img/iTunesArtwork@2x deleted file mode 100644 index fae1dad8b..000000000 Binary files a/ios/img/iTunesArtwork@2x and /dev/null differ diff --git a/ios/img/iTunesArtwork@2x.png b/ios/img/iTunesArtwork@2x.png deleted file mode 100644 index fdee900aa..000000000 Binary files a/ios/img/iTunesArtwork@2x.png and /dev/null differ diff --git a/ios/img/locateUser.png b/ios/img/locateUser.png deleted file mode 100644 index e0599e542..000000000 Binary files a/ios/img/locateUser.png and /dev/null differ diff --git a/ios/img/resetPosition.png b/ios/img/resetPosition.png deleted file mode 100644 index 81269cd4f..000000000 Binary files a/ios/img/resetPosition.png and /dev/null differ diff --git a/ios/img/toggleDebug.png b/ios/img/toggleDebug.png deleted file mode 100644 index aa5e3042f..000000000 Binary files a/ios/img/toggleDebug.png and /dev/null differ diff --git a/ios/img/toggleStyle.png b/ios/img/toggleStyle.png deleted file mode 100644 index 59a6f330f..000000000 Binary files a/ios/img/toggleStyle.png and /dev/null differ diff --git a/ios/img/unrotate.png b/ios/img/unrotate.png deleted file mode 100644 index 63361e99d..000000000 Binary files a/ios/img/unrotate.png and /dev/null differ diff --git a/ios/llmr-app.gyp b/ios/llmr-app.gyp deleted file mode 100644 index aeccd573f..000000000 --- a/ios/llmr-app.gyp +++ /dev/null @@ -1,70 +0,0 @@ -{ - 'includes': [ - '../common.gypi', - '../config.gypi' - ], - 'targets': [ - { - "target_name": "iosapp", - "product_name": "Mapbox GL", - "type": "executable", - "sources": [ - "./main.m", - "./MBXAppDelegate.h", - "./MBXAppDelegate.m", - "./MBXViewController.h", - "./MBXViewController.mm", - ' - -#import "MBXAppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([MBXAppDelegate class])); - } -} diff --git a/ios/mapbox-gl-cocoa b/ios/mapbox-gl-cocoa index 698f31b3c..93615fe8a 160000 --- a/ios/mapbox-gl-cocoa +++ b/ios/mapbox-gl-cocoa @@ -1 +1 @@ -Subproject commit 698f31b3c777b50839aa116340614f6f18d5087a +Subproject commit 93615fe8a3123332d608eaae0a9b804059bd8581 diff --git a/macosx/ATTRIBUTION b/macosx/ATTRIBUTION deleted file mode 100644 index dff33b3b9..000000000 --- a/macosx/ATTRIBUTION +++ /dev/null @@ -1 +0,0 @@ -Icon from http://dryicons.com/icon/architecture-blueprint-icons-set/map/ \ No newline at end of file diff --git a/scripts/compare_images.js b/scripts/compare_images.js new file mode 100755 index 000000000..3d33d4b50 --- /dev/null +++ b/scripts/compare_images.js @@ -0,0 +1,98 @@ +#!/usr/bin/env node + +var fs = require('fs'); +var path = require('path'); +var spawn = require('child_process').spawn; + +var base_dir = path.join(path.resolve('.'), 'test/fixtures/styles'); + +var files = fs.readdirSync(base_dir).filter(function(name) { + return name.match(/\.info\.json$/); +}); + +var html = + '\n' + + '\n' + + '\n' + + ' \n' + + ' \n' + + ' \n' + + '\n'; + +var exitCode = 0; + +processFiles(); + +function processFiles() { + if (!files.length) return done(); + + var name = files.shift(); + + var info = require(path.join(base_dir, name)); + var base = path.basename(name, '.info.json'); + + var actual = path.join(base_dir, base + '.actual.png'); + var expected = path.join(base_dir, base + '.expected.png'); + var diff = path.join(base_dir, base + '.diff.png'); + + var compare = spawn('compare', ['-metric', 'MAE', actual, expected, diff ]); + var error = ''; + compare.stderr.on('data', function(data) { + error += data.toString(); + }); + compare.on('exit', function(code, signal) { + // The compare program returns 2 on error otherwise 0 if the images are similar or 1 if they are dissimilar. + if (code == 2) { + writeResult(base, info, error.trim(), Infinity); + exitCode = 2; + } else { + var difference = parseFloat(error.match(/^\d+(?:\.\d+)?\s+\(([^\)]+)\)\s*$/)[1]); + writeResult(base, info, '', difference); + + } + return processFiles(); + }); + compare.stdin.end(); +} + +function writeResult(base, info, error, difference) { + var color = 'green'; + var allowedDifference = ('diff' in info) ? info.diff : 0.01; + if (difference > allowedDifference) { + color = 'red'; + if (exitCode < 1) { + exitCode = 1; + } + } + + html += + '\n' + + ' \n' + + ' \n' + + ' \n' + + '\n' + ; +} + +function done() { + html += "
ActualExpectedInfo
\n' + + '

' + base + '

\n' + + (error ? '

' + error + '

\n' : '') + + '
    \n' + + '
  • diff: ' + difference + '
  • \n' + + '
  • zoom: ' + (info.zoom || 0) + '
  • \n' + + '
  • latitude: ' + (info.latitude || 0) + '
  • \n' + + '
  • longitude: ' + (info.longitude || 0) + '
  • \n' + + '
  • angle: ' + (info.angle || 0) + '
  • \n' + + '
  • width: ' + (info.width || 0) + '
  • \n' + + '
  • height: ' + (info.height || 0) + '
  • \n' + + '
\n' + + '
\n"; + + fs.writeFileSync(path.join(base_dir, 'index.html'), html); + + process.exit(exitCode); +} \ No newline at end of file diff --git a/scripts/create_result_table.js b/scripts/create_result_table.js deleted file mode 100644 index ad604890f..000000000 --- a/scripts/create_result_table.js +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env node - -var fs = require('fs'); -var path = require('path'); - -var html = - '\n' + - '\n' + - '\n' + - ' \n' + - ' \n' + - ' \n' + - '\n'; - -var dir = fs.readdirSync('./test/fixtures/styles').filter(function(name) { - return name.match(/\.info\.json$/); -}).forEach(function(name) { - var info = require(path.join(path.resolve('.'), './test/fixtures/styles', name)); - var base = path.basename(name, '.info.json'); - - html += - '\n' + - ' \n' + - ' \n' + - ' \n' + - '\n' - ; -}); - -html += "
ActualExpectedInfo
\n' + - '

' + base + '

\n' + - '
    \n' + - '
  • zoom: ' + (info.zoom || 0) + '
  • \n' + - '
  • latitude: ' + (info.latitude || 0) + '
  • \n' + - '
  • longitude: ' + (info.longitude || 0) + '
  • \n' + - '
  • angle: ' + (info.angle || 0) + '
  • \n' + - '
  • width: ' + (info.width || 0) + '
  • \n' + - '
  • height: ' + (info.height || 0) + '
  • \n' + - '
\n' + - '