Interface GeoArea

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CONTAINS
      The referenced shape CONTAINS this area
      static int DISJOINT
      The referenced shape has no relation to this area
      static int OVERLAPS
      The referenced shape OVERLAPS this area
      static int WITHIN
      The referenced shape IS WITHIN this area
    • Field Detail

      • CONTAINS

        static final int CONTAINS
        The referenced shape CONTAINS this area
        See Also:
        Constant Field Values
      • WITHIN

        static final int WITHIN
        The referenced shape IS WITHIN this area
        See Also:
        Constant Field Values
      • OVERLAPS

        static final int OVERLAPS
        The referenced shape OVERLAPS this area
        See Also:
        Constant Field Values
      • DISJOINT

        static final int DISJOINT
        The referenced shape has no relation to this area
        See Also:
        Constant Field Values
    • Method Detail

      • getRelationship

        int getRelationship​(GeoShape shape)
        Find the spatial relationship between a shape and the current geo area. Note: return value is how the GeoShape relates to the GeoArea, not the other way around. For example, if this GeoArea is entirely within the shape, then CONTAINS should be returned. If the shape is entirely enclosed by this GeoArea, then WITHIN should be returned.

        It is permissible to return OVERLAPS instead of WITHIN if the shape intersects with the area at even a single point. So, a circle inscribed in a rectangle could return either OVERLAPS or WITHIN, depending on implementation. It is not permissible to return CONTAINS or DISJOINT in this circumstance, however.

        Similarly, it is permissible to return OVERLAPS instead of CONTAINS under conditions where the shape consists of multiple independent overlapping subshapes, and the area overlaps one of the subshapes. It is not permissible to return WITHIN or DISJOINT in this circumstance, however.

        Parameters:
        shape - is the shape to consider.
        Returns:
        the relationship, from the perspective of the shape.