Ejemplo n.º 1
0
        public void Move_Line_RelativeVerticalLine()
        {
            StreamGeometry geometry = new StreamGeometry();
            MockContext context = new MockContext();
            PathMarkupParser target = new PathMarkupParser(geometry, context);

            target.Parse("M3,4 L5,6 v7");

            Assert.AreEqual("M3,4 L5,6 L5,13 ", context.Trace);
        }
Ejemplo n.º 2
0
        public void Move_Line_HorizontalLine()
        {
            StreamGeometry geometry = new StreamGeometry();
            MockContext context = new MockContext();
            PathMarkupParser target = new PathMarkupParser(geometry, context);

            target.Parse("M3,4 L5,6 H7");

            Assert.AreEqual("M3,4 L5,6 L7,6 ", context.Trace);
        }
Ejemplo n.º 3
0
        public void Move_RelativeLine_RelativeLine()
        {
            StreamGeometry geometry = new StreamGeometry();
            MockContext context = new MockContext();
            PathMarkupParser target = new PathMarkupParser(geometry, context);

            target.Parse("M3,4 l5,6 7,8");

            Assert.AreEqual("M3,4 L8,10 L15,18 ", context.Trace);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a <see cref="StreamGeometry"/> from a string.
        /// </summary>
        /// <param name="s">The string.</param>
        /// <returns>A <see cref="StreamGeometry"/>.</returns>
        public static StreamGeometry Parse(string s)
        {
            StreamGeometry result = new StreamGeometry();

            using (StreamGeometryContext ctx = result.Open())
            {
                PathMarkupParser parser = new PathMarkupParser(ctx);
                parser.Parse(s);
                return result;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a <see cref="StreamGeometry"/> from a string.
        /// </summary>
        /// <param name="s">The string.</param>
        /// <returns>A <see cref="StreamGeometry"/>.</returns>
        public static StreamGeometry Parse(string s)
        {
            StreamGeometry result = new StreamGeometry();

            using (StreamGeometryContext ctx = result.Open())
            {
                PathMarkupParser parser = new PathMarkupParser(ctx);
                parser.Parse(s);
                return(result);
            }
        }
Ejemplo n.º 6
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            StreamGeometry result = new StreamGeometry();

            using (StreamGeometryContext ctx = result.Open())
            {
                PathMarkupParser parser = new PathMarkupParser(result, ctx);
                parser.Parse((string)value);
                return result;
            }
        }
Ejemplo n.º 7
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            StreamGeometry result = new StreamGeometry();

            using (StreamGeometryContext ctx = result.Open())
            {
                PathMarkupParser parser = new PathMarkupParser(result, ctx);
                parser.Parse((string)value);
                return(result);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a <see cref="StreamGeometry"/> from a string.
        /// </summary>
        /// <param name="s">The string.</param>
        /// <returns>A <see cref="StreamGeometry"/>.</returns>
        public static new StreamGeometry Parse(string s)
        {
            var streamGeometry = new StreamGeometry();

            using (var context = streamGeometry.Open())
                using (var parser = new PathMarkupParser(context))
                {
                    parser.Parse(s);
                }

            return(streamGeometry);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Parses the specified path data to a <see cref="PathGeometry"/>.
        /// </summary>
        /// <param name="pathData">The s.</param>
        /// <returns></returns>
        public static new PathGeometry Parse(string pathData)
        {
            var pathGeometry = new PathGeometry();

            using (var context = new PathGeometryContext(pathGeometry))
                using (var parser = new PathMarkupParser(context))
                {
                    parser.Parse(pathData);
                }

            return(pathGeometry);
        }