public void stabilizeLayout(double limit) { if (layout != null) { while (layout.getStabilization() < limit) layout.compute(); } }
public void particleMoved(Object id, double x, double y, double z) { //for (LayoutListener listener : listeners) // listener.nodeMoved((String) id, x, y, z); Object xyz[] = new Object[3]; xyz[0] = x; xyz[1] = y; xyz[2] = z; sendNodeAttributeChanged(getLayoutAlgorithmName(), (String) id, "xyz", xyz, xyz); // System.out.printf("particle %s moved : %f;%f;%f\n", id, x, y, z); }
protected void setBox(Box box, Node node) { if (node.hasAttribute("box")) getBox(node).remove(node); box.add(node); node.setAttribute("box", box); if (!node.hasAttribute("children")) node.addAttribute("children", new Box(node, 1)); getChildrenBox(node).level = box.level + 1; }
/** * Launch an automatic layout process that will position nodes in the * background. */ public void enableAutoLayout() { enableAutoLayout(Layouts.newLayoutAlgorithm()); }
protected Spring getNewSpring(EadesParticle p1, EadesParticle p2) { return new Spring(p1, p2); }
protected EadesParticle getNewParticle(String id) { return new EadesParticle(id); }
/** * Force of a spring is : c1 * log(d/c2) */ void computeForce() { double d = p1.d(p2); force = c1 * Math.log(d / c2); }
public void edgeAdded(String sourceId, long timeId, String edgeId, String fromNodeId, String toNodeId, boolean directed) { EadesParticle p1, p2; Spring spring; p1 = (EadesParticle) particles.get(fromNodeId); p2 = (EadesParticle) particles.get(toNodeId); spring = getNewSpring(p1, p2); springs.put(edgeId, spring); p1.springs.put(p2, spring); p2.springs.put(p1, spring); stabilization = 0; }
protected void clearGG() { gg.clear(); if (styleSheet != null) gg.setAttribute("ui.stylesheet", styleSheet); if (layout != null) layout.clear(); }
protected void setBox(Box box, Node node) { if (node.hasAttribute("box")) getBox(node).remove(node); box.add(node); node.setAttribute("box", box); if (!node.hasAttribute("children")) node.addAttribute("children", new Box(node, 1)); getChildrenBox(node).level = box.level + 1; }
public void stabilizeLayout(double limit) { if (layout != null) { while (layout.getStabilization() < limit) layout.compute(); } }
public void particleMoved(Object id, double x, double y, double z) { //for (LayoutListener listener : listeners) // listener.nodeMoved((String) id, x, y, z); Object xyz[] = new Object[3]; xyz[0] = x; xyz[1] = y; xyz[2] = z; sendNodeAttributeChanged(getLayoutAlgorithmName(), (String) id, "xyz", xyz, xyz); // System.out.printf("particle %s moved : %f;%f;%f\n", id, x, y, z); }
public Viewer display(boolean autoLayout) { Viewer viewer = new Viewer(this, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD); GraphRenderer renderer = Viewer.newGraphRenderer(); viewer.addView(Viewer.DEFAULT_VIEW_ID, renderer); if (autoLayout) { Layout layout = Layouts.newLayoutAlgorithm(); viewer.enableAutoLayout(layout); } return viewer; }
protected Spring getNewSpring(EadesParticle p1, EadesParticle p2) { return new Spring(p1, p2); }
protected EadesParticle getNewParticle(String id) { return new EadesParticle(id); }
public Viewer display(boolean autoLayout) { Viewer viewer = new Viewer(this, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD); GraphRenderer renderer = Viewer.newGraphRenderer(); viewer.addView(Viewer.DEFAULT_VIEW_ID, renderer); if (autoLayout) { Layout layout = Layouts.newLayoutAlgorithm(); viewer.enableAutoLayout(layout); } return viewer; }