// Path: core/src/main/java/com/github/filosganga/geogson/model/MultiPolygon.java
// public class MultiPolygon extends AbstractGeometry<MultiDimensionalPositions> {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public MultiPolygon(MultiDimensionalPositions positions) {
//         super(positions);
//     }
// 
//     /**
//      * Creates a MultiPolygon from the given {@link Polygon} sequence.
//      *
//      * @param polygons The {@link Polygon} sequence.
//      * @return MultiPolygon
//      */
//     public static MultiPolygon of(Polygon... polygons) {
//         return of(Arrays.asList(polygons));
//     }
// 
//     /**
//      * Creates a MultiPolygon from the given {@link Polygon} sequence.
//      *
//      * @param polygons The {@link Polygon} Iterable.
//      * @return MultiPolygon
//      */
//     public static MultiPolygon of(Iterable<Polygon> polygons) {
//         MultiDimensionalPositions.Builder positionsBuilder = MultiDimensionalPositions.builder();
//         for(Polygon polygon : polygons) {
//             positionsBuilder.addAreaPosition(polygon.positions());
//         }
// 
//         return new MultiPolygon(positionsBuilder.build());
//     }
// 
//     /**
//      * Creates a MultiPolygon from the given {@link Polygon} stream.
//      *
//      * @param polygons The {@link Polygon} Stream.
//      * @return MultiPolygon
//      */
//     public static MultiPolygon of(Stream<Polygon> polygons) {
//         return of(polygons.collect(Collectors.toList()));
//     }
// 
//     @Override
//     public Type type() {
//         return Type.MULTI_POLYGON;
//     }
// 
//     /**
//      * Returns the Iterable of {@link Polygon} composing this MultiPolygon.
//      *
//      * @return an Iterable of the polygons contained in this MultiPolygon.
//      */
//     public List<Polygon> polygons() {
//         return positions().children().stream()
//                 .map(Polygon::new)
//                 .collect(Collectors.toList());
// 
//     }
// 
// }


import com.github.filosganga.geogson.model.MultiPolygon;
import org.locationtech.jts.geom.GeometryFactory;
import java.util.stream.StreamSupport;
package com.github.filosganga.geogson.jts;



/**
 * A {@link com.github.filosganga.geogson.codec.Codec} for {@link org.locationtech.jts.geom.MultiPolygon} and
 * {@link MultiPolygon}.
 */
public class MultiPolygonCodec extends AbstractJtsCodec<org.locationtech.jts.geom.MultiPolygon, MultiPolygon> {

    /**
     * Create a codec for a {@link org.locationtech.jts.geom.MultiPolygon JTS
     * MultiPolygon} with a given {@link GeometryFactory}
     *
     * @param geometryFactory a {@link GeometryFactory} defining a PrecisionModel and a SRID
     */
    public MultiPolygonCodec(GeometryFactory geometryFactory) {
        super(geometryFactory);
    }

    @Override
    public MultiPolygon toGeometry(org.locationtech.jts.geom.MultiPolygon src) {
// Path: core/src/main/java/com/github/filosganga/geogson/model/MultiPolygon.java
// public class MultiPolygon extends AbstractGeometry<MultiDimensionalPositions> {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public MultiPolygon(MultiDimensionalPositions positions) {
//         super(positions);
//     }
// 
//     /**
//      * Creates a MultiPolygon from the given {@link Polygon} sequence.
//      *
//      * @param polygons The {@link Polygon} sequence.
//      * @return MultiPolygon
//      */
//     public static MultiPolygon of(Polygon... polygons) {
//         return of(Arrays.asList(polygons));
//     }
// 
//     /**
//      * Creates a MultiPolygon from the given {@link Polygon} sequence.
//      *
//      * @param polygons The {@link Polygon} Iterable.
//      * @return MultiPolygon
//      */
//     public static MultiPolygon of(Iterable<Polygon> polygons) {
//         MultiDimensionalPositions.Builder positionsBuilder = MultiDimensionalPositions.builder();
//         for(Polygon polygon : polygons) {
//             positionsBuilder.addAreaPosition(polygon.positions());
//         }
// 
//         return new MultiPolygon(positionsBuilder.build());
//     }
// 
//     /**
//      * Creates a MultiPolygon from the given {@link Polygon} stream.
//      *
//      * @param polygons The {@link Polygon} Stream.
//      * @return MultiPolygon
//      */
//     public static MultiPolygon of(Stream<Polygon> polygons) {
//         return of(polygons.collect(Collectors.toList()));
//     }
// 
//     @Override
//     public Type type() {
//         return Type.MULTI_POLYGON;
//     }
// 
//     /**
//      * Returns the Iterable of {@link Polygon} composing this MultiPolygon.
//      *
//      * @return an Iterable of the polygons contained in this MultiPolygon.
//      */
//     public List<Polygon> polygons() {
//         return positions().children().stream()
//                 .map(Polygon::new)
//                 .collect(Collectors.toList());
// 
//     }
// 
// }


// Path: jts/src/main/java/com/github/filosganga/geogson/jts/MultiPolygonCodec.java
import com.github.filosganga.geogson.model.MultiPolygon;
import org.locationtech.jts.geom.GeometryFactory;
import java.util.stream.StreamSupport;

package com.github.filosganga.geogson.jts;



/**
 * A {@link com.github.filosganga.geogson.codec.Codec} for {@link org.locationtech.jts.geom.MultiPolygon} and
 * {@link MultiPolygon}.
 */
public class MultiPolygonCodec extends AbstractJtsCodec<org.locationtech.jts.geom.MultiPolygon, MultiPolygon> {

    /**
     * Create a codec for a {@link org.locationtech.jts.geom.MultiPolygon JTS
     * MultiPolygon} with a given {@link GeometryFactory}
     *
     * @param geometryFactory a {@link GeometryFactory} defining a PrecisionModel and a SRID
     */
    public MultiPolygonCodec(GeometryFactory geometryFactory) {
        super(geometryFactory);
    }

    @Override
    public MultiPolygon toGeometry(org.locationtech.jts.geom.MultiPolygon src) {
        return MultiPolygon.of(StreamSupport.stream(JtsPolygonIterable.of(src).spliterator(), false)