use of net.sf.latexdraw.parsers.svg.parsers.SVGPathParser in project latexdraw by arnobl.
the class SVGPathElement method getSegList.
/**
* @return the segList.
* @since 0.1
*/
public SVGPathSegList getSegList() {
final String path = getPathData();
final SVGPathSegList segList = new SVGPathSegList();
final SVGPathParser pp = new SVGPathParser(path, segList);
try {
pp.parse();
}// $NON-NLS-1$ //$NON-NLS-2$
catch (final ParseException e) {
throw new IllegalArgumentException(e + " But : \"" + path + "\" found.");
}
return segList;
}
use of net.sf.latexdraw.parsers.svg.parsers.SVGPathParser in project latexdraw by arnobl.
the class TestSVGPathSegArc method testToString.
@Test
public void testToString() throws ParseException {
SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false);
SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), pathSeg -> {
if (pathSeg instanceof SVGPathSegMoveto && cpt == 0) {
cpt++;
return;
}
assertTrue(pathSeg instanceof SVGPathSegArc);
SVGPathSegArc seg2 = (SVGPathSegArc) pathSeg;
assertEquals(seg.getAngle(), seg2.getAngle(), 0.0001);
assertEquals(seg.getRX(), seg2.getRX(), 0.0001);
assertEquals(seg.getRY(), seg2.getRY(), 0.0001);
assertEquals(seg.getX(), seg2.getX(), 0.0001);
assertEquals(seg.getY(), seg2.getY(), 0.0001);
assertEquals(seg.isLargeArcFlag(), seg2.isLargeArcFlag());
assertEquals(seg.isRelative(), seg2.isRelative());
assertEquals(seg.isSweepFlag(), seg2.isSweepFlag());
});
parser.parse();
}
use of net.sf.latexdraw.parsers.svg.parsers.SVGPathParser in project latexdraw by arnobl.
the class TestSVGPathSegCurvetoCubic method testToString.
@Test
public void testToString() throws ParseException {
SVGPathSegMoveto m = new SVGPathSegMoveto(0, 0, false);
SVGPathParser parser = new SVGPathParser(m.toString() + " " + seg.toString(), pathSeg -> {
if (pathSeg instanceof SVGPathSegMoveto && cpt == 0) {
cpt++;
return;
}
assertTrue(pathSeg instanceof SVGPathSegCurvetoCubic);
SVGPathSegCurvetoCubic seg2 = (SVGPathSegCurvetoCubic) pathSeg;
assertEquals(seg.getX(), seg2.getX(), 0.0001);
assertEquals(seg.getY(), seg2.getY(), 0.0001);
assertEquals(seg.isRelative(), seg2.isRelative());
});
parser.parse();
}
use of net.sf.latexdraw.parsers.svg.parsers.SVGPathParser in project latexdraw by arnobl.
the class TestSVGPathSegCurvetoCubicSmooth 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 SVGPathSegCurvetoCubicSmooth);
SVGPathSegCurvetoCubicSmooth seg2 = (SVGPathSegCurvetoCubicSmooth) pathSeg;
assertEquals(seg.getX(), seg2.getX(), 0.0001);
assertEquals(seg.getY(), seg2.getY(), 0.0001);
assertEquals(seg.isRelative(), seg2.isRelative());
});
parser.parse();
}
use of net.sf.latexdraw.parsers.svg.parsers.SVGPathParser 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();
}
Aggregations