示例#1
0
            public static PathDiagram Parse(string[] lines)
            {
                int height = lines.Length;
                int width  = lines[0].Length;

                var result = new PathDiagram(width, height);

                for (int x = 0; x < width; x++)
                {
                    for (int y = 0; y < height; y++)
                    {
                        result[x, y] = DiagramCell.Parse(lines[y][x]);
                    }
                }

                return(result);
            }
示例#2
0
 internal static State <SvgDrawState, XElementBuilder> RenderSvg(IDiagram diagram)
 {
     return(diagram switch
     {
         CircleDiagram x => RenderCircle(x),
         EllipseDiagram x => RenderEllipseDiagram(x),
         CompositeDiagram x => RenderCompositeDiagram(x),
         ViewboxDiagram x => RenderViewboxDiagram(x),
         ScaledDiagram x => RenderScaled(x),
         OffsetDiagram x => RenderOffsetDiagram(x),
         StyleDecorator x => RenderStyleDecorator(x),
         BoundingBoxOverridingDiagram x => RenderSvg(x.Diagram),
         RectangleDiagram x => RenderRectangle(x),
         PolygonDiagram x => RenderPolygon(x),
         DefinedDiagram x => RenderDefined(x),
         WhitelistMask x => RenderWhitelistMask(x),
         RotatedDiagram x => RenderRotated(x),
         PathDiagram x => RenderPathDiagram(x),
         //we should probably gravitate away from this exception in the nearish future.
         _ => throw new DiagramNotRenderableException(diagram)
     });
示例#3
0
 protected override void ResetState()
 {
     diagram = null;
 }
示例#4
0
 protected override void LoadState()
 {
     diagram    = PathDiagram.Parse(FileLines);
     pathString = diagram.GetPathString(out steps);
 }