use of net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadratic in project latexdraw by arnobl.
the class SVGPathParser method parseQuadraticBezierCurveto.
/**
* Parses an SVGPath quadratic curveto.
* @param isRelative True if segment is relative.
* @throws ParseException If a problem occurs.
*/
protected void parseQuadraticBezierCurveto(final boolean isRelative) throws ParseException {
nextChar();
skipWSP();
do {
final Tuple<Double, Double> p1 = parsePoint();
skipWSPComma();
final Tuple<Double, Double> p0 = parsePoint();
skipWSPComma();
handler.onPathSeg(new SVGPathSegCurvetoQuadratic(p0.a, p0.b, p1.a, p1.b, isRelative));
} while (!isEOC() && isNumber(false));
}
use of net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadratic in project latexdraw by arnobl.
the class TestSVGPathSegCurvetoQuadratic 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 SVGPathSegCurvetoQuadratic);
SVGPathSegCurvetoQuadratic seg2 = (SVGPathSegCurvetoQuadratic) pathSeg;
assertEquals(seg.getX(), seg2.getX(), 0.0001);
assertEquals(seg.getX1(), seg2.getX1(), 0.0001);
assertEquals(seg.getY(), seg2.getY(), 0.0001);
assertEquals(seg.getY1(), seg2.getY1(), 0.0001);
assertEquals(seg.isRelative(), seg2.isRelative());
});
parser.parse();
}
use of net.sf.latexdraw.parsers.svg.path.SVGPathSegCurvetoQuadratic in project latexdraw by arnobl.
the class TestSVGPathSegCurvetoQuadratic method setUp.
@Before
public void setUp() {
cpt = 0;
seg = new SVGPathSegCurvetoQuadratic(3e1, 4e-1, -5e1, 6.5, true);
}
Aggregations