Changeset 2449 in josm


Ignore:
Timestamp:
2009-11-14T18:33:15+01:00 (14 years ago)
Author:
hansendc
Message:

Simply QuadBuckets iterator.

This should make things much clearer and less buggy. There
have been a good number of bugs in here lately.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r2442 r2449  
    471471            return ret;
    472472        }
     473        QBLevel nextNode()
     474        {
     475            if (this.isLeaf())
     476                return this.nextSibling();
     477            return this.firstChild();
     478        }
    473479        QBLevel nextContentNode()
    474480        {
    475             QBLevel next = this;
    476             if (this.isLeaf()) {
    477                 next = this.nextSibling();
    478             }
     481            QBLevel next = this.nextNode();
    479482            if (next == null)
    480                 return null;
    481             // Walk back down the tree and find the first leaf
    482             while (!next.isLeaf()) {
    483                 QBLevel child;
    484                 if (next.hasContent() && next != this) {
    485                     break;
    486                 }
    487                 child = next.firstChild();
    488                 if (debug) {
    489                     out("["+next.level+"] next node ("+next+") is a branch (content: "+next.hasContent()+"), moving down...");
    490                 }
    491                 if (child == null) {
    492                     abort("branch node ("+this+" "+next.isLeaf()+") had no children (content: "+next.content+") this: " + this);
    493                 }
    494                 next = child;
    495             }
    496             return next;
     483                return next;
     484            if (next.hasContent())
     485                return next;
     486            return next.nextContentNode();
    497487        }
    498488        int size()
Note: See TracChangeset for help on using the changeset viewer.