use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class ViewShape method getActivatedGroupNodes.
private static Collection<javafx.scene.shape.Shape> getActivatedGroupNodes(final Group gp) {
// Adding all the shape children
final Collection<javafx.scene.shape.Shape> shapes = gp.getChildren().stream().filter(node -> node instanceof javafx.scene.shape.Shape && node.isVisible() && !node.isDisable()).map(node -> (javafx.scene.shape.Shape) node).collect(Collectors.toList());
// Adding all the view shape children
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ViewShape<?> && node.isVisible() && !node.isDisable()).map(vs -> ((ViewShape<?>) vs).getActivatedShapes()).flatMap(st -> st.stream()).collect(Collectors.toList()));
// Adding the shapes contained in groups that are not view shapes
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof Group && !(node instanceof ViewShape<?>)).map(node -> getActivatedGroupNodes((Group) node)).flatMap(st -> st.stream()).collect(Collectors.toList()));
// Adding the images contained in the group
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ImageView && node.isVisible() && !node.isDisable()).map(node -> {
final Bounds bounds = node.getBoundsInParent();
final Rectangle rec = new Rectangle(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
rec.setFill(Color.WHITE);
rec.getTransforms().setAll(gp.getLocalToSceneTransform());
return rec;
}).collect(Collectors.toList()));
return shapes;
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestSquare method testIsTypeOf.
@Test
public void testIsTypeOf() {
final Square shape = ShapeFactory.INST.createSquare();
assertFalse(shape.isTypeOf(Grid.class));
assertFalse(shape.isTypeOf(Circle.class));
assertTrue(shape.isTypeOf(Shape.class));
assertTrue(shape.isTypeOf(PositionShape.class));
assertTrue(shape.isTypeOf(SquaredShape.class));
assertTrue(shape.isTypeOf(LineArcProp.class));
assertTrue(shape.isTypeOf(Square.class));
assertTrue(shape.isTypeOf(shape.getClass()));
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestTriangle method testIsTypeOf.
@Test
public void testIsTypeOf() {
final Triangle shape = ShapeFactory.INST.createTriangle();
assertFalse(shape.isTypeOf(Rectangle.class));
assertFalse(shape.isTypeOf(Circle.class));
assertTrue(shape.isTypeOf(Shape.class));
assertTrue(shape.isTypeOf(PositionShape.class));
assertTrue(shape.isTypeOf(RectangularShape.class));
assertTrue(shape.isTypeOf(Triangle.class));
assertTrue(shape.isTypeOf(shape.getClass()));
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestRectangle method testIsTypeOf.
@Test
public void testIsTypeOf() {
final Rectangle shape = ShapeFactory.INST.createRectangle();
assertFalse(shape.isTypeOf(Ellipse.class));
assertFalse(shape.isTypeOf(Circle.class));
assertTrue(shape.isTypeOf(Shape.class));
assertTrue(shape.isTypeOf(LineArcProp.class));
assertTrue(shape.isTypeOf(PositionShape.class));
assertTrue(shape.isTypeOf(RectangularShape.class));
assertTrue(shape.isTypeOf(Rectangle.class));
assertTrue(shape.isTypeOf(shape.getClass()));
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestShape method testDuplicate.
@Theory
public void testDuplicate(@ShapeData final Shape shape) {
final Shape sh = shape.duplicate();
assertNotNull(sh);
assertEquals(sh.getClass(), shape.getClass());
}
Aggregations