use of net.sf.latexdraw.model.api.shape.Freehand in project latexdraw by arnobl.
the class FreehandImpl method duplicate.
@Override
@NotNull
public Freehand duplicate() {
final Freehand dup = ShapeFactory.INST.createFreeHand(points.stream().map(pt -> ShapeFactory.INST.createPoint(pt.getX(), pt.getY())).collect(Collectors.toList()));
dup.copy(this);
return dup;
}
use of net.sf.latexdraw.model.api.shape.Freehand in project latexdraw by arnobl.
the class TestParsingPscustom method testPsCustomMovetoCurveto.
@Test
public void testPsCustomMovetoCurveto() {
parser("\\pscustom[linewidth=10cm]{\\moveto(1,2)\\curveto(3.1,4.1)(3.2,4.3)(3,4)}");
final Freehand fh = getShapeAt(0);
assertEquals(2, fh.getNbPoints());
assertEquals(1d * Shape.PPC, fh.getPtAt(0).getX(), 0.001);
assertEquals(-2d * Shape.PPC, fh.getPtAt(0).getY(), 0.001);
assertEquals(3d * Shape.PPC, fh.getPtAt(1).getX(), 0.001);
assertEquals(-4d * Shape.PPC, fh.getPtAt(1).getY(), 0.001);
assertEquals(FreeHandStyle.CURVES, fh.getType());
}
use of net.sf.latexdraw.model.api.shape.Freehand in project latexdraw by arnobl.
the class TestFreehand method testDuplicate.
@Test
public void testDuplicate() {
shape.setOpened(!shape.isOpened());
shape.setInterval(shape.getInterval() * 2);
shape.setType(FreeHandStyle.LINES);
final Freehand dup = shape.duplicate();
assertEquals(shape.isOpened(), dup.isOpened());
assertEquals(shape.getInterval(), dup.getInterval());
assertEquals(FreeHandStyle.LINES, dup.getType());
}
use of net.sf.latexdraw.model.api.shape.Freehand in project latexdraw by arnobl.
the class PolymorphFreeHandTest method testFreeHandInterval.
@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#createDiversifiedFreeHand")
default void testFreeHandInterval(final Freehand sh) {
final Freehand s2 = produceOutputShapeFrom(sh);
assertEquals(sh.getInterval(), s2.getInterval());
}
use of net.sf.latexdraw.model.api.shape.Freehand in project latexdraw by arnobl.
the class TestPSTFreeHand method testFreeHandInterval.
@Override
@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#createDiversifiedFreeHand")
@Disabled
public void testFreeHandInterval(final Freehand sh) {
// PST import cannot determine the interval.
final Freehand s2 = produceOutputShapeFrom(sh);
assertEquals(sh.getNbPoints(), s2.getNbPoints());
}
Aggregations