public class AreaImpl extends DefaultArea implements Area
| Constructor and Description |
|---|
AreaImpl(AreaImpl src)
Creates a copy of another area.
|
AreaImpl(Box box)
Creates an area from a single box.
|
AreaImpl(int x1,
int y1,
int x2,
int y2)
Creates an empty area of a given size
|
AreaImpl(Rectangular r)
Creates an empty area of a given size
|
AreaImpl(java.util.Vector<Box> boxList)
Creates an area from a a list of boxes.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addBox(Box box)
Adds a new box to the area and updates the area bounds.
|
void |
appendChild(Area child)
Appends a new child area to the list of child areas of this area.
|
void |
appendChildren(java.util.List<Area> list)
Appends a list of child areas to the list of child areas of this area.
|
boolean |
contains(int x,
int y) |
boolean |
containsText() |
void |
createSeparators()
Creates a set of the horizontal and vertical separators
|
Area |
createSuperArea(Rectangular gp,
java.util.List<Area> selected,
java.lang.String name)
Creates a new subarea from a specified region of the area and moves the selected child
nodes to the new area.
|
boolean |
encloses(AreaImpl other) |
AreaImpl |
findContentAbove(Separator sep)
Looks for the nearest text box area placed above the separator.
|
java.lang.String |
getBoxText()
Returns the text string represented by a concatenation of all
the boxes contained directly in this area (no subareas)
|
float |
getColorLuminosity()
Computes the average luminosity of the boxes in the area
|
float |
getDeclaredFontSize()
Returns the font size declared for the first box.
|
java.awt.Color |
getEffectiveBackgroundColor()
Obtains the effective background color visible under the area.
|
float |
getFontSize()
Computes the average font size of the boxes in the area
|
float |
getFontStyle()
Computes the average font style of the boxes in the area
|
float |
getFontWeight()
Computes the average font weight of the boxes in the area
|
java.util.Vector<AreaImpl> |
getChildNodesInside(Rectangular r)
Returns the child areas whose absolute coordinates intersect with the specified rectangle.
|
int |
getLevel() |
float |
getLineThrough()
Obtains the amount of line-through text. 0 means no underlined text, 1 means all the text is underlined.
|
ContentObject |
getReplacedContent() |
SeparatorSet |
getSeparators() |
AreaStyle |
getStyle()
Obtains the overall style of the area.
|
java.lang.String |
getText()
Returns the complete text contained in this area and its sub area.
|
int |
getTextLength()
Returns the text string represented by a concatenation of all
the boxes contained directly in this area.
|
float |
getUnderline()
Obtains the amount of underlined text. 0 means no underlined text, 1 means all the text is underlined.
|
boolean |
hasContent() |
boolean |
hasSameBackground(AreaImpl other)
Checks if this area has the same background color as another area
|
boolean |
hasSameStyle(AreaImpl other)
Compares two areas and decides whether they have the same style.
|
void |
chooseBox(Box node)
Add the box node to the area if its bounds are inside of the area bounds.
|
boolean |
isAreaEmpty(Rectangular r)
Check if there are some children in the given subarea of the area.
|
boolean |
isExplicitlySeparated()
When set to true, the area is considered to be separated from other
areas explicitly, i.e. independently on its real borders or background.
|
boolean |
isHorizontalSeparator()
Tries to guess if this area acts as a horizontal separator.
|
boolean |
isReplaced()
Checks whether this area is formed by replaced boxes.
|
boolean |
isVerticalSeparator()
Tries to guess if this area acts as a vertical separator.
|
void |
join(AreaImpl other,
boolean horizontal)
Joins another area to this area.
|
void |
joinArea(AreaImpl other,
Rectangular pos,
boolean horizontal)
Joins this area with another area and updates the layout in the grid to the given values.
|
void |
joinChild(AreaImpl other)
Joins a child area to this area.
|
void |
removeAllChildren()
Removes all the child areas from their parent.
|
void |
removeSimpleSeparators()
Removes simple separators from current separator set.
|
protected void |
resetAverages()
Resets the averages to the values obtained from the text boxes
that belong to this area only.
|
boolean |
separatedDown() |
boolean |
separatedLeft() |
boolean |
separatedRight() |
boolean |
separatedUp() |
void |
setLevel(int level) |
void |
setSeparated(boolean separated)
When set to true, the area is considered to be separated from other
areas explicitly, i.e. independently on its real borders or background.
|
java.lang.String |
toString() |
void |
updateAverages(AreaImpl other)
Updates the average values when a new area is added or joined
|
addTag, containsTag, createGrid, createTopology, getAllBoxes, getBoxes, getContentBounds, getGrid, getGridHeight, getGridPosition, getGridWidth, getGridX, getGridY, getChildArea, getChildAreas, getChildAtGridPos, getIndex, getMostSupportedTag, getName, getNextOnLine, getNextSibling, getParentArea, getPreviousOnLine, getPreviousSibling, getTags, getTagSupport, getText, getTopology, hasTag, hasTag, insertChild, isSeparator, removeAllTags, removeChild, removeTag, setGridPosition, setGridX, setGridY, SetHorizontalSeparator, setName, setNextOnLine, setPreviousOnLine, SetVerticalSeparatorgetBackgroundColor, getBorderCount, getBottomBorder, getBounds, getHeight, getId, getLeftBorder, getPage, getRightBorder, getTopBorder, getWidth, getX1, getX2, getY1, getY2, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated, setBackgroundColor, setBackgroundSeparated, setBorders, setBottomBorder, setBounds, setFontSize, setFontStyle, setFontWeight, setId, setLeftBorder, setLineThrough, setPage, setRightBorder, setTopBorder, setUnderlineadd, addAttribute, getAttribute, getDepth, getChildAt, getChildCount, getChildren, getIndex, getLeafCount, getNextSiblingNode, getParent, getPreviousSiblingNode, getRoot, insert, isLeaf, isRoot, remove, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllBoxes, getBoxes, getText, getTopology, isSeparatorgetBackgroundColor, getBorderCount, getBottomBorder, getBounds, getId, getLeftBorder, getPage, getRightBorder, getTopBorder, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparatedgetHeight, getWidth, getX1, getX2, getY1, getY2addAttribute, getAttribute, getDepth, getChildArea, getChildAreas, getChildCount, getIndex, getLeafCount, getNextSibling, getParentArea, getPreviousSibling, insertChild, isLeaf, removeChildaddTag, getMostSupportedTag, getTags, getTagSupport, hasTag, hasTag, removeTagpublic AreaImpl(int x1,
int y1,
int x2,
int y2)
public AreaImpl(Rectangular r)
public AreaImpl(Box box)
box - The source box that will be contained in this areapublic AreaImpl(java.util.Vector<Box> boxList)
boxList - The source boxes that will be contained in this areapublic AreaImpl(AreaImpl src)
src - The source areapublic void appendChild(Area child)
AreaTreeNodeappendChild in interface AreaTreeNode<Area>appendChild in class DefaultAreachild - The new child to be appendedpublic void appendChildren(java.util.List<Area> list)
AreaTreeNodeappendChildren in interface AreaTreeNode<Area>appendChildren in class DefaultArealist - The list of new children to be appendedpublic void removeAllChildren()
AreaTreeNoderemoveAllChildren in interface AreaTreeNode<Area>removeAllChildren in class GenericTreeNodepublic void joinArea(AreaImpl other, Rectangular pos, boolean horizontal)
other - The area to be joined to this areapos - The position of the result in the gridhorizontal - Horizontal or vertical join?public void join(AreaImpl other, boolean horizontal)
other - The area to be joined to this area.horizontal - If true, the areas are joined horizontally.
This influences the resulting area borders. If false, the areas are joined vertically.public void joinChild(AreaImpl other)
other - The child area to be joined to this area.public int getLevel()
public void setLevel(int level)
public java.lang.String toString()
toString in class DefaultAreapublic void chooseBox(Box node)
node - The box node to be addedpublic boolean hasSameBackground(AreaImpl other)
other - the other areapublic boolean encloses(AreaImpl other)
public boolean contains(int x,
int y)
public boolean hasContent()
public java.awt.Color getEffectiveBackgroundColor()
AreagetEffectiveBackgroundColor in interface AreagetEffectiveBackgroundColor in class DefaultAreapublic boolean containsText()
public boolean isReplaced()
AreaisReplaced in interface AreaisReplaced in class DefaultAreapublic java.lang.String getBoxText()
getBoxText in class DefaultAreapublic int getTextLength()
public ContentObject getReplacedContent()
public boolean isHorizontalSeparator()
isHorizontalSeparator in interface AreaisHorizontalSeparator in class DefaultAreapublic boolean isVerticalSeparator()
isVerticalSeparator in interface AreaisVerticalSeparator in class DefaultAreapublic Area createSuperArea(Rectangular gp, java.util.List<Area> selected, java.lang.String name)
AreacreateSuperArea in interface AreacreateSuperArea in class DefaultAreagp - the subarea boundsselected - nodes to be moved to the new areaname - the name (identification) of the new areapublic float getDeclaredFontSize()
public float getFontSize()
getFontSize in interface ContentRectgetFontSize in class DefaultContentRectpublic float getFontWeight()
getFontWeight in interface ContentRectgetFontWeight in class DefaultContentRectpublic float getFontStyle()
getFontStyle in interface ContentRectgetFontStyle in class DefaultContentRectpublic float getUnderline()
ContentRectgetUnderline in interface ContentRectgetUnderline in class DefaultContentRectpublic float getLineThrough()
ContentRectgetLineThrough in interface ContentRectgetLineThrough in class DefaultContentRectpublic float getColorLuminosity()
public void updateAverages(AreaImpl other)
other - the other areaprotected void resetAverages()
public java.lang.String getText()
AreagetText in interface AreagetText in class DefaultAreapublic java.util.Vector<AreaImpl> getChildNodesInside(Rectangular r)
public boolean isAreaEmpty(Rectangular r)
public void createSeparators()
public SeparatorSet getSeparators()
public void removeSimpleSeparators()
public AreaImpl findContentAbove(Separator sep)
sep - the separatornull if there is nothing above the separatorprotected void addBox(Box box)
addBox in class DefaultAreabox - the new box to addpublic boolean separatedDown()
true if the area is separated from the areas below itpublic boolean separatedUp()
true if the area is separated from the areas above itpublic boolean separatedLeft()
true if the area is separated from the areas on the leftpublic boolean separatedRight()
true if the area is separated from the areas on the rightpublic boolean isExplicitlySeparated()
true, if the area is explicitly separatedpublic void setSeparated(boolean separated)
separated - true, if the area should be explicitly separatedpublic AreaStyle getStyle()