Package cz.vutbr.fit.layout.model
Interface AreaTopology
-
- All Known Implementing Classes:
AreaListGridTopology,DefaultGridTopology
public interface AreaTopologyThis is an abstraction of a topology that represents the mutual positions of areas in an abstract space (e.g. in a parent area).- Author:
- burgetr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddrawLayout(OutputDisplay disp)Graphically displays the topology on a graphical output device.Collection<ContentRect>findAllAreasAt(int x, int y)Finds all the areas at the specified position in the grid.Collection<ContentRect>findAllAreasIntersecting(Rectangular r)Finds all the areas that intersect with the specified rectangle in the grid.ContentRectfindAreaAt(int x, int y)Finds an area at the specified position in the grid.Collection<ContentRect>getAreas()Gets the list of areas that are being managed by this topology.RectangulargetPosition(ContentRect area)Obtains the position of the given area within this topology.Map<ContentRect,Rectangular>getPositionMap()Obtains a map assigning a position to each area.intgetTopologyHeight()Obtains the total height of the topology used for placing the child areas within this area.RectangulargetTopologyPosition()Obtains the absolute position of the whole topology within the page.intgetTopologyWidth()Obtains the total width of the topology used for placing the child areas within this area.voidsetPosition(ContentRect area, Rectangular gp)Sets the position of the given area in this topology.RectangulartoPixelPosition(Rectangular topologyPosition)Translates the bounds in the topology to pixel bounds.RectangulartoPixelPositionAbsolute(Rectangular topologyPosition)Translates the bounds in the topology to absolute pixel bounds.inttoTopologyX(int pixelX)Translates the X coordinate from pixels to topology positioninttoTopologyY(int pixelY)Translates the Y coordinate from pixels to topology positionvoidupdate()Recomputes the topology.
-
-
-
Method Detail
-
getAreas
Collection<ContentRect> getAreas()
Gets the list of areas that are being managed by this topology.- Returns:
- the list of areas
-
getTopologyWidth
int getTopologyWidth()
Obtains the total width of the topology used for placing the child areas within this area.- Returns:
- the topology width; the units depend on the used topology
-
getTopologyHeight
int getTopologyHeight()
Obtains the total height of the topology used for placing the child areas within this area.- Returns:
- the topology height; the units depend on the topology
-
getTopologyPosition
Rectangular getTopologyPosition()
Obtains the absolute position of the whole topology within the page.- Returns:
- the absolute position of this topology
-
getPosition
Rectangular getPosition(ContentRect area)
Obtains the position of the given area within this topology.- Parameters:
area- The area whose position we want to obtain.- Returns:
- The area position in this topology or
nullwhen the area position is not described by this topology.
-
getPositionMap
Map<ContentRect,Rectangular> getPositionMap()
Obtains a map assigning a position to each area. Note that the efficiency of this method greatly depends on the topology implementation.- Returns:
- A map assigning a position to the individual areas. The key set contains all the areas in the topology.
-
setPosition
void setPosition(ContentRect area, Rectangular gp)
Sets the position of the given area in this topology.- Parameters:
area- The area whose position we want to set.gp- The new position.
-
findAreaAt
ContentRect findAreaAt(int x, int y)
Finds an area at the specified position in the grid. If there are multiple areas sharing the same position, the first of them is returned in a non-deterministic way. Therefore, this method should be used for topologies that do not allow overlapping areas.- Parameters:
x- the x coordinate of the grid celly- the y coordinate of the grid cell- Returns:
- the area at the specified position or
nullwhen there is no such area
-
findAllAreasAt
Collection<ContentRect> findAllAreasAt(int x, int y)
Finds all the areas at the specified position in the grid.- Parameters:
x- the x coordinate of the grid celly- the y coordinate of the grid cell- Returns:
- the collection of areas at the specified position or an empty collection when there is no such area
-
findAllAreasIntersecting
Collection<ContentRect> findAllAreasIntersecting(Rectangular r)
Finds all the areas that intersect with the specified rectangle in the grid.- Parameters:
r- the the rectangle to intersect with- Returns:
- the collection of areas at the specified position or an empty collection when there is no such area
-
toPixelPosition
Rectangular toPixelPosition(Rectangular topologyPosition)
Translates the bounds in the topology to pixel bounds.- Parameters:
topologyPosition- the position within the topology- Returns:
- the pixle position
-
toPixelPositionAbsolute
Rectangular toPixelPositionAbsolute(Rectangular topologyPosition)
Translates the bounds in the topology to absolute pixel bounds.- Parameters:
topologyPosition- the position within the topology- Returns:
- the pixle position
-
toTopologyX
int toTopologyX(int pixelX)
Translates the X coordinate from pixels to topology position- Parameters:
pixelX- the pixel X coordinate- Returns:
- the topology X coordinate
-
toTopologyY
int toTopologyY(int pixelY)
Translates the Y coordinate from pixels to topology position- Parameters:
pixelY- the pixel Y coordinate- Returns:
- the topology Y coordinate
-
update
void update()
Recomputes the topology. This should be used when the underlying areas have changed (some areas have been added, removed or resized).
-
drawLayout
void drawLayout(OutputDisplay disp)
Graphically displays the topology on a graphical output device.- Parameters:
disp- the ouptut display to be used
-
-