Пример #1
0
        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);
            }
        }
Пример #2
0
 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);
        }
Пример #4
0
        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
0
        public GMLTesting()
        {
            _point = Factory.CreatePoint(new Coordinate(100, 100));

            Coordinate[] coordinates =
            {
                new Coordinate(10,10),
                new Coordinate(20,20),
                new Coordinate(20,10)
            };
            _line = Factory.CreateLineString(coordinates);

            coordinates = new[]
            {
                new Coordinate(100,100),
                new Coordinate(200,100),
                new Coordinate(200,200),                
                new Coordinate(100,200),
                new Coordinate(100,100)
            };
            Coordinate[] interior1 =
            { 
                new Coordinate(120,120),
                new Coordinate(180,120),
                new Coordinate(180,180),                
                new Coordinate(120,180),
                new Coordinate(120,120)
            };
            ILinearRing linearRing = Factory.CreateLinearRing(coordinates);
            ILinearRing[] holes = { Factory.CreateLinearRing(interior1)};
            _polygon = Factory.CreatePolygon(linearRing, holes);

            coordinates = new[]
            {
                new Coordinate(100,100),
                new Coordinate(200,200),
                new Coordinate(300,300),                
                new Coordinate(400,400),
                new Coordinate(500,500)
            };
            _multiPoint = Factory.CreateMultiPoint(coordinates);

            _writer = new GMLWriter();
            _reader = new GMLReader();
        }
Пример #6
-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);
 }