Search in sources :

Example 16 with ILine

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

the class ViewArrow method updatePath.

@Override
public void updatePath(final boolean isShadow) {
    path.setStrokeLineCap(StrokeLineCap.BUTT);
    path.getElements().clear();
    path.fillProperty().unbind();
    path.strokeWidthProperty().unbind();
    path.getTransforms().clear();
    ellipse.getTransforms().clear();
    arc.getTransforms().clear();
    GenericViewArrow.super.updatePath(isShadow);
    final ILine line = arrow.getArrowLine();
    final double lineAngle = (-line.getLineAngle() + Math.PI * 2d) % (Math.PI * 2d);
    if (arrow.getArrowStyle() != ArrowStyle.NONE && !MathUtils.INST.equalsDouble(lineAngle, 0d)) {
        final Rotate rotate = new Rotate(Math.toDegrees(lineAngle), 0d, 0d);
        path.getTransforms().add(rotate);
        ellipse.getTransforms().add(rotate);
        arc.getTransforms().add(rotate);
    }
}
Also used : Rotate(javafx.scene.transform.Rotate) ILine(net.sf.latexdraw.models.interfaces.shape.ILine)

Example 17 with ILine

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

the class TestILine method testGetPerpendicularLineVert.

@Test
public void testGetPerpendicularLineVert() {
    line.setLine(0, 10, 0, -10);
    line.updateAandB();
    ILine line2 = line.getPerpendicularLine(ShapeFactory.INST.createPoint());
    assertNotNull(line2);
    assertEqualsDouble(0d, line2.getY1());
    assertEqualsDouble(0d, line2.getY2());
}
Also used : ILine(net.sf.latexdraw.models.interfaces.shape.ILine) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 18 with ILine

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

the class TestILine method testGetIntersection.

@Test
public void testGetIntersection() {
    ILine line2 = ShapeFactory.INST.createLine(72, -981, 0, 0);
    line.setLine(-237, 17, 13, -82);
    line.updateAandB();
    IPoint pt = line.getIntersection(line2);
    assertNotNull(pt);
    assertEqualsDouble(5.809358228, pt.getX());
    assertEqualsDouble(-79.152505858, pt.getY());
}
Also used : ILine(net.sf.latexdraw.models.interfaces.shape.ILine) IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 19 with ILine

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

the class TestILine method testGetIntersectionHoriz.

@Test
public void testGetIntersectionHoriz() {
    ILine line2 = ShapeFactory.INST.createLine(0, 0, 1, 0);
    line.setLine(0, -10, 0, 10);
    line.updateAandB();
    IPoint pt = line2.getIntersection(line);
    assertNotNull(pt);
    assertEqualsDouble(0d, pt.getX());
    assertEqualsDouble(0d, pt.getY());
}
Also used : ILine(net.sf.latexdraw.models.interfaces.shape.ILine) IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Example 20 with ILine

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

the class TestILine method testGetIntersectionSegment.

@Test
public void testGetIntersectionSegment() {
    ILine line2 = ShapeFactory.INST.createLine(0, 0, 1, 0);
    line.setLine(1, 1, 0, -1);
    line.updateAandB();
    IPoint pt = line.getIntersectionSegment(line2);
    assertNotNull(pt);
    assertEqualsDouble(0.5, pt.getX());
    assertEqualsDouble(0d, pt.getY());
}
Also used : ILine(net.sf.latexdraw.models.interfaces.shape.ILine) IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test) HelperTest(net.sf.latexdraw.HelperTest)

Aggregations

ILine (net.sf.latexdraw.models.interfaces.shape.ILine)21 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)10 Test (org.junit.Test)10 HelperTest (net.sf.latexdraw.HelperTest)7 Theory (org.junit.experimental.theories.Theory)4 LinearGradient (javafx.scene.paint.LinearGradient)1 Stop (javafx.scene.paint.Stop)1 Rotate (javafx.scene.transform.Rotate)1 IArrow (net.sf.latexdraw.models.interfaces.shape.IArrow)1 SVGMarkerElement (net.sf.latexdraw.parsers.svg.SVGMarkerElement)1