Class AWTDrawVisitor
- java.lang.Object
-
- org.openscience.cdk.renderer.visitor.AbstractAWTDrawVisitor
-
- org.openscience.cdk.renderer.visitor.AWTDrawVisitor
-
- All Implemented Interfaces:
IRenderingVisitor,IDrawVisitor
public class AWTDrawVisitor extends AbstractAWTDrawVisitor
Implementation of theIDrawVisitorinterface for the AWT widget toolkit, allowing molecules to be rendered with toolkits based on AWT, like the Java reference graphics platform Swing.- Source code:
- main
- Belongs to CDK module:
- renderawt
-
-
Field Summary
-
Fields inherited from class org.openscience.cdk.renderer.visitor.AbstractAWTDrawVisitor
transform
-
-
Constructor Summary
Constructors Constructor Description AWTDrawVisitor(Graphics2D graphics)Constructs a newIDrawVisitorusing the AWT widget toolkit, taking aGraphics2Dobject to which the chemical content is drawn.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AWTDrawVisitorforVectorGraphics(Graphics2D g2)Create a draw visitor that will be rendering to a vector graphics output.Graphics2DgetGraphics()Returns theGraphics2Dfor for this visitor.RendererModelgetRendererModel()Returns the currentRendererModel.Map<Integer,BasicStroke>getStrokeMap()Returns the current stroke map.voidsetFontManager(IFontManager fontManager)The font manager must be set by any renderer that uses this class! This manager is needed to keep track of fonts of the right size.voidsetRendererModel(RendererModel rendererModel)voidsetRounding(boolean val)Set whether we should we round coordinates to ints, this tries to circumvent graphical glitches from AWT where floating points are truncated (e.g.voidvisit(IRenderingElement element)-
Methods inherited from class org.openscience.cdk.renderer.visitor.AbstractAWTDrawVisitor
getTextBasePoint, getTextBounds, getTextBounds, setTransform, transformPoint, transformPoint
-
-
-
-
Constructor Detail
-
AWTDrawVisitor
public AWTDrawVisitor(Graphics2D graphics)
Constructs a newIDrawVisitorusing the AWT widget toolkit, taking aGraphics2Dobject to which the chemical content is drawn.- Parameters:
graphics-Graphics2Dto which will be drawn
-
-
Method Detail
-
getRendererModel
public RendererModel getRendererModel()
Returns the currentRendererModel.- Returns:
- the current model
-
getStrokeMap
public Map<Integer,BasicStroke> getStrokeMap()
Returns the current stroke map.- Returns:
- a
Mapwith Integer as keys andBasicStrokes.
-
getGraphics
public Graphics2D getGraphics()
Returns theGraphics2Dfor for this visitor.- Returns:
- the
Graphics2Dobject
-
forVectorGraphics
public static AWTDrawVisitor forVectorGraphics(Graphics2D g2)
Create a draw visitor that will be rendering to a vector graphics output. This disables the minimum stroke size and stroke caching when drawing lines.- Parameters:
g2- graphics environment- Returns:
- draw visitor
-
setRounding
public void setRounding(boolean val)
Set whether we should we round coordinates to ints, this tries to circumvent graphical glitches from AWT where floating points are truncated (e.g. 1.6 -> 1) which causes notable defect such as parallel lines that aren't parallel.- Parameters:
val- rounding mode
-
visit
public void visit(IRenderingElement element)
-
setFontManager
public void setFontManager(IFontManager fontManager)
The font manager must be set by any renderer that uses this class! This manager is needed to keep track of fonts of the right size.- Parameters:
fontManager- theIFontManagerto be used
-
setRendererModel
public void setRendererModel(RendererModel rendererModel)
-
-