plane.getPlaneElement().add(shape);
if(flowElement instanceof BoundaryEvent) {
BPMNEdge edge = factory.createBPMNEdge();
edge.setBpmnElement(flowElement);
List<Point> dockers = _dockers.get(flowElement.getId());
DcFactory dcFactory = DcFactory.eINSTANCE;
Point addedDocker = dcFactory.createPoint();
for (int i = 0; i < dockers.size(); i++) {
edge.getWaypoint().add(dockers.get(i));
if(i == 0) {
addedDocker.setX(dockers.get(i).getX());
addedDocker.setY(dockers.get(i).getY());
}
}
if(dockers.size() == 1) {
edge.getWaypoint().add(addedDocker);
}
plane.getPlaneElement().add(edge);
}
}
// check if its a subprocess
if(flowElement instanceof SubProcess) {
createSubProcessDiagram(plane, flowElement, factory);
}
} else if(flowElement instanceof DataObject) {
Bounds b = _bounds.get(flowElement.getId());
if (b != null) {
BPMNShape shape = factory.createBPMNShape();
shape.setBpmnElement(flowElement);
shape.setBounds(b);
plane.getPlaneElement().add(shape);
}
}
else if (flowElement instanceof SequenceFlow) {
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
BPMNEdge edge = factory.createBPMNEdge();
edge.setBpmnElement(flowElement);
DcFactory dcFactory = DcFactory.eINSTANCE;
Point point = dcFactory.createPoint();
if(sequenceFlow.getSourceRef() != null) {
Bounds sourceBounds = _bounds.get(sequenceFlow.getSourceRef().getId());
point.setX(sourceBounds.getX() + (sourceBounds.getWidth()/2));
point.setY(sourceBounds.getY() + (sourceBounds.getHeight()/2));
}
edge.getWaypoint().add(point);
List<Point> dockers = _dockers.get(sequenceFlow.getId());
for (int i = 1; i < dockers.size() - 1; i++) {
edge.getWaypoint().add(dockers.get(i));
}
point = dcFactory.createPoint();
if(sequenceFlow.getTargetRef() != null) {
Bounds targetBounds = _bounds.get(sequenceFlow.getTargetRef().getId());
point.setX(targetBounds.getX() + (targetBounds.getWidth()/2));
point.setY(targetBounds.getY() + (targetBounds.getHeight()/2));
}
edge.getWaypoint().add(point);
plane.getPlaneElement().add(edge);
}
}
// artifacts
if (process.getArtifacts() != null){
for (Artifact artifact : process.getArtifacts()) {
if (artifact instanceof TextAnnotation || artifact instanceof Group) {
Bounds b = _bounds.get(artifact.getId());
if (b != null) {
BPMNShape shape = factory.createBPMNShape();
shape.setBpmnElement(artifact);
shape.setBounds(b);
plane.getPlaneElement().add(shape);
}
}
if (artifact instanceof Association){
Association association = (Association)artifact;
BPMNEdge edge = factory.createBPMNEdge();
edge.setBpmnElement(association);
DcFactory dcFactory = DcFactory.eINSTANCE;
Point point = dcFactory.createPoint();
Bounds sourceBounds = _bounds.get(association.getSourceRef().getId());
point.setX(sourceBounds.getX() + (sourceBounds.getWidth()/2));
point.setY(sourceBounds.getY() + (sourceBounds.getHeight()/2));
edge.getWaypoint().add(point);
List<Point> dockers = _dockers.get(association.getId());
for (int i = 1; i < dockers.size() - 1; i++) {
edge.getWaypoint().add(dockers.get(i));
}
point = dcFactory.createPoint();
Bounds targetBounds = _bounds.get(association.getTargetRef().getId());
point.setX(targetBounds.getX()); // TODO check
point.setY(targetBounds.getY() + (targetBounds.getHeight()/2));
edge.getWaypoint().add(point);
plane.getPlaneElement().add(edge);