Search in sources :

Example 1 with DotStyle

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

the class ViewDot method updateDot.

private void updateDot() {
    final DotStyle dotStyle = model.getDotStyle();
    path.setVisible(dotStyle != DotStyle.DOT && dotStyle != DotStyle.O);
    dot.setVisible(dotStyle == DotStyle.DOT || dotStyle == DotStyle.O || dotStyle == DotStyle.OPLUS || dotStyle == DotStyle.OTIMES);
    path.getElements().clear();
    setStroke();
    setFill();
    switch(dotStyle) {
        case ASTERISK:
            setPathAsterisk();
            break;
        case BAR:
            setPathBar();
            break;
        case DIAMOND:
            setPathDiamond();
            break;
        case O:
        case DOT:
            setPathO();
            break;
        case FDIAMOND:
            setPathDiamond();
            break;
        case PENTAGON:
        case FPENTAGON:
            setPathPentagon();
            break;
        case SQUARE:
        case FSQUARE:
            setPathSquare();
            break;
        case TRIANGLE:
        case FTRIANGLE:
            setPathTriangle();
            break;
        case OPLUS:
            setPathOPlus();
            break;
        case OTIMES:
            setPathOTime();
            break;
        case PLUS:
            setPathPlus();
            break;
        case X:
            setPathX();
            break;
        default:
    }
}
Also used : DotStyle(net.sf.latexdraw.models.interfaces.shape.DotStyle)

Example 2 with DotStyle

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

the class TestHandDotStyle method testSelectDotStyleSelection.

@Test
public void testSelectDotStyleSelection() {
    new CompositeGUIVoidCommand(activateHand, selectionAddDot, selectionAddRec, selectionAddDot, updateIns).execute();
    DotStyle style = dotCB.getSelectionModel().getSelectedItem();
    selectNextDotStyle.execute();
    DotStyle newStyle = dotCB.getSelectionModel().getSelectedItem();
    assertEquals(newStyle, ((IDot) drawing.getSelection().getShapeAt(0)).getDotStyle());
    assertEquals(newStyle, ((IDot) drawing.getSelection().getShapeAt(2)).getDotStyle());
    assertNotEquals(style, newStyle);
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) DotStyle(net.sf.latexdraw.models.interfaces.shape.DotStyle) Test(org.junit.Test)

Example 3 with DotStyle

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

the class ShapeDotCustomiser method initialize.

@Override
public void initialize(final URL location, final ResourceBundle resources) {
    mainPane.managedProperty().bind(mainPane.visibleProperty());
    final Map<DotStyle, Image> cache = new EnumMap<>(DotStyle.class);
    // NON-NLS
    cache.put(DotStyle.DOT, new Image("/res/dotStyles/dot.none.png"));
    // NON-NLS
    cache.put(DotStyle.ASTERISK, new Image("/res/dotStyles/dot.asterisk.png"));
    // NON-NLS
    cache.put(DotStyle.BAR, new Image("/res/dotStyles/dot.bar.png"));
    // NON-NLS
    cache.put(DotStyle.DIAMOND, new Image("/res/dotStyles/dot.diamond.png"));
    // NON-NLS
    cache.put(DotStyle.FDIAMOND, new Image("/res/dotStyles/dot.diamondF.png"));
    // NON-NLS
    cache.put(DotStyle.O, new Image("/res/dotStyles/dot.o.png"));
    // NON-NLS
    cache.put(DotStyle.OPLUS, new Image("/res/dotStyles/dot.oplus.png"));
    // NON-NLS
    cache.put(DotStyle.OTIMES, new Image("/res/dotStyles/dot.ocross.png"));
    // NON-NLS
    cache.put(DotStyle.PLUS, new Image("/res/dotStyles/dot.plus.png"));
    // NON-NLS
    cache.put(DotStyle.X, new Image("/res/dotStyles/dot.cross.png"));
    // NON-NLS
    cache.put(DotStyle.TRIANGLE, new Image("/res/dotStyles/dot.triangle.png"));
    // NON-NLS
    cache.put(DotStyle.FTRIANGLE, new Image("/res/dotStyles/dot.triangleF.png"));
    // NON-NLS
    cache.put(DotStyle.PENTAGON, new Image("/res/dotStyles/dot.pentagon.png"));
    // NON-NLS
    cache.put(DotStyle.FPENTAGON, new Image("/res/dotStyles/dot.pentagonF.png"));
    // NON-NLS
    cache.put(DotStyle.SQUARE, new Image("/res/dotStyles/dot.square.png"));
    // NON-NLS
    cache.put(DotStyle.FSQUARE, new Image("/res/dotStyles/dot.squareF.png"));
    initComboBox(dotCB, cache, DotStyle.values());
}
Also used : DotStyle(net.sf.latexdraw.models.interfaces.shape.DotStyle) Image(javafx.scene.image.Image) EnumMap(java.util.EnumMap)

Example 4 with DotStyle

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

the class PSTDotView method getCode.

@Override
public String getCode(final IPoint origin, final float ppc) {
    final double x = shape.getX() - origin.getX();
    final double y = origin.getY() - shape.getY();
    final DotStyle style = shape.getDotStyle();
    final StringBuilder params = getPropertiesCode(ppc);
    final StringBuilder rotation = getRotationHeaderCode(ppc, origin);
    final StringBuilder code = new StringBuilder();
    if (style != DotStyle.DOT)
        // $NON-NLS-1$
        params.append(", dotstyle=").append(style.getPSTToken());
    // $NON-NLS-1$
    params.append(", dotsize=").append((float) MathUtils.INST.getCutNumber(shape.getDiametre() / ppc));
    if (rotation != null)
        code.append(rotation);
    // $NON-NLS-1$
    code.append("\\psdots[");
    code.append(params);
    if (shape.isFillable())
        code.append(", fillcolor=").append(getColourName(shape.getFillingCol()));
    code.append(']').append('(');
    code.append(MathUtils.INST.getCutNumberFloat(x / ppc)).append(',');
    code.append(MathUtils.INST.getCutNumberFloat(y / ppc)).append(')');
    if (rotation != null)
        code.append('}');
    return code.toString();
}
Also used : DotStyle(net.sf.latexdraw.models.interfaces.shape.DotStyle)

Aggregations

DotStyle (net.sf.latexdraw.models.interfaces.shape.DotStyle)4 EnumMap (java.util.EnumMap)1 Image (javafx.scene.image.Image)1 CompositeGUIVoidCommand (net.sf.latexdraw.instruments.CompositeGUIVoidCommand)1 Test (org.junit.Test)1