org.geolatte.geom.generator.DefaultMultiLineStringGenerator 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 DefaultMultiLineStringGenerator extends AbstractGeometryGenerator
> {
private final int numLineString;
private final DefaultLineStringGenerator
lineStrGen;
DefaultMultiLineStringGenerator(int numLineString, int numPoints, Box
bbox, Random rnd) {
super(bbox, rnd);
this.numLineString = numLineString;
this.lineStrGen = new DefaultLineStringGenerator<>(numPoints, bbox, rnd);
}
@Override
public MultiLineString
generate() {
LineString
[] linestrings = (LineString
[]) new LineString[numLineString - 1];
lineStrGen.generateArray(linestrings);
return DSL.multilinestring(lineStrGen.generate(), linestrings);
}
}