Class SeparatorSet

  • Direct Known Subclasses:
    SeparatorSetHVS

    public abstract class SeparatorSet
    extends Object
    A generic set of horizontal and vertical separators for a page.
    Author:
    radek
    • Field Detail

      • HSEP_MIN_HEIGHT

        protected static final double HSEP_MIN_HEIGHT
        The minimal height of a horizontal separator in "em" units
        See Also:
        Constant Field Values
      • VSEP_MIN_WIDTH

        protected static final double VSEP_MIN_WIDTH
        The minimal width of a vertical separator in "em" units
        See Also:
        Constant Field Values
      • SEP_MIN_RATIO

        protected static final double SEP_MIN_RATIO
        The minimal width/height ratio of the separator
        See Also:
        Constant Field Values
      • ART_SEP_WIDTH

        protected static final int ART_SEP_WIDTH
        The width of the 'artificial' separators created by background colors
        See Also:
        Constant Field Values
      • root

        protected Area root
        The root of the area tree that will be processed
      • bsep

        protected Vector<Separator> bsep
        List of separators comming from the box analysis
    • Constructor Detail

      • SeparatorSet

        public SeparatorSet​(Area root)
        Creates a new separator set with one horizontal and one vertical separator.
      • SeparatorSet

        public SeparatorSet​(Area root,
                            Area filter)
        Creates a new separator set with one horizontal and one vertical separator.
    • Method Detail

      • getMostImportantSeparator

        public Separator getMostImportantSeparator()
        Obtains the most important (with the greatest weight) separator from all the separators. The separators must be sorted before this metod is called.
        Returns:
        The selected separator or null when there are no separators
      • getMinHSepHeight

        public int getMinHSepHeight()
        Computes the minimal height of a horizontal separator that is accepted with this separator set. Usually, it depends on the average font size of the corresponding visual area.
        Returns:
        the minimal height in pixels
      • getMinVSepWidth

        public int getMinVSepWidth()
        Computes the minimal width of a vertical separator that is accepted with this separator set. Usually, it depends on the average font size of the corresponding visual area.
        Returns:
        the minimal width in pixels
      • isSeparatorAt

        public boolean isSeparatorAt​(int x,
                                     int y)
        Checks if a point is covered by a separator.
        Parameters:
        x - the point x coordinate
        y - the point y coordinate
        Returns:
        true if any of the separators in this set covers the specified point
      • findSeparators

        protected abstract void findSeparators​(Area area,
                                               Area filter)
        Finds the horizontal and vertical list of separators
        Parameters:
        area - the root area
        filter - if not null, only the sub areas enclosed in the filter area are considered
      • applyRegularFilters

        protected void applyRegularFilters()
        Applies various filters on the current separator sets in order to remove irrelevant separators or adjust the sizes. This is calle automatically after each recursive iteration.
      • applyFinalFilters

        public void applyFinalFilters()
        Applies various filters on the current separator sets in order to remove irrelevant separators or adjust the sizes. This must be called manually after the final results are obtained.
      • filterMarginalSeparators

        protected void filterMarginalSeparators()
        Removes the separators that are placed on the area borders.
      • filterSeparators

        protected void filterSeparators()
        Removes all the separators where the weight is lower than the specified threshold.
      • processIntersections

        protected void processIntersections()
        Processes the separators so that they do not intersect.
      • processIntersectionsSplitHorizontal

        protected void processIntersectionsSplitHorizontal()
        Processes the separators so that they do not intersect. The vertical separators are left untouched, the horizontal separators are split by the vertical ones when necessary.
      • processIntersectionsRemoveHorizontal

        protected void processIntersectionsRemoveHorizontal()
        Processes the separators so that they do not intersect. The vertical separators are left untouched, the horizontal separators are removed when they intersect with a vertical one.