- def members=(s)
- @members = s
- end
-
- def tags=(t)
- @tags = t
- end
-
-# has_many :relation_segments, :class_name => 'OldRelationSegment', :foreign_key => 'id'
-# has_many :relation_tags, :class_name => 'OldRelationTag', :foreign_key => 'id'
-
- def old_members
- OldRelationMember.find(:all, :conditions => ['id = ? AND version = ?', self.id, self.version])
- end
-
- def old_tags
- OldRelationTag.find(:all, :conditions => ['id = ? AND version = ?', self.id, self.version])
- end
-
- def to_xml
- doc = OSM::API.new.get_xml_doc
- doc.root << to_xml_node()
- return doc
- end
-
- def to_xml_node
- el1 = XML::Node.new 'relation'
- el1['id'] = self.id.to_s
- el1['visible'] = self.visible.to_s
- el1['timestamp'] = self.timestamp.xmlschema
- el1['user'] = self.changeset.user.display_name if self.changeset.user.data_public?
- el1['version'] = self.version.to_s
- el1['changeset'] = self.changeset_id.to_s
-
- self.old_members.each do |member|
- e = XML::Node.new 'member'
- e['type'] = member.member_type.to_s
- e['ref'] = member.member_id.to_s # "id" is considered uncool here as it should be unique in XML
- e['role'] = member.member_role.to_s
- el1 << e
- end
-
- self.old_tags.each do |tag|
- e = XML::Node.new 'tag'
- e['k'] = tag.k
- e['v'] = tag.v
- el1 << e
- end
- return el1
- end
-
- # Temporary method to match interface to nodes
- def tags_as_hash
- return self.tags
- end