Search in sources :

Example 1 with TicksStyle

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

the class GenericAxes method updatePathLabels.

default void updatePathLabels() {
    final IAxes model = getModel();
    // NON-NLS
    final Font font = new Font("cmr10", model.getLabelsSize());
    final PlottingStyle labelsDisplay = model.getLabelsDisplayed();
    final PlottingStyle ticksDisplay = model.getTicksDisplayed();
    final TicksStyle ticksStyle = model.getTicksStyle();
    // This fake text is used to compute widths and heights and other font metrics of a current text.
    // NON-NLS
    final Text fooText = new Text("foo");
    fooText.setFont(font);
    if (labelsDisplay.isX()) {
        updatePathLabelsX(ticksDisplay, ticksStyle, fooText);
    }
    if (labelsDisplay.isY()) {
        updatePathLabelsY(ticksDisplay, ticksStyle, fooText);
    }
}
Also used : TicksStyle(net.sf.latexdraw.models.interfaces.shape.TicksStyle) PlottingStyle(net.sf.latexdraw.models.interfaces.shape.PlottingStyle) IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes) Text(javafx.scene.text.Text) Font(javafx.scene.text.Font)

Example 2 with TicksStyle

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

the class GenericAxes method updatePathTicks.

default void updatePathTicks() {
    final IAxes model = getModel();
    final PlottingStyle ticksDisplay = model.getTicksDisplayed();
    final TicksStyle ticksStyle = model.getTicksStyle();
    final double tickLgth = ticksStyle == TicksStyle.FULL ? model.getTicksSize() * 2d : model.getTicksSize();
    if (ticksDisplay.isX()) {
        updatePathTicksX(getGapX(), ticksStyle, tickLgth);
    }
    if (ticksDisplay.isY()) {
        updatePathTicksY(getGapY(), ticksStyle, tickLgth);
    }
    disablePathTicks(!ticksDisplay.isX() && !ticksDisplay.isY());
    setPathTicksFill(Color.BLACK);
}
Also used : TicksStyle(net.sf.latexdraw.models.interfaces.shape.TicksStyle) PlottingStyle(net.sf.latexdraw.models.interfaces.shape.PlottingStyle) IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes)

Example 3 with TicksStyle

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

the class TestPencilAxesStyle method testSelectTicksStylePencil.

@Test
public void testSelectTicksStylePencil() {
    new CompositeGUIVoidCommand(activatePencil, pencilCreatesAxes, updateIns).execute();
    TicksStyle style = shapeTicks.getSelectionModel().getSelectedItem();
    selectTicksStyle.execute();
    TicksStyle newStyle = shapeTicks.getSelectionModel().getSelectedItem();
    assertEquals(newStyle, ((IAxesProp) pencil.createShapeInstance()).getTicksStyle());
    assertNotEquals(style, newStyle);
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) TicksStyle(net.sf.latexdraw.models.interfaces.shape.TicksStyle) Test(org.junit.Test)

Example 4 with TicksStyle

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

the class TestHandAxeStyle method testSelectTicksStyleSelection.

@Test
public void testSelectTicksStyleSelection() {
    new CompositeGUIVoidCommand(activateHand, selectionAddAxes, selectionAddRec, selectionAddAxes, updateIns).execute();
    TicksStyle style = shapeTicks.getSelectionModel().getSelectedItem();
    selectTicksStyle.execute();
    TicksStyle newStyle = shapeTicks.getSelectionModel().getSelectedItem();
    assertEquals(newStyle, ((IAxesProp) drawing.getSelection().getShapeAt(0)).getTicksStyle());
    assertEquals(newStyle, ((IAxesProp) drawing.getSelection().getShapeAt(2)).getTicksStyle());
    assertNotEquals(style, newStyle);
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) TicksStyle(net.sf.latexdraw.models.interfaces.shape.TicksStyle) Test(org.junit.Test)

Aggregations

TicksStyle (net.sf.latexdraw.models.interfaces.shape.TicksStyle)4 CompositeGUIVoidCommand (net.sf.latexdraw.instruments.CompositeGUIVoidCommand)2 IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)2 PlottingStyle (net.sf.latexdraw.models.interfaces.shape.PlottingStyle)2 Test (org.junit.Test)2 Font (javafx.scene.text.Font)1 Text (javafx.scene.text.Text)1