Class StandardGenerator
java.lang.Object
org.openscience.cdk.renderer.generators.standard.StandardGenerator
- All Implemented Interfaces:
IGenerator<IAtomContainer>
The standard generator creates
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.- Author:
- John May
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
The color of the atom numbers.static final class
The distance of atom numbers from their parent atom as a percentage of bond length, default value is 0.25 (25%)static final class
Annotation font size relative to element symbols, default = 0.4 (40%).static final class
Defines the color of unselected atoms (and bonds).static final class
Defines the ratio of the separation between lines in double bonds as a percentage of length (BasicSceneGenerator.BondLength
).static final class
The number of sections to render in a dashed 'unknown' bond, default = 4;static final class
Render small delocalised rings as bonds/life buoys? This can sometimes be misleading for fused rings but is commonly used.static final class
Display deuterium[2H]
as 'D'.static final class
Modify bold wedges to be flush with adjacent bonds, default = true.static final class
Modify hashed wedges to be flush when there is a single adjacent bond, default = true.static final class
Indicate delocalised/aromatic bonds should always be rendered, even when there is a valid Kekule structure.static final class
The preferred spacing between lines in hashed bonds.static final class
Parameter defines the style of highlight used to emphasis atoms and bonds.static enum
Enumeration of highlight style.static final class
Whether Major Isotopes e.g.static final class
The width of outer glow as a percentage of stroke width.static final class
The default font style for pseudo-atoms, is Bold and Italic.static final class
How "deep" are brackets drawn.static final class
Scale Sgroup annotations relative to the normal font size (atom symbol).static final class
Defines the ratio of the stroke to the width of the stroke of the font used to depict atom symbols.static final class
Defines the margin between an atom symbol and a connected bond based on the stroke width.static final class
Defines which atoms have their symbol displayed.static final class
The spacing of waves (semi circles) drawn in wavy bonds with.static final class
Ratio of the wide end of wedge compared to the narrow end (stroke width). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Defines the annotation label(s) of a chem object in a depiction.static final String
Marks atoms and bonds as being hidden from the actual depiction.static final String
static final String
Defines that a chem object should be highlighted in a depiction.static final String
A special markup for annotation labels that hints the generator to renderer the annotation label in italic. -
Constructor Summary
ConstructorsConstructorDescriptionStandardGenerator
(Font font) Create a new standard generator that utilises the specified font to display atom symbols. -
Method Summary
Modifier and TypeMethodDescriptionstatic IRenderingElement
Make an embedded text label for display in a CDK renderer.generate
(IAtomContainer container, RendererModel parameters) Converts aIChemObject
from the chemical data model into something that can be drawn in the chemical drawing.Returns the list ofIGeneratorParameter
for this particular generator.
-
Field Details
-
HIGHLIGHT_COLOR
Defines that a chem object should be highlighted in a depiction. Only atom symbols that are displayed are highlighted, the visibility of symbols can be modified withSymbolVisibility
.atom.setProperty(StandardGenerator.HIGHLIGHT_COLOR, Color.RED);
- See Also:
-
ANNOTATION_LABEL
Defines the annotation label(s) of a chem object in a depiction. The annotation must be a string.String number = Integer.toString(1 + container.indexOf(atom)); atom.setProperty(CDKConstants.ANNOTATION_LABEL, number);
- See Also:
-
ITALIC_DISPLAY_PREFIX
A special markup for annotation labels that hints the generator to renderer the annotation label in italic. The primary use case is for Cahn-Ingold-Prelog descriptors.String cipLabel = "R"; atom.setProperty(CDKConstants.ANNOTATION_LABEL, StandardGenerator.ITALIC_DISPLAY_PREFIX + cipLabel);
- See Also:
-
HIDDEN
Marks atoms and bonds as being hidden from the actual depiction. Set this property to non-null to indicate this.- See Also:
-
HIDDEN_FULLY
- See Also:
-
-
Constructor Details
-
StandardGenerator
Create a new standard generator that utilises the specified font to display atom symbols.- Parameters:
font
- the font family, size, and style
-
-
Method Details
-
generate
Converts aIChemObject
from the chemical data model into something that can be drawn in the chemical drawing.- Specified by:
generate
in interfaceIGenerator<IAtomContainer>
- Parameters:
container
- the chemical entity to be depictedparameters
- the rendering parameters- Returns:
- a drawable chemical depiction component
-
embedText
Make an embedded text label for display in a CDK renderer. If a piece of text contains newlines they are centred aligned below each other with a line height of 1.4.- Parameters:
font
- the font to embeddedtext
- the text labelcolor
- the colorscale
- the resize, should include the model scale- Returns:
- pre-rendered element
-
getParameters
Returns the list ofIGeneratorParameter
for this particular generator.- Specified by:
getParameters
in interfaceIGenerator<IAtomContainer>
- Returns:
- a
List
ofIGeneratorParameter
s
-