Package org.openstreetmap.josm.tools
Class GeoPropertyIndex.GPLevel<T>
- java.lang.Object
-
- org.openstreetmap.josm.tools.GeoPropertyIndex.GPLevel<T>
-
- Enclosing class:
- GeoPropertyIndex<T>
protected static class GeoPropertyIndex.GPLevel<T> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private BBoxbboxprivate GeoPropertyIndex.GPLevel<T>[]childrenprivate intlevelprivate GeoPropertyIndex<T>ownerprivate GeoPropertyIndex.GPLevel<T>parentprivate Tval
-
Constructor Summary
Constructors Constructor Description GPLevel(int level, BBox bbox, GeoPropertyIndex.GPLevel<T> parent, GeoPropertyIndex<T> owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidgenerateChild(GeoPropertyIndex.GPLevel<T>[] currentChildren, BBox testBBox, int idx)Safely generate the child in a multi-threaded environmentprivate BBoxgenerateTestBBox(int idx, double lon2, double lat2)Generate the bbox for the specified index in thegetChildren()arrayTget(LatLon ll)private TgetBounded(LatLon ll)private GeoPropertyIndex.GPLevel<T>[]getChildren()Get the children array safely in a multi-threaded environment.(package private) booleanisInside(ILatLon ll)Checks, if a point is inside this tile.(package private) booleanisInside(BBox bbox, ILatLon ll)Checks, if a point is inside this tile.java.lang.StringtoString()
-
-
-
Field Detail
-
level
private final int level
-
parent
private final GeoPropertyIndex.GPLevel<T> parent
-
owner
private final GeoPropertyIndex<T> owner
-
children
private GeoPropertyIndex.GPLevel<T>[] children
-
-
Constructor Detail
-
GPLevel
public GPLevel(int level, BBox bbox, GeoPropertyIndex.GPLevel<T> parent, GeoPropertyIndex<T> owner)
-
-
Method Detail
-
getBounded
private T getBounded(LatLon ll)
-
generateTestBBox
private BBox generateTestBBox(int idx, double lon2, double lat2)
Generate the bbox for the specified index in thegetChildren()array- Parameters:
idx- The index in thegetChildren()arraylon2- The longitude of the center of the previous levellat2- The latitude of the center of the previous level- Returns:
- The test bbox for the specified index in the
getChildren()array
-
generateChild
private void generateChild(GeoPropertyIndex.GPLevel<T>[] currentChildren, BBox testBBox, int idx)
Safely generate the child in a multi-threaded environment- Parameters:
currentChildren- The children array to checktestBBox- The current bbox (will be used to create the newGeoPropertyIndex.GPLevel)idx- The index in the child array
-
getChildren
private GeoPropertyIndex.GPLevel<T>[] getChildren()
Get the children array safely in a multi-threaded environment. If this ends up being a performance issue, look up the "immutable" double-checked locking idiom. Just be certain you have a good test when checking the performance differences. See #23309/#23036. The issue there is thatTerritories.getRegionalTaginfoUrls(LatLon)uses aCollection.parallelStream().- Returns:
- The children array (sw, nw, se, ne)
-
isInside
boolean isInside(ILatLon ll)
Checks, if a point is inside this tile. Makes sure, that neighboring tiles do not overlap, i.e. a point exactly on the border of two tiles must be inside exactly one of the tiles.- Parameters:
ll- the coordinates of the point- Returns:
- true, if it is inside of the box
-
isInside
boolean isInside(BBox bbox, ILatLon ll)
Checks, if a point is inside this tile. Makes sure, that neighboring tiles do not overlap, i.e. a point exactly on the border of two tiles must be inside exactly one of the tiles.- Parameters:
bbox- the tilell- the coordinates of the point- Returns:
- true, if it is inside of the box
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-