本文整理汇总了Java中mil.nga.geopackage.GeoPackageException类的典型用法代码示例。如果您正苦于以下问题:Java GeoPackageException类的具体用法?Java GeoPackageException怎么用?Java GeoPackageException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoPackageException类属于mil.nga.geopackage包,在下文中一共展示了GeoPackageException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUpImport
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Set up the import database
*
* @param activity
* @param testContext
* @return
*/
public static GeoPackage setUpImport(Activity activity, Context testContext) {
GeoPackageManager manager = GeoPackageFactory.getManager(activity);
// Delete
manager.delete(TestConstants.IMPORT_DB_NAME);
// Copy the test db file from assets to the internal storage
TestUtils.copyAssetFileToInternalStorage(activity, testContext,
TestConstants.IMPORT_DB_FILE_NAME);
// Import
String importLocation = TestUtils.getAssetFileInternalStorageLocation(
activity, TestConstants.IMPORT_DB_FILE_NAME);
manager.importGeoPackage(new File(importLocation));
// Open
GeoPackage geoPackage = manager.open(TestConstants.IMPORT_DB_NAME);
if (geoPackage == null) {
throw new GeoPackageException("Failed to open database");
}
return geoPackage;
}
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:32,代码来源:TestSetupTeardown.java
示例2: setContents
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
public void setContents(Contents contents) {
this.contents = contents;
if (contents != null) {
// Verify the Contents have a features data type (Spec Requirement
// 23)
ContentsDataType dataType = contents.getDataType();
if (dataType == null || dataType != ContentsDataType.FEATURES) {
throw new GeoPackageException("The "
+ Contents.class.getSimpleName() + " of a "
+ GeometryColumns.class.getSimpleName()
+ " must have a data type of "
+ ContentsDataType.FEATURES.getName());
}
tableName = contents.getId();
} else {
tableName = null;
}
}
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:19,代码来源:GeometryColumns.java
示例3: FeatureDao
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Constructor
*
* @param database
* @param db
* @param featureDb
* @param geometryColumns
* @param table
*/
public FeatureDao(String database, GeoPackageConnection db, FeatureConnection featureDb, GeometryColumns geometryColumns,
FeatureTable table) {
super(database, db, featureDb, table);
this.featureDb = featureDb;
this.geometryColumns = geometryColumns;
if (geometryColumns.getContents() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ Contents.class.getSimpleName());
}
if (geometryColumns.getSrs() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ SpatialReferenceSystem.class.getSimpleName());
}
projection = ProjectionFactory.getProjection(geometryColumns.getSrs());
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:29,代码来源:FeatureDao.java
示例4: createTileMatrixTable
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean createTileMatrixTable() {
verifyWritable();
boolean created = false;
TileMatrixDao dao = getTileMatrixDao();
try {
if (!dao.isTableExists()) {
created = tableCreator.createTileMatrix() > 0;
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to check if "
+ TileMatrix.class.getSimpleName()
+ " table exists and create it", e);
}
return created;
}
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:21,代码来源:GeoPackageCoreImpl.java
示例5: getAttributesDao
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AttributesDao getAttributesDao(String tableName) {
ContentsDao dao = getContentsDao();
Contents contents = null;
try {
contents = dao.queryForId(tableName);
} catch (SQLException e) {
throw new GeoPackageException("Failed to retrieve "
+ Contents.class.getSimpleName() + " for table name: "
+ tableName, e);
}
if (contents == null) {
throw new GeoPackageException(
"No Contents Table exists for table name: " + tableName);
}
return getAttributesDao(contents);
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:22,代码来源:GeoPackageImpl.java
示例6: isIndexed
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Is the feature table indexed in the provided type location
*
* @param type index location type
* @return true if indexed
*/
public boolean isIndexed(FeatureIndexType type) {
boolean indexed = false;
if (type == null) {
indexed = isIndexed();
} else {
switch (type) {
case GEOPACKAGE:
indexed = featureTableIndex.isIndexed();
break;
case METADATA:
indexed = featureIndexer.isIndexed();
break;
default:
throw new GeoPackageException("Unsupported FeatureIndexType: " + type);
}
}
return indexed;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:25,代码来源:FeatureIndexManager.java
示例7: getLastIndexed
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Get the date last indexed
*
* @param type feature index type
* @return last indexed date or null
*/
public Date getLastIndexed(FeatureIndexType type) {
Date lastIndexed = null;
if (type == null) {
lastIndexed = getLastIndexed();
} else {
switch (type) {
case GEOPACKAGE:
lastIndexed = featureTableIndex.getLastIndexed();
break;
case METADATA:
lastIndexed = featureIndexer.getLastIndexed();
break;
default:
throw new GeoPackageException("Unsupported FeatureIndexType: " + type);
}
}
return lastIndexed;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:25,代码来源:FeatureIndexManager.java
示例8: FeatureDao
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Constructor
*
* @param database
* @param db
* @param featureDb
* @param geometryColumns
* @param table
*/
public FeatureDao(String database, GeoPackageConnection db,
FeatureConnection featureDb, GeometryColumns geometryColumns,
FeatureTable table) {
super(database, db, featureDb, table);
this.featureDb = featureDb;
this.geometryColumns = geometryColumns;
if (geometryColumns.getContents() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ Contents.class.getSimpleName());
}
if (geometryColumns.getSrs() == null) {
throw new GeoPackageException(GeometryColumns.class.getSimpleName()
+ " " + geometryColumns.getId() + " has null "
+ SpatialReferenceSystem.class.getSimpleName());
}
projection = ProjectionFactory.getProjection(geometryColumns.getSrs());
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:30,代码来源:FeatureDao.java
示例9: getIndexedType
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Get the indexed type or throw an error if not indexed
*/
private FeatureIndexType getIndexedType() {
FeatureIndexType indexType = null;
// Check for an indexed type
for (FeatureIndexType type : indexLocationQueryOrder) {
if (isIndexed(type)) {
indexType = type;
break;
}
}
// Verify features are indexed
if (indexType == null) {
throw new GeoPackageException("Features are not indexed. GeoPackage: "
+ featureTableIndex.getGeoPackage().getName()
+ ", Table: " + featureTableIndex.getTableName());
}
return indexType;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:25,代码来源:FeatureIndexManager.java
示例10: index
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Index the feature row. This method assumes that indexing has been
* completed and maintained as the last indexed time is updated.
*
* @param row
* feature row
* @return true if indexed
*/
public boolean index(FeatureRow row) {
TableIndex tableIndex = getTableIndex();
if (tableIndex == null) {
throw new GeoPackageException(
"GeoPackage table is not indexed. GeoPackage: "
+ getGeoPackage().getName() + ", Table: "
+ getTableName());
}
boolean indexed = index(tableIndex, row.getId(), row.getGeometry());
// Update the last indexed time
updateLastIndexed();
return indexed;
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:24,代码来源:FeatureTableIndex.java
示例11: UrlTileGenerator
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Constructor
*
* @param geoPackage
* GeoPackage
* @param tableName
* table name
* @param tileUrl
* tile url
* @param minZoom
* min zoom
* @param maxZoom
* max zoom
* @param boundingBox
* tiles bounding box
* @param projection
* tiles projection
* @since 1.2.0
*/
public UrlTileGenerator(GeoPackage geoPackage, String tableName,
String tileUrl, int minZoom, int maxZoom, BoundingBox boundingBox,
Projection projection) {
super(geoPackage, tableName, minZoom, maxZoom, boundingBox, projection);
try {
this.tileUrl = URLDecoder.decode(tileUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new GeoPackageException("Failed to decode tile url: "
+ tileUrl, e);
}
this.urlHasXYZ = hasXYZ(tileUrl);
this.urlHasBoundingBox = hasBoundingBox(tileUrl);
if (!this.urlHasXYZ && !this.urlHasBoundingBox) {
throw new GeoPackageException(
"URL does not contain x,y,z or bounding box variables: "
+ tileUrl);
}
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:41,代码来源:UrlTileGenerator.java
示例12: getGeometryColumns
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Get the Geometry Columns, should only return one or no value
*
* @return geometry columns
*/
public GeometryColumns getGeometryColumns() {
GeometryColumns result = null;
if (geometryColumns.size() > 1) {
// This shouldn't happen with the unique table name constraint on
// geometry columns
throw new GeoPackageException(
"Unexpected state. More than one GeometryColumn has a foreign key to the Contents. Count: "
+ geometryColumns.size());
} else if (geometryColumns.size() == 1) {
CloseableIterator<GeometryColumns> iterator = geometryColumns
.closeableIterator();
try {
result = iterator.next();
} finally {
try {
iterator.close();
} catch (IOException e) {
throw new GeoPackageException(
"Failed to close the Geometry Columns iterator", e);
}
}
}
return result;
}
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:30,代码来源:Contents.java
示例13: registerTable
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Register a cursor wrapper for the provided table name. Database queries
* will wrap the returned cursor
*
* @param tableName
* @param cursorWrapper
*/
public void registerTable(String tableName,
GeoPackageCursorWrapper cursorWrapper) {
// Check for an existing wrapper
GeoPackageCursorWrapper existing = tableCursors.get(tableName);
// Add the wrapper
if (existing == null) {
tableCursors.put(tableName, cursorWrapper);
tableCursors.put(CoreSQLUtils.quoteWrap(tableName), cursorWrapper);
}
// Verify that the wrapper is not different from the existing
else if (!existing.getClass().equals(cursorWrapper.getClass())) {
throw new GeoPackageException("Table '" + tableName
+ "' was already registered for cursor wrapper '"
+ existing.getClass().getSimpleName()
+ "' and can not be registered for '"
+ cursorWrapper.getClass().getSimpleName() + "'");
}
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:28,代码来源:GeoPackageCursorFactory.java
示例14: createFeatureTileLinkTable
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean createFeatureTileLinkTable() {
verifyWritable();
boolean created = false;
FeatureTileLinkDao dao = getFeatureTileLinkDao();
try {
if (!dao.isTableExists()) {
created = tableCreator.createFeatureTileLink() > 0;
}
} catch (SQLException e) {
throw new GeoPackageException("Failed to check if "
+ FeatureTileLink.class.getSimpleName()
+ " table exists and create it", e);
}
return created;
}
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:21,代码来源:GeoPackageCoreImpl.java
示例15: getTileDao
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public TileDao getTileDao(Contents contents) {
if (contents == null) {
throw new GeoPackageException("Non null "
+ Contents.class.getSimpleName()
+ " is required to create " + TileDao.class.getSimpleName());
}
TileMatrixSet tileMatrixSet = contents.getTileMatrixSet();
if (tileMatrixSet == null) {
throw new GeoPackageException("No "
+ TileMatrixSet.class.getSimpleName() + " exists for "
+ Contents.class.getSimpleName() + " " + contents.getId());
}
return getTileDao(tileMatrixSet);
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:22,代码来源:GeoPackageImpl.java
示例16: create
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Create a new table metadata
*
* @param metadata
*/
public void create(TableMetadata metadata) {
ContentValues values = new ContentValues();
values.put(TableMetadata.COLUMN_GEOPACKAGE_ID, metadata.getGeoPackageId());
values.put(TableMetadata.COLUMN_TABLE_NAME, metadata.getTableName());
values.put(TableMetadata.COLUMN_LAST_INDEXED, metadata.getLastIndexed());
long insertId = db.insert(
TableMetadata.TABLE_NAME, null,
values);
if (insertId == -1) {
throw new GeoPackageException(
"Failed to insert table metadata. GeoPackage Id: "
+ metadata.getGeoPackageId() + ", Table Name: "
+ metadata.getTableName() + ", Last Indexed: "
+ metadata.getLastIndexed());
}
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:22,代码来源:TableMetadataDataSource.java
示例17: querySingleIntResult
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Query the SQL for a single result int
*
* @param connection
* @param sql
* @param args
* @return integer result, null if no result
* @since 1.2.1
*/
public static Integer querySingleIntResult(Connection connection,
String sql, String[] args) {
ResultSet resultSet = query(connection, sql, args);
Integer result = null;
try {
if (resultSet.next()) {
result = resultSet.getInt(1);
} else {
throw new GeoPackageException(
"Failed to query for single result. SQL: " + sql);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for single result. SQL: " + sql, e);
} finally {
closeResultSetStatement(resultSet, sql);
}
return result;
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:32,代码来源:SQLUtils.java
示例18: singleResultQuery
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Query the SQL for a single integer result
*
* @param connection
* @param sql
* @param args
* @return Integer result, null if no result
*/
private static int singleResultQuery(Connection connection, String sql,
String[] args) {
ResultSet resultSet = query(connection, sql, args);
int result = 0;
try {
if (resultSet.next()) {
result = resultSet.getInt(1);
} else {
throw new GeoPackageException(
"Failed to query for single result. SQL: " + sql);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for single result. SQL: " + sql, e);
} finally {
closeResultSetStatement(resultSet, sql);
}
return result;
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:31,代码来源:SQLUtils.java
示例19: getGeoPackage
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @throws IOException
* @throws SQLException
*/
@Override
protected GeoPackage getGeoPackage() throws Exception {
GeoPackageManager manager = GeoPackageFactory.getManager(activity);
// Delete
manager.delete(name);
// Copy the test db file from assets to the internal storage
TestUtils.copyAssetFileToInternalStorage(activity, testContext,
file);
// Import
String importLocation = TestUtils.getAssetFileInternalStorageLocation(
activity, file);
manager.importGeoPackage(new File(importLocation));
// Open
GeoPackage geoPackage = manager.open(name);
if (geoPackage == null) {
throw new GeoPackageException("Failed to open database");
}
return geoPackage;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:31,代码来源:TilesGeoPackageTestCase.java
示例20: setTileGenerator
import mil.nga.geopackage.GeoPackageException; //导入依赖的package包/类
/**
* Set the tile generator settings
*
* @param activity
* @param tileGenerator
* @param minZoom
* @param maxZoom
* @param compressFormat
* @param compressQuality
* @param googleTiles
* @param boundingBox
*/
private static void setTileGenerator(Activity activity, TileGenerator tileGenerator, int minZoom, int maxZoom,
CompressFormat compressFormat, Integer compressQuality,
boolean googleTiles, BoundingBox boundingBox) {
if (minZoom > maxZoom) {
throw new GeoPackageException(
activity.getString(R.string.generate_tiles_min_zoom_label)
+ " can not be larger than "
+ activity
.getString(R.string.generate_tiles_max_zoom_label));
}
tileGenerator.setCompressFormat(compressFormat);
tileGenerator.setCompressQuality(compressQuality);
tileGenerator.setGoogleTiles(googleTiles);
}
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:29,代码来源:LoadTilesTask.java
注:本文中的mil.nga.geopackage.GeoPackageException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论