コード例 #1
0
        private static void ReadAndTest(string file)
        {
            Console.WriteLine(file);
            string gml;

            using (var fl = EmbeddedResourceManager.GetResourceStream("NetTopologySuite.Samples.Tests.Various." + file))
            {
                gml = new StreamReader(fl).ReadToEnd();
            }

            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(gml);
            string gmlNode = xmlDoc.DocumentElement.FirstChild.NextSibling.FirstChild.LastChild.InnerXml;

            Console.WriteLine(gmlNode);

            var gmlReader = new NetTopologySuite.IO.GML2.GMLReader();
            var geom      = gmlReader.Read(gmlNode);

            Assert.IsNotNull(geom);
            Assert.IsFalse(geom.IsEmpty);

            Console.WriteLine(geom.ToString());
            Console.WriteLine(new string('=', 60));
        }
コード例 #2
0
        private static void ReadAndTest(string file)
        {
            Console.WriteLine(file);
            var path = EmbeddedResourceManager.SaveEmbeddedResourceToTempFile("NetTopologySuite.Samples.Tests.Various." + file);
            var gml = File.ReadAllText(path);

            var xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(gml);
            var gmlNode = xmlDoc.DocumentElement.FirstChild.NextSibling.FirstChild.LastChild.InnerXml;
            Console.WriteLine(gmlNode);

            var gmlReader = new NetTopologySuite.IO.GML2.GMLReader();
            var geom = gmlReader.Read(gmlNode);

            Assert.IsNotNull(geom);
            Assert.IsFalse(geom.IsEmpty);

            Console.WriteLine(geom.ToString());
            Console.WriteLine(new string('=', 60));

            EmbeddedResourceManager.CleanUpTempFile(path);
        }
コード例 #3
0
        private static void ReadAndTest(string file)
        {
            Console.WriteLine(file);
            var path = EmbeddedResourceManager.SaveEmbeddedResourceToTempFile("NetTopologySuite.Samples.Tests.Various." + file);
            var gml  = File.ReadAllText(path);

            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(gml);
            var gmlNode = xmlDoc.DocumentElement.FirstChild.NextSibling.FirstChild.LastChild.InnerXml;

            Console.WriteLine(gmlNode);

            var gmlReader = new NetTopologySuite.IO.GML2.GMLReader();
            var geom      = gmlReader.Read(gmlNode);

            Assert.IsNotNull(geom);
            Assert.IsFalse(geom.IsEmpty);

            Console.WriteLine(geom.ToString());
            Console.WriteLine(new string('=', 60));

            EmbeddedResourceManager.CleanUpTempFile(path);
        }