本文整理汇总了Java中mil.nga.geopackage.GeoPackage.getTileMatrixDao方法的典型用法代码示例。如果您正苦于以下问题:Java GeoPackage.getTileMatrixDao方法的具体用法?Java GeoPackage.getTileMatrixDao怎么用?Java GeoPackage.getTileMatrixDao使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mil.nga.geopackage.GeoPackage
的用法示例。
在下文中一共展示了GeoPackage.getTileMatrixDao方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDelete
import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
* Test delete
*
* @param geoPackage
* @throws SQLException
*/
public static void testDelete(GeoPackage geoPackage) throws SQLException {
TileMatrixDao dao = geoPackage.getTileMatrixDao();
if (dao.isTableExists()) {
List<TileMatrix> results = dao.queryForAll();
if (!results.isEmpty()) {
// Choose random tile matrix
int random = (int) (Math.random() * results.size());
TileMatrix tileMatrix = results.get(random);
// Delete the tile matrix
dao.delete(tileMatrix);
// Verify deleted
TileMatrix queryTileMatrix = dao.queryForId(tileMatrix.getId());
TestCase.assertNull(queryTileMatrix);
// Prepared deleted
results = dao.queryForAll();
if (!results.isEmpty()) {
// Choose random tile matrix
random = (int) (Math.random() * results.size());
tileMatrix = results.get(random);
// Find which tile matrix to delete
QueryBuilder<TileMatrix, TileMatrixKey> qb = dao
.queryBuilder();
qb.where().eq(TileMatrix.COLUMN_ZOOM_LEVEL,
tileMatrix.getZoomLevel());
PreparedQuery<TileMatrix> query = qb.prepare();
List<TileMatrix> queryResults = dao.query(query);
int count = queryResults.size();
// Delete
DeleteBuilder<TileMatrix, TileMatrixKey> db = dao
.deleteBuilder();
db.where().eq(TileMatrix.COLUMN_ZOOM_LEVEL,
tileMatrix.getZoomLevel());
PreparedDelete<TileMatrix> deleteQuery = db.prepare();
int deleted = dao.delete(deleteQuery);
TestCase.assertEquals(count, deleted);
}
}
}
}
示例2: testDeleteTables
import mil.nga.geopackage.GeoPackage; //导入方法依赖的package包/类
/**
* Test deleting tables by name
*
* @param geoPackage
* @throws SQLException
*/
public static void testDeleteTables(GeoPackage geoPackage)
throws SQLException {
GeometryColumnsDao geometryColumnsDao = geoPackage
.getGeometryColumnsDao();
TileMatrixSetDao tileMatrixSetDao = geoPackage.getTileMatrixSetDao();
TestCase.assertTrue(geometryColumnsDao.isTableExists()
|| tileMatrixSetDao.isTableExists());
if (geometryColumnsDao.isTableExists()) {
for (String featureTable : geoPackage.getFeatureTables()) {
FeatureDao featureDao = geoPackage.getFeatureDao(featureTable);
featureDao.dropTable();
}
geoPackage.dropTable(GeometryColumns.TABLE_NAME);
TestCase.assertFalse(geometryColumnsDao.isTableExists());
}
if (tileMatrixSetDao.isTableExists()) {
TileMatrixDao tileMatrixDao = geoPackage.getTileMatrixDao();
TestCase.assertTrue(tileMatrixSetDao.isTableExists());
TestCase.assertTrue(tileMatrixDao.isTableExists());
for (String tileTable : geoPackage.getTileTables()) {
TileDao tileDao = geoPackage.getTileDao(tileTable);
tileDao.dropTable();
}
geoPackage.dropTable(TileMatrix.TABLE_NAME);
geoPackage.dropTable(TileMatrixSet.TABLE_NAME);
TestCase.assertFalse(tileMatrixSetDao.isTableExists());
TestCase.assertFalse(tileMatrixDao.isTableExists());
}
}