public  org.osmdroid.views.overlay.Polygon toCurvePolygon(CurvePolygon curvePolygon) {

        org.osmdroid.views.overlay.Polygon polygonOptions = new org.osmdroid.views.overlay.Polygon();
        List<GeoPoint> pts = new ArrayList<>();
        List<Curve> rings = curvePolygon.getRings();
        List<List<GeoPoint>> holes = new ArrayList<>();
        if (!rings.isEmpty()) {

            Double z = null;

            // Add the polygon points
            Curve curve = rings.get(0);
            if (curve instanceof CompoundCurve) {
                CompoundCurve compoundCurve = (CompoundCurve) curve;
                for (LineString lineString : compoundCurve.getLineStrings()) {
                    for (Point point : lineString.getPoints()) {
                        GeoPoint latLng = toLatLng(point);
                        pts.add(latLng);

                    }
                }
            } else if (curve instanceof LineString) {
                LineString lineString = (LineString) curve;
                for (Point point : lineString.getPoints()) {
                    GeoPoint latLng = toLatLng(point);
                    pts.add(latLng);

                }
            } else {
                throw new GeoPackageException("Unsupported Curve Type: "
                    + curve.getClass().getSimpleName());
            }


            // Add the holes
            for (int i = 1; i < rings.size(); i++) {
                Curve hole = rings.get(i);
                List<GeoPoint> holeLatLngs = new ArrayList<GeoPoint>();
                if (hole instanceof CompoundCurve) {
                    CompoundCurve holeCompoundCurve = (CompoundCurve) hole;
                    for (LineString holeLineString : holeCompoundCurve.getLineStrings()) {
                        for (Point point : holeLineString.getPoints()) {
                            GeoPoint latLng = toLatLng(point);
                            holeLatLngs.add(latLng);

                        }
                    }
                } else if (hole instanceof LineString) {
                    LineString holeLineString = (LineString) hole;
                    for (Point point : holeLineString.getPoints()) {
                        GeoPoint latLng = toLatLng(point);
                        holeLatLngs.add(latLng);
                        if (point.hasZ()) {
                            z = (z == null) ? point.getZ() : Math.max(z,
                                point.getZ());
                        }
                    }
                } else {
                    throw new GeoPackageException("Unsupported Curve Hole Type: "
                        + hole.getClass().getSimpleName());
                }
                holes.add(holeLatLngs);

            }

        }
        polygonOptions.setHoles(holes);
        polygonOptions.setPoints(pts);

        return polygonOptions;
    }
public org . osmdroid . views . overlay . Polygon toCurvePolygon ( CurvePolygon curvePolygon ) { org . osmdroid . views . overlay . Polygon polygonOptions = new org . osmdroid . views . overlay . Polygon ( ) ; List < GeoPoint > pts = new ArrayList < > ( ) ; List < Curve > rings = curvePolygon . getRings ( ) ; List < List < GeoPoint > > holes = new ArrayList < > ( ) ; if ( ! rings . isEmpty ( ) ) { Double z = null ; Curve curve = rings . get ( 0 ) ; if ( curve instanceof CompoundCurve ) { CompoundCurve compoundCurve = ( CompoundCurve ) curve ; for ( LineString lineString : compoundCurve . getLineStrings ( ) ) { for ( Point point : lineString . getPoints ( ) ) { GeoPoint latLng = toLatLng ( point ) ; pts . add ( latLng ) ; } } } else if ( curve instanceof LineString ) { LineString lineString = ( LineString ) curve ; for ( Point point : lineString . getPoints ( ) ) { GeoPoint latLng = toLatLng ( point ) ; pts . add ( latLng ) ; } } else { throw new GeoPackageException ( "Unsupported Curve Type: " + curve . getClass ( ) . getSimpleName ( ) ) ; } for ( int i = 1 ; i < rings . size ( ) ; i ++ ) { Curve hole = rings . get ( i ) ; List < GeoPoint > holeLatLngs = new ArrayList < GeoPoint > ( ) ; if ( hole instanceof CompoundCurve ) { CompoundCurve holeCompoundCurve = ( CompoundCurve ) hole ; for ( LineString holeLineString : holeCompoundCurve . getLineStrings ( ) ) { for ( Point point : holeLineString . getPoints ( ) ) { GeoPoint latLng = toLatLng ( point ) ; holeLatLngs . add ( latLng ) ; } } } else if ( hole instanceof LineString ) { LineString holeLineString = ( LineString ) hole ; for ( Point point : holeLineString . getPoints ( ) ) { GeoPoint latLng = toLatLng ( point ) ; holeLatLngs . add ( latLng ) ; if ( point . hasZ ( ) ) { z = ( z == null ) ? point . getZ ( ) : Math . max ( z , point . getZ ( ) ) ; } } } else { throw new GeoPackageException ( "Unsupported Curve Hole Type: " + hole . getClass ( ) . getSimpleName ( ) ) ; } holes . add ( holeLatLngs ) ; } } polygonOptions . setHoles ( holes ) ; polygonOptions . setPoints ( pts ) ; return polygonOptions ; }
Convert a {@link CurvePolygon} to a {@link PolygonOptions}

@param curvePolygon curve polygon
@return polygon options
@since 1.4.1