All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geolatte.geom.generator.DefaultPolygonGenerator Maven / Gradle / Ivy

Go to download

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.Box;
import org.geolatte.geom.LinearRing;
import org.geolatte.geom.Polygon;
import org.geolatte.geom.Position;
import org.geolatte.geom.builder.DSL;

import java.util.Random;


import static org.geolatte.geom.builder.DSL.ring;
import static org.geolatte.geom.generator.PositionGenerator.nPositionsWithinAndClosed;

/**
 * Created by Karel Maesen, Geovise BVBA on 28/09/2018.
 */
class DefaultPolygonGenerator

extends AbstractGeometryGenerator> { final private int numPoints; DefaultPolygonGenerator(int numPoints, Box

bbox, Random rnd) { super(bbox, rnd); this.numPoints = numPoints; } @Override public Polygon

generate() { P[] ps = nPositionsWithinAndClosed(numPoints, bbox, rnd); LinearRing

hull = ring(crs(), ps); return DSL.polygon(hull); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy