private void _draw_connectors(RenderContext ctx) { var connector_nodes = this.shapes.Where(s => s is Connector).Cast <Connector>().ToList(); // if no dynamic connectors then do nothing if (connector_nodes.Count < 1) { return; } // Drop the number of connectors needed somewhere on the page var masters = connector_nodes.Select(i => i.Master.VisioMaster).ToArray(); var origin = new Drawing.Point(-2, -2); var points = Enumerable.Range(0, connector_nodes.Count) .Select(i => origin + new Drawing.Point(1.10, 0)) .ToList(); var connector_shapeids = ctx.VisioPage.DropManyU(masters, points); var page_shapes = ctx.VisioPage.Shapes; // Perform the connection for (int i = 0; i < connector_shapeids.Length; i++) { var connector_shapeid = connector_shapeids[i]; var vis_connector = page_shapes.ItemFromID[connector_shapeid]; var dyncon_shape = connector_nodes[i]; var from_shape = ctx.GetShape(dyncon_shape.From.VisioShapeID); var to_shape = ctx.GetShape(dyncon_shape.To.VisioShapeID); VACONNECT.ConnectorHelper.ConnectShapes(from_shape, to_shape, vis_connector); dyncon_shape.VisioShape = vis_connector; dyncon_shape.VisioShapeID = connector_shapeids[i]; } }
private void PerformDrawing(RenderContext ctx) { // Draw shapes var non_connectors = this.shapes.Where(s => !(s is Connector)).ToList(); var non_connector_dropshapes = non_connectors.Where(s => s is Shape).Cast <Shape>().ToList(); var non_connector_nondropshapes = non_connectors.Where(s => !(s is Shape)).ToList(); this.drop_masters(ctx, non_connector_dropshapes); this._draw_non_masters(ctx, non_connector_nondropshapes); // verify that all non-connectors have an associated shape id this.check_valid_shape_ids(); // Draw Connectors this._draw_connectors(ctx); // Make sure we have Visio shape objects for all DOM objects foreach (var shape in this.shapes) { if (shape.VisioShape == null) { shape.VisioShape = ctx.GetShape(shape.VisioShapeID); } } }
private void SetCustomProperties(RenderContext ctx) { var shapes_with_custom_props = this.shapes.Where(s => s.CustomProperties != null); foreach (var shape in shapes_with_custom_props) { var vshape = ctx.GetShape(shape.VisioShapeID); foreach (var kv in shape.CustomProperties) { string cp_name = kv.Key; VACUSTPROP.CustomPropertyCells cp_cells = kv.Value; VACUSTPROP.CustomPropertyHelper.Set(vshape, cp_name, cp_cells); } } }
private void AddHyperlinks(RenderContext ctx) { var shapes_with_hyperlinks = this.shapes.Where(s => s.Hyperlinks != null); foreach (var shape in shapes_with_hyperlinks) { var vshape = ctx.GetShape(shape.VisioShapeID); foreach (var hyperlink in shape.Hyperlinks) { var h = vshape.Hyperlinks.Add(); h.Name = hyperlink.Name; // Name of Hyperlink h.Address = hyperlink.Address; // Address of Hyperlink } } }
private void AddHyperlinks(RenderContext ctx) { var shapes_with_hyperlinks = this.shapes.Where(s => s.Hyperlinks != null); foreach (var shape in shapes_with_hyperlinks) { var vshape = ctx.GetShape(shape.VisioShapeID); foreach (var hyperlink in shape.Hyperlinks) { var h = vshape.Hyperlinks.Add(); h.Name = hyperlink.Name; // Name of Hyperlink h.Description = hyperlink.Description; h.Address = hyperlink.Address; // Address of Hyperlink h.SubAddress = hyperlink.SubAddress; h.ExtraInfo = hyperlink.ExtraInfo; h.Frame = hyperlink.Frame; //h.SortKey = hyperlink.SortKey; //h.NewWindow = hyperlink.NewWindow; //h.IsDefaultLink = hyperlink.Default; //h.Invisible = hyperlink.Invisible; } } }