private CompoundDirectedGraph mapDiagramToGraph() {
Map<AnchorContainer, Node> shapeToNode = new HashMap<AnchorContainer, Node>();
Diagram d = getDiagram();
CompoundDirectedGraph dg = new CompoundDirectedGraph();
EdgeList edgeList = new EdgeList();
NodeList nodeList = new NodeList();
EList<Shape> children = d.getChildren();
for (Shape shape : children) {
Node node = new Node();
GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
node.x = ga.getX();
node.y = ga.getY();
node.width = ga.getWidth();
node.height = ga.getHeight();
node.data = shape;
shapeToNode.put(shape, node);
nodeList.add(node);
}
EList<Connection> connections = d.getConnections();
for (Connection connection : connections) {
AnchorContainer source = connection.getStart().getParent();
AnchorContainer target = connection.getEnd().getParent();