本文整理汇总了Java中mil.nga.geopackage.GeoPackageException类的典型用法代码示例。如果您正苦于以下问题:Java GeoPackageException类的具体用法?Java GeoPackageException怎么用?Java GeoPackageException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoPackageException类属于mil.nga.geopackage包,在下文中一共展示了GeoPackageException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
}
示例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());
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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() + "'");
}
}
示例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;
}
示例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);
}