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); }
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) });
protected override void ResetState() { diagram = null; }
protected override void LoadState() { diagram = PathDiagram.Parse(FileLines); pathString = diagram.GetPathString(out steps); }