private static void DoTest(Type expectedType)
        {
            string name = expectedType.Name;
            string file = String.Format("{0}s", name.ToLowerInvariant().Substring(1));
            string resname = String.Format("NetTopologySuite.Tests.NUnit.TestData.{0}.xml", file);
            string path = EmbeddedResourceManager.SaveEmbeddedResourceToTempFile(resname);

            var doc = 
#if !PCL
                new XmlDocument();
            doc.Load(path);
#else
            XDocument.Load(path);
#endif

            GMLReader gr = new GMLReader();
            IGeometryCollection gc = (IGeometryCollection) gr.Read(doc);
            Assert.IsTrue(gc.NumGeometries == 25);
            for (int i = 0; i < 25; i++)
            {
                IGeometry g = gc.GetGeometryN(i);
                Assert.IsNotNull(g);
                Assert.IsInstanceOf(expectedType, g);
            }
        }
 public void gml_reader_can_read_gml_fragment()
 {   
     GMLReader reader = new GMLReader();
     string testFragment = GenerateTestFragment();
     IGeometry actual = reader.Read(testFragment);
     Assert.That(actual, Is.Not.Null);
     Point geom = new Point(52, -0.9);
     Assert.That(actual.EqualsExact(geom), Is.True);
 }
示例#3
0
        public void TestPointWithBlankAfterCoordinates()
        {
            const string gml = "<gml:Point srsName=\"SDO:8265\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:coordinates decimal=\".\" cs=\",\" ts=\" \">-89.5589359049658,44.535657997424 </gml:coordinates></gml:Point>";
            var reader = new GMLReader();
            var geom = reader.Read(gml);

            Assert.IsNotNull(geom);
            Assert.IsInstanceOf<IPoint>(geom);
        }
        public void gml_writer_generates_fragment_with_namespace_if_needed()
        {            
            XmlDocument doc = new XmlDocument();
            Point geom = new Point(52, -0.9);
            doc.Load(geom.ToGMLFeature());

            string content = doc.OuterXml;
            Assert.That(content, Is.Not.Null);
            Assert.That(content.StartsWith("<gml:Point xmlns:gml=\"http://www.opengis.net/gml\""), Is.True);

            GMLReader reader = new GMLReader();
            IGeometry actual = reader.Read(content);
            Assert.That(actual, Is.Not.Null);
            Assert.That(actual.EqualsExact(geom), Is.True);
        }
示例#5
-1
 public void gml_reader_can_read_ToGMLFeature()
 {
     GMLReader reader = new GMLReader();
     Point geom = new Point(52, -0.9);
     IGeometry actual = reader.Read(geom.ToGMLFeature());
     Assert.That(actual, Is.Not.Null);
     Assert.That(actual.EqualsExact(geom), Is.True);
 }