3 * Copyright (c) 2008 Paolo Molaro lupus@oddwiz.org
4 * License: MIT/X11, see the MIT.X11 file.
7 using System
.Collections
;
8 using System
.Collections
.Generic
;
10 using System
.Collections
.Specialized
;
12 namespace OpenStreetMap
{
14 public abstract class OsmObject
{
15 StringDictionary tags
;
22 public abstract string ObjectType
{
26 public virtual void WriteXml (XmlTextWriter writer
)
69 public string TimeStamp
{
79 public string this [string key
] {
87 tags
= new StringDictionary ();
93 public void RemoveTag (string tag
)
100 public ICollection Tags
{
103 return new string [0];
108 public void WriteCommonAttrs (XmlTextWriter writer
)
110 writer
.WriteAttributeString ("id", ID
.ToString ());
111 writer
.WriteAttributeString ("user", User
);
112 writer
.WriteAttributeString ("timestamp", TimeStamp
);
113 writer
.WriteAttributeString ("visible", Visible
? "true": "false");
116 public void WriteTags (XmlTextWriter writer
)
120 foreach (string k
in tags
.Keys
) {
121 writer
.WriteStartElement ("tag");
122 writer
.WriteAttributeString ("k", k
);
123 writer
.WriteAttributeString ("v", tags
[k
]);
124 writer
.WriteEndElement ();