/** * Sets the order of the vertices in the layout according to the ordering * specified by {@code comparator}. * @param comparator the comparator to use to order the vertices */ public void setVertexOrder(Comparator<V> comparator) { if (vertex_ordered_list == null) vertex_ordered_list = new ArrayList<V>(getGraph().getVertices()); Collections.sort(vertex_ordered_list, comparator); }
/** * Sets the order of the vertices in the layout according to the ordering * of {@code vertex_list}. * @param vertex_list a list specifying the ordering of the vertices */ public void setVertexOrder(List<V> vertex_list) { if (!vertex_list.containsAll(getGraph().getVertices())) throw new IllegalArgumentException("Supplied list must include " + "all vertices of the graph"); this.vertex_ordered_list = vertex_list; }
/** * Sets the order of the vertices in the layout according to the ordering * specified by {@code comparator}. */ public void setVertexOrder(Comparator<V> comparator) { if (vertex_ordered_list == null) vertex_ordered_list = new ArrayList<V>(getGraph().getVertices()); Collections.sort(vertex_ordered_list, comparator); }
/** * Sets the order of the vertices in the layout according to the ordering * of {@code vertex_list}. */ public void setVertexOrder(List<V> vertex_list) { if (!vertex_list.containsAll(getGraph().getVertices())) throw new IllegalArgumentException("Supplied list must include " + "all vertices of the graph"); this.vertex_ordered_list = vertex_list; }
public void initialize() { Dimension d = getSize(); if (d != null) { if (vertex_ordered_list == null) setVertexOrder(new ArrayList<V>(getGraph().getVertices())); double height = d.getHeight(); double width = d.getWidth(); if (radius <= 0) { radius = 0.45 * (height < width ? height : width); } int i = 0; for (V v : vertex_ordered_list) { Point2D coord = apply(v); double angle = (2 * Math.PI * i) / vertex_ordered_list.size(); coord.setLocation(Math.cos(angle) * radius + width / 2, Math.sin(angle) * radius + height / 2); CircleVertexData data = getCircleData(v); data.setAngle(angle); i++; } } }
public void initialize() { Dimension d = getSize(); if (d != null) { if (vertex_ordered_list == null) setVertexOrder(new ArrayList<V>(getGraph().getVertices())); double height = d.getHeight(); double width = d.getWidth(); if (radius <= 0) { radius = 0.45 * (height < width ? height : width); } int i = 0; for (V v : vertex_ordered_list) { Point2D coord = transform(v); double angle = (2 * Math.PI * i) / vertex_ordered_list.size(); coord.setLocation(Math.cos(angle) * radius + width / 2, Math.sin(angle) * radius + height / 2); CircleVertexData data = getCircleData(v); data.setAngle(angle); i++; } } }