예제 #1
0
        private static void GeometryGmlWriterTest(Action <GeometryPipeline> pipelineCalls, params string[] expectedXPaths)
        {
            var ms = new MemoryStream();
            var w  = XmlWriter.Create(ms, new XmlWriterSettings {
                Indent = false
            });
            DrawBoth gw = new GmlWriter(w);

            gw.GeometryPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeometry);

            pipelineCalls(gw.GeometryPipeline);
            w.Flush();
            w.Close();

            // use XElement to validate basic XML integrity
            ms.Seek(0, SeekOrigin.Begin);
            XmlNameTable nt = new NameTable();

            nt.Add(GmlConstants.GmlPrefix);
            // XPath or string contains
            var xnm = new XmlNamespaceManager(nt);

            xnm.AddNamespace(GmlConstants.GmlPrefix, GmlConstants.GmlNamespace);

            var xDoc = new XmlDocument(nt);

            xDoc.Load(ms);

            var nav = xDoc.CreateNavigator();

            SpatialTestUtils.VerifyXPaths(nav, xnm, "/node()[@gml:srsName = '" + GmlConstants.SrsPrefix + CoordinateSystem.DefaultGeometry.EpsgId + "']");

            SpatialTestUtils.VerifyXPaths(nav, xnm, expectedXPaths);
        }