Package com.esri.core.geometry
Class QuadTree
- java.lang.Object
-
- com.esri.core.geometry.QuadTree
-
- All Implemented Interfaces:
java.io.Serializable
public class QuadTree extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QuadTree.QuadTreeIterator
-
Field Summary
Fields Modifier and Type Field Description private QuadTreeImpl
m_impl
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description QuadTree(Envelope2D extent, int height)
Creates a QuadTree with the root having the extent of the input Envelope2D, and height of the input height, where the root starts at height 0.QuadTree(Envelope2D extent, int height, boolean bStoreDuplicates)
Creates a QuadTree with the root having the extent of the input Envelope2D, and height of the input height, where the root starts at height 0.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getContainedSubTreeElementCount(int quadHandle)
Returns the number of elements contained in the subtree rooted at the given quad_handle.Envelope2D
getDataExtent()
Returns the extent of all elements in the quad tree.int
getElement(int elementHandle)
Returns the element at the given element_handle.int
getElementCount()
Returns the number of elements in the QuadTree.Envelope2D
getElementExtent(int elementHandle)
Returns the element extent at the given element_handle.Envelope2D
getExtent(int quadHandle)
Returns the extent of the quad at the given quad_handle.int
getHeight(int quadHandle)
Returns the height of the quad at the given quad_handle.(package private) java.lang.Object
getImpl_()
Returns a void* to the impl class.int
getIntersectionCount(Envelope2D query, double tolerance, int maxCount)
Returns the number of elements in the quad tree that intersect the qiven query.QuadTree.QuadTreeIterator
getIterator()
Gets an iterator on the QuadTree.QuadTree.QuadTreeIterator
getIterator(boolean bSorted)
Gets an iterator on the QuadTree.QuadTree.QuadTreeIterator
getIterator(Envelope2D query, double tolerance)
Gets an iterator on the QuadTree using the input Envelope2D as the query.QuadTree.QuadTreeIterator
getIterator(Envelope2D query, double tolerance, boolean bSorted)
Gets an iterator on the QuadTree using the input Envelope2D as the query.QuadTree.QuadTreeIterator
getIterator(Geometry query, double tolerance)
Gets an iterator on the QuadTree.QuadTree.QuadTreeIterator
getIterator(Geometry query, double tolerance, boolean bSorted)
Gets an iterator on the QuadTree.int
getMaxHeight()
Returns the max height the quad tree can grow to.int
getQuad(int elementHandle)
Returns the Quad_handle of the quad containing the given element_handle.Envelope2D
getQuadTreeExtent()
Returns the extent of the quad tree.int
getSubTreeElementCount(int quadHandle)
Returns the number of elements in the subtree rooted at the given quad_handle.boolean
hasData(Envelope2D query, double tolerance)
Returns true if the quad tree has data intersecting the given query.int
insert(int element, Envelope2D boundingBox)
Inserts the element and bounding_box into the QuadTree.int
insert(int element, Envelope2D boundingBox, int hintIndex)
Inserts the element and bounding_box into the QuadTree at the given quad_handle.void
removeElement(int elementHandle)
Removes the element and bounding_box at the given element_handle.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_impl
private QuadTreeImpl m_impl
-
-
Constructor Detail
-
QuadTree
public QuadTree(Envelope2D extent, int height)
Creates a QuadTree with the root having the extent of the input Envelope2D, and height of the input height, where the root starts at height 0. \param extent The extent of the QuadTree. \param height The max height of the QuadTree.
-
QuadTree
public QuadTree(Envelope2D extent, int height, boolean bStoreDuplicates)
Creates a QuadTree with the root having the extent of the input Envelope2D, and height of the input height, where the root starts at height 0. \param extent The extent of the QuadTreeImpl. \param height The max height of the QuadTreeImpl. \param bStoreDuplicates Put true to place elements deeper into the quad tree at intesecting quads, duplicates will be stored. Put false to only place elements into quads that can contain it..
-
-
Method Detail
-
insert
public int insert(int element, Envelope2D boundingBox)
Inserts the element and bounding_box into the QuadTree. Note that a copy will me made of the input bounding_box. Note that this will invalidate any active iterator on the QuadTree. Returns an Element_handle corresponding to the element and bounding_box. \param element The element of the Geometry to be inserted. \param bounding_box The bounding_box of the Geometry to be inserted.
-
insert
public int insert(int element, Envelope2D boundingBox, int hintIndex)
Inserts the element and bounding_box into the QuadTree at the given quad_handle. Note that a copy will me made of the input bounding_box. Note that this will invalidate any active iterator on the QuadTree. Returns an Element_handle corresponding to the element and bounding_box. \param element The element of the Geometry to be inserted. \param bounding_box The bounding_box of the Geometry to be inserted. \param hint_index A handle used as a hint where to place the element. This can be a handle obtained from a previous insertion and is useful on data having strong locality such as segments of a Polygon.
-
removeElement
public void removeElement(int elementHandle)
Removes the element and bounding_box at the given element_handle. Note that this will invalidate any active iterator on the QuadTree. \param element_handle The handle corresponding to the element and bounding_box to be removed.
-
getElement
public int getElement(int elementHandle)
Returns the element at the given element_handle. \param element_handle The handle corresponding to the element to be retrieved.
-
getElementExtent
public Envelope2D getElementExtent(int elementHandle)
Returns the element extent at the given element_handle. \param element_handle The handle corresponding to the element extent to be retrieved.
-
getDataExtent
public Envelope2D getDataExtent()
Returns the extent of all elements in the quad tree.
-
getQuadTreeExtent
public Envelope2D getQuadTreeExtent()
Returns the extent of the quad tree.
-
getSubTreeElementCount
public int getSubTreeElementCount(int quadHandle)
Returns the number of elements in the subtree rooted at the given quad_handle. \param quad_handle The handle corresponding to the quad.
-
getContainedSubTreeElementCount
public int getContainedSubTreeElementCount(int quadHandle)
Returns the number of elements contained in the subtree rooted at the given quad_handle. \param quad_handle The handle corresponding to the quad.
-
getIntersectionCount
public int getIntersectionCount(Envelope2D query, double tolerance, int maxCount)
Returns the number of elements in the quad tree that intersect the qiven query. Some elements may be duplicated if the quad tree stores duplicates. \param query The Envelope2D used for the query. \param tolerance The tolerance used for the intersection tests. \param max_count If the intersection count becomes greater than or equal to the max_count, then max_count is returned.
-
hasData
public boolean hasData(Envelope2D query, double tolerance)
Returns true if the quad tree has data intersecting the given query. \param query The Envelope2D used for the query. \param tolerance The tolerance used for the intersection tests.
-
getHeight
public int getHeight(int quadHandle)
Returns the height of the quad at the given quad_handle. \param quad_handle The handle corresponding to the quad.
-
getMaxHeight
public int getMaxHeight()
Returns the max height the quad tree can grow to.
-
getExtent
public Envelope2D getExtent(int quadHandle)
Returns the extent of the quad at the given quad_handle. \param quad_handle The handle corresponding to the quad.
-
getQuad
public int getQuad(int elementHandle)
Returns the Quad_handle of the quad containing the given element_handle. \param element_handle The handle corresponding to the element.
-
getElementCount
public int getElementCount()
Returns the number of elements in the QuadTree.
-
getIterator
public QuadTree.QuadTreeIterator getIterator(Geometry query, double tolerance)
Gets an iterator on the QuadTree. The query will be the Envelope2D that bounds the input Geometry. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Geometry used for the query. If the Geometry is a Line segment, then the query will be the segment. Otherwise the query will be the Envelope2D bounding the Geometry. \param tolerance The tolerance used for the intersection tests.
-
getIterator
public QuadTree.QuadTreeIterator getIterator(Envelope2D query, double tolerance)
Gets an iterator on the QuadTree using the input Envelope2D as the query. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Envelope2D used for the query. \param tolerance The tolerance used for the intersection tests.
-
getIterator
public QuadTree.QuadTreeIterator getIterator()
Gets an iterator on the QuadTree.
-
getIterator
public QuadTree.QuadTreeIterator getIterator(Geometry query, double tolerance, boolean bSorted)
Gets an iterator on the QuadTree. The query will be the Envelope2D that bounds the input Geometry. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Geometry used for the query. If the Geometry is a Line segment, then the query will be the segment. Otherwise the query will be the Envelope2D bounding the Geometry. \param tolerance The tolerance used for the intersection tests. \param bSorted Put true to iterate the quad tree in the order of the Element_types.
-
getIterator
public QuadTree.QuadTreeIterator getIterator(Envelope2D query, double tolerance, boolean bSorted)
Gets an iterator on the QuadTree using the input Envelope2D as the query. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Envelope2D used for the query. \param tolerance The tolerance used for the intersection tests. \param bSorted Put true to iterate the quad tree in the order of the Element_types.
-
getIterator
public QuadTree.QuadTreeIterator getIterator(boolean bSorted)
Gets an iterator on the QuadTree. \param bSorted Put true to iterate the quad tree in the order of the Element_types.
-
getImpl_
java.lang.Object getImpl_()
Returns a void* to the impl class.
-
-