Skip to content

Commit

Permalink
Merge pull request #21 from ngageoint/develop
Browse files Browse the repository at this point in the history
Develop to Master, 1.11 updates
  • Loading branch information
bosborn committed May 10, 2016
2 parents d021cdc + ec3f56e commit 96e4e41
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Adheres to [Semantic Versioning](http://semver.org/).

## 1.11 (TBD)

* TBD
* geopackage-android version updated to 1.2.9
* Natural Earth Rivers GeoPackage URL

## [1.10](https://github.com/ngageoint/geopackage-mapcache-android/releases/tag/1.10) (04-19-2016)

Expand Down
2 changes: 1 addition & 1 deletion mapcache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ android {
}

dependencies {
compile "mil.nga.geopackage:geopackage-android:1.2.8" // comment out to build locally
compile "mil.nga.geopackage:geopackage-android:1.2.9" // comment out to build locally
//compile project(':geopackage-sdk') // uncomment me to build locally
compile 'com.google.android.gms:play-services:8.4.0'
}
49 changes: 40 additions & 9 deletions mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import com.google.android.gms.maps.model.TileOverlayOptions;
import com.google.android.gms.maps.model.TileProvider;

import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
Expand Down Expand Up @@ -106,6 +107,8 @@
import mil.nga.geopackage.projection.ProjectionConstants;
import mil.nga.geopackage.projection.ProjectionFactory;
import mil.nga.geopackage.projection.ProjectionTransform;
import mil.nga.geopackage.schema.columns.DataColumns;
import mil.nga.geopackage.schema.columns.DataColumnsDao;
import mil.nga.geopackage.tiles.TileBoundingBoxUtils;
import mil.nga.geopackage.tiles.features.FeatureTiles;
import mil.nga.geopackage.tiles.features.MapFeatureTiles;
Expand Down Expand Up @@ -2927,10 +2930,7 @@ public void onClick(DialogInterface dialog, int item) {
if (item >= 0) {
switch (item) {
case 0:
infoExistingFeatureOption(featureRow, title, geomData);
if (geoPackage != null) {
geoPackage.close();
}
infoExistingFeatureOption(geoPackage, featureRow, title, geomData);
break;
case 1:
tempEditFeatureMarker = marker;
Expand Down Expand Up @@ -2995,35 +2995,66 @@ private void infoFeatureClick(final Marker marker, MarkerFeature markerFeature)
.getGeometryType();

String title = getTitle(geometryType, marker);
infoExistingFeatureOption(featureRow, title, geomData);

infoExistingFeatureOption(geoPackage, featureRow, title, geomData);
}else {
geoPackage.close();
}
geoPackage.close();
}

/**
* Info existing feature option
*
* @param geoPackage
* @param featureRow
* @param title
* @param geomData
*/
private void infoExistingFeatureOption(FeatureRow featureRow,
private void infoExistingFeatureOption(final GeoPackage geoPackage,
FeatureRow featureRow,
String title,
GeoPackageGeometryData geomData) {

DataColumnsDao dataColumnsDao = geoPackage.getDataColumnsDao();
try {
if(!dataColumnsDao.isTableExists()){
dataColumnsDao = null;
}
} catch (SQLException e) {
dataColumnsDao = null;
Log.e(GeoPackageMapFragment.class.getSimpleName(),
"Failed to check if Data Columns table exists for GeoPackage: "
+ geoPackage.getName(), e);
}

StringBuilder message = new StringBuilder();
int geometryColumn = featureRow.getGeometryColumnIndex();
for (int i = 0; i < featureRow.columnCount(); i++) {
if (i != geometryColumn) {
Object value = featureRow.getValue(i);
if (value != null) {
message.append(featureRow.getColumn(i).getName()).append(": ");
String columnName = featureRow.getColumn(i).getName();
if(dataColumnsDao != null) {
try {
DataColumns dataColumn = dataColumnsDao.getDataColumn(featureRow.getTable().getTableName(), columnName);
if (dataColumn != null) {
columnName = dataColumn.getName();
}
} catch (SQLException e) {
Log.e(GeoPackageMapFragment.class.getSimpleName(),
"Failed to search for Data Column name for column: " + columnName
+ ", Feature Table: " + featureRow.getTable().getTableName()
+ ", GeoPackage: " + geoPackage.getName(), e);
}
}
message.append(columnName).append(": ");
message.append(value);
message.append("\n");
}
}
}
if (geoPackage != null) {
geoPackage.close();
}

if (message.length() > 0) {
message.append("\n");
Expand Down
3 changes: 3 additions & 0 deletions mapcache/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,23 @@
<string name="button_cancel_label">Cancel</string>

<string-array name="preloaded_geopackage_url_labels">
<item>Natural Earth Rivers</item>
<item>GDAL Sample</item>
<item>Simple Sewers</item>
<item>Haiti</item>
<item>Belgium Geonames</item>
<item>ERDC Whitehorse</item>
</string-array>
<string-array name="preloaded_geopackage_urls">
<item>http://ngageoint.github.io/GeoPackage/examples/rivers.gpkg</item>
<item>http://www.geopackage.org/data/gdal_sample.gpkg</item>
<item>http://www.geopackage.org/data/simple_sewer_features.gpkg</item>
<item>http://www.geopackage.org/data/haiti-vectors-split.gpkg</item>
<item>http://www.geopackage.org/data/geonames_belgium.gpkg</item>
<item>https://portal.opengeospatial.org/files/63156</item>
</string-array>
<string-array name="preloaded_geopackage_url_names">
<item>rivers</item>
<item>gdal_sample</item>
<item>simple_sewer_features</item>
<item>haiti-vectors-split</item>
Expand Down

0 comments on commit 96e4e41

Please sign in to comment.