use of org.opennms.features.topology.api.topo.VertexRef in project opennms by OpenNMS.
the class RealUltimateLayoutAlgorithm method doISOMLayout.
private static void doISOMLayout(final Layout graphLayout, SparseGraph<VertexRef, EdgeRef> jungGraph, Dimension size) {
NonStupidISOMLayout layout = new NonStupidISOMLayout(jungGraph, graphLayout);
layout.setInitializer(initializer(graphLayout));
layout.setSize(size);
while (!layout.done()) {
layout.step();
}
for (VertexRef v : jungGraph.getVertices()) {
graphLayout.setLocation(v, new Point(layout.getX(v), layout.getY(v)));
}
}
use of org.opennms.features.topology.api.topo.VertexRef in project opennms by OpenNMS.
the class SavedHistory method getFocusVertices.
private static Set<VertexRef> getFocusVertices(GraphContainer graphContainer) {
final Set<VertexRef> retVal = new HashSet<>();
Criteria[] criterias = graphContainer.getCriteria();
for (Criteria crit : criterias) {
if (crit instanceof VertexHopGraphProvider.VertexHopCriteria && !(crit instanceof CollapsibleCriteria)) {
retVal.addAll(((VertexHopGraphProvider.VertexHopCriteria) crit).getVertices());
}
}
return retVal;
}
use of org.opennms.features.topology.api.topo.VertexRef in project opennms by OpenNMS.
the class VertexHopGraphProvider method getFocusNodes.
public Set<VertexRef> getFocusNodes(Criteria... criteria) {
Set<VertexRef> focusNodes = new HashSet<VertexRef>();
for (Criteria criterium : criteria) {
try {
VertexHopCriteria hopCriterium = (VertexHopCriteria) criterium;
focusNodes.addAll(hopCriterium.getVertices());
} catch (ClassCastException e) {
}
}
return focusNodes;
}
use of org.opennms.features.topology.api.topo.VertexRef in project opennms by OpenNMS.
the class VertexInfoPanelItemProvider method findSingleSelectedItem.
@Override
protected Optional<VertexRef> findSingleSelectedItem(GraphContainer container) {
Collection<VertexRef> selectedVertexRefs = container.getSelectionManager().getSelectedVertexRefs();
if (selectedVertexRefs.size() == 1) {
final VertexRef vertexRef = selectedVertexRefs.iterator().next();
Vertex vertex = container.getTopologyServiceClient().getVertex(vertexRef);
return Optional.ofNullable(vertex);
}
return Optional.empty();
}
use of org.opennms.features.topology.api.topo.VertexRef in project opennms by OpenNMS.
the class BreadcrumbPathCalculator method findPath.
static List<VertexRef> findPath(Map<VertexRef, EdgeRef> incomingEdgeMap, VertexRef vertexToFind) {
Objects.requireNonNull(incomingEdgeMap);
Objects.requireNonNull(vertexToFind);
List<VertexRef> vertexRefs = Lists.newArrayList();
if (incomingEdgeMap.get(vertexToFind) != null) {
addPathRecursively(vertexRefs, vertexToFind, incomingEdgeMap);
if (vertexRefs.size() >= 2) {
Iterator<VertexRef> it = vertexRefs.iterator();
VertexRef left = it.next();
while (it.hasNext()) {
VertexRef right = it.next();
if (left.getNamespace().equals(right.getNamespace())) {
it.remove();
}
left = right;
}
}
}
return vertexRefs;
}
Aggregations