Search in sources :

Example 36 with IAxes

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

the class PSTLatexdrawListener method exitPsaxes.

@Override
public void exitPsaxes(final net.sf.latexdraw.parsers.pst.PSTParser.PsaxesContext ctx) {
    final IAxes axes = ShapeFactory.INST.createAxes(ShapeFactory.INST.createPoint());
    final IPoint gridstart;
    final IPoint gridend;
    final IPoint position;
    if (ctx.p3 == null) {
        if (ctx.p2 == null) {
            position = ShapeFactory.INST.createPoint();
            gridstart = ShapeFactory.INST.createPoint();
            gridend = ShapeFactory.INST.createPoint(ctx.pstctx.coordToRawPoint(ctx.p1));
        } else {
            position = ShapeFactory.INST.createPoint(ctx.pstctx.coordToRawPoint(ctx.p1).multiply(IShape.PPC));
            gridstart = ShapeFactory.INST.createPoint();
            gridend = ShapeFactory.INST.createPoint(ctx.pstctx.coordToRawPoint(ctx.p2).subtract(ctx.pstctx.coordToRawPoint(ctx.p1)));
        }
    } else {
        position = ShapeFactory.INST.createPoint();
        gridstart = ShapeFactory.INST.createPoint(ctx.pstctx.coordToRawPoint(ctx.p2));
        gridend = ShapeFactory.INST.createPoint(ctx.pstctx.coordToRawPoint(ctx.p3));
    }
    setArrows(axes, ctx.pstctx);
    setStdGridParams(ctx.pstctx.ox, ctx.pstctx.oy, axes, ctx.pstctx);
    setShapeParameters(axes, ctx.pstctx);
    axes.setAxesStyle(AxesStyle.getStyle(ctx.pstctx.axesStyle));
    axes.setTicksDisplayed(PlottingStyle.getStyle(ctx.pstctx.ticks));
    axes.setLabelsDisplayed(PlottingStyle.getStyle(ctx.pstctx.labels));
    axes.setTicksStyle(TicksStyle.getStyle(ctx.pstctx.ticksStyle));
    axes.setIncrementX(ctx.pstctx.dxIncrement);
    axes.setIncrementY(ctx.pstctx.dyIncrement);
    axes.setDistLabelsX(ctx.pstctx.dxLabelDist);
    axes.setDistLabelsY(ctx.pstctx.dyLabelDist);
    axes.setShowOrigin(ctx.pstctx.showOrigin);
    axes.setGridEndX(gridend.getX());
    axes.setGridEndY(gridend.getY());
    axes.setGridStartX(gridstart.getX());
    axes.setGridStartY(gridstart.getY());
    axes.setPosition(position);
    shapes.peek().addShape(axes);
}
Also used : IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes) IPoint(net.sf.latexdraw.models.interfaces.shape.IPoint)

Example 37 with IAxes

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

the class LAxes method duplicate.

@Override
public IAxes duplicate() {
    final IAxes axes = ShapeFactory.INST.createAxes(getPosition());
    axes.copy(this);
    return axes;
}
Also used : IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes)

Example 38 with IAxes

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

the class TestParsingPsaxes method testTickStyle.

@Theory
public void testTickStyle(final PlottingStyle style) {
    parser("\\psaxes[ticks=" + style.getPSTToken() + "](0,0)(0,0)(2,2)");
    final IAxes axes = getShapeAt(0);
    assertEquals(style, axes.getTicksDisplayed());
}
Also used : IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes) Theory(org.junit.experimental.theories.Theory)

Example 39 with IAxes

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

the class TestParsingPsaxes method testAxesstyle.

@Theory
public void testAxesstyle(final AxesStyle style) {
    parser("\\psaxes[axesstyle=" + style.getPSTToken() + "](0,0)(0,0)(2,2)");
    final IAxes axes = getShapeAt(0);
    assertEquals(style, axes.getAxesStyle());
}
Also used : IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes) Theory(org.junit.experimental.theories.Theory)

Example 40 with IAxes

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

the class TestParsingPsaxes method testTickStyle.

@Theory
public void testTickStyle(final TicksStyle style) {
    parser("\\psaxes[tickstyle=" + style.getPSTToken() + "](0,0)(0,0)(2,2)");
    final IAxes axes = getShapeAt(0);
    assertEquals(style, axes.getTicksStyle());
}
Also used : IAxes(net.sf.latexdraw.models.interfaces.shape.IAxes) Theory(org.junit.experimental.theories.Theory)

Aggregations

IAxes (net.sf.latexdraw.models.interfaces.shape.IAxes)50 Theory (org.junit.experimental.theories.Theory)28 Test (org.junit.Test)12 IArrowableSingleShape (net.sf.latexdraw.models.interfaces.shape.IArrowableSingleShape)10 HelperTest (net.sf.latexdraw.HelperTest)7 IShape (net.sf.latexdraw.models.interfaces.shape.IShape)5 PlottingStyle (net.sf.latexdraw.models.interfaces.shape.PlottingStyle)4 TicksStyle (net.sf.latexdraw.models.interfaces.shape.TicksStyle)4 IDot (net.sf.latexdraw.models.interfaces.shape.IDot)3 IPoint (net.sf.latexdraw.models.interfaces.shape.IPoint)3 IRectangle (net.sf.latexdraw.models.interfaces.shape.IRectangle)3 Collections (java.util.Collections)2 ShapeData (net.sf.latexdraw.data.ShapeData)2 ShapeFactory (net.sf.latexdraw.models.ShapeFactory)2 ArrowStyle (net.sf.latexdraw.models.interfaces.shape.ArrowStyle)2 AxesStyle (net.sf.latexdraw.models.interfaces.shape.AxesStyle)2 BorderPos (net.sf.latexdraw.models.interfaces.shape.BorderPos)2 DotStyle (net.sf.latexdraw.models.interfaces.shape.DotStyle)2 FillingStyle (net.sf.latexdraw.models.interfaces.shape.FillingStyle)2 IGroup (net.sf.latexdraw.models.interfaces.shape.IGroup)2