コード例 #1
0
        /// <summary>
        /// Adds a node to the xml output stream.
        /// </summary>
        /// <param name="simpleNode"></param>
        public override void AddNode(Node simpleNode)
        {
            var nd = new OsmSharp.Osm.Xml.v0_6.node();

            // set id
            nd.idSpecified = false;
            if (simpleNode.Id.HasValue)
            {
                nd.id          = simpleNode.Id.Value;
                nd.idSpecified = true;
            }

            // set changeset.
            nd.changesetSpecified = false;
            if (simpleNode.ChangeSetId.HasValue)
            {
                nd.changeset          = simpleNode.ChangeSetId.Value;
                nd.changesetSpecified = true;
            }

            // set visible.
            nd.visibleSpecified = false;
            if (simpleNode.Visible.HasValue)
            {
                nd.visible          = simpleNode.Visible.Value;
                nd.visibleSpecified = true;
            }

            // set timestamp.
            nd.timestampSpecified = false;
            if (simpleNode.TimeStamp.HasValue)
            {
                nd.timestamp          = simpleNode.TimeStamp.Value;
                nd.timestampSpecified = true;
            }

            // set latitude.
            nd.latSpecified = false;
            if (simpleNode.Latitude.HasValue)
            {
                nd.lat          = simpleNode.Latitude.Value;
                nd.latSpecified = true;
            }

            // set longitude.
            nd.lonSpecified = false;
            if (simpleNode.Longitude.HasValue)
            {
                nd.lon          = simpleNode.Longitude.Value;
                nd.lonSpecified = true;
            }

            // set uid
            nd.uidSpecified = false;
            if (simpleNode.UserId.HasValue)
            {
                nd.uid          = simpleNode.UserId.Value;
                nd.uidSpecified = true;
            }

            // set user
            nd.user = simpleNode.UserName;

            // set tags.
            nd.tag = this.ConvertToXmlTags(simpleNode.Tags);

            // set version.
            if (simpleNode.Version.HasValue)
            {
                nd.version          = simpleNode.Version.Value;
                nd.versionSpecified = true;
            }

            // serialize node.
            _serNode.Serialize(_writer, nd);
            _writer.Flush();
            _textWriter.Write(_textWriter.NewLine);
        }
コード例 #2
0
        /// <summary>
        /// Adds a node to the xml output stream.
        /// </summary>
        /// <param name="simpleNode"></param>
        public override void AddNode(Node simpleNode)
        {
            var nd = new OsmSharp.Osm.Xml.v0_6.node();

            // set id
            nd.idSpecified = false;
            if (simpleNode.Id.HasValue)
            {
                nd.id = simpleNode.Id.Value;
                nd.idSpecified = true;
            }

            // set changeset.
            nd.changesetSpecified = false;
            if(simpleNode.ChangeSetId.HasValue)
            {
                nd.changeset = simpleNode.ChangeSetId.Value;
                nd.changesetSpecified = true;
            }

            // set visible.
            nd.visibleSpecified = false;
            if (simpleNode.Visible.HasValue)
            {
                nd.visible = simpleNode.Visible.Value;
                nd.visibleSpecified = true;
            }

            // set timestamp.
            nd.timestampSpecified = false;
            if (simpleNode.TimeStamp.HasValue)
            {
                nd.timestamp = simpleNode.TimeStamp.Value;
                nd.timestampSpecified = true;
            }

            // set latitude.
            nd.latSpecified = false;
            if (simpleNode.Latitude.HasValue)
            {
                nd.lat = simpleNode.Latitude.Value;
                nd.latSpecified = true;
            }

            // set longitude.
            nd.lonSpecified = false;
            if (simpleNode.Longitude.HasValue)
            {
                nd.lon = simpleNode.Longitude.Value;
                nd.lonSpecified = true;
            }

            // set uid
            nd.uidSpecified = false;
            if (simpleNode.UserId.HasValue)
            {
                nd.uid  = simpleNode.UserId.Value;
                nd.uidSpecified = true;
            }

            // set user
            nd.user = simpleNode.UserName;

            // set tags.
            nd.tag = this.ConvertToXmlTags(simpleNode.Tags);

            // set version.
            if (simpleNode.Version.HasValue)
            {
                nd.version = simpleNode.Version.Value;
                nd.versionSpecified = true;
            }

            XmlSerializerNamespaces emptyNamespace = new XmlSerializerNamespaces();
            emptyNamespace.Add(String.Empty, String.Empty);

            // serialize node.
            var memoryStream = new MemoryStream();
            var writer = XmlWriter.Create(memoryStream, _settings);
            var serNode = new XmlSerializer(typeof(Osm.Xml.v0_6.node), string.Empty);
            serNode.Serialize(writer, nd, emptyNamespace);
            memoryStream.WriteTo(_stream);
            _stream.Flush();
            _streamWriter.WriteLine();
            _streamWriter.Flush();
        }
コード例 #3
0
        /// <summary>
        /// Adds a node to the xml output stream.
        /// </summary>
        /// <param name="simpleNode"></param>
        public override void AddNode(Node simpleNode)
        {
            var nd = new OsmSharp.Osm.Xml.v0_6.node();

            // set id
            nd.idSpecified = false;
            if (simpleNode.Id.HasValue)
            {
                nd.id          = simpleNode.Id.Value;
                nd.idSpecified = true;
            }

            // set changeset.
            nd.changesetSpecified = false;
            if (simpleNode.ChangeSetId.HasValue)
            {
                nd.changeset          = simpleNode.ChangeSetId.Value;
                nd.changesetSpecified = true;
            }

            // set visible.
            nd.visibleSpecified = false;
            if (simpleNode.Visible.HasValue)
            {
                nd.visible          = simpleNode.Visible.Value;
                nd.visibleSpecified = true;
            }

            // set timestamp.
            nd.timestampSpecified = false;
            if (simpleNode.TimeStamp.HasValue)
            {
                nd.timestamp          = simpleNode.TimeStamp.Value;
                nd.timestampSpecified = true;
            }

            // set latitude.
            nd.latSpecified = false;
            if (simpleNode.Latitude.HasValue)
            {
                nd.lat          = simpleNode.Latitude.Value;
                nd.latSpecified = true;
            }

            // set longitude.
            nd.lonSpecified = false;
            if (simpleNode.Longitude.HasValue)
            {
                nd.lon          = simpleNode.Longitude.Value;
                nd.lonSpecified = true;
            }

            // set uid
            nd.uidSpecified = false;
            if (simpleNode.UserId.HasValue)
            {
                nd.uid          = simpleNode.UserId.Value;
                nd.uidSpecified = true;
            }

            // set user
            nd.user = simpleNode.UserName;

            // set tags.
            nd.tag = this.ConvertToXmlTags(simpleNode.Tags);

            // set version.
            if (simpleNode.Version.HasValue)
            {
                nd.version          = simpleNode.Version.Value;
                nd.versionSpecified = true;
            }

            XmlSerializerNamespaces emptyNamespace = new XmlSerializerNamespaces();

            emptyNamespace.Add(String.Empty, String.Empty);

            // serialize node.
            var memoryStream = new MemoryStream();
            var writer       = XmlWriter.Create(memoryStream, _settings);
            var serNode      = new XmlSerializer(typeof(Osm.Xml.v0_6.node), string.Empty);

            serNode.Serialize(writer, nd, emptyNamespace);
            memoryStream.WriteTo(_stream);
            _stream.Flush();
            _streamWriter.WriteLine();
            _streamWriter.Flush();
        }
コード例 #4
0
        /// <summary>
        /// Adds a node to the xml output stream.
        /// </summary>
        /// <param name="simpleNode"></param>
        public override void AddNode(Node simpleNode)
        {
            var nd = new OsmSharp.Osm.Xml.v0_6.node();

            // set id
            nd.idSpecified = false;
            if (simpleNode.Id.HasValue)
            {
                nd.id = simpleNode.Id.Value;
                nd.idSpecified = true;
            }

            // set changeset.
            nd.changesetSpecified = false;
            if(simpleNode.ChangeSetId.HasValue)
            {
                nd.changeset = simpleNode.ChangeSetId.Value;
                nd.changesetSpecified = true;
            }

            // set visible.
            nd.visibleSpecified = false;
            if (simpleNode.Visible.HasValue)
            {
                nd.visible = simpleNode.Visible.Value;
                nd.visibleSpecified = true;
            }

            // set timestamp.
            nd.timestampSpecified = false;
            if (simpleNode.TimeStamp.HasValue)
            {
                nd.timestamp = simpleNode.TimeStamp.Value;
                nd.timestampSpecified = true;
            }

            // set latitude.
            nd.latSpecified = false;
            if (simpleNode.Latitude.HasValue)
            {
                nd.lat = simpleNode.Latitude.Value;
                nd.latSpecified = true;
            }

            // set longitude.
            nd.lonSpecified = false;
            if (simpleNode.Longitude.HasValue)
            {
                nd.lon = simpleNode.Longitude.Value;
                nd.lonSpecified = true;
            }

            // set uid
            nd.uidSpecified = false;
            if (simpleNode.UserId.HasValue)
            {
                nd.uid  = simpleNode.UserId.Value;
                nd.uidSpecified = true;
            }

            // set user
            nd.user = simpleNode.UserName;

            // set tags.
            nd.tag = this.ConvertToXmlTags(simpleNode.Tags);

            // set version.
            if (simpleNode.Version.HasValue)
            {
                nd.version = simpleNode.Version.Value;
                nd.versionSpecified = true;
            }

            // serialize node.
            _serNode.Serialize(_writer, nd);
            _writer.Flush();
            _textWriter.Write(_textWriter.NewLine);
        }