use of net.sf.latexdraw.parser.svg.path.SVGPathSegCurvetoCubicSmooth in project latexdraw by arnobl.
the class SVGPathElement method isBezierCurve.
public boolean isBezierCurve() {
final SVGPathSegList segList = getSegList();
if (segList.isEmpty() || !(segList.get(0) instanceof SVGPathSegMoveto)) {
return false;
}
final int size = segList.size() - 1;
boolean ok = true;
int i;
for (i = 1; i < size && ok; i++) {
if (!(segList.get(i) instanceof SVGPathSegCurvetoCubic) && !(segList.get(i) instanceof SVGPathSegCurvetoCubicSmooth)) {
ok = false;
}
}
return ok && (segList.get(size) instanceof SVGPathSegClosePath || segList.get(size) instanceof SVGPathSegCurvetoCubic || segList.get(size) instanceof SVGPathSegCurvetoCubicSmooth);
}
use of net.sf.latexdraw.parser.svg.path.SVGPathSegCurvetoCubicSmooth in project latexdraw by arnobl.
the class TestSVGPathSegCurvetoCubicSmooth method testToString.
@Test
public void testToString() {
final AtomicBoolean done = new AtomicBoolean(false);
final SVGPathSegMoveto m = new SVGPathSegMoveto(0d, 0d, false);
SVGParserUtils.INSTANCE.parseSVGPath(m.toString() + " " + seg.toString(), pathSeg -> {
if (pathSeg instanceof SVGPathSegMoveto) {
return;
}
done.set(true);
final SVGPathSegCurvetoCubicSmooth seg2 = (SVGPathSegCurvetoCubicSmooth) pathSeg;
assertEquals(seg.getX(), seg2.getX(), 0.0001);
assertEquals(seg.getY(), seg2.getY(), 0.0001);
assertEquals(seg.isRelative(), seg2.isRelative());
});
assertTrue(done.get());
}
Aggregations