Search in sources :

Example 16 with IArrow

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

the class GenericViewArrow method updatePathDoubleLeftRightArrow.

default void updatePathDoubleLeftRightArrow(final boolean isShadow) {
    final IArrow arrow = getArrow();
    final double width = arrow.getArrowShapedWidth();
    final double length = arrow.getArrowLength() * width;
    final double inset = arrow.getArrowInset() * length;
    final double x;
    if (arrow.isInverted()) {
        x = 2d * length;
    } else {
        x = 0d;
    }
    updatePathArrow(x, 0d, x - length, -width / 2d, x - length - inset, 0d, x - length, width / 2d);
    updatePathArrow(x - length, 0d, x - 2d * length, -width / 2d, x - 2d * length - inset, 0d, x - 2d * length, width / 2d);
    final double x2 = x - length - inset;
    final double x2bis = x - 2d * length - inset;
    createMoveTo(x2, 0d);
    createLineTo(x2bis, 0d);
    setPathFill(createLineOrShadColBinding(isShadow));
    setPathStroke(createLineOrShadColBinding(isShadow));
    if (arrow.isInverted()) {
        setRotation180();
    }
}
Also used : IArrow(net.sf.latexdraw.models.interfaces.shape.IArrow)

Example 17 with IArrow

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

the class GenericViewArrow method updatePathBarIn.

default void updatePathBarIn(final IPoint pt1, final IPoint pt2, final boolean isShadow) {
    final IArrow arrow = getArrow();
    final double width = arrow.getBarShapedArrowWidth();
    final double lineWidth = arrow.getShape().getThickness();
    final double dec = isArrowInPositiveDirection(pt1, pt2) ? lineWidth / 2d : -lineWidth / 2d;
    createMoveTo(dec, -width / 2d);
    createLineTo(dec, width / 2d);
    setPathStrokeWidth(createFullThickBinding());
    setPathStroke(createLineOrShadColBinding(isShadow));
}
Also used : IArrow(net.sf.latexdraw.models.interfaces.shape.IArrow)

Example 18 with IArrow

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

the class ShapeArrowCustomiser method update.

@Override
protected void update(final IGroup shape) {
    if (shape.isTypeOf(IArrowable.class)) {
        setActivated(true);
        final IArrow arr1 = shape.getArrowAt(0);
        final IArrow arr2 = shape.getArrowAt(-1);
        final ArrowStyle arrStyle1 = arr1.getArrowStyle();
        final ArrowStyle arrStyle2 = arr2.getArrowStyle();
        arrowLeftCB.setValue(arrStyle1);
        arrowRightCB.setValue(arrStyle2);
        final boolean isArrow = arrStyle1.isArrow() || arrStyle2.isArrow();
        final boolean isDot = arrStyle1.isCircleDisk() || arrStyle2.isCircleDisk();
        final boolean isBar = arrStyle1.isBar() || arrStyle2.isBar();
        final boolean isSBracket = arrStyle1.isSquareBracket() || arrStyle2.isSquareBracket();
        final boolean isRBracket = arrStyle1.isRoundBracket() || arrStyle2.isRoundBracket();
        // Updating the visibility of the widgets.
        arrowPane.setVisible(isArrow);
        dotPane.setVisible(isDot);
        barPane.setVisible(isBar || isSBracket || isRBracket);
        bracketPane.setVisible(isSBracket);
        rbracketPane.setVisible(isRBracket);
        // Updating the value of the widgets.
        if (isArrow) {
            arrowInset.getValueFactory().setValue(arr1.getArrowInset());
            arrowLength.getValueFactory().setValue(arr1.getArrowLength());
            arrowSizeDim.getValueFactory().setValue(arr1.getArrowSizeDim());
            arrowSizeNum.getValueFactory().setValue(arr1.getArrowSizeNum());
        }
        if (isDot) {
            dotSizeNum.getValueFactory().setValue(arr1.getDotSizeNum());
            dotSizeDim.getValueFactory().setValue(arr1.getDotSizeDim());
        }
        if (isBar || isSBracket || isRBracket) {
            tbarsizeDim.getValueFactory().setValue(arr1.getTBarSizeDim());
            tbarsizeNum.getValueFactory().setValue(arr1.getTBarSizeNum());
        }
        if (isSBracket) {
            bracketNum.getValueFactory().setValue(arr1.getBracketNum());
        }
        if (isRBracket) {
            rbracketNum.getValueFactory().setValue(arr1.getRBracketNum());
        }
    } else {
        setActivated(false);
    }
}
Also used : ArrowStyle(net.sf.latexdraw.models.interfaces.shape.ArrowStyle) IArrow(net.sf.latexdraw.models.interfaces.shape.IArrow)

Aggregations

IArrow (net.sf.latexdraw.models.interfaces.shape.IArrow)18 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)3 SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)2 Arc (javafx.scene.shape.Arc)1 ArrowStyle (net.sf.latexdraw.models.interfaces.shape.ArrowStyle)1 Color (net.sf.latexdraw.models.interfaces.shape.Color)1 ICircleArc (net.sf.latexdraw.models.interfaces.shape.ICircleArc)1 ILine (net.sf.latexdraw.models.interfaces.shape.ILine)1 IPolyline (net.sf.latexdraw.models.interfaces.shape.IPolyline)1 SVGGElement (net.sf.latexdraw.parsers.svg.SVGGElement)1 Test (org.junit.Test)1