Changeset 10001 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2016-03-17T01:50:12+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/BBox.java
r9976 r10001 52 52 } 53 53 54 public BBox(double a _x, double a_y, double b_x, double b_y) {55 56 if (a _x > b_x) {57 xmax = a _x;58 xmin = b _x;54 public BBox(double ax, double ay, double bx, double by) { 55 56 if (ax > bx) { 57 xmax = ax; 58 xmin = bx; 59 59 } else { 60 xmax = b _x;61 xmin = a _x;62 } 63 64 if (a _y > b_y) {65 ymax = a _y;66 ymin = b _y;60 xmax = bx; 61 xmin = ax; 62 } 63 64 if (ay > by) { 65 ymax = ay; 66 ymin = by; 67 67 } else { 68 ymax = b _y;69 ymin = a _y;68 ymax = by; 69 ymin = ay; 70 70 } 71 71 -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r9854 r10001 98 98 } 99 99 100 QBLevel(QBLevel<T> parent, int parent _index, final QuadBuckets<T> buckets) {100 QBLevel(QBLevel<T> parent, int parentIndex, final QuadBuckets<T> buckets) { 101 101 this.parent = parent; 102 102 this.level = parent.level + 1; 103 this.index = parent _index;103 this.index = parentIndex; 104 104 this.buckets = buckets; 105 105 … … 111 111 mult = 1 << 30; 112 112 } 113 long this_quadpart = mult * (parent_index << shift);114 this.quad = parent.quad | this_quadpart;113 long quadpart = mult * (parentIndex << shift); 114 this.quad = parent.quad | quadpart; 115 115 this.bbox = calculateBBox(); // calculateBBox reference quad 116 116 } 117 117 118 118 private BBox calculateBBox() { 119 LatLon bottom _left = this.coor();120 double lat = bottom _left.lat() + parent.height() / 2;121 double lon = bottom _left.lon() + parent.width() / 2;122 return new BBox(bottom _left.lon(), bottom_left.lat(), lon, lat);119 LatLon bottomLeft = this.coor(); 120 double lat = bottomLeft.lat() + parent.height() / 2; 121 double lon = bottomLeft.lon() + parent.width() / 2; 122 return new BBox(bottomLeft.lon(), bottomLeft.lat(), lon, lat); 123 123 } 124 124 … … 181 181 } 182 182 183 boolean matches(final T o, final BBox search _bbox) {183 boolean matches(final T o, final BBox searchBbox) { 184 184 if (o instanceof Node) { 185 185 final LatLon latLon = ((Node) o).getCoor(); 186 186 // node without coords -> bbox[0,0,0,0] 187 return search _bbox.bounds(latLon != null ? latLon : LatLon.ZERO);188 } 189 return o.getBBox().intersects(search _bbox);190 } 191 192 private void search_contents(BBox search _bbox, List<T> result) {187 return searchBbox.bounds(latLon != null ? latLon : LatLon.ZERO); 188 } 189 return o.getBBox().intersects(searchBbox); 190 } 191 192 private void search_contents(BBox searchBbox, List<T> result) { 193 193 /* 194 194 * It is possible that this was created in a split … … 199 199 200 200 for (T o : content) { 201 if (matches(o, search _bbox)) {201 if (matches(o, searchBbox)) { 202 202 result.add(o); 203 203 } … … 299 299 } 300 300 301 private void search(BBox search _bbox, List<T> result) {302 if (!this.bbox().intersects(search _bbox))301 private void search(BBox searchBbox, List<T> result) { 302 if (!this.bbox().intersects(searchBbox)) 303 303 return; 304 else if (bbox().bounds(search _bbox)) {304 else if (bbox().bounds(searchBbox)) { 305 305 buckets.searchCache = this; 306 306 } 307 307 308 308 if (this.hasContent()) { 309 search_contents(search _bbox, result);309 search_contents(searchBbox, result); 310 310 } 311 311 … … 313 313 314 314 if (nw != null) { 315 nw.search(search _bbox, result);315 nw.search(searchBbox, result); 316 316 } 317 317 if (ne != null) { 318 ne.search(search _bbox, result);318 ne.search(searchBbox, result); 319 319 } 320 320 if (se != null) { 321 se.search(search _bbox, result);321 se.search(searchBbox, result); 322 322 } 323 323 if (sw != null) { 324 sw.search(search _bbox, result);324 sw.search(searchBbox, result); 325 325 } 326 326 } … … 330 330 } 331 331 332 int index_of(QBLevel<T> find _this) {332 int index_of(QBLevel<T> findThis) { 333 333 QBLevel<T>[] children = getChildren(); 334 334 for (int i = 0; i < QuadTiling.TILES_PER_LEVEL; i++) { 335 if (children[i] == find _this)335 if (children[i] == findThis) 336 336 return i; 337 337 }
Note:
See TracChangeset
for help on using the changeset viewer.