Class TextLines

java.lang.Object
org.jpedal.text.TextLines

public class TextLines extends Object
  • Constructor Details

    • TextLines

      public TextLines()
  • Method Details

    • addUrlArea

      public void addUrlArea(int page, int[] area, String url)
    • setUrlAreas

      public void setUrlAreas(Map<Integer,ArrayList<int[]>> areas, Map<Integer,ArrayList<String>> urls)
    • 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 paragraph
      y - Coord y value to begin looking for a paragraph
      page - 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 highlighted
      areaSelect - :: 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

      public Map<Integer,int[][]> 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

      public void setLineAreas(Map<Integer,int[][]> la)
    • getURLLocations

      public ArrayList<int[]> getURLLocations(int page)
    • getURLText

      public ArrayList<String> getURLText(int page)
    • getLinkAtPageLocation

      public String getLinkAtPageLocation(int page, int x, int y)
    • 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 one
      paramsTwo - the points of rectangle two
      Returns:
      true if the rectangles intersect