Skip to content

Commit

Permalink
Merge pull request #38 from ngageoint/develop
Browse files Browse the repository at this point in the history
2.0.2 release
  • Loading branch information
bosborn authored Mar 21, 2018
2 parents cbd653c + d32b22a commit f4e8627
Show file tree
Hide file tree
Showing 56 changed files with 1,975 additions and 238 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ Adheres to [Semantic Versioning](http://semver.org/).

---

## 2.0.2 (TBD)

* TBD
## [2.0.2](https://github.com/ngageoint/geopackage-ios/releases/tag/2.0.2) (03-21-2018)

* Tile Scaling extension for displaying missing tiles using nearby zoom levels
* Projection Transform "is same projection" method
* Tile DAO zoom level improvements and approximate zoom level determinations
* Skip tiles drawn from features when no features overlap the tile
* Tile Generator fix to save updated bounds in the Tile Matrix Set
* Tile Generator projection transformations only when projections differ
* Stream closing improvements
* Feature Tiles close method
* RTree Trigger Update 3 spec fix

## [2.0.1](https://github.com/ngageoint/geopackage-ios/releases/tag/2.0.1) (02-14-2018)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pull from [CocoaPods](https://cocoapods.org/pods/geopackage-ios):
Pull from GitHub via CocoaPods:

pod 'geopackage-ios', :git => 'https://github.com/ngageoint/geopackage-ios.git', :branch => 'master'
pod 'geopackage-ios', :git => 'https://github.com/ngageoint/geopackage-ios.git', :tag => '2.0.1'
pod 'geopackage-ios', :git => 'https://github.com/ngageoint/geopackage-ios.git', :tag => '2.0.2'

Include as local project:

Expand Down
66 changes: 66 additions & 0 deletions geopackage-ios.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions geopackage-ios/GPKGGeoPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#import "GPKGGriddedTileDao.h"
#import "GPKGAttributesTable.h"
#import "GPKGAttributesDao.h"
#import "GPKGTileScalingDao.h"

/**
* A single GeoPackage database connection
Expand Down Expand Up @@ -772,4 +773,18 @@
-(GPKGAttributesTable *) createAttributesTableWithTableName: (NSString *) tableName
andColumns: (NSArray *) columns;

/**
* Get a Tile Scaling DAO
*
* @return tile scaling dao
*/
-(GPKGTileScalingDao *) getTileScalingDao;

/**
* Create the Tile Scaling Table if it does not exist
*
* @return true if created
*/
-(BOOL) createTileScalingTable;

@end
17 changes: 17 additions & 0 deletions geopackage-ios/GPKGGeoPackage.m
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,23 @@ -(GPKGAttributesTable *) createAttributesTableWithTableName: (NSString *) tableN
return table;
}

-(GPKGTileScalingDao *) getTileScalingDao{
return [[GPKGTileScalingDao alloc] initWithDatabase:self.database];
}

-(BOOL) createTileScalingTable{

[self verifyWritable];

BOOL created = false;
GPKGTileScalingDao * dao = [self getTileScalingDao];
if(![dao tableExists]){
created = [self.tableCreator createTileScaling] > 0;
}

return created;
}

-(GPKGSpatialReferenceSystem *) getSrs: (NSNumber *) srsId{
GPKGSpatialReferenceSystemDao * dao = [self getSpatialReferenceSystemDao];
GPKGSpatialReferenceSystem * srs = (GPKGSpatialReferenceSystem *)[dao queryForIdObject:srsId];
Expand Down
7 changes: 7 additions & 0 deletions geopackage-ios/db/GPKGGeoPackageTableCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@
*/
-(int) createFeatureTileLink;

/**
* Create Tile Scaling table
*
* @return tables created
*/
-(int) createTileScaling;

/**
* Create the user table
*
Expand Down
5 changes: 5 additions & 0 deletions geopackage-ios/db/GPKGGeoPackageTableCreator.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#import "GPKGFeatureTileLink.h"
#import "GPKGGriddedCoverage.h"
#import "GPKGGriddedTile.h"
#import "GPKGTileScaling.h"
#import "GPKGSqlUtils.h"

@implementation GPKGGeoPackageTableCreator
Expand Down Expand Up @@ -94,6 +95,10 @@ -(int) createFeatureTileLink{
return [self createTable:GPKG_FTL_TABLE_NAME];
}

-(int) createTileScaling{
return [self createTable:GPKG_TS_TABLE_NAME];
}

-(int) createTable: (NSString *) tableName{

NSString * tablesProperties = [GPKGIOUtils getPropertyListPathWithName:GPKG_GEO_PACKAGE_RESOURCES_TABLES];
Expand Down
16 changes: 16 additions & 0 deletions geopackage-ios/extension/GPKGNGAExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,20 @@
*/
+(void) deleteFeatureTileLinkExtensionWithGeoPackage: (GPKGGeoPackage *) geoPackage;

/**
* Delete the Tile Scaling extensions for the table
*
* @param geoPackage GeoPackage
* @param table table name
*/
+(void) deleteTileScalingWithGeoPackage: (GPKGGeoPackage *) geoPackage andTable: (NSString *) table;

/**
* Delete the Tile Scaling extension including the extension entries and
* custom tables
*
* @param geoPackage GeoPackage
*/
+(void) deleteTileScalingExtensionWithGeoPackage: (GPKGGeoPackage *) geoPackage;

@end
33 changes: 33 additions & 0 deletions geopackage-ios/extension/GPKGNGAExtensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
#import "GPKGFeatureTableIndex.h"
#import "GPKGFeatureTileLinkDao.h"
#import "GPKGFeatureTileTableLinker.h"
#import "GPKGTileTableScaling.h"

@implementation GPKGNGAExtensions

+(void) deleteTableExtensionsWithGeoPackage: (GPKGGeoPackage *) geoPackage andTable: (NSString *) table{

[self deleteGeometryIndexWithGeoPackage:geoPackage andTable:table];
[self deleteFeatureTileLinkWithGeoPackage:geoPackage andTable:table];
[self deleteTileScalingWithGeoPackage:geoPackage andTable:table];

// Delete future extensions for the table here
}
Expand All @@ -25,6 +27,7 @@ +(void) deleteExtensionsWithGeoPackage: (GPKGGeoPackage *) geoPackage{

[self deleteGeometryIndexExtensionWithGeoPackage:geoPackage];
[self deleteFeatureTileLinkExtensionWithGeoPackage:geoPackage];
[self deleteTileScalingExtensionWithGeoPackage:geoPackage];

// Delete future extension tables here
}
Expand Down Expand Up @@ -86,4 +89,34 @@ +(void) deleteFeatureTileLinkExtensionWithGeoPackage: (GPKGGeoPackage *) geoPack
}
}

+(void) deleteTileScalingWithGeoPackage: (GPKGGeoPackage *) geoPackage andTable: (NSString *) table{

GPKGTileScalingDao *tileScalingDao = [geoPackage getTileScalingDao];
GPKGExtensionsDao * extensionsDao = [geoPackage getExtensionsDao];

if([tileScalingDao tableExists]){
[tileScalingDao deleteById:table];
}
if([extensionsDao tableExists]){
NSString * extension = [GPKGExtensions buildExtensionNameWithAuthor:GPKG_EXTENSION_TILE_SCALING_AUTHOR andExtensionName:GPKG_EXTENSION_TILE_SCALING_NAME_NO_AUTHOR];
[extensionsDao deleteByExtension:extension andTable:table];
}

}

+(void) deleteTileScalingExtensionWithGeoPackage: (GPKGGeoPackage *) geoPackage{

GPKGTileScalingDao *tileScalingDao = [geoPackage getTileScalingDao];
GPKGExtensionsDao * extensionsDao = [geoPackage getExtensionsDao];

if([tileScalingDao tableExists]){
[tileScalingDao dropTable];
}
if([extensionsDao tableExists]){
NSString * extension = [GPKGExtensions buildExtensionNameWithAuthor:GPKG_EXTENSION_TILE_SCALING_AUTHOR andExtensionName:GPKG_EXTENSION_TILE_SCALING_NAME_NO_AUTHOR];
[extensionsDao deleteByExtension:extension];
}

}

@end
1 change: 0 additions & 1 deletion geopackage-ios/extension/GPKGRTreeIndexExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern NSString * const GPKG_RTREE_INDEX_EXTENSION_NAME;

/**
* RTree Index Extension
* TODO Not currently supported for Android, user defined functions are not supported.
*/
@interface GPKGRTreeIndexExtension : GPKGBaseExtension

Expand Down
43 changes: 23 additions & 20 deletions geopackage-ios/extension/coverage/GPKGCoverageData.m
Original file line number Diff line number Diff line change
Expand Up @@ -1624,27 +1624,30 @@ -(NSArray *) valuesWithTileMatrix: (GPKGTileMatrix *) tileMatrix andTileResults:
for (int y = minDestY; y <= maxDestY; y++) {
for (int x = minDestX; x <= maxDestX; x++) {

// Determine the coverage data value based upon the
// selected algorithm
NSDecimalNumber * value = nil;
switch (self.algorithm) {
case GPKG_CDA_NEAREST_NEIGHBOR:
value = [self nearestNeighborValueWithGriddedTile:griddedTile andCoverageDataImage:image andLeftLastColumns:leftLastColumns andTopLeftRows:topLeftRows andTopRows:topRows andY:y andX:x andWidthRatio:widthRatio andHeightRatio:heightRatio andDestTop:dest.origin.y andDestLeft:dest.origin.x andSrcTop:src.origin.y andSrcLeft:src.origin.x];
break;
case GPKG_CDA_BILINEAR:
value = [self bilinearInterpolationValueWithGriddedTile:griddedTile andCoverageDataImage:image andLeftLastColumns:leftLastColumns andTopLeftRows:topLeftRows andTopRows:topRows andY:y andX:x andWidthRatio:widthRatio andHeightRatio:heightRatio andDestTop:dest.origin.y andDestLeft:dest.origin.x andSrcTop:src.origin.y andSrcLeft:src.origin.x];
break;
case GPKG_CDA_BICUBIC:
value = [self bicubicInterpolationValueWithGriddedTile:griddedTile andCoverageDataImage:image andLeftLastColumns:leftLastColumns andTopLeftRows:topLeftRows andTopRows:topRows andY:y andX:x andWidthRatio:widthRatio andHeightRatio:heightRatio andDestTop:dest.origin.y andDestLeft:dest.origin.x andSrcTop:src.origin.y andSrcLeft:src.origin.x];
break;
default:
[NSException raise:@"Unsupported Algorithm" format:@"Algorithm is not supported: %u", self.algorithm];
if([self objectInDoubleArray:values atIndex1:y andIndex2:x] == nil){

// Determine the coverage data value based upon the
// selected algorithm
NSDecimalNumber * value = nil;
switch (self.algorithm) {
case GPKG_CDA_NEAREST_NEIGHBOR:
value = [self nearestNeighborValueWithGriddedTile:griddedTile andCoverageDataImage:image andLeftLastColumns:leftLastColumns andTopLeftRows:topLeftRows andTopRows:topRows andY:y andX:x andWidthRatio:widthRatio andHeightRatio:heightRatio andDestTop:dest.origin.y andDestLeft:dest.origin.x andSrcTop:src.origin.y andSrcLeft:src.origin.x];
break;
case GPKG_CDA_BILINEAR:
value = [self bilinearInterpolationValueWithGriddedTile:griddedTile andCoverageDataImage:image andLeftLastColumns:leftLastColumns andTopLeftRows:topLeftRows andTopRows:topRows andY:y andX:x andWidthRatio:widthRatio andHeightRatio:heightRatio andDestTop:dest.origin.y andDestLeft:dest.origin.x andSrcTop:src.origin.y andSrcLeft:src.origin.x];
break;
case GPKG_CDA_BICUBIC:
value = [self bicubicInterpolationValueWithGriddedTile:griddedTile andCoverageDataImage:image andLeftLastColumns:leftLastColumns andTopLeftRows:topLeftRows andTopRows:topRows andY:y andX:x andWidthRatio:widthRatio andHeightRatio:heightRatio andDestTop:dest.origin.y andDestLeft:dest.origin.x andSrcTop:src.origin.y andSrcLeft:src.origin.x];
break;
default:
[NSException raise:@"Unsupported Algorithm" format:@"Algorithm is not supported: %u", self.algorithm];
}

if (value != nil) {
[self replaceObjectInDoubleArray:values atIndex1:y andIndex2:x withValue:value];
}

}

if (value != nil) {
[self replaceObjectInDoubleArray:values atIndex1:y andIndex2:x withValue:value];
}

}
}

Expand Down
2 changes: 1 addition & 1 deletion geopackage-ios/extension/rtree_sql.plist
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ END;</string>
</array>
<key>trigger.update3</key>
<array>
<string>CREATE TRIGGER &quot;rtree_&lt;t&gt;_&lt;c&gt;_update3&quot; AFTER UPDATE OF &quot;&lt;c&gt;&quot; ON &quot;&lt;t&gt;&quot;
<string>CREATE TRIGGER &quot;rtree_&lt;t&gt;_&lt;c&gt;_update3&quot; AFTER UPDATE ON &quot;&lt;t&gt;&quot;
WHEN OLD.&quot;&lt;i&gt;&quot; != NEW.&quot;&lt;i&gt;&quot; AND
(NEW.&quot;&lt;c&gt;&quot; NOTNULL AND NOT ST_IsEmpty(NEW.&quot;&lt;c&gt;&quot;))
BEGIN
Expand Down
122 changes: 122 additions & 0 deletions geopackage-ios/extension/scale/GPKGTileScaling.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// GPKGTileScaling.h
// geopackage-ios
//
// Created by Brian Osborn on 3/12/18.
// Copyright © 2018 NGA. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GPKGTileMatrixSet.h"
#import "GPKGTileScalingTypes.h"

/**
* Tile Scaling table constants
*/
extern NSString * const GPKG_TS_TABLE_NAME;
extern NSString * const GPKG_TS_COLUMN_PK;
extern NSString * const GPKG_TS_COLUMN_TABLE_NAME;
extern NSString * const GPKG_TS_COLUMN_SCALING_TYPE;
extern NSString * const GPKG_TS_COLUMN_ZOOM_IN;
extern NSString * const GPKG_TS_COLUMN_ZOOM_OUT;

@interface GPKGTileScaling : NSObject <NSMutableCopying>

/**
* Foreign key to table_name in gpkg_tile_matrix_set
*/
@property (nonatomic, strong) NSString *tableName;

/**
* Tile Scaling behavior type
*/
@property (nonatomic, strong) NSString *scalingType;

/**
* Max zoom levels in to search
*/
@property (nonatomic, strong) NSNumber *zoomIn;

/**
* Max zoom levels out to search
*/
@property (nonatomic, strong) NSNumber *zoomOut;

/**
* Initialize
*
* @return new tile scaling
*/
-(instancetype) init;

/**
* Initialize
*
* @param tileMatrixSet tile matrix set
* @param scalingType scaling type
* @param zoomIn max zoom in levels
* @param zoomOut max zoom out levels
*
* @return new tile scaling
*/
-(instancetype) initWithTileMatrixSet: (GPKGTileMatrixSet *) tileMatrixSet andScalingType: (enum GPKGTileScalingType) scalingType andZoomIn: (NSNumber *) zoomIn andZoomOut: (NSNumber *) zoomOut;

/**
* Initialize
*
* @param tableName table name
* @param scalingType scaling type
* @param zoomIn max zoom in levels
* @param zoomOut max zoom out levels
*
* @return new tile scaling
*/
-(instancetype) initWithTableName: (NSString *) tableName andScalingType: (enum GPKGTileScalingType) scalingType andZoomIn: (NSNumber *) zoomIn andZoomOut: (NSNumber *) zoomOut;

/**
* Initialize
*
* @param scalingType scaling type
* @param zoomIn max zoom in levels
* @param zoomOut max zoom out levels
*
* @return new tile scaling
*/
-(instancetype) initWithScalingType: (enum GPKGTileScalingType) scalingType andZoomIn: (NSNumber *) zoomIn andZoomOut: (NSNumber *) zoomOut;

/**
* Set the tile matrix set
*
* @param tileMatrixSet tile matrix set
*/
-(void) setTileMatrixSet: (GPKGTileMatrixSet *) tileMatrixSet;

/**
* Get the tile scaling type
*
* @return tile scaling type
*/
-(enum GPKGTileScalingType) getTileScalingType;

/**
* Set the tile scaling type
*
* @param scalingType tile scaling type
*/
-(void) setTileScalingType: (enum GPKGTileScalingType) scalingType;

/**
* Is zoom in tile search enabled
*
* @return true if zoom in for tiles is allowed
*/
-(BOOL) isZoomIn;

/**
* Is zoom out tile search enabled
*
* @return true if zoom out for tiles is allowed
*/
-(BOOL) isZoomOut;

@end
Loading

0 comments on commit f4e8627

Please sign in to comment.