use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestParsingPscustom method testPsCustomMustConsiderParametersCommand.
@Test
public void testPsCustomMustConsiderParametersCommand() {
parser("\\pscustom[linewidth=10cm]{\\moveto(1,2)\\lineto(3,4)\\lineto(4,4)}");
final Shape sh = getShapeAt(0);
assertEquals(10d * Shape.PPC, sh.getThickness(), 0.001);
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class Pencil method bindDnDToDrawFreeHandShape.
/**
* Binds a DnD interaction to create shape.
*/
private void bindDnDToDrawFreeHandShape() {
nodeBinder().usingInteraction(() -> new DnD(false, true)).toProduce(i -> {
final Shape sh = editing.createShapeInstance();
final Point pt = getAdaptedPoint(i.getSrcLocalPoint());
sh.getPoints().get(0).setPoint(pt.getX(), pt.getY());
return new AddShape(sh, canvas.getDrawing());
}).on(canvas).first((i, c) -> canvas.requestFocus()).then((i, c) -> {
final Point last = c.getShape().getPtAt(-1);
final Point endPt = getAdaptedPoint(i.getTgtLocalPoint());
if (!MathUtils.INST.equalsDouble(last.getX(), endPt.getX(), 0.0001) && !MathUtils.INST.equalsDouble(last.getY(), endPt.getY(), 0.0001)) {
c.setShape(ShapeFactory.INST.createFreeHandFrom((Freehand) c.getShape(), endPt));
}
canvas.setTempView(viewFactory.createView(c.getShape()).orElse(null));
}).endOrCancel(i -> canvas.setTempView(null)).when(i -> i.getButton() == MouseButton.PRIMARY && editing.getCurrentChoice() == EditionChoice.FREE_HAND).strictStart().bind();
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestGroup method init4setFill.
private void init4setFill() {
final Axes sh2 = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
final Shape sh1 = ShapeFactory.INST.createRectangle();
final Shape sh1b = ShapeFactory.INST.createRectangle();
shape.getShapes().add(sh2);
shape.getShapes().add(sh1);
shape.getShapes().add(sh1b);
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestGroup method init4getAxes.
private Axes init4getAxes() {
final Shape sh1 = ShapeFactory.INST.createRectangle();
final Axes sh2 = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
final Axes sh3 = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
shape.getShapes().add(sh1);
shape.getShapes().add(sh2);
shape.getShapes().add(sh3);
return sh2;
}
use of net.sf.latexdraw.model.api.shape.Shape in project latexdraw by arnobl.
the class TestGroup method init4setAxes.
private void init4setAxes() {
final Shape sh1 = ShapeFactory.INST.createRectangle();
final Axes sh2 = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
final Shape sh1b = ShapeFactory.INST.createRectangle();
final Axes sh3 = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
shape.getShapes().add(sh1);
shape.getShapes().add(sh2);
shape.getShapes().add(sh1b);
shape.getShapes().add(sh3);
}
Aggregations