Search in sources :

Example 21 with IPolyline

use of net.sf.latexdraw.models.interfaces.shape.IPolyline in project latexdraw by arnobl.

the class TestParsingPsline method testCoordinatesCm.

@Test
public void testCoordinatesCm() {
    parser("\\psline(35cm,20cm)(1.2cm,2cm)");
    final IPolyline line = (IPolyline) listener.getShapes().get(0);
    assertEquals(35d * IShape.PPC, line.getPtAt(0).getX(), 0.0001);
    assertEquals(-20d * IShape.PPC, line.getPtAt(0).getY(), 0.0001);
    assertEquals(1.2 * IShape.PPC, line.getPtAt(1).getX(), 0.0001);
    assertEquals(-2d * IShape.PPC, line.getPtAt(1).getY(), 0.0001);
}
Also used : IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) Test(org.junit.Test)

Example 22 with IPolyline

use of net.sf.latexdraw.models.interfaces.shape.IPolyline in project latexdraw by arnobl.

the class TestParsingQline method testCoordinatesCm.

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

Example 23 with IPolyline

use of net.sf.latexdraw.models.interfaces.shape.IPolyline in project latexdraw by arnobl.

the class TestParsingQline method testMustNotBeFilled.

@Test
public void testMustNotBeFilled() {
    parser("\\qline(35cm,20cm)(11.12cm,-2cm)");
    final IPolyline line = getShapeAt(0);
    assertEquals(FillingStyle.NONE, line.getFillingStyle());
}
Also used : IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) Test(org.junit.Test)

Example 24 with IPolyline

use of net.sf.latexdraw.models.interfaces.shape.IPolyline 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 IPolyline line = getShapeAt(0);
    assertFalse(line.hasShadow());
}
Also used : IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) Test(org.junit.Test)

Example 25 with IPolyline

use of net.sf.latexdraw.models.interfaces.shape.IPolyline in project latexdraw by arnobl.

the class TestIPolyline method testConstructor.

@Test
public void testConstructor() {
    final IPoint pt1 = ShapeFactory.INST.createPoint(1, 1);
    final IPoint pt2 = ShapeFactory.INST.createPoint(2, 2);
    final IPolyline pol = ShapeFactory.INST.createPolyline(Arrays.asList(pt1, pt2));
    assertEquals(pt1, pol.getPtAt(0));
    assertEquals(pt2, pol.getPtAt(-1));
}
Also used : IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)25 Test (org.junit.Test)17 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)4 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)3 HelperTest (net.sf.latexdraw.HelperTest)2 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)2 ICircle (net.sf.latexdraw.models.interfaces.shape.ICircle)2 IFreehand (net.sf.latexdraw.models.interfaces.shape.IFreehand)2 IModifiablePointsShape (net.sf.latexdraw.models.interfaces.shape.IModifiablePointsShape)2 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)2 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)2 SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Function (java.util.function.Function)1 Platform (javafx.application.Platform)1 ObjectProperty (javafx.beans.property.ObjectProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 Point2D (javafx.geometry.Point2D)1