use of net.sf.latexdraw.parsers.svg.path.SVGPathSegLineto in project latexdraw by arnobl.
the class SVGPathParser method parseLineto.
/**
* Parses an SVGPath lineto.
* @param isRelative True if segment is relative.
* @throws ParseException If a problem occurs.
*/
protected void parseLineto(final boolean isRelative) throws ParseException {
nextChar();
skipWSP();
final double x = parseNumber(false);
skipWSPComma();
final double y = parseNumber(false);
skipWSPComma();
handler.onPathSeg(new SVGPathSegLineto(x, y, isRelative));
parserPathSeg(isRelative);
}
use of net.sf.latexdraw.parsers.svg.path.SVGPathSegLineto 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;
}
Aggregations