private Path toPath(MultiPolygon multiPolygon) {
Path path = toPath((Polygon) multiPolygon.getGeometryN(0));
for (int g = 1; g < multiPolygon.getNumGeometries(); g++) {
Polygon polygon = (Polygon) multiPolygon.getGeometryN(g);
LinearRing exteriorRing = polygon.getExteriorRing();
path.moveTo((int) exteriorRing.getCoordinate().getX(), (int) exteriorRing.getCoordinate().getY());
for (int i = 1; i < exteriorRing.getNumPoints() - 1; i++) {
Coordinate coordinate = exteriorRing.getCoordinateN(i);
path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
}
path.close();
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
LinearRing interiorRing = polygon.getInteriorRingN(i);
path.moveTo((int) interiorRing.getCoordinate().getX(), (int) interiorRing.getCoordinate().getY());
for (int j = 1; j < interiorRing.getNumPoints() - 1; j++) {
Coordinate coordinate = interiorRing.getCoordinateN(j);
path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
}
path.close();
}
}