use of org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData in project sirius-components by eclipse-sirius.
the class EdgeLabelPositionProviderTests method createDiagramLayoutData.
private DiagramLayoutData createDiagramLayoutData() {
DiagramLayoutData diagramLayoutData = new DiagramLayoutData();
diagramLayoutData.setId(UUID.randomUUID().toString());
diagramLayoutData.setPosition(Position.at(0, 0));
diagramLayoutData.setSize(Size.of(1000, 1000));
return diagramLayoutData;
}
use of org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData in project sirius-components by eclipse-sirius.
the class EdgeRoutingPointsProviderTests method createDiagramLayoutData.
private DiagramLayoutData createDiagramLayoutData() {
DiagramLayoutData diagramLayoutData = new DiagramLayoutData();
diagramLayoutData.setId(UUID.randomUUID().toString());
diagramLayoutData.setPosition(Position.at(0, 0));
diagramLayoutData.setSize(Size.of(1000, 1000));
return diagramLayoutData;
}
use of org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData in project sirius-components by eclipse-sirius.
the class NodeLabelPositionProviderTests method testNodeRectangleLabelBoundsPosition.
@Test
public void testNodeRectangleLabelBoundsPosition() {
DiagramLayoutData createDiagramLayoutData = this.createDiagramLayoutData();
NodeLayoutData nodeLayoutData = this.createNodeLayoutData(Position.at(0, 0), DEFAULT_NODE_SIZE, createDiagramLayoutData, NodeType.NODE_RECTANGLE);
NodeLabelPositionProvider labelBoundsProvider = new NodeLabelPositionProvider(new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator());
LabelLayoutData labelLayoutData = this.createLabelLayoutData();
Position position = labelBoundsProvider.getPosition(nodeLayoutData, labelLayoutData, new ArrayList<>());
assertThat(position).extracting(Position::getX).isEqualTo(Double.valueOf(DEFAULT_NODE_SIZE.getWidth() / 2));
assertThat(position).extracting(Position::getY).isEqualTo(Double.valueOf(5));
}
use of org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData in project sirius-components by eclipse-sirius.
the class NodeLabelPositionProviderTests method createDiagramLayoutData.
private DiagramLayoutData createDiagramLayoutData() {
DiagramLayoutData diagramLayoutData = new DiagramLayoutData();
diagramLayoutData.setId(UUID.randomUUID().toString());
diagramLayoutData.setPosition(Position.at(0, 0));
diagramLayoutData.setSize(Size.of(1000, 1000));
return diagramLayoutData;
}
use of org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData in project sirius-components by eclipse-sirius.
the class NodeLabelPositionProviderTests method testNodeImageLabelBoundsPosition.
@Test
public void testNodeImageLabelBoundsPosition() {
DiagramLayoutData createDiagramLayoutData = this.createDiagramLayoutData();
NodeLayoutData nodeLayoutData = this.createNodeLayoutData(Position.at(0, 0), DEFAULT_NODE_SIZE, createDiagramLayoutData, NodeType.NODE_IMAGE);
NodeLabelPositionProvider labelBoundsProvider = new NodeLabelPositionProvider(new LayoutConfiguratorRegistry(List.of()).getDefaultLayoutConfigurator());
LabelLayoutData labelLayoutData = this.createLabelLayoutData();
Position position = labelBoundsProvider.getPosition(nodeLayoutData, labelLayoutData, new ArrayList<>());
assertThat(position).extracting(Position::getX).isEqualTo(Double.valueOf(DEFAULT_NODE_SIZE.getWidth() / 2));
assertThat(position).extracting(Position::getY).isEqualTo(Double.valueOf(-23.3984375));
}
Aggregations