@Override public String toString() { return super.toString() + ", x=" + getX() + ", y=" + getY() + ", width=" + getWidth() + ", height=" + getHeight(); }
protected DiagramNode transformBoundsForImage(DiagramNode diagramBoundsImage, DiagramNode diagramBoundsXml, DiagramNode elementBounds) { double scalingFactorX = diagramBoundsImage.getWidth() / diagramBoundsXml.getWidth(); double scalingFactorY = diagramBoundsImage.getWidth() / diagramBoundsXml.getWidth(); DiagramNode elementBoundsForImage = new DiagramNode(elementBounds.getId()); elementBoundsForImage.setX((double) Math.round((elementBounds.getX() - diagramBoundsXml.getX()) * scalingFactorX + diagramBoundsImage.getX())); elementBoundsForImage.setY((double) Math.round((elementBounds.getY() - diagramBoundsXml.getY()) * scalingFactorY + diagramBoundsImage.getY())); elementBoundsForImage.setWidth((double) Math.round(elementBounds.getWidth() * scalingFactorX)); elementBoundsForImage.setHeight((double) Math.round(elementBounds.getHeight() * scalingFactorY)); return elementBoundsForImage; }
protected DiagramNode transformBoundsForImage(DiagramNode diagramBoundsImage, DiagramNode diagramBoundsXml, DiagramNode elementBounds) { double scalingFactorX = diagramBoundsImage.getWidth() / diagramBoundsXml.getWidth(); double scalingFactorY = diagramBoundsImage.getWidth() / diagramBoundsXml.getWidth(); DiagramNode elementBoundsForImage = new DiagramNode(elementBounds.getId()); elementBoundsForImage.setX((double) Math.round((elementBounds.getX() - diagramBoundsXml.getX()) * scalingFactorX + diagramBoundsImage.getX())); elementBoundsForImage.setY((double) Math.round((elementBounds.getY() - diagramBoundsXml.getY()) * scalingFactorY + diagramBoundsImage.getY())); elementBoundsForImage.setWidth((double) Math.round(elementBounds.getWidth() * scalingFactorX)); elementBoundsForImage.setHeight((double) Math.round(elementBounds.getHeight() * scalingFactorY)); return elementBoundsForImage; }
protected DiagramNode transformBoundsForImage(DiagramNode diagramBoundsImage, DiagramNode diagramBoundsXml, DiagramNode elementBounds) { double scalingFactorX = diagramBoundsImage.getWidth() / diagramBoundsXml.getWidth(); double scalingFactorY = diagramBoundsImage.getWidth() / diagramBoundsXml.getWidth(); DiagramNode elementBoundsForImage = new DiagramNode(elementBounds.getId()); elementBoundsForImage.setX((double) Math.round((elementBounds.getX() - diagramBoundsXml.getX()) * scalingFactorX + diagramBoundsImage.getX())); elementBoundsForImage.setY((double) Math.round((elementBounds.getY() - diagramBoundsXml.getY()) * scalingFactorY + diagramBoundsImage.getY())); elementBoundsForImage.setWidth((double) Math.round(elementBounds.getWidth() * scalingFactorX)); elementBoundsForImage.setHeight((double) Math.round(elementBounds.getHeight() * scalingFactorY)); return elementBoundsForImage; }
protected Map<String, DiagramNode> fixFlowNodePositionsIfModelFromAdonis(Document bpmnModel, Map<String, DiagramNode> elementBoundsFromBpmnDi) { if (isExportedFromAdonis50(bpmnModel)) { Map<String, DiagramNode> mapOfFixedBounds = new HashMap<String, DiagramNode>(); XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xPath = xPathFactory.newXPath(); xPath.setNamespaceContext(new Bpmn20NamespaceContext()); for (Entry<String, DiagramNode> entry : elementBoundsFromBpmnDi.entrySet()) { String elementId = entry.getKey(); DiagramNode elementBounds = entry.getValue(); String expression = "local-name(//bpmn:*[@id = '" + elementId + "'])"; try { XPathExpression xPathExpression = xPath.compile(expression); String elementLocalName = xPathExpression.evaluate(bpmnModel); if (!"participant".equals(elementLocalName) && !"lane".equals(elementLocalName) && !"textAnnotation".equals(elementLocalName) && !"group".equals(elementLocalName)) { elementBounds.setX(elementBounds.getX() - elementBounds.getWidth() / 2); elementBounds.setY(elementBounds.getY() - elementBounds.getHeight() / 2); } } catch (XPathExpressionException e) { throw new ActivitiException("Error while evaluating the following XPath expression on a BPMN XML document: '" + expression + "'.", e); } mapOfFixedBounds.put(elementId, elementBounds); } return mapOfFixedBounds; } else { return elementBoundsFromBpmnDi; } }
protected Map<String, DiagramNode> fixFlowNodePositionsIfModelFromAdonis(Document bpmnModel, Map<String, DiagramNode> elementBoundsFromBpmnDi) { if (isExportedFromAdonis50(bpmnModel)) { Map<String, DiagramNode> mapOfFixedBounds = new HashMap<>(); XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xPath = xPathFactory.newXPath(); xPath.setNamespaceContext(new Bpmn20NamespaceContext()); for (Entry<String, DiagramNode> entry : elementBoundsFromBpmnDi.entrySet()) { String elementId = entry.getKey(); DiagramNode elementBounds = entry.getValue(); String expression = "local-name(//bpmn:*[@id = '" + elementId + "'])"; try { XPathExpression xPathExpression = xPath.compile(expression); String elementLocalName = xPathExpression.evaluate(bpmnModel); if (!"participant".equals(elementLocalName) && !"lane".equals(elementLocalName) && !"textAnnotation".equals(elementLocalName) && !"group".equals(elementLocalName)) { elementBounds.setX(elementBounds.getX() - elementBounds.getWidth() / 2); elementBounds.setY(elementBounds.getY() - elementBounds.getHeight() / 2); } } catch (XPathExpressionException e) { throw new ActivitiException("Error while evaluating the following XPath expression on a BPMN XML document: '" + expression + "'.", e); } mapOfFixedBounds.put(elementId, elementBounds); } return mapOfFixedBounds; } else { return elementBoundsFromBpmnDi; } }
protected Map<String, DiagramNode> fixFlowNodePositionsIfModelFromAdonis(Document bpmnModel, Map<String, DiagramNode> elementBoundsFromBpmnDi) { if (isExportedFromAdonis50(bpmnModel)) { Map<String, DiagramNode> mapOfFixedBounds = new HashMap<String, DiagramNode>(); XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xPath = xPathFactory.newXPath(); xPath.setNamespaceContext(new Bpmn20NamespaceContext()); for (Entry<String, DiagramNode> entry : elementBoundsFromBpmnDi.entrySet()) { String elementId = entry.getKey(); DiagramNode elementBounds = entry.getValue(); String expression = "local-name(//bpmn:*[@id = '" + elementId + "'])"; try { XPathExpression xPathExpression = xPath.compile(expression); String elementLocalName = xPathExpression.evaluate(bpmnModel); if (!"participant".equals(elementLocalName) && !"lane".equals(elementLocalName) && !"textAnnotation".equals(elementLocalName) && !"group".equals(elementLocalName)) { elementBounds.setX(elementBounds.getX() - elementBounds.getWidth()/2); elementBounds.setY(elementBounds.getY() - elementBounds.getHeight()/2); } } catch (XPathExpressionException e) { throw new ActivitiException("Error while evaluating the following XPath expression on a BPMN XML document: '" + expression + "'.", e); } mapOfFixedBounds.put(elementId, elementBounds); } return mapOfFixedBounds; } else { return elementBoundsFromBpmnDi; } }
@Override public String toString() { return super.toString() + ", x=" + getX() + ", y=" + getY() + ", width=" + getWidth() + ", height=" + getHeight(); }
@Override public String toString() { return super.toString() + ", x=" + getX() + ", y=" + getY() + ", width=" + getWidth() + ", height=" + getHeight(); }
@Override public String toString() { return super.toString() + ", x=" + getX() + ", y=" + getY() + ", width=" + getWidth() + ", height=" + getHeight(); }