private static void PerformTest(IPointShapeFactory factory)
        {
            var gpw = new GraphicsPathWriter(new IdentityPointTransformation(), factory);
            var res = gpw.ToShape(_multiPoint);

            var b = new Bitmap(100, 100);

            using (var g = Graphics.FromImage(b))
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.Clear(Color.White);
                g.FillPath(new SolidBrush(Color.FromArgb(180, Color.Red)), res);
                g.DrawPath(Pens.Red, res);
            }
            b.Save(string.Format("MultiPoint-{0}.png", factory), ImageFormat.Png);
        }
Esempio n. 2
0
        private static void PerformTest(IPointShapeFactory factory)
        {
            var gpw = new GraphicsPathWriter(new IdentityPointTransformation(), factory);
            var res = gpw.ToShape(_multiPoint);

            var b = new Bitmap(100, 100);
            using (var g = Graphics.FromImage(b))
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.Clear(Color.White);
                g.FillPath(new SolidBrush(Color.FromArgb(180, Color.Red)), res);
                g.DrawPath(Pens.Red, res);
            }
            b.Save(string.Format("MultiPoint-{0}.png", factory), ImageFormat.Png);
            

        }
Esempio n. 3
0
        public void TestPolygonWithHoles()
        {
            const string wkt = "POLYGON((2 2, 2 98, 98 98, 98 2, 2 2), (5 90, 10 90, 10 95, 5 95, 5 90))";
            var geom = new WKTReader().Read(wkt);

            var gpw = new GraphicsPathWriter();
            var res = gpw.ToShape(geom);

            var b = new Bitmap(100, 100);
            using (var g = Graphics.FromImage(b))
            {
                //g.Transform = new Matrix(1f, 0f, -0f, -1f, 0f, 100f);
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.Clear(Color.White);
                g.FillPath(new SolidBrush(Color.FromArgb(180, Color.Red)), res);
                g.DrawPath(Pens.Red, res);
            }
            b.Save("PolygonWithHoles.png", ImageFormat.Png);

            var reverse = GraphicsPathReader.Read(res, 0d, GeometryFactory.Default);
            //Assert.AreEqual(geom, reverse);
        }
        public void TestPolygonWithHoles()
        {
            const string wkt  = "POLYGON((2 2, 2 98, 98 98, 98 2, 2 2), (5 90, 10 90, 10 95, 5 95, 5 90))";
            var          geom = new WKTReader().Read(wkt);

            var gpw = new GraphicsPathWriter();
            var res = gpw.ToShape(geom);

            var b = new Bitmap(100, 100);

            using (var g = Graphics.FromImage(b))
            {
                //g.Transform = new Matrix(1f, 0f, -0f, -1f, 0f, 100f);
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.Clear(Color.White);
                g.FillPath(new SolidBrush(Color.FromArgb(180, Color.Red)), res);
                g.DrawPath(Pens.Red, res);
            }
            b.Save("PolygonWithHoles.png", ImageFormat.Png);

            var reverse = GraphicsPathReader.Read(res, 0d, GeometryFactory.Default);
            //Assert.AreEqual(geom, reverse);
        }