use of net.sf.latexdraw.model.api.shape.Plot in project latexdraw by arnobl.
the class TestPlot method testCopy.
@Test
public void testCopy() {
final Plot shape2 = ShapeFactory.INST.createPlot(ShapeFactory.INST.createPoint(), 1d, 11d, "x 2 mul", false);
shape2.setPlotEquation("2 x mul");
shape2.setPolar(true);
shape2.setNbPlottedPoints(73);
shape2.setPlotStyle(PlotStyle.ECURVE);
shape2.setPlotMinX(-234.0);
shape2.setPlotMaxX(123.0);
shape2.setDotStyle(DotStyle.BAR);
shape2.setDiametre(23.0);
shape2.setDotFillingCol(DviPsColors.YELLOW);
shape.setPlotEquation("x");
shape.copy(shape2);
assertEquals("2 x mul", shape.getPlotEquation());
assertTrue(shape.isPolar());
assertEquals(DviPsColors.YELLOW, shape.getDotFillingCol());
assertEquals(23.0, shape.getDiametre(), 0.0001);
assertEquals(DotStyle.BAR, shape.getDotStyle());
assertEquals(123.0, shape.getPlotMaxX(), 0.0001);
assertEquals(-234.0, shape.getPlotMinX(), 0.0001);
assertEquals(PlotStyle.ECURVE, shape.getPlotStyle());
assertEquals(73, shape.getNbPlottedPoints());
}
use of net.sf.latexdraw.model.api.shape.Plot in project latexdraw by arnobl.
the class TestTextSetter method testTypeEqFieldOKAddShape.
@Test
public void testTypeEqFieldOKAddShape() {
Cmds.of(plotMode, clickCanvas, () -> write("x 2 mul").type(KeyCode.ENTER)).execute();
assertEquals(1, canvas.getDrawing().size());
assertTrue(canvas.getDrawing().getShapeAt(0).orElseThrow() instanceof Plot);
final Plot sh = (Plot) canvas.getDrawing().getShapeAt(0).orElseThrow();
assertEquals("x 2 mul", sh.getPlotEquation());
assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getX(), sh.getPosition().getX(), 1d);
assertEquals(-Canvas.getMargins() + canvas.screenToLocal(pos).getY() + setter.getTextField().getPrefHeight(), sh.getPosition().getY(), 1d);
}
use of net.sf.latexdraw.model.api.shape.Plot in project latexdraw by arnobl.
the class PolymorphPlotTest method testPlotParams.
@ParameterizedTest
@MethodSource("net.sf.latexdraw.data.ShapeSupplier#createDiversifiedPlot")
default void testPlotParams(final Plot sh) {
final Plot s2 = produceOutputShapeFrom(sh);
CompareShapeMatcher.INST.assertEqualsPlot(sh, s2);
}
use of net.sf.latexdraw.model.api.shape.Plot in project latexdraw by arnobl.
the class PolymorphPlotTest method testPlotParamsWithAllStyle.
@ParameterizedTest
@EnumSource(PlotStyle.class)
default void testPlotParamsWithAllStyle(final PlotStyle style) {
final Plot sh = ShapeSupplier.createPlot();
sh.setPlotStyle(style);
final Plot s2 = produceOutputShapeFrom(sh);
CompareShapeMatcher.INST.assertEqualsPlot(sh, s2);
}
use of net.sf.latexdraw.model.api.shape.Plot in project latexdraw by arnobl.
the class ModifyShapePropertyTest method commonCanDoFixture.
@Override
protected void commonCanDoFixture() {
shapes = ShapeFactory.INST.createGroup();
final Grid grid = ShapeFactory.INST.createGrid(ShapeFactory.INST.createPoint());
final Axes axes = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
final Dot dot = ShapeFactory.INST.createDot(ShapeFactory.INST.createPoint());
final Circle circle = ShapeFactory.INST.createCircle();
final Ellipse ell = ShapeFactory.INST.createEllipse();
final Text txt = ShapeFactory.INST.createText();
final BezierCurve bc = ShapeFactory.INST.createBezierCurve(Collections.emptyList());
final Polyline pl = ShapeFactory.INST.createPolyline(Collections.emptyList());
final Polygon pg = ShapeFactory.INST.createPolygon(Collections.emptyList());
final Triangle tr = ShapeFactory.INST.createTriangle();
final Rhombus rh = ShapeFactory.INST.createRhombus();
final Rectangle r1 = ShapeFactory.INST.createRectangle();
final Plot plot = ShapeFactory.INST.createPlot(ShapeFactory.INST.createPoint(), 0d, 1d, "x", false);
final CircleArc carc = ShapeFactory.INST.createCircleArc();
final Square sq = ShapeFactory.INST.createSquare();
final Freehand fh = ShapeFactory.INST.createFreeHand(Collections.emptyList());
r1.setLineStyle(LineStyle.DASHED);
r1.setBordersPosition(BorderPos.INTO);
r1.setFillingStyle(FillingStyle.PLAIN);
r1.setThickness(2.3);
r1.setHasDbleBord(true);
r1.setLineArc(0.2);
r1.setDbleBordSep(1.3);
r1.setHatchingsAngle(0.33);
r1.setHatchingsSep(9.1);
r1.setHatchingsWidth(12.11);
r1.setShadowAngle(0.1);
r1.setGradMidPt(0.66);
r1.setHatchingsCol(DviPsColors.CYAN);
r1.setLineColour(DviPsColors.NAVYBLUE);
r1.setShadowSize(87.2);
r1.setFillingCol(DviPsColors.CARNATIONPINK);
r1.setShadowCol(DviPsColors.CORNFLOWERBLUE);
r1.setDashSepBlack(1.2);
r1.setDashSepWhite(2.1);
r1.setDotSep(23.1);
r1.setGradAngle(1.3);
r1.setDbleBordCol(DviPsColors.RED);
r1.setGradColEnd(DviPsColors.BITTERSWEET);
r1.setGradColStart(DviPsColors.FORESTGREEN);
r1.setShowPts(true);
final Rectangle r2 = ShapeFactory.INST.createRectangle();
r2.setLineStyle(LineStyle.SOLID);
r2.setBordersPosition(BorderPos.MID);
r2.setFillingStyle(FillingStyle.HLINES);
r2.setThickness(6.3);
r2.setHasShadow(true);
r2.setLineArc(0.33);
r2.setDbleBordSep(2.3);
r2.setHatchingsAngle(-0.53);
r2.setHatchingsSep(1.1);
r2.setHatchingsWidth(2.11);
r2.setShadowAngle(-0.1);
r2.setGradMidPt(0.31);
r2.setHatchingsCol(DviPsColors.APRICOT);
r2.setLineColour(DviPsColors.YELLOW);
r2.setShadowSize(8.1);
r2.setFillingCol(DviPsColors.CERULEAN);
r2.setShadowCol(DviPsColors.DARKORCHID);
r1.setDashSepBlack(11.2);
r1.setDashSepWhite(21.1);
r1.setDotSep(231.1);
r1.setGradAngle(11.3);
r1.setDbleBordCol(DviPsColors.ROYALBLUE);
r1.setGradColEnd(DviPsColors.CADETBLUE);
r1.setGradColStart(DviPsColors.OLIVE);
dot.setDotStyle(DotStyle.DIAMOND);
txt.copy(r1);
ell.copy(r1);
circle.copy(r2);
dot.copy(r2);
bc.copy(r2);
pl.copy(r1);
pg.copy(r2);
tr.copy(r1);
rh.copy(r2);
plot.copy(r1);
carc.copy(r2);
sq.copy(r1);
fh.copy(r2);
sq.setFillingStyle(FillingStyle.GRAD);
shapes.addShape(r1);
shapes.addShape(txt);
shapes.addShape(grid);
shapes.addShape(pl);
shapes.addShape(pg);
shapes.addShape(r2);
shapes.addShape(axes);
shapes.addShape(ell);
shapes.addShape(circle);
shapes.addShape(tr);
shapes.addShape(rh);
shapes.addShape(dot);
shapes.addShape(bc);
shapes.addShape(plot);
shapes.addShape(carc);
shapes.addShape(sq);
shapes.addShape(fh);
}
Aggregations