Skip to content

Commit

Permalink
Allow atom generation to include annotations (e.g. atom numbers).
Browse files Browse the repository at this point in the history
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Sep 8, 2014
1 parent 2694dc6 commit 7b0bd51
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -155,8 +155,10 @@ public StandardGenerator(Font font) {
// the exact font stroke but for now we use the width of the pipe character.
final double fontStroke = new TextOutline("|", font).resize(1 / scale, 1 / scale).getBounds().getWidth();
final double stroke = parameters.get(StrokeRatio.class) * fontStroke;

ElementGroup annotations = new ElementGroup();

AtomSymbol[] symbols = generateAtomSymbols(container, visibility, parameters);
AtomSymbol[] symbols = generateAtomSymbols(container, visibility, parameters, annotations);
IRenderingElement[] bondElements = StandardBondGenerator.generateBonds(container, symbols, parameters, stroke);

Rectangle2D bounds = new Rectangle2D.Double(container.getAtom(0).getPoint2d().x,
Expand Down Expand Up @@ -219,6 +221,9 @@ public StandardGenerator(Font font) {
}
}

/** Annotations are added to the front layer. */
frontLayer.add(annotations);

ElementGroup group = new ElementGroup();

group.add(new Bounds(bounds.getMinX(), bounds.getMinY(),
Expand All @@ -238,7 +243,7 @@ public StandardGenerator(Font font) {
* @param parameters render model parameters
* @return generated atom symbols (can contain null)
*/
private AtomSymbol[] generateAtomSymbols(IAtomContainer container, SymbolVisibility visibility, RendererModel parameters) {
private AtomSymbol[] generateAtomSymbols(IAtomContainer container, SymbolVisibility visibility, RendererModel parameters, ElementGroup annotations) {

final double scale = parameters.get(BasicSceneGenerator.Scale.class);

Expand Down

0 comments on commit 7b0bd51

Please sign in to comment.