Package org.openstreetmap.josm.tools
Class GeoPropertyIndex<T>
- java.lang.Object
-
- org.openstreetmap.josm.tools.GeoPropertyIndex<T>
-
- Type Parameters:
T
- the property (like land/water or nation)
public class GeoPropertyIndex<T> extends java.lang.Object
Fast index to look up properties of the earth surface.It is expected that there is a relatively slow method to look up the property for a certain coordinate and that there are larger areas with a uniform property.
This index tries to find rectangles with uniform property and caches them. Rectangles are subdivided, if there are different properties within. (Up to a maximum level, when the slow method is used again.)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GeoPropertyIndex.GPLevel<T>
-
Field Summary
Fields Modifier and Type Field Description private static boolean
DEBUG
private GeoProperty<T>
geoProp
private GeoPropertyIndex.GPLevel<T>
lastLevelUsed
private int
maxLevel
private GeoPropertyIndex.GPLevel<T>
root
-
Constructor Summary
Constructors Constructor Description GeoPropertyIndex(GeoProperty<T> geoProp, int maxLevel)
Create new GeoPropertyIndex.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get(LatLon ll)
Look up the property for a certain point.GeoProperty<T>
getGeoProperty()
Returns the geo property.java.lang.String
toString()
-
-
-
Field Detail
-
maxLevel
private final int maxLevel
-
geoProp
private final GeoProperty<T> geoProp
-
root
private final GeoPropertyIndex.GPLevel<T> root
-
lastLevelUsed
private GeoPropertyIndex.GPLevel<T> lastLevelUsed
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GeoPropertyIndex
public GeoPropertyIndex(GeoProperty<T> geoProp, int maxLevel)
Create new GeoPropertyIndex.- Parameters:
geoProp
- the input property that should be made faster by this indexmaxLevel
- max level
-
-
Method Detail
-
get
public T get(LatLon ll)
Look up the property for a certain point. This gives the same result asGeoProperty.get(LatLon)
, but should be faster.- Parameters:
ll
- the point coordinates- Returns:
- property value at that point
-
getGeoProperty
public final GeoProperty<T> getGeoProperty()
Returns the geo property.- Returns:
- the geo property
- Since:
- 14484
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-