protected internal virtual void ResizeSubProcess(IBpmnShape innerShape) { IBaseElement innerElement = innerShape.BpmnElement; IBounds innerShapeBounds = innerShape.Bounds; IModelElementInstance parent = innerElement.ParentElement; while (parent is ISubProcess) { IBpmnShape subProcessShape = FindBpmnShape((ISubProcess)parent); if (subProcessShape != null) { IBounds subProcessBounds = subProcessShape.Bounds; double innerX = innerShapeBounds.GetX().Value; double innerWidth = innerShapeBounds.GetWidth().Value; double innerY = innerShapeBounds.GetY().Value; double innerHeight = innerShapeBounds.GetHeight().Value; double subProcessY = subProcessBounds.GetY().Value; double subProcessHeight = subProcessBounds.GetHeight().Value; double subProcessX = subProcessBounds.GetX().Value; double subProcessWidth = subProcessBounds.GetWidth().Value; double tmpWidth = innerX + innerWidth + Space; double tmpHeight = innerY + innerHeight + Space; if (innerY == subProcessY) { subProcessBounds.SetY(subProcessY - Space); subProcessBounds.SetHeight(subProcessHeight + Space); } if (tmpWidth >= subProcessX + subProcessWidth) { double newWidth = tmpWidth - subProcessX; subProcessBounds.SetWidth(newWidth); } if (tmpHeight >= subProcessY + subProcessHeight) { double newHeight = tmpHeight - subProcessY; subProcessBounds.SetHeight(newHeight); } innerElement = (ISubProcess)parent; innerShapeBounds = subProcessBounds; parent = innerElement.ParentElement; } else { break; } } }
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>()); }