Class StandardGenerator
- java.lang.Object
-
- org.openscience.cdk.renderer.generators.standard.StandardGenerator
-
- All Implemented Interfaces:
IGenerator<IAtomContainer>
public final class StandardGenerator extends Object implements IGenerator<IAtomContainer>
The standard generator createsIRenderingElement
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 asGeneralPath
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 theHIGHLIGHT_COLOR
. The style of highlight is set with theStandardGenerator.Highlighting
parameter. The Standard Generator - CDK Wiki page provides extended details of using and configuring this generator.- Author:
- John May
- See Also:
- Standard Generator - CDK Wiki
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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).
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description StandardGenerator(Font font)
Create a new standard generator that utilises the specified font to display atom symbols.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 aIChemObject
from the chemical data model into something that can be drawn in the chemical drawing.List<IGeneratorParameter<?>>
getParameters()
Returns the list ofIGeneratorParameter
for this particular generator.
-
-
-
Field Detail
-
HIGHLIGHT_COLOR
public static final String 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:
- Constant Field Values
-
ANNOTATION_LABEL
public static final String 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:
- Constant Field Values
-
ITALIC_DISPLAY_PREFIX
public static final String 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:
- Constant Field Values
-
HIDDEN
public static final String HIDDEN
Marks atoms and bonds as being hidden from the actual depiction. Set this property to non-null to indicate this.- See Also:
- Constant Field Values
-
HIDDEN_FULLY
public static final String HIDDEN_FULLY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StandardGenerator
public StandardGenerator(Font font)
Create a new standard generator that utilises the specified font to display atom symbols.- Parameters:
font
- the font family, size, and style
-
-
Method Detail
-
generate
public IRenderingElement generate(IAtomContainer container, RendererModel parameters)
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
public static IRenderingElement embedText(Font font, String text, Color color, double scale)
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
public List<IGeneratorParameter<?>> getParameters()
Returns the list ofIGeneratorParameter
for this particular generator.- Specified by:
getParameters
in interfaceIGenerator<IAtomContainer>
- Returns:
- a
List
ofIGeneratorParameter
s
-
-