Class OverlayOperations

java.lang.Object
nz.org.riskscape.engine.geo.OverlayOperations

public abstract class OverlayOperations extends Object

Performs geometry overlay operations on two geometries. These overlay operations are done here (instead of call lhs.intersection(rhs)) to allow greater control on the Noder implementation that is used. This can greatly reduce the chance of an overlay operation resulting in the dreaded TopologyException.

Note that the geometries returned from these operations are not guaranteed to be homogeneous. If homogeneous geometries are required see GeometryUtils.removeNonFamilyMembers(Geometry, GeometryFamily).

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract org.locationtech.jts.geom.Geometry
    apply(org.locationtech.jts.geom.Geometry lhs, org.locationtech.jts.geom.Geometry rhs, int overlayOp)
    Applies a geometric overlay operation to the left and right hand side geometries.
    org.locationtech.jts.geom.Geometry
    difference(org.locationtech.jts.geom.Geometry lhs, org.locationtech.jts.geom.Geometry rhs)
     
    get()
     
    org.locationtech.jts.geom.Geometry
    intersection(org.locationtech.jts.geom.Geometry lhs, org.locationtech.jts.geom.Geometry rhs)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OverlayOperations

      public OverlayOperations()
  • Method Details

    • get

      public static OverlayOperations get()
      Returns:
      A general purpose OverlayOperations.
    • apply

      protected abstract org.locationtech.jts.geom.Geometry apply(org.locationtech.jts.geom.Geometry lhs, org.locationtech.jts.geom.Geometry rhs, int overlayOp)

      Applies a geometric overlay operation to the left and right hand side geometries.

      Parameters:
      lhs - left hand side geometry
      rhs - right hand side geometry
      overlayOp - operation to perform
      Returns:
      result of applying the overlay operation to lhs/rhs
    • intersection

      public org.locationtech.jts.geom.Geometry intersection(org.locationtech.jts.geom.Geometry lhs, org.locationtech.jts.geom.Geometry rhs)
      Returns:
      the geometric intersection of lhs/rhs
    • difference

      public org.locationtech.jts.geom.Geometry difference(org.locationtech.jts.geom.Geometry lhs, org.locationtech.jts.geom.Geometry rhs)
      Returns:
      the geometric difference of lhs/rhs