/// <summary> /// Instantiates a PathElement based on the PathFigureType /// </summary> /// <param name="figureType">PathFigureType</param> /// <param name="match">Match object</param> /// <param name="index">Index of the match</param> /// <returns>ICanvasPathElement</returns> internal static ICanvasPathElement CreatePathFigure(PathFigureType figureType, Match match, int index) { var element = CreatePathElement(figureType); element?.Initialize(match, index); return(element); }
/// <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> /// Instantiates a PathElement based on the PathFigureType /// </summary> /// <param name="figureType">PathFigureType</param> /// <param name="capture">Capture object</param> /// <param name="index">Index of the capture</param> /// <param name="isRelative">Indicates whether the coordinates are absolute or relative</param> /// <returns>ICanvasPathElement</returns> internal static ICanvasPathElement CreateAdditionalPathFigure(PathFigureType figureType, Capture capture, int index, bool isRelative) { var element = CreatePathElement(figureType); element?.InitializeAdditional(capture, index, isRelative); return(element); }
/// <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); }
/// <summary> /// Get the Regex for extracting attributes of the given PathFigureType /// </summary> /// <param name="figureType">PathFigureType</param> /// <returns>Regex</returns> internal static Regex GetAttributesRegex(PathFigureType figureType) { return(PathFigureAttributeRegexes[figureType]); }
/// <summary> /// Get the Regex for the given PathFigureType /// </summary> /// <param name="figureType">PathFigureType</param> /// <returns>Regex</returns> internal static Regex GetRegex(PathFigureType figureType) { return(PathFigureRegexes[figureType]); }
/// <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) { if (figureType == PathFigureType.FillRule) { return(new FillRuleElement()); }