org.geolatte.geom.generator.DefaultGeometryCollectionGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geolatte-geom Show documentation
Show all versions of geolatte-geom Show documentation
This geoLatte-geom library offers a geometry model that conforms to the OGC Simple Features for SQL
specification.
The newest version!
package org.geolatte.geom.generator;
import org.geolatte.geom.*;
import org.geolatte.geom.builder.DSL;
import java.util.Random;
/**
* Created by Karel Maesen, Geovise BVBA on 28/09/2018.
*/
class DefaultGeometryCollectionGenerator implements Generator> {
private final int numGeoms;
private final Generator> baseGenerator;
DefaultGeometryCollectionGenerator(int numGeoms, Generator> baseGenerator, Random rnd) {
this.numGeoms = numGeoms;
this.baseGenerator = baseGenerator;
};
@Override
@SuppressWarnings("unchecked")
public GeometryCollection generate() {
Geometry
[] geoms = (Geometry
[]) new Geometry[numGeoms-1];
baseGenerator.generateArray(geoms);
return DSL.geometrycollection(baseGenerator.generate(), geoms);
}
}