public void RenderDirectedGraphWithCustomProps() { var d = new DG.Drawing(); var n0 = d.AddShape("n0", "Untitled Node", "basflo_u.vss", "Decision"); n0.Size = new VA.Drawing.Size(3, 2); n0.CustomProperties = new Dictionary<string, VACUSTPROP.CustomPropertyCells>(); n0.CustomProperties["p1"] = new VACUSTPROP.CustomPropertyCells("v1"); n0.CustomProperties["p2"] = new VACUSTPROP.CustomPropertyCells("v2"); n0.CustomProperties["p3"] = new VACUSTPROP.CustomPropertyCells("v3"); var options = new DG.MsaglLayoutOptions(); options.UseDynamicConnectors = true; var visapp = this.GetVisioApplication(); var doc = this.GetNewDoc(); var page1 = visapp.ActivePage; d.Render(page1, options); Assert.IsNotNull(n0.VisioShape); var props_dic = VACUSTPROP.CustomPropertyHelper.Get(n0.VisioShape); Assert.IsTrue(props_dic.Count>=3); Assert.AreEqual("\"v1\"",props_dic["p1"].Value.Formula); Assert.AreEqual("\"v2\"", props_dic["p2"].Value.Formula); Assert.AreEqual("\"v3\"", props_dic["p3"].Value.Formula); page1.Application.ActiveWindow.ViewFit = (short) IVisio.VisWindowFit.visFitPage; string output_filename = TestGlobals.TestHelper.GetTestMethodOutputFilename(".vsd"); doc.SaveAs(output_filename); doc.Close(); }
public static void DirectedGraphViaMsagl() { var page1 = SampleEnvironment.Application.ActiveDocument.Pages.Add(); var directed_graph_drawing = DirectGraphLayoutSamples.get_dg_drawing(); var options = new DGMODEL.MsaglLayoutOptions(); options.UseDynamicConnectors = false; directed_graph_drawing.Render(page1, options); }
public void DirectedGraph_WithBezierConnectors() { var directed_graph_drawing = this.create_sample_graph(); var options = new DG.MsaglLayoutOptions(); options.UseDynamicConnectors = false; var visapp = this.GetVisioApplication(); var doc = this.GetNewDoc(); var page = visapp.ActivePage; directed_graph_drawing.Render(page,options); string output_filename = TestGlobals.TestHelper.GetTestMethodOutputFilename(".vsd"); doc.SaveAs(output_filename); doc.Close(); }
public static void Render(IVisio.Page page, Drawing drawing, MsaglLayoutOptions options) { if (page == null) { throw new ArgumentNullException(nameof(page)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } var renderer = new MsaglRenderer(); renderer.LayoutOptions = options; renderer.Render(drawing, page); page.ResizeToFitContents(renderer.LayoutOptions.ResizeBorderWidth); }
public void DirectedGraph_WithDynamicConnectors() { var directed_graph_drawing = this.create_sample_graph(); var options = new DG.MsaglLayoutOptions(); options.UseDynamicConnectors = true; var visapp = this.GetVisioApplication(); var doc = this.GetNewDoc(); var page1 = visapp.ActivePage; directed_graph_drawing.Render(page1, options); string output_filename = TestGlobals.TestHelper.GetTestMethodOutputFilename(".vsd"); doc.SaveAs(output_filename); doc.Close(); }
public void DirectedGraph(IList <VAGRAPH.Drawing> directedgraphs) { this._client.Application.AssertApplicationAvailable(); this._client.WriteVerbose("Start rendering directed graph"); var app = this._client.Application.Get(); this._client.WriteVerbose("Creating a New Document For the Directed Graphs"); var doc = this._client.Document.New(null); int num_pages_created = 0; var doc_pages = doc.Pages; foreach (int i in Enumerable.Range(0, directedgraphs.Count)) { var dg = directedgraphs[i]; var options = new VAGRAPH.MsaglLayoutOptions(); options.UseDynamicConnectors = false; // if this is the first page to drawe // then reuse the initial empty page in the document // otherwise, create a new page. var page = num_pages_created == 0 ? app.ActivePage : doc_pages.Add(); this._client.WriteVerbose("Rendering page: {0}", i + 1); dg.Render(page, options); this._client.Page.ResizeToFitContents(new Drawing.Size(1.0, 1.0), true); this._client.View.Zoom(Zoom.ToPage); this._client.WriteVerbose("Finished rendering page"); num_pages_created++; } this._client.WriteVerbose("Finished rendering all pages"); this._client.WriteVerbose("Finished rendering directed graph."); }
public void RenderDirectedGraphWithCustomProps() { var d = new DG.Drawing(); var n0 = d.AddShape("n0", "Untitled Node", "basflo_u.vss", "Decision"); n0.Size = new VA.Drawing.Size(3, 2); n0.CustomProperties = new Dictionary <string, VACUSTPROP.CustomPropertyCells>(); n0.CustomProperties["p1"] = new VACUSTPROP.CustomPropertyCells("v1"); n0.CustomProperties["p2"] = new VACUSTPROP.CustomPropertyCells("v2"); n0.CustomProperties["p3"] = new VACUSTPROP.CustomPropertyCells("v3"); var options = new DG.MsaglLayoutOptions(); options.UseDynamicConnectors = true; var visapp = this.GetVisioApplication(); var doc = this.GetNewDoc(); var page1 = visapp.ActivePage; d.Render(page1, options); Assert.IsNotNull(n0.VisioShape); var props_dic = VACUSTPROP.CustomPropertyHelper.Get(n0.VisioShape); Assert.IsTrue(props_dic.Count >= 3); Assert.AreEqual("\"v1\"", props_dic["p1"].Value.Formula); Assert.AreEqual("\"v2\"", props_dic["p2"].Value.Formula); Assert.AreEqual("\"v3\"", props_dic["p3"].Value.Formula); page1.Application.ActiveWindow.ViewFit = (short)IVisio.VisWindowFit.visFitPage; string output_filename = TestGlobals.TestHelper.GetTestMethodOutputFilename(".vsd"); doc.SaveAs(output_filename); doc.Close(); }
public void Render(IVisio.Page page, MsaglLayoutOptions options) { MsaglRenderer.Render(page, this, options); }
public void DirectedGraph(IList<DGMODEL.Drawing> directedgraphs) { this.Client.Application.AssertApplicationAvailable(); this.Client.WriteVerbose("Start rendering directed graph"); var app = this.Client.Application.Get(); this.Client.WriteVerbose("Creating a New Document For the Directed Graphs"); var doc = this.Client.Document.New(null); int num_pages_created = 0; var doc_pages = doc.Pages; foreach (int i in Enumerable.Range(0, directedgraphs.Count)) { var dg = directedgraphs[i]; var options = new DGMODEL.MsaglLayoutOptions(); options.UseDynamicConnectors = false; // if this is the first page to drawe // then reuse the initial empty page in the document // otherwise, create a new page. var page = num_pages_created == 0 ? app.ActivePage : doc_pages.Add(); this.Client.WriteVerbose("Rendering page: {0}", i + 1); dg.Render(page, options); this.Client.Page.ResizeToFitContents(new Drawing.Size(1.0, 1.0), true); this.Client.View.Zoom(Zoom.ToPage); this.Client.WriteVerbose("Finished rendering page"); num_pages_created++; } this.Client.WriteVerbose("Finished rendering all pages"); this.Client.WriteVerbose("Finished rendering directed graph."); }