Community
Participate
Working Groups
When I drag a Task with x=10,y=10 to the upper corner the designer makes a new gap between the edge of the pain and the task (50pix) but in the BPMN File the value of y is now 0.! So when I now export a Diagram. The x,y Values in BPMN file are not equal to the x,y Coordinates in the Diagram. This is related to bug 423326. According to the BPMN2 spec, coordinates must be non-negative. This is why, if you move a shape into negative coordinate territory, the editor normalizes everything back to zero. This is done during file saving in Bpmn2ModelerResourceImpl$Bpmn2ModelerXMLSave#saveElement(o,f). Solution: do a negative coordinate check just before the image is saved and offset the image exporter by the min X/Y values if negative (a pretty good idea, but I'm not sure of the amount of work involved)
I'm afraid the best I can do right now is to add a comment at the beginning of the file when it is saved, something like this: <?xml version="1.0" encoding="UTF-8"?> <!-- origin at x=-50 y=0 --> <bpmn2:definitions .../> You can then grab this comment string in Java code after the document is loaded, like this: import org.eclipse.bpmn2.DocumentRoot; import org.eclipse.bpmn2.Bpmn2Resource; import org.eclipse.emf.ecore.util.FeatureMap; ... Bpmn2Resource resource = getResource(); /* get the EMF Resource from somewhere */ DocumentRoot documentRoot = resource.getContents().get(0); FeatureMap featureMap = documentRoot.getMixed(); if (featureMap.size()>0) { FeatureMap.Entry e = featureMap.get(0); if (e.getEStructuralFeature() == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT) { String comment = e.getValue(); // parse the comment string here... } } Will that work for you?