Class OverlayNGRobust


  • public class OverlayNGRobust
    extends java.lang.Object
    Performs an overlay operation using OverlayNG, providing full robustness by using a series of increasingly robust (but slower) noding strategies.

    The noding strategies used are:

    1. A simple, fast noder using FLOATING precision.
    2. A SnappingNoder using an automatically-determined snap tolerance
    3. First snapping each geometry to itself, and then overlaying them using a SnappingNoder.
    4. The above two strategies are repeated with increasing snap tolerance, up to a limit.
    5. Finally a SnapRoundingNoder is used with a automatically-determined scale factor intended to preserve input precision while still preventing robustness problems.
    If all of the above attempts fail to compute a valid overlay, the original TopologyException is thrown. In practice this is extremely unlikely to occur.

    This algorithm relies on each overlay operation execution throwing a TopologyException if it is unable to compute the overlay correctly. Generally this occurs because the noding phase does not produce a valid noding. This requires the use of a ValidatingNoder in order to check the results of using a floating noder.

    Author:
    Martin Davis
    See Also:
    OverlayNG
    • Constructor Summary

      Constructors 
      Constructor Description
      OverlayNGRobust()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Geometry overlay​(Geometry geom0, Geometry geom1, int opCode)
      Overlay two geometries, using heuristics to ensure computation completes correctly.
      static Geometry union​(java.util.Collection<Geometry> geoms)
      Computes the unary union of a collection of geometries using robust computation.
      static Geometry union​(java.util.Collection<Geometry> geoms, GeometryFactory geomFact)
      Computes the unary union of a collection of geometries using robust computation.
      static Geometry union​(Geometry geom)
      Computes the unary union of a geometry using robust computation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OverlayNGRobust

        public OverlayNGRobust()
    • Method Detail

      • union

        public static Geometry union​(Geometry geom)
        Computes the unary union of a geometry using robust computation.
        Parameters:
        geom - the geometry to union
        Returns:
        the union result
        See Also:
        UnaryUnionOp
      • union

        public static Geometry union​(java.util.Collection<Geometry> geoms)
        Computes the unary union of a collection of geometries using robust computation.
        Parameters:
        geoms - the collection of geometries to union
        Returns:
        the union result
        See Also:
        UnaryUnionOp
      • union

        public static Geometry union​(java.util.Collection<Geometry> geoms,
                                     GeometryFactory geomFact)
        Computes the unary union of a collection of geometries using robust computation.
        Parameters:
        geoms - the collection of geometries to union
        geomFact - the geometry factory to use
        Returns:
        the union of the geometries
      • overlay

        public static Geometry overlay​(Geometry geom0,
                                       Geometry geom1,
                                       int opCode)
        Overlay two geometries, using heuristics to ensure computation completes correctly. In practice the heuristics are observed to be fully correct.
        Parameters:
        geom0 - a geometry
        geom1 - a geometry
        opCode - the overlay operation code (from OverlayNG
        Returns:
        the overlay result geometry
        See Also:
        OverlayNG