Ignore:
Timestamp:
2009-12-06T14:43:18+01:00 (14 years ago)
Author:
jttt
Message:

Added Way.hasIncompletNodes(), Way.isIncomplete() now returns true only if way is not downloaded, not if one of the nodes is missing. Way.isUsable() return false if one of the way nodes is incomplete

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
3 edited

Legend:

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

    r2578 r2587  
    150150            if (n.isIncomplete()) return;
    151151        }
    152         myWay.setIncomplete(false);
     152        myWay.setHasIncompleteNodes(false);
    153153    }
    154154
     
    168168            throw new RuntimeException(tr("Missing merge target for node with id {0}", other.getUniqueId()));
    169169        if (myNode.isIncomplete() || myNode.isDeleted() || !myNode.isVisible()) return;
    170         wayloop: for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) {
    171             if (w.isDeleted() || ! w.isVisible() || ! w.isIncomplete()) {
    172                 continue;
    173             }
    174             for (Node n: w.getNodes()) {
    175                 if (n.isIncomplete()) {
    176                     continue wayloop;
     170
     171        wayloop:
     172            for (Way w: OsmPrimitive.getFilteredList(myNode.getReferrers(), Way.class)) {
     173                if (w.isDeleted() || ! w.isVisible() || ! w.isIncomplete()) {
     174                    continue;
    177175                }
    178             }
    179             // all nodes are complete - set the way complete too
    180             w.setIncomplete(false);
    181         }
     176                for (Node n: w.getNodes()) {
     177                    if (n.isIncomplete()) {
     178                        continue wayloop;
     179                    }
     180                }
     181                // all nodes are complete - set the way complete too
     182                w.setHasIncompleteNodes(false);
     183            }
    182184    }
    183185
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r2583 r2587  
    11551155    }
    11561156
     1157    //TODO This method should not be necessary, incomplete state should be handled internally by OsmPrimitive
    11571158    public void setIncomplete(boolean incomplete) {
    11581159        this.incomplete = incomplete;
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r2578 r2587  
    2626    private Node[] nodes = new Node[0];
    2727    private BBox bbox;
     28    private boolean hasIncompleteNodes;
    2829
    2930    /**
     
    375376        bbox = new BBox(this);
    376377    }
     378
     379    //TODO This method should not be necessary. hasIncomplete state should be updated automatically when incomplete state of nodes change
     380    public void setHasIncompleteNodes(boolean hasIncompleteNodes) {
     381        this.hasIncompleteNodes = hasIncompleteNodes;
     382    }
     383
     384    public boolean hasIncompleteNodes() {
     385        return hasIncompleteNodes;
     386    }
     387
     388    @Override
     389    public boolean isUsable() {
     390        return super.isUsable() && !hasIncompleteNodes();
     391    }
    377392}
Note: See TracChangeset for help on using the changeset viewer.