Package cz.vutbr.fit.layout.io
Class Graphics2DDisplay
- java.lang.Object
-
- cz.vutbr.fit.layout.io.Graphics2DDisplay
-
- All Implemented Interfaces:
OutputDisplay
- Direct Known Subclasses:
ImageOutputDisplay
public class Graphics2DDisplay extends Object implements OutputDisplay
An output display implementation that shows the areas on a Graphics2D device.- Author:
- burgetr
-
-
Constructor Summary
Constructors Constructor Description Graphics2DDisplay(Graphics2D g)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearArea(int x, int y, int width, int height)
Clears the given area of the display.void
colorizeByClass(ContentRect rect, String cname)
Draws the colorized are bounds.void
colorizeByTags(ContentRect rect, Set<Tag> s)
Draws the colorized are bounds.void
drawBox(Box box)
Draws the box contents on the page depending on the box type.void
drawConnection(ContentRect a1, ContentRect a2, Color color)
Draws a connection between two content rectangles.void
drawExtent(Area area)
Draws the area bounds at the output display.void
drawExtent(Box box)
Draws the box bounds at the output display.void
drawPage(Page page)
Draws the complete page including all the boxes.void
drawPage(Page page, boolean bitmap)
Draws the complete page by drawing all the boxes or a bitmap screenshot.void
drawRectangle(Rectangular rect, Color color)
Draws the given rectangle with the specified color.Graphics2D
getGraphics()
void
setGraphics(Graphics2D g)
protected void
setupGraphics()
Configures the graphics context for drawing the boxes.protected Color
stringColor(String cname)
-
-
-
Constructor Detail
-
Graphics2DDisplay
public Graphics2DDisplay(Graphics2D g)
-
-
Method Detail
-
getGraphics
public Graphics2D getGraphics()
- Specified by:
getGraphics
in interfaceOutputDisplay
-
setGraphics
public void setGraphics(Graphics2D g)
-
drawPage
public void drawPage(Page page)
Description copied from interface:OutputDisplay
Draws the complete page including all the boxes.- Specified by:
drawPage
in interfaceOutputDisplay
- Parameters:
page
- The page to draw.
-
drawPage
public void drawPage(Page page, boolean bitmap)
Description copied from interface:OutputDisplay
Draws the complete page by drawing all the boxes or a bitmap screenshot.- Specified by:
drawPage
in interfaceOutputDisplay
- Parameters:
page
- The page to draw.bitmap
- Use bitmap page screen shot if available.
-
drawBox
public void drawBox(Box box)
Description copied from interface:OutputDisplay
Draws the box contents on the page depending on the box type. This does not automatically draw the child boxes.- Specified by:
drawBox
in interfaceOutputDisplay
- Parameters:
box
- The box do draw.
-
drawExtent
public void drawExtent(Box box)
Description copied from interface:OutputDisplay
Draws the box bounds at the output display.- Specified by:
drawExtent
in interfaceOutputDisplay
- Parameters:
box
- The box to be displayed
-
drawExtent
public void drawExtent(Area area)
Description copied from interface:OutputDisplay
Draws the area bounds at the output display.- Specified by:
drawExtent
in interfaceOutputDisplay
- Parameters:
area
- The area to be displayed
-
drawRectangle
public void drawRectangle(Rectangular rect, Color color)
Description copied from interface:OutputDisplay
Draws the given rectangle with the specified color.- Specified by:
drawRectangle
in interfaceOutputDisplay
- Parameters:
rect
- the rectangle to be drawncolor
- the drawing color
-
drawConnection
public void drawConnection(ContentRect a1, ContentRect a2, Color color)
Description copied from interface:OutputDisplay
Draws a connection between two content rectangles.- Specified by:
drawConnection
in interfaceOutputDisplay
- Parameters:
a1
- The first content rectanglea2
- The second content rectanglecolor
- Connection color
-
colorizeByTags
public void colorizeByTags(ContentRect rect, Set<Tag> s)
Description copied from interface:OutputDisplay
Draws the colorized are bounds. The color is defined by the tags. Multiple colors should be used when there are multiple tags (e.g. splitting the area bounds to several parts). The output display should assign different colors to different tags; the exact implementation of the color mapping depends on the OutputDisplay implementation. The area is not displayed when the tag set is empty.- Specified by:
colorizeByTags
in interfaceOutputDisplay
- Parameters:
rect
- The area to be displayeds
- A set of tags used for generating the area colors
-
clearArea
public void clearArea(int x, int y, int width, int height)
Description copied from interface:OutputDisplay
Clears the given area of the display.- Specified by:
clearArea
in interfaceOutputDisplay
- Parameters:
x
- the area X coordinatey
- the area Y coordinatewidth
- the area widthheight
- the area height
-
colorizeByClass
public void colorizeByClass(ContentRect rect, String cname)
Description copied from interface:OutputDisplay
Draws the colorized are bounds. The color is defined by a string. The output display should assign different colors to different strings; the exact implementation of the color mapping depends on the OutputDisplay implementation. The area is not displayed when class name is empty.- Specified by:
colorizeByClass
in interfaceOutputDisplay
- Parameters:
rect
- The area to be displayedcname
- The class name used for generating the colors.
-
setupGraphics
protected void setupGraphics()
Configures the graphics context for drawing the boxes. This method is normally called fromdrawPage(Page)
before the actual drawing starts.
-
-