示例#1
0
        ///// <summary>
        ///// Converts an domain model changeset to and Xml changeset.
        ///// </summary>
        ///// <param name="changeset"></param>
        ///// <returns></returns>
        //public static changeset ConvertTo(this ChangeSet changeset)
        //{
        //    throw new NotImplementedException();
        //}

        ///// <summary>
        ///// Converts a domain model relation to an Xml relation.
        ///// </summary>
        ///// <param name="dom_obj"></param>
        ///// <returns></returns>
        //public static relation ConvertTo(this SimpleRelation dom_obj)
        //{
        //    relation xml_obj = new relation();

        //    // set the changeset.
        //    if (dom_obj.ChangeSetId.HasValue)
        //    {
        //        xml_obj.changeset = dom_obj.ChangeSetId.Value;
        //        xml_obj.changesetSpecified = true;
        //    }

        //    // set the id.
        //    if (dom_obj.Id.HasValue)
        //    {
        //        xml_obj.id = dom_obj.Id.Value;
        //        xml_obj.idSpecified = true;
        //    }
        //    else
        //    {
        //        xml_obj.idSpecified = false;
        //    }

        //    if (dom_obj.Tags != null)
        //    {
        //        xml_obj.tag = new tag[dom_obj.Tags.Count];
        //        int idx = 0;
        //        foreach (var tag in dom_obj.Tags)
        //        {
        //            tag t = new tag();
        //            t.k = tag.Key;
        //            t.v = tag.Value;
        //            xml_obj.tag[idx] = t;
        //            idx++;
        //        }
        //    }

        //    // set the timestamp.
        //    if (dom_obj.TimeStamp.HasValue)
        //    {
        //        xml_obj.timestamp = dom_obj.TimeStamp.Value;
        //        xml_obj.timestampSpecified = true;
        //    }

        //    // set the user data.
        //    if (dom_obj.UserId.HasValue)
        //    {
        //        xml_obj.uid = dom_obj.UserId.Value;
        //        xml_obj.uidSpecified = true;
        //    }
        //    xml_obj.user = xml_obj.user;

        //    // set the version.
        //    if (dom_obj.Version.HasValue)
        //    {
        //        xml_obj.version = (ulong)dom_obj.Version.Value;
        //        xml_obj.versionSpecified = true;
        //    }

        //    // set the visible.
        //    if (dom_obj.Visible.HasValue)
        //    {
        //        xml_obj.visible = dom_obj.Visible.Value;
        //        xml_obj.visibleSpecified = true;
        //    }
        //    else
        //    {
        //        xml_obj.visibleSpecified = false;
        //    }

        //    // set the way-specific properties.
        //    xml_obj.member = new member[dom_obj.Members.Count];
        //    for (int idx = 0; idx < dom_obj.Members.Count; idx++)
        //    {
        //        RelationMember dom_member = dom_obj.Members[idx];
        //        member m = new member();

        //        switch(dom_member.Member.Type)
        //        {
        //            case OsmType.Node:
        //                m.type = memberType.node;
        //                m.typeSpecified = true;
        //                break;
        //            case OsmType.Relation:
        //                m.type = memberType.relation;
        //                m.typeSpecified = true;
        //                break;
        //            case OsmType.Way:
        //                m.type = memberType.way;
        //                m.typeSpecified = true;
        //                break;
        //        }

        //        m.@ref = dom_member.Member.Id;
        //        m.refSpecified = true;
        //        m.role = dom_member.Role;

        //        xml_obj.member[idx] = m;
        //    }

        //    return xml_obj;
        //}

        ///// <summary>
        ///// Converts a domain model way to an Xml way.
        ///// </summary>
        ///// <param name="dom_obj"></param>
        ///// <returns></returns>
        //public static way ConvertTo(this Way dom_obj)
        //{
        //    way xml_obj = new way();

        //    // set the changeset.
        //    if (dom_obj.ChangeSetId.HasValue)
        //    {
        //        xml_obj.changeset = dom_obj.ChangeSetId.Value;
        //        xml_obj.changesetSpecified = true;
        //    }

        //    // set the id.
        //    xml_obj.id = dom_obj.Id;
        //    xml_obj.idSpecified = true;

        //    if (dom_obj.Tags != null)
        //    {
        //        xml_obj.tag = new tag[dom_obj.Tags.Count];
        //        int idx = 0;
        //        foreach (var tag in dom_obj.Tags)
        //        {
        //            tag t = new tag();
        //            t.k = tag.Key;
        //            t.v = tag.Value;
        //            xml_obj.tag[idx] = t;
        //            idx++;
        //        }
        //    }

        //    // set the timestamp.
        //    if (dom_obj.TimeStamp.HasValue)
        //    {
        //        xml_obj.timestamp = dom_obj.TimeStamp.Value;
        //        xml_obj.timestampSpecified = true;
        //    }

        //    // set the user data.
        //    if (dom_obj.UserId.HasValue)
        //    {
        //        xml_obj.uid = dom_obj.UserId.Value;
        //        xml_obj.uidSpecified = true;
        //    }
        //    xml_obj.user = xml_obj.user;

        //    // set the version.
        //    if (dom_obj.Version.HasValue)
        //    {
        //        xml_obj.version = (ulong)dom_obj.Version.Value;
        //        xml_obj.versionSpecified = true;
        //    }

        //    // set the visible.
        //    xml_obj.visible = dom_obj.Visible;
        //    xml_obj.visibleSpecified = true;

        //    // set the way-specific properties.
        //    xml_obj.nd = new nd[dom_obj.Nodes.Count];
        //    for(int idx = 0;idx < dom_obj.Nodes.Count;idx++)
        //    {
        //        nd n = new nd();
        //        n.@ref =  dom_obj.Nodes[idx].Id;
        //        n.refSpecified = true;
        //        xml_obj.nd[idx] = n;
        //    }

        //    return xml_obj;
        //}

        ///// <summary>
        ///// Converts an Xml node to an Osm domain model node.
        ///// </summary>
        ///// <param name="dom_obj"></param>
        ///// <returns></returns>
        //public static node ConvertTo(this Node dom_obj)
        //{
        //    node xml_obj = new node();

        //    // set the changeset.
        //    if(dom_obj.ChangeSetId.HasValue)
        //    {
        //        xml_obj.changeset = dom_obj.ChangeSetId.Value;
        //        xml_obj.changesetSpecified = true;
        //    }

        //    // set the id.
        //    xml_obj.id = dom_obj.Id;
        //    xml_obj.idSpecified = true;

        //    if (dom_obj.Tags != null)
        //    {
        //        xml_obj.tag = new tag[dom_obj.Tags.Count];
        //        int idx = 0;
        //        foreach (var tag in dom_obj.Tags)
        //        {
        //            tag t = new tag();
        //            t.k = tag.Key;
        //            t.v = tag.Value;
        //            xml_obj.tag[idx] = t;
        //            idx++;
        //        }
        //    }

        //    // set the timestamp.
        //    if (dom_obj.TimeStamp.HasValue)
        //    {
        //        xml_obj.timestamp = dom_obj.TimeStamp.Value;
        //        xml_obj.timestampSpecified = true;
        //    }

        //    // set the user data.
        //    if (dom_obj.UserId.HasValue)
        //    {
        //        xml_obj.uid = dom_obj.UserId.Value;
        //        xml_obj.uidSpecified = true;
        //    }
        //    xml_obj.user = xml_obj.user;

        //    // set the version.
        //    if (dom_obj.Version.HasValue)
        //    {
        //        xml_obj.version = (ulong)dom_obj.Version.Value;
        //        xml_obj.versionSpecified = true;
        //    }

        //    // set the visible.
        //    xml_obj.visible = dom_obj.Visible;
        //    xml_obj.visibleSpecified = true;

        //    // set the node-specific properties.
        //    xml_obj.lat = dom_obj.Coordinate.Latitude;
        //    xml_obj.latSpecified = true;
        //    xml_obj.lon = dom_obj.Coordinate.Longitude;
        //    xml_obj.lonSpecified = true;

        //    return xml_obj;
        //}

        /// <summary>
        /// Converts an Xml node to an Osm domain model node.
        /// </summary>
        /// <param name="dom_obj"></param>
        /// <returns></returns>
        public static node ConvertTo(this OsmSharp.Osm.Node dom_obj)
        {
            node xml_obj = new node();

            // set the changeset.
            if (dom_obj.ChangeSetId.HasValue)
            {
                xml_obj.changeset          = dom_obj.ChangeSetId.Value;
                xml_obj.changesetSpecified = true;
            }

            // set the id.
            if (dom_obj.Id.HasValue)
            {
                xml_obj.id          = dom_obj.Id.Value;
                xml_obj.idSpecified = true;
            }

            if (dom_obj.Tags != null)
            {
                xml_obj.tag = new tag[dom_obj.Tags.Count];
                int idx = 0;
                foreach (var tag in dom_obj.Tags)
                {
                    tag t = new tag();
                    t.k = tag.Key;
                    t.v = tag.Value;
                    xml_obj.tag[idx] = t;
                    idx++;
                }
            }

            // set the timestamp.
            if (dom_obj.TimeStamp.HasValue)
            {
                xml_obj.timestamp          = dom_obj.TimeStamp.Value;
                xml_obj.timestampSpecified = true;
            }

            // set the user data.
            if (dom_obj.UserId.HasValue)
            {
                xml_obj.uid          = dom_obj.UserId.Value;
                xml_obj.uidSpecified = true;
            }
            xml_obj.user = xml_obj.user;

            // set the version.
            if (dom_obj.Version.HasValue)
            {
                xml_obj.version          = (ulong)dom_obj.Version.Value;
                xml_obj.versionSpecified = true;
            }

            // set the visible.
            xml_obj.visible          = dom_obj.Visible.Value;
            xml_obj.visibleSpecified = true;

            // set the node-specific properties.
            xml_obj.lat          = dom_obj.Latitude.Value;
            xml_obj.latSpecified = true;
            xml_obj.lon          = dom_obj.Longitude.Value;
            xml_obj.lonSpecified = true;

            return(xml_obj);
        }
示例#2
0
        public static node ConvertTo(this Node node)
        {
            node node1 = new node();
            long?nullable1;

            if (node.ChangeSetId.HasValue)
            {
                node node2 = node1;
                nullable1 = node.ChangeSetId;
                long num = nullable1.Value;
                node2.changeset          = num;
                node1.changesetSpecified = true;
            }
            nullable1 = node.Id;
            if (nullable1.HasValue)
            {
                node node2 = node1;
                nullable1 = node.Id;
                long num = nullable1.Value;
                node2.id          = num;
                node1.idSpecified = true;
            }
            if (node.Tags != null)
            {
                node1.tag = new tag[node.Tags.Count];
                int index = 0;
                foreach (Tag tag in node.Tags)
                {
                    node1.tag[index] = new tag()
                    {
                        k = tag.Key,
                        v = tag.Value
                    };
                    ++index;
                }
            }
            if (node.TimeStamp.HasValue)
            {
                node1.timestamp          = node.TimeStamp.Value;
                node1.timestampSpecified = true;
            }
            nullable1 = node.UserId;
            if (nullable1.HasValue)
            {
                node node2 = node1;
                nullable1 = node.UserId;
                long num = nullable1.Value;
                node2.uid          = num;
                node1.uidSpecified = true;
            }
            node1.user = node1.user;
            ulong?version = node.Version;

            if (version.HasValue)
            {
                node node2 = node1;
                version = node.Version;
                long num = (long)version.Value;
                node2.version          = (ulong)num;
                node1.versionSpecified = true;
            }
            if (node.Visible.HasValue)
            {
                node1.visible          = node.Visible.Value;
                node1.visibleSpecified = true;
            }
            double?nullable2;

            if (node.Latitude.HasValue)
            {
                node node2 = node1;
                nullable2 = node.Latitude;
                double num = nullable2.Value;
                node2.lat          = num;
                node1.latSpecified = true;
            }
            nullable2 = node.Longitude;
            if (nullable2.HasValue)
            {
                node node2 = node1;
                nullable2 = node.Longitude;
                double num = nullable2.Value;
                node2.lon          = num;
                node1.lonSpecified = true;
            }
            return(node1);
        }
示例#3
0
        /// <summary>
        /// Converts an Xml node to an Osm domain model node.
        /// </summary>
        /// <param name="dom_obj"></param>
        /// <returns></returns>
        public static node ConvertTo(this OsmSharp.Osm.Simple.SimpleNode dom_obj)
        {
            node xml_obj = new node();

            // set the changeset.
            if (dom_obj.ChangeSetId.HasValue)
            {
                xml_obj.changeset = dom_obj.ChangeSetId.Value;
                xml_obj.changesetSpecified = true;
            }

            // set the id.
            if (dom_obj.Id.HasValue)
            {
                xml_obj.id = dom_obj.Id.Value;
                xml_obj.idSpecified = true;
            }

            if (dom_obj.Tags != null)
            {
                xml_obj.tag = new tag[dom_obj.Tags.Count];
                IList<KeyValuePair<string, string>> tags_list = dom_obj.Tags.ToList<KeyValuePair<string, string>>();
                for (int idx = 0; idx < tags_list.Count; idx++)
                {
                    KeyValuePair<string, string> tag_pair = tags_list[idx];
                    tag t = new tag();
                    t.k = tag_pair.Key;
                    t.v = tag_pair.Value;
                    xml_obj.tag[idx] = t;
                }
            }

            // set the timestamp.
            if (dom_obj.TimeStamp.HasValue)
            {
                xml_obj.timestamp = dom_obj.TimeStamp.Value;
                xml_obj.timestampSpecified = true;
            }

            // set the user data.
            if (dom_obj.UserId.HasValue)
            {
                xml_obj.uid = dom_obj.UserId.Value;
                xml_obj.uidSpecified = true;
            }
            xml_obj.user = xml_obj.user;

            // set the version.
            if (dom_obj.Version.HasValue)
            {
                xml_obj.version = (ulong)dom_obj.Version.Value;
                xml_obj.versionSpecified = true;
            }

            // set the visible.
            xml_obj.visible = dom_obj.Visible.Value;
            xml_obj.visibleSpecified = true;

            // set the node-specific properties.
            xml_obj.lat = dom_obj.Latitude.Value;
            xml_obj.latSpecified = true;
            xml_obj.lon = dom_obj.Longitude.Value;
            xml_obj.lonSpecified = true;

            return xml_obj;
        }
示例#4
0
        ///// <summary>
        ///// Converts an domain model changeset to and Xml changeset.
        ///// </summary>
        ///// <param name="changeset"></param>
        ///// <returns></returns>
        //public static changeset ConvertTo(this ChangeSet changeset)
        //{
        //    throw new NotImplementedException();
        //}
        ///// <summary>
        ///// Converts a domain model relation to an Xml relation.
        ///// </summary>
        ///// <param name="dom_obj"></param>
        ///// <returns></returns>
        //public static relation ConvertTo(this SimpleRelation dom_obj)
        //{
        //    relation xml_obj = new relation();
        //    // set the changeset.
        //    if (dom_obj.ChangeSetId.HasValue)
        //    {
        //        xml_obj.changeset = dom_obj.ChangeSetId.Value;
        //        xml_obj.changesetSpecified = true;
        //    }
        //    // set the id.
        //    if (dom_obj.Id.HasValue)
        //    {
        //        xml_obj.id = dom_obj.Id.Value;
        //        xml_obj.idSpecified = true;
        //    }
        //    else
        //    {
        //        xml_obj.idSpecified = false;
        //    }
        //    if (dom_obj.Tags != null)
        //    {
        //        xml_obj.tag = new tag[dom_obj.Tags.Count];
        //        int idx = 0;
        //        foreach (var tag in dom_obj.Tags)
        //        {
        //            tag t = new tag();
        //            t.k = tag.Key;
        //            t.v = tag.Value;
        //            xml_obj.tag[idx] = t;
        //            idx++;
        //        }
        //    }
        //    // set the timestamp.
        //    if (dom_obj.TimeStamp.HasValue)
        //    {
        //        xml_obj.timestamp = dom_obj.TimeStamp.Value;
        //        xml_obj.timestampSpecified = true;
        //    }
        //    // set the user data.
        //    if (dom_obj.UserId.HasValue)
        //    {
        //        xml_obj.uid = dom_obj.UserId.Value;
        //        xml_obj.uidSpecified = true;
        //    }
        //    xml_obj.user = xml_obj.user;
        //    // set the version.
        //    if (dom_obj.Version.HasValue)
        //    {
        //        xml_obj.version = (ulong)dom_obj.Version.Value;
        //        xml_obj.versionSpecified = true;
        //    }
        //    // set the visible.
        //    if (dom_obj.Visible.HasValue)
        //    {
        //        xml_obj.visible = dom_obj.Visible.Value;
        //        xml_obj.visibleSpecified = true;
        //    }
        //    else
        //    {
        //        xml_obj.visibleSpecified = false;
        //    }
        //    // set the way-specific properties.
        //    xml_obj.member = new member[dom_obj.Members.Count];
        //    for (int idx = 0; idx < dom_obj.Members.Count; idx++)
        //    {
        //        RelationMember dom_member = dom_obj.Members[idx];
        //        member m = new member();
        //        switch(dom_member.Member.Type)
        //        {
        //            case OsmType.Node:
        //                m.type = memberType.node;
        //                m.typeSpecified = true;
        //                break;
        //            case OsmType.Relation:
        //                m.type = memberType.relation;
        //                m.typeSpecified = true;
        //                break;
        //            case OsmType.Way:
        //                m.type = memberType.way;
        //                m.typeSpecified = true;
        //                break;
        //        }
        //        m.@ref = dom_member.Member.Id;
        //        m.refSpecified = true;
        //        m.role = dom_member.Role;
        //        xml_obj.member[idx] = m;
        //    }
        //    return xml_obj;
        //}
        ///// <summary>
        ///// Converts a domain model way to an Xml way.
        ///// </summary>
        ///// <param name="dom_obj"></param>
        ///// <returns></returns>
        //public static way ConvertTo(this Way dom_obj)
        //{
        //    way xml_obj = new way();
        //    // set the changeset.
        //    if (dom_obj.ChangeSetId.HasValue)
        //    {
        //        xml_obj.changeset = dom_obj.ChangeSetId.Value;
        //        xml_obj.changesetSpecified = true;
        //    }
        //    // set the id.
        //    xml_obj.id = dom_obj.Id;
        //    xml_obj.idSpecified = true;
        //    if (dom_obj.Tags != null)
        //    {
        //        xml_obj.tag = new tag[dom_obj.Tags.Count];
        //        int idx = 0;
        //        foreach (var tag in dom_obj.Tags)
        //        {
        //            tag t = new tag();
        //            t.k = tag.Key;
        //            t.v = tag.Value;
        //            xml_obj.tag[idx] = t;
        //            idx++;
        //        }
        //    }
        //    // set the timestamp.
        //    if (dom_obj.TimeStamp.HasValue)
        //    {
        //        xml_obj.timestamp = dom_obj.TimeStamp.Value;
        //        xml_obj.timestampSpecified = true;
        //    }
        //    // set the user data.
        //    if (dom_obj.UserId.HasValue)
        //    {
        //        xml_obj.uid = dom_obj.UserId.Value;
        //        xml_obj.uidSpecified = true;
        //    }
        //    xml_obj.user = xml_obj.user;
        //    // set the version.
        //    if (dom_obj.Version.HasValue)
        //    {
        //        xml_obj.version = (ulong)dom_obj.Version.Value;
        //        xml_obj.versionSpecified = true;
        //    }
        //    // set the visible.
        //    xml_obj.visible = dom_obj.Visible;
        //    xml_obj.visibleSpecified = true;
        //    // set the way-specific properties.
        //    xml_obj.nd = new nd[dom_obj.Nodes.Count];
        //    for(int idx = 0;idx < dom_obj.Nodes.Count;idx++)
        //    {
        //        nd n = new nd();
        //        n.@ref =  dom_obj.Nodes[idx].Id;
        //        n.refSpecified = true;
        //        xml_obj.nd[idx] = n;
        //    }
        //    return xml_obj;
        //}
        ///// <summary>
        ///// Converts an Xml node to an Osm domain model node.
        ///// </summary>
        ///// <param name="dom_obj"></param>
        ///// <returns></returns>
        //public static node ConvertTo(this Node dom_obj)
        //{
        //    node xml_obj = new node();
        //    // set the changeset.
        //    if(dom_obj.ChangeSetId.HasValue)
        //    {
        //        xml_obj.changeset = dom_obj.ChangeSetId.Value;
        //        xml_obj.changesetSpecified = true;
        //    }
        //    // set the id.
        //    xml_obj.id = dom_obj.Id;
        //    xml_obj.idSpecified = true;
        //    if (dom_obj.Tags != null)
        //    {
        //        xml_obj.tag = new tag[dom_obj.Tags.Count];
        //        int idx = 0;
        //        foreach (var tag in dom_obj.Tags)
        //        {
        //            tag t = new tag();
        //            t.k = tag.Key;
        //            t.v = tag.Value;
        //            xml_obj.tag[idx] = t;
        //            idx++;
        //        }
        //    }
        //    // set the timestamp.
        //    if (dom_obj.TimeStamp.HasValue)
        //    {
        //        xml_obj.timestamp = dom_obj.TimeStamp.Value;
        //        xml_obj.timestampSpecified = true;
        //    }
        //    // set the user data.
        //    if (dom_obj.UserId.HasValue)
        //    {
        //        xml_obj.uid = dom_obj.UserId.Value;
        //        xml_obj.uidSpecified = true;
        //    }
        //    xml_obj.user = xml_obj.user;
        //    // set the version.
        //    if (dom_obj.Version.HasValue)
        //    {
        //        xml_obj.version = (ulong)dom_obj.Version.Value;
        //        xml_obj.versionSpecified = true;
        //    }
        //    // set the visible.
        //    xml_obj.visible = dom_obj.Visible;
        //    xml_obj.visibleSpecified = true;
        //    // set the node-specific properties.
        //    xml_obj.lat = dom_obj.Coordinate.Latitude;
        //    xml_obj.latSpecified = true;
        //    xml_obj.lon = dom_obj.Coordinate.Longitude;
        //    xml_obj.lonSpecified = true;
        //    return xml_obj;
        //}
        /// <summary>
        /// Converts an Xml node to an Osm domain model node.
        /// </summary>
        /// <param name="dom_obj"></param>
        /// <returns></returns>
        public static node ConvertTo(this OsmSharp.Osm.Node dom_obj)
        {
            node xml_obj = new node();

            // set the changeset.
            if (dom_obj.ChangeSetId.HasValue)
            {
                xml_obj.changeset = dom_obj.ChangeSetId.Value;
                xml_obj.changesetSpecified = true;
            }

            // set the id.
            if (dom_obj.Id.HasValue)
            {
                xml_obj.id = dom_obj.Id.Value;
                xml_obj.idSpecified = true;
            }

            if (dom_obj.Tags != null)
            {
                xml_obj.tag = new tag[dom_obj.Tags.Count];
                int idx = 0;
                foreach (var tag in dom_obj.Tags)
                {
                    tag t = new tag();
                    t.k = tag.Key;
                    t.v = tag.Value;
                    xml_obj.tag[idx] = t;
                    idx++;
                }
            }

            // set the timestamp.
            if (dom_obj.TimeStamp.HasValue)
            {
                xml_obj.timestamp = dom_obj.TimeStamp.Value;
                xml_obj.timestampSpecified = true;
            }

            // set the user data.
            if (dom_obj.UserId.HasValue)
            {
                xml_obj.uid = dom_obj.UserId.Value;
                xml_obj.uidSpecified = true;
            }
            xml_obj.user = xml_obj.user;

            // set the version.
            if (dom_obj.Version.HasValue)
            {
                xml_obj.version = (ulong)dom_obj.Version.Value;
                xml_obj.versionSpecified = true;
            }

            // set the visible.
            xml_obj.visible = dom_obj.Visible.Value;
            xml_obj.visibleSpecified = true;

            // set the node-specific properties.
            xml_obj.lat = dom_obj.Latitude.Value;
            xml_obj.latSpecified = true;
            xml_obj.lon = dom_obj.Longitude.Value;
            xml_obj.lonSpecified = true;

            return xml_obj;
        }
示例#5
0
        /// <summary>
        /// Converts an Xml node to an Osm domain model node.
        /// </summary>
        /// <returns></returns>
        public static node ConvertTo(this OsmSharp.Osm.Node node)
        {
            var xmlNode = new node();

            // set the changeset.
            if (node.ChangeSetId.HasValue)
            {
                xmlNode.changeset = node.ChangeSetId.Value;
                xmlNode.changesetSpecified = true;
            }

            // set the id.
            if (node.Id.HasValue)
            {
                xmlNode.id = node.Id.Value;
                xmlNode.idSpecified = true;
            }

            if (node.Tags != null)
            {
                xmlNode.tag = new tag[node.Tags.Count];
                int idx = 0;
                foreach (var tag in node.Tags)
                {
                    var t = new tag();
                    t.k = tag.Key;
                    t.v = tag.Value;
                    xmlNode.tag[idx] = t;
                    idx++;
                }
            }

            // set the timestamp.
            if (node.TimeStamp.HasValue)
            {
                xmlNode.timestamp = node.TimeStamp.Value;
                xmlNode.timestampSpecified = true;
            }

            // set the user data.
            if (node.UserId.HasValue)
            {
                xmlNode.uid = node.UserId.Value;
                xmlNode.uidSpecified = true;
            }
            xmlNode.user = xmlNode.user;

            // set the version.
            if (node.Version.HasValue)
            {
                xmlNode.version = (ulong)node.Version.Value;
                xmlNode.versionSpecified = true;
            }

            // set the visible.
            if (node.Visible.HasValue)
            {
                xmlNode.visible = node.Visible.Value;
                xmlNode.visibleSpecified = true;
            }

            // set the node-specific properties.
            if (node.Latitude.HasValue)
            {
                xmlNode.lat = node.Latitude.Value;
                xmlNode.latSpecified = true;
            }
            if (node.Longitude.HasValue)
            {
                xmlNode.lon = node.Longitude.Value;
                xmlNode.lonSpecified = true;
            }

            return xmlNode;
        }