Example usage for com.itextpdf.text.pdf.parser Subpath isDegenerate

List of usage examples for com.itextpdf.text.pdf.parser Subpath isDegenerate

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf.parser Subpath isDegenerate.

Prototype

public boolean isDegenerate() 

Source Link

Document

Returns a boolean indicating whether the subpath is degenerate or not.

Usage

From source file:mkl.testarea.itext5.pdfcleanup.PdfCleanUpRegionFilter.java

License:Open Source License

/**
 * Adds all subpaths of the path to the {@link ClipperOffset} object with one
 * note: it doesn't add degenerate subpaths.
 *
 * @return {@link java.util.List} consisting of all degenerate subpaths of the path.
 *//*from w ww.  jav a  2 s  .com*/
private static List<Subpath> addPath(ClipperOffset offset, Path path, JoinType joinType, EndType endType) {
    List<Subpath> degenerateSubpaths = new ArrayList<Subpath>();

    for (Subpath subpath : path.getSubpaths()) {
        if (subpath.isDegenerate()) {
            degenerateSubpaths.add(subpath);
            continue;
        }

        if (!subpath.isSinglePointClosed() && !subpath.isSinglePointOpen()) {
            EndType et;

            if (subpath.isClosed()) {
                // Offsetting is never used for path being filled
                et = EndType.CLOSED_LINE;
            } else {
                et = endType;
            }

            List<Point2D> linearApproxPoints = subpath.getPiecewiseLinearApproximation();
            offset.addPath(convertToIntPoints(linearApproxPoints), joinType, et);
        }
    }

    return degenerateSubpaths;
}