Search in sources :

Example 11 with Polyline

use of net.sf.latexdraw.model.api.shape.Polyline in project latexdraw by arnobl.

the class TestPolyline method testIsTypeOf.

@Test
public void testIsTypeOf() {
    final Polyline shape = ShapeFactory.INST.createPolyline(Collections.emptyList());
    assertFalse(shape.isTypeOf(Rectangle.class));
    assertFalse(shape.isTypeOf(Circle.class));
    assertTrue(shape.isTypeOf(Shape.class));
    assertTrue(shape.isTypeOf(ModifiablePointsShape.class));
    assertTrue(shape.isTypeOf(Polygon.class));
    assertTrue(shape.isTypeOf(Polyline.class));
    assertTrue(shape.isTypeOf(shape.getClass()));
}
Also used : Circle(net.sf.latexdraw.model.api.shape.Circle) ModifiablePointsShape(net.sf.latexdraw.model.api.shape.ModifiablePointsShape) Shape(net.sf.latexdraw.model.api.shape.Shape) Polyline(net.sf.latexdraw.model.api.shape.Polyline) Rectangle(net.sf.latexdraw.model.api.shape.Rectangle) ModifiablePointsShape(net.sf.latexdraw.model.api.shape.ModifiablePointsShape) Polygon(net.sf.latexdraw.model.api.shape.Polygon) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 12 with Polyline

use of net.sf.latexdraw.model.api.shape.Polyline in project latexdraw by arnobl.

the class TestParsingQline method testNoDbleBord.

@Test
public void testNoDbleBord() {
    parser("\\psset{doubleline=true}\\qline(35cm,20cm)(11.12cm,-2cm)");
    final Polyline line = getShapeAt(0);
    assertFalse(line.hasDbleBord());
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Example 13 with Polyline

use of net.sf.latexdraw.model.api.shape.Polyline in project latexdraw by arnobl.

the class TestParsingQline method testNoShadow.

@Test
public void testNoShadow() {
    parser("\\psset{shadow=true}\\qline(35cm,20cm)(11.12cm,-2cm)");
    final Polyline line = getShapeAt(0);
    assertFalse(line.hasShadow());
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Example 14 with Polyline

use of net.sf.latexdraw.model.api.shape.Polyline in project latexdraw by arnobl.

the class TestParsingQline method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\qline(35cm,20cm)(11.12cm,-2cm)");
    final Polyline line = getShapeAt(0);
    assertEquals(2, line.getNbPoints());
    assertEquals(35d * Shape.PPC, line.getPtAt(0).getX(), 0.001);
    assertEquals(20d * Shape.PPC * -1d, line.getPtAt(0).getY(), 0.001);
    assertEquals(11.12 * Shape.PPC, line.getPtAt(1).getX(), 0.001);
    assertEquals(-2d * Shape.PPC * -1d, line.getPtAt(1).getY(), 0.001);
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Example 15 with Polyline

use of net.sf.latexdraw.model.api.shape.Polyline in project latexdraw by arnobl.

the class TestParsingPsline method testFloatSigns.

@Test
public void testFloatSigns() {
    parser("\\psline(+++35.5,--50.5)(--+12, -1)");
    final Polyline line = (Polyline) parsedShapes.get(0);
    assertEquals(35.5 * Shape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-50.5 * Shape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(12d * Shape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(1d * Shape.PPC, line.getPtAt(1).getY(), 0.0001);
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Aggregations

Polyline (net.sf.latexdraw.model.api.shape.Polyline)21 Test (org.junit.jupiter.api.Test)14 Point (net.sf.latexdraw.model.api.shape.Point)3 Polygon (net.sf.latexdraw.model.api.shape.Polygon)3 Test (org.junit.Test)3 HelperTest (net.sf.latexdraw.HelperTest)2 BezierCurve (net.sf.latexdraw.model.api.shape.BezierCurve)2 Circle (net.sf.latexdraw.model.api.shape.Circle)2 Freehand (net.sf.latexdraw.model.api.shape.Freehand)2 ModifiablePointsShape (net.sf.latexdraw.model.api.shape.ModifiablePointsShape)2 Rectangle (net.sf.latexdraw.model.api.shape.Rectangle)2 Shape (net.sf.latexdraw.model.api.shape.Shape)2 NotNull (org.jetbrains.annotations.NotNull)2 Click (io.github.interacto.jfx.interaction.library.Click)1 DnD (io.github.interacto.jfx.interaction.library.DnD)1 MultiClick (io.github.interacto.jfx.interaction.library.MultiClick)1 PointsData (io.github.interacto.jfx.interaction.library.PointsData)1 Press (io.github.interacto.jfx.interaction.library.Press)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1