Exemplo n.º 1
0
        public IVisio.Shape PieSlice(Drawing.Point center,
                                     double radius,
                                     double start_angle,
                                     double end_angle)
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            var application = this._client.Application.Get();

            using (var undoscope = this._client.Application.NewUndoScope("Draw Pie Slice"))
            {
                var active_page = application.ActivePage;
                var slice       = new Models.Charting.PieSlice(center, radius, start_angle, end_angle);
                var shape       = slice.Render(active_page);
                return(shape);
            }
        }
Exemplo n.º 2
0
        private void _draw_non_masters(RenderContext context, List <BaseShape> non_masters)
        {
            foreach (var shape in non_masters)
            {
                if (shape is Line)
                {
                    var line       = (Line)shape;
                    var line_shape = context.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 = context.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 = context.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 Models.Charting.PieSlice(ps.Center, ps.StartAngle,
                                                                    ps.EndAngle, ps.InnerRadius, ps.OuterRadius);
                    var ps_shape = vad_arcslice.Render(context.VisioPage);
                    ps.VisioShapeID = ps_shape.ID16;
                    ps.VisioShape   = ps_shape;
                }
                else if (shape is PieSlice)
                {
                    var ps = (PieSlice)shape;

                    var vad_ps   = new Models.Charting.PieSlice(ps.Center, ps.Start, ps.End, ps.Radius);
                    var ps_shape = vad_ps.Render(context.VisioPage);
                    ps.VisioShapeID = ps_shape.ID16;
                    ps.VisioShape   = ps_shape;
                }
                else if (shape is BezierCurve)
                {
                    var bez       = (BezierCurve)shape;
                    var bez_shape = context.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 = context.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("Unhandled DOM node type: \"{0}\"", shape.GetType());
                    throw new InternalAssertionException(msg);
                }
            }
        }
        public IVisio.Shape DoughnutSlice(Drawing.Point center,
                          double inner_radius,
                          double outer_radius,
                          double start_angle,
                          double end_angle)
        {
            this.Client.Application.AssertApplicationAvailable();
            this.Client.Document.AssertDocumentAvailable();

            var application = this.Client.Application.Get();
            using (var undoscope = this.Client.Application.NewUndoScope("Draw Pie Slice"))
            {
                var active_page = application.ActivePage;
                var slice = new Models.Charting.PieSlice(center, inner_radius, outer_radius, start_angle, end_angle);
                var shape = slice.Render(active_page);
                return shape;
            }
        }