Java Code Examples for mil.nga.geopackage.features.index.FeatureIndexManager#close()
The following examples show how to use
mil.nga.geopackage.features.index.FeatureIndexManager#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeoPackageImpl.java From geopackage-android with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public BoundingBox getFeatureBoundingBox(Projection projection, String table, boolean manual) { BoundingBox boundingBox = null; FeatureIndexManager indexManager = new FeatureIndexManager(context, this, table); try { if (manual || indexManager.isIndexed()) { boundingBox = indexManager.getBoundingBox(projection); } } finally { indexManager.close(); } return boundingBox; }
Example 2
Source File: GeoPackageImpl.java From geopackage-java with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public BoundingBox getFeatureBoundingBox(Projection projection, String table, boolean manual) { BoundingBox boundingBox = null; FeatureIndexManager indexManager = new FeatureIndexManager(this, table); try { if (manual || indexManager.isIndexed()) { boundingBox = indexManager.getBoundingBox(projection); } } finally { indexManager.close(); } return boundingBox; }
Example 3
Source File: GeoPackageExample.java From geopackage-android with MIT License | 5 votes |
private static void createGeometryIndexExtension(Context context, GeoPackage geoPackage) { List<String> featureTables = geoPackage.getFeatureTables(); for (String featureTable : featureTables) { FeatureDao featureDao = geoPackage.getFeatureDao(featureTable); FeatureIndexManager indexer = new FeatureIndexManager(context, geoPackage, featureDao); indexer.setIndexLocation(FeatureIndexType.GEOPACKAGE); indexer.index(); indexer.close(); } }
Example 4
Source File: FeatureTiles.java From geopackage-android with MIT License | 4 votes |
/** * Constructor, auto creates the index manager for indexed tables and feature styles for styled tables * * @param context context * @param geoPackage GeoPackage * @param featureDao feature dao * @param density display density: {@link android.util.DisplayMetrics#density} * @param width drawn tile width * @param height drawn tile height * @since 3.2.0 */ public FeatureTiles(Context context, GeoPackage geoPackage, FeatureDao featureDao, float density, int width, int height) { this.context = context; this.featureDao = featureDao; if (featureDao != null) { this.projection = featureDao.getProjection(); } this.density = TileUtils.tileDensity(density, width, height); tileWidth = width; tileHeight = height; createEmptyImage(); compressFormat = CompressFormat.valueOf(context.getString(R.string.feature_tiles_compress_format)); pointPaint.setAntiAlias(true); pointRadius = Float.valueOf(context.getString(R.string.feature_tiles_point_radius)); linePaint.setAntiAlias(true); lineStrokeWidth = Float.valueOf(context.getString(R.string.feature_tiles_line_stroke_width)); linePaint.setStrokeWidth(this.density * lineStrokeWidth); linePaint.setStyle(Style.STROKE); polygonPaint.setAntiAlias(true); polygonStrokeWidth = Float.valueOf(context.getString(R.string.feature_tiles_polygon_stroke_width)); polygonPaint.setStrokeWidth(this.density * polygonStrokeWidth); polygonPaint.setStyle(Style.STROKE); Resources resources = context.getResources(); fillPolygon = resources.getBoolean(R.bool.feature_tiles_polygon_fill); polygonFillPaint.setAntiAlias(true); polygonFillPaint.setStyle(Style.FILL); polygonFillPaint.setAlpha(resources.getInteger(R.integer.feature_tiles_polygon_fill_alpha)); if (geoPackage != null) { indexManager = new FeatureIndexManager(context, geoPackage, featureDao); if (!indexManager.isIndexed()) { indexManager.close(); indexManager = null; } featureTableStyles = new FeatureTableStyles(geoPackage, featureDao.getTable()); if (!featureTableStyles.has()) { featureTableStyles = null; } } calculateDrawOverlap(); }
Example 5
Source File: OAPIFeatureGeneratorTest.java From geopackage-android with MIT License | 4 votes |
/** * Test a WFS server and create a GeoPackage * * @param server server url * @param collection collection name * @param name geoPackage and table name * @param limit request limit * @param totalLimit total limit * @param boundingBox bounding box * @param time time * @param period period or end time * @throws SQLException upon error */ private void testServer(String server, String collection, String name, Integer limit, Integer totalLimit, BoundingBox boundingBox, String time, String period) throws SQLException { GeoPackageManager geoPackageManager = GeoPackageFactory.getManager(activity); geoPackageManager.delete(collection); geoPackageManager.create(collection); GeoPackage geoPackage = geoPackageManager.open(collection); OAPIFeatureGenerator generator = new OAPIFeatureGenerator( geoPackage, name, server, collection); generator.setLimit(limit); generator.setTotalLimit(totalLimit); generator.setBoundingBox(boundingBox); generator.setTime(time); generator.setPeriod(period); generator.setDownloadAttempts(3); int count = generator.generateFeatures(); if (totalLimit != null) { TestCase.assertEquals(totalLimit.intValue(), count); } FeatureDao featureDao = generator.getFeatureDao(); if (totalLimit != null) { TestCase.assertEquals(totalLimit.intValue(), featureDao.count()); } FeatureIndexManager indexer = new FeatureIndexManager(activity, geoPackage, featureDao); indexer.setIndexLocation(FeatureIndexType.GEOPACKAGE); indexer.index(); indexer.close(); BoundingBox dataBounds = geoPackage .getBoundingBox(featureDao.getTableName()); Contents contents = featureDao.getContents(); contents.setBoundingBox(dataBounds); geoPackage.getContentsDao().update(contents); geoPackage.close(); }