/// <summary> /// Instantiates a PathElement based on the PathFigureType /// </summary> /// <param name="figureType">PathFigureType</param> /// <returns>ICanvasPathElement</returns> private static ICanvasPathElement CreatePathElement(PathFigureType figureType) { ICanvasPathElement result = null; switch (figureType) { case PathFigureType.FillRule: result = new FillRuleElement(); break; case PathFigureType.PathFigure: result = new CanvasPathFigure(); break; case PathFigureType.EllipseFigure: result = new CanvasEllipseFigure(); break; case PathFigureType.PolygonFigure: result = new CanvasPolygonFigure(); break; case PathFigureType.RectangleFigure: result = new CanvasRectangleFigure(); break; case PathFigureType.RoundedRectangleFigure: result = new CanvasRoundRectangleFigure(); break; } return(result); }
/// <summary> /// Creates a default Path Element for the given PathFigureType /// </summary> /// <param name="figureType">PathFigureType</param> /// <returns>ICanvasPathElement</returns> internal static ICanvasPathElement CreateDefaultPathElement(PathFigureType figureType) { ICanvasPathElement result; switch (figureType) { case PathFigureType.FillRule: result = new FillRuleElement(); break; default: throw new ArgumentException("Creation of Only Default FillRuleElement is supported.", nameof(figureType)); } return(result); }