Changeset 7353 in josm for trunk/src/org


Ignore:
Timestamp:
2014-07-31T19:40:30+02:00 (10 years ago)
Author:
bastiK
Message:

fixed #10328 - AssertionError when adding tag (is_right_hand_traffic)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/GeoPropertyIndex.java

    r7193 r7353  
    9797
    9898        public T get(LatLon ll) {
    99             if (bbox.bounds(ll))
     99            if (isInside(ll))
    100100                return getBounded(ll);
    101101            if (DEBUG) System.err.print("up["+level+"]");
     
    105105        private T getBounded(LatLon ll) {
    106106            if (DEBUG) System.err.print("GPLevel["+level+"]"+bbox+" ");
    107             if (!bbox.bounds(ll)) {
     107            if (!isInside(ll)) {
    108108                throw new AssertionError("Point "+ll+" should be inside "+bbox);
    109109            }
     
    154154            return children[idx].getBounded(ll);
    155155        }
     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        }
    156170
    157171    }
Note: See TracChangeset for help on using the changeset viewer.