public void clearHighlighted() { for (LineText lineText : pageLines) { lineText.clearHighlighted(); } for (LineText lineText : sortedPageLines) { lineText.clearHighlighted(); } // check optional content. if (optionalPageLines != null) { // iterate over optional content keys and extract text from visible groups Set<OptionalContents> keys = optionalPageLines.keySet(); ArrayList<LineText> optionalLines; for (OptionalContents key : keys) { if (key != null && key.isVisible()) { optionalLines = optionalPageLines.get(key).getAllPageLines(); for (LineText lineText : optionalLines) { lineText.clearHighlighted(); } } } } }
/** * Gets all visible lines, checking the page text for any text that is in an optional content * group and that that group is flagged as visible. * * @return list of all visible lineText. */ private ArrayList<LineText> getVisiblePageLines(boolean skip) { ArrayList<LineText> visiblePageLines = skip ? new ArrayList<LineText>() : new ArrayList<LineText>(pageLines); // add optional content text that is visible. // check optional content. if (optionalPageLines != null) { // iterate over optional content keys and extract text from visible groups Set<OptionalContents> keys = optionalPageLines.keySet(); for (OptionalContents key : keys) { if (key != null && key.isVisible()) { ArrayList<LineText> pageLines = optionalPageLines.get(key).getVisiblePageLines(false); LineText currentLine = new LineText(); visiblePageLines.add(currentLine); for (LineText lineText : pageLines) { currentLine.addAll(lineText.getWords()); // recalculate the bounds. currentLine.getBounds(); } } } } return visiblePageLines; }