use of net.sf.latexdraw.models.interfaces.shape.IAxes in project latexdraw by arnobl.
the class TestParsingPsaxes method testParamDx.
@Theory
public void testParamDx(@DoubleData(vals = { 2d, 3.5 }) final double dx) {
parser("\\psaxes[Dx=" + dx + "](0,0)(0,0)(2,2)");
final IAxes axes = getShapeAt(0);
assertEquals(dx, axes.getIncrementX(), 0.00001);
}
use of net.sf.latexdraw.models.interfaces.shape.IAxes in project latexdraw by arnobl.
the class TestParsingPsaxes method testLabelsStyle.
@Theory
public void testLabelsStyle(final PlottingStyle style) {
parser("\\psaxes[labels=" + style.getPSTToken() + "](0,0)(0,0)(2,2)");
final IAxes axes = getShapeAt(0);
assertEquals(style, axes.getLabelsDisplayed());
}
use of net.sf.latexdraw.models.interfaces.shape.IAxes in project latexdraw by arnobl.
the class TestIAxes method testDuplicate.
@Test
public void testDuplicate() {
shape.setIncrementX(24);
shape.setIncrementY(28);
shape.setAxesStyle(AxesStyle.FRAME);
shape.setTicksStyle(TicksStyle.BOTTOM);
shape.setDistLabelsX(12);
shape.setDistLabelsY(112);
shape.setShowOrigin(false);
shape.setTicksDisplayed(PlottingStyle.NONE);
shape.setTicksSize(34);
IAxes s2 = shape.duplicate();
assertNotNull(s2);
assertEqualsDouble(s2.getIncrementX(), shape.getIncrementX());
assertEqualsDouble(s2.getIncrementY(), shape.getIncrementY());
assertEquals(s2.getAxesStyle(), shape.getAxesStyle());
assertEqualsDouble(s2.getTicksSize(), shape.getTicksSize());
assertEquals(s2.getTicksDisplayed(), shape.getTicksDisplayed());
assertEquals(s2.getTicksStyle(), shape.getTicksStyle());
assertEqualsDouble(s2.getDistLabelsX(), shape.getDistLabelsX());
assertEqualsDouble(s2.getDistLabelsY(), shape.getDistLabelsY());
assertEquals(s2.isShowOrigin(), shape.isShowOrigin());
}
use of net.sf.latexdraw.models.interfaces.shape.IAxes in project latexdraw by arnobl.
the class TestIAxes method testConstructor3OK.
@Test
public void testConstructor3OK() {
IAxes axes = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint(10, -20));
assertNotNull(axes.getPtAt(0));
assertEqualsDouble(10d, axes.getPtAt(0).getX());
assertEqualsDouble(-20d, axes.getPtAt(0).getY());
}
use of net.sf.latexdraw.models.interfaces.shape.IAxes in project latexdraw by arnobl.
the class GenericAxes method updatePathTicksX.
default void updatePathTicksX(final double gapx, final TicksStyle ticksStyle, final double tickLgth) {
final IAxes model = getModel();
final boolean noArrowLeftX = model.getArrowStyle(1) == ArrowStyle.NONE || model.getGridMinX() == model.getOriginX();
final boolean noArrowRightX = model.getArrowStyle(3) == ArrowStyle.NONE || model.getGridMaxX() == model.getOriginX();
final double distX = model.getDistLabelsX();
final double y;
switch(ticksStyle) {
case FULL:
y = tickLgth / 2d;
break;
case TOP:
y = 0d;
break;
default:
y = tickLgth;
}
for (double incrx = model.getIncrementX(), maxx = model.getGridMaxX() / distX, minx = model.getGridMinX() / distX, i = minx * incrx; i <= maxx * incrx; i += incrx * distX) {
final int inti = (int) i;
if (isElementPaintable(noArrowLeftX, noArrowRightX, minx, maxx, inti)) {
final double x = inti * gapx;
createPathTicksMoveTo(x, y);
createPathTicksLineTo(x, y - tickLgth);
}
}
}
Aggregations