Interface TopologyPredicate


public interface TopologyPredicate
The API for strategy classes implementing spatial predicates based on the DE-9IM topology model. Predicate values for specific geometry pairs can be evaluated by RelateNG.
Author:
Martin Davis
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Indicates that the value of the predicate can be finalized based on its current state.
    default void
    init(int dimA, int dimB)
    Initializes the predicate for a specific geometric case.
    default void
    init(Envelope envA, Envelope envB)
    Initializes the predicate for a specific geometric case.
    boolean
    Tests if the predicate value is known.
    Gets the name of the predicate.
    default boolean
    requireCovers(boolean isSourceA)
    Reports whether this predicate requires that the source cover the target.
    default boolean
    requireExteriorCheck(boolean isSourceA)
    Reports whether this predicate requires checking if the source input intersects the Exterior of the target input.
    default boolean
    Reports whether this predicate requires interaction between the input geometries.
    default boolean
    Reports whether this predicate requires self-noding for geometries which contain crossing edges (for example,
    invalid reference
    LineString
    s, or s containing lines or polygons which may self-intersect).
    void
    updateDimension(int locA, int locB, int dimension)
    Updates the entry in the DE-9IM intersection matrix for given
    invalid reference
    Location
    s in the input geometries.
    boolean
    Gets the current value of the predicate result.
  • Method Details

    • name

      String name()
      Gets the name of the predicate.
      Returns:
      the predicate name
    • requireSelfNoding

      default boolean requireSelfNoding()
      Reports whether this predicate requires self-noding for geometries which contain crossing edges (for example,
      invalid reference
      LineString
      s, or s containing lines or polygons which may self-intersect). Self-noding ensures that intersections are computed consistently in cases which contain self-crossings and mutual crossings.

      Most predicates require this, but it can be avoided for simple intersection detection (such as in RelatePredicate.intersects() and RelatePredicate.disjoint(). Avoiding self-noding improves performance for polygonal inputs.

      Returns:
      true if self-noding is required.
    • requireInteraction

      default boolean requireInteraction()
      Reports whether this predicate requires interaction between the input geometries. This is the case if
       IM[I, I] >= 0 or IM[I, B] >= 0 or IM[B, I] >= 0 or IM[B, B] >= 0
       
      This allows a fast result if the envelopes of the geometries are disjoint.
      Returns:
      true if the geometries must interact
    • requireCovers

      default boolean requireCovers(boolean isSourceA)
      Reports whether this predicate requires that the source cover the target. This is the case if
       IM[Ext(Src), Int(Tgt)] = F and IM[Ext(Src), Bdy(Tgt)] = F
       
      If true, this allows a fast result if the source envelope does not cover the target envelope.
      Parameters:
      isSourceA - indicates the source input geometry
      Returns:
      true if the predicate requires checking whether the source covers the target
    • requireExteriorCheck

      default boolean requireExteriorCheck(boolean isSourceA)
      Reports whether this predicate requires checking if the source input intersects the Exterior of the target input. This is the case if:
       IM[Int(Src), Ext(Tgt)] >= 0 or IM[Bdy(Src), Ext(Tgt)] >= 0
       
      If false, this may permit a faster result in some geometric situations.
      Parameters:
      isSourceA - indicates the source input geometry
      Returns:
      true if the predicate requires checking whether the source intersects the target exterior
    • init

      default void init(int dimA, int dimB)
      Initializes the predicate for a specific geometric case. This may allow the predicate result to become known if it can be inferred from the dimensions.
      Parameters:
      dimA - the dimension of geometry A
      dimB - the dimension of geometry B
      See Also:
      • invalid reference
        Dimension
    • init

      default void init(Envelope envA, Envelope envB)
      Initializes the predicate for a specific geometric case. This may allow the predicate result to become known if it can be inferred from the envelopes.
      Parameters:
      envA - the envelope of geometry A
      envB - the envelope of geometry B
    • updateDimension

      void updateDimension(int locA, int locB, int dimension)
      Updates the entry in the DE-9IM intersection matrix for given
      invalid reference
      Location
      s in the input geometries.

      If this method is called with a

      invalid reference
      Dimension
      value which is less than the current value for the matrix entry, the implementing class should avoid changing the entry if this would cause information loss.
      Parameters:
      locA - the location on the A axis of the matrix
      locB - the location on the B axis of the matrix
      dimension - the dimension value for the entry
      See Also:
      • invalid reference
        Dimension
      • invalid reference
        Location
    • finish

      void finish()
      Indicates that the value of the predicate can be finalized based on its current state.
    • isKnown

      boolean isKnown()
      Tests if the predicate value is known.
      Returns:
      true if the result is known
    • value

      boolean value()
      Gets the current value of the predicate result. The value is only valid if isKnown() is true.
      Returns:
      the predicate result value