示例#1
0
        public IVisio.Shape RenderPie(IVisio.Page page)
        {
            if (this.Angle == 0.0)
            {
                var p1 = this.GetPointAtRadius(this.Center, this.Radius, this.SectorStartAngle);
                return(page.DrawLine(this.Center, p1));
            }
            else if (this.Angle >= 2 * System.Math.PI)
            {
                var A     = this.Center.Add(-this.Radius, -this.Radius);
                var B     = this.Center.Add(this.Radius, this.Radius);
                var rect  = new Drawing.Rectangle(A, B);
                var shape = page.DrawOval(rect);
                return(shape);
            }
            else
            {
                int degree;
                var pie_bez = this.GetShapeBezierForPie(out degree);

                // Render the bezier
                var doubles_array = Drawing.Point.ToDoubles(pie_bez).ToArray();
                var pie_slice     = page.DrawBezier(doubles_array, (short)degree, 0);
                return(pie_slice);
            }
        }
        private static IVisio.Shape draw_leaf(IVisio.Page page, VA.Drawing.Point p0)
        {
            var p1            = p0.Add(1, 1);
            var p2            = p1.Add(1, 0);
            var p3            = p2.Add(1, -1);
            var p4            = p3.Add(-1, -1);
            var p5            = p4.Add(-1, 0);
            var p6            = p5.Add(-1, 1);
            var bezier_points = new[] { p0, p1, p2, p3, p4, p5, p6 };

            var s = page.DrawBezier(bezier_points);

            return(s);
        }
示例#3
0
        public IVisio.Shape RenderDoughnut(IVisio.Page page)
        {
            double total_angle = this.Angle;

            if (total_angle == 0.0)
            {
                var p1    = this.GetPointAtRadius(this.Center, this.SectorStartAngle, this.InnerRadius);
                var p2    = this.GetPointAtRadius(this.Center, this.SectorStartAngle, this.Radius);
                var shape = page.DrawLine(p1, p2);
                return(shape);
            }
            else if (total_angle >= System.Math.PI)
            {
                var outer_radius_point = new Drawing.Point(this.Radius, this.Radius);
                var C          = this.Center - outer_radius_point;
                var D          = this.Center + outer_radius_point;
                var outer_rect = new Drawing.Rectangle(C, D);

                var inner_radius_point = new Drawing.Point(this.InnerRadius, this.InnerRadius);
                var A          = this.Center - inner_radius_point - C;
                var B          = this.Center + inner_radius_point - C;
                var inner_rect = new Drawing.Rectangle(A, B);

                var shape = page.DrawOval(outer_rect);
                shape.DrawOval(inner_rect.Left, inner_rect.Bottom, inner_rect.Right, inner_rect.Top);

                return(shape);
            }
            else
            {
                int degree;
                var thickarc = this.GetShapeBezierForDoughnut(out degree);

                // Render the bezier
                var doubles_array = Drawing.Point.ToDoubles(thickarc).ToArray();
                var pie_slice     = page.DrawBezier(doubles_array, (short)degree, 0);
                return(pie_slice);
            }
        }