use of net.sf.latexdraw.parsers.svg.path.SVGPathSegList in project latexdraw by arnobl.
the class SVGPathElement method isPolygon.
/**
* @return True if the path is composed of lines and has a 'close path' segment at the end.
* @since 0.1
*/
public boolean isPolygon() {
final SVGPathSegList segList = getSegList();
if (segList.isEmpty() || !(segList.get(0) instanceof SVGPathSegMoveto))
return false;
boolean ok = true;
int i;
final int size;
for (i = 1, size = segList.size() - 1; i < size && ok; i++) if (!(segList.get(i) instanceof SVGPathSegLineto))
ok = false;
if (!(segList.get(segList.size() - 1) instanceof SVGPathSegClosePath))
ok = false;
return ok;
}
use of net.sf.latexdraw.parsers.svg.path.SVGPathSegList 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);
}
Aggregations