Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tyburg committed Mar 31, 2021
2 parents 2b8bf71 + 9707dba commit d1d150c
Show file tree
Hide file tree
Showing 154 changed files with 2,100 additions and 5,527 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
platform :ios, '12.0'

inhibit_all_warnings!

target 'mapcache-ios' do
pod 'geopackage-ios', '~> 4.0.1'
pod 'geopackage-ios', '~> 6.0.0'
pod 'Fingertips', '~> 0.5.0'
end
Binary file modified mapcache-ios-geopackage.sketch
Binary file not shown.
204 changes: 47 additions & 157 deletions mapcache-ios.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions mapcache-ios/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

#import "AppDelegate.h"
#import "GPKGGeoPackageFactory.h"
#import "GPKGSManagerViewController.h"
#import "MCConstants.h"
#import "MCProperties.h"
#import "MBFingerTipWindow.h"
#import "mapcache_ios-Swift.h"


@interface AppDelegate ()
@property (strong, nonatomic) NSMutableArray *childCoordinators;
@property (strong, nonatomic) GPKGGeoPackageManager *manager;
@property (strong, nonatomic) MCTileServerRepository *tileServerRepository;
@property (nonatomic, strong) GPKGGeoPackageCache *geoPackages;
@end

Expand Down Expand Up @@ -44,6 +46,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
mapCoordinator.drawerViewDelegate = drawerCoordinator;
[_childCoordinators addObject:drawerCoordinator];
[_childCoordinators addObject:mapCoordinator];

_window.rootViewController = mapViewController;

BOOL preventDisclaimer = [[NSUserDefaults standardUserDefaults] boolForKey:@"preventDisclaimer"];
Expand All @@ -55,6 +58,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
_manager = [GPKGGeoPackageFactory manager];
_geoPackages = [[GPKGGeoPackageCache alloc] initWithManager:self.manager];

_tileServerRepository = [MCTileServerRepository shared];
[_tileServerRepository loadUserDefaults];

return YES;
}

Expand Down Expand Up @@ -141,8 +147,6 @@ - (BOOL) application:(UIApplication *)application openURL:(NSURL *)


- (void) setupApplicationAppearance {
UIApplication.sharedApplication.statusBarStyle = UIStatusBarStyleLightContent;

[[UINavigationBar appearance] setBarTintColor:[MCColorUtil getPrimary]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
Expand Down
23 changes: 17 additions & 6 deletions mapcache-ios/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -18,19 +17,31 @@
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LoadingScreen" translatesAutoresizingMaskIntoConstraints="NO" id="ezn-dY-R42">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VOr-px-ERH">
<rect key="frame" x="0.0" y="239" width="375" height="428"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="ezn-dY-R42" secondAttribute="bottom" id="3a5-9Q-kcb"/>
<constraint firstItem="VOr-px-ERH" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="4Lg-kq-t0z"/>
<constraint firstItem="VOr-px-ERH" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="9Xo-q0-Edu"/>
<constraint firstItem="ezn-dY-R42" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="EDG-Qv-2Dk"/>
<constraint firstItem="ezn-dY-R42" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="MqU-qm-rgN"/>
<constraint firstAttribute="bottom" secondItem="VOr-px-ERH" secondAttribute="bottom" id="dsy-NT-WPN"/>
<constraint firstItem="VOr-px-ERH" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="239" id="lCk-os-gn5"/>
<constraint firstAttribute="trailing" secondItem="ezn-dY-R42" secondAttribute="trailing" id="p0X-1N-1ad"/>
<constraint firstAttribute="trailing" secondItem="VOr-px-ERH" secondAttribute="trailing" id="z6u-M3-BLa"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
<point key="canvasLocation" x="548" y="454.72263868065971"/>
</view>
</objects>
<resources>
<image name="LoadingScreen" width="375" height="667"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
6 changes: 3 additions & 3 deletions mapcache-ios/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
23 changes: 23 additions & 0 deletions mapcache-ios/Images.xcassets/Layer.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Layer.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "TileServerError.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mapcache-ios/data/MCGeoPackageRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)copyGeoPacakge:(NSString *)geoPacakgeName to:(NSString *)newName;
- (BOOL)savePoints:(NSArray<GPKGMapPoint *> *) points toDatabase:(MCDatabase *) database table:(MCTable *) table;
- (BOOL)createFeatueLayerIn:(NSString *)database withGeomertyColumns:(GPKGGeometryColumns *)geometryColumns boundingBox:(GPKGBoundingBox *)boundingBox srsId:(NSNumber *) srsId;
- (BOOL) deleteLayer:(MCTable *) table;
- (BOOL) renameTable:(MCTable *) table toNewName:(NSString *)newTableName;
- (NSArray *)tileMatricesForTableNamed:(NSString *) tableName inDatabase:(NSString *)databaseName;
- (GPKGUserRow *)queryRow:(int)rowId fromTableNamed:(NSString *)tableName inDatabase:(NSString *)databaseName;
Expand Down
27 changes: 25 additions & 2 deletions mapcache-ios/data/MCGeoPackageRepository.m
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ - (BOOL) createFeatueLayerIn:(NSString *)database withGeomertyColumns:(GPKGGeome

@try {
geoPackage = [_manager open:database];
//[geoPackage createFeatureTableWithGeometryColumns:geometryColumns andBoundingBox:boundingBox andSrsId:srsId];
[geoPackage createFeatureTableWithGeometryColumns:geometryColumns andIdColumnName:@"id" andBoundingBox:boundingBox andSrsId:srsId];
[geometryColumns setSrsId:srsId];
[geoPackage createFeatureTableWithMetadata:[GPKGFeatureTableMetadata createWithGeometryColumns:geometryColumns andBoundingBox:boundingBox]];
}
@catch (NSException *e) {
// TODO handle this
Expand All @@ -281,6 +281,29 @@ - (BOOL) createFeatueLayerIn:(NSString *)database withGeomertyColumns:(GPKGGeome
}


- (BOOL) deleteLayer:(MCTable *) table {
GPKGGeoPackage *geoPackage = nil;
BOOL didDelete = NO;

@try {
geoPackage = [self.manager open:table.database];
[geoPackage deleteTable:table.name];
[self.activeDatabases removeTable:table];
didDelete = YES;
}
@catch (NSException *exception) {
[MCUtils showMessageWithDelegate:self
andTitle:[NSString stringWithFormat:@"%@ %@ - %@ Table", [MCProperties getValueOfProperty:GPKGS_PROP_GEOPACKAGE_TABLE_DELETE_LABEL], table.database, table.name]
andMessage:[NSString stringWithFormat:@"%@", [exception description]]];
}
@finally {
[geoPackage close];
[self regenerateDatabaseList];
return didDelete;
}
}


- (BOOL) renameTable:(MCTable *) table toNewName:(NSString *)newTableName {
GPKGGeoPackage *geoPackage;
BOOL didRenameTable = YES;
Expand Down
32 changes: 32 additions & 0 deletions mapcache-ios/data/MCServerError.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// MCServerError.h
// mapcache-ios
//
// Created by Tyler Burgett on 10/26/20.
// Copyright © 2020 NGA. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, MCServerType) {
MCXYZTileServer,
MCTMSTileServer,
MCWMSTileServer
};


typedef NS_ENUM(NSInteger, MCServerErrorType) {
MCURLInvalid,
MCTileServerNoResponse,
MCNoData,
MCTileServerParseError,
MCNoError
};

@interface MCServerError : NSError

@end

NS_ASSUME_NONNULL_END
13 changes: 13 additions & 0 deletions mapcache-ios/data/MCServerError.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// MCServerError.m
// mapcache-ios
//
// Created by Tyler Burgett on 10/26/20.
// Copyright © 2020 NGA. All rights reserved.
//

#import "MCServerError.h"

@implementation MCServerError

@end
Loading

0 comments on commit d1d150c

Please sign in to comment.