Index: trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2436)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2437)
@@ -768,16 +768,27 @@
     }
 
-    void reindexNode(Node node) {
+    private void reindexNode(Node node) {
         nodes.remove(node);
         nodes.add(node);
         for (Way way:OsmPrimitive.getFilteredList(node.getReferrers(), Way.class)) {
             ways.remove(way);
+            way.updatePosition();
             ways.add(way);
         }
     }
 
-    void reindexWay(Way way) {
+    private void reindexWay(Way way) {
         ways.remove(way);
         ways.add(way);
+    }
+
+    public void fireNodeMoved(Node node) {
+        // TODO Fire event
+        reindexNode(node);
+    }
+
+    public void fireWayNodesChanged(Way way) {
+        // TODO Fire event
+        reindexWay(way);
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/Node.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 2436)
+++ trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 2437)
@@ -25,5 +25,5 @@
             }
             if (getDataSet() != null) {
-                getDataSet().reindexNode(this);
+                getDataSet().fireNodeMoved(this);
             }
         }
@@ -43,5 +43,5 @@
             }
             if (getDataSet() != null) {
-                getDataSet().reindexNode(this);
+                getDataSet().fireNodeMoved(this);
             }
         }
@@ -177,4 +177,5 @@
     }
 
+    @Override
     public BBox getBBox() {
         if (coor == null)
@@ -183,3 +184,8 @@
             return new BBox(coor, coor);
     }
+
+    @Override
+    public void updatePosition() {
+        // Do nothing for now, but in future replace CachedLatLon with simple doubles and update precalculated EastNorth value here
+    }
 }
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2436)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2437)
@@ -1010,4 +1010,9 @@
     public abstract BBox getBBox();
 
+    /**
+     * Called by Dataset to update cached position information of primitive (bbox, cached EarthNorth, ...)
+     */
+    public abstract void updatePosition();
+
 }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 2436)
+++ trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 2437)
@@ -206,14 +206,4 @@
         {
             init(parent);
-        }
-        String quads(T o)
-        {
-            if (o instanceof Node) {
-                LatLon coor = ((Node)o).getCoor();
-                if (coor == null)
-                    return "null node coordinates";
-                return Long.toHexString(QuadTiling.quadTile(coor));
-            }
-            return "Way??";
         }
         synchronized boolean remove_content(T o)
@@ -302,5 +292,5 @@
                 QBLevel child = children[new_index];
                 if (debug) {
-                    out("putting "+o+"(q:"+quads(o)+") into ["+new_index+"] " + child.bbox());
+                    out("putting "+o+"(q:"+Long.toHexString(QuadTiling.quadTile(o.getBBox().points().get(0)))+") into ["+new_index+"] " + child.bbox());
                 }
                 child.add(o);
Index: trunk/src/org/openstreetmap/josm/data/osm/Relation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 2436)
+++ trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 2437)
@@ -330,3 +330,8 @@
         return new BBox(0, 0, 0, 0);
     }
+
+    @Override
+    public void updatePosition() {
+        // Do nothing for now
+    }
 }
Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 2436)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 2437)
@@ -26,4 +26,5 @@
      */
     private Node[] nodes = new Node[0];
+    private BBox bbox;
 
     /**
@@ -60,5 +61,5 @@
 
         clearCached();
-        reindex();
+        fireNodesChanged();
     }
 
@@ -289,5 +290,5 @@
         newNodes[nodes.length] = n;
         nodes = newNodes;
-        reindex();
+        fireNodesChanged();
     }
 
@@ -312,5 +313,5 @@
         newNodes[offs] = n;
         nodes = newNodes;
-        reindex();
+        fireNodesChanged();
     }
 
@@ -324,5 +325,5 @@
             }
         }
-        reindex();
+        fireNodesChanged();
         super.setDeleted(deleted);
     }
@@ -358,7 +359,7 @@
     }
 
-    private void reindex() {
+    private void fireNodesChanged() {
         if (getDataSet() != null) {
-            getDataSet().reindexWay(this);
+            getDataSet().fireWayNodesChanged(this);
         }
     }
@@ -366,6 +367,15 @@
     @Override
     public BBox getBBox() {
-        // TODO Precalculate way bbox (and update it every time nodes are moved or edited)
-        return new BBox(this);
+        if (getDataSet() == null)
+            return new BBox(this);
+        if (bbox == null) {
+            bbox = new BBox(this);
+        }
+        return bbox;
+    }
+
+    @Override
+    public void updatePosition() {
+        bbox = new BBox(this);
     }
 }
