Search in sources :

Example 1 with IArc

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

the class Border method updateArcHandlers.

private void updateArcHandlers(final IShape selectedShape) {
    if (selectedShape instanceof IArc) {
        final IArc arc = (IArc) selectedShape;
        arcHandlerStart.setCurrentArc(arc);
        arcHandlerEnd.setCurrentArc(arc);
        arcHandlerStart.setVisible(true);
        arcHandlerEnd.setVisible(true);
    } else {
        arcHandlerStart.setVisible(false);
        arcHandlerEnd.setVisible(false);
    }
}
Also used : IArc(net.sf.latexdraw.models.interfaces.shape.IArc)

Example 2 with IArc

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

the class TestParsingPswedge method testCoordinatesCm.

@Theory
public void testCoordinatesCm(final String cmd) {
    parser(cmd + "(35cm,20cm){.5cm}{10}{20}");
    IArc arc = getShapeAt(0);
    assertEquals(35d * IShape.PPC - .5 * IShape.PPC, arc.getPosition().getX(), 0.001);
    assertEquals((20d * IShape.PPC - .5 * IShape.PPC) * -1d, arc.getPosition().getY(), 0.001);
    assertEquals(.5 * IShape.PPC * 2d, arc.getWidth(), 0.0000001);
    assertEquals(.5 * IShape.PPC * 2d, arc.getHeight(), 0.0000001);
}
Also used : IArc(net.sf.latexdraw.models.interfaces.shape.IArc) Theory(org.junit.experimental.theories.Theory)

Example 3 with IArc

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

the class TestParsingPswedge method testMissingOrigin.

@Theory
public void testMissingOrigin(final String cmd) {
    parser(cmd + "{10}{10}{20}");
    IArc arc = getShapeAt(0);
    assertEquals(-10d * IShape.PPC, arc.getPosition().getX(), 0.0000001);
    assertEquals(-10d * IShape.PPC * -1d, arc.getPosition().getY(), 0.0000001);
    assertEquals(10d * IShape.PPC * 2d, arc.getWidth(), 0.0000001);
    assertEquals(10d * IShape.PPC * 2d, arc.getHeight(), 0.0000001);
}
Also used : IArc(net.sf.latexdraw.models.interfaces.shape.IArc) Theory(org.junit.experimental.theories.Theory)

Example 4 with IArc

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

the class TestParsingPswedge method testParse2CoordinatesFloat2.

@Theory
public void testParse2CoordinatesFloat2(final String cmd) {
    parser(cmd + "(35.5,50.5){1.25}{10}{20}");
    IArc arc = getShapeAt(0);
    assertEquals(35.5 * IShape.PPC - 1.25 * IShape.PPC, arc.getPosition().getX(), 0.001);
    assertEquals((50.5 * IShape.PPC - 1.25 * IShape.PPC) * -1d, arc.getPosition().getY(), 0.001);
    assertEquals(1.25 * IShape.PPC * 2d, arc.getWidth(), 0.0000001);
    assertEquals(1.25 * IShape.PPC * 2d, arc.getHeight(), 0.0000001);
}
Also used : IArc(net.sf.latexdraw.models.interfaces.shape.IArc) Theory(org.junit.experimental.theories.Theory)

Example 5 with IArc

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

the class TestParsingPswedge method testAngle1Angle2.

@Theory
public void testAngle1Angle2(final String cmd, @DoubleData(vals = { 100d, 200d, 20d, -200.15d }) final double angle1, @DoubleData(vals = { 100d, 200d, 20d, -200.15d }) final double angle2) {
    assumeThat(cmd, not(endsWith("psarcn")));
    parser(cmd + "{10}{" + angle1 + "}{" + angle2 + "}");
    IArc arc = getShapeAt(0);
    assertEquals(Math.toRadians(angle1), arc.getAngleStart(), 0.0000001);
    assertEquals(Math.toRadians(angle2), arc.getAngleEnd(), 0.0000001);
}
Also used : IArc(net.sf.latexdraw.models.interfaces.shape.IArc) Theory(org.junit.experimental.theories.Theory)

Aggregations

IArc (net.sf.latexdraw.models.interfaces.shape.IArc)17 Theory (org.junit.experimental.theories.Theory)12 Test (org.junit.Test)4