private static Polygon extractFloor ( final Polygon polygon ) { GeometryFactory factory = polygon . getFactory ( ) ; final LinearRing shell = factory . createLinearRing ( getClockWise ( polygon . getExteriorRing ( ) ) . getCoordinates ( ) ) ; final int nbOfHoles = polygon . getNumInteriorRing ( ) ; final LinearRing [ ] holes = new LinearRing [ nbOfHoles ] ; for ( int i = 0 ; i < nbOfHoles ; i ++ ) { holes [ i ] = factory . createLinearRing ( getCounterClockWise ( polygon . getInteriorRingN ( i ) ) . getCoordinates ( ) ) ; } return factory . createPolygon ( shell , holes ) ; }
Reverse the polygon to be oriented clockwise