diff --git a/CHANGELOG.md b/CHANGELOG.md index 286a5b8d..e914941c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ Adheres to [Semantic Versioning](http://semver.org/). ## 1.1.9 (TBD) -* TBD +* GeoPackage validate has GeoPackage extension bug fix +* Additional GeoPackage manager import GeoPackage from path method +* GeoPackage table type check methods ## [1.1.8](https://github.com/ngageoint/geopackage-ios/releases/tag/1.1.8) (02-22-2016) diff --git a/geopackage-ios/GPKGGeoPackage.h b/geopackage-ios/GPKGGeoPackage.h index 54d97ee1..dcd986a8 100644 --- a/geopackage-ios/GPKGGeoPackage.h +++ b/geopackage-ios/GPKGGeoPackage.h @@ -95,6 +95,33 @@ */ -(NSArray *)getTables; +/** + * Check if the table is a feature table + * + * @param table table name + * + * @return true if a feature table + */ +-(BOOL) isFeatureTable: (NSString *) table; + +/** + * Check if the table is a tile table + * + * @param table table name + * + * @return true if a tile table + */ +-(BOOL) isTileTable: (NSString *) table; + +/** + * Check if the table exists as a feature or tile table + * + * @param table table name + * + * @return true if a feature or tile table + */ +-(BOOL) isFeatureOrTileTable: (NSString *) table; + /** * Get the feature table count * diff --git a/geopackage-ios/GPKGGeoPackage.m b/geopackage-ios/GPKGGeoPackage.m index 26d9117c..a30eb128 100644 --- a/geopackage-ios/GPKGGeoPackage.m +++ b/geopackage-ios/GPKGGeoPackage.m @@ -68,6 +68,21 @@ -(NSArray *)getTables{ return tables; } +-(BOOL) isFeatureTable: (NSString *) table{ + NSSet * featureTables = [[NSSet alloc] initWithArray:[self getFeatureTables]]; + return [featureTables containsObject:table]; +} + +-(BOOL) isTileTable: (NSString *) table{ + NSSet * tileTables = [[NSSet alloc] initWithArray:[self getTileTables]]; + return [tileTables containsObject:table]; +} + +-(BOOL) isFeatureOrTileTable: (NSString *) table{ + NSSet * tables = [[NSSet alloc] initWithArray:[self getTables]]; + return [tables containsObject:table]; +} + -(int)getFeatureTableCount{ int count = 0; GPKGGeometryColumnsDao *dao = [self getGeometryColumnsDao]; diff --git a/geopackage-ios/factory/GPKGGeoPackageManager.h b/geopackage-ios/factory/GPKGGeoPackageManager.h index 41fd12c1..ef28283b 100644 --- a/geopackage-ios/factory/GPKGGeoPackageManager.h +++ b/geopackage-ios/factory/GPKGGeoPackageManager.h @@ -241,6 +241,18 @@ */ -(BOOL) importGeoPackageFromPath: (NSString *) path withName: (NSString *) name inDirectory: (NSString *) dbDirectory andOverride: (BOOL) override; +/** + * Import a GeoPackage file from a path and name it with existing file overide and move instead of copy option + * + * @param path GeoPackage path + * @param name creation name + * @param override true to override an existing GeoPackage + * @param moveFile true to move GeoPackage instead of copying + * + * @return true if imported + */ +-(BOOL) importGeoPackageFromPath: (NSString *) path withName: (NSString *) name andOverride: (BOOL) override andMove: (BOOL) moveFile; + /** * Import a GeoPackage file from a path and name it into a directory with existing file overide and move instead of copy option * diff --git a/geopackage-ios/factory/GPKGGeoPackageManager.m b/geopackage-ios/factory/GPKGGeoPackageManager.m index c20dd997..32d42cf2 100644 --- a/geopackage-ios/factory/GPKGGeoPackageManager.m +++ b/geopackage-ios/factory/GPKGGeoPackageManager.m @@ -240,6 +240,10 @@ -(BOOL) importGeoPackageFromPath: (NSString *) path withName: (NSString *) name return [self importGeoPackageFromPath:path withName:name inDirectory:dbDirectory andOverride:override andMove:false]; } +-(BOOL) importGeoPackageFromPath: (NSString *) path withName: (NSString *) name andOverride: (BOOL) override andMove: (BOOL) moveFile{ + return [self importGeoPackageFromPath:path withName:name inDirectory:nil andOverride:override andMove:moveFile]; +} + -(BOOL) importGeoPackageFromPath: (NSString *) path withName: (NSString *) name inDirectory: (NSString *) dbDirectory andOverride: (BOOL) override andMove: (BOOL) moveFile{ // Verify the file has the right extension diff --git a/geopackage-ios/validate/GPKGGeoPackageValidate.m b/geopackage-ios/validate/GPKGGeoPackageValidate.m index cc415dd8..1db3f1f3 100644 --- a/geopackage-ios/validate/GPKGGeoPackageValidate.m +++ b/geopackage-ios/validate/GPKGGeoPackageValidate.m @@ -14,8 +14,8 @@ @implementation GPKGGeoPackageValidate +(BOOL) hasGeoPackageExtension: (NSString *) file{ NSString * extension = [file pathExtension]; BOOL isGeoPackage = extension != nil - && ([extension caseInsensitiveCompare:GPKG_GEOPACKAGE_EXTENSION] - || [extension caseInsensitiveCompare:GPKG_GEOPACKAGE_EXTENDED_EXTENSION]); + && ([extension caseInsensitiveCompare:GPKG_GEOPACKAGE_EXTENSION] == NSOrderedSame + || [extension caseInsensitiveCompare:GPKG_GEOPACKAGE_EXTENDED_EXTENSION] == NSOrderedSame); return isGeoPackage; }