示例#1
0
        public override void Start()
        {
            _xmlreader = _writer.Write(_point);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document.InnerXml);
            _result = _reader.Read(_document);
            Debug.Assert(_point.Equals(_result), "ERROR!");

            //string gml = document.InnerXml;
            //gml = gml.Replace("gml:", "");
            //result = reader.Read(gml);

            _xmlreader = _writer.Write(_line);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document.InnerXml);
            _result = _reader.Read(_document);
            Debug.Assert(_line.Equals(_result), "ERROR!");

            _xmlreader = _writer.Write(_polygon);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document.InnerXml);
            _result = _reader.Read(_document);
            Debug.Assert(_polygon.Equals(_result), "ERROR!");

            _xmlreader = _writer.Write(_multiPoint);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document);
            _result = _reader.Read(_document);
            Debug.Assert(_multiPoint.Equals(_result), "ERROR!");

            var multiLineString = new WKTReader().Read("MULTILINESTRING ((10 10, 20 20), (30 30, 40 40, 50 50, 70 80, 990 210), (2000.1 22, 457891.2334 3456.2, 33333 44444))") as MultiLineString;

            _xmlreader = _writer.Write(multiLineString);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document.InnerXml);
            _result = _reader.Read(_document);
            Debug.Assert(multiLineString.Equals(_result), "ERROR!");

            var multiPolygon = new WKTReader().Read("MULTIPOLYGON (((10 10, 10 20, 20 20, 20 10, 10 10), (12 12, 18 12, 18 18, 12 18, 12 12), (14 14, 16 14, 16 16, 14 16, 14 14)), ((30 30, 30 40, 40 40, 40 30, 30 30), (32 32, 38 32, 38 38, 32 38, 32 32)))") as MultiPolygon;

            _xmlreader = _writer.Write(multiPolygon);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document.InnerXml);
            _result = _reader.Read(_document);
            Debug.Assert(multiPolygon.EqualsExact(_result), "ERROR!");

            Geometry[] geometries         = { _point, _line, _polygon, _multiPoint, multiLineString, multiPolygon };
            var        geometryCollection = Factory.CreateGeometryCollection(geometries);

            _xmlreader = _writer.Write(geometryCollection);
            _document  = new XmlDocument();
            _document.Load(_xmlreader);
            Write(_document.InnerXml);
            _result = _reader.Read(_document);
            Debug.Assert(geometryCollection.EqualsExact(_result), "ERROR!");
        }