Search in sources :

Example 1 with MultiPathDecorator

use of com.ait.lienzo.client.core.shape.MultiPathDecorator in project kie-wb-common by kiegroup.

the class AssociationView method createLine.

private static Object[] createLine(final double x1, final double y1, final double x2, final double y2) {
    final MultiPath head = new MultiPath();
    final MultiPath tail = new MultiPath();
    final DirectionalLine line = new DirectionalLine(x1, y1, x2, y2);
    line.setDashArray(new DashArray(2, 6));
    line.setDraggable(true);
    line.setSelectionStrokeOffset(SELECTION_OFFSET);
    line.setHeadOffset(head.getBoundingBox().getHeight());
    line.setTailOffset(tail.getBoundingBox().getHeight());
    final MultiPathDecorator headDecorator = new MultiPathDecorator(head);
    final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail);
    return new Object[] { line, headDecorator, tailDecorator };
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) DashArray(com.ait.lienzo.client.core.types.DashArray)

Example 2 with MultiPathDecorator

use of com.ait.lienzo.client.core.shape.MultiPathDecorator in project kie-wb-common by kiegroup.

the class KnowledgeRequirementView method createLine.

private static Object[] createLine(final double x1, final double y1, final double x2, final double y2) {
    final MultiPath head = new MultiPath();
    final MultiPath tail = new MultiPath().M(0, DECORATOR_HEIGHT).L(DECORATOR_WIDTH / 2, 0).L(DECORATOR_WIDTH, DECORATOR_HEIGHT).setFillColor(ColorName.BLACK).setFillAlpha(1);
    final DirectionalLine line = new DirectionalLine(x1, y1, x2, y2);
    line.setDashArray(new DashArray(4, 4));
    line.setDraggable(true);
    line.setSelectionStrokeOffset(SELECTION_OFFSET);
    line.setHeadOffset(head.getBoundingBox().getHeight());
    line.setTailOffset(tail.getBoundingBox().getHeight());
    final MultiPathDecorator headDecorator = new MultiPathDecorator(head);
    final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail);
    return new Object[] { line, headDecorator, tailDecorator };
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) DashArray(com.ait.lienzo.client.core.types.DashArray)

Example 3 with MultiPathDecorator

use of com.ait.lienzo.client.core.shape.MultiPathDecorator in project kie-wb-common by kiegroup.

the class AbstractConnectorViewTest method createLineNull.

@Test
public void createLineNull() {
    Object[] line = AbstractConnectorView.createLine(lineFactory, null, 0d, 1d);
    MultiPathDecorator headDecorator = (MultiPathDecorator) line[1];
    MultiPathDecorator tailDecorator = (MultiPathDecorator) line[2];
    assertEquals(headDecorator.getPath().getBoundingBox(), emptyBoundingBox());
    assertEquals(tailDecorator.getPath().getBoundingBox(), emptyBoundingBox());
}
Also used : MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) Test(org.junit.Test)

Example 4 with MultiPathDecorator

use of com.ait.lienzo.client.core.shape.MultiPathDecorator in project kie-wb-common by kiegroup.

the class OrthogonalPolyLineConnectorViewTest method testCreateLine.

@Test
public void testCreateLine() {
    double[] points = new double[] { 0, 0, 10, 10 };
    OrthogonalPolyLineConnectorFactory factory = new OrthogonalPolyLineConnectorFactory();
    Object[] line = PolylineConnectorView.createLine(factory, ConnectorShapeDef.Direction.ONE, points);
    MultiPathDecorator head = (MultiPathDecorator) line[1];
    MultiPath headPath = head.getPath();
    BoundingBox headBoundingBox = headPath.getBoundingBox();
    MultiPathDecorator tail = (MultiPathDecorator) line[2];
    MultiPath tailPath = tail.getPath();
    BoundingBox tailBoundingBox = tailPath.getBoundingBox();
    assertEquals(0, headBoundingBox.getWidth(), 0);
    assertEquals(0, headBoundingBox.getHeight(), 0);
    assertNotEquals(0, tailBoundingBox.getWidth(), 0);
    assertNotEquals(0, tailBoundingBox.getHeight(), 0);
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) OrthogonalPolyLineConnectorFactory(org.kie.workbench.common.stunner.shapes.client.factory.OrthogonalPolyLineConnectorFactory) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) Test(org.junit.Test)

Example 5 with MultiPathDecorator

use of com.ait.lienzo.client.core.shape.MultiPathDecorator in project kie-wb-common by kiegroup.

the class PolyLineConnectorViewTest method testCreateLine.

@Test
public void testCreateLine() {
    double[] points = new double[] { 0, 0, 10, 10 };
    PolyLineConnectorFactory factory = new PolyLineConnectorFactory();
    Object[] line = PolylineConnectorView.createLine(factory, ConnectorShapeDef.Direction.ONE, points);
    MultiPathDecorator head = (MultiPathDecorator) line[1];
    MultiPath headPath = head.getPath();
    BoundingBox headBoundingBox = headPath.getBoundingBox();
    MultiPathDecorator tail = (MultiPathDecorator) line[2];
    MultiPath tailPath = tail.getPath();
    BoundingBox tailBoundingBox = tailPath.getBoundingBox();
    assertEquals(0, headBoundingBox.getWidth(), 0);
    assertEquals(0, headBoundingBox.getHeight(), 0);
    assertNotEquals(0, tailBoundingBox.getWidth(), 0);
    assertNotEquals(0, tailBoundingBox.getHeight(), 0);
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) PolyLineConnectorFactory(org.kie.workbench.common.stunner.shapes.client.factory.PolyLineConnectorFactory) MultiPathDecorator(com.ait.lienzo.client.core.shape.MultiPathDecorator) Test(org.junit.Test)

Aggregations

MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)13 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)9 Test (org.junit.Test)6 DashArray (com.ait.lienzo.client.core.types.DashArray)3 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)2 Layer (com.ait.lienzo.client.core.shape.Layer)1 PolyLine (com.ait.lienzo.client.core.shape.PolyLine)1 WiresConnectorLabel (com.ait.lienzo.client.core.shape.wires.util.WiresConnectorLabel)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)1 Consumer (com.ait.tooling.common.api.java.util.function.Consumer)1 Before (org.junit.Before)1 OrthogonalPolyLineConnectorFactory (org.kie.workbench.common.stunner.shapes.client.factory.OrthogonalPolyLineConnectorFactory)1 PolyLineConnectorFactory (org.kie.workbench.common.stunner.shapes.client.factory.PolyLineConnectorFactory)1