public abstract class AbstractAWTDrawVisitor extends Object implements IDrawVisitor
IDrawVisitor
interface for the AWT
widget toolkit, allowing molecules to be rendered with toolkits based on
AWT, like the Java reference graphics platform Swing.Modifier and Type | Field and Description |
---|---|
protected AffineTransform |
transform
This is initially null, and must be set in the setTransform method!
|
Constructor and Description |
---|
AbstractAWTDrawVisitor() |
Modifier and Type | Method and Description |
---|---|
protected Point |
getTextBasePoint(String text,
double xCoord,
double yCoord,
Graphics2D graphics)
Calculates the base point where text should be rendered, as text in Java
is typically placed using the left-lower corner point in screen coordinates.
|
protected Rectangle2D |
getTextBounds(String text,
double xCoord,
double yCoord,
Graphics2D graphics)
Calculates the boundaries of a text string in screen coordinates.
|
protected Rectangle2D |
getTextBounds(String text,
Graphics2D g2)
Obtain the exact bounding box of the
text in the provided
graphics environment. |
void |
setTransform(AffineTransform transform)
Sets a new affine transformation to convert world coordinates into
screen coordinates.
|
void |
transformPoint(double[] xy) |
int[] |
transformPoint(double xCoord,
double yCoord)
Transforms a point according to the current affine transformation,
converting a world coordinate into a screen coordinate.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setFontManager, setRendererModel
visit
protected AffineTransform transform
public int[] transformPoint(double xCoord, double yCoord)
xCoord
- x-coordinate of the world point to transformyCoord
- y-coordinate of the world point to transformpublic void transformPoint(double[] xy)
protected Rectangle2D getTextBounds(String text, double xCoord, double yCoord, Graphics2D graphics)
text
- the text stringxCoord
- the world x-coordinate of where the text should be placedyCoord
- the world y-coordinate of where the text should be placedgraphics
- the graphics to which the text is provided as outputprotected Point getTextBasePoint(String text, double xCoord, double yCoord, Graphics2D graphics)
text
- the text stringxCoord
- the world x-coordinate of where the text should be placedyCoord
- the world y-coordinate of where the text should be placedgraphics
- the graphics to which the text is provided as outputprotected Rectangle2D getTextBounds(String text, Graphics2D g2)
text
in the provided
graphics environment.text
- the text to obtain the bounds ofg2
- the graphic environmentTextLayout
public void setTransform(AffineTransform transform)
setTransform
in interface IRenderingVisitor
transform
- the new AffineTransform
.Copyright © 2018. All Rights Reserved.