java.lang.Object
org.jhotdraw8.geom.contour.StaticSpatialIndex
StaticSpatialIndex.
References:
This code has been derived from CavalierContours.
- CavalierContours. Copyright (c) 2019 Jedidiah Buck McCready. MIT License.
- github.com
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionStaticSpatialIndex(int numItems) Creates a new instance which can hold the specified number of items.StaticSpatialIndex(int numItems, int nodeSize) Creates a new instance which can hold the specified number of items, and which uses the specified number of items per node. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double minX, double minY, double maxX, double maxY) voidfinish()voidquery(double minX, double minY, double maxX, double maxY, IntArrayList results) voidquery(double minX, double minY, double maxX, double maxY, IntArrayList results, IntArrayDeque stack) Query the spatial index adding indexes to the results vector given.voidvisitQuery(double minX, double minY, double maxX, double maxY, IntPredicate visitor) voidvisitQuery(double minX, double minY, double maxX, double maxY, IntPredicate visitor, IntArrayDeque stack) Query the spatial index, invoking a visitor function for each index that overlaps the bounding box given.
-
Constructor Details
-
StaticSpatialIndex
public StaticSpatialIndex(int numItems) Creates a new instance which can hold the specified number of items.- Parameters:
numItems- number of items in spatial index
-
StaticSpatialIndex
public StaticSpatialIndex(int numItems, int nodeSize) Creates a new instance which can hold the specified number of items, and which uses the specified number of items per node.- Parameters:
numItems- number of items in spatial indexnodeSize- number of items per node
-
-
Method Details
-
add
public void add(double minX, double minY, double maxX, double maxY) -
finish
public void finish() -
query
- Parameters:
minX-minY-maxX-maxY-results-
-
query
public void query(double minX, double minY, double maxX, double maxY, IntArrayList results, IntArrayDeque stack) Query the spatial index adding indexes to the results vector given. This overload accepts an existing vector to use as a stack and takes care of clearing the stack before use. -
visitQuery
- Parameters:
minX-minY-maxX-maxY-visitor-
-
visitQuery
public void visitQuery(double minX, double minY, double maxX, double maxY, IntPredicate visitor, IntArrayDeque stack) Query the spatial index, invoking a visitor function for each index that overlaps the bounding box given. Visitor function has the signature boolean(int index), if visitor returns false the query stops early, otherwise the query continues. This overload accepts an existing vector to use as a stack and takes care of clearing the stack before use.
-