+ # discussion on the mailing list gave the following definition for
+ # the bounding box update procedure of a relation:
+ #
+ # adding or removing nodes or ways from a relation causes them to be
+ # added to the changeset bounding box. adding a relation member or
+ # changing tag values causes all node and way members to be added to the
+ # bounding box. this is similar to how the map call does things and is
+ # reasonable on the assumption that adding or removing members doesn't
+ # materially change the rest of the relation.
+ any_relations =
+ changed_members.collect { |id,type| type == "relation" }.
+ inject(false) { |b,s| b or s }
+
+ if tags_changed or any_relations
+ # add all non-relation bounding boxes to the changeset
+ # FIXME: check for tag changes along with element deletions and
+ # make sure that the deleted element's bounding box is hit.
+ self.members.each do |type, id, role|
+ if type != "relation"
+ update_changeset_element(type, id)
+ end
+ end
+ else
+ # add only changed members to the changeset
+ changed_members.each do |id, type|
+ update_changeset_element(type, id)
+ end
+ end
+
+ # tell the changeset we updated one element only
+ changeset.add_changes! 1
+
+ # save the (maybe updated) changeset bounding box
+ changeset.save!