public final class StandardGenerator extends Object implements IGenerator<IAtomContainer>
IRenderingElement
s for the atoms and bonds of a structure
diagram. These are generated together allowing the bonds to drawn cleanly without overlap. The
generate is heavily based on ideas documented in (Jonathan Brecher. Pure Appl. Chem. 2008. 80) and (Clark A.. Molecular Informatics. 2013. 32).
Atom symbols are provided as GeneralPath
outlines. This allows the depiction to be
independent of the system used to view the diagram (primarily important for vector graphic
depictions). The font used to generate the diagram must be provided to the constructor.
Atoms and bonds can be highlighted by setting the HIGHLIGHT_COLOR
. The style of
highlight is set with the StandardGenerator.Highlighting
parameter.
The Standard Generator - CDK Wiki
page provides extended details of using and configuring this generator.Modifier and Type | Class and Description |
---|---|
static class |
StandardGenerator.AnnotationColor
The color of the atom numbers.
|
static class |
StandardGenerator.AnnotationDistance
The distance of atom numbers from their parent atom as a percentage of bond length, default
value is 0.25 (25%)
|
static class |
StandardGenerator.AnnotationFontScale
Annotation font size relative to element symbols, default = 0.4 (40%).
|
static class |
StandardGenerator.AtomColor
Defines the color of unselected atoms (and bonds).
|
static class |
StandardGenerator.BondSeparation
Defines the ratio of the separation between lines in double bonds as a percentage of length
(
BasicSceneGenerator.BondLength ). |
static class |
StandardGenerator.DashSection
The number of sections to render in a dashed 'unknown' bond, default = 4;
|
static class |
StandardGenerator.DelocalisedDonutsBondDisplay
Render small delocalised rings as bonds/life buoys? This can sometimes
be misleading for fused rings but is commonly used.
|
static class |
StandardGenerator.DeuteriumSymbol
Display deuterium
[2H] as 'D'. |
static class |
StandardGenerator.FancyBoldWedges
Modify bold wedges to be flush with adjacent bonds, default = true.
|
static class |
StandardGenerator.FancyHashedWedges
Modify hashed wedges to be flush when there is a single adjacent bond, default = true.
|
static class |
StandardGenerator.ForceDelocalisedBondDisplay
Indicate delocalised/aromatic bonds should always be rendered, even when
there is a valid Kekule structure.
|
static class |
StandardGenerator.HashSpacing
The preferred spacing between lines in hashed bonds.
|
static class |
StandardGenerator.Highlighting
Parameter defines the style of highlight used to emphasis atoms and bonds.
|
static class |
StandardGenerator.HighlightStyle
Enumeration of highlight style.
|
static class |
StandardGenerator.OmitMajorIsotopes
Whether Major Isotopes e.g.
|
static class |
StandardGenerator.OuterGlowWidth
The width of outer glow as a percentage of stroke width.
|
static class |
StandardGenerator.PseudoFontStyle
The default font style for pseudo-atoms, is Bold and Italic.
|
static class |
StandardGenerator.SgroupBracketDepth
How "deep" are brackets drawn.
|
static class |
StandardGenerator.SgroupFontScale
Scale Sgroup annotations relative to the normal font size (atom symbol).
|
static class |
StandardGenerator.StrokeRatio
Defines the ratio of the stroke to the width of the stroke of the font used to depict atom
symbols.
|
static class |
StandardGenerator.SymbolMarginRatio
Defines the margin between an atom symbol and a connected bond based on the stroke width.
|
static class |
StandardGenerator.Visibility
Defines which atoms have their symbol displayed.
|
static class |
StandardGenerator.WaveSpacing
The spacing of waves (semi circles) drawn in wavy bonds with.
|
static class |
StandardGenerator.WedgeRatio
Ratio of the wide end of wedge compared to the narrow end (stroke width).
|
Modifier and Type | Field and Description |
---|---|
static String |
ANNOTATION_LABEL
Defines the annotation label(s) of a chem object in a depiction.
|
static String |
HIDDEN
Marks atoms and bonds as being hidden from the actual depiction.
|
static String |
HIDDEN_FULLY |
static String |
HIGHLIGHT_COLOR
Defines that a chem object should be highlighted in a depiction.
|
static String |
ITALIC_DISPLAY_PREFIX
A special markup for annotation labels that hints the generator to renderer
the annotation label in italic.
|
Constructor and Description |
---|
StandardGenerator(Font font)
Create a new standard generator that utilises the specified font to display atom symbols.
|
Modifier and Type | Method and Description |
---|---|
static IRenderingElement |
embedText(Font font,
String text,
Color color,
double scale)
Make an embedded text label for display in a CDK renderer.
|
IRenderingElement |
generate(IAtomContainer container,
RendererModel parameters)
Converts a
IChemObject from the chemical data model into
something that can be drawn in the chemical drawing. |
List<IGeneratorParameter<?>> |
getParameters()
Returns the list of
IGeneratorParameter for this particular
generator. |
public static final String HIGHLIGHT_COLOR
SymbolVisibility
.
atom.setProperty(StandardGenerator.HIGHLIGHT_COLOR, Color.RED);
public static final String ANNOTATION_LABEL
String number = Integer.toString(1 + container.indexOf(atom));
atom.setProperty(CDKConstants.ANNOTATION_LABEL, number);
public static final String ITALIC_DISPLAY_PREFIX
String cipLabel = "R";
atom.setProperty(CDKConstants.ANNOTATION_LABEL,
StandardGenerator.ITALIC_DISPLAY_PREFIX + cipLabel);
public static final String HIDDEN
public static final String HIDDEN_FULLY
public StandardGenerator(Font font)
font
- the font family, size, and stylepublic IRenderingElement generate(IAtomContainer container, RendererModel parameters)
IChemObject
from the chemical data model into
something that can be drawn in the chemical drawing.generate
in interface IGenerator<IAtomContainer>
container
- the chemical entity to be depictedparameters
- the rendering parameterspublic static IRenderingElement embedText(Font font, String text, Color color, double scale)
font
- the font to embeddedtext
- the text labelcolor
- the colorscale
- the resize, should include the model scalepublic List<IGeneratorParameter<?>> getParameters()
IGeneratorParameter
for this particular
generator.getParameters
in interface IGenerator<IAtomContainer>
List
of IGeneratorParameter
sCopyright © 2022. All rights reserved.