Search in sources :

Example 51 with Point2D

use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.

the class TransformImplTest method testGetTranslate.

@Test
public void testGetTranslate() {
    final Point2D t = tested.getTranslate();
    assertEquals(translate, t);
}
Also used : Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) Test(org.junit.Test)

Example 52 with Point2D

use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.

the class UpdateCanvasControlPointPositionCommandTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    newPosition = new Point2D(10, 10);
    updateCanvasControlPointPositionCommand = spy(new UpdateCanvasControlPointPositionCommand(edge, controlPoint1, newPosition));
}
Also used : Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) Before(org.junit.Before)

Example 53 with Point2D

use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.

the class UpdateElementPositionCommandTest method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    super.setUp();
    when(candidate.getUUID()).thenReturn("uuid1");
    when(candidate.getContent()).thenReturn(content);
    when(content.getBounds()).thenReturn(new BoundsImpl(new BoundImpl(3d, 27d), new BoundImpl(50d, 50d)));
    this.tested = new UpdateElementPositionCommand(candidate, new Point2D(100d, 200d));
}
Also used : Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Before(org.junit.Before)

Example 54 with Point2D

use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.

the class GraphBoundsIndexerImplTest method testGetAt.

@Test
public void testGetAt() {
    Point2D position = GraphUtils.getPosition((View) graphInstanceParent.startNode.getContent());
    double[] size = GraphUtils.getNodeSize((View) graphInstanceParent.startNode.getContent());
    double getAtX = position.getX() + (size[0] / 2);
    double getAtY = position.getY() + (size[1] / 2);
    Node<View<?>, Edge> node = graphBoundsIndexerImpl.getAt(getAtX, getAtY);
    assertNotNull(node);
}
Also used : Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 55 with Point2D

use of org.kie.workbench.common.stunner.core.graph.content.view.Point2D in project kie-wb-common by kiegroup.

the class ControlPointControlImplTest method setUp.

@Before
public void setUp() {
    super.setUp();
    initialControlPointPosition = new Point2D(0, 0);
    newControlPointPosition = new Point2D(10, 10);
    controlPoint1 = new ControlPointImpl(initialControlPointPosition);
    canvasSelectionEvent = new CanvasSelectionEvent(canvasHandler, EDGE_UUID);
    canvasControlPointDragStartEvent = new CanvasControlPointDragStartEvent(initialControlPointPosition);
    canvasControlPointDragEndEvent = new CanvasControlPointDragEndEvent(newControlPointPosition);
    canvasControlPointDoubleClickEvent = new CanvasControlPointDoubleClickEvent(initialControlPointPosition);
    controlPointControl = spy(new ControlPointControlImpl(canvasCommandFactory));
    when(canvas.getShape(EDGE_UUID)).thenReturn(connectorShape);
    when(graphIndex.get(EDGE_UUID)).thenReturn(edge);
    when(graphIndex.getEdge(EDGE_UUID)).thenReturn(edge);
    when(edge.getContent()).thenReturn(viewConnector);
    when(edge.getUUID()).thenReturn(EDGE_UUID);
    when(connectorShape.getShapeView()).thenReturn(shapeView);
    when(viewConnector.getControlPoints()).thenReturn(Arrays.asList(controlPoint1));
    controlPointControl.enable(canvasHandler);
    controlPointControl.setCommandManagerProvider(() -> commandManager);
    controlPointControl.register(edge);
}
Also used : CanvasSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasSelectionEvent) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) CanvasControlPointDragStartEvent(org.kie.workbench.common.stunner.core.client.canvas.event.controlpoint.CanvasControlPointDragStartEvent) CanvasControlPointDragEndEvent(org.kie.workbench.common.stunner.core.client.canvas.event.controlpoint.CanvasControlPointDragEndEvent) ControlPointImpl(org.kie.workbench.common.stunner.core.graph.content.view.ControlPointImpl) CanvasControlPointDoubleClickEvent(org.kie.workbench.common.stunner.core.client.canvas.event.controlpoint.CanvasControlPointDoubleClickEvent) Before(org.junit.Before)

Aggregations

Point2D (org.kie.workbench.common.stunner.core.graph.content.view.Point2D)55 Test (org.junit.Test)25 Edge (org.kie.workbench.common.stunner.core.graph.Edge)18 View (org.kie.workbench.common.stunner.core.graph.content.view.View)17 Node (org.kie.workbench.common.stunner.core.graph.Node)15 Command (org.kie.workbench.common.stunner.core.command.Command)10 BoundImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl)10 BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)10 Before (org.junit.Before)9 Bounds (org.kie.workbench.common.stunner.core.graph.content.Bounds)7 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)6 CompositeCommand (org.kie.workbench.common.stunner.core.command.impl.CompositeCommand)6 TestingGraphMockHandler (org.kie.workbench.common.stunner.core.TestingGraphMockHandler)5 UpdateElementPositionCommand (org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPositionCommand)5 Ignore (org.junit.Ignore)4 Element (org.kie.workbench.common.stunner.core.graph.Element)4 AbstractCanvas (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas)3 CanvasCommand (org.kie.workbench.common.stunner.core.client.command.CanvasCommand)3 ShapeView (org.kie.workbench.common.stunner.core.client.shape.view.ShapeView)3 CommandResult (org.kie.workbench.common.stunner.core.command.CommandResult)3