Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-172

Replace boolean argument in AbstractEnvelope.contains and intersects

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 0.3, 0.4, 0.5, 0.6, 0.7
    • 0.8
    • Referencing
    • None

    Description

      The AbstractEnvelope class provides the following methods:

      • boolean contains(Envelope envelope, boolean edgesInclusive)
      • boolean intersects(Envelope envelope, boolean edgesInclusive)

      We may replace the boolean argument by something more generic.

      First alternative: enumeration

      We could replace the boolean argument by something like the following enumeration:

      public enum EdgeInclusion {
          /**
           * All edges are inclusive. This is the default policy for Envelope.
           */
          ALL,
      
          /**
           * All edges are exclusive.
           */
          NONE,
      
          /**
           * Edges defined by the lower corner are inclusive, while edges defined by the upper corner are exclusive.
           * This is the usual policy in Java2D.
           */
          LOWER,
      
          /**
           * Edges defined by the upper corner are inclusive, while edges defined by the lower corner are exclusive.
           * This policy is defined for completeness but rarely used.
           */
          UPPER
      }
      

      The policy used in the majority of cases is the ALL one. Consequently we should provide convenience methods expecting only an Envelope argument and using that mode by default.

      Second alternative: isLowerInclusive(int) and isUpperInclusive(int) methods.

      We could add a pair of methods telling whether the lower and upper values are inclusive or exclusive for a given dimension. This would be more generic than the above-cited enumeration, and would also be closer to the org.apache.sis.measure.Range API. The inclusion/exclusion information would be part of the Envelope state instead than an argument provided to the contains and intersects methods. However we would need to revisit also the contains(DirectPosition) and add(Envelope) methods.

      Attachments

        Activity

          People

            desruisseaux Martin Desruisseaux
            desruisseaux Martin Desruisseaux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: