Search in sources :

Example 6 with IPolyline

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

the class TestParsingPsline method testCoordinatesFloat2.

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

Example 7 with IPolyline

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

the class TestParsingPsline method testBugTwoSameArrows.

@Test
public void testBugTwoSameArrows() {
    parser("\\psline{<-<}(-0.1,-0.2)(2,5)");
    final IPolyline sh = (IPolyline) listener.getShapes().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 : IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) Test(org.junit.Test)

Example 8 with IPolyline

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

the class TestParsingPsline method testCoordinatesPt.

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

Example 9 with IPolyline

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

Example 10 with IPolyline

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

the class TestIPolyline method testIsTypeOf.

@Test
public void testIsTypeOf() {
    final IPolyline shape = ShapeFactory.INST.createPolyline(Collections.emptyList());
    assertFalse(shape.isTypeOf(null));
    assertFalse(shape.isTypeOf(IRectangle.class));
    assertFalse(shape.isTypeOf(ICircle.class));
    assertTrue(shape.isTypeOf(IShape.class));
    assertTrue(shape.isTypeOf(IModifiablePointsShape.class));
    assertTrue(shape.isTypeOf(IPolygon.class));
    assertTrue(shape.isTypeOf(IPolyline.class));
    assertTrue(shape.isTypeOf(shape.getClass()));
}
Also used : ICircle(net.sf.latexdraw.models.interfaces.shape.ICircle) IModifiablePointsShape(net.sf.latexdraw.models.interfaces.shape.IModifiablePointsShape) IPolyline(net.sf.latexdraw.models.interfaces.shape.IPolyline) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) IPolygon(net.sf.latexdraw.models.interfaces.shape.IPolygon) IRectangle(net.sf.latexdraw.models.interfaces.shape.IRectangle) 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