Search in sources :

Example 16 with Polyline

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

the class TestParsingPsline method testCoordinatesInch.

@Test
public void testCoordinatesInch() {
    parser("\\psline(35in,20in)(1.2in,0.2in)");
    final Polyline line = (Polyline) parsedShapes.get(0);
    assertEquals(35d * Shape.PPC / 2.54, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20d * Shape.PPC / 2.54, line.getPtAt(0).getY(), 0.0001);
    assertEquals(1.2 * Shape.PPC / 2.54, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-0.2 * Shape.PPC / 2.54, line.getPtAt(1).getY(), 0.0001);
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Example 17 with Polyline

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

the class TestParsingPsline method testMoreThanTwoPointsCoordinates.

@Test
public void testMoreThanTwoPointsCoordinates() {
    parser("\\psline(5,10)(6, 7) (1, 2) % foo \n(3, \t4)");
    final Polyline line = (Polyline) parsedShapes.get(0);
    assertEquals(4, line.getNbPoints());
    assertEquals(5d * Shape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-10d * Shape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(6d * Shape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-7d * Shape.PPC, line.getPtAt(1).getY(), 0.0001);
    assertEquals(1d * Shape.PPC, line.getPtAt(2).getX(), 0.0001);
    assertEquals(-2d * Shape.PPC, line.getPtAt(2).getY(), 0.0001);
    assertEquals(3d * Shape.PPC, line.getPtAt(3).getX(), 0.0001);
    assertEquals(-4d * Shape.PPC, line.getPtAt(3).getY(), 0.0001);
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Example 18 with Polyline

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

the class TestParsingPsline method testBugTwoSameArrows.

@Test
public void testBugTwoSameArrows() {
    parser("\\psline{<-<}(-0.1,-0.2)(2,5)");
    final Polyline sh = (Polyline) parsedShapes.get(0);
    assertEquals(ArrowStyle.LEFT_ARROW, sh.getArrowAt(0).getArrowStyle());
    assertEquals(ArrowStyle.LEFT_ARROW, sh.getArrowAt(1).getArrowStyle());
    assertNotEquals(sh.getArrowAt(0), sh.getArrowAt(1));
}
Also used : Polyline(net.sf.latexdraw.model.api.shape.Polyline) Test(org.junit.jupiter.api.Test)

Example 19 with Polyline

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

the class TestParsingPsline method testCoordinatesCm.

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

Example 20 with Polyline

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

the class TestParsingPsline method testCoordinatesPt.

@Test
public void testCoordinatesPt() {
    parser("\\psline(35pt,20pt)(10pt,5pt)");
    final Polyline line = (Polyline) parsedShapes.get(0);
    assertEquals(2, line.getNbPoints());
    assertEquals(35d * Shape.PPC / PSTricksConstants.CM_VAL_PT, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20d * Shape.PPC / PSTricksConstants.CM_VAL_PT, line.getPtAt(0).getY(), 0.0001);
    assertEquals(10d * Shape.PPC / PSTricksConstants.CM_VAL_PT, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-5d * Shape.PPC / PSTricksConstants.CM_VAL_PT, 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