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 voidclearArea(int x, int y, int width, int height)Clears the given area of the display.voidcolorizeByClass(ContentRect rect, String cname)Draws the colorized are bounds.voidcolorizeByTags(ContentRect rect, Set<Tag> s)Draws the colorized are bounds.voiddrawBox(Box box)Draws the box contents on the page depending on the box type.voiddrawConnection(ContentRect a1, ContentRect a2, Color color)Draws a connection between two content rectangles.voiddrawExtent(Area area)Draws the area bounds at the output display.voiddrawExtent(Box box)Draws the box bounds at the output display.voiddrawPage(Page page)Draws the complete page including all the boxes.voiddrawPage(Page page, boolean bitmap)Draws the complete page by drawing all the boxes or a bitmap screenshot.voiddrawRectangle(Rectangular rect, Color color)Draws the given rectangle with the specified color.Graphics2DgetGraphics()voidsetGraphics(Graphics2D g)protected voidsetupGraphics()Configures the graphics context for drawing the boxes.protected ColorstringColor(String cname)
-
-
-
Constructor Detail
-
Graphics2DDisplay
public Graphics2DDisplay(Graphics2D g)
-
-
Method Detail
-
getGraphics
public Graphics2D getGraphics()
- Specified by:
getGraphicsin interfaceOutputDisplay
-
setGraphics
public void setGraphics(Graphics2D g)
-
drawPage
public void drawPage(Page page)
Description copied from interface:OutputDisplayDraws the complete page including all the boxes.- Specified by:
drawPagein interfaceOutputDisplay- Parameters:
page- The page to draw.
-
drawPage
public void drawPage(Page page, boolean bitmap)
Description copied from interface:OutputDisplayDraws the complete page by drawing all the boxes or a bitmap screenshot.- Specified by:
drawPagein 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:OutputDisplayDraws the box contents on the page depending on the box type. This does not automatically draw the child boxes.- Specified by:
drawBoxin interfaceOutputDisplay- Parameters:
box- The box do draw.
-
drawExtent
public void drawExtent(Box box)
Description copied from interface:OutputDisplayDraws the box bounds at the output display.- Specified by:
drawExtentin interfaceOutputDisplay- Parameters:
box- The box to be displayed
-
drawExtent
public void drawExtent(Area area)
Description copied from interface:OutputDisplayDraws the area bounds at the output display.- Specified by:
drawExtentin interfaceOutputDisplay- Parameters:
area- The area to be displayed
-
drawRectangle
public void drawRectangle(Rectangular rect, Color color)
Description copied from interface:OutputDisplayDraws the given rectangle with the specified color.- Specified by:
drawRectanglein 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:OutputDisplayDraws a connection between two content rectangles.- Specified by:
drawConnectionin 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:OutputDisplayDraws 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:
colorizeByTagsin 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:OutputDisplayClears the given area of the display.- Specified by:
clearAreain 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:OutputDisplayDraws 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:
colorizeByClassin 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.
-
-