Changeset 3163 in josm


Ignore:
Timestamp:
2010-03-29T21:34:13+02:00 (14 years ago)
Author:
bastiK
Message:

fixed #4815 (after [3154] you cannot remove a node from quadbuckets if the coordinates have changed -> first remove the node from quadbuckets then change the coordinates then add it back)

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

Legend:

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

    r3153 r3163  
    4646            }
    4747            add(coor);
     48        }
     49    }
     50
     51    public BBox(Node n) {
     52        LatLon coor = n.getCoor();
     53        if (coor == null) {
     54            xmin = xmax = ymin = ymax = 0;
     55        } else {
     56            xmin = xmax = coor.lon();
     57            ymin = ymax = coor.lat();
    4858        }
    4959    }
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r3147 r3163  
    767767    private void reindexNode(Node node) {
    768768        nodes.remove(node);
     769        node.updatePosition();
    769770        nodes.add(node);
    770771        for (OsmPrimitive primitive: node.getReferrers()) {
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r3159 r3163  
    1515
    1616    private CachedLatLon coor;
     17    private BBox bbox;
    1718
    1819    public final void setCoor(LatLon coor) {
     
    186187    @Override
    187188    public BBox getBBox() {
    188         if (coor == null)
    189             return new BBox(0, 0, 0, 0);
    190         else
    191             return new BBox(coor, coor);
     189        if (getDataSet() == null)
     190            return new BBox(this);
     191        if (bbox == null) {
     192            bbox = new BBox(this);
     193        }
     194        return new BBox(bbox);
    192195    }
    193196
    194197    @Override
    195198    public void updatePosition() {
    196         // Do nothing for now, but in future replace CachedLatLon with simple doubles and update precalculated EastNorth value here
     199        bbox = new BBox(this);
     200        // TODO: replace CachedLatLon with simple doubles and update precalculated EastNorth value here
    197201    }
    198202
Note: See TracChangeset for help on using the changeset viewer.