Package cz.vutbr.fit.layout.segm.op
Class SeparatorSet
- java.lang.Object
-
- cz.vutbr.fit.layout.segm.op.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 Summary
Fields Modifier and Type Field Description protected static int
ART_SEP_WIDTH
The width of the 'artificial' separators created by background colorsprotected Vector<Separator>
bsep
List of separators comming from the box analysisprotected Vector<Separator>
hsep
List of horizontal separatorsprotected static double
HSEP_MIN_HEIGHT
The minimal height of a horizontal separator in "em" unitsprotected Area
root
The root of the area tree that will be processedprotected static double
SEP_MIN_RATIO
The minimal width/height ratio of the separatorprotected Vector<Separator>
vsep
List of vertical separatorsprotected static double
VSEP_MIN_WIDTH
The minimal width of a vertical separator in "em" units
-
Constructor Summary
Constructors Constructor Description SeparatorSet(Area root)
Creates a new separator set with one horizontal and one vertical separator.SeparatorSet(Area root, Area filter)
Creates a new separator set with one horizontal and one vertical separator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
applyFinalFilters()
Applies various filters on the current separator sets in order to remove irrelevant separators or adjust the sizes.protected void
applyRegularFilters()
Applies various filters on the current separator sets in order to remove irrelevant separators or adjust the sizes.protected void
filterMarginalSeparators()
Removes the separators that are placed on the area borders.protected void
filterSeparators()
Removes all the separators where the weight is lower than the specified threshold.protected abstract void
findSeparators(Area area, Area filter)
Finds the horizontal and vertical list of separatorsVector<Separator>
getBoxsep()
Vector<Separator>
getHorizontal()
int
getMinHSepHeight()
Computes the minimal height of a horizontal separator that is accepted with this separator set.int
getMinVSepWidth()
Computes the minimal width of a vertical separator that is accepted with this separator set.Separator
getMostImportantSeparator()
Obtains the most important (with the greatest weight) separator from all the separators.Vector<Separator>
getVertical()
boolean
isSeparatorAt(int x, int y)
Checks if a point is covered by a separator.protected void
processIntersections()
Processes the separators so that they do not intersect.protected void
processIntersectionsRemoveHorizontal()
Processes the separators so that they do not intersect.protected void
processIntersectionsSplitHorizontal()
Processes the separators so that they do not intersect.
-
-
-
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
-
-
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 coordinatey
- 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 areafilter
- 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.
-
-