Ejemplo n.º 1
0
        public static void QuickWrite(List <GeneralPolygon2d> polygons1, string color1, float width1,
                                      List <GeneralPolygon2d> polygons2, string color2, float width2,
                                      string sPath)
        {
            SVGWriter writer       = new SVGWriter();
            Style     style1       = SVGWriter.Style.Outline(color1, width1);
            Style     style1_holes = SVGWriter.Style.Outline(color1, width1 / 2);

            foreach (GeneralPolygon2d poly in polygons1)
            {
                writer.AddPolygon(poly.Outer, style1);
                foreach (var hole in poly.Holes)
                {
                    writer.AddPolygon(hole, style1_holes);
                }
            }
            Style style2       = SVGWriter.Style.Outline(color2, width2);
            Style style2_holes = SVGWriter.Style.Outline(color2, width2 / 2);

            foreach (GeneralPolygon2d poly in polygons2)
            {
                writer.AddPolygon(poly.Outer, style2);
                foreach (var hole in poly.Holes)
                {
                    writer.AddPolygon(hole, style2_holes);
                }
            }
            writer.Write(sPath);
        }
Ejemplo n.º 2
0
        public static void QuickWrite(List <GeneralPolygon2d> polygons, string sPath, double line_width = 1)
        {
            var writer    = new SVGWriter();
            var outer_cw  = SVGWriter.Style.Outline("black", 2 * (float)line_width);
            var outer_ccw = SVGWriter.Style.Outline("green", 2 * (float)line_width);
            var inner     = SVGWriter.Style.Outline("red", (float)line_width);

            foreach (GeneralPolygon2d poly in polygons)
            {
                if (poly.Outer.IsClockwise)
                {
                    writer.AddPolygon(poly.Outer, outer_cw);
                }
                else
                {
                    writer.AddPolygon(poly.Outer, outer_ccw);
                }

                foreach (var hole in poly.Holes)
                {
                    writer.AddPolygon(hole, inner);
                }
            }
            writer.Write(sPath);
        }
Ejemplo n.º 3
0
        public static void QuickWrite(DGraph2 graph, string sPath, double line_width = 1)
        {
            SVGWriter writer = new SVGWriter();
            Style     style  = SVGWriter.Style.Outline("black", (float)line_width);

            writer.AddGraph(graph, style);
            writer.Write(sPath);
        }