Search in sources :

Example 1 with SVGPathSegCurvetoQuadraticSmooth

use of net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth in project latexdraw by arnobl.

the class TestSVGPathSegCurvetoQuadraticSmooth method testToString.

@Test
public void testToString() throws ParseException {
    SVGPathSegMoveto m = new SVGPathSegMoveto(0d, 0d, false);
    SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), pathSeg -> {
        if (pathSeg instanceof SVGPathSegMoveto && cpt == 0) {
            cpt++;
            return;
        }
        assertTrue(pathSeg instanceof SVGPathSegCurvetoQuadraticSmooth);
        SVGPathSegCurvetoQuadraticSmooth seg2 = (SVGPathSegCurvetoQuadraticSmooth) pathSeg;
        assertEquals(seg.getX(), seg2.getX(), 0.0001);
        assertEquals(seg.getY(), seg2.getY(), 0.0001);
        assertEquals(seg.isRelative(), seg2.isRelative());
    });
    parser.parse();
}
Also used : SVGPathParser(net.sf.latexdraw.parsers.svg.parsers.SVGPathParser) SVGPathSegCurvetoQuadraticSmooth(net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth) SVGPathSegMoveto(net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto) Test(org.junit.Test)

Example 2 with SVGPathSegCurvetoQuadraticSmooth

use of net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth in project latexdraw by arnobl.

the class SVGPathParser method parseShorthandQuadraticBezierCurveto.

/**
 * Parses an SVGPath quadratic smooth curveto.
 * @param isRelative True if segment is relative.
 * @throws ParseException If a problem occurs.
 */
protected void parseShorthandQuadraticBezierCurveto(final boolean isRelative) throws ParseException {
    nextChar();
    skipWSP();
    final double x = parseNumber(false);
    skipWSPComma();
    final double y = parseNumber(false);
    skipWSPComma();
    handler.onPathSeg(new SVGPathSegCurvetoQuadraticSmooth(x, y, isRelative));
    parserPathSeg(isRelative);
}
Also used : SVGPathSegCurvetoQuadraticSmooth(net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth)

Example 3 with SVGPathSegCurvetoQuadraticSmooth

use of net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth in project latexdraw by arnobl.

the class TestSVGPathSegCurvetoQuadraticSmooth method setUp.

@Before
public void setUp() {
    seg = new SVGPathSegCurvetoQuadraticSmooth(-5.23e-10, 6.5, false);
    cpt = 0;
}
Also used : SVGPathSegCurvetoQuadraticSmooth(net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth) Before(org.junit.Before)

Aggregations

SVGPathSegCurvetoQuadraticSmooth (net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadraticSmooth)3 SVGPathParser (net.sf.latexdraw.parsers.svg.parsers.SVGPathParser)1 SVGPathSegMoveto (net.sf.latexdraw.parsers.svg.path.SVGPathSegMoveto)1 Before (org.junit.Before)1 Test (org.junit.Test)1