Search in sources :

Example 76 with IPoint

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

the class LAbstractGrid method getTopRightPoint.

@Override
public IPoint getTopRightPoint() {
    final IPoint pos = getPosition();
    final double step = getStep();
    // FIXME strange: different from getTopLeftPoint and co. but works for scale.
    return ShapeFactory.INST.createPoint(pos.getX() + step * (getGridEndX() - getGridStartX()), pos.getY() - step * (getGridEndY() - getGridStartY()));
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint)

Example 77 with IPoint

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

the class LAbstractGrid method mirrorHorizontal.

@Override
public void mirrorHorizontal(final double x) {
    if (MathUtils.INST.isValidCoord(x)) {
        final IPoint bl = points.get(0).horizontalSymmetry(x);
        final IPoint br = getBottomRightPoint().horizontalSymmetry(x);
        points.get(0).setPoint(br.getX() < bl.getX() ? br.getX() : bl.getX(), br.getY());
    }
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint)

Example 78 with IPoint

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

the class LAbstractGrid method mirrorVertical.

@Override
public void mirrorVertical(final double y) {
    if (MathUtils.INST.isValidCoord(y)) {
        final IPoint bl = points.get(0).verticalSymmetry(y);
        final IPoint tl = getTopLeftPoint().verticalSymmetry(y);
        points.get(0).setPoint(bl.getX(), bl.getY() > tl.getY() ? bl.getY() : tl.getY());
    }
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint)

Example 79 with IPoint

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

the class LGroupShape method getFullBottomRightPoint.

@Override
default IPoint getFullBottomRightPoint() {
    final double gap = getBorderGap();
    final IPoint br = getBottomRightPoint();
    br.translate(gap, gap);
    return br;
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint)

Example 80 with IPoint

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

the class LLine method getTopLeftPoint.

@Override
public IPoint getTopLeftPoint() {
    final IPoint pt1 = getPoint1();
    final IPoint pt2 = getPoint2();
    return ShapeFactory.INST.createPoint(pt1.getX() < pt2.getX() ? pt1.getX() : pt2.getX(), pt1.getY() < pt2.getY() ? pt1.getY() : pt2.getY());
}
Also used : IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint)

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