use of org.opennms.features.topology.api.LayoutAlgorithm in project opennms by OpenNMS.
the class ManualLayoutAlgorithmTest method verifyAppliesXAndYCoordinates.
/*
* This test verifies, that the vertex coordinates of x and y are applied to the
* layout, if they exist.
*/
@Test
public void verifyAppliesXAndYCoordinates() {
final ManualTest test = new ManualTest(new SimpleGraphBuilder("dummy").vertex("1").vX(0).vY(0).vertex("2").vX(1).vY(1).get());
final LayoutAlgorithm layoutAlgorithm = new ManualLayoutAlgorithm(test.layoutManager);
layoutAlgorithm.updateLayout(test.graph);
Assert.assertEquals(ImmutableMap.builder().put(new DefaultVertexRef("dummy", "1"), new Point(0, 0)).put(new DefaultVertexRef("dummy", "2"), new Point(1, 1)).build(), test.layout.getLocations());
}
use of org.opennms.features.topology.api.LayoutAlgorithm in project opennms by OpenNMS.
the class DefaultTopologyService method getPreferredLayoutAlgorithm.
// Determines default layout
@Override
public LayoutAlgorithm getPreferredLayoutAlgorithm(String metaTopologyId, String namespace) {
Objects.requireNonNull(metaTopologyId);
Objects.requireNonNull(namespace);
final GraphProvider graphProvider = getGraphProvider(metaTopologyId, namespace);
final String preferredLayout = graphProvider.getDefaults().getPreferredLayout();
final LayoutAlgorithm preferredLayoutAlgorithm = serviceLocator != null ? findLayoutAlgorithm(preferredLayout) : DEFAULT_LAYOUT_ALGORITHM;
return preferredLayoutAlgorithm;
}
Aggregations