List of usage examples for com.google.common.geometry S2CellId childEnd
public S2CellId childEnd()
From source file:com.amazonaws.geo.s2.internal.S2Manager.java
private static void processChildren(S2CellId parent, S2LatLngRect latLngRect, ConcurrentLinkedQueue<S2CellId> queue, ArrayList<S2CellId> cellIds) { List<S2CellId> children = new ArrayList<S2CellId>(4); for (S2CellId c = parent.childBegin(); !c.equals(parent.childEnd()); c = c.next()) { if (containsGeodataToFind(c, latLngRect)) { children.add(c);/*from w w w .j a va 2 s. co m*/ } } /* * TODO: Need to update the strategy! * * Current strategy: * 1 or 2 cells contain cellIdToFind: Traverse the children of the cell. * 3 cells contain cellIdToFind: Add 3 cells for result. * 4 cells contain cellIdToFind: Add the parent for result. * * ** All non-leaf cells contain 4 child cells. */ if (children.size() == 1 || children.size() == 2) { for (S2CellId child : children) { if (child.isLeaf()) { cellIds.add(child); } else { queue.add(child); } } } else if (children.size() == 3) { cellIds.addAll(children); } else if (children.size() == 4) { cellIds.add(parent); } else { assert false; // This should not happen. } }