geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/features/DefaultFeatureTiles.java
private boolean drawShape(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, FeatureTileCanvas canvas, FeatureRow featureRow, Geometry geometry) {

        boolean drawn = false;

        GeometryType geometryType = geometry.getGeometryType();
        FeatureStyle featureStyle = getFeatureStyle(featureRow, geometryType);

        switch (geometryType) {

            case POINT:
                Point point = (Point) geometry;
                drawn = drawPoint(boundingBox, transform, canvas, point, featureStyle);
                break;
            case LINESTRING:
            case CIRCULARSTRING:
                LineString lineString = (LineString) geometry;
                Path linePath = new Path();
                addLineString(simplifyTolerance, boundingBox, transform, linePath, lineString);
                drawn = drawLinePath(canvas, linePath, featureStyle);
                break;
            case POLYGON:
            case TRIANGLE:
                Polygon polygon = (Polygon) geometry;
                Path polygonPath = new Path();
                addPolygon(simplifyTolerance, boundingBox, transform, polygonPath, polygon);
                drawn = drawPolygonPath(canvas, polygonPath, featureStyle);
                break;
            case MULTIPOINT:
                MultiPoint multiPoint = (MultiPoint) geometry;
                for (Point pointFromMulti : multiPoint.getPoints()) {
                    drawn = drawPoint(boundingBox, transform, canvas, pointFromMulti, featureStyle) || drawn;
                }
                break;
            case MULTILINESTRING:
                MultiLineString multiLineString = (MultiLineString) geometry;
                Path multiLinePath = new Path();
                for (LineString lineStringFromMulti : multiLineString.getLineStrings()) {
                    addLineString(simplifyTolerance, boundingBox, transform, multiLinePath, lineStringFromMulti);
                }
                drawn = drawLinePath(canvas, multiLinePath, featureStyle);
                break;
            case MULTIPOLYGON:
                MultiPolygon multiPolygon = (MultiPolygon) geometry;
                Path multiPolygonPath = new Path();
                for (Polygon polygonFromMulti : multiPolygon.getPolygons()) {
                    addPolygon(simplifyTolerance, boundingBox, transform, multiPolygonPath, polygonFromMulti);
                }
                drawn = drawPolygonPath(canvas, multiPolygonPath, featureStyle);
                break;
            case COMPOUNDCURVE:
                CompoundCurve compoundCurve = (CompoundCurve) geometry;
                Path compoundCurvePath = new Path();
                for (LineString lineStringFromCompoundCurve : compoundCurve.getLineStrings()) {
                    addLineString(simplifyTolerance, boundingBox, transform, compoundCurvePath, lineStringFromCompoundCurve);
                }
                drawn = drawLinePath(canvas, compoundCurvePath, featureStyle);
                break;
            case POLYHEDRALSURFACE:
            case TIN:
                PolyhedralSurface polyhedralSurface = (PolyhedralSurface) geometry;
                Path polyhedralSurfacePath = new Path();
                for (Polygon polygonFromPolyhedralSurface : polyhedralSurface.getPolygons()) {
                    addPolygon(simplifyTolerance, boundingBox, transform, polyhedralSurfacePath, polygonFromPolyhedralSurface);
                }
                drawn = drawPolygonPath(canvas, polyhedralSurfacePath, featureStyle);
                break;
            case GEOMETRYCOLLECTION:
                @SuppressWarnings("unchecked")
                GeometryCollection<Geometry> geometryCollection = (GeometryCollection) geometry;
                List<Geometry> geometries = geometryCollection.getGeometries();
                for (Geometry geometryFromCollection : geometries) {
                    drawn = drawShape(simplifyTolerance, boundingBox, transform, canvas, featureRow, geometryFromCollection) || drawn;
                }
                break;
            default:
                throw new GeoPackageException("Unsupported Geometry Type: "
                        + geometry.getGeometryType().getName());
        }

        return drawn;
    }
private boolean drawShape(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, FeatureTileCanvas canvas, FeatureRow featureRow, Geometry geometry) {

        boolean drawn = false;

        GeometryType geometryType = geometry.getGeometryType();
        FeatureStyle featureStyle = getFeatureStyle(featureRow, geometryType);

        switch (geometryType) {

            case POINT:
                Point point = (Point) geometry;
                drawn = drawPoint(boundingBox, transform, canvas, point, featureStyle);
                break;
            case LINESTRING:
            case CIRCULARSTRING:
                LineString lineString = (LineString) geometry;
                Path linePath = new Path();
                addLineString(simplifyTolerance, boundingBox, transform, linePath, lineString);
                drawn = drawLinePath(canvas, linePath, featureStyle);
                break;
            case POLYGON:
            case TRIANGLE:
                Polygon polygon = (Polygon) geometry;
                Path polygonPath = new Path();
                addPolygon(simplifyTolerance, boundingBox, transform, polygonPath, polygon);
                drawn = drawPolygonPath(canvas, polygonPath, featureStyle);
                break;
            case MULTIPOINT:
                MultiPoint multiPoint = (MultiPoint) geometry;
                for (Point pointFromMulti : multiPoint.getPoints()) {
                    drawn = drawPoint(boundingBox, transform, canvas, pointFromMulti, featureStyle) || drawn;
                }
                break;
            case MULTILINESTRING:
                MultiLineString multiLineString = (MultiLineString) geometry;
                Path multiLinePath = new Path();
                for (LineString lineStringFromMulti : multiLineString.getLineStrings()) {
                    addLineString(simplifyTolerance, boundingBox, transform, multiLinePath, lineStringFromMulti);
                }
                drawn = drawLinePath(canvas, multiLinePath, featureStyle);
                break;
            case MULTIPOLYGON:
                MultiPolygon multiPolygon = (MultiPolygon) geometry;
                Path multiPolygonPath = new Path();
                for (Polygon polygonFromMulti : multiPolygon.getPolygons()) {
                    addPolygon(simplifyTolerance, boundingBox, transform, multiPolygonPath, polygonFromMulti);
                }
                drawn = drawPolygonPath(canvas, multiPolygonPath, featureStyle);
                break;
            case COMPOUNDCURVE:
                CompoundCurve compoundCurve = (CompoundCurve) geometry;
                Path compoundCurvePath = new Path();
                for (LineString lineStringFromCompoundCurve : compoundCurve.getLineStrings()) {
                    addLineString(simplifyTolerance, boundingBox, transform, compoundCurvePath, lineStringFromCompoundCurve);
                }
                drawn = drawLinePath(canvas, compoundCurvePath, featureStyle);
                break;
            case POLYHEDRALSURFACE:
            case TIN:
                PolyhedralSurface polyhedralSurface = (PolyhedralSurface) geometry;
                Path polyhedralSurfacePath = new Path();
                for (Polygon polygonFromPolyhedralSurface : polyhedralSurface.getPolygons()) {
                    addPolygon(simplifyTolerance, boundingBox, transform, polyhedralSurfacePath, polygonFromPolyhedralSurface);
                }
                drawn = drawPolygonPath(canvas, polyhedralSurfacePath, featureStyle);
                break;
            case GEOMETRYCOLLECTION:
                @SuppressWarnings("unchecked")
                GeometryCollection<Geometry> geometryCollection = (GeometryCollection) geometry;
                List<Geometry> geometries = geometryCollection.getGeometries();
                for (Geometry geometryFromCollection : geometries) {
                    drawn = drawShape(simplifyTolerance, boundingBox, transform, canvas, featureRow, geometryFromCollection) || drawn;
                }
                break;
            default:
                throw new GeoPackageException("Unsupported Geometry Type: "
                        + geometry.getGeometryType().getName());
        }

        return drawn;
    }
private boolean drawShape ( double simplifyTolerance , BoundingBox boundingBox , ProjectionTransform transform , FeatureTileCanvas canvas , FeatureRow featureRow , Geometry geometry ) { boolean drawn = false ; GeometryType geometryType = geometry . getGeometryType ( ) ; FeatureStyle featureStyle = getFeatureStyle ( featureRow , geometryType ) ; switch ( geometryType ) { case POINT : Point point = ( Point ) geometry ; drawn = drawPoint ( boundingBox , transform , canvas , point , featureStyle ) ; break ; case LINESTRING : case CIRCULARSTRING : LineString lineString = ( LineString ) geometry ; Path linePath = new Path ( ) ; addLineString ( simplifyTolerance , boundingBox , transform , linePath , lineString ) ; drawn = drawLinePath ( canvas , linePath , featureStyle ) ; break ; case POLYGON : case TRIANGLE : Polygon polygon = ( Polygon ) geometry ; Path polygonPath = new Path ( ) ; addPolygon ( simplifyTolerance , boundingBox , transform , polygonPath , polygon ) ; drawn = drawPolygonPath ( canvas , polygonPath , featureStyle ) ; break ; case MULTIPOINT : MultiPoint multiPoint = ( MultiPoint ) geometry ; for ( Point pointFromMulti : multiPoint . getPoints ( ) ) { drawn = drawPoint ( boundingBox , transform , canvas , pointFromMulti , featureStyle ) || drawn ; } break ; case MULTILINESTRING : MultiLineString multiLineString = ( MultiLineString ) geometry ; Path multiLinePath = new Path ( ) ; for ( LineString lineStringFromMulti : multiLineString . getLineStrings ( ) ) { addLineString ( simplifyTolerance , boundingBox , transform , multiLinePath , lineStringFromMulti ) ; } drawn = drawLinePath ( canvas , multiLinePath , featureStyle ) ; break ; case MULTIPOLYGON : MultiPolygon multiPolygon = ( MultiPolygon ) geometry ; Path multiPolygonPath = new Path ( ) ; for ( Polygon polygonFromMulti : multiPolygon . getPolygons ( ) ) { addPolygon ( simplifyTolerance , boundingBox , transform , multiPolygonPath , polygonFromMulti ) ; } drawn = drawPolygonPath ( canvas , multiPolygonPath , featureStyle ) ; break ; case COMPOUNDCURVE : CompoundCurve compoundCurve = ( CompoundCurve ) geometry ; Path compoundCurvePath = new Path ( ) ; for ( LineString lineStringFromCompoundCurve : compoundCurve . getLineStrings ( ) ) { addLineString ( simplifyTolerance , boundingBox , transform , compoundCurvePath , lineStringFromCompoundCurve ) ; } drawn = drawLinePath ( canvas , compoundCurvePath , featureStyle ) ; break ; case POLYHEDRALSURFACE : case TIN : PolyhedralSurface polyhedralSurface = ( PolyhedralSurface ) geometry ; Path polyhedralSurfacePath = new Path ( ) ; for ( Polygon polygonFromPolyhedralSurface : polyhedralSurface . getPolygons ( ) ) { addPolygon ( simplifyTolerance , boundingBox , transform , polyhedralSurfacePath , polygonFromPolyhedralSurface ) ; } drawn = drawPolygonPath ( canvas , polyhedralSurfacePath , featureStyle ) ; break ; case GEOMETRYCOLLECTION : @ SuppressWarnings ( "unchecked" ) GeometryCollection < Geometry > geometryCollection = ( GeometryCollection ) geometry ; List < Geometry > geometries = geometryCollection . getGeometries ( ) ; for ( Geometry geometryFromCollection : geometries ) { drawn = drawShape ( simplifyTolerance , boundingBox , transform , canvas , featureRow , geometryFromCollection ) || drawn ; } break ; default : throw new GeoPackageException ( "Unsupported Geometry Type: " + geometry . getGeometryType ( ) . getName ( ) ) ; } return drawn ; }
Draw the geometry on the canvas

@param simplifyTolerance simplify tolerance in meters
@param boundingBox       bounding box
@param transform         projection transform
@param canvas            feature tile canvas
@param featureRow        feature row
@param geometry          feature geometry
@return true if drawn
Draw the geometry on the canvas