/* * Creates the corresponding yFiles edge after the custom edge is loaded from persistence. * Only for persistence purposes. * @param graph The graph that the edge is part of. * @param source The source node of the edge. * @param target The target node of the edge. * @return The edge. */ protected Edge createEdge(CustomGraph graph, Node source, Node target) { Edge edge = graph.createEdge(source, target); // EdgeRealizer eRealizer = graph.getRealizer(edge); // eRealizer.setSourcePoint(points.get(0).createPoint()); // eRealizer.setTargetPoint(points.get(1).createPoint()); // for(int i=2; i<points.size(); i++) { // PointEntity point = points.get(i); // eRealizer.addPoint(point.getX(), point.getY());; // } return edge; }
/* * 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; }