private static GeoPolygon fromPolygon(final Polygon polygon){
  final Polygon[] theHoles=polygon.getHoles();
  final List<GeoPolygon> holeList=new ArrayList<>(theHoles.length);
  for (  final Polygon hole : theHoles) {
    final GeoPolygon component=fromPolygon(hole);
    if (component != null) {
      holeList.add(component);
    }
  }
  final double[] polyLats=polygon.getPolyLats();
  final double[] polyLons=polygon.getPolyLons();
  final List<GeoPoint> points=new ArrayList<>(polyLats.length - 1);
  for (int i=0; i < polyLats.length - 1; i++) {
    final int index=polyLats.length - 2 - i;
    points.add(new GeoPoint(PlanetModel.WGS84,fromDegrees(polyLats[index]),fromDegrees(polyLons[index])));
  }
  final GeoPolygon rval=GeoPolygonFactory.makeGeoPolygon(PlanetModel.WGS84,points,holeList);
  return rval;
}

private static GeoPolygon fromPolygon ( final Polygon polygon ) { final Polygon [ ] theHoles = polygon . getHoles ( ) ; final List < GeoPolygon > holeList = new ArrayList < > ( theHoles . length ) ; for ( final Polygon hole : theHoles ) { final GeoPolygon component = fromPolygon ( hole ) ; if ( component != null ) { holeList . add ( component ) ; } } final double [ ] polyLats = polygon . getPolyLats ( ) ; final double [ ] polyLons = polygon . getPolyLons ( ) ; final List < GeoPoint > points = new ArrayList < > ( polyLats . length - 1 ) ; for ( int i = 0 ; i < polyLats . length - 1 ; i ++ ) { final int index = polyLats . length - 2 - i ; points . add ( new GeoPoint ( PlanetModel . WGS84 , fromDegrees ( polyLats [ index ] ) , fromDegrees ( polyLons [ index ] ) ) ) ; } final GeoPolygon rval = GeoPolygonFactory . makeGeoPolygon ( PlanetModel . WGS84 , points , holeList ) ; return rval ; }
convert a polygon object into a geopolygon . this method uses
