public virtual IBpmnEdge CreateBpmnEdge(ISequenceFlow sequenceFlow)
        {
            IBpmnPlane bpmnPlane = FindBpmnPlane();

            if (bpmnPlane != null)
            {
                IBpmnEdge edge = CreateInstance <IBpmnEdge>(typeof(IBpmnEdge));
                edge.BpmnElement = sequenceFlow;
                Waypoints        = edge;

                bpmnPlane.AddChildElement(edge);
                return(edge);
            }
            return(null);
        }
        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);
        }
Example #3
0
        public static IProcessBuilder CreateProcess()
        {
            IBpmnModelInstance modelInstance = Instance.DoCreateEmptyModel();
            IDefinitions       definitions   = modelInstance.NewInstance <IDefinitions>(typeof(IDefinitions));

            definitions.TargetNamespace = BpmnModelConstants.Bpmn20Ns;
            definitions.DomElement.RegisterNamespace("camunda", BpmnModelConstants.CamundaNs);
            modelInstance.Definitions = definitions;
            IProcess process = modelInstance.NewInstance <IProcess>(typeof(IProcess));

            definitions.AddChildElement(process);

            IBpmnDiagram bpmnDiagram = modelInstance.NewInstance <IBpmnDiagram>(typeof(IBpmnDiagram));

            IBpmnPlane bpmnPlane = modelInstance.NewInstance <IBpmnPlane>(typeof(IBpmnPlane));

            bpmnPlane.BpmnElement = process;

            bpmnDiagram.AddChildElement(bpmnPlane);
            definitions.AddChildElement(bpmnDiagram);

            return(process.Builder());
        }