Class GeometryUtil


  • public class GeometryUtil
    extends Object
    Utilities methods for geometries
    Author:
    Nick Collier, Eric Tatara
    • Constructor Detail

      • GeometryUtil

        public GeometryUtil()
    • Method Detail

      • findGeometryType

        public static GeometryUtil.GeometryType findGeometryType​(Class geomClass)
        Finds the geometry type of the specified org.locationtech.jts.geom class.
        Parameters:
        geom - the org.locationtech.jts.geom class whose type we want.
        Returns:
        the geometry type of the specified org.locationtech.jts.geom class.
      • findGeometryType

        public static GeometryUtil.GeometryType findGeometryType​(org.locationtech.jts.geom.Geometry geom)
        Finds the geometry type of the specified geometry.
        Parameters:
        geom - the geometry whose type we want.
        Returns:
        the geometry type of the specified geometry.
      • findGeometryType

        public static GeometryUtil.GeometryType findGeometryType​(org.geotools.styling.Style style)
        Finds the geometry type associated with a style.
        Parameters:
        style - the style to check
        Returns:
        the geometry type associated with a style.
      • findGeometryType

        public static GeometryUtil.GeometryType findGeometryType​(org.opengis.feature.simple.SimpleFeature feature)
        Finds the geometry type of the specified feature.
        Parameters:
        feature - the feature whose type we want.
        Returns:
        the geometry type of the specified feature.
      • generateBuffer

        public static org.locationtech.jts.geom.Geometry generateBuffer​(Geography geography,
                                                                        org.locationtech.jts.geom.Geometry geom,
                                                                        double distance)
        Generates a Geometry that represents a buffer zone around the Geometry geom argument. An automatic conversion of the geometry CRS is done to UTM if neccessary. The distance argument is in SI meters and represent the distance from the edge of the geometry to the border.
        Parameters:
        geography - the geography
        geom - the geometry for which to create a buffer
        distance - the distance in meters between the geometry and the boundary
        Returns:
        the buffer geometry
      • generateRandomPointsInPolygon

        public static List<org.locationtech.jts.geom.Coordinate> generateRandomPointsInPolygon​(org.locationtech.jts.geom.Geometry mask,
                                                                                               int numPoints)
        Generate a collection of random coordinates that fall within the provided mask geometry. The default Repast uniform distribution instance is use for random number generation and can be controlled with the model seed.
        Parameters:
        mask - the mask Geometry (border) to enclose random points
        numPoints - the number of random points to generate
        Returns:
        a collection of random coordinates
      • generateRandomPointsInPolygon

        public static List<org.locationtech.jts.geom.Coordinate> generateRandomPointsInPolygon​(org.locationtech.jts.geom.Geometry mask,
                                                                                               int numPoints,
                                                                                               cern.jet.random.engine.RandomEngine generator)
        Generate a collection of random coordinates that fall within the provided mask geometry. The RandomEngine instance is use for random number generation.
        Parameters:
        mask - the mask Geometry (border) to enclose random points
        numPoints - the number of random points to generate
        generator - the random generator engine
        Returns:
        a collection of random coordinates