Search in sources :

Example 6 with Geometry

use of mil.nga.sf.Geometry in project geopackage-android-map by ngageoint.

the class ReadmeTest method testGeoPackage.

/**
 * Test GeoPackage
 *
 * @param context        context
 * @param geoPackageFile GeoPackage file
 * @param map            Google map
 * @throws IOException  upon error
 * @throws SQLException upon error
 */
private void testGeoPackage(Context context, File geoPackageFile, GoogleMap map) throws IOException, SQLException {
    // Context context = ...;
    // File geoPackageFile = ...;
    // GoogleMap map = ...;
    // Get a manager
    GeoPackageManager manager = GeoPackageFactory.getManager(context);
    // Import database
    boolean imported = manager.importGeoPackage(geoPackageFile);
    // Available databases
    List<String> databases = manager.databases();
    // Open database
    GeoPackage geoPackage = manager.open(databases.get(0));
    // GeoPackage Table DAOs
    SpatialReferenceSystemDao srsDao = geoPackage.getSpatialReferenceSystemDao();
    ContentsDao contentsDao = geoPackage.getContentsDao();
    GeometryColumnsDao geomColumnsDao = geoPackage.getGeometryColumnsDao();
    TileMatrixSetDao tileMatrixSetDao = geoPackage.getTileMatrixSetDao();
    TileMatrixDao tileMatrixDao = geoPackage.getTileMatrixDao();
    SchemaExtension schemaExtension = new SchemaExtension(geoPackage);
    DataColumnsDao dao = schemaExtension.getDataColumnsDao();
    DataColumnConstraintsDao dataColumnConstraintsDao = schemaExtension.getDataColumnConstraintsDao();
    MetadataExtension metadataExtension = new MetadataExtension(geoPackage);
    MetadataDao metadataDao = metadataExtension.getMetadataDao();
    MetadataReferenceDao metadataReferenceDao = metadataExtension.getMetadataReferenceDao();
    ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();
    // Feature and tile tables
    List<String> features = geoPackage.getFeatureTables();
    List<String> tiles = geoPackage.getTileTables();
    // Query Features
    String featureTable = features.get(0);
    FeatureDao featureDao = geoPackage.getFeatureDao(featureTable);
    GoogleMapShapeConverter converter = new GoogleMapShapeConverter(featureDao.getProjection());
    FeatureCursor featureCursor = featureDao.queryForAll();
    try {
        for (FeatureRow featureRow : featureCursor) {
            GeoPackageGeometryData geometryData = featureRow.getGeometry();
            if (geometryData != null && !geometryData.isEmpty()) {
                Geometry geometry = geometryData.getGeometry();
                GoogleMapShape shape = converter.toShape(geometry);
                GoogleMapShape mapShape = GoogleMapShapeConverter.addShapeToMap(map, shape);
            // ...
            }
        }
    } finally {
        featureCursor.close();
    }
    // Query Tiles
    String tileTable = tiles.get(0);
    TileDao tileDao = geoPackage.getTileDao(tileTable);
    TileCursor tileCursor = tileDao.queryForAll();
    try {
        for (TileRow tileRow : tileCursor) {
            byte[] tileBytes = tileRow.getTileData();
            Bitmap tileBitmap = tileRow.getTileDataBitmap();
        // ...
        }
    } finally {
        tileCursor.close();
    }
    // Retrieve Tiles by XYZ
    GeoPackageTileRetriever retriever = new GeoPackageTileRetriever(tileDao);
    GeoPackageTile geoPackageTile = retriever.getTile(2, 2, 2);
    if (geoPackageTile != null) {
        byte[] tileBytes = geoPackageTile.getData();
        Bitmap tileBitmap = geoPackageTile.getBitmap();
    // ...
    }
    // Retrieve Tiles by Bounding Box
    TileCreator tileCreator = new TileCreator(tileDao, ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM));
    GeoPackageTile geoPackageTile2 = tileCreator.getTile(new BoundingBox(-90.0, 0.0, 0.0, 66.513260));
    if (geoPackageTile2 != null) {
        byte[] tileBytes = geoPackageTile2.getData();
        Bitmap tileBitmap = geoPackageTile2.getBitmap();
    // ...
    }
    // Tile Provider (GeoPackage or Google API)
    TileProvider overlay = GeoPackageOverlayFactory.getTileProvider(tileDao);
    TileOverlayOptions overlayOptions = new TileOverlayOptions();
    overlayOptions.tileProvider(overlay);
    overlayOptions.zIndex(-1);
    map.addTileOverlay(overlayOptions);
    BoundingBox boundingBox = BoundingBox.worldWebMercator();
    Projection projection = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR);
    // Index Features
    FeatureIndexManager indexer = new FeatureIndexManager(context, geoPackage, featureDao);
    indexer.setIndexLocation(FeatureIndexType.GEOPACKAGE);
    int indexedCount = indexer.index();
    // Query Indexed Features in paginated chunks
    FeatureIndexResults indexResults = indexer.queryForChunk(boundingBox, projection, 50);
    FeaturePaginatedCursor paginatedCursor = indexer.paginate(indexResults);
    for (FeatureRow featureRow : paginatedCursor) {
        GeoPackageGeometryData geometryData = featureRow.getGeometry();
        if (geometryData != null && !geometryData.isEmpty()) {
            Geometry geometry = geometryData.getGeometry();
        // ...
        }
    }
    // Feature Tile Provider (dynamically draw tiles from features)
    FeatureTiles featureTiles = new DefaultFeatureTiles(context, featureDao, context.getResources().getDisplayMetrics().density);
    // Set max features to draw per tile
    featureTiles.setMaxFeaturesPerTile(1000);
    // Custom feature tile implementation
    NumberFeaturesTile numberFeaturesTile = new NumberFeaturesTile(context);
    // Draw feature count tiles when max features passed
    featureTiles.setMaxFeaturesTileDraw(numberFeaturesTile);
    // Set index manager to query feature indices
    featureTiles.setIndexManager(indexer);
    FeatureOverlay featureOverlay = new FeatureOverlay(featureTiles);
    // Set zoom level to start showing tiles
    featureOverlay.setMinZoom(featureDao.getZoomLevel());
    TileOverlayOptions featureOverlayOptions = new TileOverlayOptions();
    featureOverlayOptions.tileProvider(featureOverlay);
    // Draw the feature tiles behind map markers
    featureOverlayOptions.zIndex(-1);
    map.addTileOverlay(featureOverlayOptions);
    // URL Tile Generator (generate tiles from a URL)
    TileGenerator urlTileGenerator = new UrlTileGenerator(context, geoPackage, "url_tile_table", "http://url/{z}/{x}/{y}.png", 0, 0, boundingBox, projection);
    int urlTileCount = urlTileGenerator.generateTiles();
    // Feature Tile Generator (generate tiles from features)
    TileGenerator featureTileGenerator = new FeatureTileGenerator(context, geoPackage, "tiles_" + featureTable, featureTiles, 1, 2, boundingBox, projection);
    int featureTileCount = featureTileGenerator.generateTiles();
    // Close feature tiles (and indexer)
    featureTiles.close();
    // Close database when done
    geoPackage.close();
}
Also used : MetadataReferenceDao(mil.nga.geopackage.extension.metadata.reference.MetadataReferenceDao) GeoPackageTileRetriever(mil.nga.geopackage.tiles.retriever.GeoPackageTileRetriever) DataColumnsDao(mil.nga.geopackage.extension.schema.columns.DataColumnsDao) Projection(mil.nga.proj.Projection) DefaultFeatureTiles(mil.nga.geopackage.tiles.features.DefaultFeatureTiles) FeatureDao(mil.nga.geopackage.features.user.FeatureDao) GeoPackage(mil.nga.geopackage.GeoPackage) MetadataExtension(mil.nga.geopackage.extension.metadata.MetadataExtension) TileProvider(com.google.android.gms.maps.model.TileProvider) FeatureOverlay(mil.nga.geopackage.map.tiles.overlay.FeatureOverlay) SpatialReferenceSystemDao(mil.nga.geopackage.srs.SpatialReferenceSystemDao) Bitmap(android.graphics.Bitmap) FeaturePaginatedCursor(mil.nga.geopackage.features.user.FeaturePaginatedCursor) DataColumnConstraintsDao(mil.nga.geopackage.extension.schema.constraints.DataColumnConstraintsDao) BoundingBox(mil.nga.geopackage.BoundingBox) TileCreator(mil.nga.geopackage.tiles.retriever.TileCreator) MetadataDao(mil.nga.geopackage.extension.metadata.MetadataDao) FeatureIndexResults(mil.nga.geopackage.features.index.FeatureIndexResults) GeoPackageGeometryData(mil.nga.geopackage.geom.GeoPackageGeometryData) SchemaExtension(mil.nga.geopackage.extension.schema.SchemaExtension) TileOverlayOptions(com.google.android.gms.maps.model.TileOverlayOptions) ExtensionsDao(mil.nga.geopackage.extension.ExtensionsDao) NumberFeaturesTile(mil.nga.geopackage.tiles.features.custom.NumberFeaturesTile) GeoPackageManager(mil.nga.geopackage.GeoPackageManager) UrlTileGenerator(mil.nga.geopackage.tiles.UrlTileGenerator) GoogleMapShapeConverter(mil.nga.geopackage.map.geom.GoogleMapShapeConverter) GoogleMapShape(mil.nga.geopackage.map.geom.GoogleMapShape) Geometry(mil.nga.sf.Geometry) GeoPackageTile(mil.nga.geopackage.tiles.retriever.GeoPackageTile) DefaultFeatureTiles(mil.nga.geopackage.tiles.features.DefaultFeatureTiles) FeatureTiles(mil.nga.geopackage.tiles.features.FeatureTiles) TileMatrixDao(mil.nga.geopackage.tiles.matrix.TileMatrixDao) FeatureRow(mil.nga.geopackage.features.user.FeatureRow) FeatureIndexManager(mil.nga.geopackage.features.index.FeatureIndexManager) TileRow(mil.nga.geopackage.tiles.user.TileRow) TileGenerator(mil.nga.geopackage.tiles.TileGenerator) FeatureTileGenerator(mil.nga.geopackage.tiles.features.FeatureTileGenerator) UrlTileGenerator(mil.nga.geopackage.tiles.UrlTileGenerator) FeatureCursor(mil.nga.geopackage.features.user.FeatureCursor) FeatureTileGenerator(mil.nga.geopackage.tiles.features.FeatureTileGenerator) TileMatrixSetDao(mil.nga.geopackage.tiles.matrixset.TileMatrixSetDao) ContentsDao(mil.nga.geopackage.contents.ContentsDao) TileDao(mil.nga.geopackage.tiles.user.TileDao) TileCursor(mil.nga.geopackage.tiles.user.TileCursor) GeometryColumnsDao(mil.nga.geopackage.features.columns.GeometryColumnsDao)

Example 7 with Geometry

use of mil.nga.sf.Geometry in project geopackage-android-map by ngageoint.

the class GoogleMapShapeConverter method toGeometry.

/**
 * Convert a GoogleMapShape to a Geometry
 *
 * @param shape google map shape
 * @return geometry
 */
public Geometry toGeometry(GoogleMapShape shape) {
    Geometry geometry = null;
    Object shapeObject = shape.getShape();
    switch(shape.getGeometryType()) {
        case POINT:
            LatLng point = null;
            switch(shape.getShapeType()) {
                case LAT_LNG:
                    point = (LatLng) shapeObject;
                    break;
                case MARKER_OPTIONS:
                    MarkerOptions markerOptions = (MarkerOptions) shapeObject;
                    point = markerOptions.getPosition();
                    break;
                case MARKER:
                    Marker marker = (Marker) shapeObject;
                    point = marker.getPosition();
                    break;
                default:
                    throw new GeoPackageException("Not a valid " + shape.getGeometryType().getName() + " shape type: " + shape.getShapeType());
            }
            if (point != null) {
                geometry = toPoint(point);
            }
            break;
        case LINESTRING:
        case CIRCULARSTRING:
            List<LatLng> lineStringPoints = null;
            switch(shape.getShapeType()) {
                case POLYLINE_OPTIONS:
                    PolylineOptions polylineOptions = (PolylineOptions) shapeObject;
                    lineStringPoints = polylineOptions.getPoints();
                    break;
                case POLYLINE:
                    Polyline polyline = (Polyline) shapeObject;
                    lineStringPoints = polyline.getPoints();
                    break;
                case POLYLINE_MARKERS:
                    PolylineMarkers polylineMarkers = (PolylineMarkers) shapeObject;
                    if (!polylineMarkers.isValid()) {
                        throw new GeoPackageException(PolylineMarkers.class.getSimpleName() + " is not valid to create " + shape.getGeometryType().getName());
                    }
                    if (!polylineMarkers.isDeleted()) {
                        lineStringPoints = getPointsFromMarkers(polylineMarkers.getMarkers());
                    }
                    break;
                default:
                    throw new GeoPackageException("Not a valid " + shape.getGeometryType().getName() + " shape type: " + shape.getShapeType());
            }
            if (lineStringPoints != null) {
                switch(shape.getGeometryType()) {
                    case LINESTRING:
                        geometry = toLineString(lineStringPoints);
                        break;
                    case CIRCULARSTRING:
                        geometry = toCircularString(lineStringPoints);
                        break;
                    default:
                        throw new GeoPackageException("Unhandled " + shape.getGeometryType().getName());
                }
            }
            break;
        case POLYGON:
            List<LatLng> polygonPoints = null;
            List<List<LatLng>> holePointList = null;
            switch(shape.getShapeType()) {
                case POLYGON_OPTIONS:
                    PolygonOptions polygonOptions = (PolygonOptions) shapeObject;
                    polygonPoints = polygonOptions.getPoints();
                    holePointList = polygonOptions.getHoles();
                    break;
                case POLYGON:
                    com.google.android.gms.maps.model.Polygon polygon = (com.google.android.gms.maps.model.Polygon) shapeObject;
                    polygonPoints = polygon.getPoints();
                    holePointList = polygon.getHoles();
                    break;
                case POLYGON_MARKERS:
                    PolygonMarkers polygonMarkers = (PolygonMarkers) shapeObject;
                    if (!polygonMarkers.isValid()) {
                        throw new GeoPackageException(PolygonMarkers.class.getSimpleName() + " is not valid to create " + shape.getGeometryType().getName());
                    }
                    if (!polygonMarkers.isDeleted()) {
                        polygonPoints = getPointsFromMarkers(polygonMarkers.getMarkers());
                        holePointList = new ArrayList<>();
                        for (PolygonHoleMarkers hole : polygonMarkers.getHoles()) {
                            if (!hole.isDeleted()) {
                                List<LatLng> holePoints = getPointsFromMarkers(hole.getMarkers());
                                holePointList.add(holePoints);
                            }
                        }
                    }
                    break;
                default:
                    throw new GeoPackageException("Not a valid " + shape.getGeometryType().getName() + " shape type: " + shape.getShapeType());
            }
            if (polygonPoints != null) {
                geometry = toPolygon(polygonPoints, holePointList);
            }
            break;
        case MULTIPOINT:
            List<LatLng> multiPoints = null;
            switch(shape.getShapeType()) {
                case MULTI_LAT_LNG:
                    MultiLatLng multiLatLng = (MultiLatLng) shapeObject;
                    multiPoints = multiLatLng.getLatLngs();
                    break;
                case MULTI_MARKER:
                    MultiMarker multiMarker = (MultiMarker) shapeObject;
                    multiPoints = getPointsFromMarkers(multiMarker.getMarkers());
                    break;
                default:
                    throw new GeoPackageException("Not a valid " + shape.getGeometryType().getName() + " shape type: " + shape.getShapeType());
            }
            if (multiPoints != null) {
                geometry = toMultiPoint(multiPoints);
            }
            break;
        case MULTILINESTRING:
        case COMPOUNDCURVE:
            switch(shape.getShapeType()) {
                case MULTI_POLYLINE_OPTIONS:
                    MultiPolylineOptions multiPolylineOptions = (MultiPolylineOptions) shapeObject;
                    switch(shape.getGeometryType()) {
                        case MULTILINESTRING:
                            geometry = toMultiLineStringFromOptions(multiPolylineOptions);
                            break;
                        case COMPOUNDCURVE:
                            geometry = toCompoundCurveFromOptions(multiPolylineOptions);
                            break;
                        default:
                            throw new GeoPackageException("Unhandled " + shape.getGeometryType().getName());
                    }
                    break;
                case MULTI_POLYLINE:
                    MultiPolyline multiPolyline = (MultiPolyline) shapeObject;
                    switch(shape.getGeometryType()) {
                        case MULTILINESTRING:
                            geometry = toMultiLineString(multiPolyline.getPolylines());
                            break;
                        case COMPOUNDCURVE:
                            geometry = toCompoundCurve(multiPolyline.getPolylines());
                            break;
                        default:
                            throw new GeoPackageException("Unhandled " + shape.getGeometryType().getName());
                    }
                    break;
                case MULTI_POLYLINE_MARKERS:
                    MultiPolylineMarkers multiPolylineMarkers = (MultiPolylineMarkers) shapeObject;
                    if (!multiPolylineMarkers.isValid()) {
                        throw new GeoPackageException(MultiPolylineMarkers.class.getSimpleName() + " is not valid to create " + shape.getGeometryType().getName());
                    }
                    if (!multiPolylineMarkers.isDeleted()) {
                        List<List<LatLng>> multiPolylineMarkersList = new ArrayList<>();
                        for (PolylineMarkers polylineMarkers : multiPolylineMarkers.getPolylineMarkers()) {
                            if (!polylineMarkers.isDeleted()) {
                                multiPolylineMarkersList.add(getPointsFromMarkers(polylineMarkers.getMarkers()));
                            }
                        }
                        switch(shape.getGeometryType()) {
                            case MULTILINESTRING:
                                geometry = toMultiLineStringFromList(multiPolylineMarkersList);
                                break;
                            case COMPOUNDCURVE:
                                geometry = toCompoundCurveFromList(multiPolylineMarkersList);
                                break;
                            default:
                                throw new GeoPackageException("Unhandled " + shape.getGeometryType().getName());
                        }
                    }
                    break;
                default:
                    throw new GeoPackageException("Not a valid " + shape.getGeometryType().getName() + " shape type: " + shape.getShapeType());
            }
            break;
        case MULTIPOLYGON:
            switch(shape.getShapeType()) {
                case MULTI_POLYGON_OPTIONS:
                    MultiPolygonOptions multiPolygonOptions = (MultiPolygonOptions) shapeObject;
                    geometry = toMultiPolygonFromOptions(multiPolygonOptions);
                    break;
                case MULTI_POLYGON:
                    mil.nga.geopackage.map.geom.MultiPolygon multiPolygon = (mil.nga.geopackage.map.geom.MultiPolygon) shapeObject;
                    geometry = toMultiPolygon(multiPolygon.getPolygons());
                    break;
                case MULTI_POLYGON_MARKERS:
                    MultiPolygonMarkers multiPolygonMarkers = (MultiPolygonMarkers) shapeObject;
                    if (!multiPolygonMarkers.isValid()) {
                        throw new GeoPackageException(MultiPolygonMarkers.class.getSimpleName() + " is not valid to create " + shape.getGeometryType().getName());
                    }
                    if (!multiPolygonMarkers.isDeleted()) {
                        List<Polygon> multiPolygonMarkersList = new ArrayList<>();
                        for (PolygonMarkers polygonMarkers : multiPolygonMarkers.getPolygonMarkers()) {
                            if (!polygonMarkers.isDeleted()) {
                                List<LatLng> multiPolygonPoints = getPointsFromMarkers(polygonMarkers.getMarkers());
                                List<List<LatLng>> multiPolygonHolePoints = new ArrayList<>();
                                for (PolygonHoleMarkers hole : polygonMarkers.getHoles()) {
                                    if (!hole.isDeleted()) {
                                        List<LatLng> holePoints = getPointsFromMarkers(hole.getMarkers());
                                        multiPolygonHolePoints.add(holePoints);
                                    }
                                }
                                multiPolygonMarkersList.add(toPolygon(multiPolygonPoints, multiPolygonHolePoints));
                            }
                        }
                        geometry = createMultiPolygon(multiPolygonMarkersList);
                    }
                    break;
                default:
                    throw new GeoPackageException("Not a valid " + shape.getGeometryType().getName() + " shape type: " + shape.getShapeType());
            }
            break;
        case POLYHEDRALSURFACE:
        case TIN:
        case TRIANGLE:
            throw new GeoPackageException("Unsupported GeoPackage type: " + shape.getGeometryType());
        case GEOMETRYCOLLECTION:
            @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shapeObject;
            GeometryCollection<Geometry> geometryCollection = new GeometryCollection<>(false, false);
            for (GoogleMapShape shapeListItem : shapeList) {
                Geometry subGeometry = toGeometry(shapeListItem);
                if (subGeometry != null) {
                    geometryCollection.addGeometry(subGeometry);
                }
            }
            if (geometryCollection.numGeometries() > 0) {
                geometry = geometryCollection;
            }
            break;
        default:
    }
    return geometry;
}
Also used : PolygonOptions(com.google.android.gms.maps.model.PolygonOptions) ArrayList(java.util.ArrayList) PolylineOptions(com.google.android.gms.maps.model.PolylineOptions) GeometryCollection(mil.nga.sf.GeometryCollection) ArrayList(java.util.ArrayList) List(java.util.List) LatLng(com.google.android.gms.maps.model.LatLng) MultiPolygon(mil.nga.sf.MultiPolygon) CurvePolygon(mil.nga.sf.CurvePolygon) Polygon(mil.nga.sf.Polygon) MarkerOptions(com.google.android.gms.maps.model.MarkerOptions) Marker(com.google.android.gms.maps.model.Marker) Geometry(mil.nga.sf.Geometry) MultiPolygon(mil.nga.sf.MultiPolygon) Polyline(com.google.android.gms.maps.model.Polyline) GeoPackageException(mil.nga.geopackage.GeoPackageException)

Example 8 with Geometry

use of mil.nga.sf.Geometry in project geopackage-android-map by ngageoint.

the class GoogleMapShapeConverterUtils method testShapes.

/**
 * Test shapes
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void testShapes(GeoPackage geoPackage) throws SQLException {
    GeometryColumnsDao geometryColumnsDao = geoPackage.getGeometryColumnsDao();
    if (geometryColumnsDao.isTableExists()) {
        List<GeometryColumns> results = geometryColumnsDao.queryForAll();
        for (GeometryColumns geometryColumns : results) {
            FeatureDao dao = geoPackage.getFeatureDao(geometryColumns);
            GoogleMapShapeConverter converter = new GoogleMapShapeConverter(dao.getProjection());
            converter.setExteriorOrientation(null);
            converter.setHoleOrientation(null);
            // Query for all
            FeatureCursor cursor = dao.queryForAll();
            while (cursor.moveToNext()) {
                FeatureRow featureRow = cursor.getRow();
                GeoPackageGeometryData geometryData = featureRow.getGeometry();
                if (geometryData != null) {
                    Geometry geometry = geometryData.getGeometry();
                    GeometryType geometryType = geometry.getGeometryType();
                    switch(geometryType) {
                        case POINT:
                            convertPoint(converter, (Point) geometry);
                            break;
                        case LINESTRING:
                            convertLineString(converter, (LineString) geometry);
                            break;
                        case POLYGON:
                            convertPolygon(converter, (Polygon) geometry);
                            break;
                        case MULTIPOINT:
                            convertMultiPoint(converter, (MultiPoint) geometry);
                            break;
                        case MULTILINESTRING:
                            convertMultiLineString(converter, (MultiLineString) geometry);
                            break;
                        case MULTIPOLYGON:
                            convertMultiPolygon(converter, (MultiPolygon) geometry);
                            break;
                        case CIRCULARSTRING:
                            convertLineString(converter, (CircularString) geometry);
                            break;
                        case COMPOUNDCURVE:
                            convertCompoundCurve(converter, (CompoundCurve) geometry);
                            break;
                        case POLYHEDRALSURFACE:
                            convertMultiPolygon(converter, (PolyhedralSurface) geometry);
                            break;
                        case TIN:
                            convertMultiPolygon(converter, (TIN) geometry);
                            break;
                        case TRIANGLE:
                            convertPolygon(converter, (Triangle) geometry);
                            break;
                        default:
                    }
                }
            }
            cursor.close();
        }
    }
}
Also used : GeometryColumns(mil.nga.geopackage.features.columns.GeometryColumns) Geometry(mil.nga.sf.Geometry) GeoPackageGeometryData(mil.nga.geopackage.geom.GeoPackageGeometryData) GeometryType(mil.nga.sf.GeometryType) FeatureRow(mil.nga.geopackage.features.user.FeatureRow) FeatureDao(mil.nga.geopackage.features.user.FeatureDao) FeatureCursor(mil.nga.geopackage.features.user.FeatureCursor) GeometryColumnsDao(mil.nga.geopackage.features.columns.GeometryColumnsDao)

Example 9 with Geometry

use of mil.nga.sf.Geometry in project geopackage-android-map by ngageoint.

the class GoogleMapShapeConverter method addToMap.

/**
 * Convert a {@link GeometryCollection} to a list of Map shapes and add to
 * the map
 *
 * @param map                google map
 * @param geometryCollection geometry collection
 * @return google map shapes
 */
public List<GoogleMapShape> addToMap(GoogleMap map, GeometryCollection<Geometry> geometryCollection) {
    List<GoogleMapShape> shapes = new ArrayList<>();
    for (Geometry geometry : geometryCollection.getGeometries()) {
        GoogleMapShape shape = addToMap(map, geometry);
        shapes.add(shape);
    }
    return shapes;
}
Also used : Geometry(mil.nga.sf.Geometry) ArrayList(java.util.ArrayList)

Aggregations

Geometry (mil.nga.sf.Geometry)9 GeoPackageException (mil.nga.geopackage.GeoPackageException)4 ArrayList (java.util.ArrayList)3 FeatureDao (mil.nga.geopackage.features.user.FeatureDao)3 FeatureRow (mil.nga.geopackage.features.user.FeatureRow)3 GeoPackageGeometryData (mil.nga.geopackage.geom.GeoPackageGeometryData)3 Point (mil.nga.sf.Point)3 GeometryColumnsDao (mil.nga.geopackage.features.columns.GeometryColumnsDao)2 FeatureCursor (mil.nga.geopackage.features.user.FeatureCursor)2 SpatialReferenceSystemDao (mil.nga.geopackage.srs.SpatialReferenceSystemDao)2 CompoundCurve (mil.nga.sf.CompoundCurve)2 GeometryType (mil.nga.sf.GeometryType)2 LineString (mil.nga.sf.LineString)2 Bitmap (android.graphics.Bitmap)1 LatLng (com.google.android.gms.maps.model.LatLng)1 Marker (com.google.android.gms.maps.model.Marker)1 MarkerOptions (com.google.android.gms.maps.model.MarkerOptions)1 PolygonOptions (com.google.android.gms.maps.model.PolygonOptions)1 Polyline (com.google.android.gms.maps.model.Polyline)1 PolylineOptions (com.google.android.gms.maps.model.PolylineOptions)1