Class GeometryMapper


  • public class GeometryMapper
    extends java.lang.Object
    Methods to map various collections of Geometrys via defined mapping functions.
    Author:
    Martin Davis
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  GeometryMapper.MapOp
      An interface for geometry functions that map a geometry input to a geometry output.
    • Constructor Summary

      Constructors 
      Constructor Description
      GeometryMapper()  
    • Constructor Detail

      • GeometryMapper

        public GeometryMapper()
    • Method Detail

      • map

        public static Geometry map​(Geometry geom,
                                   GeometryMapper.MapOp op)
        Maps the members of a Geometry (which may be atomic or composite) into another Geometry of most specific type. null results are skipped. In the case of hierarchical GeometryCollections, only the first level of members are mapped.
        Parameters:
        geom - the input atomic or composite geometry
        op - the mapping operation
        Returns:
        a result collection or geometry of most specific type
      • map

        public static java.util.Collection map​(java.util.Collection geoms,
                                               GeometryMapper.MapOp op)
      • flatMap

        public static Geometry flatMap​(Geometry geom,
                                       int emptyDim,
                                       GeometryMapper.MapOp op)
        Maps the atomic elements of a Geometry (which may be atomic or composite) using a GeometryMapper.MapOp mapping operation into an atomic Geometry or a flat collection of the most specific type. null and empty values returned from the mapping operation are discarded.
        Parameters:
        geom - the geometry to map
        emptyDim - the dimension of empty geometry to create
        op - the mapping operation
        Returns:
        the mapped result