private void InitGraphDoc() { this.pic = new PictureBox(); base.Controls.Add(this.pic); this.pic.BackColor = Color.White; this.pic.Location = new Point(0, 0); this.pic.Name = "pic"; this.pic.Size = new Size(0x4b0, 0x4b0); this.pic.TabIndex = 0; this.pic.TabStop = false; this.pic.Paint += new PaintEventHandler(this.pic_Paint); this.mGraphDoc = new GraphDoc(this.pic); }
public void Load(SkyMap.Net.Workflow.XPDL.Prodef prodef, Proinst proinst, GraphDoc gDoc, ImageList imgList) { if (prodef == null) { throw new ArgumentNullException("Prodef cannot be null"); } if (proinst == null) { throw new ArgumentNullException("Proinst cannot be null"); } if ((this.mProdef == null) || (prodef.Id != this.mProdef.Id)) { this.Close(); this.mProdef = prodef; this.mProinst = proinst; foreach (Actdef actdef in prodef.Actdefs.Values) { IList<Transition> froms = actdef.Froms; if (froms.Count > 0) { foreach (Transition transition in froms) { if (!this.mWFTRANSITIONs.ContainsKey(transition.Id)) { this.mWFTRANSITIONs.Add(transition.Id, transition); } } } } } if (LoggingService.IsDebugEnabled) { LoggingService.Debug("开始画流程图..."); } this.BuildGraphDoc(gDoc, imgList); if (LoggingService.IsDebugEnabled) { LoggingService.Debug("结束画流程图..."); } }
public void BuildGraphDoc(GraphDoc gDoc, ImageList imgList) { gDoc.ClearAll(); gDoc.BeginUpdate(); GraphUnit selectedUnit = null; int num = 0; foreach (Actdef actdef in this.Prodef.Actdefs.Values) { int xPos; int yPos; try { xPos = actdef.XPos; yPos = actdef.YPos; } catch { xPos = 0; yPos = num; } gDoc.AddNode(xPos, yPos, imgList, (int) actdef.Type, this.GetNodeType(actdef.Type)); gDoc.SelectedUnit.RelationalID = actdef.Id; gDoc.SelectedUnit.Name = actdef.Name; num += 0x20; if (actdef.IsDefaultInit) { selectedUnit = gDoc.SelectedUnit; } } foreach (Transition transition in this.mWFTRANSITIONs.Values) { Pen pen = new Pen(Color.Black, 2f); try { gDoc.AddArrowLine(this.GetNodeByRelationalID(gDoc, transition.From.Id), this.GetNodeByRelationalID(gDoc, transition.To.Id), pen.Color, (int) pen.Width); gDoc.SelectedUnit.RelationalID = transition.Id; gDoc.SelectedUnit.Name = transition.Name; } catch { } } if (selectedUnit != null) { gDoc.SelectedUnit = selectedUnit; } gDoc.EndUpdate(); selectedUnit = null; }
private Node GetNodeByRelationalID(GraphDoc gDoc, string relID) { for (int i = 0; i < gDoc.Nodes.Count; i++) { if (gDoc.Nodes[i].RelationalID == relID) { return gDoc.Nodes[i]; } } return null; }
private void BuildGraphDoc(GraphDoc gDoc, ImageList imgList) { gDoc.ClearAll(); gDoc.BeginUpdate(); GraphUnit selectedUnit = null; int num = 0; foreach (Actdef actdef in this.Prodef.Actdefs.Values) { int xPos; int yPos; try { xPos = actdef.XPos; yPos = actdef.YPos; } catch { xPos = 0; yPos = num; } if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("添加结点:{0}...", new object[] { actdef.Name }); } gDoc.AddNode(xPos, yPos, imgList, (int) actdef.Type, this.GetNodeType(actdef.Type)); gDoc.SelectedUnit.RelationalID = actdef.Id; if (actdef.Type != ActdefType.INTERACTION) { gDoc.SelectedUnit.Name = actdef.Name; } else { gDoc.SelectedUnit.Name = this.GetUnitName(actdef); } num += 0x20; if (actdef.IsDefaultInit) { selectedUnit = gDoc.SelectedUnit; } } foreach (Transition transition in this.mWFTRANSITIONs.Values) { Pen pen = new Pen(Color.Black, 2f); try { gDoc.AddArrowLine(this.GetNodeByRelationalID(gDoc, transition.From.Id), this.GetNodeByRelationalID(gDoc, transition.To.Id), pen.Color, (int) pen.Width); gDoc.SelectedUnit.RelationalID = transition.Id; gDoc.SelectedUnit.Name = transition.Name; } catch { } } if (selectedUnit != null) { gDoc.SelectedUnit = selectedUnit; } gDoc.EndUpdate(); selectedUnit = null; }
private void InitGraphDoc() { this.pic = new PictureBox(); this.pPic.Controls.Add(this.pic); this.pic.BackColor = Color.White; this.pic.Location = new Point(0, 0); this.pic.Name = "pic"; this.pic.Size = new Size(0x4b0, 0x4b0); this.pic.TabIndex = 0; this.pic.TabStop = false; this.pic.Paint += new PaintEventHandler(this.pic_Paint); this.pic.MouseUp += new MouseEventHandler(this.pic_MouseUp); this.pic.MouseMove += new MouseEventHandler(this.pic_MouseMove); this.pic.MouseDown += new MouseEventHandler(this.pic_MouseDown); this.mGraphDoc = new GraphDoc(this.pic); this.mGraphDoc.UnitSelect += new UnitSelectEventHandler(this.mGraphDoc_UnitSelect); this.mGraphDoc.UnitAdd += new UnitAddEventHandler(this.mGraphDoc_UnitAdd); this.mGraphDoc.UnitRemove += new UnitRemoveEventHandler(this.mGraphDoc_UnitRemove); }