/* * Updates a custom edge before it is being persisted. * Only for persistence purposes. * @param graph The graph that the edge is part of. * @param edge The corresponding yFiles edge. */ protected void update(CustomGraph graph, Edge edge) { this.source = graph.getCustomNode(edge.source()); this.target = graph.getCustomNode(edge.target()); // EdgeRealizer eRealizer = graph.getRealizer(edge); // this.points = new ArrayList<PointEntity>(); // this.points.add(new PointEntity(eRealizer.getSourcePoint())); // this.points.add(new PointEntity(eRealizer.getTargetPoint())); // for(int i=0; i<eRealizer.pointCount(); i++) { // this.points.add(new PointEntity(eRealizer.getPoint(i))); // } this.graph = graph; }
private void addBranchToBranchEdge( Edge currentEdge, Attachment sourceAttachment, Attachment targetAttachment) { EdgeMap edgeTypeMap = (EdgeMap) _graph.getDataProvider(EdgeMapKeys.EDGE_INFO); Node sourceNode = _viewModel.getViewNode(currentEdge.source()); Node targetNode = _viewModel.getViewNode(currentEdge.target()); Edge newEdge = _graph.createEdge(sourceNode, targetNode); edgeTypeMap.set( newEdge, new SViewEdgeInfo(EdgeType.BRANCH_BRANCH, sourceAttachment, targetAttachment)); sourceNode = getViewStartingNode(newEdge.source(), _graph); targetNode = getViewStartingNode(newEdge.target(), _graph); _viewModel.addComplentaryViewNodes(sourceNode, targetNode); }
private Edge addSimpleEdge(Edge currentEdge) { Node sourceFrom = currentEdge.source(); Node from = _viewModel.getViewNode(sourceFrom); if (from == null) { from = realizeNeigbour(_graph, sourceFrom); } Node sourceTo = currentEdge.target(); Node to = _viewModel.getViewNode(sourceTo); if (to == null) { to = realizeNeigbour(_graph, sourceTo); } Edge newEdge = _graph.createEdge(from, to); return newEdge; }