Search in sources :

Example 1 with PlottingStyle

use of net.sf.latexdraw.models.interfaces.shape.PlottingStyle 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 PlottingStyle

use of net.sf.latexdraw.models.interfaces.shape.PlottingStyle 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 PlottingStyle

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

the class TestPencilAxesStyle method testSelectShowLabelsPencil.

@Test
public void testSelectShowLabelsPencil() {
    new CompositeGUIVoidCommand(activatePencil, pencilCreatesAxes, updateIns).execute();
    PlottingStyle style = showLabels.getSelectionModel().getSelectedItem();
    selectPlotLabel.execute();
    PlottingStyle newStyle = showLabels.getSelectionModel().getSelectedItem();
    assertEquals(newStyle, ((IAxesProp) pencil.createShapeInstance()).getLabelsDisplayed());
    assertNotEquals(style, newStyle);
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) PlottingStyle(net.sf.latexdraw.models.interfaces.shape.PlottingStyle) Test(org.junit.Test)

Example 4 with PlottingStyle

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

the class TestHandAxeStyle method testSelectShowTicksSelection.

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

Example 5 with PlottingStyle

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

the class TestPencilAxesStyle method testSelectShowTicksPencil.

@Test
public void testSelectShowTicksPencil() {
    new CompositeGUIVoidCommand(activatePencil, pencilCreatesAxes, updateIns).execute();
    PlottingStyle style = showTicks.getSelectionModel().getSelectedItem();
    selectPlotTicks.execute();
    PlottingStyle newStyle = showTicks.getSelectionModel().getSelectedItem();
    assertEquals(newStyle, ((IAxesProp) pencil.createShapeInstance()).getTicksDisplayed());
    assertNotEquals(style, newStyle);
}
Also used : CompositeGUIVoidCommand(net.sf.latexdraw.instruments.CompositeGUIVoidCommand) PlottingStyle(net.sf.latexdraw.models.interfaces.shape.PlottingStyle) Test(org.junit.Test)

Aggregations

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