예제 #1
0
        public void Parse_Test()
        {
            var encoder = new UTF8Encoding();
            const string data = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\b@\0\0\0\0\0\0@\0\0\0\0\0\0@\0\0\0\0\0\0@\0\0\0\0\0\0@\0\0\0\0\0\0\b@\0\0\0\0\0\0\b@\0\0\0\0\0\0\b@\0\0\0\0\0\0\b@\0\0\0\0\0\0@";

            var bytes = encoder.GetBytes(data);

            var factory = new GeometryFactory();
            var parser = new WkbReader(factory);
            var result = parser.Parse(bytes);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(Polygon));

            var polygon = (Polygon) result;
            Assert.IsNotNull(polygon.Rings.FirstOrDefault());
            Assert.AreEqual(polygon.Rings.FirstOrDefault().Vertices.Count, 5);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="geometryFactory">Geometry Factory</param>
 public WellKnownBinaryConverter(IGeometryFactory geometryFactory)
 {
     this._reader = new WkbReader(geometryFactory);
     this._writer = new WkbWriter();
 }