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);
}
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);
}
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));
}
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);
}
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);
}
Aggregations