Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the OsmXmlReader class that reads data from the specified stream.
        /// </summary>
        /// <param name="stream">The stream with osm xml data.</param>
        /// <param name="settings">The OsmReaderSettings object that determines behaviour of XmlReader.</param>
        public OsmXmlReader(Stream stream, OsmXmlReaderSettings settings)
        {
            _input = stream;

            this.Settings            = settings;
            this.Settings.IsReadOnly = true;
            this.InitializeReader();
        }
 public void Constructor_StreamSettings_SetsSettingsAndMakesItReadOnly()
 {
     OsmXmlReaderSettings settings = new OsmXmlReaderSettings() { ReadMetadata = false };
     using (OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_simple_node), settings)) {
         Assert.Same(settings, target.Settings);
         Assert.True(settings.IsReadOnly);
     }
 }
 public void Constructor_StringSettings_SetsSettingsAndMakesItReadOnly()
 {
     string path = "../../src/Tests.SpatialLite.Osm/Data/Xml/osm-real-file.osm";
     OsmXmlReaderSettings settings = new OsmXmlReaderSettings() { ReadMetadata = false };
     using (OsmXmlReader target = new OsmXmlReader(path, settings)) {
         Assert.Same(settings, target.Settings);
         Assert.True(settings.IsReadOnly);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the OsmXmlReader class that reads data from the specified file.
        /// </summary>
        /// <param name="path">Path to the .osm file.</param>
        /// <param name="settings">The OsmReaderSettings object that determines behaviour of XmlReader.</param>
        public OsmXmlReader(string path, OsmXmlReaderSettings settings)
        {
            _input           = new FileStream(path, FileMode.Open, FileAccess.Read);
            _ownsInputStream = true;

            this.Settings            = settings;
            this.Settings.IsReadOnly = true;
            this.InitializeReader();
        }