use of com.ait.lienzo.client.core.types.Point2DArray in project lienzo-core by ahome-it.
the class Triangle method parse.
private boolean parse(final Attributes attr) {
final Point2DArray list = attr.getPoints().noAdjacentPoints();
if ((null != list) && (list.size() > 2)) {
final Point2D p0 = list.get(0);
m_list.M(p0);
final double corner = getCornerRadius();
if (corner <= 0) {
m_list.L(list.get(1));
m_list.L(list.get(2));
m_list.Z();
} else {
Geometry.drawArcJoinedLines(m_list, list.push(p0), corner);
}
return true;
}
return false;
}
use of com.ait.lienzo.client.core.types.Point2DArray in project lienzo-core by ahome-it.
the class AbstractMultiPathPartShape method prepare.
@Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha) {
final double radius = getCornerRadius();
if (radius != 0) {
m_cornerPoints = new NFastArrayList<>();
for (int i = 0; i < m_points.size(); i++) {
final PathPartList baseList = m_points.get(i);
final Point2DArray basePoints = baseList.getPoints();
final PathPartList cornerList = new PathPartList();
Geometry.drawArcJoinedLines(cornerList, baseList, basePoints, radius);
m_cornerPoints.add(cornerList);
}
}
if (false == validSizeConstraints()) {
throw new IllegalArgumentException("Constraints are either smaller or larger than size.");
}
return true;
}
use of com.ait.lienzo.client.core.types.Point2DArray in project kie-wb-common by kiegroup.
the class LogSelectedEdgeDevCommand method logEdge.
private void logEdge(final Edge<? extends View<?>, Node> edge) {
StunnerLogger.log(edge);
if (edge.getContent() instanceof HasControlPoints) {
final ControlPoint[] controlPoints = ((HasControlPoints) edge.getContent()).getControlPoints();
String s = "*** CPS = ";
if (null != controlPoints) {
for (ControlPoint cp : controlPoints) {
s += " [" + format(cp.getLocation()) + "] ";
}
s += " *** ";
} else {
s += " [Empty] ";
}
log(s);
String s1 = "*** CPS[Lienzo] = ";
final Shape shape = getCanvasHandler().getCanvas().getShape(edge.getUUID());
final WiresConnectorView connectorView = (WiresConnectorView) shape.getShapeView();
final Point2DArray controlPoints1 = connectorView.getControlPoints();
if (null != controlPoints1) {
for (com.ait.lienzo.client.core.types.Point2D point2D : controlPoints1) {
s1 += " [" + point2D.getX() + "," + point2D.getY() + "] ";
}
s1 += " *** ";
} else {
s1 += " [Empty] ";
}
log(s1);
}
}
use of com.ait.lienzo.client.core.types.Point2DArray in project kie-wb-common by kiegroup.
the class DirectionalLineTest method testSkipParse.
@Test
public void testSkipParse() throws Exception {
final Attributes attr = mock(Attributes.class);
final Point2DArray points = new Point2DArray();
when(attr.getControlPoints()).thenReturn(points);
final boolean parsed = tested.parse(attr);
assertFalse(parsed);
}
use of com.ait.lienzo.client.core.types.Point2DArray in project kie-wb-common by kiegroup.
the class WiresConnectorViewExtTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
HEAD_DECORATOR = new MultiPathDecorator(new MultiPath().rect(0, 0, 10, 10));
TAIL_DECORATOR = new MultiPathDecorator(new MultiPath().rect(0, 0, 10, 10));
POINTS = new Point2DArray(new Point2D(0, 10), new Point2D(10, 10), new Point2D(20, 20), new Point2D(30, 30), new Point2D(40, 40));
line = new PolyLine(POINTS);
layer = spy(new Layer());
doAnswer(invocation -> {
((Consumer) invocation.getArguments()[0]).accept(labelText);
return label;
}).when(label).configure(any(Consumer.class));
tested = spy(new WiresConnectorViewExt(ShapeViewSupportedEvents.DESKTOP_CONNECTOR_EVENT_TYPES, line, HEAD_DECORATOR, TAIL_DECORATOR) {
@Override
protected Optional<WiresConnectorLabel> createLabel(String title) {
return Optional.of(WiresConnectorViewExtTest.this.label);
}
});
tested.setControl(connectorControl);
layer.add(tested.getGroup());
}
Aggregations