private void CreateSystemElements(IVPage p, SPES_DocumentReferencer pReferencer) { //CellsSRC(1,11,4) gibt an, wo der Text positioniert werden soll //setCenter (double x, double y) positioniert das ausgewaehlte Shape an die gewuenschte Stelle, angegebene Werte //sind in Zoll , um von cm auf Zoll zu kommen, muss durch 2.54 dividiert werden. IVShape header, systemName, rvp, fvp, lvp, tvp, statusRvp, statusFvp, statusLvp, statusTvp; IVHyperlink rvphl, fvphl, lvphl, tvphl; header = p.DrawRectangle(1, 1, 8, 1.5); header.LineStyle = "none"; header.Text = "Artifacts of " + p.Name; header.SetCenter(4, (28 / 2.54)); header.CellsSRC(3, 0, 7).FormulaU = "24 pt"; header.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; systemName = p.DrawRectangle(1, 1, 8, 4); systemName.Text = p.Name; systemName.SetCenter(4, (23.2 / 2.54)); systemName.CellsSRC(1, 11, 4).Formula = "0"; systemName.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; rvp = p.DrawRectangle(1, 1, 2.5, 3); rvp.Text = "Requirements Engineering Viewpoint"; rvp.SetCenter(4.2 / 2.54, (22.8 / 2.54)); rvp.CellsSRC(1, 11, 4).Formula = "0"; rvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusRvp = p.DrawOval(1, 1, 1.16, 1.16); statusRvp.SetCenter(4.2 / 2.54, 21.3 / 2.54); statusRvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; fvp = p.DrawRectangle(1, 1, 2.5, 3); fvp.Text = "Functional Viewpoint"; fvp.SetCenter(8.2 / 2.54, (22.8 / 2.54)); fvp.CellsSRC(1, 11, 4).Formula = "0"; fvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusFvp = p.DrawOval(1, 1, 1.16, 1.16); statusFvp.SetCenter(8.2 / 2.54, 21.3 / 2.54); statusFvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; lvp = p.DrawRectangle(1, 1, 2.5, 3); lvp.Text = "Logical Viewpoint"; lvp.SetCenter(12.2 / 2.54, (22.8 / 2.54)); lvp.CellsSRC(1, 11, 4).Formula = "0"; lvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusLvp = p.DrawOval(1, 1, 1.16, 1.16); statusLvp.SetCenter(12.2 / 2.54, 21.3 / 2.54); statusLvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; tvp = p.DrawRectangle(1, 1, 2.5, 3); tvp.Text = "Technical Viewpoint"; tvp.SetCenter(16.2 / 2.54, (22.8 / 2.54)); tvp.CellsSRC(1, 11, 4).Formula = "0"; tvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusTvp = p.DrawOval(1, 1, 1.16, 1.16); statusTvp.SetCenter(16.2 / 2.54, 21.3 / 2.54); statusTvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; //System.Windows.Forms.MessageBox.Show(("Create Documents?")); CreateViewPointDocs(p.Name, this._application.ActiveDocument.Path, pReferencer); rvphl = rvp.AddHyperlink(); rvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_RVP.vsdx")); fvphl = fvp.AddHyperlink(); fvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_FVP.vsdx")); lvphl = lvp.AddHyperlink(); lvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_LVP.vsdx")); tvphl = tvp.AddHyperlink(); tvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_TVP.vsdx")); }
private void CreateSubSystemElements(IVPage p, IntPtr appkey, SPES_DocumentReferencer pReferencer) { using (Application app = new Application()) { Application subapplic = this._application; IntPtr helpappkey = new IntPtr(0); Application applic = null;; foreach (var window in OpenWindowGetter.GetOpenWindows()) { if (window.Value.Contains("Visio Professional")) { OpenWindowGetter.SetForegroundWindow(window.Key); applic = NetOffice.VisioApi.Application.GetActiveInstance(); if (app == applic) { helpappkey = window.Key; } ; } ; } OpenWindowGetter.SetForegroundWindow(helpappkey); CreateemptyModels(app, this._application.ActiveDocument.Path, p.Name, pReferencer); IVShape header, systemName, rvp, fvp, lvp, tvp, statusRvp, statusFvp, statusLvp, statusTvp; IVHyperlink rvphl, fvphl, lvphl, tvphl; header = p.DrawRectangle(1, 1, 8, 1.5); header.LineStyle = "none"; header.Text = "Artifacts of " + p.Name; header.SetCenter(4, (28 / 2.54)); header.CellsSRC(3, 0, 7).FormulaU = "24 pt"; header.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; systemName = p.DrawRectangle(1, 1, 8, 4); systemName.Text = p.Name; systemName.SetCenter(4, (23.2 / 2.54)); systemName.CellsSRC(1, 11, 4).Formula = "0"; systemName.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; rvp = p.DrawRectangle(1, 1, 2.5, 3); rvp.Text = "Requirements Engineering Viewpoint"; rvp.SetCenter(4.2 / 2.54, (22.8 / 2.54)); rvp.CellsSRC(1, 11, 4).Formula = "0"; rvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusRvp = p.DrawOval(1, 1, 1.16, 1.16); statusRvp.SetCenter(4.2 / 2.54, 23.5 / 2.54); statusRvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; fvp = p.DrawRectangle(1, 1, 2.5, 3); fvp.Text = "Functional Viewpoint"; fvp.SetCenter(8.2 / 2.54, (22.8 / 2.54)); fvp.CellsSRC(1, 11, 4).Formula = "0"; fvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusFvp = p.DrawOval(1, 1, 1.16, 1.16); statusFvp.SetCenter(8.2 / 2.54, 23.5 / 2.54); statusFvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; lvp = p.DrawRectangle(1, 1, 2.5, 3); lvp.Text = "Logical Viewpoint"; lvp.SetCenter(12.2 / 2.54, (22.8 / 2.54)); lvp.CellsSRC(1, 11, 4).Formula = "0"; lvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusLvp = p.DrawOval(1, 1, 1.16, 1.16); statusLvp.SetCenter(12.2 / 2.54, 23.5 / 2.54); statusLvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; tvp = p.DrawRectangle(1, 1, 2.5, 3); tvp.Text = "Technical Viewpoint"; tvp.SetCenter(16.2 / 2.54, (22.8 / 2.54)); tvp.CellsSRC(1, 11, 4).Formula = "0"; tvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusTvp = p.DrawOval(1, 1, 1.16, 1.16); statusTvp.SetCenter(16.2 / 2.54, 23.5 / 2.54); statusTvp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; var doc = app.Documents.Add(""); CreateRvp(p.Name, doc); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_RVP.vsdx")); doc.Close(); rvphl = rvp.AddHyperlink(); rvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_RVP.vsdx")); doc = app.Documents.Add(""); CreateFvp(p.Name, doc); //todo: load shapes -> load modules //app.Documents.OpenEx("SMT_FN_Funktionsnetz.vssx", 4); //app.Documents.OpenEx("SMT_IA.vssx", 4); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_FVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemName.Text + "_FVP.vsdx", typeof(FunktionsnetzNetwork).Name); fvphl = fvp.AddHyperlink(); fvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_FVP.vsdx")); doc = app.Documents.Add(""); CreateLvp(p.Name, doc); //app.Documents.OpenEx("SMT_Class.vssx", 4); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_LVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemName.Text + "_LVP.vsdx", typeof(LogicalViewpointNetwork).Name); lvphl = lvp.AddHyperlink(); lvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_LVP.vsdx")); doc = app.Documents.Add(""); CreateTvp(p.Name, doc); //app.Documents.OpenEx("SMT_SM.vssx", 4); //app.Documents.OpenEx("SMT_IA.vssx", 4); doc.SaveAs(System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_TVP.vsdx")); doc.Close(); pReferencer.AddAssignment(systemName.Text + "_TVP.vsdx", typeof(TechnicalViewpointNetwork).Name); tvphl = tvp.AddHyperlink(); tvphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemName.Text + "_TVP.vsdx")); app.Quit(); OpenWindowGetter.SetForegroundWindow(appkey); } }
private void CreateRvp(string systemname, IVDocument doc) { //TODO neu erstellte Diagramme mit Shapesheet oeffnen IVPage page = new IVPage(); IVShape header, kontext, neutral, bezogen; IVShape wissenskontext, funktKontext, struktKontext; IVShape goals, useMap, szenario; IVShape struktPerspektive, funktPerspektive, verhaltensPerspektive; IVHyperlink wkhl, skhl, fkhl, ghl, uchl, mschl, sphl, fphl, vphl; IVShape statusWk, statusfK, statussK, statusG, statusUcm, statusSz, statussP, statusfP, statusVp; foreach (Page p in doc.Pages) { page = p; } page.Name = "RVP_" + systemname; IVShape boundary = page.DrawRectangle(0, 12, 9, 1); boundary.CellsSRC(1, 3, 1).FormulaU = "THEMEGUARD(RGB(0,0,0))"; header = page.DrawRectangle(1, 1, 8, 1.5); header.Text = "Requirements Viewpoint: " + systemname; header.SetCenter(4, (28 / 2.54)); header.CellsSRC(1, 11, 4).Formula = "0"; header.LineStyle = "none"; header.CellsSRC(3, 0, 7).FormulaU = "24 pt"; header.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; //Kontextmodelle kontext = page.DrawRectangle(1, 1, 3, 1.5); kontext.Text = "Context Models"; kontext.SetCenter((3 / 2.54), (25 / 2.54)); kontext.CellsSRC(1, 11, 4).Formula = "0"; kontext.LineStyle = "none"; kontext.CellsSRC(3, 0, 7).FormulaU = "18 pt"; kontext.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; wissenskontext = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); wissenskontext.Text = "Context of Knowledge"; wissenskontext.SetCenter((3 / 2.54), (22 / 2.54)); wissenskontext.CellsSRC(1, 11, 4).Formula = "0"; wissenskontext.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusWk = page.DrawOval(1, 1, 1.16, 1.16); statusWk.SetCenter(3 / 2.54, 20.5 / 2.54); statusWk.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; struktKontext = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); struktKontext.Text = "Structural operational Context"; struktKontext.SetCenter((8 / 2.54), (22 / 2.54)); struktKontext.CellsSRC(1, 11, 4).Formula = "0"; struktKontext.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statussK = page.DrawOval(1, 1, 1.16, 1.16); statussK.SetCenter(8 / 2.54, 20.5 / 2.54); statussK.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; funktKontext = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); funktKontext.Text = "Functional operational Context"; funktKontext.SetCenter((13 / 2.54), (22 / 2.54)); funktKontext.CellsSRC(1, 11, 4).Formula = "0"; funktKontext.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusfK = page.DrawOval(1, 1, 1.16, 1.16); statusfK.SetCenter(13 / 2.54, 20.5 / 2.54); statusfK.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; //Loesungsneutrale Modelle neutral = page.DrawRectangle(1, 1, 4, 1.5); neutral.Text = "Solution-unaware Models"; neutral.SetCenter((4 / 2.54), (18 / 2.54)); neutral.CellsSRC(1, 11, 4).Formula = "0"; neutral.LineStyle = "none"; neutral.CellsSRC(3, 0, 7).FormulaU = "18 pt"; neutral.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; goals = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); goals.Text = "Goals"; goals.SetCenter((3 / 2.54), (15 / 2.54)); goals.CellsSRC(1, 11, 4).Formula = "0"; goals.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusG = page.DrawOval(1, 1, 1.16, 1.16); statusG.SetCenter(3 / 2.54, 13.5 / 2.54); statusG.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; useMap = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); useMap.Text = "Use-Case Maps"; useMap.SetCenter((8 / 2.54), (15 / 2.54)); useMap.CellsSRC(1, 11, 4).Formula = "0"; useMap.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusUcm = page.DrawOval(1, 1, 1.16, 1.16); statusUcm.SetCenter(8 / 2.54, 13.5 / 2.54); statusUcm.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; szenario = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); szenario.Text = "Scenarios"; szenario.SetCenter((13 / 2.54), (15 / 2.54)); szenario.CellsSRC(1, 11, 4).Formula = "0"; szenario.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusSz = page.DrawOval(1, 1, 1.16, 1.16); statusSz.SetCenter(13 / 2.54, 13.5 / 2.54); statusSz.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; //Loesungsbezogene Modelle bezogen = page.DrawRectangle(1, 1, 4, 1.5); bezogen.Text = "Solution-oriented Models"; bezogen.SetCenter((4 / 2.54), (11 / 2.54)); bezogen.CellsSRC(1, 11, 4).Formula = "0"; bezogen.LineStyle = "none"; bezogen.CellsSRC(3, 0, 7).FormulaU = "18 pt"; bezogen.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; struktPerspektive = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); struktPerspektive.Text = "Structural Perspective"; struktPerspektive.SetCenter((3 / 2.54), (8 / 2.54)); struktPerspektive.CellsSRC(1, 11, 4).Formula = "0"; struktPerspektive.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statussP = page.DrawOval(1, 1, 1.16, 1.16); statussP.SetCenter(3 / 2.54, 6.5 / 2.54); statussP.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; funktPerspektive = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); funktPerspektive.Text = "Function Perspective"; funktPerspektive.SetCenter((8 / 2.54), (8 / 2.54)); funktPerspektive.CellsSRC(1, 11, 4).Formula = "0"; funktPerspektive.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusfP = page.DrawOval(1, 1, 1.16, 1.16); statusfP.SetCenter(8 / 2.54, 6.5 / 2.54); statusfP.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; verhaltensPerspektive = page.DrawRectangle(2.5, 2.5, 4.2, 4.2); verhaltensPerspektive.Text = "Behavioral Perspective"; verhaltensPerspektive.SetCenter((13 / 2.54), (8 / 2.54)); verhaltensPerspektive.CellsSRC(1, 11, 4).Formula = "0"; verhaltensPerspektive.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,255,255))"; statusVp = page.DrawOval(1, 1, 1.16, 1.16); statusVp.SetCenter(13 / 2.54, 6.5 / 2.54); statusVp.CellsSRC(1, 3, 0).FormulaU = "THEMEGUARD(RGB(255,0,0))"; //Weise erstellte Objekte zu wkhl = wissenskontext.AddHyperlink(); wkhl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_CoK.vsdx")); skhl = struktKontext.AddHyperlink(); skhl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_soC.vsdx")); fkhl = funktKontext.AddHyperlink(); fkhl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_foC.vsdx")); ghl = goals.AddHyperlink(); ghl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_Goals.vsdx")); uchl = useMap.AddHyperlink(); uchl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_UCM.vsdx")); mschl = szenario.AddHyperlink(); mschl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_MSC.vsdx")); sphl = struktPerspektive.AddHyperlink(); sphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_stP.vsdx")); fphl = funktPerspektive.AddHyperlink(); fphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_fuP.vsdx")); vphl = verhaltensPerspektive.AddHyperlink(); vphl.Address = (System.IO.Path.Combine(this._application.ActiveDocument.Path, systemname + "_RVP_BP.vsdx")); }