Interface AreaTopology

  • All Known Implementing Classes:
    AreaListGridTopology, DefaultGridTopology

    public interface AreaTopology
    This 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 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 null when 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 cell
        y - the y coordinate of the grid cell
        Returns:
        the area at the specified position or null when 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 cell
        y - 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