- Timestamp:
- 2014-07-31T19:40:30+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/GeoPropertyIndex.java
r7193 r7353 97 97 98 98 public T get(LatLon ll) { 99 if ( bbox.bounds(ll))99 if (isInside(ll)) 100 100 return getBounded(ll); 101 101 if (DEBUG) System.err.print("up["+level+"]"); … … 105 105 private T getBounded(LatLon ll) { 106 106 if (DEBUG) System.err.print("GPLevel["+level+"]"+bbox+" "); 107 if (! bbox.bounds(ll)) {107 if (!isInside(ll)) { 108 108 throw new AssertionError("Point "+ll+" should be inside "+bbox); 109 109 } … … 154 154 return children[idx].getBounded(ll); 155 155 } 156 157 /** 158 * Checks, if a point is inside this tile. 159 * Makes sure, that neighboring tiles do not overlap, i.e. a point exactly 160 * on the border of two tiles must be inside exactly one of the tiles. 161 * @param ll the coordinates of the point 162 * @return true, if it is inside of the box 163 */ 164 boolean isInside(LatLon ll) { 165 return bbox.getTopLeftLon() <= ll.lon() && 166 (ll.lon() < bbox.getBottomRightLon() || (ll.lon() == 180.0 && bbox.getBottomRightLon() == 180.0)) && 167 bbox.getBottomRightLat() <= ll.lat() && 168 (ll.lat() < bbox.getTopLeftLat() || (ll.lat() == 90.0 && bbox.getTopLeftLat() == 90.0)); 169 } 156 170 157 171 }
Note:
See TracChangeset
for help on using the changeset viewer.