Example #1
0
        private void _draw_non_masters(RenderContext ctx, List <BaseShape> non_masters)
        {
            foreach (var shape in non_masters)
            {
                if (shape is Line)
                {
                    var line       = (Line)shape;
                    var line_shape = ctx.VisioPage.DrawLine(line.P0, line.P1);
                    line.VisioShapeID = line_shape.ID16;
                    line.VisioShape   = line_shape;
                }
                else if (shape is Rectangle)
                {
                    var rect       = (Rectangle)shape;
                    var rect_shape = ctx.VisioPage.DrawRectangle(rect.P0.X, rect.P0.Y, rect.P1.X, rect.P1.Y);
                    rect.VisioShapeID = rect_shape.ID16;
                    rect.VisioShape   = rect_shape;
                }
                else if (shape is Oval)
                {
                    var oval       = (Oval)shape;
                    var oval_shape = ctx.VisioPage.DrawOval(oval.P0.X, oval.P0.Y, oval.P1.X, oval.P1.Y);
                    oval.VisioShapeID = oval_shape.ID16;
                    oval.VisioShape   = oval_shape;
                }
                else if (shape is Arc)
                {
                    var ps           = (Arc)shape;
                    var vad_arcslice = new VA.Models.Charting.PieSlice(ps.Center, ps.StartAngle,
                                                                       ps.EndAngle, ps.InnerRadius, ps.OuterRadius);
                    var ps_shape = vad_arcslice.Render(ctx.VisioPage);
                    ps.VisioShapeID = ps_shape.ID16;
                    ps.VisioShape   = ps_shape;
                }
                else if (shape is PieSlice)
                {
                    var ps = (PieSlice)shape;

                    var vad_ps   = new VA.Models.Charting.PieSlice(ps.Center, ps.Start, ps.End, ps.Radius);
                    var ps_shape = vad_ps.Render(ctx.VisioPage);
                    ps.VisioShapeID = ps_shape.ID16;
                    ps.VisioShape   = ps_shape;
                }
                else if (shape is BezierCurve)
                {
                    var bez       = (BezierCurve)shape;
                    var bez_shape = ctx.VisioPage.DrawBezier(bez.ControlPoints);
                    bez.VisioShapeID = bez_shape.ID16;
                    bez.VisioShape   = bez_shape;
                }
                else if (shape is PolyLine)
                {
                    var pl       = (PolyLine)shape;
                    var pl_shape = ctx.VisioPage.DrawPolyline(pl.Points);
                    pl.VisioShapeID = pl_shape.ID16;
                    pl.VisioShape   = pl_shape;
                }
                else if (shape is Connector)
                {
                    // skip these will be specially drawn
                }

                else
                {
                    string msg = string.Format("Internal Error: Unhandled DOM node type: {0}", shape.GetType());
                    throw new AutomationException(msg);
                }
            }
        }