Class QuadTreeNode<T>
java.lang.Object
org.aksw.commons.collections.quadtree.QuadTreeNode<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intprotected final org.locationtech.jts.geom.Envelopeprotected QuadTreeNode<T>[]protected final intprotected longInferred minimum item count (recurses to the parents)protected booleanprotected final floatprotected final intprotected LongExplicit number of minimum items set on this nodeprotected QuadTreeNode<T>protected final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionQuadTreeNode(QuadTreeNode<T> parent, int parentChildIndex, org.locationtech.jts.geom.Envelope bounds, int maxDepth, int depth, float k) -
Method Summary
Modifier and TypeMethodDescriptionacquireNodes(org.locationtech.jts.geom.Envelope splitBounds, int depth) Returns the collection of leaf nodes for the given boundsvoidorg.locationtech.jts.geom.Envelopeorg.locationtech.jts.geom.CoordinateQuadTreeNode<T>[]getData()intgetDepth()getId()Build a string that represents the path to this node from the rootlongbooleanTrue if either the minItemCount is set, or all children have it set FIXME This description is not concise - mention the transitivitybooleanisLeaf()booleanisLoaded()newNode(int parentChildIndex, org.locationtech.jts.geom.Envelope bounds) query(org.locationtech.jts.geom.Envelope bounds, int depth) Return loaded and leaf nodes within the boundsvoidqueryRec(org.locationtech.jts.geom.Envelope queryBounds, Collection<QuadTreeNode<T>> result, int depth) voidremoveItem(Object id) voidsetLoaded(boolean isLoaded) voidsetMinItemCount(long value) Sets the minimum item count on this node and recursively updates the inferred minimum item count (.infMinItemCount) on its parents.voidsplitFor(org.locationtech.jts.geom.Envelope splitBounds, int depth, Collection<QuadTreeNode<T>> result) If the node'size is above a certain ratio of the size of the bounds, it is placed into result.voidtoString()voidunlink()If there is a parent, replace this node with an empty onevoidUpdate the inferred minimum item count of this node.
-
Field Details
-
TOP_LEFT
public static final int TOP_LEFT- See Also:
-
TOP_RIGHT
public static final int TOP_RIGHT- See Also:
-
BOTTOM_LEFT
public static final int BOTTOM_LEFT- See Also:
-
BOTTOM_RIGHT
public static final int BOTTOM_RIGHT- See Also:
-
parent
-
children
-
parentChildIndex
protected final int parentChildIndex -
bounds
protected final org.locationtech.jts.geom.Envelope bounds -
maxDepth
protected final int maxDepth -
k
protected final float k -
depth
protected final int depth -
isLoaded
protected boolean isLoaded -
minItemCount
Explicit number of minimum items set on this node -
infMinItemCount
protected long infMinItemCountInferred minimum item count (recurses to the parents) -
data
-
-
Constructor Details
-
QuadTreeNode
public QuadTreeNode(QuadTreeNode<T> parent, int parentChildIndex, org.locationtech.jts.geom.Envelope bounds, int maxDepth, int depth, float k)
-
-
Method Details
-
getParent
-
getChildren
-
getData
-
isLoaded
public boolean isLoaded() -
setLoaded
public void setLoaded(boolean isLoaded) -
getInfMinItemCount
public long getInfMinItemCount() -
getDepth
public int getDepth() -
getId
Build a string that represents the path to this node from the root -
isLeaf
public boolean isLeaf() -
addItem
-
removeItem
-
setMinItemCount
public void setMinItemCount(long value) Sets the minimum item count on this node and recursively updates the inferred minimum item count (.infMinItemCount) on its parents.- Parameters:
value-
-
getMinItemCount
-
isCountComplete
public boolean isCountComplete()True if either the minItemCount is set, or all children have it set FIXME This description is not concise - mention the transitivity -
updateInfMinItemCount
public void updateInfMinItemCount()Update the inferred minimum item count of this node. It's the sum of the children's inferred minimum item counts. -
getBounds
public org.locationtech.jts.geom.Envelope getBounds() -
getCenter
public org.locationtech.jts.geom.Coordinate getCenter() -
newNode
-
subdivide
public void subdivide() -
query
Return loaded and leaf nodes within the bounds- Parameters:
bounds-depth- The maximum number of levels to go beyond the level derived from the size of bounds
-
queryRec
public void queryRec(org.locationtech.jts.geom.Envelope queryBounds, Collection<QuadTreeNode<T>> result, int depth) -
splitFor
public void splitFor(org.locationtech.jts.geom.Envelope splitBounds, int depth, Collection<QuadTreeNode<T>> result) If the node'size is above a certain ratio of the size of the bounds, it is placed into result. Otherwise, it is recursively split until the child nodes' ratio to given bounds has become large enough. Use example: If the screen is centered on a certain location, then this method picks tiles (quad-tree-nodes) of appropriate size (not too big and not too small).- Parameters:
bounds-depth-result-
-
acquireNodes
public Collection<QuadTreeNode<T>> acquireNodes(org.locationtech.jts.geom.Envelope splitBounds, int depth) Returns the collection of leaf nodes for the given bounds -
unlink
public void unlink()If there is a parent, replace this node with an empty one -
toString
-