public virtual IBpmnShape CreateBpmnShape(IFlowNode node) { IBpmnPlane bpmnPlane = FindBpmnPlane(); if (bpmnPlane != null) { IBpmnShape bpmnShape = CreateInstance <IBpmnShape>(typeof(IBpmnShape)); bpmnShape.BpmnElement = node; IBounds nodeBounds = CreateInstance <IBounds>(typeof(IBounds)); if (node is ISubProcess) { bpmnShape.Expanded = true; nodeBounds.SetWidth(350); nodeBounds.SetHeight(200); } else if (node is IActivity) { nodeBounds.SetWidth(100); nodeBounds.SetHeight(80); } else if (node is IEvent) { nodeBounds.SetWidth(36); nodeBounds.SetHeight(36); } else if (node is IGateway) { nodeBounds.SetWidth(50); nodeBounds.SetHeight(50); } nodeBounds.SetX(0); nodeBounds.SetY(0); bpmnShape.AddChildElement(nodeBounds); bpmnPlane.AddChildElement(bpmnShape); return(bpmnShape); } return(null); }
public virtual StartEventBuilder StartEvent(string id) { IStartEvent start = SubProcessBuilder.CreateChild <IStartEvent>(typeof(IStartEvent), id); IBpmnShape startShape = SubProcessBuilder.CreateBpmnShape(start); IBpmnShape subProcessShape = SubProcessBuilder.FindBpmnShape(SubProcessBuilder.element); if (subProcessShape != null) { IBounds subProcessBounds = subProcessShape.Bounds; IBounds startBounds = startShape.Bounds; double subProcessX = subProcessBounds.GetX().Value; double subProcessY = subProcessBounds.GetY().Value; double subProcessHeight = subProcessBounds.GetHeight().Value; double startHeight = startBounds.GetHeight().Value; startBounds.SetX(subProcessX); startBounds.SetY(subProcessY + subProcessHeight / 2 - startHeight / 2); } return(start.Builder <StartEventBuilder, IStartEvent>()); }