Search in sources :

Example 96 with IPoint

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

the class LGroup method setGridEndList.

@Override
public void setGridEndList(final List<IPoint> values) {
    if (values != null && values.size() == shapes.size()) {
        IntStream.range(0, values.size()).forEach(i -> {
            final IShape sh = shapes.get(i);
            final IPoint pt = values.get(i);
            if (pt != null && sh instanceof IStdGridProp) {
                ((IStdGridProp) sh).setGridEnd(pt.getX(), pt.getY());
            }
        });
    }
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) IShape(net.sf.latexdraw.models.interfaces.shape.IShape) IStdGridProp(net.sf.latexdraw.models.interfaces.prop.IStdGridProp)

Example 97 with IPoint

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

the class TestBorder method testScaleWRectangle.

@Test
public void testScaleWRectangle() {
    new CompositeGUIVoidCommand(addRec, waitFXEvents, selectAllShapes).execute();
    final double width = addedRec.getWidth();
    final double height = addedRec.getHeight();
    final IPoint tl = addedRec.getTopLeftPoint();
    tl.translate(50d, 0d);
    drag(border.scaleHandlers.get(3)).dropBy(50d, 10d);
    waitFXEvents.execute();
    assertEquals(height, addedRec.getHeight(), 0.001);
    assertEquals(width - 50d, addedRec.getWidth(), 3d);
    assertEquals(tl.getX(), addedRec.getTopLeftPoint().getX(), 2d);
    assertEquals(tl.getY(), addedRec.getTopLeftPoint().getY(), 2d);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test)

Example 98 with IPoint

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

the class TestBorder method testScaleERectangle.

@Test
public void testScaleERectangle() {
    new CompositeGUIVoidCommand(addRec, waitFXEvents, selectAllShapes).execute();
    final double width = addedRec.getWidth();
    final double height = addedRec.getHeight();
    final IPoint tr = addedRec.getTopRightPoint();
    tr.translate(50d, 0d);
    drag(border.scaleHandlers.get(4)).dropBy(50d, 10d);
    waitFXEvents.execute();
    assertEquals(height, addedRec.getHeight(), 0.001);
    assertEquals(width + 50d, addedRec.getWidth(), 3d);
    assertEquals(tr.getX(), addedRec.getTopRightPoint().getX(), 2d);
    assertEquals(tr.getY(), addedRec.getTopRightPoint().getY(), 2d);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test)

Example 99 with IPoint

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

the class TestBorder method testScaleSRectangle.

@Test
public void testScaleSRectangle() {
    new CompositeGUIVoidCommand(addRec, waitFXEvents, selectAllShapes).execute();
    final double width = addedRec.getWidth();
    final double height = addedRec.getHeight();
    final IPoint bl = addedRec.getBottomLeftPoint();
    bl.translate(0d, 50d);
    drag(border.scaleHandlers.get(6)).dropBy(30d, 50d);
    waitFXEvents.execute();
    assertEquals(width, addedRec.getWidth(), 0.001);
    assertEquals(height + 50d, addedRec.getHeight(), 3d);
    assertEquals(bl.getX(), addedRec.getBottomLeftPoint().getX(), 3d);
    assertEquals(bl.getY(), addedRec.getBottomLeftPoint().getY(), 3d);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test)

Example 100 with IPoint

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

the class TestBorder method testScaleSORectangle.

@Test
public void testScaleSORectangle() {
    new CompositeGUIVoidCommand(addRec, waitFXEvents, selectAllShapes).execute();
    final double width = addedRec.getWidth();
    final double height = addedRec.getHeight();
    final IPoint bl = addedRec.getBottomLeftPoint();
    bl.translate(50d, 70d);
    drag(border.scaleHandlers.get(5)).dropBy(50d, 70d);
    waitFXEvents.execute();
    assertEquals(width - 50d, addedRec.getWidth(), 3d);
    assertEquals(height + 70d, addedRec.getHeight(), 3d);
    assertEquals(bl.getX(), addedRec.getBottomLeftPoint().getX(), 3d);
    assertEquals(bl.getY(), addedRec.getBottomLeftPoint().getY(), 3d);
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint) Test(org.junit.Test)

Aggregations

IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)191 Test (org.junit.Test)45 HelperTest (net.sf.latexdraw.HelperTest)25 Theory (org.junit.experimental.theories.Theory)21 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)15 SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)11 SVGGElement (net.sf.latexdraw.parsers.svg.SVGGElement)11 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)10 ILine (net.sf.latexdraw.models.interfaces.shape.ILine)10 IBezierCurve (net.sf.latexdraw.models.interfaces.shape.IBezierCurve)9 IGroup (net.sf.latexdraw.models.interfaces.shape.IGroup)9 ArrayList (java.util.ArrayList)8 MathUtils (net.sf.latexdraw.models.MathUtils)8 Collections (java.util.Collections)7 IPolygon (net.sf.latexdraw.models.interfaces.shape.IPolygon)7 Arrays (java.util.Arrays)6 Cursor (javafx.scene.Cursor)6 BorderPos (net.sf.latexdraw.models.interfaces.shape.BorderPos)6 IModifiablePointsShape (net.sf.latexdraw.models.interfaces.shape.IModifiablePointsShape)6 Inject (net.sf.latexdraw.util.Inject)6