Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r3102 r3107 334 334 @Override 335 335 public BBox getBBox() { 336 if (bbox == null) { 337 calculateBBox(new HashSet<PrimitiveId>()); 336 if (getDataSet() == null) 337 return calculateBBox(new HashSet<PrimitiveId>()); 338 else { 338 339 if (bbox == null) { 339 bbox = new BBox(0, 0, 0, 0); // No members 340 } 341 } 342 return bbox; 340 bbox = calculateBBox(new HashSet<PrimitiveId>()); 341 if (bbox == null) { 342 bbox = new BBox(0, 0, 0, 0); // No members 343 } 344 } 345 return bbox; 346 } 343 347 } 344 348 … … 374 378 super.setDataset(dataSet); 375 379 checkMembers(); 380 bbox = null; // bbox might have changed if relation was in ds, was removed, modified, added back to dataset 376 381 } 377 382 … … 401 406 /** 402 407 * Replies true if at least one child primitive is incomplete 403 * 408 * 404 409 * @return true if at least one child primitive is incomplete 405 410 */ … … 414 419 * Replies a collection with the incomplete children this relation 415 420 * refers to 416 * 421 * 417 422 * @return the incomplete children. Empty collection if no children are incomplete. 418 423 */ -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r2982 r3107 65 65 } 66 66 67 @Test 68 public void testBBoxNotInDataset() { 69 Node n1 = new Node(new LatLon(10, 10)); 70 Node n2 = new Node(new LatLon(20, 20)); 71 Way w1 = new Way(); 72 w1.addNode(n1); 73 w1.addNode(n2); 74 Relation r1 = new Relation(); 75 r1.getBBox(); 76 r1.addMember(new RelationMember("", w1)); 77 78 Assert.assertEquals(new BBox(w1), r1.getBBox()); 79 80 DataSet ds = new DataSet(); 81 ds.addPrimitive(n1); 82 ds.addPrimitive(n2); 83 ds.addPrimitive(w1); 84 ds.addPrimitive(r1); 85 86 Assert.assertEquals(new BBox(w1), r1.getBBox()); 87 88 ds.removePrimitive(r1); 89 90 n1.setCoor(new LatLon(30, 40)); 91 Assert.assertEquals(new BBox(w1), r1.getBBox()); 92 93 ds.addPrimitive(r1); 94 Assert.assertEquals(new BBox(w1), r1.getBBox()); 95 } 96 67 97 }
Note:
See TracChangeset
for help on using the changeset viewer.