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, SetVerticalSeparator
getBackgroundColor, 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, setUnderline
add, addAttribute, getAttribute, getDepth, getChildAt, getChildCount, getChildren, getIndex, getLeafCount, getNextSiblingNode, getParent, getPreviousSiblingNode, getRoot, insert, isLeaf, isRoot, remove, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllBoxes, getBoxes, getText, getTopology, isSeparator
getBackgroundColor, getBorderCount, getBottomBorder, getBounds, getId, getLeftBorder, getPage, getRightBorder, getTopBorder, hasBottomBorder, hasLeftBorder, hasRightBorder, hasTopBorder, isBackgroundSeparated
getHeight, getWidth, getX1, getX2, getY1, getY2
addAttribute, getAttribute, getDepth, getChildArea, getChildAreas, getChildCount, getIndex, getLeafCount, getNextSibling, getParentArea, getPreviousSibling, insertChild, isLeaf, removeChild
addTag, getMostSupportedTag, getTags, getTagSupport, hasTag, hasTag, removeTag
public 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)
AreaTreeNode
appendChild
in interface AreaTreeNode<Area>
appendChild
in class DefaultArea
child
- The new child to be appendedpublic void appendChildren(java.util.List<Area> list)
AreaTreeNode
appendChildren
in interface AreaTreeNode<Area>
appendChildren
in class DefaultArea
list
- The list of new children to be appendedpublic void removeAllChildren()
AreaTreeNode
removeAllChildren
in interface AreaTreeNode<Area>
removeAllChildren
in class GenericTreeNode
public 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 DefaultArea
public 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()
Area
getEffectiveBackgroundColor
in interface Area
getEffectiveBackgroundColor
in class DefaultArea
public boolean containsText()
public boolean isReplaced()
Area
isReplaced
in interface Area
isReplaced
in class DefaultArea
public java.lang.String getBoxText()
getBoxText
in class DefaultArea
public int getTextLength()
public ContentObject getReplacedContent()
public boolean isHorizontalSeparator()
isHorizontalSeparator
in interface Area
isHorizontalSeparator
in class DefaultArea
public boolean isVerticalSeparator()
isVerticalSeparator
in interface Area
isVerticalSeparator
in class DefaultArea
public Area createSuperArea(Rectangular gp, java.util.List<Area> selected, java.lang.String name)
Area
createSuperArea
in interface Area
createSuperArea
in class DefaultArea
gp
- 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 ContentRect
getFontSize
in class DefaultContentRect
public float getFontWeight()
getFontWeight
in interface ContentRect
getFontWeight
in class DefaultContentRect
public float getFontStyle()
getFontStyle
in interface ContentRect
getFontStyle
in class DefaultContentRect
public float getUnderline()
ContentRect
getUnderline
in interface ContentRect
getUnderline
in class DefaultContentRect
public float getLineThrough()
ContentRect
getLineThrough
in interface ContentRect
getLineThrough
in class DefaultContentRect
public float getColorLuminosity()
public void updateAverages(AreaImpl other)
other
- the other areaprotected void resetAverages()
public java.lang.String getText()
Area
getText
in interface Area
getText
in class DefaultArea
public 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 DefaultArea
box
- 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()