Search in sources :

Example 31 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project lienzo-core by ahome-it.

the class ContainerNode method getBoundingBox.

@Override
public BoundingBox getBoundingBox() {
    final BoundingBox bbox = new BoundingBox();
    final NFastArrayList<M> list = getChildNodes();
    final int size = list.size();
    for (int i = 0; i < size; i++) {
        final BoundingPoints bpts = list.get(i).getBoundingPoints();
        if (null != bpts) {
            bbox.add(bpts.getArray());
        }
    }
    return bbox;
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) BoundingPoints(com.ait.lienzo.client.core.types.BoundingPoints)

Example 32 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project drools-wb by kiegroup.

the class GuidedDecisionTableViewImpl method makeHeaderCaption.

private Group makeHeaderCaption() {
    final Group g = GWT.create(Group.class);
    final double captionWidth = ((GuidedDecisionTableRenderer) renderer).getHeaderCaptionWidth();
    final GuidedDecisionTableTheme theme = (GuidedDecisionTableTheme) renderer.getTheme();
    final Rectangle r = theme.getBaseRectangle(GuidedDecisionTableTheme.ModelColumnType.CAPTION);
    r.setWidth(captionWidth);
    r.setHeight(HEADER_CAPTION_HEIGHT);
    final MultiPath border = theme.getBodyGridLine();
    border.M(0.5, HEADER_CAPTION_HEIGHT + 0.5);
    border.L(0.5, 0.5);
    border.L(captionWidth + 0.5, 0.5);
    border.L(captionWidth + 0.5, HEADER_CAPTION_HEIGHT + 0.5);
    border.L(0.5, HEADER_CAPTION_HEIGHT + 0.5);
    final Text caption = theme.getHeaderText();
    caption.setText(model.getTableName());
    caption.setX(captionWidth / 2);
    caption.setY(HEADER_CAPTION_HEIGHT / 2);
    // Clip Caption Group
    final BoundingBox bb = new BoundingBox(0, 0, captionWidth + border.getStrokeWidth(), HEADER_CAPTION_HEIGHT + 0.5);
    final IPathClipper clipper = getPathClipper(bb);
    g.setPathClipper(clipper);
    clipper.setActive(true);
    g.add(r);
    g.add(caption);
    g.add(border);
    return g;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) MultiPath(com.ait.lienzo.client.core.shape.MultiPath) IPathClipper(com.ait.lienzo.client.core.shape.IPathClipper) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) GuidedDecisionTableTheme(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableTheme) Text(com.ait.lienzo.client.core.shape.Text) GuidedDecisionTableRenderer(org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer)

Example 33 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox 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 34 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox 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)

Example 35 with BoundingBox

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

the class EmptyStateLayer method updateCursor.

private void updateCursor() {
    BoundingBox captionBB = caption.getBoundingBox();
    double captionCenterY = captionBB.getHeight() / 2d;
    double cursorTargetWidth = 40;
    double cursorTargetHeight = 62.4;
    double cursorCenterX = cursorTargetWidth / 2d;
    double centerX = getWidth() / 2d;
    double centerY = getHeight() / 2d;
    BoundingBox cursorBB = cursor.getBoundingBox();
    final double[] cursorScale = getScaleFactor(cursorBB.getWidth(), cursorBB.getHeight(), cursorTargetWidth, cursorTargetHeight);
    cursor.setScale(cursorScale[0], cursorScale[1]);
    cursor.setX(centerX - cursorCenterX);
    cursor.setY(centerY - captionCenterY - 25 - cursorTargetHeight);
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Aggregations

BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)79 Point2D (com.ait.lienzo.client.core.types.Point2D)24 Test (org.junit.Test)16 ScratchPad (com.ait.lienzo.client.core.util.ScratchPad)8 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)7 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)7 Context2D (com.ait.lienzo.client.core.Context2D)6 ArrayList (java.util.ArrayList)6 Direction (com.ait.lienzo.shared.core.types.Direction)5 Group (com.ait.lienzo.client.core.shape.Group)4 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)4 Text (com.ait.lienzo.client.core.shape.Text)3 Transform (com.ait.lienzo.client.core.types.Transform)3 NFastDoubleArrayJSO (com.ait.tooling.nativetools.client.collection.NFastDoubleArrayJSO)3 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)3 MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)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 BoundingPoints (com.ait.lienzo.client.core.types.BoundingPoints)2