Package cz.vutbr.fit.layout.impl
Class DefaultAreaTree
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.BaseArtifact
-
- cz.vutbr.fit.layout.impl.DefaultAreaTree
-
- All Implemented Interfaces:
AreaTree
,Artifact
,SearchableAreaContainer
- Direct Known Subclasses:
RDFAreaTree
,SegmentationAreaTree
public class DefaultAreaTree extends BaseArtifact implements AreaTree
Default Page implementation.- Author:
- burgetr
-
-
Constructor Summary
Constructors Constructor Description DefaultAreaTree(AreaTree src)
Creates a copy of an area tree.DefaultAreaTree(org.eclipse.rdf4j.model.IRI pageIri)
Creates an area tree from a page.DefaultAreaTree(org.eclipse.rdf4j.model.IRI parentIri, org.eclipse.rdf4j.model.IRI pageIri)
Creates an area tree from another artifact
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Area
createArea(Area other)
Creates a new area in the tree by copying another area.Area
createArea(Box box)
Creates a new area in the tree from a box.Area
createArea(Rectangular r)
Creates a new empty area in the tree.Area
createArea(List<Box> boxes)
Creates a new area in the tree from a list of boxes.Area
getAreaAt(int x, int y)
Finds the bottom-most area node present at the given coordinates in the area tree.Area
getAreaByName(String name)
Finds an area by the given name.List<Area>
getAreasAt(int x, int y)
Finds all the area nodes present at the given coordinates in the area tree.org.eclipse.rdf4j.model.IRI
getArtifactType()
Gets the artifact type.int
getMaxAreaId(Area root)
protected int
getNextAreaId()
org.eclipse.rdf4j.model.IRI
getPageIri()
Gets the IRI of the page the area tree was build from.Area
getRoot()
Obtains the root node of the area tree.void
setNextAreaId(int nextId)
void
setPageIri(org.eclipse.rdf4j.model.IRI pageIri)
void
setRoot(Area root)
String
toString()
void
updateNextAreaId()
void
updateTopologies()
Updates the topology structures (e.g. grids) for all the areas in the tree.-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseArtifact
equals, getCreatedOn, getCreator, getCreatorParams, getIri, getLabel, getMetadata, getParentIri, hashCode, setCreatedOn, setCreator, setCreatorParams, setIri, setLabel, setMetadata, setParentIri
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cz.vutbr.fit.layout.model.Artifact
getCreatedOn, getCreator, getCreatorParams, getIri, getLabel, getMetadata, getParentIri, setIri
-
-
-
-
Constructor Detail
-
DefaultAreaTree
public DefaultAreaTree(org.eclipse.rdf4j.model.IRI pageIri)
Creates an area tree from a page.- Parameters:
pageIri
- the IRI of the source page
-
DefaultAreaTree
public DefaultAreaTree(org.eclipse.rdf4j.model.IRI parentIri, org.eclipse.rdf4j.model.IRI pageIri)
Creates an area tree from another artifact- Parameters:
parentIri
- the parent artifact IRIpageIri
- the associated page IRI
-
DefaultAreaTree
public DefaultAreaTree(AreaTree src)
Creates a copy of an area tree.- Parameters:
src
- the source area tree
-
-
Method Detail
-
getArtifactType
public org.eclipse.rdf4j.model.IRI getArtifactType()
Description copied from interface:Artifact
Gets the artifact type.- Specified by:
getArtifactType
in interfaceArtifact
- Returns:
- the IRI of the artifact type.
-
getPageIri
public org.eclipse.rdf4j.model.IRI getPageIri()
Description copied from interface:AreaTree
Gets the IRI of the page the area tree was build from. This may be equal to the parent IRI when the tree was built from the page directly.- Specified by:
getPageIri
in interfaceAreaTree
- Returns:
- the source page IRI
-
setPageIri
public void setPageIri(org.eclipse.rdf4j.model.IRI pageIri)
-
getRoot
public Area getRoot()
Description copied from interface:AreaTree
Obtains the root node of the area tree.
-
setRoot
public void setRoot(Area root)
-
updateTopologies
public void updateTopologies()
Description copied from interface:AreaTree
Updates the topology structures (e.g. grids) for all the areas in the tree.- Specified by:
updateTopologies
in interfaceAreaTree
-
getAreaAt
public Area getAreaAt(int x, int y)
Description copied from interface:SearchableAreaContainer
Finds the bottom-most area node present at the given coordinates in the area tree.- Specified by:
getAreaAt
in interfaceSearchableAreaContainer
- Parameters:
x
- the X coordinatey
- the Y coordinate- Returns:
- the area node present at the given coordinates or
null
when no node is found.
-
getAreasAt
public List<Area> getAreasAt(int x, int y)
Description copied from interface:SearchableAreaContainer
Finds all the area nodes present at the given coordinates in the area tree.- Specified by:
getAreasAt
in interfaceSearchableAreaContainer
- Parameters:
x
- the X coordinatey
- the Y coordinate- Returns:
- a list of the area nodes present at the given coordinates ordered from the topmost to the bottommost one.
-
getAreaByName
public Area getAreaByName(String name)
Description copied from interface:SearchableAreaContainer
Finds an area by the given name.- Specified by:
getAreaByName
in interfaceSearchableAreaContainer
- Parameters:
name
- the name of the area- Returns:
- the area with the given name or
null
when nothing is found.
-
createArea
public Area createArea(Rectangular r)
Description copied from interface:AreaTree
Creates a new empty area in the tree.- Specified by:
createArea
in interfaceAreaTree
- Parameters:
r
- the new area bounds.- Returns:
- the new area
-
createArea
public Area createArea(Box box)
Description copied from interface:AreaTree
Creates a new area in the tree from a box.- Specified by:
createArea
in interfaceAreaTree
- Parameters:
box
- source box- Returns:
- the new area containing the box.
-
createArea
public Area createArea(Area other)
Description copied from interface:AreaTree
Creates a new area in the tree by copying another area.- Specified by:
createArea
in interfaceAreaTree
- Parameters:
other
- the other area to copy- Returns:
- the new area containing the box.
-
createArea
public Area createArea(List<Box> boxes)
Description copied from interface:AreaTree
Creates a new area in the tree from a list of boxes.- Specified by:
createArea
in interfaceAreaTree
- Parameters:
boxes
- a list of boxes- Returns:
- the new area containing all the boxes.
-
getNextAreaId
protected int getNextAreaId()
-
setNextAreaId
public void setNextAreaId(int nextId)
-
updateNextAreaId
public void updateNextAreaId()
-
getMaxAreaId
public int getMaxAreaId(Area root)
-
-