Java Code Examples for mil.nga.geopackage.features.user.FeatureDao#getTable()
The following examples show how to use
mil.nga.geopackage.features.user.FeatureDao#getTable() .
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: GeoPackageExample.java From geopackage-android with MIT License | 5 votes |
private static void createFeatureStylesGeometry2(GeoPackage geoPackage, List<StyleRow> styles, List<IconRow> icons) throws IOException { FeatureDao featureDao = geoPackage.getFeatureDao("geometry2"); FeatureTableStyles geometry2Styles = new FeatureTableStyles(geoPackage, featureDao.getTable()); geometry2Styles.setTableStyle(GeometryType.POINT, styles.get(0)); geometry2Styles.setTableStyle(GeometryType.LINESTRING, styles.get(1)); geometry2Styles.setTableStyle(GeometryType.POLYGON, styles.get(0)); geometry2Styles.setTableStyle(GeometryType.GEOMETRY, styles.get(2)); geometry2Styles.createStyleRelationship(); geometry2Styles.createIconRelationship(); FeatureCursor features = featureDao.queryForAll(); while (features.moveToNext()) { FeatureRow featureRow = features.getRow(); switch (featureRow.getGeometryType()) { case POINT: geometry2Styles.setIcon(featureRow, icons.get(0)); break; case LINESTRING: geometry2Styles.setStyle(featureRow, styles.get(0)); break; case POLYGON: geometry2Styles.setStyle(featureRow, styles.get(1)); break; default: } } features.close(); }
Example 2
Source File: GeoPackageExample.java From geopackage-java with MIT License | 5 votes |
private static void createFeatureStylesGeometry2(GeoPackage geoPackage, List<StyleRow> styles, List<IconRow> icons) throws IOException { FeatureDao featureDao = geoPackage.getFeatureDao("geometry2"); FeatureTableStyles geometry2Styles = new FeatureTableStyles(geoPackage, featureDao.getTable()); geometry2Styles.setTableStyle(GeometryType.POINT, styles.get(0)); geometry2Styles.setTableStyle(GeometryType.LINESTRING, styles.get(1)); geometry2Styles.setTableStyle(GeometryType.POLYGON, styles.get(0)); geometry2Styles.setTableStyle(GeometryType.GEOMETRY, styles.get(2)); geometry2Styles.createStyleRelationship(); geometry2Styles.createIconRelationship(); FeatureResultSet features = featureDao.queryForAll(); while (features.moveToNext()) { FeatureRow featureRow = features.getRow(); switch (featureRow.getGeometryType()) { case POINT: geometry2Styles.setIcon(featureRow, icons.get(0)); break; case LINESTRING: geometry2Styles.setStyle(featureRow, styles.get(0)); break; case POLYGON: geometry2Styles.setStyle(featureRow, styles.get(1)); break; default: } } features.close(); }
Example 3
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 4
Source File: GeoPackageExample.java From geopackage-android with MIT License | 4 votes |
private static void createFeatureStylesGeometry1(GeoPackage geoPackage, List<StyleRow> styles, List<IconRow> icons) throws IOException { FeatureDao featureDao = geoPackage.getFeatureDao("geometry1"); FeatureTableStyles geometry1Styles = new FeatureTableStyles(geoPackage, featureDao.getTable()); geometry1Styles.setTableStyleDefault(styles.get(0)); geometry1Styles.setTableStyle(GeometryType.POLYGON, styles.get(1)); geometry1Styles.setTableStyle(GeometryType.POINT, styles.get(2)); geometry1Styles.createStyleRelationship(); geometry1Styles.createIconRelationship(); int pointCount = 0; int lineCount = 0; int polygonCount = 0; FeatureCursor features = featureDao.queryForAll(); while (features.moveToNext()) { FeatureRow featureRow = features.getRow(); switch (featureRow.getGeometryType()) { case POINT: pointCount++; switch (pointCount) { case 1: geometry1Styles.setIcon(featureRow, icons.get(0)); break; case 2: geometry1Styles.setIcon(featureRow, icons.get(1)); break; case 3: geometry1Styles.setIcon(featureRow, icons.get(2)); break; } break; case LINESTRING: lineCount++; switch (lineCount) { case 2: geometry1Styles.setStyle(featureRow, styles.get(1)); break; case 3: geometry1Styles.setStyle(featureRow, styles.get(2)); break; } break; case POLYGON: polygonCount++; switch (polygonCount) { case 2: geometry1Styles.setStyle(featureRow, styles.get(3)); break; case 3: geometry1Styles.setStyle(featureRow, styles.get(2)); break; } break; default: } } features.close(); }
Example 5
Source File: FeatureTiles.java From geopackage-java with MIT License | 4 votes |
/** * Constructor, auto creates the index manager for indexed tables and * feature styles for styled tables * * @param geoPackage * GeoPackage * @param featureDao * feature dao * @param scale * scale factor * @param width * drawn tile width * @param height * drawn tile height * @since 3.2.0 */ public FeatureTiles(GeoPackage geoPackage, FeatureDao featureDao, float scale, int width, int height) { this.featureDao = featureDao; if (featureDao != null) { this.projection = featureDao.getProjection(); } this.scale = scale; tileWidth = width; tileHeight = height; compressFormat = GeoPackageJavaProperties.getProperty( JavaPropertyConstants.FEATURE_TILES, JavaPropertyConstants.FEATURE_TILES_COMPRESS_FORMAT); pointRadius = GeoPackageJavaProperties.getFloatProperty( JavaPropertyConstants.FEATURE_TILES_POINT, JavaPropertyConstants.FEATURE_TILES_RADIUS); pointPaint.setColor(GeoPackageJavaProperties.getColorProperty( JavaPropertyConstants.FEATURE_TILES_POINT, JavaPropertyConstants.FEATURE_TILES_COLOR)); lineStrokeWidth = GeoPackageJavaProperties.getFloatProperty( JavaPropertyConstants.FEATURE_TILES_LINE, JavaPropertyConstants.FEATURE_TILES_STROKE_WIDTH); linePaint.setStrokeWidth(this.scale * lineStrokeWidth); linePaint.setColor(GeoPackageJavaProperties.getColorProperty( JavaPropertyConstants.FEATURE_TILES_LINE, JavaPropertyConstants.FEATURE_TILES_COLOR)); polygonStrokeWidth = GeoPackageJavaProperties.getFloatProperty( JavaPropertyConstants.FEATURE_TILES_POLYGON, JavaPropertyConstants.FEATURE_TILES_STROKE_WIDTH); polygonPaint.setStrokeWidth(this.scale * polygonStrokeWidth); polygonPaint.setColor(GeoPackageJavaProperties.getColorProperty( JavaPropertyConstants.FEATURE_TILES_POLYGON, JavaPropertyConstants.FEATURE_TILES_COLOR)); fillPolygon = GeoPackageJavaProperties.getBooleanProperty( JavaPropertyConstants.FEATURE_TILES_POLYGON_FILL); polygonFillPaint.setColor(GeoPackageJavaProperties.getColorProperty( JavaPropertyConstants.FEATURE_TILES_POLYGON_FILL, JavaPropertyConstants.FEATURE_TILES_COLOR)); if (geoPackage != null) { featureIndex = new FeatureTableIndex(geoPackage, featureDao); if (!featureIndex.isIndexed()) { featureIndex.close(); featureIndex = null; } featureTableStyles = new FeatureTableStyles(geoPackage, featureDao.getTable()); if (!featureTableStyles.has()) { featureTableStyles = null; } } calculateDrawOverlap(); }
Example 6
Source File: GeoPackageExample.java From geopackage-java with MIT License | 4 votes |
private static void createFeatureStylesGeometry1(GeoPackage geoPackage, List<StyleRow> styles, List<IconRow> icons) throws IOException { FeatureDao featureDao = geoPackage.getFeatureDao("geometry1"); FeatureTableStyles geometry1Styles = new FeatureTableStyles(geoPackage, featureDao.getTable()); geometry1Styles.setTableStyleDefault(styles.get(0)); geometry1Styles.setTableStyle(GeometryType.POLYGON, styles.get(1)); geometry1Styles.setTableStyle(GeometryType.POINT, styles.get(2)); geometry1Styles.createStyleRelationship(); geometry1Styles.createIconRelationship(); int pointCount = 0; int lineCount = 0; int polygonCount = 0; FeatureResultSet features = featureDao.queryForAll(); while (features.moveToNext()) { FeatureRow featureRow = features.getRow(); switch (featureRow.getGeometryType()) { case POINT: pointCount++; switch (pointCount) { case 1: geometry1Styles.setIcon(featureRow, icons.get(0)); break; case 2: geometry1Styles.setIcon(featureRow, icons.get(1)); break; case 3: geometry1Styles.setIcon(featureRow, icons.get(2)); break; } break; case LINESTRING: lineCount++; switch (lineCount) { case 2: geometry1Styles.setStyle(featureRow, styles.get(1)); break; case 3: geometry1Styles.setStyle(featureRow, styles.get(2)); break; } break; case POLYGON: polygonCount++; switch (polygonCount) { case 2: geometry1Styles.setStyle(featureRow, styles.get(3)); break; case 3: geometry1Styles.setStyle(featureRow, styles.get(2)); break; } break; default: } } features.close(); }
Example 7
Source File: GeoPackageExample.java From geopackage-android with MIT License | 3 votes |
private static void createRTreeSpatialIndexExtension(GeoPackage geoPackage) { RTreeIndexExtension extension = new RTreeIndexExtension(geoPackage); List<String> featureTables = geoPackage.getFeatureTables(); for (String tableName : featureTables) { FeatureDao featureDao = geoPackage.getFeatureDao(tableName); FeatureTable featureTable = featureDao.getTable(); extension.create(featureTable); } }
Example 8
Source File: GeoPackageExample.java From geopackage-java with MIT License | 3 votes |
private static void createRTreeSpatialIndexExtension( GeoPackage geoPackage) { RTreeIndexExtension extension = new RTreeIndexExtension(geoPackage); List<String> featureTables = geoPackage.getFeatureTables(); for (String tableName : featureTables) { FeatureDao featureDao = geoPackage.getFeatureDao(tableName); FeatureTable featureTable = featureDao.getTable(); extension.create(featureTable); } }