Class S2ShapeIndex.Options

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    S2ShapeIndex

    public static class S2ShapeIndex.Options
    extends java.lang.Object
    implements java.io.Serializable
    Options that affect construction of the S2ShapeIndex.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Options()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getCellSizeToLongEdgeRatio()
      Returns the cell size relative to the length of an edge at which it is first considered to be "long" (default is 1.0).
      int getMaxEdgesPerCell()
      Returns the maximum number of edges per cell (default 10.) If a cell has more than this many edges that are "long" relative to the cell size, and it is not a leaf cell, then it is subdivided.
      void setCellSizeToLongEdgeRatio​(double cellSizeToLongEdgeRatio)
      Sets the new ratio of cell size to long edges.
      void setMaxEdgesPerCell​(int maxEdgesPerCell)
      Sets the new number of max edges per cell.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • maxEdgesPerCell

        private int maxEdgesPerCell
      • cellSizeToLongEdgeRatio

        private double cellSizeToLongEdgeRatio
    • Constructor Detail

      • Options

        public Options()
    • Method Detail

      • getMaxEdgesPerCell

        public int getMaxEdgesPerCell()
        Returns the maximum number of edges per cell (default 10.) If a cell has more than this many edges that are "long" relative to the cell size, and it is not a leaf cell, then it is subdivided. Whether an edge is considered "long" is controlled by the value returned by getCellSizeToLongEdgeRatio().
      • setMaxEdgesPerCell

        public void setMaxEdgesPerCell​(int maxEdgesPerCell)
        Sets the new number of max edges per cell. Only has an effect during index construction, usually triggered by calling S2ShapeIndex.iterator().
      • getCellSizeToLongEdgeRatio

        public double getCellSizeToLongEdgeRatio()
        Returns the cell size relative to the length of an edge at which it is first considered to be "long" (default is 1.0). Long edges do not contribute toward the decision to subdivide a cell further. The size and speed of the index are typically not very sensitive to this parameter. Reasonable values range from 0.1 to 10, with smaller values causing more aggressive subdivision of long edges grouped closely together. For example, a value of 2.0 means that the cell must be at least twice the size of the edge in order for that edge to be counted. There are two reasons for not counting long edges:
        1. Such edges typically need to be propagated to several children, which increases time and memory costs without much benefit, and
        2. In pathological cases, many long edges close together could force subdivision to continue all the way to the leaf cell level.
      • setCellSizeToLongEdgeRatio

        public void setCellSizeToLongEdgeRatio​(double cellSizeToLongEdgeRatio)
        Sets the new ratio of cell size to long edges. Only has an effect during index construction, usually triggered by calling S2ShapeIndex.iterator().