mil.nga.geopackage.extension.link.FeatureTileTableLinker Java Examples
The following examples show how to use
mil.nga.geopackage.extension.link.FeatureTileTableLinker.
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: GeoPackageOverlayFactory.java From geopackage-android-map with MIT License | 6 votes |
/** * Create a composite overlay linking the feature overly with * * @param featureOverlay feature overlay * @param geoPackage GeoPackage * @return linked bounded overlay */ public static BoundedOverlay getLinkedFeatureOverlay(FeatureOverlay featureOverlay, GeoPackage geoPackage) { BoundedOverlay overlay; // Get the linked tile daos FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage); List<TileDao> tileDaos = linker.getTileDaosForFeatureTable(featureOverlay.getFeatureTiles().getFeatureDao().getTableName()); if (!tileDaos.isEmpty()) { // Create a composite overlay to search for existing tiles before drawing from features overlay = getCompositeOverlay(tileDaos, featureOverlay); } else { overlay = featureOverlay; } return overlay; }
Example #2
Source File: FeatureTileGenerator.java From geopackage-android with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override protected void preTileGeneration() { // Link the feature and tile table if they are in the same GeoPackage GeoPackage geoPackage = getGeoPackage(); String featureTable = featureTiles.getFeatureDao().getTableName(); String tileTable = getTableName(); if (linkTables && geoPackage.isFeatureTable(featureTable) && geoPackage.isTileTable(tileTable)) { FeatureTileTableLinker linker = new FeatureTileTableLinker( geoPackage); linker.link(featureTable, tileTable); } }
Example #3
Source File: GeoPackageExample.java From geopackage-android with MIT License | 6 votes |
private void validateNGAExtensions(GeoPackage geoPackage, boolean has) throws SQLException { ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); TestCase.assertEquals( has && GEOMETRY_INDEX, extensionsDao.isTableExists() && !extensionsDao.queryByExtension( FeatureTableIndex.EXTENSION_NAME).isEmpty()); TestCase.assertEquals(has && FEATURE_TILE_LINK, new FeatureTileTableLinker(geoPackage).has()); TestCase.assertEquals( has && TILE_SCALING, extensionsDao.isTableExists() && !extensionsDao.queryByExtension( TileTableScaling.EXTENSION_NAME).isEmpty()); TestCase.assertEquals(has && PROPERTIES, new PropertiesExtension( geoPackage).has()); TestCase.assertEquals(has && CONTENTS_ID, new ContentsIdExtension( geoPackage).has()); TestCase.assertEquals(has && FEATURE_STYLE, new FeatureStyleExtension( geoPackage).has()); }
Example #4
Source File: GeoPackageExample.java From geopackage-android with MIT License | 6 votes |
private static void createTileScalingExtension(GeoPackage geoPackage) { for (String tileTable : geoPackage.getTileTables()) { TileTableScaling tileTableScaling = new TileTableScaling( geoPackage, tileTable); TileScaling tileScaling = new TileScaling(); tileScaling.setZoomIn(2l); FeatureTileTableLinker linker = new FeatureTileTableLinker( geoPackage); if (linker.has() && !linker.getFeatureTablesForTileTable(tileTable) .isEmpty()) { tileScaling.setScalingType(TileScalingType.IN); } else { tileScaling.setScalingType(TileScalingType.IN_OUT); tileScaling.setZoomOut(2l); } tileTableScaling.create(tileScaling); } }
Example #5
Source File: FeatureTileGenerator.java From geopackage-java with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override protected void preTileGeneration() { // Link the feature and tile table if they are in the same GeoPackage GeoPackage geoPackage = getGeoPackage(); String featureTable = featureTiles.getFeatureDao().getTableName(); String tileTable = getTableName(); if (linkTables && geoPackage.isFeatureTable(featureTable) && geoPackage.isTileTable(tileTable)) { FeatureTileTableLinker linker = new FeatureTileTableLinker( geoPackage); linker.link(featureTable, tileTable); } }
Example #6
Source File: GeoPackageExample.java From geopackage-java with MIT License | 6 votes |
private void validateNGAExtensions(GeoPackage geoPackage, boolean has) throws SQLException { ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); TestCase.assertEquals(has && GEOMETRY_INDEX, extensionsDao.isTableExists() && !extensionsDao .queryByExtension(FeatureTableIndex.EXTENSION_NAME) .isEmpty()); TestCase.assertEquals(has && FEATURE_TILE_LINK, new FeatureTileTableLinker(geoPackage).has()); TestCase.assertEquals(has && TILE_SCALING, extensionsDao.isTableExists() && !extensionsDao .queryByExtension(TileTableScaling.EXTENSION_NAME) .isEmpty()); TestCase.assertEquals(has && PROPERTIES, new PropertiesExtension(geoPackage).has()); TestCase.assertEquals(has && CONTENTS_ID, new ContentsIdExtension(geoPackage).has()); TestCase.assertEquals(has && FEATURE_STYLE, new FeatureStyleExtension(geoPackage).has()); }
Example #7
Source File: GeoPackageExample.java From geopackage-java with MIT License | 6 votes |
private static void createTileScalingExtension(GeoPackage geoPackage) { for (String tileTable : geoPackage.getTileTables()) { TileTableScaling tileTableScaling = new TileTableScaling(geoPackage, tileTable); TileScaling tileScaling = new TileScaling(); tileScaling.setZoomIn(2l); FeatureTileTableLinker linker = new FeatureTileTableLinker( geoPackage); if (linker.has() && !linker.getFeatureTablesForTileTable(tileTable) .isEmpty()) { tileScaling.setScalingType(TileScalingType.IN); } else { tileScaling.setScalingType(TileScalingType.IN_OUT); tileScaling.setZoomOut(2l); } tileTableScaling.create(tileScaling); } }
Example #8
Source File: MapFragment.java From mage-android with Apache License 2.0 | 4 votes |
/** * Add the GeoPackage Tile Table Cache Overlay * @param enabledCacheOverlays * @param tileTableCacheOverlay * @param geoPackage * @param linkedToFeatures */ private void addGeoPackageTileCacheOverlay(Map<String, CacheOverlay> enabledCacheOverlays, GeoPackageTileTableCacheOverlay tileTableCacheOverlay, GeoPackage geoPackage, boolean linkedToFeatures){ // Retrieve the cache overlay if it already exists (and remove from cache overlays) CacheOverlay cacheOverlay = cacheOverlays.remove(tileTableCacheOverlay.getCacheName()); if(cacheOverlay != null){ // If the existing cache overlay is being replaced, create a new cache overlay if(tileTableCacheOverlay.getParent().isAdded()){ cacheOverlay = null; } } if(cacheOverlay == null){ // Create a new GeoPackage tile provider and add to the map TileDao tileDao = geoPackage.getTileDao(tileTableCacheOverlay.getName()); TileTableScaling tileTableScaling = new TileTableScaling(geoPackage, tileDao); TileScaling tileScaling = tileTableScaling.get(); BoundedOverlay overlay = GeoPackageOverlayFactory .getBoundedOverlay(tileDao, getResources().getDisplayMetrics().density, tileScaling); TileOverlayOptions overlayOptions = null; if(linkedToFeatures){ overlayOptions = createFeatureTileOverlayOptions(overlay); }else { overlayOptions = createTileOverlayOptions(overlay); } TileOverlay tileOverlay = map.addTileOverlay(overlayOptions); tileTableCacheOverlay.setTileOverlay(tileOverlay); // Check for linked feature tables tileTableCacheOverlay.clearFeatureOverlayQueries(); FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage); List<FeatureDao> featureDaos = linker.getFeatureDaosForTileTable(tileDao.getTableName()); for(FeatureDao featureDao: featureDaos){ // Create the feature tiles FeatureTiles featureTiles = new DefaultFeatureTiles(getActivity(), geoPackage, featureDao, getResources().getDisplayMetrics().density); // Add the feature overlay query FeatureOverlayQuery featureOverlayQuery = new FeatureOverlayQuery(getActivity(), overlay, featureTiles); tileTableCacheOverlay.addFeatureOverlayQuery(featureOverlayQuery); } cacheOverlay = tileTableCacheOverlay; } // Add the cache overlay to the enabled cache overlays enabledCacheOverlays.put(cacheOverlay.getCacheName(), cacheOverlay); }