Package org.jpedal.text
Class TextLines
java.lang.Object
org.jpedal.text.TextLines
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addHighlights
(int[][] highlights, boolean areaSelect, int page) Method to highlight text on page.void
addToLineAreas
(int[] area, int writingMode, int page) void
addUrlArea
(int page, int[] area, String url) void
Clear all highlights that are being displayedGet all the highlights currently stored.int[][]
getHighlightableInArea
(int[] highlights, boolean areaSelect, int page) int[][]
getHighlightedAreasAs2DArray
(int page) Creates a two-dimensional int array containing x,y,width and height values for each rectangle that is stored in the localAreas map, which allows us to create a swing/fx rectangle on these values.int[][]
getLineAreasAs2DArray
(int page) Creates a two-dimensional int array containing x,y,width and height values for each rectangle that is stored in the localLineAreas map, which allows us to create a swing/fx rectangle on these values.getLinkAtPageLocation
(int page, int x, int y) ArrayList<int[]>
getURLLocations
(int page) getURLText
(int page) boolean
static boolean
intersects
(int[] paramsOne, int[] paramsTwo) Checks whether two rectangles intersect Takes the raw x,y,w,h data of the rectangles in array form.int[]
setFoundParagraphAsArray
(int x, int y, int page) Highlights a section of lines that form a paragraph and returns the area that encloses all highlight localAreas.void
setLineAreas
(Map<Integer, int[][]> la) void
-
Constructor Details
-
TextLines
public TextLines()
-
-
Method Details
-
addUrlArea
-
setUrlAreas
-
setFoundParagraphAsArray
public int[] setFoundParagraphAsArray(int x, int y, int page) Highlights a section of lines that form a paragraph and returns the area that encloses all highlight localAreas.- Parameters:
x
- Coord x value to begin looking for a paragraphy
- Coord y value to begin looking for a paragraphpage
- Page number of page to look for a paragraph on- Returns:
- int[] that contains x,y,w,h of all localAreas highlighted
-
addToLineAreas
public void addToLineAreas(int[] area, int writingMode, int page) -
clearHighlights
public void clearHighlights()Clear all highlights that are being displayed -
addHighlights
public void addHighlights(int[][] highlights, boolean areaSelect, int page) Method to highlight text on page.If areaSelect = true then the Rectangle array will be highlighted on screen unmodified. areaSelect should be true when being used with values returned from the search as these localAreas are already corrected and modified for display.
If areaSelect = false then all lines between the top left point and bottom right point will be selected including two partial lines the top line starting from the top left point of the rectangle and the bottom line ending at the bottom right point of the rectangle.
- Parameters:
highlights
- :: The 2DArray contains the raw x,y,w,h params of a set of rectangles that you wish to have highlightedareaSelect
- :: The flag that will either select text as line between points if false or characters within an area if true.page
- :: The page to add highlights to.
-
getHighlightableInArea
public int[][] getHighlightableInArea(int[] highlights, boolean areaSelect, int page) -
hasHighlightAreasUpdated
public boolean hasHighlightAreasUpdated() -
getAllHighlights
Get all the highlights currently stored. The returned Map using the page numbers as the keys for the values.- Returns:
- A Map containing all highlights currently stored.
-
getHighlightedAreasAs2DArray
public int[][] getHighlightedAreasAs2DArray(int page) Creates a two-dimensional int array containing x,y,width and height values for each rectangle that is stored in the localAreas map, which allows us to create a swing/fx rectangle on these values.- Parameters:
page
- of type int.- Returns:
- an int[][] Containing x,y,w,h of Highlights on Page.
-
setLineAreas
-
getURLLocations
-
getURLText
-
getLinkAtPageLocation
-
getLineAreasAs2DArray
public int[][] getLineAreasAs2DArray(int page) Creates a two-dimensional int array containing x,y,width and height values for each rectangle that is stored in the localLineAreas map, which allows us to create a swing/fx rectangle on these values.- Parameters:
page
- of type int.- Returns:
- an int[][] Containing x,y,w,h of line localAreas on Page.
-
intersects
public static boolean intersects(int[] paramsOne, int[] paramsTwo) Checks whether two rectangles intersect Takes the raw x,y,w,h data of the rectangles in array form.- Parameters:
paramsOne
- the points of rectangle oneparamsTwo
- the points of rectangle two- Returns:
- true if the rectangles intersect
-