Search in sources :

Example 6 with MultiPath

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

the class CaseManagementColorMapBackedPickerTest method checkDropZonesAreAddedForCaseManagementShapesWithDropZone.

@Test
public void checkDropZonesAreAddedForCaseManagementShapesWithDropZone() {
    final MultiPath dropZone = mock(MultiPath.class);
    when(dropZone.getAttributes()).thenReturn(mock(Attributes.class));
    when(dropZone.getPathPartListArray()).thenReturn(new NFastArrayList<>());
    final AbstractCaseManagementShape shape = mock(AbstractCaseManagementShape.class);
    when(shape.getDropZone()).thenReturn(Optional.of(dropZone));
    when(dropZone.getActualPathPartListArray()).thenReturn(new NFastArrayList<PathPartList>());
    picker.addSupplementaryPaths(shape);
    verify(picker, times(1)).addDropZone(eq(shape));
    verify(picker, times(1)).drawShape(anyString(), anyDouble(), eq(dropZone), any(PickerPart.class), eq(true));
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) Attributes(com.ait.lienzo.client.core.shape.Attributes) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart) PathPartList(com.ait.lienzo.client.core.types.PathPartList) Test(org.junit.Test)

Example 7 with MultiPath

use of com.ait.lienzo.client.core.shape.MultiPath in project lienzo-core by ahome-it.

the class WiresShapeHighlightImpl method highlightBorder.

private void highlightBorder(final WiresShape parent) {
    if (null == m_path) {
        final MultiPath path = parent.getPath();
        m_path = path.copy();
        m_path.setStrokeWidth(borderSize);
        final Point2D absLoc = path.getComputedLocation();
        m_path.setX(absLoc.getX());
        m_path.setY(absLoc.getY());
        m_path.setStrokeColor("#CC1100");
        m_path.setStrokeAlpha(0.8);
        parent.getGroup().getOverLayer().add(m_path);
        this.parent = parent;
        drawOverLayer();
    }
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) Point2D(com.ait.lienzo.client.core.types.Point2D)

Example 8 with MultiPath

use of com.ait.lienzo.client.core.shape.MultiPath in project lienzo-core by ahome-it.

the class WiresConnector method updateForCenterConnection.

public static void updateForCenterConnection(final WiresConnector connector, final WiresConnection connection, final int pointIndex) {
    if ((connection.getMagnet() != null) && (connection.getMagnet().getIndex() == 0)) {
        final MultiPath path = connection.getMagnet().getMagnets().getWiresShape().getPath();
        final BoundingBox box = path.getBoundingBox();
        final Point2D c = Geometry.findCenter(box);
        Point2D intersectPoint = Geometry.getPathIntersect(connection, path, c, pointIndex);
        if (null == intersectPoint) {
            intersectPoint = new Point2D();
        }
        final Direction d = MagnetManager.getDirection(intersectPoint, box);
        final Point2D loc = path.getComputedLocation().copy();
        connection.setXOffset(intersectPoint.getX() - c.getX());
        connection.setYOffset(intersectPoint.getY() - c.getY());
        if (connector.getHeadConnection() == connection) {
            connector.getLine().setHeadDirection(d);
        } else {
            connector.getLine().setTailDirection(d);
        }
        connection.move(loc.getX() + c.getX(), loc.getY() + c.getY());
    }
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) Point2D(com.ait.lienzo.client.core.types.Point2D) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) Direction(com.ait.lienzo.shared.core.types.Direction)

Example 9 with MultiPath

use of com.ait.lienzo.client.core.shape.MultiPath in project lienzo-core by ahome-it.

the class ColorMapBackedPicker method addShapes.

protected void addShapes(final NFastArrayList<WiresShape> shapes) {
    for (int j = 0; j < shapes.size(); j++) {
        final WiresShape prim = shapes.get(j);
        if (m_options.shapesToSkip.contains(prim)) {
            continue;
        }
        final MultiPath multiPath = prim.getPath();
        drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BODY), true);
        addSupplementaryPaths(prim);
        if (m_options.hotspotsEnabled) {
            drawShape(m_colorKeyRotor.next(), m_options.hotspotWidth, new PickerPart(prim, PickerPart.ShapePart.BORDER_HOTSPOT), false);
            // need to be able to detect the difference between the actual border selection and the border hotspot
            drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BORDER), false);
        }
        if ((prim.getChildShapes() != null) && !prim.getChildShapes().isEmpty()) {
            addShapes(prim.getChildShapes());
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart)

Example 10 with MultiPath

use of com.ait.lienzo.client.core.shape.MultiPath in project lienzo-core by ahome-it.

the class BackingColorMapUtils method drawShapeToBacking.

public static void drawShapeToBacking(final Context2D ctx, final WiresShape shape, final String color) {
    final MultiPath multiPath = shape.getPath();
    drawShapeToBacking(ctx, shape, color, multiPath.getStrokeWidth(), true);
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath)

Aggregations

MultiPath (com.ait.lienzo.client.core.shape.MultiPath)39 Test (org.junit.Test)16 WiresShapeView (org.kie.workbench.common.stunner.client.lienzo.shape.view.wires.WiresShapeView)10 MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)9 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)9 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)7 Point2D (com.ait.lienzo.client.core.types.Point2D)7 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)4 Before (org.junit.Before)4 Layer (com.ait.lienzo.client.core.shape.Layer)3 PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)3 DashArray (com.ait.lienzo.client.core.types.DashArray)3 PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)3 Group (com.ait.lienzo.client.core.shape.Group)2 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)2 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)2 WiresMagnet (com.ait.lienzo.client.core.shape.wires.WiresMagnet)2 NFastArrayList (com.ait.tooling.nativetools.client.collection.NFastArrayList)2 SafeUri (com.google.gwt.safehtml.shared.SafeUri)2 Edge (org.kie.workbench.common.stunner.core.graph.Edge)2